|
@@ -159,10 +159,9 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
bizWorkOrderDetail.setContractId(bizArchiveInput.getId());
|
|
bizWorkOrderDetail.setContractId(bizArchiveInput.getId());
|
|
newWorkOrderDetails.add(bizWorkOrderDetail);
|
|
newWorkOrderDetails.add(bizWorkOrderDetail);
|
|
// addLoopTasks(workOrder);
|
|
// addLoopTasks(workOrder);
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
// 假设已有该任务 判断是否重建任务 修改任务月数和结束月
|
|
// 假设已有该任务 判断是否重建任务 修改任务月数和结束月
|
|
- if(l.getRedirect() != null && l.getRedirect()) {
|
|
|
|
|
|
+ if (l.getRedirect() != null && l.getRedirect()) {
|
|
// 重建任务将旧任务停止
|
|
// 重建任务将旧任务停止
|
|
workOrders.forEach(v -> v.setIsStop(1));
|
|
workOrders.forEach(v -> v.setIsStop(1));
|
|
changeWorkOrders.addAll(workOrders);
|
|
changeWorkOrders.addAll(workOrders);
|
|
@@ -239,8 +238,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
DateTime startMonth = DateTime.of(v.getStartMonth());
|
|
DateTime startMonth = DateTime.of(v.getStartMonth());
|
|
v.setEndMonth(startMonth.offset(DateField.MONTH, monthNum - 1).toSqlDate());
|
|
v.setEndMonth(startMonth.offset(DateField.MONTH, monthNum - 1).toSqlDate());
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else if (detail != null) {
|
|
|
|
|
|
+ } else if (detail != null) {
|
|
int monthNum = l.getMonthNum() - (detail.getServiceNum() == null ? 0 : detail.getServiceNum()) - (detail.getFreeNum() == null ? 0 : detail.getFreeNum());
|
|
int monthNum = l.getMonthNum() - (detail.getServiceNum() == null ? 0 : detail.getServiceNum()) - (detail.getFreeNum() == null ? 0 : detail.getFreeNum());
|
|
|
|
|
|
if (monthNum == 0) {
|
|
if (monthNum == 0) {
|
|
@@ -265,8 +263,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
// }
|
|
// }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else if (bizArchiveInput.getServiceType().equals(2)) {
|
|
|
|
|
|
+ } else if (bizArchiveInput.getServiceType().equals(2)) {
|
|
List<BizWorkOrder> workOrders = workOrderService.query().eq("company_id", bizArchiveInput.getCompanyId()).eq("contract_id", bizArchiveInput.getId()).eq("is_stop", 0).list();
|
|
List<BizWorkOrder> workOrders = workOrderService.query().eq("company_id", bizArchiveInput.getCompanyId()).eq("contract_id", bizArchiveInput.getId()).eq("is_stop", 0).list();
|
|
// 假设是单次任务 添加该任务
|
|
// 假设是单次任务 添加该任务
|
|
details.forEach(l -> {
|
|
details.forEach(l -> {
|
|
@@ -317,7 +314,8 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
@Override
|
|
@Override
|
|
public boolean save(BizArchiveInput bizArchiveInput) {
|
|
public boolean save(BizArchiveInput bizArchiveInput) {
|
|
// 判断是否重复订单号
|
|
// 判断是否重复订单号
|
|
- if((bizArchiveInput.getFromId() == null || bizArchiveInput.getFromId().equals(0L)) && this.query().eq("from_id", 0L).eq("contract_no", bizArchiveInput.getContractNo()).ne("id", bizArchiveInput.getId() == null ? 0L :bizArchiveInput.getId()).count() > 0) throw new ServiceException("订单号不能重复", HttpStatus.ERROR);
|
|
|
|
|
|
+ if ((bizArchiveInput.getFromId() == null || bizArchiveInput.getFromId().equals(0L)) && this.query().eq("from_id", 0L).eq("contract_no", bizArchiveInput.getContractNo()).ne("id", bizArchiveInput.getId() == null ? 0L : bizArchiveInput.getId()).count() > 0)
|
|
|
|
+ throw new ServiceException("订单号不能重复", HttpStatus.ERROR);
|
|
|
|
|
|
boolean saveStatus = super.save(bizArchiveInput);
|
|
boolean saveStatus = super.save(bizArchiveInput);
|
|
List<BizArchiveInputDetail> bizArchiveInputDetails = bizArchiveInput.getDetails();
|
|
List<BizArchiveInputDetail> bizArchiveInputDetails = bizArchiveInput.getDetails();
|
|
@@ -350,10 +348,11 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
@Override
|
|
@Override
|
|
public boolean updateById(BizArchiveInput bizArchiveInput) {
|
|
public boolean updateById(BizArchiveInput bizArchiveInput) {
|
|
// 判断是否重复订单号
|
|
// 判断是否重复订单号
|
|
- if(this.query()
|
|
|
|
|
|
+ if (this.query()
|
|
.eq("contract_no", bizArchiveInput.getContractNo())
|
|
.eq("contract_no", bizArchiveInput.getContractNo())
|
|
- .eq("tenant_id",bizArchiveInput.getTenantId())
|
|
|
|
- .eq("from_id", 0L).ne("id", bizArchiveInput.getId() == null ? 0L :bizArchiveInput.getId()).count() > 0) throw new ServiceException("订单号不能重复", HttpStatus.ERROR);
|
|
|
|
|
|
+ .eq("tenant_id", bizArchiveInput.getTenantId())
|
|
|
|
+ .eq("from_id", 0L).ne("id", bizArchiveInput.getId() == null ? 0L : bizArchiveInput.getId()).count() > 0)
|
|
|
|
+ throw new ServiceException("订单号不能重复", HttpStatus.ERROR);
|
|
|
|
|
|
boolean saveStatus = super.updateById(bizArchiveInput);
|
|
boolean saveStatus = super.updateById(bizArchiveInput);
|
|
List<BizArchiveInputDetail> bizArchiveInputDetails = bizArchiveInput.getDetails();
|
|
List<BizArchiveInputDetail> bizArchiveInputDetails = bizArchiveInput.getDetails();
|
|
@@ -683,6 +682,9 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
failureMsg.append("<br/>").append(failureNum).append("、客户 ").append(item.getCompanyName()).append(" 不存在");
|
|
failureMsg.append("<br/>").append(failureNum).append("、客户 ").append(item.getCompanyName()).append(" 不存在");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if (item.getDiscountAmount() == null) {
|
|
|
|
+ item.setDiscountAmount(BigDecimal.ZERO);
|
|
|
|
+ }
|
|
archiveInput.setCompanyId(company.getId());
|
|
archiveInput.setCompanyId(company.getId());
|
|
archiveInput.setArchiveCode(String.valueOf(snowflakeIdWorker.nextId()));
|
|
archiveInput.setArchiveCode(String.valueOf(snowflakeIdWorker.nextId()));
|
|
archiveInput.setAmount(item.getAmount());
|
|
archiveInput.setAmount(item.getAmount());
|
|
@@ -698,7 +700,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
// }
|
|
// }
|
|
// 判断下订单总价单价是否和录入相符
|
|
// 判断下订单总价单价是否和录入相符
|
|
// 假设 amount - discountAmount != trueAmount 跳过该订单
|
|
// 假设 amount - discountAmount != trueAmount 跳过该订单
|
|
- if(item.getAmount().subtract(item.getDiscountAmount() == null ? BigDecimal.ZERO : item.getDiscountAmount()).compareTo(item.getTrueAmount()) != 0) {
|
|
|
|
|
|
+ if (item.getAmount().subtract(item.getDiscountAmount() == null ? BigDecimal.ZERO : item.getDiscountAmount()).compareTo(item.getTrueAmount()) != 0) {
|
|
failureNum++;
|
|
failureNum++;
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实际付款金额出错");
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实际付款金额出错");
|
|
continue;
|
|
continue;
|
|
@@ -725,6 +727,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实收金额不等于实际任务金额的和。");
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实收金额不等于实际任务金额的和。");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
if (item.getDiscountAmount().compareTo(keepFreeAccount.add(securityFree).add(housingFundFree).add(returnTaxFree)) != 0) {
|
|
if (item.getDiscountAmount().compareTo(keepFreeAccount.add(securityFree).add(housingFundFree).add(returnTaxFree)) != 0) {
|
|
failureNum++;
|
|
failureNum++;
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append("优惠金额不等于任务优惠金额的和。");
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append("优惠金额不等于任务优惠金额的和。");
|
|
@@ -738,12 +741,12 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
BigDecimal securityMonth = item.getSocialSecurityMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getSocialSecurityMonth());
|
|
BigDecimal securityMonth = item.getSocialSecurityMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getSocialSecurityMonth());
|
|
BigDecimal housingFundMonth = item.getHousingFundMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getHousingFundMonth());
|
|
BigDecimal housingFundMonth = item.getHousingFundMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getHousingFundMonth());
|
|
BigDecimal returnTaxMonth = item.getReturnTaxMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getReturnTaxMonth());
|
|
BigDecimal returnTaxMonth = item.getReturnTaxMonth() == null ? BigDecimal.ZERO : BigDecimal.valueOf(item.getReturnTaxMonth());
|
|
- if(nameCountMap.get(item.getContractNo())>1L){
|
|
|
|
|
|
+ if (nameCountMap.get(item.getContractNo()) > 1L) {
|
|
failureNum++;
|
|
failureNum++;
|
|
failureMsg.append("<br/>").append(failureNum).append("导入的合同编号 ").append(item.getContractNo()).append("不能重复");
|
|
failureMsg.append("<br/>").append(failureNum).append("导入的合同编号 ").append(item.getContractNo()).append("不能重复");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- if(contNOs.contains(item.getContractNo())){
|
|
|
|
|
|
+ if (contNOs.contains(item.getContractNo())) {
|
|
failureNum++;
|
|
failureNum++;
|
|
failureMsg.append("<br/>").append(failureNum).append("合同编号 ").append(item.getContractNo()).append("已存在不能重复导入");
|
|
failureMsg.append("<br/>").append(failureNum).append("合同编号 ").append(item.getContractNo()).append("已存在不能重复导入");
|
|
continue;
|
|
continue;
|
|
@@ -819,7 +822,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setTenantId(tenantId);
|
|
detail.setTenantId(tenantId);
|
|
archiveInputDetails.add(detail);
|
|
archiveInputDetails.add(detail);
|
|
- BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(1L)).findFirst().orElse(null);
|
|
|
|
|
|
+ BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(1L)).findFirst().orElse(null);
|
|
if (workOrder == null) {
|
|
if (workOrder == null) {
|
|
workOrder = new BizWorkOrder();
|
|
workOrder = new BizWorkOrder();
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
@@ -866,7 +869,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setTenantId(tenantId);
|
|
detail.setTenantId(tenantId);
|
|
archiveInputDetails.add(detail);
|
|
archiveInputDetails.add(detail);
|
|
- BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(2L)).findFirst().orElse(null);
|
|
|
|
|
|
+ BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(2L)).findFirst().orElse(null);
|
|
if (workOrder == null) {
|
|
if (workOrder == null) {
|
|
workOrder = new BizWorkOrder();
|
|
workOrder = new BizWorkOrder();
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
@@ -913,7 +916,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setTenantId(tenantId);
|
|
detail.setTenantId(tenantId);
|
|
archiveInputDetails.add(detail);
|
|
archiveInputDetails.add(detail);
|
|
- BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(3L)).findFirst().orElse(null);
|
|
|
|
|
|
+ BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(3L)).findFirst().orElse(null);
|
|
if (workOrder == null) {
|
|
if (workOrder == null) {
|
|
workOrder = new BizWorkOrder();
|
|
workOrder = new BizWorkOrder();
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
@@ -961,7 +964,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setId(snowflakeIdWorker.nextId());
|
|
detail.setTenantId(tenantId);
|
|
detail.setTenantId(tenantId);
|
|
archiveInputDetails.add(detail);
|
|
archiveInputDetails.add(detail);
|
|
- BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(4L)).findFirst().orElse(null);
|
|
|
|
|
|
+ BizWorkOrder workOrder = bizWorkOrders.stream().filter(v -> v.getCompanyId().equals(detail.getCompanyId()) && v.getTaskTypeId().equals(4L)).findFirst().orElse(null);
|
|
if (workOrder == null) {
|
|
if (workOrder == null) {
|
|
workOrder = new BizWorkOrder();
|
|
workOrder = new BizWorkOrder();
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
workOrder.setCompanyId(archiveInput.getCompanyId());
|
|
@@ -1045,7 +1048,7 @@ public class BizArchiveInputServiceImpl extends ServiceImpl<BizArchiveInputMappe
|
|
// }
|
|
// }
|
|
// 金额验证
|
|
// 金额验证
|
|
// 假设 amount - discountAmount != trueAmount 跳过该订单
|
|
// 假设 amount - discountAmount != trueAmount 跳过该订单
|
|
- if(item.getAmount().subtract(item.getDiscountAmount() == null ? BigDecimal.ZERO : item.getDiscountAmount()).compareTo(item.getTrueAmount()) != 0) {
|
|
|
|
|
|
+ if (item.getAmount().subtract(item.getDiscountAmount() == null ? BigDecimal.ZERO : item.getDiscountAmount()).compareTo(item.getTrueAmount()) != 0) {
|
|
failureNum++;
|
|
failureNum++;
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实际付款金额出错");
|
|
failureMsg.append("<br/>").append(failureNum).append("、订单 ").append(item.getContractNo()).append(" 实际付款金额出错");
|
|
continue;
|
|
continue;
|