|
|
@@ -63,14 +63,13 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
public Pagination<ContractManageListBo> getManageList(String contractId, Integer serialNumber, Integer type,
|
|
|
Integer status, String startDateFormattedDate, String endDateFormattedDate, Integer province,
|
|
|
String unitName, String uid, Integer pNo, Integer pSize) {
|
|
|
- Map<String, Object> params = disposeParams(contractId, serialNumber, type,
|
|
|
- status, startDateFormattedDate, endDateFormattedDate, province,
|
|
|
- unitName, uid);
|
|
|
-
|
|
|
+ Map<String, Object> params = disposeParams(contractId, serialNumber, type, status, startDateFormattedDate,
|
|
|
+ endDateFormattedDate, province, unitName, uid);
|
|
|
+
|
|
|
if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
|
|
|
params.put("principal", TokenManager.getAdminId());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (pNo == null || pNo < 0) {
|
|
|
pNo = 1;
|
|
|
}
|
|
|
@@ -86,12 +85,35 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
@SuppressWarnings("unchecked")
|
|
|
@Override
|
|
|
public Pagination<ContractClientListBo> getClientList(String contractId, Integer serialNumber, Integer type,
|
|
|
- Integer status, String startDateFormattedDate, String endDateFormattedDate, Integer pNo, Integer pSize) {
|
|
|
+ Integer status, String startDateFormattedDate, String endDateFormattedDate, String completeStartDate,
|
|
|
+ String completeEndDate, Integer pNo, Integer pSize) {
|
|
|
+
|
|
|
+ Map<String, Object> params = disposeParams(contractId, serialNumber, type, status, startDateFormattedDate,
|
|
|
+ endDateFormattedDate, null, null, TokenManager.getUserId());
|
|
|
|
|
|
- Map<String, Object> params = disposeParams(contractId, serialNumber, type,
|
|
|
- status, startDateFormattedDate, endDateFormattedDate, null,
|
|
|
- null, TokenManager.getUserId());
|
|
|
+ Date lStart = null;
|
|
|
+ Date lEnd = null;
|
|
|
+ if (!StringUtils.isBlank(completeStartDate)) {
|
|
|
+ try {
|
|
|
+ lStart = DateUtils.parseDate(startDateFormattedDate, AFTConstants.YYYYMMDD);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if (null != lStart) {
|
|
|
+ params.put("lStart", lStart);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isBlank(completeEndDate)) {
|
|
|
+ try {
|
|
|
+ lEnd = DateUtils.addDays(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD), 1);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != lEnd) {
|
|
|
+ params.put("lEnd", lEnd);
|
|
|
+ }
|
|
|
|
|
|
if (pNo == null || pNo < 0) {
|
|
|
pNo = 1;
|
|
|
@@ -176,12 +198,12 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
} catch (ParseException e) {
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (null != c.getStatus() && c.getStatus().equals(ContractStatus.CIRCULATION.getCode())) {
|
|
|
c.setStatus(ContractStatus.SIGN.getCode());
|
|
|
flag = true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
c.setSignDate(signDate);
|
|
|
contractMapper.updateByPrimaryKeySelective(c);
|
|
|
|
|
|
@@ -190,7 +212,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
|
|
|
for (int i = 0; i < principals.length; i++) {
|
|
|
ContractLog log = disposeContractLog(c);
|
|
|
- if (flag){
|
|
|
+ if (flag) {
|
|
|
log.setStatus(ContractStatus.CIRCULATION.getCode());
|
|
|
}
|
|
|
log.setPrincipal(principals[i]);
|
|
|
@@ -219,7 +241,6 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
return contractMapper.batchDeleteByPrimaryKey(id);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Contract saveContract(Contract c) {
|
|
|
c.setStatus(ContractStatus.CREATE.getCode());
|
|
|
@@ -229,7 +250,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
contractLogMapper.insert(disposeContractLog(c));
|
|
|
return c;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private ContractLog disposeContractLog(Contract c) {
|
|
|
ContractLog cl = new ContractLog();
|
|
|
cl.setId(UUID.randomUUID().toString());
|
|
|
@@ -245,7 +266,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
cl.setCid(c.getId());
|
|
|
return cl;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private Notice createNotice(Contract c, ContractLog l) {
|
|
|
Contract info = contractMapper.selectByPrimaryKey(c.getId());
|
|
|
|
|
|
@@ -270,7 +291,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
n.setYear(info.getCognizanceYear());
|
|
|
return n;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private Contract disposeContract(Contract c) {
|
|
|
c.setId(UUID.randomUUID().toString());
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
@@ -287,17 +308,14 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
c.setDeletedSign(DeleteStatus.UNDELETE.getCode());
|
|
|
return c;
|
|
|
}
|
|
|
-
|
|
|
- private Map<String, Object> disposeParams(String contractId, Integer serialNumber, Integer type,
|
|
|
- Integer status, String startDateFormattedDate, String endDateFormattedDate, Integer province,
|
|
|
- String unitName, String uid){
|
|
|
+
|
|
|
+ private Map<String, Object> disposeParams(String contractId, Integer serialNumber, Integer type, Integer status,
|
|
|
+ String startDateFormattedDate, String endDateFormattedDate, Integer province, String unitName, String uid) {
|
|
|
Date cStart = null;
|
|
|
Date cEnd = null;
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if (null != serialNumber) {
|
|
|
params.put("serialNumber", serialNumber);
|
|
|
}
|
|
|
@@ -331,7 +349,7 @@ public class ContractServiceImpl extends BaseMybatisDao<ContractMapper> implemen
|
|
|
|
|
|
if (!StringUtils.isBlank(endDateFormattedDate)) {
|
|
|
try {
|
|
|
- cEnd = DateUtils.addDays(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD),1);
|
|
|
+ cEnd = DateUtils.addDays(DateUtils.parseDate(endDateFormattedDate, AFTConstants.YYYYMMDD), 1);
|
|
|
} catch (ParseException e) {
|
|
|
}
|
|
|
}
|