diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index 830ccfbd3..9bd34fcd7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -6857,7 +6857,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl params) { - String cut = (String) params.get("cut");// String ids = (String) params.get("ids");//认证清单id String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id @@ -6882,9 +6881,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl lawsInventoryPlatformEOS = new ArrayList<>(); + List projectCertificationInventoryEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) { - Map map = new HashMap<>(); - List projectLawsInventoryEOS = new ArrayList<>(); //类别 String category = projectCertificationInventoryEO.getCategory(); //检验项目 @@ -6896,52 +6894,170 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl libraryBaseList = projectLibraryBaseList.stream() - .filter(e -> certificationInventoryEO.getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); - //平台件项目库中的认证清单的配置项为平台件项目名称 - String configItemTemp = ""; - if(!libraryBaseList.isEmpty()){ - //配置项 - configItemTemp = libraryBaseList.get(0).getProjectNameId(); + List result = new ArrayList<>(); + //如果车型项目库中的配置项为空或为标配时,不去匹配直接关联 + if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){ + if(!certificationInventoryEOS.isEmpty()){ + result = setData(certificationInventoryEOS, projectCertificationInventoryEOList, projectCertificationInventoryEO); } - //类别 - String categoryTemp = certificationInventoryEO.getCategory(); - //检验项目 - String inspectionItemTemp = certificationInventoryEO.getInspectionItem(); - //编号 - String serialNumberTemp = certificationInventoryEO.getSerialNumber(); - //责任领域 - String dutyTerritoryTemp = certificationInventoryEO.getDutyTerritory(); + }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ + //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 + //如果一致,则用类别,检验项目,编号,责任领域去做匹配 + + List projectCertificationInventoryEOS = new ArrayList<>(); + for (int i = 0; i < certificationInventoryEOS.size(); i++) { + int finalI = i; + List libraryBaseList = projectLibraryBaseList.stream() + .filter(e -> certificationInventoryEOS.get(finalI).getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); + //平台件项目库中的认证清单的配置项为平台件项目名称 + String configItemTemp = ""; + if(!libraryBaseList.isEmpty()){ + //配置项 + configItemTemp = libraryBaseList.get(0).getProjectNameId(); + } + //类别 + String categoryTemp = certificationInventoryEOS.get(i).getCategory(); + //检验项目 + String inspectionItemTemp = certificationInventoryEOS.get(i).getInspectionItem(); + //编号 + String serialNumberTemp = certificationInventoryEOS.get(i).getSerialNumber(); + //责任领域 + String dutyTerritoryTemp = certificationInventoryEOS.get(i).getDutyTerritory(); - if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){ - //如果车型项目库中的配置项为空或为标配时,直接将平台件信息添加到关联表 - setData(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); - }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ - //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 - //如果一致,则用类别,检验项目,编号,责任领域去做匹配 if(configItem.equals(configItemTemp) && category.equals(categoryTemp) && inspectionItem.equals(inspectionItemTemp) && serialNumber.equals(serialNumberTemp) && dutyTerritory.equals(dutyTerritoryTemp)){ - setData(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); + + projectCertificationInventoryEOS.add(certificationInventoryEOS.get(i)); } } + if(!projectCertificationInventoryEOS.isEmpty()){ + result = setData(certificationInventoryEOS, projectCertificationInventoryEOS, projectCertificationInventoryEO); + this.saveOrUpdateBatch(result); + } } } - if(!lawsInventoryPlatformEOS.isEmpty()){ - lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); - } } - private void setData(List lawsInventoryPlatformEOS, ProjectCertificationInventoryEO projectCertificationInventoryEO, ProjectCertificationInventoryEO certificationInventoryEO) { - LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO(); - inventoryPlatformEO.setCreateTime(new Date()); - inventoryPlatformEO.setUpdateTime(new Date()); - inventoryPlatformEO.setLawsInventoryId(projectCertificationInventoryEO.getId()); - inventoryPlatformEO.setPlatformLawsInventoryId(certificationInventoryEO.getId()); - lawsInventoryPlatformEOS.add(inventoryPlatformEO); + private List setData(List certificationInventoryEOS, + List projectCertificationInventoryEOList, + ProjectCertificationInventoryEO projectCertificationInventoryEO) { + List projectCertificationInventoryEOS = new ArrayList<>(); + //设置平台件认证清单数据 + setProjectCertificationInventoryEO(certificationInventoryEOS.get(0), projectCertificationInventoryEO); + projectCertificationInventoryEOS.add(projectCertificationInventoryEO); + + //如果车型项目库中的配置项为空或为标配时,不去匹配直接关联,此时一对多,一指的是车型库认证清单,多指的是平台件认证清单 + //例:一条车型库认证清单对应3条平台件认证清单,此时需要复制两条项目库认证清单,将这两条认证清单中的交付物模板到生产企业名称 + //的字段值替换为平台件认证清单的数据,原有的那条认证清单这部分数据也需要替换 + for (int i = 1; i < certificationInventoryEOS.size(); i++) { + ProjectCertificationInventoryEO certificationInventoryEO = new ProjectCertificationInventoryEO(); + BeanUtils.copyProperties(projectCertificationInventoryEO,certificationInventoryEO); + certificationInventoryEO.setId(UUID.randomUUID().toString().replace("-","")); + //设置平台件认证清单数据 + setProjectCertificationInventoryEO(certificationInventoryEOS.get(i), certificationInventoryEO); + projectCertificationInventoryEOS.add(certificationInventoryEO); + } + return projectCertificationInventoryEOS; } + private void setProjectCertificationInventoryEO(ProjectCertificationInventoryEO certificationInventoryEO, ProjectCertificationInventoryEO projectCertificationInventoryEO) { + //交付物模板-deliverableTemplate + projectCertificationInventoryEO.setDeliverableTemplate(certificationInventoryEO.getDeliverableTemplate()); + //交付物类型-deliverableType + projectCertificationInventoryEO.setDeliverableType(certificationInventoryEO.getDeliverableType()); + //交付结果-deliveryResult + projectCertificationInventoryEO.setDeliveryResult(certificationInventoryEO.getDeliveryResult()); + //截止日期-endTime + projectCertificationInventoryEO.setEndTime(certificationInventoryEO.getEndTime()); + //流程状态-flowStatus + projectCertificationInventoryEO.setFlowStatus(certificationInventoryEO.getFlowStatus()); + //报告编号-reportNumber + projectCertificationInventoryEO.setReportNumber(certificationInventoryEO.getReportNumber()); + //产品型号-productModel + projectCertificationInventoryEO.setProductModel(certificationInventoryEO.getProductModel()); + //生产企业名称-productionEnterpriseName + projectCertificationInventoryEO.setProductionEnterpriseName(certificationInventoryEO.getProductionEnterpriseName()); + } +// public void listPlatform(Map params) { +// String cut = (String) params.get("cut");// +// String ids = (String) params.get("ids");//认证清单id +// String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id +// +// //认证清单数据 +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.in(ProjectCertificationInventoryEO::getId,Arrays.asList(ids.split(","))); +// List certificationInventoryEOList = this.list(wrapper); +// +// //平台件项目对应的认证清单数据 +// LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); +// wrapper1.in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(projectLibraryIds.split(","))); +// List certificationInventoryEOS = this.list(wrapper1); +// +// //平台件项目信息 +// List projectLibraryBaseList = new ArrayList<>(); +// if(!certificationInventoryEOList.isEmpty()){ +// List projectIdList = certificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getProjectLibraryId).distinct().collect(Collectors.toList()); +// LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); +// wrapper2.in(ProjectLibraryBase::getId,projectIdList); +// projectLibraryBaseList = projectLibraryBaseService.list(wrapper2); +// } +// +// List lawsInventoryPlatformEOS = new ArrayList<>(); +// +// for (ProjectCertificationInventoryEO projectCertificationInventoryEO : certificationInventoryEOList) { +// Map map = new HashMap<>(); +// List projectLawsInventoryEOS = new ArrayList<>(); +// //类别 +// String category = projectCertificationInventoryEO.getCategory(); +// //检验项目 +// String inspectionItem = projectCertificationInventoryEO.getInspectionItem(); +// //配置项 +// String configItem = projectCertificationInventoryEO.getConfigItem(); +// //编号 +// String serialNumber = projectCertificationInventoryEO.getSerialNumber(); +// //责任领域 +// String dutyTerritory = projectCertificationInventoryEO.getDutyTerritory(); +// +// for (ProjectCertificationInventoryEO certificationInventoryEO : certificationInventoryEOS) { +// List libraryBaseList = projectLibraryBaseList.stream() +// .filter(e -> certificationInventoryEO.getProjectLibraryId().equals(e.getId())).collect(Collectors.toList()); +// //平台件项目库中的认证清单的配置项为平台件项目名称 +// String configItemTemp = ""; +// if(!libraryBaseList.isEmpty()){ +// //配置项 +// configItemTemp = libraryBaseList.get(0).getProjectNameId(); +// } +// //类别 +// String categoryTemp = certificationInventoryEO.getCategory(); +// //检验项目 +// String inspectionItemTemp = certificationInventoryEO.getInspectionItem(); +// //编号 +// String serialNumberTemp = certificationInventoryEO.getSerialNumber(); +// //责任领域 +// String dutyTerritoryTemp = certificationInventoryEO.getDutyTerritory(); +// +// if(StringUtils.isBlank(configItem) || "标配".equals(configItem)){ +// //如果车型项目库中的配置项为空或为标配时,直接将平台件信息添加到关联表 +// setData(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); +// }else if(StringUtils.isNotBlank(configItem) && !"标配".equals(configItem)){ +// //如果车型项目库中的配置项不为空且不为标配时,如果车型项目库认证清单的配置项与平台件认证清单的配置项不一致,则不再匹配 +// //如果一致,则用类别,检验项目,编号,责任领域去做匹配 +// if(configItem.equals(configItemTemp) +// && category.equals(categoryTemp) +// && inspectionItem.equals(inspectionItemTemp) +// && serialNumber.equals(serialNumberTemp) +// && dutyTerritory.equals(dutyTerritoryTemp)){ +// setData(lawsInventoryPlatformEOS, projectCertificationInventoryEO, certificationInventoryEO); +// } +// } +// } +// } +// if(!lawsInventoryPlatformEOS.isEmpty()){ +// lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS); +// } +// } + }