diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java new file mode 100644 index 000000000..1debeba94 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java @@ -0,0 +1,441 @@ +package com.jero.modules.project.service.editImpl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.jero.modules.project.entity.ProjectLawsInventoryEO; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; +import com.jero.modules.project.enums.InventoryAffirmNodeEnum; +import com.jero.modules.project.enums.TaskStatusEnum; +import com.jero.modules.project.service.IProjectLawsInventoryEOService; +import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; +import com.jero.modules.todoCenter.entity.ProcessInfoEO; +import com.jero.modules.todoCenter.enums.DesignComplianceFlowNodeKeyEnum; +import com.jero.modules.todoCenter.enums.VerifyComplianceFlowNodeKeyEnum; +import com.jero.modules.todoCenter.service.IProcessInfoDetailEOService; +import com.jero.modules.todoCenter.service.IProcessInfoEOService; +import com.jero.modules.wkflow.enums.FlowTypeEnum; +import com.jero.modules.wkflow.feginClient.impl.WorkFlowFeignClientImpl; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 项目库-法规清单-编辑功能实现类 + */ +@Service +public class ProjectLawsInventoryEOEditServiceImpl { + @Autowired + private IProjectLawsInventoryEOService projectLawsInventoryEOService; + @Autowired + private WorkFlowFeignClientImpl workFlowFeignClient; + @Autowired + private IProcessInfoDetailEOService processInfoDetailEOService; + @Autowired + private IProcessInfoEOService processInfoEOService; + + /** + * 处理编辑了法规工程师的逻辑 + * @param newPliEo 新的法规清单对象 + * @param oldPliEoList 旧的法规清单数组 + */ + public void updateRegulationOwner(ProjectLawsInventoryEO newPliEo, List oldPliEoList) { + if (CollectionUtils.isNotEmpty(oldPliEoList)) { + List oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); + pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList); + List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); + if(CollectionUtils.isNotEmpty(pidEoList)){ + List taskIdList = new ArrayList<>(); + List updatePidEoList = new ArrayList<>(); + for (ProjectLawsInventoryEO oldPliEo : oldPliEoList) { + // 清单待校核 + boolean toBeCheckedFlag = ( + StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + ); + // 结果待审查 + boolean toBeReviewedFlag = ( + StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + ); + + // 编辑前、编辑后的法规工程师都不为空。 + boolean regulationOwnerIsNotNull = ( + StringUtils.isNotEmpty(oldPliEo.getRegulationOwnerId()) + && StringUtils.isNotEmpty(newPliEo.getRegulationOwnerId()) + ); + if (regulationOwnerIsNotNull && (toBeCheckedFlag || toBeReviewedFlag)) { + // 如果新的法规工程师不等于旧的法规工程师 将之前的法规工程师的待办任务,转给新的法规工程师办理 + if (!StringUtils.equals(oldPliEo.getRegulationOwnerId(), newPliEo.getRegulationOwnerId())) { + // 过滤出来,清单确认流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 + List qdqrPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.QDQR.getValue()) + && StringUtils.equals(pidEo.getTaskDefinitionKey(), InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey()) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(qdqrPidEoList)) { + qdqrPidEoList.forEach(qdqrPidEo -> { + qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); + }); + updatePidEoList.addAll(qdqrPidEoList); + } + + // 过滤出来,设计符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 + List designFlowPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) + && StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(designFlowPidEoList)) { + designFlowPidEoList.forEach(qdqrPidEo -> { + qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); + }); + updatePidEoList.addAll(designFlowPidEoList); + + taskIdList.addAll(designFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); + } + + // 过滤出来,验证符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 + List verifyFlowPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue()) + && StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(verifyFlowPidEoList)) { + verifyFlowPidEoList.forEach(qdqrPidEo -> { + qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); + }); + updatePidEoList.addAll(verifyFlowPidEoList); + + taskIdList.addAll(verifyFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); + } + } + } + } + if (CollectionUtils.isNotEmpty(updatePidEoList)) { + // 更新组装好的 法规工程师待办任务。 + this.processInfoDetailEOService.updateBatchById(updatePidEoList); + } + if (CollectionUtils.isNotEmpty(taskIdList)) { + String taskIds = String.join(",", taskIdList); + // 更新流程服务办理人 + this.workFlowFeignClient.changeAssigneeBatch(taskIds, newPliEo.getRegulationOwnerId()); + } + } + } +// ProjectLawsInventoryEO projectLawsInventoryOld = this.projectLawsInventoryEOService.queryById(newPliEo.getId()); +// // 清单待校核 +// boolean toBeCheckedFlag = ( +// StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) +// || StringUtils.equals(projectLawsInventoryOld.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) +// ); +// // 结果待审查 +// boolean toBeReviewedFlag = ( +// StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) +// || StringUtils.equals(projectLawsInventoryOld.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) +// ); +// +// // 编辑前、编辑后的法规工程师都不为空。 +// boolean regulationOwnerIsNotNull = ( +// StringUtils.isNotEmpty(projectLawsInventoryOld.getRegulationOwnerId()) +// && StringUtils.isNotEmpty(newPliEo.getRegulationOwnerId()) +// ); +// if (regulationOwnerIsNotNull && (toBeCheckedFlag || toBeReviewedFlag)) { +// // 如果新的法规工程师不等于旧的法规工程师 将之前的法规工程师的待办任务,转给新的法规工程师办理 +// if (!StringUtils.equals(projectLawsInventoryOld.getRegulationOwnerId(), newPliEo.getRegulationOwnerId())) { +// QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); +// pidEoQueryWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, newPliEo.getId()); +// List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); +// if (CollectionUtils.isNotEmpty(pidEoList)) { +// // 过滤出来,清单确认流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 +// List qdqrPidEoList = pidEoList.stream().filter(pidEo -> { +// boolean flag = ( +// StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.QDQR.getValue()) +// && StringUtils.equals(pidEo.getTaskDefinitionKey(), InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey()) +// && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// if (CollectionUtils.isNotEmpty(qdqrPidEoList)) { +// qdqrPidEoList.forEach(qdqrPidEo -> { +// qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); +// }); +// this.processInfoDetailEOService.updateBatchById(qdqrPidEoList); +// } +// +// List taskIdList = new ArrayList<>(); +// +// // 过滤出来,设计符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 +// List designFlowPidEoList = pidEoList.stream().filter(pidEo -> { +// boolean flag = ( +// StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) +// && StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) +// && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// if (CollectionUtils.isNotEmpty(designFlowPidEoList)) { +// designFlowPidEoList.forEach(qdqrPidEo -> { +// qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); +// }); +// this.processInfoDetailEOService.updateBatchById(designFlowPidEoList); +// +// taskIdList.addAll(designFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); +// } +// +// // 过滤出来,验证符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 +// List verifyFlowPidEoList = pidEoList.stream().filter(pidEo -> { +// boolean flag = ( +// StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue()) +// && StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) +// && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) +// ); +// return flag; +// }).collect(Collectors.toList()); +// if (CollectionUtils.isNotEmpty(verifyFlowPidEoList)) { +// verifyFlowPidEoList.forEach(qdqrPidEo -> { +// qdqrPidEo.setUserId(newPliEo.getRegulationOwnerId()); +// }); +// this.processInfoDetailEOService.updateBatchById(verifyFlowPidEoList); +// +// taskIdList.addAll(verifyFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); +// } +// +// if (CollectionUtils.isNotEmpty(taskIdList)) { +// String taskIds = String.join(",", taskIdList); +// // 更新流程服务办理人 +// this.workFlowFeignClient.changeAssigneeBatch(taskIds, newPliEo.getRegulationOwnerId()); +// } +// } +// } +// } + } + + /** + * 处理编辑了责任人的逻辑 + * @param newPliEo 新的法规清单对象 + * @param oldPliEoList 旧的法规清单数组 + */ + public void updateDutyPerson(ProjectLawsInventoryEO newPliEo, List oldPliEoList) { + if (CollectionUtils.isNotEmpty(oldPliEoList)) { + List oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); + pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList); + List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); + if(CollectionUtils.isNotEmpty(pidEoList)){ + List designTaskIdList = new ArrayList<>(); + List verifyTaskIdList = new ArrayList<>(); + List updatePidEoList = new ArrayList<>(); + for (ProjectLawsInventoryEO oldPliEo : oldPliEoList) { + boolean designDutyTaskFlag = ( + StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + // 如果旧符合性责任人不等于新的符合性责任人,并且设计符合性流程状态是 任务待确认、结果待提交、不符合、待追踪。则代表当前任务在责任人身上,需要将旧的责任人待办任务,转给新的责任人。 + if (!StringUtils.equals(newPliEo.getDesignDutyId(), oldPliEo.getDesignDutyId()) && designDutyTaskFlag) { + // 过滤出来,设计符合性流程,并且是责任人操作节点的数据,转办给新的责任人 + List designPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) + && ( + StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.ZRRQR.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.DEZRRQR.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()) + ) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(designPidEoList)){ + designPidEoList.forEach(designPidEo -> { + designPidEo.setUserId(newPliEo.getDesignDutyId()); + }); + updatePidEoList.addAll(designPidEoList); + designTaskIdList.addAll(designPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); + } + } + + boolean verifyDutyTaskFlag = ( + StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ); + // 如果验证符合性流程状态是 任务待确认、结果待提交、不符合、待追踪,则代表当前任务在责任人身上,需要将旧的责任人待办任务,转给新的责任人。 + if (!StringUtils.equals(newPliEo.getVerifyDutyId(), oldPliEo.getVerifyDutyId()) && verifyDutyTaskFlag) { + // 过滤出来,验证符合性流程,并且是责任人操作节点的数据,转办给新的责任人 + List verifyPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue()) + && ( + StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.ZRRQR.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.DEZRRQR.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + ||StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()) + ) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(verifyPidEoList)){ + verifyPidEoList.forEach(verifyPidEo -> { + verifyPidEo.setUserId(newPliEo.getVerifyDutyId()); + }); + updatePidEoList.addAll(verifyPidEoList); + verifyTaskIdList.addAll(verifyPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); + } + } + } + if (CollectionUtils.isNotEmpty(updatePidEoList)) { + // 更新组装好的 责任人待办任务。 + this.processInfoDetailEOService.updateBatchById(updatePidEoList); + } + if (CollectionUtils.isNotEmpty(designTaskIdList)) { + String taskIds = String.join(",", designTaskIdList); + // 更新流程服务办理人 + this.workFlowFeignClient.changeAssigneeBatch(taskIds, newPliEo.getDesignDutyId()); + } + if (CollectionUtils.isNotEmpty(verifyTaskIdList)) { + String taskIds = String.join(",", verifyTaskIdList); + // 更新流程服务办理人 + this.workFlowFeignClient.changeAssigneeBatch(taskIds, newPliEo.getVerifyDutyId()); + } + } + } + } + + /** + * 处理修改设计或验证符合性截止日期的逻辑 + * @param newPliEo 新的法规清单对象 + * @param oldPliEoList 旧的法规清单数组 + */ + public void updateDesignOrVerifyEndTime(ProjectLawsInventoryEO newPliEo, List oldPliEoList) { + if (CollectionUtils.isNotEmpty(oldPliEoList)) { + List oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pidEoQueryWrap = new QueryWrapper<>(); + pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList); + List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); + if (CollectionUtils.isNotEmpty(pidEoList)) { + // 处理设计符合性截止日期 + Date newDesignDueDate = newPliEo.getDesignDueDate(); + if (ObjectUtils.isNotEmpty(newDesignDueDate)) { + this.updateProcessInfoDetailEOEndTimeByDesign(oldPliEoList, pidEoList, newDesignDueDate); + } + + // 处理验证符合性截止日期 + Date newVerifyDueDate = newPliEo.getVerifyDueDate(); + if (ObjectUtils.isNotEmpty(newVerifyDueDate)) { + this.updateProcessInfoDetailEOEndTimeByVerify(oldPliEoList, pidEoList, newVerifyDueDate); + } + } + } + } + + /** + * 修改设计符合性流程明细表截止日期 + * @param oldPliEoList + * @param pidEoList + * @param newDesignDueDate + */ + private void updateProcessInfoDetailEOEndTimeByDesign(List oldPliEoList, List pidEoList, Date newDesignDueDate) { + // 过滤设计符合性截止日期,不等于新的设计符合性截止日期,并且数据状态为(结果待提交、结果待审查、不符合、待追踪)的数据,这四种状态的数据是流程走到了设计符合性确认节点。 + List designPliEOList = oldPliEoList.stream().filter(oldPliEo -> { + boolean flag = ( + !newDesignDueDate.equals(oldPliEo.getDesignDueDate()) + && ( + StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(designPliEOList)) { + // 过滤出来,设计符合性流程,并且是责任人提交交付物、法规工程师审核操作节点的数据,更新截止日期 + List designPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) + && ( + StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) + || StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + || StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()) + ) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(designPidEoList)) { + String processInfoId = designPidEoList.get(0).getProcessInfoId(); + ProcessInfoEO processInfoEO = this.processInfoEOService.queryById(processInfoId); + if(ObjectUtils.isNotEmpty(processInfoEO)){ + processInfoEO.setEndTime(newDesignDueDate); + this.processInfoEOService.updateById(processInfoEO); + } + } + } + } + + /** + * 修改验证符合性流程明细表截止日期 + * @param oldPliEoList + * @param pidEoList + * @param newVerifyDueDate + */ + private void updateProcessInfoDetailEOEndTimeByVerify(List oldPliEoList, List pidEoList, Date newVerifyDueDate) { + // 过滤验证符合性截止日期,不等于新的验证符合性截止日期,并且数据状态为(结果待提交、结果待审查、不符合、待追踪)的数据,这四种状态的数据是流程走到了验证符合性确认节点。 + List verifyPliEOList = oldPliEoList.stream().filter(oldPliEo -> { + boolean flag = ( + !newVerifyDueDate.equals(oldPliEo.getVerifyDueDate()) + && ( + StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.INCONFORMITY.getValue()) + || StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TO_TRACK.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(verifyPliEOList)) { + // 过滤出来,验证符合性流程,并且是责任人提交交付物、法规工程师审核操作节点的数据,更新截止日期 + List verifyPidEoList = pidEoList.stream().filter(pidEo -> { + boolean flag = ( + StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue()) + && ( + StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) + || StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.ZRRTJJFW.getValue()) + || StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.DEZRRTJJFW.getValue()) + ) + && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(verifyPidEoList)) { + String processInfoId = verifyPidEoList.get(0).getProcessInfoId(); + ProcessInfoEO processInfoEO = this.processInfoEOService.queryById(processInfoId); + if(ObjectUtils.isNotEmpty(processInfoEO)){ + processInfoEO.setEndTime(newVerifyDueDate); + this.processInfoEOService.updateById(processInfoEO); + } + } + } + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java index 3ab1ccb10..a4f8afe6d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java @@ -55,6 +55,7 @@ import com.jero.modules.project.entity.*; import com.jero.modules.project.enums.*; import com.jero.modules.project.mapper.*; import com.jero.modules.project.service.*; +import com.jero.modules.project.service.editImpl.ProjectLawsInventoryEOEditServiceImpl; import com.jero.modules.project.util.WordUtil; import com.jero.modules.project.vo.ProjectTaskUrgVo; import com.jero.modules.split.common.FileUnZip; @@ -268,6 +269,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl oldPliQueryWrap = new QueryWrapper<>(); + oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,projectLawsInventoryEO.getId()); + List oldPliEoList = this.list(oldPliQueryWrap); this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO); + // 处理编辑法规工程师的逻辑 + this.editService.updateRegulationOwner(projectLawsInventoryEO,oldPliEoList); + // 处理编辑责任人的逻辑 + this.editService.updateDutyPerson(projectLawsInventoryEO,oldPliEoList); + // 处理修改设计或验证符合性截止日期的逻辑 + this.editService.updateDesignOrVerifyEndTime(projectLawsInventoryEO,oldPliEoList); projectLawsInventoryEO.setUpdateTime(now); ProjectLawsInventoryEO projectLawsInventoryEOCopy = SerializationUtils.clone(projectLawsInventoryEO);//复制 @@ -776,71 +788,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl pidEoQueryWrap = new QueryWrapper<>(); - pidEoQueryWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projectLawsInventoryEO.getId()); - List pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap); - if (CollectionUtils.isNotEmpty(pidEoList)) { - // 过滤出来,清单确认流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 - List qdqrPidEoList = pidEoList.stream().filter(pidEo -> { - boolean flag = ( - StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.QDQR.getValue()) - && StringUtils.equals(pidEo.getTaskDefinitionKey(), InventoryAffirmNodeEnum.REGULATION_OWNER_AUDIT.getKey()) - && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(qdqrPidEoList)) { - qdqrPidEoList.forEach(qdqrPidEo -> { - qdqrPidEo.setUserId(projectLawsInventoryEO.getRegulationOwnerId()); - }); - this.processInfoDetailEOService.updateBatchById(qdqrPidEoList); - } - - List taskIdList = new ArrayList<>(); - - // 过滤出来,设计符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 - List designFlowPidEoList = pidEoList.stream().filter(pidEo -> { - boolean flag = ( - StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.SJFHXSHLC.getValue()) - && StringUtils.equals(pidEo.getTaskDefinitionKey(), DesignComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) - && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(designFlowPidEoList)) { - designFlowPidEoList.forEach(qdqrPidEo -> { - qdqrPidEo.setUserId(projectLawsInventoryEO.getRegulationOwnerId()); - }); - this.processInfoDetailEOService.updateBatchById(designFlowPidEoList); - - taskIdList.addAll(designFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); - } - - // 过滤出来,验证符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师 - List verifyFlowPidEoList = pidEoList.stream().filter(pidEo -> { - boolean flag = ( - StringUtils.equals(pidEo.getFlowType(), FlowTypeEnum.YZFHXSCLC.getValue()) - && StringUtils.equals(pidEo.getTaskDefinitionKey(), VerifyComplianceFlowNodeKeyEnum.FGGCSSH.getValue()) - && StringUtils.equals(pidEo.getStatus(), TaskStatusEnum.NOT_DONE.getValue()) - ); - return flag; - }).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(verifyFlowPidEoList)) { - verifyFlowPidEoList.forEach(qdqrPidEo -> { - qdqrPidEo.setUserId(projectLawsInventoryEO.getRegulationOwnerId()); - }); - this.processInfoDetailEOService.updateBatchById(verifyFlowPidEoList); - - taskIdList.addAll(verifyFlowPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); - } - - if (CollectionUtils.isNotEmpty(taskIdList)) { - String taskIds = String.join(",", taskIdList); - // 更新流程服务办理人 - this.workFlowFeignClient.changeAssigneeBatch(taskIds, projectLawsInventoryEO.getRegulationOwnerId()); - } - } } } } @@ -4376,6 +4323,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); List infoList = list(queryWrapper.in("id", idList)); + for (String id : idList) { + projectLawsInventoryEO.setId(id); + // 发送消息 + this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO); + } + // 处理编辑法规工程师的逻辑 + this.editService.updateRegulationOwner(projectLawsInventoryEO,infoList); + // 处理编辑责任人的逻辑 + this.editService.updateDutyPerson(projectLawsInventoryEO,infoList); + // 处理修改设计或验证符合性截止日期的逻辑 + this.editService.updateDesignOrVerifyEndTime(projectLawsInventoryEO,infoList); + List projectLawsInventoryEOList = new ArrayList<>(); List adds = new ArrayList<>();