Merge remote-tracking branch 'origin/dev_PersonChange_20230712'

# Conflicts:
#	jero-web/src/views/projectManagement/components/listEditModel.vue
This commit is contained in:
高嵩
2023-07-14 18:06:53 +08:00
17 changed files with 1963 additions and 668 deletions
@@ -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;
}
}
@@ -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<ParamsManifestEO> {
boolean setTemplateName(List<String> paramsTemplateIds);
boolean updateModel(String mid,String version, String cid);
/**
* 获取用户的责任领域数组
* @param params
* @return
*/
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
}
@@ -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<ParamsManifestEOMap
return result.substring(0, result.lastIndexOf("%")); // 前端不需要返百分号
}
@Override
public List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params) {
List<SysDictItem> 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<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
QueryWrapper<ParamsManifestEO> pmQueryWrap = new QueryWrapper<>();
pmQueryWrap.lambda().like(ParamsManifestEO::getProjectId,projectLibraryId);
List<ParamsManifestEO> pmEoList = this.list(pmQueryWrap);
if (CollectionUtils.isNotEmpty(pmEoList)) {
List<String> pmEoIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ParamsCollectManifestEO> pcmQueryWrap = new QueryWrapper<>();
pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList);
pcmQueryWrap.and(pcmQuery -> {
pcmQuery.lambda().eq(ParamsCollectManifestEO::getDre,userName).or().eq(ParamsCollectManifestEO::getSdt,userName);
});
List<ParamsCollectManifestEO> pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap);
if(CollectionUtils.isNotEmpty(pcmEoList)){
List<String> 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<Map<String, Object>> replacementUserList = (List<Map<String, Object>>) json.get("replacementUserList");
QueryWrapper<ParamsManifestEO> pmQueryWrap = new QueryWrapper<>();
pmQueryWrap.lambda().like(ParamsManifestEO::getProjectId,projectLibraryId);
List<ParamsManifestEO> pmEoList = this.list(pmQueryWrap);
if (CollectionUtils.isNotEmpty(pmEoList)) {
List<String> pmEoIdList = pmEoList.stream().map(ParamsManifestEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ParamsCollectManifestEO> pcmQueryWrap = new QueryWrapper<>();
pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList);
List<ParamsCollectManifestEO> pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap);
if(CollectionUtils.isNotEmpty(pcmEoList)){
List<ParamsCollectManifestEO> updateEoList = new ArrayList<>();
for (Map<String, Object> 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);
}
}
}
}
}
@@ -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<ProjectLibraryB
public void exportProjectProgressStatisticsXls(HttpServletResponse response,HttpServletRequest request, @RequestParam Map<String,Object> params) {
this.projectLibraryBaseService.exportProjectProgressStatisticsXls(response,request, params);
}
@AutoLog(value = "获取用户在该项目中所有的责任领域")
@ApiOperation(value="获取用户在该项目中所有的责任领域", notes="获取用户在该项目中所有的责任领域")
@GetMapping(value = "/getUserAllDutyTerritoryList")
public Result<List<DictModel>> getUserAllDutyTerritoryList(@RequestParam Map<String,Object> params){
List<DictModel> 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);
}
}
@@ -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<Projec
* @param editEndTimeCertificationInventoryEOS
*/
void syncProcessInfoDetailEndTime(Date endTime, List<ProjectCertificationInventoryEO> editEndTimeCertificationInventoryEOS);
/**
* 获取用户的责任领域数组
* @param params
* @return
*/
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
}
@@ -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<ProjectLawsInve
IPage<ProjectLawsInventoryEO> queryPage(ProjectLawsInventoryEO projectLawsInventoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req);
Result<?> finalizationVerify(Map<String, Object> params);
/**
* 获取用户的责任领域数组
* @param params
* @return
*/
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/***
* 替换用户
* @param params
*/
void replacementUser(JSONObject json);
}
@@ -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<ProjectLibraryBase>
* @param params
*/
void exportProjectProgressStatisticsXls(HttpServletResponse response, HttpServletRequest request, Map<String, Object> params);
/**
* 获取用户在该项目中所有的责任领域数组
* @param params
* @return
*/
List<DictModel> getUserAllDutyTerritoryList(Map<String, Object> params);
/**
* 全局替换用户
* @param json
* @return
*/
Result<?> overallReplacementUser(JSONObject json);
}
@@ -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<ProjectRelated
List<Map<String, Object>> queryLawEngineerByProjectId(Map<String, Object> params);
List<Map<String, Object>> queryEngineeringInterfacePersonByProjectId(Map<String, Object> params);
/**
* 获取用户的责任领域数组
* @param params
* @return
*/
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
}
@@ -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<ProjectLawsInventoryEO> oldPliEoList) {
if (CollectionUtils.isNotEmpty(oldPliEoList)) {
List<String> oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList);
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
if(CollectionUtils.isNotEmpty(pidEoList)){
List<String> taskIdList = new ArrayList<>();
List<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
// pidEoQueryWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, newPliEo.getId());
// List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
// if (CollectionUtils.isNotEmpty(pidEoList)) {
// // 过滤出来,清单确认流程,并且是法规工程师审核节点的数据,转办给新的法规工程师
// List<ProcessInfoDetailEO> 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<String> taskIdList = new ArrayList<>();
//
// // 过滤出来,设计符合性流程,并且是法规工程师审核节点的数据,转办给新的法规工程师
// List<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProjectLawsInventoryEO> oldPliEoList) {
if (CollectionUtils.isNotEmpty(oldPliEoList)) {
List<String> oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList);
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
if(CollectionUtils.isNotEmpty(pidEoList)){
List<String> designTaskIdList = new ArrayList<>();
List<String> verifyTaskIdList = new ArrayList<>();
List<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProjectLawsInventoryEO> oldPliEoList) {
if (CollectionUtils.isNotEmpty(oldPliEoList)) {
List<String> oldPliEoIdList = oldPliEoList.stream().map(ProjectLawsInventoryEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList);
List<ProcessInfoDetailEO> 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<ProjectLawsInventoryEO> oldPliEoList, List<ProcessInfoDetailEO> pidEoList, Date newDesignDueDate) {
// 过滤设计符合性截止日期,不等于新的设计符合性截止日期,并且数据状态为(结果待提交、结果待审查、不符合、待追踪)的数据,这四种状态的数据是流程走到了设计符合性确认节点。
List<ProjectLawsInventoryEO> 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<ProcessInfoDetailEO> 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<ProjectLawsInventoryEO> oldPliEoList, List<ProcessInfoDetailEO> pidEoList, Date newVerifyDueDate) {
// 过滤验证符合性截止日期,不等于新的验证符合性截止日期,并且数据状态为(结果待提交、结果待审查、不符合、待追踪)的数据,这四种状态的数据是流程走到了验证符合性确认节点。
List<ProjectLawsInventoryEO> 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<ProcessInfoDetailEO> 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);
}
}
}
}
}
@@ -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<Proj
*/
@Override
public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) {
List<String> flowStatusList = new ArrayList<>();
flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue());
QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> editEndTimeCertificationInventoryEOS = this.list(certificationQueryWrap);
// 编辑截至日期发消息
List<ProjectCertificationInventoryEO> 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<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> 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<ProjectCertificationInventoryEO> editDutyPersonCertificationQueryWrap = new QueryWrapper<>();
editDutyPersonCertificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
List<ProjectCertificationInventoryEO> 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<String> userIdList = editDutyPersonCertificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
this.sendMessageByTemplateId(
editDutyPersonCertificationInventoryEOS,
TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(),
userIdList,
userInfoList,
projectCertificationInventoryEO.getEndTime(),""
);
// 如果责任人有变更将之前责任人的待办中心任务移交给新的责任人
QueryWrapper<ProcessInfoDetailEO> detailQueryWrap = new QueryWrapper<>();
List<String> 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<String> taskDefinitionKeyList = new ArrayList<>();
taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRJSRW.getKey());
taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRTJRW.getKey());
detailQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKeyList);
List<ProcessInfoDetailEO> 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<Proj
}
}
/**
* 编辑责任人处理逻辑
* @param pciEo
*/
private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List<ProjectCertificationInventoryEO> oldPciEoList) {
// 过滤出来旧数据的责任人与新修改的责任人不是同一个人并且流程状态是 任务待确认结果待提交审查退回的数据这三个状态的流程数据在责任人节点
List<ProjectCertificationInventoryEO> 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<String> userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
this.sendMessageByTemplateId(
oldPciEos,
TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(),
userIdList,
userInfoList,
pciEo.getEndTime(),
""
);
// 如果责任人有变更将之前责任人的待办中心任务移交给新的责任人
QueryWrapper<ProcessInfoDetailEO> detailQueryWrap = new QueryWrapper<>();
List<String> 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<String> taskDefinitionKeyList = new ArrayList<>();
taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRJSRW.getKey());
taskDefinitionKeyList.add(CertificationFlowNodeEnum.ZRRTJRW.getKey());
detailQueryWrap.lambda().in(ProcessInfoDetailEO::getTaskDefinitionKey, taskDefinitionKeyList);
List<ProcessInfoDetailEO> 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<ProjectCertificationInventoryEO> oldPciEoList) {
Date newEndTime = newPciEo.getEndTime();
// 过滤出来旧的截止日期不等于更改后的新截止日期并且数据状态为 任务待确认结果待提交审查退回的数据
List<ProjectCertificationInventoryEO> 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<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> 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<Proj
updateList.add(updateProjectCertificationInventoryEO);
}
List<String> flowStatusList = new ArrayList<>();
flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList);
// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS = this.list(certificationQueryWrap);
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){
List<ProjectCertificationInventoryEO> 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<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
List<SysUser> 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<String> flowStatusList = new ArrayList<>();
// flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
//
// QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList);
//// certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
// List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS = this.list(certificationQueryWrap);
//
// if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){
// List<ProjectCertificationInventoryEO> 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<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
// List<SysUser> 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<Proj
@Override
public Result<?> 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<Proj
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue());
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
this.updateBatchById(projectCertificationInventoryEOList);
// 根据项目库id查询当前项目认证清单数据获取清单校核截止时间 最早的一个时间
flowStatusList.clear();
flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
flowStatusList.add(CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue());
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
if(CollectionUtils.isNotEmpty(pciEoList)){
List<Date> 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<Proj
deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(deleteDetailWrap);
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
this.updateBatchById(projectCertificationInventoryEOList);
// 获取认证清单 - 飞书跳转链接
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN);
@@ -1174,6 +1223,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<SysUser> 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<Proj
templateVariableMap.put("projectNameCn",PRN_CN);
templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(inventoryVerifyEndTime));
templateVariableMap.put("endTime",DateUtils.formatDate(finalInventoryVerifyEndTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P);
@@ -1839,6 +1889,17 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> 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<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
@@ -1914,6 +1975,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> 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<Proj
return Result.OK("审批通过成功!");
}
/**
* 更新截止日期
* @param flowStatusList
* @param taskDefinitionKey
* @param projectLibraryBase
*/
private void updateProcessInfoDetailEndTime(List<String> flowStatusList,
String taskDefinitionKey,
ProjectLibraryBase projectLibraryBase,
String orderByField,
List<String> excludeIdList) {
QueryWrapper<ProjectCertificationInventoryEO> 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<ProjectCertificationInventoryEO> 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<ProcessInfoDetailEO> detailQueryWrapper = new QueryWrapper<>();
detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId());
detailQueryWrapper.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,taskDefinitionKey);
List<ProcessInfoDetailEO> 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<Proj
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
}
// 根据项目库id查询当前项目认证清单数据获取数据状态为 结果待审查的 截止时间 最早的一个时间
Date endTime = null;
QueryWrapper<ProjectCertificationInventoryEO> 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<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
if(CollectionUtils.isNotEmpty(pciEoList) || CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
List<Date> endTimeList = new ArrayList<>();
// 本次提交之前数据库里面存在的截止时间
List<Date> oldEndTimeList = pciEoList.stream().map(ProjectCertificationInventoryEO::getEndTime).distinct().collect(Collectors.toList());
endTimeList.addAll(oldEndTimeList);
// 当前要提交的数据截止时间
List<Date> 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<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 给认证工程师分配任务
@@ -2018,7 +2148,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getEndTime());
processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO);
}
// 数据更新为结果待审查
@@ -2053,7 +2183,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
certificationEngineerList,
certificationEngineers,
projectCertificationInventoryEOList.get(0).getEndTime(),
endTime,
CertificationFlowNodeEnum.TASK_REVIEW.getKey()
);
}catch (Exception ex){
@@ -2526,6 +2656,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 认证工程师发起任务将数据的状态更新为 任务待确认
this.updateBatchById(projectCertificationInventoryEOList);
// 获取当前项目下认证清单清单校核截止日期最早的一个更新到流程明细表中认证工程师接受任务节点的截止时间中
this.updateProcessInfoDetailEndTime(
flowStatusList,
CertificationFlowNodeEnum.RZGCSJSRW.getKey(),
projectLibraryBase,
"inventory_verify_end_time",
idList
);
// 更新该项目认证流程中认证工程师的任务状态
// 如果还有 清单待校核责任人拒绝 状态的数据不做操作如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办
this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList);
@@ -6011,7 +6150,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
String flowStatus = pciEo.getFlowStatus();
// 如果该数据为 结果待提交或审查退回的时候
if (StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
|| StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) ) {
|| StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) ) {
List<ProcessInfoDetailEO> pidEoListTemp = pidEoList.stream().filter(pidEo -> {
boolean flag = (
StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId)
@@ -6091,5 +6230,83 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
return result;
}
@Override
public List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params) {
List<SysDictItem> result = new ArrayList<>();
String userId = (String) params.get("userId");
String projectLibraryId = (String) params.get("projectLibraryId");
List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
pciQueryWrap.and(pciQuery -> {
pciQuery.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,userId)
.or().eq(ProjectCertificationInventoryEO::getSdt,userId);
});
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
if(CollectionUtils.isNotEmpty(pciEoList)){
List<String> 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<Map<String, Object>> replacementUserList = (List<Map<String, Object>>) json.get("replacementUserList");
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId);
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
List<ProjectCertificationInventoryEO> updateEoList = new ArrayList<>();
for (Map<String, Object> 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<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,pciEo.getId());
List<ProjectCertificationInventoryEO> 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);
}
}
}
@@ -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<ProjectLawsIn
private ISysDictItemService sysDictItemService;
@Autowired
private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService;
@Autowired
private ProjectLawsInventoryEOEditServiceImpl editService;
/**
* 保存
@@ -498,8 +502,17 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean checkResult = checkData(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), projectLawsInventoryEO.getId());
if (checkResult) {
QueryWrapper<ProjectLawsInventoryEO> oldPliQueryWrap = new QueryWrapper<>();
oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,projectLawsInventoryEO.getId());
List<ProjectLawsInventoryEO> 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<ProjectLawsIn
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(), params);
// 将之前的法规工程师的待办任务转给新的法规工程师办理
QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
pidEoQueryWrap.lambda().eq(ProcessInfoDetailEO::getProjectLawsInventoryId, projectLawsInventoryEO.getId());
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
if (CollectionUtils.isNotEmpty(pidEoList)) {
// 过滤出来清单确认流程并且是法规工程师审核节点的数据转办给新的法规工程师
List<ProcessInfoDetailEO> 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<String> taskIdList = new ArrayList<>();
// 过滤出来设计符合性流程并且是法规工程师审核节点的数据转办给新的法规工程师
List<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProjectLawsIn
QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>();
List<ProjectLawsInventoryEO> 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<ProjectLawsInventoryEO> projectLawsInventoryEOList = new ArrayList<>();
List<ProjectUserPermission> adds = new ArrayList<>();
@@ -13757,4 +13717,91 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
return result;
}
@Override
public List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params) {
List<SysDictItem> result = new ArrayList<>();
String userId = (String) params.get("userId");
String projectLibraryId = (String) params.get("projectLibraryId");
List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
QueryWrapper<ProjectLawsInventoryEO> 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<ProjectLawsInventoryEO> pliEoList = this.list(pliQueryWrap);
if(CollectionUtils.isNotEmpty(pliEoList)){
List<String> 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<Map<String, Object>> replacementUserList = (List<Map<String, Object>>) json.get("replacementUserList");
QueryWrapper<ProjectLawsInventoryEO> pliQueryWrap = new QueryWrapper<>();
pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId);
List<ProjectLawsInventoryEO> pliEoList = this.list(pliQueryWrap);
List<ProjectLawsInventoryEO> updateEoList = new ArrayList<>();
for (Map<String, Object> 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<ProjectLawsInventoryEO> oldPliQueryWrap = new QueryWrapper<>();
oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,pliEo.getId());
List<ProjectLawsInventoryEO> 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);
}
}
}
@@ -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<ProjectLibraryBas
// 如果studio编辑了认证工程师,需要给旧的认证工程师发送认证清单任务消息
if(StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer()) && StringUtils.isNotEmpty(original.getCertificationEngineer())){
List<String> originalCertificationEngineerIdList = Arrays.asList(original.getCertificationEngineer().split(","));
List<String> 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<String> flowStatusList = new ArrayList<>();
flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
QueryWrapper<ProjectCertificationInventoryEO> certificationInventoryEOQueryWrapper = new QueryWrapper<>();
certificationInventoryEOQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryBase.getId());
certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper);
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
List<SysUser> 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<ProjectLibraryBas
}
/**
* 编辑认证工程师逻辑处理
* @param newPlbEO
* @param oldPlbEO
*/
private void editCertificationEngineer(ProjectLibraryBase newPlbEO, ProjectLibraryBase oldPlbEO) {
List<String> oldCertificationEngineerIdList = Arrays.asList(oldPlbEO.getCertificationEngineer().split(","));
List<String> 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<String> flowStatusList = new ArrayList<>();
flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
flowStatusList.add(CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
QueryWrapper<ProjectCertificationInventoryEO> certificationInventoryEOQueryWrapper = new QueryWrapper<>();
certificationInventoryEOQueryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, newPlbEO.getId());
certificationInventoryEOQueryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper);
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){
this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
List<SysUser> 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<ProjectLibraryBas
// 如果该项目下清单待校核的数据不为空,给这些认证工程师分配待办任务。
if(CollectionUtils.isNotEmpty(pciToBeCheckedList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师接受任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidQueryWrap);
if(CollectionUtils.isNotEmpty(pidEoList)){
List<String> 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<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
@@ -744,6 +767,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO);
}
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
@@ -760,11 +784,22 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(CollectionUtils.isNotEmpty(pciToBeReviewEDList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师审查 任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<ProcessInfoDetailEO> 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<String> pidEoIdList = pidEoList.stream().map(ProcessInfoDetailEO::getId).distinct().collect(Collectors.toList());
this.processInfoDetailEOService.deleteByIds(pidEoIdList);
}
// 给认证工程师分配任务
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
@@ -777,6 +812,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO);
}
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
@@ -2550,6 +2586,66 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
}
@Override
public List<DictModel> getUserAllDutyTerritoryList(Map<String, Object> params) {
List<DictModel> result = new ArrayList<>();
List<SysDictItem> sysDictItems = this.sysDictItemServiceImpl.selectItemsAll();
List<SysDictItem> dutyTerritorySdiList = sysDictItems.stream().filter(sysDictItem -> {
return (StringUtils.equals(sysDictItem.getDictCode(), DicCodeEnum.DUTY_TERRITORY.getCode()));
}).collect(Collectors.toList());
params.put("dutyTerritorySdiList",dutyTerritorySdiList);
List<SysDictItem> userAllDutyTerritorySdiList = new ArrayList<>();
List<SysDictItem> prpSdiList = this.projectRelatedPersonnelService.getUserDutyTerritoryList(params);
if(CollectionUtils.isNotEmpty(prpSdiList)){
userAllDutyTerritorySdiList.addAll(prpSdiList);
}
List<SysDictItem> pliSdiList = this.projectLawsInventoryEOService.getUserDutyTerritoryList(params);
if(CollectionUtils.isNotEmpty(pliSdiList)){
userAllDutyTerritorySdiList.addAll(pliSdiList);
}
List<SysDictItem> 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<SysDictItem> 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
@@ -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<ProjectRelat
return resultList;
}
@Override
public List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params) {
List<SysDictItem> result = new ArrayList<>();
String userId = (String) params.get("userId");
String projectLibraryId = (String) params.get("projectLibraryId");
List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
QueryWrapper<ProjectRelatedPersonnel> prpQueryWrap = new QueryWrapper<>();
prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId,projectLibraryId);
List<ProjectRelatedPersonnel> 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<String> 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<Map<String, Object>> replacementUserList = (List<Map<String, Object>>) json.get("replacementUserList");
QueryWrapper<ProjectRelatedPersonnel> prpQueryWrap = new QueryWrapper<>();
prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId, projectLibraryId);
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = this.list(prpQueryWrap);
List<ProjectRelatedPersonnel> updateEoList = new ArrayList<>();
for (Map<String, Object> 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);
}
}
}
@@ -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,
<!--(
case when flow_type = '21' then
+4
View File
@@ -1905,4 +1905,8 @@ module.exports = {
knowledgeSharingHaveBeenStored:'Knowledge Sharing have been stored',
regulationMonthlyReportHaveBeenStored:'Regulation Monthly Report have been stored',
sendBackOne:'Return',
globalReplacement:'Global Replacement',
replacedPerson:'Replaced person',
replacementPerson:'Replacement Person',
thereReplaceableData:'There is currently no replaceable data',
}
+4
View File
@@ -3861,4 +3861,8 @@ module.exports = {
Notitleincluded:'不包含标题',
backToHomePage:'返回主页',
sendBackOne:'退回',
globalReplacement:'全局替换',
replacedPerson:'被替换人',
replacementPerson:'替换人',
thereReplaceableData:'当前没有可替换的数据',
}
File diff suppressed because it is too large Load Diff