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 2063aa759..251ef87fa 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 @@ -196,92 +196,21 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList = new ArrayList<>(); - flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); - flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); QueryWrapper certificationQueryWrap = new QueryWrapper<>(); certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); - certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); - List editEndTimeCertificationInventoryEOS = this.list(certificationQueryWrap); - - // 编辑截至日期发消息 + List oldPciEoList = this.list(certificationQueryWrap); if(projectCertificationInventoryEO.getEndTime() != null){ - editEndTimeCertificationInventoryEOS = editEndTimeCertificationInventoryEOS.stream().filter(certificationInventory -> { - boolean flag = false; - if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ - flag = true; - } - return flag; - }).collect(Collectors.toList()); - - if(CollectionUtils.isNotEmpty(editEndTimeCertificationInventoryEOS)){ - - // 同步更新待办中心-流程明细截止日期 - this.syncProcessInfoDetailEndTime(projectCertificationInventoryEO.getEndTime(),editEndTimeCertificationInventoryEOS); - - ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(editEndTimeCertificationInventoryEOS.get(0).getProjectLibraryId()); - if(ObjectUtils.isNotEmpty(projectLibraryBase)){ - List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); - List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); - - editEndTimeCertificationInventoryEOS.get(0).setEndTime(projectCertificationInventoryEO.getEndTime()); - - this.sendMessageByTemplateId( - editEndTimeCertificationInventoryEOS, - TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), - userIdList, - userInfoList, - projectCertificationInventoryEO.getEndTime(),"" - ); - } - } + // 编辑截至日期处理逻辑 + this.editEndTime(projectCertificationInventoryEO, oldPciEoList); } - - // 如果编辑了责任人,给责任人发消息 if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ - QueryWrapper editDutyPersonCertificationQueryWrap = new QueryWrapper<>(); - editDutyPersonCertificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); - List editDutyPersonCertificationInventoryEOS = this.list(editDutyPersonCertificationQueryWrap); - - editDutyPersonCertificationInventoryEOS = editDutyPersonCertificationInventoryEOS.stream().filter(certificationInventory -> { - boolean flag = false; - if(!StringUtils.equals(certificationInventory.getDutyPerson(),projectCertificationInventoryEO.getDutyPerson())){ - flag = true; - } - return flag; - }).collect(Collectors.toList()); - - if(CollectionUtils.isNotEmpty(editDutyPersonCertificationInventoryEOS)){ - List userIdList = editDutyPersonCertificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); - List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); - this.sendMessageByTemplateId( - editDutyPersonCertificationInventoryEOS, - TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(), - userIdList, - userInfoList, - projectCertificationInventoryEO.getEndTime(),"" - ); - - // 如果责任人有变更,将之前责任人的待办中心任务,移交给新的责任人。 - QueryWrapper detailQueryWrap = new QueryWrapper<>(); - List idList = Arrays.asList(projectCertificationInventoryEO.getId().split(",")); - detailQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId,idList); - detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); - detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus,TaskStatusEnum.NOT_DONE.getValue()); - List taskDefinitionKeyList = new ArrayList<>(); - taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRJSRW.getKey()); - taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRTJRW.getKey()); - detailQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKeyList); - - List processInfoDetailEOList = this.processInfoDetailEOService.list(detailQueryWrap); - if(CollectionUtils.isNotEmpty(processInfoDetailEOList)){ - processInfoDetailEOList.forEach(detail -> { - detail.setUserId(projectCertificationInventoryEO.getDutyPerson()); - }); - this.processInfoDetailEOService.updateBatchById(processInfoDetailEOList); - } - } + // 编辑责任人处理逻辑 + this.editDutyPerson(projectCertificationInventoryEO,oldPciEoList); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){ + // 编辑交付物类型、交付物模板逻辑 + // TODO 此处逻辑需要详细需求。如何操作。 } // 获取编辑前的数据 @@ -453,6 +382,99 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl oldPciEoList) { + // 过滤出来,旧数据的责任人与新修改的责任人不是同一个人,并且流程状态是 任务待确认、结果待提交、审查退回的数据,这三个状态的流程数据在责任人节点。 + List oldPciEos = oldPciEoList.stream().filter(oldPciEo -> { + boolean flag = ( + !StringUtils.equals(oldPciEo.getDutyPerson(), pciEo.getDutyPerson()) + && ( + StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(oldPciEos)) { + List userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + "" + ); + + // 如果责任人有变更,将之前责任人的待办中心任务,移交给新的责任人。 + QueryWrapper detailQueryWrap = new QueryWrapper<>(); + List idList = Arrays.asList(pciEo.getId().split(",")); + detailQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, idList); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.CERTIFICATION_LC.getValue()); + detailQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue()); + List taskDefinitionKeyList = new ArrayList<>(); + taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRJSRW.getKey()); + taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRTJRW.getKey()); + detailQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey, taskDefinitionKeyList); + + List processInfoDetailEOList = this.processInfoDetailEOService.list(detailQueryWrap); + if (CollectionUtils.isNotEmpty(processInfoDetailEOList)) { + processInfoDetailEOList.forEach(detail -> { + detail.setUserId(pciEo.getDutyPerson()); + }); + this.processInfoDetailEOService.updateBatchById(processInfoDetailEOList); + } + } + } + + /** + * 编辑截止日期处理逻辑 + * @param newPciEo 最新编辑的认证清单信息 + * @param oldPciEoList 旧的认证清单数组 + */ + private void editEndTime(ProjectCertificationInventoryEO newPciEo, List oldPciEoList) { + Date newEndTime = newPciEo.getEndTime(); + // 过滤出来,旧的截止日期不等于更改后的新截止日期,并且数据状态为 任务待确认、结果待提交、审查退回的数据。 + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newEndTime.equals(pldPciEo.getEndTime()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + // 同步更新待办中心-流程明细截止日期 + this.syncProcessInfoDetailEndTime(newEndTime, oldPciEos); + + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + oldPciEos.get(0).setEndTime(newPciEo.getEndTime()); + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), + userIdList, + userInfoList, + newEndTime, + "" + ); + } + } + } + /** * 通过id删除 * @@ -1080,6 +1102,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl issue(JSONObject json) { String ids = json.getString("ids"); + String projectLibraryId = json.getString("projectLibraryId"); if(StringUtils.isEmpty(ids)){ throw new JeroBootException("至少选择一条数据进行发布!"); } @@ -1118,10 +1141,23 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList)){ + List inventoryVerifyEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getInventoryVerifyEndTime).distinct().collect(Collectors.toList()); + inventoryVerifyEndTimeList.add(inventoryVerifyEndTime); + Collections.sort(inventoryVerifyEndTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 + inventoryVerifyEndTime = inventoryVerifyEndTimeList.get(0); + } - String projectLibraryId = json.getString("projectLibraryId"); // 获取项目信息,获取认证工程师,给认证工程师分配待办任务 ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId); if(ObjectUtils.isNotEmpty(projectLibraryBase)){ @@ -1164,7 +1200,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); @@ -1174,6 +1209,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerUserInfoList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + Date finalInventoryVerifyEndTime = inventoryVerifyEndTime; certificationEngineerIdList.forEach(userId -> { try { String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerUserInfoList,userId); @@ -1187,7 +1223,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + // 获取当前项目下,认证清单,截止日期最早的一个,更新到流程明细表中,认证工程师审查任务节点的截止时间中 + flowStatusList.clear(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + this.updateProcessInfoDetailEndTime( + flowStatusList, + CertificationFlowNodeEnum.RZGCSSC.getKey(), + projectLibraryBase, + "end_time", + idList + ); try { // 给责任人分配待办中心的任务 List processInfoDetailEOList = new ArrayList<>(); @@ -1914,6 +1961,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); + + // 获取当前项目下,认证清单,截止日期最早的一个,更新到流程明细表中,认证工程师审查任务节点的截止时间中 + this.updateProcessInfoDetailEndTime( + flowStatusList, + CertificationFlowNodeEnum.RZGCSSC.getKey(), + projectLibraryBase, + "end_time", + idList + ); try { // 更新数据状态为 审查通过 this.updateBatchById(projectCertificationInventoryEOList); @@ -1943,6 +1999,45 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList, + String taskDefinitionKey, + ProjectLibraryBase projectLibraryBase, + String orderByField, + List excludeIdList) { + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryBase.getId()); + pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus, flowStatusList); + if(CollectionUtils.isNotEmpty(excludeIdList)){ + pciQueryWrap.lambda().notIn(ProjectCertificationInventoryEO::getId, excludeIdList); + } + pciQueryWrap.orderByAsc(orderByField); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList)){ + Date endTime = null; + if(StringUtils.equals("inventory_verify_end_time",orderByField)){ + endTime = pciEoList.get(0).getInventoryVerifyEndTime(); + } else if(StringUtils.equals("end_time",orderByField)){ + endTime = pciEoList.get(0).getEndTime(); + } + + QueryWrapper detailQueryWrapper = new QueryWrapper<>(); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKey); + List detailEOList = this.processInfoDetailEOService.list(detailQueryWrapper); + Date finalEndTime = endTime; + detailEOList.forEach(detailEO -> { + detailEO.setEndTime(finalEndTime); + }); + this.processInfoDetailEOService.updateBatchById(detailEOList); + } + } + /** * 更新任务状态为已办 * @param projectLibraryBase @@ -2006,6 +2101,27 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId()); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + pciQueryWrap.lambda().isNotNull(ProjectCertificationInventoryEO::getEndTime); + List pciEoList = this.list(pciQueryWrap); + if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + List endTimeList = new ArrayList<>(); + // 本次提交之前数据库里面存在的截止时间 + List oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); + endTimeList.addAll(oldEndTimeList); + // 当前要提交的数据截止时间 + List newEndTimeList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList()); + endTimeList.addAll(newEndTimeList); + + endTimeList = endTimeList.stream().distinct().collect(Collectors.toList()); + Collections.sort(endTimeList, (d1, d2) -> d1.compareTo(d2)); // 根据时间顺序排序 + endTime = endTimeList.get(0); + } + List processInfoDetailEOList = new ArrayList<>(); List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); // 给认证工程师分配任务 @@ -2018,7 +2134,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pidEoListTemp = pidEoList.stream().filter(pidEo -> { boolean flag = ( StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java index 31310bd3a..b025ab31d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLibraryBaseServiceImpl.java @@ -439,46 +439,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl originalCertificationEngineerIdList = Arrays.asList(original.getCertificationEngineer().split(",")); - List newCertificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); - - originalCertificationEngineerIdList = originalCertificationEngineerIdList.stream().filter(originalCertificationEngineerId -> { - boolean flag = true; - for (String newCertificationEngineerId : newCertificationEngineerIdList) { - // 如果新传进来的 认证工程师id跟现有的认证工程师id一致,不用发消息 - if(StringUtils.equals(newCertificationEngineerId,originalCertificationEngineerId)){ - flag = false; - break; - } - } - return flag; - }).collect(Collectors.toList()); - - if(CollectionUtils.isNotEmpty(originalCertificationEngineerIdList)){ - // 判断当前项目下是否还有需要认证工程师操作的数据 只有清单待校核、结果待审查 这两个状态的数据由认证工程师操作。 - List flowStatusList = new ArrayList<>(); - flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); - flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); - - QueryWrapper certificationInventoryEOQueryWrapper = new QueryWrapper<>(); - certificationInventoryEOQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId()); - certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); - List projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper); - if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ - this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); - List userInfoList = this.sysUserService.querySysUserListByIdList(originalCertificationEngineerIdList); - this.projectCertificationInventoryEOService.sendMessageByTemplateId( - projectCertificationInventoryEOList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE13.getValue(), - originalCertificationEngineerIdList, - userInfoList, - projectCertificationInventoryEOList.get(0).getEndTime(),"" - ); - } - } + this.editCertificationEngineer(projectLibraryBase, original); } - setRzlcCertificationEngineerTask(projectLibraryBase); checkExitData(projectLibraryBase); saveOrUpdate(projectLibraryBase); checkVersionOrder(projectLibraryBase.getParentId(),projectLibraryBase.getProjectVersion(),projectLibraryBase.getId()); @@ -704,6 +667,53 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl oldCertificationEngineerIdList = Arrays.asList(oldPlbEO.getCertificationEngineer().split(",")); + List newCertificationEngineerIdList = Arrays.asList(newPlbEO.getCertificationEngineer().split(",")); + + oldCertificationEngineerIdList = oldCertificationEngineerIdList.stream().filter(originalCertificationEngineerId -> { + boolean flag = true; + for (String newCertificationEngineerId : newCertificationEngineerIdList) { + // 如果新传进来的 认证工程师id跟现有的认证工程师id一致,不用发消息 + if(StringUtils.equals(newCertificationEngineerId,originalCertificationEngineerId)){ + flag = false; + break; + } + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldCertificationEngineerIdList)){ + // 判断当前项目下是否还有需要认证工程师操作的数据 只有清单待校核、结果待审查 这两个状态的数据由认证工程师操作。 + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()); + + QueryWrapper certificationInventoryEOQueryWrapper = new QueryWrapper<>(); + certificationInventoryEOQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, newPlbEO.getId()); + certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper); + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + List userInfoList = this.sysUserService.querySysUserListByIdList(oldCertificationEngineerIdList); + this.projectCertificationInventoryEOService.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE13.getValue(), + oldCertificationEngineerIdList, + userInfoList, + projectCertificationInventoryEOList.get(0).getEndTime(),"" + ); + } + } + + this.setRzlcCertificationEngineerTask(newPlbEO); + } + /** * 重新设置认证工程师在待办中心的 认证流程的 待办任务。 * @param projectLibraryBase @@ -727,11 +737,23 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl pidRemoveWrap = new QueryWrapper<>(); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); - this.processInfoDetailEOService.remove(pidRemoveWrap); + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + pidQueryWrap.orderByAsc("end_time"); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + if(CollectionUtils.isNotEmpty(pidEoList)){ + List pidEoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getId).distinct().collect(Collectors.toList()); + this.processInfoDetailEOService.deleteByIds(pidEoIdList); + } + + // 获取责任确认截止时间 最早的时间 + this.projectCertificationInventoryEOService.certificationInventoryEOListSortByTaskConfirmEndTimeAsc(pciToBeCheckedList); + Date endTime = pciToBeCheckedList.get(0).getInventoryVerifyEndTime(); + if(ObjectUtils.isEmpty(endTime)){ + endTime = pidEoList.get(0).getEndTime(); + } // 给认证工程师分配任务 List processInfoDetailEOList = new ArrayList<>(); @@ -744,6 +766,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl pidRemoveWrap = new QueryWrapper<>(); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey()); - pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); - this.processInfoDetailEOService.remove(pidRemoveWrap); + QueryWrapper pidQueryWrap = new QueryWrapper<>(); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey()); + pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); + pidQueryWrap.orderByAsc("end_time"); + List pidEoList = this.processInfoDetailEOService.list(pidQueryWrap); + + // 获取截止日期最早的一天。 + this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(pciToBeReviewEDList); + Date endTime = pciToBeReviewEDList.get(0).getEndTime(); + if(CollectionUtils.isNotEmpty(pidEoList)){ + endTime = pidEoList.get(0).getEndTime(); + + List pidEoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getId).distinct().collect(Collectors.toList()); + this.processInfoDetailEOService.deleteByIds(pidEoIdList); + } // 给认证工程师分配任务 List processInfoDetailEOList = new ArrayList<>(); @@ -777,6 +811,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl