diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/StringUtils.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/StringUtils.java index 2bdee5f69..0b16825d9 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/StringUtils.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/util/StringUtils.java @@ -5,6 +5,7 @@ import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * @Author: liyawei @@ -129,5 +130,18 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { return String.valueOf(param); } } + + /** + * 字符串去重 + * @param values + * @return + */ + public static String strDistinct(String values){ + String result = ""; + if (StringUtils.isNotEmpty(values)) { + result = Arrays.asList(values.split(",")).stream().distinct().collect(Collectors.joining(",")); + } + return result; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java index faccdc37e..1f69ce4a9 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/IParamsManifestEOService.java @@ -1,5 +1,6 @@ package com.jero.modules.cert.collect.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -7,6 +8,7 @@ import com.jero.modules.cert.collect.entity.ParamsManifestEO; import com.jero.modules.cert.collect.vo.ParamsManifestHistoryVO; import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.template.entity.ParamsTemplateEO; +import com.jero.modules.system.entity.SysDictItem; import java.util.List; import java.util.Map; @@ -99,4 +101,17 @@ public interface IParamsManifestEOService extends IService { boolean setTemplateName(List paramsTemplateIds); boolean updateModel(String mid,String version, String cid); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /** + * 替换用户 + * @param json + */ + void replacementUser(JSONObject json); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java index ab57f651d..1f2dfcac3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsManifestEOServiceImpl.java @@ -2,7 +2,9 @@ package com.jero.modules.cert.collect.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -36,6 +38,7 @@ import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.cert.template.service.IParamsInfoPublishEOService; import com.jero.modules.cert.template.service.IParamsTemplateEOService; import com.jero.modules.enums.DictCodeEnum; +import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.entity.ProjectRelatedPersonnel; import com.jero.modules.project.service.IProjectLibraryBaseService; import com.jero.modules.project.service.IProjectRelatedPersonnelService; @@ -56,14 +59,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; /** @@ -1135,4 +1131,89 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String userName = (String) params.get("userName"); + String projectLibraryId = (String) params.get("projectLibraryId"); + String parentId = (String) params.get("parentId"); + if(StringUtils.isNotEmpty(parentId)){ + projectLibraryId = parentId; + } + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + + QueryWrapper pmQueryWrap = new QueryWrapper<>(); + pmQueryWrap.lambda().like(ParamsManifestEO::getProjectId,projectLibraryId); + List pmEoList = this.list(pmQueryWrap); + if (CollectionUtils.isNotEmpty(pmEoList)) { + List pmEoIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pcmQueryWrap = new QueryWrapper<>(); + pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList); + pcmQueryWrap.and(pcmQuery -> { + pcmQuery.lambda().eq(ParamsCollectManifestEO::getDre,userName).or().eq(ParamsCollectManifestEO::getSdt,userName); + }); + List pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); + if(CollectionUtils.isNotEmpty(pcmEoList)){ + List dutyTerritoryIdList = pcmEoList.stream().map(ParamsCollectManifestEO::getDutyTerritory).distinct().collect(Collectors.toList()); + + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (org.apache.commons.lang3.StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + } + return result; + } + + @Override + public void replacementUser(JSONObject json) { + String userName = json.getString("userName"); + String projectLibraryId = json.getString("projectLibraryId"); + String parentId = json.getString("parentId"); + if(StringUtils.isNotEmpty(parentId)){ + projectLibraryId = parentId; + } + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper pmQueryWrap = new QueryWrapper<>(); + pmQueryWrap.lambda().like(ParamsManifestEO::getProjectId,projectLibraryId); + List pmEoList = this.list(pmQueryWrap); + if (CollectionUtils.isNotEmpty(pmEoList)) { + List pmEoIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList()); + QueryWrapper pcmQueryWrap = new QueryWrapper<>(); + pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList); + List pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); + if(CollectionUtils.isNotEmpty(pcmEoList)){ + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserName = (String) replacementUserMap.get("newUserName"); + if (StringUtils.isNotEmpty(newUserName)) { + for (ParamsCollectManifestEO pcmEo : pcmEoList) { + if (StringUtils.equals(pcmEo.getDutyTerritory(), dutyTerritory) && !StringUtils.equals(pcmEo.getState(),CollectManifestStateEnum.SYNC_REPORT.getValue())) { + if (StringUtils.equals(pcmEo.getDre(), userName)) { + pcmEo.setDre(newUserName); + } + if (StringUtils.equals(pcmEo.getSdt(), userName)) { + pcmEo.setSdt(newUserName); + } + updateEoList.add(pcmEo); + } + } + } + } + if(CollectionUtils.isNotEmpty(updateEoList)){ + this.paramsCollectManifestEOService.updateBatchById(updateEoList); + } + } + } + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java index b870ca39e..13dc0cc81 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectLibraryBaseController.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.vo.DictModel; import com.jero.modules.project.entity.ProjectLibraryBase; import com.jero.modules.project.service.IProjectLibraryBaseService; import io.swagger.annotations.Api; @@ -291,4 +292,19 @@ public class ProjectLibraryBaseController extends JeroController params) { this.projectLibraryBaseService.exportProjectProgressStatisticsXls(response,request, params); } + + @AutoLog(value = "获取用户在该项目中所有的责任领域") + @ApiOperation(value="获取用户在该项目中所有的责任领域", notes="获取用户在该项目中所有的责任领域") + @GetMapping(value = "/getUserAllDutyTerritoryList") + public Result> getUserAllDutyTerritoryList(@RequestParam Map params){ + List resList = this.projectLibraryBaseService.getUserAllDutyTerritoryList(params); + return Result.OK(resList); + } + + @AutoLog(value = "全局替换用户") + @ApiOperation(value="全局替换用户", notes="全局替换用户") + @PostMapping(value = "/overallReplacementUser") + public Result overallReplacementUser(@RequestBody JSONObject json){ + return this.projectLibraryBaseService.overallReplacementUser(json); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java index 4c99ee3a5..de028cf67 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java @@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.api.vo.Result; +import com.jero.common.system.vo.DictModel; import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.baomidou.mybatisplus.extension.service.IService; import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysRole; import com.jero.modules.system.entity.SysUser; import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; @@ -317,4 +319,17 @@ public interface IProjectCertificationInventoryEOService extends IService editEndTimeCertificationInventoryEOS); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /** + * 替换用户 + * @param json + */ + void replacementUser(JSONObject json); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java index 208d148fb..f4e393ca5 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.itextpdf.text.DocumentException; import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.MessageTypeEnum; +import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; import com.jero.modules.feishu.vo.FeishuMsgVo; import com.jero.modules.project.entity.ProjectLawsInventoryEO; @@ -308,4 +309,17 @@ public interface IProjectLawsInventoryEOService extends IService queryPage(ProjectLawsInventoryEO projectLawsInventoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req); Result finalizationVerify(Map params); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /*** + * 替换用户 + * @param params + */ + void replacementUser(JSONObject json); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java index 34ea29c85..b5009e368 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLibraryBaseService.java @@ -1,8 +1,11 @@ package com.jero.modules.project.service; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.jero.common.api.vo.Result; +import com.jero.common.system.vo.DictModel; import com.jero.modules.project.entity.ProjectLibraryBase; import javax.servlet.http.HttpServletRequest; @@ -167,4 +170,18 @@ public interface IProjectLibraryBaseService extends IService * @param params */ void exportProjectProgressStatisticsXls(HttpServletResponse response, HttpServletRequest request, Map params); + + /** + * 获取用户在该项目中所有的责任领域数组 + * @param params + * @return + */ + List getUserAllDutyTerritoryList(Map params); + + /** + * 全局替换用户 + * @param json + * @return + */ + Result overallReplacementUser(JSONObject json); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectRelatedPersonnelService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectRelatedPersonnelService.java index 9e34642b4..6e9f292bc 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectRelatedPersonnelService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectRelatedPersonnelService.java @@ -1,8 +1,11 @@ package com.jero.modules.project.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.IService; import com.jero.common.api.vo.Result; +import com.jero.common.system.vo.DictModel; import com.jero.modules.project.entity.ProjectRelatedPersonnel; +import com.jero.modules.system.entity.SysDictItem; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.web.multipart.MultipartFile; @@ -103,4 +106,17 @@ public interface IProjectRelatedPersonnelService extends IService> queryLawEngineerByProjectId(Map params); List> queryEngineeringInterfacePersonByProjectId(Map params); + + /** + * 获取用户的责任领域数组 + * @param params + * @return + */ + List getUserDutyTerritoryList(Map params); + + /** + * 替换用户 + * @param json + */ + void replacementUser(JSONObject json); } 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..90140d596 --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/editImpl/ProjectLawsInventoryEOEditServiceImpl.java @@ -0,0 +1,445 @@ +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) { + if(StringUtils.isNotEmpty(newPliEo.getDesignDutyId())){ + 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())); + } + } + } + + if(StringUtils.isNotEmpty(newPliEo.getVerifyDutyId())){ + 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/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index 41a690f71..ef80a517b 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 @@ -18,6 +18,7 @@ import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.DateUtils; import com.jero.common.util.oss.CosBootUtil; @@ -196,92 +197,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 +383,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删除 * @@ -612,45 +635,58 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList = new ArrayList<>(); - flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); - - QueryWrapper certificationQueryWrap = new QueryWrapper<>(); - certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); -// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); - List projectCertificationInventoryEOS = this.list(certificationQueryWrap); - - if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){ - List pciEoListTemp = projectCertificationInventoryEOS.stream().filter(certificationInventory -> { - boolean flag = false; - if(StringUtils.equals(certificationInventory.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ - if(projectCertificationInventoryEO.getEndTime() != null && certificationInventory.getEndTime() != null){ - if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ - flag = true; - } - } - } - return flag; - }).collect(Collectors.toList()); - - if (CollectionUtils.isNotEmpty(pciEoListTemp)) { - ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(pciEoListTemp.get(0).getProjectLibraryId()); - if(ObjectUtils.isNotEmpty(projectLibraryBase)){ - List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); - List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); - - this.sendMessageByTemplateId( - pciEoListTemp, - TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), - userIdList, - userInfoList, - projectCertificationInventoryEO.getEndTime(),"" - ); - } - } - - this.syncProcessInfoDetailEndTime(projectCertificationInventoryEO.getEndTime(),projectCertificationInventoryEOS); + if(projectCertificationInventoryEO.getEndTime() != null){ + // 编辑截至日期处理逻辑 + this.editEndTime(projectCertificationInventoryEO, pciEoList); } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ + // 编辑责任人处理逻辑 + this.editDutyPerson(projectCertificationInventoryEO,pciEoList); + } + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){ + // 编辑交付物类型、交付物模板逻辑 + // TODO 此处逻辑需要详细需求。如何操作。 + } + +// List flowStatusList = new ArrayList<>(); +// flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); +// +// QueryWrapper certificationQueryWrap = new QueryWrapper<>(); +// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); +//// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); +// List projectCertificationInventoryEOS = this.list(certificationQueryWrap); +// +// if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){ +// List pciEoListTemp = projectCertificationInventoryEOS.stream().filter(certificationInventory -> { +// boolean flag = false; +// if(StringUtils.equals(certificationInventory.getFlowStatus(),CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ +// if(projectCertificationInventoryEO.getEndTime() != null && certificationInventory.getEndTime() != null){ +// if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ +// flag = true; +// } +// } +// } +// return flag; +// }).collect(Collectors.toList()); +// +// if (CollectionUtils.isNotEmpty(pciEoListTemp)) { +// ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(pciEoListTemp.get(0).getProjectLibraryId()); +// if(ObjectUtils.isNotEmpty(projectLibraryBase)){ +// List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); +// List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); +// +// this.sendMessageByTemplateId( +// pciEoListTemp, +// TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), +// userIdList, +// userInfoList, +// projectCertificationInventoryEO.getEndTime(),"" +// ); +// } +// } +// +// this.syncProcessInfoDetailEndTime(projectCertificationInventoryEO.getEndTime(),projectCertificationInventoryEOS); +// } if(CollectionUtils.isNotEmpty(updateList)){ this.updateBatchById(updateList); } @@ -1080,6 +1116,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 +1155,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 +1214,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); @@ -1174,6 +1223,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 +1237,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 +1975,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 +2013,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 +2115,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 +2148,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pidEoListTemp = pidEoList.stream().filter(pidEo -> { boolean flag = ( StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId) @@ -6091,5 +6230,83 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String projectLibraryId = (String) params.get("projectLibraryId"); + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); + pciQueryWrap.and(pciQuery -> { + pciQuery.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,userId) + .or().eq(ProjectCertificationInventoryEO::getSdt,userId); + }); + List pciEoList = this.list(pciQueryWrap); + + if(CollectionUtils.isNotEmpty(pciEoList)){ + List dutyTerritoryIdList = Arrays.asList( + pciEoList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(",")).split(",") + ).stream().distinct().collect(Collectors.toList()); + + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + return result; + } + + @Override + public void replacementUser(JSONObject json) { + String userId = json.getString("userId"); + String projectLibraryId = json.getString("projectLibraryId"); + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper pciQueryWrap = new QueryWrapper<>(); + pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId); + List pciEoList = this.list(pciQueryWrap); + + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserId = (String) replacementUserMap.get("newUserId"); + if (StringUtils.isNotEmpty(newUserId)) { + for (ProjectCertificationInventoryEO pciEo : pciEoList) { + if (StringUtils.equals(pciEo.getDutyTerritory(), dutyTerritory)) { + if (StringUtils.equals(pciEo.getDutyPerson(), userId)) { + ProjectCertificationInventoryEO newPciEo = new ProjectCertificationInventoryEO(); + newPciEo.setId(pciEo.getId()); + newPciEo.setDutyPerson(newUserId); + + QueryWrapper certificationQueryWrap = new QueryWrapper<>(); + certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,pciEo.getId()); + List oldPciEoList = this.list(certificationQueryWrap); + // 编辑责任人处理逻辑 + this.editDutyPerson(newPciEo, oldPciEoList); + + pciEo.setDutyPerson(newUserId); + } + if (StringUtils.equals(pciEo.getSdt(), userId)) { + pciEo.setSdt(newUserId); + } + updateEoList.add(pciEo); + } + } + } + } + + if (CollectionUtils.isNotEmpty(updateEoList)) { + this.updateBatchById(updateEoList); + } + } } 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 e7670ea95..82785b8bf 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 @@ -27,6 +27,7 @@ import com.jero.common.constant.enums.MessageTypeEnum; import com.jero.common.constant.enums.MsgColorEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.query.QueryGenerator; +import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.DateUtils; import com.jero.common.util.oss.CosBootUtil; @@ -55,6 +56,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 +270,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 +789,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()); - } - } } } } @@ -4402,6 +4350,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<>(); @@ -13757,4 +13717,91 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String projectLibraryId = (String) params.get("projectLibraryId"); + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + pliQueryWrap.and(pliQuery -> { + pliQuery.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId,userId) + .or().eq(ProjectLawsInventoryEO::getDesignDutyId,userId) + .or().eq(ProjectLawsInventoryEO::getVerifyDutyId,userId); + }); + List pliEoList = this.list(pliQueryWrap); + if(CollectionUtils.isNotEmpty(pliEoList)){ + List dutyTerritoryIdList = Arrays.asList( + pliEoList.stream().map(ProjectLawsInventoryEO::getDutyTerritory).collect(Collectors.joining(",")).split(",") + ).stream().distinct().collect(Collectors.toList()); + + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + + return result; + } + @Override + public void replacementUser(JSONObject json) { + String userId = json.getString("userId"); + String projectLibraryId = json.getString("projectLibraryId"); + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper pliQueryWrap = new QueryWrapper<>(); + pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId); + List pliEoList = this.list(pliQueryWrap); + + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserId = (String) replacementUserMap.get("newUserId"); + if (StringUtils.isNotEmpty(newUserId)) { + for (ProjectLawsInventoryEO pliEo : pliEoList) { + if (StringUtils.contains(pliEo.getDutyTerritory(), dutyTerritory)) { + QueryWrapper oldPliQueryWrap = new QueryWrapper<>(); + oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,pliEo.getId()); + List oldPliEoList = this.list(oldPliQueryWrap); + ProjectLawsInventoryEO newPliEo = new ProjectLawsInventoryEO(); + + if (StringUtils.equals(pliEo.getRegulationOwnerId(), userId)) { + newPliEo.setRegulationOwnerId(newUserId); + // 处理编辑法规工程师的逻辑 + this.editService.updateRegulationOwner(newPliEo, oldPliEoList); + pliEo.setRegulationOwnerId(newUserId); + } + if (StringUtils.equals(pliEo.getEngineeringInterfacePerson(), userId)) { + pliEo.setEngineeringInterfacePerson(newUserId); + } + if (StringUtils.equals(pliEo.getDesignDutyId(), userId)) { + newPliEo.setDesignDutyId(newUserId); + pliEo.setDesignDutyId(newUserId); + } + if (StringUtils.equals(pliEo.getVerifyDutyId(), userId)) { + newPliEo.setVerifyDutyId(newUserId); + pliEo.setVerifyDutyId(newUserId); + } + + // 处理编辑责任人的逻辑 + this.editService.updateDutyPerson(newPliEo, oldPliEoList); + updateEoList.add(pliEo); + } + } + } + } + + if (CollectionUtils.isNotEmpty(updateEoList)) { + this.updateBatchById(updateEoList); + } + } } \ No newline at end of file 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..1d738151d 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 @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.vo.DictModel; @@ -439,46 +440,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 +668,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 +738,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 +767,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 +812,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl getUserAllDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + List sysDictItems = this.sysDictItemServiceImpl.selectItemsAll(); + List dutyTerritorySdiList = sysDictItems.stream().filter(sysDictItem -> { + return (StringUtils.equals(sysDictItem.getDictCode(), DicCodeEnum.DUTY_TERRITORY.getCode())); + }).collect(Collectors.toList()); + params.put("dutyTerritorySdiList",dutyTerritorySdiList); + + List userAllDutyTerritorySdiList = new ArrayList<>(); + List prpSdiList = this.projectRelatedPersonnelService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(prpSdiList)){ + userAllDutyTerritorySdiList.addAll(prpSdiList); + } + List pliSdiList = this.projectLawsInventoryEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pliSdiList)){ + userAllDutyTerritorySdiList.addAll(pliSdiList); + } + List pciSdiList = this.projectCertificationInventoryEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pciSdiList)){ + userAllDutyTerritorySdiList.addAll(pciSdiList); + } + String projectLibraryId = (String) params.get("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.selectById(projectLibraryId); + params.put("parentId",projectLibraryBase.getParentId()); + List pmSdiList = this.paramsManifestEOService.getUserDutyTerritoryList(params); + if(CollectionUtils.isNotEmpty(pmSdiList)){ + userAllDutyTerritorySdiList.addAll(pmSdiList); + } + + userAllDutyTerritorySdiList = userAllDutyTerritorySdiList.stream().distinct().collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(userAllDutyTerritorySdiList)){ + for (SysDictItem sysDictItem : userAllDutyTerritorySdiList) { + DictModel dictModel = new DictModel(); + dictModel.setText(sysDictItem.getItemText()); + dictModel.setTextEn(sysDictItem.getEnName()); + dictModel.setValue(sysDictItem.getItemValue()); + result.add(dictModel); + } + } + return result; + } + + /** + * 全局替换用户 + * @param json + * @return + */ + @Override + public Result overallReplacementUser(JSONObject json) { + this.projectRelatedPersonnelService.replacementUser(json); + this.projectLawsInventoryEOService.replacementUser(json); + this.projectCertificationInventoryEOService.replacementUser(json); + String projectLibraryId = json.getString("projectLibraryId"); + ProjectLibraryBase projectLibraryBase = this.selectById(projectLibraryId); + json.put("parentId",projectLibraryBase.getParentId()); + this.paramsManifestEOService.replacementUser(json); + return Result.OK("全局替换成功!"); + } + /** * 导出法规符合性管理 * @param workbook diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectRelatedPersonnelServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectRelatedPersonnelServiceImpl.java index ee9069061..8dd5563f2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectRelatedPersonnelServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectRelatedPersonnelServiceImpl.java @@ -1,5 +1,6 @@ package com.jero.modules.project.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -9,6 +10,7 @@ import com.jero.common.constant.CommonConstant; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.api.ISysBaseAPI; +import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.RedisUtil; import com.jero.common.util.TokenUtils; @@ -1894,4 +1896,115 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl getUserDutyTerritoryList(Map params) { + List result = new ArrayList<>(); + String userId = (String) params.get("userId"); + String projectLibraryId = (String) params.get("projectLibraryId"); + List dutyTerritorySdiList = (List) params.get("dutyTerritorySdiList"); + QueryWrapper prpQueryWrap = new QueryWrapper<>(); + prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId,projectLibraryId); + List projectRelatedPersonnelList = this.list(prpQueryWrap); + projectRelatedPersonnelList = projectRelatedPersonnelList.stream().filter(prpEo -> { + boolean lawEngineerExistFlag = false; + if(StringUtils.isNotEmpty(prpEo.getLawEngineer())){ + String[] lawEngineerArr = prpEo.getLawEngineer().split(","); + for (String lawEngineer : lawEngineerArr) { + if(StringUtils.equals(lawEngineer,userId)){ + lawEngineerExistFlag = true; + break; + } + } + } + boolean engineerLawSetExistFlag = false; + if(StringUtils.isNotEmpty(prpEo.getEngineerLawSet())){ + String[] engineerLawSetArr = prpEo.getEngineerLawSet().split(","); + for (String engineerLaw : engineerLawSetArr) { + if(StringUtils.equals(engineerLaw,userId)){ + engineerLawSetExistFlag = true; + break; + } + } + } + boolean engineeringInterfacePersonExistFlag = false; + if(StringUtils.isNotEmpty(prpEo.getEngineeringInterfacePerson())){ + String[] engineeringInterfacePersonArr = prpEo.getEngineeringInterfacePerson().split(","); + for (String engineeringInterfacePerson : engineeringInterfacePersonArr) { + if(StringUtils.equals(engineeringInterfacePerson,userId)){ + engineeringInterfacePersonExistFlag = true; + break; + } + } + } + boolean engineerAttSetExistFlag = false; + if(StringUtils.isNotEmpty(prpEo.getEngineerAttSet())){ + String[] engineerAttSetArr = prpEo.getEngineerAttSet().split(","); + for (String engineerAttSet : engineerAttSetArr) { + if(StringUtils.equals(engineerAttSet,userId)){ + engineerAttSetExistFlag = true; + break; + } + } + } + return (lawEngineerExistFlag || engineerLawSetExistFlag || engineeringInterfacePersonExistFlag || engineerAttSetExistFlag); + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(projectRelatedPersonnelList)){ + List dutyTerritoryIdList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getDutyTerritory).distinct().collect(Collectors.toList()); + result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { + boolean flag = false; + for (String dutyTerritoryId : dutyTerritoryIdList) { + if (StringUtils.equals(dutyTerritoryId, dutyTerritory.getItemValue())) { + flag = true; + break; + } + } + return flag; + }).collect(Collectors.toList()); + } + return result; + } + + public void replacementUser(JSONObject json) { + String userId = json.getString("userId"); + String projectLibraryId = json.getString("projectLibraryId"); + List> replacementUserList = (List>) json.get("replacementUserList"); + + QueryWrapper prpQueryWrap = new QueryWrapper<>(); + prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId, projectLibraryId); + List projectRelatedPersonnelList = this.list(prpQueryWrap); + List updateEoList = new ArrayList<>(); + for (Map replacementUserMap : replacementUserList) { + String dutyTerritory = (String) replacementUserMap.get("dutyTerritory"); + String newUserId = (String) replacementUserMap.get("newUserId"); + if (StringUtils.isNotEmpty(newUserId)) { + for (ProjectRelatedPersonnel prpEo : projectRelatedPersonnelList) { + if (StringUtils.equals(dutyTerritory, prpEo.getDutyTerritory())) { + if (StringUtils.contains(prpEo.getLawEngineer(), userId)) { + String lawEngineer = StringUtils.strDistinct(prpEo.getLawEngineer().replaceAll(userId, newUserId)); + prpEo.setLawEngineer(lawEngineer); + } + if (StringUtils.contains(prpEo.getEngineeringInterfacePerson(), userId)) { + String engineeringInterfacePerson = StringUtils.strDistinct(prpEo.getEngineeringInterfacePerson().replaceAll(userId, newUserId)); + prpEo.setEngineeringInterfacePerson(engineeringInterfacePerson); + } + if (StringUtils.contains(prpEo.getEngineerLawSet(), userId)) { + String engineerLawSet = StringUtils.strDistinct(prpEo.getEngineerLawSet().replaceAll(userId, newUserId)); + prpEo.setEngineerLawSet(engineerLawSet); + } + if (StringUtils.contains(prpEo.getEngineerAttSet(), userId)) { + String engineerAttSet = StringUtils.strDistinct(prpEo.getEngineerAttSet().replaceAll(userId, newUserId)); + prpEo.setEngineerAttSet(engineerAttSet); + } + updateEoList.add(prpEo); + } + } + } + } + + if (CollectionUtils.isNotEmpty(updateEoList)) { + this.updateBatchById(updateEoList); + } + } + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml index af0a76db1..c41daf64f 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml @@ -263,7 +263,7 @@ pid.end_time from process_info_detail pid - where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' and pid.end_time is not null order by pid.end_time asc limit 1 + where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' and pid.end_time is not null and pid.user_id = #{params.currentUserId} order by pid.end_time asc limit 1 ) as end_time, @@ -23,19 +29,19 @@ v-has="'projectComment:list'" @click="todocenterClick"> - {{$t('todocenter')}} + {{ $t('todocenter') }}
- {{$t('UpdateLog')}} + {{ $t('UpdateLog') }}
- {{$t('historicalVersion')}} + {{ $t('historicalVersion') }}
{{ item.roleName }} @@ -54,7 +60,7 @@
- {{roleSwitchName}} + {{ roleSwitchName }}
@@ -73,18 +79,18 @@ v-if="isTrue" @click="textClick(0,$t('projectDetails'))"> - {{$t('projectDetails')}} + {{ $t('projectDetails') }}
- {{$t('listOfRegulations')}} + {{ $t('listOfRegulations') }}
- {{$t('certificationList')}} + {{ $t('certificationList') }}
@@ -101,15 +107,15 @@ :title="$t('TaskParameterCollection')" @click="textClick(4,$t('TaskParameterCollection'))"> - {{$t('TaskParameterCollection')}} + {{ $t('TaskParameterCollection') }} - - - - - - - + + + + + + +
@@ -143,12 +149,12 @@ @click="textClick(4,$t('TaskParameterCollection'))">
- - - - - - + + + + + +
- - + + - - + + + + + + + + + + + +
+ {{ $t('cancel') }} + {{ $t('submit') }} +
+
\ No newline at end of file