|
|
@@ -440,7 +440,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean costsAdd(AgreementProductCosts agreementProductCosts) {
|
|
|
+ public boolean costsAdd(List<AgreementProductCosts> agreementProductCostsList) {
|
|
|
//2024-04-26 删除检测非车信息 强制填写费用
|
|
|
//校验非车信息是否存在
|
|
|
// List<PtlAgreementProductCostsAttrLink> nonMotorInsurance = agreementProductCosts.getCostsAttrLinks().stream().filter(x -> x.getAttrCode().equals("NonMotorInsurance")).collect(Collectors.toList());
|
|
|
@@ -452,99 +452,199 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- //添加费用主表信息
|
|
|
- PtlAgreementProductCostsNew ptlAgreementProductCostsNew = new PtlAgreementProductCostsNew();
|
|
|
- BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNew);
|
|
|
- ptlAgreementProductCostsNew.setId(null);
|
|
|
- //设置默认优先级为1
|
|
|
- if(ptlAgreementProductCostsNew.getPriorityLevel() == null)
|
|
|
- {
|
|
|
- ptlAgreementProductCostsNew.setPriorityLevel(1);
|
|
|
- }
|
|
|
- ptlAgreementProductCostsNew.setCreateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
- ptlAgreementProductCostsNew.setCreateBy(BaseController.getUser().getId());
|
|
|
- ptlAgreementProductCostsNew.blank();
|
|
|
- int insert = baseMapper.insert(ptlAgreementProductCostsNew);
|
|
|
-
|
|
|
- //添加费用出口信息
|
|
|
- PtlAgreementProductCostsExport ptlAgreementProductCostsExport = new PtlAgreementProductCostsExport();
|
|
|
- BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsExport);
|
|
|
- ptlAgreementProductCostsExport.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
- ptlAgreementProductCostsExport.setId(null);
|
|
|
- ptlAgreementProductCostsExport.blank();
|
|
|
- ptlAgreementProductCostsExportService.save(ptlAgreementProductCostsExport);
|
|
|
- //保存产品费用历史记录
|
|
|
- PtlAgreementProductCostsNewHistory ptlAgreementProductCostsNewHistory = new PtlAgreementProductCostsNewHistory();
|
|
|
- BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNewHistory);
|
|
|
- //添加费用ID
|
|
|
- ptlAgreementProductCostsNewHistory.setId(IdGenerate.nextId());
|
|
|
- ptlAgreementProductCostsNewHistory.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
- //生成批次ID
|
|
|
- String uuid = IdGenerate.nextId();
|
|
|
- ptlAgreementProductCostsNewHistory.setBatch(uuid);
|
|
|
- ptlAgreementProductCostsNewHistory.setOperatorType("add");
|
|
|
- ptlAgreementProductCostsNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
- ptlAgreementProductCostsNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
- ptlAgreementProductCostsNewHistoryService.save(ptlAgreementProductCostsNewHistory);
|
|
|
- //创建产品费用因子历史记录容器
|
|
|
- List<PtlAgreementProductCostsAttrLinkHistory> costsAttrLinkHistories = new ArrayList<>();
|
|
|
- //遍历费用属性
|
|
|
- List<PtlAgreementProductCostsAttrLink> costsAttrLinks = agreementProductCosts.getCostsAttrLinks();
|
|
|
- List<PtlAgreementProductCostsAttrLink> costsAttrLink = new ArrayList<>();
|
|
|
- List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
|
|
|
- costsAttrLinks.forEach(x -> {
|
|
|
- PtlAgreementProductCostsAttrLinkHistory costsAttrLinkHistory = new PtlAgreementProductCostsAttrLinkHistory();
|
|
|
- //处理中文逗号
|
|
|
- if(x.getMin() != null && x.getMin().contains(","))
|
|
|
- {
|
|
|
- x.setMin(x.getMin().replace(",",","));
|
|
|
- }
|
|
|
- PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().get();
|
|
|
-
|
|
|
- //单独处理车牌号
|
|
|
- if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
|
|
|
-// x.setOperator(x.getDictLabal().getJSONObject(0).getString("parentNumber"));
|
|
|
- x.setOperator("0");
|
|
|
- x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
- x.setId(0);
|
|
|
- costsAttrLink.add(x);
|
|
|
- BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
- //设置产品费用因子历史记录
|
|
|
- costsAttrLinkHistory.setId(null);
|
|
|
- costsAttrLinkHistory.setBatch(uuid);
|
|
|
- costsAttrLinkHistory.setOperatorType("add");
|
|
|
- costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
- costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
- costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
- } else {
|
|
|
- if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio") || (!"0".equals(x.getMin()) && null != x.getMin()) || (!"0".equals(x.getMax()) && null != x.getMax())) {
|
|
|
- if(x.getMin() != null || x.getMax() != null) {
|
|
|
- x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
- x.setId(0);
|
|
|
- costsAttrLink.add(x);
|
|
|
- BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
- //设置产品费用因子历史记录
|
|
|
- costsAttrLinkHistory.setId(null);
|
|
|
- costsAttrLinkHistory.setBatch(uuid);
|
|
|
-
|
|
|
- costsAttrLinkHistory.setOperatorType("add");
|
|
|
- costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
- costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
- costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
+ try {
|
|
|
+ for (AgreementProductCosts agreementProductCosts : agreementProductCostsList) {
|
|
|
+ for (int i = 0; i < agreementProductCosts.getProductId().size(); i++) {
|
|
|
+ PtlAgreementProductCostsNew ptlAgreementProductCostsNew = new PtlAgreementProductCostsNew();
|
|
|
+ BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNew);
|
|
|
+ ptlAgreementProductCostsNew.setId(null);
|
|
|
+ //设置默认优先级为1
|
|
|
+ if (ptlAgreementProductCostsNew.getPriorityLevel() == null) {
|
|
|
+ ptlAgreementProductCostsNew.setPriorityLevel(1);
|
|
|
}
|
|
|
+ ptlAgreementProductCostsNew.setProductId(agreementProductCosts.getProductId().get(i));
|
|
|
+ ptlAgreementProductCostsNew.setProductName(agreementProductCosts.getProductName().get(i));
|
|
|
+ ptlAgreementProductCostsNew.setCreateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
+ ptlAgreementProductCostsNew.setCreateBy(BaseController.getUser().getId());
|
|
|
+ ptlAgreementProductCostsNew.blank();
|
|
|
+ int insert = baseMapper.insert(ptlAgreementProductCostsNew);
|
|
|
+
|
|
|
+ //添加费用出口信息
|
|
|
+ PtlAgreementProductCostsExport ptlAgreementProductCostsExport = new PtlAgreementProductCostsExport();
|
|
|
+ BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsExport);
|
|
|
+ ptlAgreementProductCostsExport.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+ ptlAgreementProductCostsExport.setId(null);
|
|
|
+ ptlAgreementProductCostsExport.blank();
|
|
|
+ ptlAgreementProductCostsExportService.save(ptlAgreementProductCostsExport);
|
|
|
+ //保存产品费用历史记录
|
|
|
+ PtlAgreementProductCostsNewHistory ptlAgreementProductCostsNewHistory = new PtlAgreementProductCostsNewHistory();
|
|
|
+ BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNewHistory);
|
|
|
+ //添加费用ID
|
|
|
+ ptlAgreementProductCostsNewHistory.setId(IdGenerate.nextId());
|
|
|
+ ptlAgreementProductCostsNewHistory.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+ //生成批次ID
|
|
|
+ String uuid = IdGenerate.nextId();
|
|
|
+ ptlAgreementProductCostsNewHistory.setBatch(uuid);
|
|
|
+ ptlAgreementProductCostsNewHistory.setOperatorType("add");
|
|
|
+ ptlAgreementProductCostsNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ ptlAgreementProductCostsNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ ptlAgreementProductCostsNewHistoryService.save(ptlAgreementProductCostsNewHistory);
|
|
|
+ //创建产品费用因子历史记录容器
|
|
|
+ List<PtlAgreementProductCostsAttrLinkHistory> costsAttrLinkHistories = new ArrayList<>();
|
|
|
+ //遍历费用属性
|
|
|
+ List<PtlAgreementProductCostsAttrLink> costsAttrLinks = agreementProductCosts.getCostsAttrLinks();
|
|
|
+ List<PtlAgreementProductCostsAttrLink> costsAttrLink = new ArrayList<>();
|
|
|
+ List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
|
|
|
+ costsAttrLinks.forEach(x -> {
|
|
|
+ PtlAgreementProductCostsAttrLinkHistory costsAttrLinkHistory = new PtlAgreementProductCostsAttrLinkHistory();
|
|
|
+ //处理中文逗号
|
|
|
+ if (x.getMin() != null && x.getMin().contains(",")) {
|
|
|
+ x.setMin(x.getMin().replace(",", ","));
|
|
|
+ }
|
|
|
+ PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().get();
|
|
|
+
|
|
|
+ //单独处理车牌号
|
|
|
+ if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
|
|
|
+// x.setOperator(x.getDictLabal().getJSONObject(0).getString("parentNumber"));
|
|
|
+ x.setOperator("0");
|
|
|
+ x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+ x.setId(0);
|
|
|
+ costsAttrLink.add(x);
|
|
|
+ BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ costsAttrLinkHistory.setId(null);
|
|
|
+ costsAttrLinkHistory.setBatch(uuid);
|
|
|
+ costsAttrLinkHistory.setOperatorType("add");
|
|
|
+ costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
+ } else {
|
|
|
+ if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio") || (!"0".equals(x.getMin()) && null != x.getMin()) || (!"0".equals(x.getMax()) && null != x.getMax())) {
|
|
|
+ if (x.getMin() != null || x.getMax() != null) {
|
|
|
+ x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+ x.setId(0);
|
|
|
+ costsAttrLink.add(x);
|
|
|
+ BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ costsAttrLinkHistory.setId(null);
|
|
|
+ costsAttrLinkHistory.setBatch(uuid);
|
|
|
+
|
|
|
+ costsAttrLinkHistory.setOperatorType("add");
|
|
|
+ costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //保存产品费用因子历史记录
|
|
|
+ ptlAgreementProductCostsAttrLinkHistoryService.saveBatch(costsAttrLinkHistories);
|
|
|
+ ptlAgreementProductCostsAttrLinkService.saveBatch(costsAttrLink);
|
|
|
+ //添加费用因子轨迹
|
|
|
+ ptlAgreementProductCostsTrajectoryService.addCostsTrajectory(ptlAgreementProductCostsNew.getId(), "新增费用因子", BaseController.getUser().getId());
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
- //保存产品费用因子历史记录
|
|
|
- ptlAgreementProductCostsAttrLinkHistoryService.saveBatch(costsAttrLinkHistories);
|
|
|
- ptlAgreementProductCostsAttrLinkService.saveBatch(costsAttrLink);
|
|
|
- //添加费用因子轨迹
|
|
|
- ptlAgreementProductCostsTrajectoryService.addCostsTrajectory(ptlAgreementProductCostsNew.getId(),"新增费用因子",BaseController.getUser().getId());
|
|
|
- return true;
|
|
|
-
|
|
|
+ return true;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// // 单条新增
|
|
|
+// //添加费用主表信息
|
|
|
+// PtlAgreementProductCostsNew ptlAgreementProductCostsNew = new PtlAgreementProductCostsNew();
|
|
|
+// BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNew);
|
|
|
+// ptlAgreementProductCostsNew.setId(null);
|
|
|
+// //设置默认优先级为1
|
|
|
+// if(ptlAgreementProductCostsNew.getPriorityLevel() == null)
|
|
|
+// {
|
|
|
+// ptlAgreementProductCostsNew.setPriorityLevel(1);
|
|
|
+// }
|
|
|
+// ptlAgreementProductCostsNew.setCreateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
+// ptlAgreementProductCostsNew.setCreateBy(BaseController.getUser().getId());
|
|
|
+// ptlAgreementProductCostsNew.blank();
|
|
|
+// int insert = baseMapper.insert(ptlAgreementProductCostsNew);
|
|
|
+//
|
|
|
+// //添加费用出口信息
|
|
|
+// PtlAgreementProductCostsExport ptlAgreementProductCostsExport = new PtlAgreementProductCostsExport();
|
|
|
+// BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsExport);
|
|
|
+// ptlAgreementProductCostsExport.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+// ptlAgreementProductCostsExport.setId(null);
|
|
|
+// ptlAgreementProductCostsExport.blank();
|
|
|
+// ptlAgreementProductCostsExportService.save(ptlAgreementProductCostsExport);
|
|
|
+// //保存产品费用历史记录
|
|
|
+// PtlAgreementProductCostsNewHistory ptlAgreementProductCostsNewHistory = new PtlAgreementProductCostsNewHistory();
|
|
|
+// BeanUtils.copyProperties(agreementProductCosts, ptlAgreementProductCostsNewHistory);
|
|
|
+// //添加费用ID
|
|
|
+// ptlAgreementProductCostsNewHistory.setId(IdGenerate.nextId());
|
|
|
+// ptlAgreementProductCostsNewHistory.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+// //生成批次ID
|
|
|
+// String uuid = IdGenerate.nextId();
|
|
|
+// ptlAgreementProductCostsNewHistory.setBatch(uuid);
|
|
|
+// ptlAgreementProductCostsNewHistory.setOperatorType("add");
|
|
|
+// ptlAgreementProductCostsNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
+// ptlAgreementProductCostsNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+// ptlAgreementProductCostsNewHistoryService.save(ptlAgreementProductCostsNewHistory);
|
|
|
+// //创建产品费用因子历史记录容器
|
|
|
+// List<PtlAgreementProductCostsAttrLinkHistory> costsAttrLinkHistories = new ArrayList<>();
|
|
|
+// //遍历费用属性
|
|
|
+// List<PtlAgreementProductCostsAttrLink> costsAttrLinks = agreementProductCosts.getCostsAttrLinks();
|
|
|
+// List<PtlAgreementProductCostsAttrLink> costsAttrLink = new ArrayList<>();
|
|
|
+// List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = ptlAgreementUndwrtRulesAttrService.getUndwrtRulesAttrList();
|
|
|
+// costsAttrLinks.forEach(x -> {
|
|
|
+// PtlAgreementProductCostsAttrLinkHistory costsAttrLinkHistory = new PtlAgreementProductCostsAttrLinkHistory();
|
|
|
+// //处理中文逗号
|
|
|
+// if(x.getMin() != null && x.getMin().contains(","))
|
|
|
+// {
|
|
|
+// x.setMin(x.getMin().replace(",",","));
|
|
|
+// }
|
|
|
+// PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().get();
|
|
|
+//
|
|
|
+// //单独处理车牌号
|
|
|
+// if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
|
|
|
+//// x.setOperator(x.getDictLabal().getJSONObject(0).getString("parentNumber"));
|
|
|
+// x.setOperator("0");
|
|
|
+// x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+// x.setId(0);
|
|
|
+// costsAttrLink.add(x);
|
|
|
+// BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
+// //设置产品费用因子历史记录
|
|
|
+// costsAttrLinkHistory.setId(null);
|
|
|
+// costsAttrLinkHistory.setBatch(uuid);
|
|
|
+// costsAttrLinkHistory.setOperatorType("add");
|
|
|
+// costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+// costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+// costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
+// } else {
|
|
|
+// if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("radio") || (!"0".equals(x.getMin()) && null != x.getMin()) || (!"0".equals(x.getMax()) && null != x.getMax())) {
|
|
|
+// if(x.getMin() != null || x.getMax() != null) {
|
|
|
+// x.setCostsId(ptlAgreementProductCostsNew.getId());
|
|
|
+// x.setId(0);
|
|
|
+// costsAttrLink.add(x);
|
|
|
+// BeanUtils.copyProperties(x, costsAttrLinkHistory);
|
|
|
+// //设置产品费用因子历史记录
|
|
|
+// costsAttrLinkHistory.setId(null);
|
|
|
+// costsAttrLinkHistory.setBatch(uuid);
|
|
|
+//
|
|
|
+// costsAttrLinkHistory.setOperatorType("add");
|
|
|
+// costsAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+// costsAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+// costsAttrLinkHistories.add(costsAttrLinkHistory);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+// //保存产品费用因子历史记录
|
|
|
+// ptlAgreementProductCostsAttrLinkHistoryService.saveBatch(costsAttrLinkHistories);
|
|
|
+// ptlAgreementProductCostsAttrLinkService.saveBatch(costsAttrLink);
|
|
|
+// //添加费用因子轨迹
|
|
|
+// ptlAgreementProductCostsTrajectoryService.addCostsTrajectory(ptlAgreementProductCostsNew.getId(),"新增费用因子",BaseController.getUser().getId());
|
|
|
+// return true;
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public boolean costsUpdate(AgreementProductCosts agreementProductCosts) {
|
|
|
@@ -767,7 +867,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
agreementProductCosts.setCostsAttrLinks(ptlAgreementProductCostsAttrLink);
|
|
|
agreementProductCosts.setId("0");
|
|
|
|
|
|
- this.costsAdd(agreementProductCosts);
|
|
|
+ this.costsAdd((List<AgreementProductCosts>) agreementProductCosts);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -804,7 +904,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
agreementProductCosts.setCostsAttrLinks(ptlAgreementProductCostsAttrLink);
|
|
|
agreementProductCosts.setId("0");
|
|
|
|
|
|
- this.costsAdd(agreementProductCosts);
|
|
|
+ this.costsAdd((List<AgreementProductCosts>) agreementProductCosts);
|
|
|
}
|
|
|
|
|
|
return true;
|