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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Author: liyawei * @Author: liyawei
@@ -129,5 +130,18 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return String.valueOf(param); 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; package com.jero.modules.cert.collect.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.ParamsManifestHistoryVO;
import com.jero.modules.cert.collect.vo.ParamsManifestVO; import com.jero.modules.cert.collect.vo.ParamsManifestVO;
import com.jero.modules.cert.template.entity.ParamsTemplateEO; import com.jero.modules.cert.template.entity.ParamsTemplateEO;
import com.jero.modules.system.entity.SysDictItem;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -99,4 +101,17 @@ public interface IParamsManifestEOService extends IService<ParamsManifestEO> {
boolean setTemplateName(List<String> paramsTemplateIds); boolean setTemplateName(List<String> paramsTemplateIds);
boolean updateModel(String mid,String version, String cid); 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.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.IParamsInfoPublishEOService;
import com.jero.modules.cert.template.service.IParamsTemplateEOService; import com.jero.modules.cert.template.service.IParamsTemplateEOService;
import com.jero.modules.enums.DictCodeEnum; 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.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.service.IProjectLibraryBaseService; import com.jero.modules.project.service.IProjectLibraryBaseService;
import com.jero.modules.project.service.IProjectRelatedPersonnelService; import com.jero.modules.project.service.IProjectRelatedPersonnelService;
@@ -56,14 +59,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.*;
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.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -1135,4 +1131,89 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
return result.substring(0, result.lastIndexOf("%")); // 前端不需要返百分号 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.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController; 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.entity.ProjectLibraryBase;
import com.jero.modules.project.service.IProjectLibraryBaseService; import com.jero.modules.project.service.IProjectLibraryBaseService;
import io.swagger.annotations.Api; 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) { public void exportProjectProgressStatisticsXls(HttpServletResponse response,HttpServletRequest request, @RequestParam Map<String,Object> params) {
this.projectLibraryBaseService.exportProjectProgressStatisticsXls(response,request, 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.system.vo.DictModel;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.system.entity.SysCategory; 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.SysRole;
import com.jero.modules.system.entity.SysUser; import com.jero.modules.system.entity.SysUser;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
@@ -317,4 +319,17 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @param editEndTimeCertificationInventoryEOS * @param editEndTimeCertificationInventoryEOS
*/ */
void syncProcessInfoDetailEndTime(Date endTime, List<ProjectCertificationInventoryEO> 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.itextpdf.text.DocumentException;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.MessageTypeEnum; import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.system.vo.DictModel;
import com.jero.common.system.vo.LoginUser; import com.jero.common.system.vo.LoginUser;
import com.jero.modules.feishu.vo.FeishuMsgVo; import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO; 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); IPage<ProjectLawsInventoryEO> queryPage(ProjectLawsInventoryEO projectLawsInventoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req);
Result<?> finalizationVerify(Map<String, Object> params); 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; package com.jero.modules.project.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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 com.jero.modules.project.entity.ProjectLibraryBase;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -167,4 +170,18 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
* @param params * @param params
*/ */
void exportProjectProgressStatisticsXls(HttpServletResponse response, HttpServletRequest request, Map<String, Object> 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; package com.jero.modules.project.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result; 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.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.system.entity.SysDictItem;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.web.multipart.MultipartFile; 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>> queryLawEngineerByProjectId(Map<String, Object> params);
List<Map<String, Object>> queryEngineeringInterfacePersonByProjectId(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.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator; 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.system.vo.LoginUser;
import com.jero.common.util.DateUtils; import com.jero.common.util.DateUtils;
import com.jero.common.util.oss.CosBootUtil; import com.jero.common.util.oss.CosBootUtil;
@@ -196,92 +197,21 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
*/ */
@Override @Override
public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) { 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<>(); QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); List<ProjectCertificationInventoryEO> oldPciEoList = this.list(certificationQueryWrap);
List<ProjectCertificationInventoryEO> editEndTimeCertificationInventoryEOS = this.list(certificationQueryWrap);
// 编辑截至日期发消息
if(projectCertificationInventoryEO.getEndTime() != null){ if(projectCertificationInventoryEO.getEndTime() != null){
editEndTimeCertificationInventoryEOS = editEndTimeCertificationInventoryEOS.stream().filter(certificationInventory -> { // 编辑截至日期处理逻辑
boolean flag = false; this.editEndTime(projectCertificationInventoryEO, oldPciEoList);
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(),""
);
}
}
}
// 如果编辑了责任人,给责任人发消息
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){
QueryWrapper<ProjectCertificationInventoryEO> editDutyPersonCertificationQueryWrap = new QueryWrapper<>(); // 编辑责任人处理逻辑
editDutyPersonCertificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); this.editDutyPerson(projectCertificationInventoryEO,oldPciEoList);
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);
}
} }
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删除 * 通过id删除
* *
@@ -612,45 +635,58 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
updateList.add(updateProjectCertificationInventoryEO); updateList.add(updateProjectCertificationInventoryEO);
} }
List<String> flowStatusList = new ArrayList<>(); if(projectCertificationInventoryEO.getEndTime() != null){
flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); // 编辑截至日期处理逻辑
this.editEndTime(projectCertificationInventoryEO, pciEoList);
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;
} }
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){
// 编辑责任人处理逻辑
this.editDutyPerson(projectCertificationInventoryEO,pciEoList);
} }
} if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){
return flag; // 编辑交付物类型、交付物模板逻辑
}).collect(Collectors.toList()); // TODO 此处逻辑需要详细需求。如何操作。
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); // 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)){ if(CollectionUtils.isNotEmpty(updateList)){
this.updateBatchById(updateList); this.updateBatchById(updateList);
} }
@@ -1080,6 +1116,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Override @Override
public Result<?> issue(JSONObject json) { public Result<?> issue(JSONObject json) {
String ids = json.getString("ids"); String ids = json.getString("ids");
String projectLibraryId = json.getString("projectLibraryId");
if(StringUtils.isEmpty(ids)){ if(StringUtils.isEmpty(ids)){
throw new JeroBootException("至少选择一条数据进行发布!"); throw new JeroBootException("至少选择一条数据进行发布!");
} }
@@ -1118,10 +1155,23 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue()); this.saveProjectCertificationInventoryLog(projectCertificationInventoryEOList,OperatorTypeEnum.CERTIFICATION_INVENTORY_STUDIO_ISSUE.getValue());
// this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); this.updateBatchById(projectCertificationInventoryEOList);
// Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
// 根据项目库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); ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId);
if(ObjectUtils.isNotEmpty(projectLibraryBase)){ if(ObjectUtils.isNotEmpty(projectLibraryBase)){
@@ -1164,7 +1214,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); deleteDetailWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(deleteDetailWrap); this.processInfoDetailEOService.remove(deleteDetailWrap);
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
this.updateBatchById(projectCertificationInventoryEOList);
// 获取认证清单 - 飞书跳转链接 // 获取认证清单 - 飞书跳转链接
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryId, PRN_CN, PRN_EN); 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); List<SysUser> certificationEngineerUserInfoList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList);
Date finalInventoryVerifyEndTime = inventoryVerifyEndTime;
certificationEngineerIdList.forEach(userId -> { certificationEngineerIdList.forEach(userId -> {
try { try {
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerUserInfoList,userId); String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerUserInfoList,userId);
@@ -1187,7 +1237,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
templateVariableMap.put("projectNameCn",PRN_CN); templateVariableMap.put("projectNameCn",PRN_CN);
templateVariableMap.put("projectNameEn",PRN_EN); templateVariableMap.put("projectNameEn",PRN_EN);
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("endTime",DateUtils.formatDate(inventoryVerifyEndTime)); templateVariableMap.put("endTime",DateUtils.formatDate(finalInventoryVerifyEndTime));
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
templateVariableMap.put("viewBtnUrlCnPhone",hrefFeishu_CN_P); 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); ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); 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 { try {
// 给责任人分配待办中心的任务 // 给责任人分配待办中心的任务
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>(); 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); ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); List<String> dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
List<SysUser> dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); List<SysUser> dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList);
// 获取当前项目下,认证清单,截止日期最早的一个,更新到流程明细表中,认证工程师审查任务节点的截止时间中
this.updateProcessInfoDetailEndTime(
flowStatusList,
CertificationFlowNodeEnum.RZGCSSC.getKey(),
projectLibraryBase,
"end_time",
idList
);
try { try {
// 更新数据状态为 审查通过 // 更新数据状态为 审查通过
this.updateBatchById(projectCertificationInventoryEOList); this.updateBatchById(projectCertificationInventoryEOList);
@@ -1943,6 +2013,45 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
return Result.OK("审批通过成功!"); 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 * @param projectLibraryBase
@@ -2006,6 +2115,27 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!"); 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<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
// 给认证工程师分配任务 // 给认证工程师分配任务
@@ -2018,7 +2148,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(projectCertificationInventoryEOList.get(0).getEndTime()); processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO); processInfoDetailEOList.add(processInfoDetailEO);
} }
// 数据更新为结果待审查 // 数据更新为结果待审查
@@ -2053,7 +2183,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(), TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
certificationEngineerList, certificationEngineerList,
certificationEngineers, certificationEngineers,
projectCertificationInventoryEOList.get(0).getEndTime(), endTime,
CertificationFlowNodeEnum.TASK_REVIEW.getKey() CertificationFlowNodeEnum.TASK_REVIEW.getKey()
); );
}catch (Exception ex){ }catch (Exception ex){
@@ -2526,6 +2656,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
// 认证工程师发起任务,将数据的状态更新为 任务待确认。 // 认证工程师发起任务,将数据的状态更新为 任务待确认。
this.updateBatchById(projectCertificationInventoryEOList); this.updateBatchById(projectCertificationInventoryEOList);
// 获取当前项目下,认证清单,清单校核截止日期最早的一个,更新到流程明细表中,认证工程师接受任务节点的截止时间中
this.updateProcessInfoDetailEndTime(
flowStatusList,
CertificationFlowNodeEnum.RZGCSJSRW.getKey(),
projectLibraryBase,
"inventory_verify_end_time",
idList
);
// 更新该项目认证流程中,认证工程师的任务状态。 // 更新该项目认证流程中,认证工程师的任务状态。
// 如果还有 清单待校核、责任人拒绝 状态的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办 // 如果还有 清单待校核、责任人拒绝 状态的数据,不做操作,如果没有 将这个项目认证流程的所有认证工程师待办任务转为已办
this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList); this.updateProcessInfoDetailStatus(projectLibraryBase,CertificationFlowNodeEnum.RZGCSJSRW.getKey(),flowStatusList);
@@ -6011,7 +6150,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
String flowStatus = pciEo.getFlowStatus(); String flowStatus = pciEo.getFlowStatus();
// 如果该数据为 结果待提交或审查退回的时候 // 如果该数据为 结果待提交或审查退回的时候
if (StringUtils.equals(flowStatus,CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) 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 -> { List<ProcessInfoDetailEO> pidEoListTemp = pidEoList.stream().filter(pidEo -> {
boolean flag = ( boolean flag = (
StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId) StringUtils.equals(pidEo.getProjectLawsInventoryId(),pciEoId)
@@ -6091,5 +6230,83 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
return result; 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.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator; 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.system.vo.LoginUser;
import com.jero.common.util.DateUtils; import com.jero.common.util.DateUtils;
import com.jero.common.util.oss.CosBootUtil; 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.enums.*;
import com.jero.modules.project.mapper.*; import com.jero.modules.project.mapper.*;
import com.jero.modules.project.service.*; 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.util.WordUtil;
import com.jero.modules.project.vo.ProjectTaskUrgVo; import com.jero.modules.project.vo.ProjectTaskUrgVo;
import com.jero.modules.split.common.FileUnZip; import com.jero.modules.split.common.FileUnZip;
@@ -268,6 +270,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
private ISysDictItemService sysDictItemService; private ISysDictItemService sysDictItemService;
@Autowired @Autowired
private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService; private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService;
@Autowired
private ProjectLawsInventoryEOEditServiceImpl editService;
/** /**
* 保存 * 保存
@@ -498,8 +502,17 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean checkResult = checkData(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), projectLawsInventoryEO.getId()); boolean checkResult = checkData(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), projectLawsInventoryEO.getId());
if (checkResult) { if (checkResult) {
QueryWrapper<ProjectLawsInventoryEO> oldPliQueryWrap = new QueryWrapper<>();
oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,projectLawsInventoryEO.getId());
List<ProjectLawsInventoryEO> oldPliEoList = this.list(oldPliQueryWrap);
this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO); this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO);
// 处理编辑法规工程师的逻辑
this.editService.updateRegulationOwner(projectLawsInventoryEO,oldPliEoList);
// 处理编辑责任人的逻辑
this.editService.updateDutyPerson(projectLawsInventoryEO,oldPliEoList);
// 处理修改设计或验证符合性截止日期的逻辑
this.editService.updateDesignOrVerifyEndTime(projectLawsInventoryEO,oldPliEoList);
projectLawsInventoryEO.setUpdateTime(now); projectLawsInventoryEO.setUpdateTime(now);
ProjectLawsInventoryEO projectLawsInventoryEOCopy = SerializationUtils.clone(projectLawsInventoryEO);//复制 ProjectLawsInventoryEO projectLawsInventoryEOCopy = SerializationUtils.clone(projectLawsInventoryEO);//复制
@@ -776,71 +789,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(), params); 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<>(); QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>();
List<ProjectLawsInventoryEO> infoList = list(queryWrapper.in("id", idList)); 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<ProjectLawsInventoryEO> projectLawsInventoryEOList = new ArrayList<>();
List<ProjectUserPermission> adds = new ArrayList<>(); List<ProjectUserPermission> adds = new ArrayList<>();
@@ -13757,4 +13717,91 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
return result; 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.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.DictModel; import com.jero.common.system.vo.DictModel;
@@ -439,46 +440,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
// 如果studio编辑了认证工程师,需要给旧的认证工程师发送认证清单任务消息 // 如果studio编辑了认证工程师,需要给旧的认证工程师发送认证清单任务消息
if(StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer()) && StringUtils.isNotEmpty(original.getCertificationEngineer())){ if(StringUtils.isNotEmpty(projectLibraryBase.getCertificationEngineer()) && StringUtils.isNotEmpty(original.getCertificationEngineer())){
List<String> originalCertificationEngineerIdList = Arrays.asList(original.getCertificationEngineer().split(",")); this.editCertificationEngineer(projectLibraryBase, original);
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(),""
);
}
}
} }
setRzlcCertificationEngineerTask(projectLibraryBase);
checkExitData(projectLibraryBase); checkExitData(projectLibraryBase);
saveOrUpdate(projectLibraryBase); saveOrUpdate(projectLibraryBase);
checkVersionOrder(projectLibraryBase.getParentId(),projectLibraryBase.getProjectVersion(),projectLibraryBase.getId()); 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 * @param projectLibraryBase
@@ -727,11 +738,23 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
// 如果该项目下清单待校核的数据不为空,给这些认证工程师分配待办任务。 // 如果该项目下清单待校核的数据不为空,给这些认证工程师分配待办任务。
if(CollectionUtils.isNotEmpty(pciToBeCheckedList)){ if(CollectionUtils.isNotEmpty(pciToBeCheckedList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师接受任务节点的数据) // 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师接受任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> pidRemoveWrap = new QueryWrapper<>(); QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSJSRW.getKey());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(pidRemoveWrap); 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<>(); List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
@@ -744,6 +767,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO); processInfoDetailEOList.add(processInfoDetailEO);
} }
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); this.processInfoDetailEOService.saveBatch(processInfoDetailEOList);
@@ -760,11 +784,22 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
if(CollectionUtils.isNotEmpty(pciToBeReviewEDList)){ if(CollectionUtils.isNotEmpty(pciToBeReviewEDList)){
// 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师审查 任务节点的数据) // 删除待办中心(是这个项目库的 pre-Homo流程的待办任务, 认证工程师审查 任务节点的数据)
QueryWrapper<ProcessInfoDetailEO> pidRemoveWrap = new QueryWrapper<>(); QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getProcessInfoId, projectLibraryBase.getId());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.RZGCSSC.getKey());
pidRemoveWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue()); pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
this.processInfoDetailEOService.remove(pidRemoveWrap); 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<>(); List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
@@ -777,6 +812,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId()); processInfoDetailEO.setProcessInfoId(projectLibraryBase.getId());
processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId()); processInfoDetailEO.setActiProcInstId(projectLibraryBase.getId());
processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue()); processInfoDetailEO.setFlowType(FlowTypeEnum.CERTIFICATION_LC.getValue());
processInfoDetailEO.setEndTime(endTime);
processInfoDetailEOList.add(processInfoDetailEO); processInfoDetailEOList.add(processInfoDetailEO);
} }
this.processInfoDetailEOService.saveBatch(processInfoDetailEOList); 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 * @param workbook
@@ -1,5 +1,6 @@
package com.jero.modules.project.service.impl; 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.constant.enums.CutEnum;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI; 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.system.vo.LoginUser;
import com.jero.common.util.RedisUtil; import com.jero.common.util.RedisUtil;
import com.jero.common.util.TokenUtils; import com.jero.common.util.TokenUtils;
@@ -1894,4 +1896,115 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
return resultList; 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 pid.end_time
from from
process_info_detail pid 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, ) as end_time,
<!--( <!--(
case when flow_type = '21' then case when flow_type = '21' then
+4
View File
@@ -1905,4 +1905,8 @@ module.exports = {
knowledgeSharingHaveBeenStored:'Knowledge Sharing have been stored', knowledgeSharingHaveBeenStored:'Knowledge Sharing have been stored',
regulationMonthlyReportHaveBeenStored:'Regulation Monthly Report have been stored', regulationMonthlyReportHaveBeenStored:'Regulation Monthly Report have been stored',
sendBackOne:'Return', 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:'不包含标题', Notitleincluded:'不包含标题',
backToHomePage:'返回主页', backToHomePage:'返回主页',
sendBackOne:'退回', sendBackOne:'退回',
globalReplacement:'全局替换',
replacedPerson:'被替换人',
replacementPerson:'替换人',
thereReplaceableData:'当前没有可替换的数据',
} }
@@ -11,6 +11,12 @@
</span> </span>
</div> </div>
<div class="Virtual-detail-text-right"> <div class="Virtual-detail-text-right">
<div class="operator-text"
v-has="'projectComment:list'"
@click="globalReplacementClick">
<a-icon type="qrcode"/>
{{ $t('globalReplacement') }}
</div>
<!-- <div class="operator-text"--> <!-- <div class="operator-text"-->
<!-- v-if="textTitle === $t('listOfRegulations')"--> <!-- v-if="textTitle === $t('listOfRegulations')"-->
<!-- v-has="'projectComment:list'"--> <!-- v-has="'projectComment:list'"-->
@@ -178,11 +184,51 @@
<historicalVersionList ref="historicalVersionListRef"/> <historicalVersionList ref="historicalVersionListRef"/>
<commentList ref="commentListRef"/> <commentList ref="commentListRef"/>
<JLoading :loading="loading"></JLoading> <JLoading :loading="loading"></JLoading>
<SelectedBy ref="SelectedByRef"
:isSingleChoice="true"
:title="$t('PersonnelSelection')"
@SelectedByForm="SelectedByForm"/>
<a-drawer
:title="$t('globalReplacement')"
:maskClosable="false"
:width="900"
placement="right"
:closable="true"
@close="handleCancel"
:visible="selectVisible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-spin :spinning="submitLoading">
<a-table
ref="table"
:loading="selectLoading"
:pagination="false"
:scroll="{x: '100%',y:'calc(100vh - 300px)'}"
rowKey="id"
:data-source="dataSource"
:columns="columns"
>
<span slot="replacementPerson"
slot-scope="text,record,index"
:title="text">
<PersonnelSelection :query="{db_field_name:'newUserId',db_field_txt:$t('personLiable'),subscript:index}"
:isSingleChoice="true"
:personneQuery="record"
@change="PersonnelSelectionChange"
v-model="record.newUserIdName"/>
</span>
</a-table>
</a-spin>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" style="margin-right: 16px">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="submitLoading">{{ $t('submit') }}</a-button>
</div>
</a-drawer>
</div> </div>
</template> </template>
<script> <script>
import TaskList from '../components/TaskList' import TaskList from '../components/TaskList'
import SelectedBy from '@/components/SelectedBy/index'
import listOfRegulations from '../components/listOfRegulations' import listOfRegulations from '../components/listOfRegulations'
import ProjectDetailsName from '../components/ProjectDetails' import ProjectDetailsName from '../components/ProjectDetails'
import TaskParameterCollection from '../components/TaskParameterCollection' import TaskParameterCollection from '../components/TaskParameterCollection'
@@ -193,6 +239,7 @@
import commentList from '../components/commentList' import commentList from '../components/commentList'
import {getAction, postAction, deleteAction, downloadFile} from '@/api/manage' import {getAction, postAction, deleteAction, downloadFile} from '@/api/manage'
import certificationList from '../components/certificationList/index' import certificationList from '../components/certificationList/index'
import PersonnelSelection from '@/components/PersonnelSelection/index'
import {mapGetters} from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
@@ -207,15 +254,21 @@
historicalVersionList, historicalVersionList,
commentList, commentList,
projectStatus, projectStatus,
certificationList certificationList,
SelectedBy,
PersonnelSelection
}, },
data() { data() {
return { return {
title: '', title: '',
selectVisible: false,
confirmLoading: false,
submitLoading: false,
isDisplayNum: '', isDisplayNum: '',
textTitle: '', textTitle: '',
isTrue: true, isTrue: true,
loading: false, loading: false,
selectLoading: false,
JTextLoading: false, JTextLoading: false,
isDisplay: true, isDisplay: true,
areaOfResponsibilityList: {}, areaOfResponsibilityList: {},
@@ -256,7 +309,43 @@
engineeringInterfacePerson: '', engineeringInterfacePerson: '',
roleSwitchName: '', roleSwitchName: '',
roleSwitchingList: [], roleSwitchingList: [],
visible: false visible: false,
userIds: '',
userName: '',
dataSource: [],
columns: [
{
title: this.$t('replacedPerson'),
align: 'left',
dataIndex: 'userName',
width: 180,
customRender: (value, row, index) => {
const obj = {
children: value,
attrs: {}
}
if (index === 0) {
obj.attrs.rowSpan = row.maxLength
} else {
obj.attrs.rowSpan = 0
}
return obj
}
},
{
title: this.$t('areaOfResponsibility'),
align: 'left',
dataIndex: 'title',
width: 180
},
{
title: this.$t('replacementPerson'),
align: 'left',
dataIndex: 'replacementPerson',
width: 180,
scopedSlots: {customRender: 'replacementPerson'}
}
]
} }
}, },
created() { created() {
@@ -279,7 +368,7 @@
// this.textColor(this.$t('taskList')) // this.textColor(this.$t('taskList'))
// this.textTitle = this.$t('taskList') // this.textTitle = this.$t('taskList')
this.$router.push({ this.$router.push({
path:'/projectRegulationTasks', path: '/projectRegulationTasks'
}) })
} else if (this.$route.query.type == '104') { } else if (this.$route.query.type == '104') {
// this.textColor(this.$t('nonConformance')) // this.textColor(this.$t('nonConformance'))
@@ -307,10 +396,85 @@
} }
}, },
methods: { methods: {
...mapGetters(['userInfo']),
textIconClick() { textIconClick() {
this.isDisplay = !this.isDisplay this.isDisplay = !this.isDisplay
}, },
...mapGetters(['userInfo']), globalReplacementClick() {
this.$refs.SelectedByRef.getPush()
},
SelectedByForm(userIds, userName) {
this.userIds = userIds
this.userName = userName
this.selectVisible = true
this.$refs.SelectedByRef.visible = false
this.$refs.SelectedByRef.submitLoading = false
this.getUserAllDutyTerritoryList()
},
getUserAllDutyTerritoryList() {
let query = {
projectLibraryId: this.$route.query.id,
userName: this.userName,
userId: this.userIds
}
this.selectLoading = true
getAction('/project/projectLibraryBase/getUserAllDutyTerritoryList', query).then((res) => {
if (res.success) {
this.dataSource = res.result || []
this.dataSource.forEach(val => {
val.newUserId = ''
val.userName = this.userName
val.maxLength = this.dataSource.length
})
this.selectLoading = false
} else {
this.dataSource = []
this.selectLoading = false
}
})
},
handleCancel() {
this.selectVisible = false
},
handleSubmit() {
if (this.dataSource.length > 0) {
let replacementUserList = []
this.dataSource.forEach(res => {
replacementUserList.push({
dutyTerritory: res.value,
newUserId: res.newUserId || '',
newUserName: res.newUserIdName || ''
})
})
let query = {
userId: this.userIds,
projectLibraryId: this.$route.query.id,
userName: this.userName,
replacementUserList: replacementUserList
}
this.submitLoading = true
postAction('/project/projectLibraryBase/overallReplacementUser', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.submitLoading = false
this.selectVisible = false
this.dataSource = []
this.userName = ''
this.userIds = ''
let textTitle = this.textTitle
this.textTitle = ''
this.$nextTick(() => {
this.textTitle = textTitle
})
} else {
this.$message.warning(this.$t('operationFailed'))
this.submitLoading = false
}
})
} else {
this.$message.warning(this.$t('thereReplaceableData'))
}
},
textColor(name) { textColor(name) {
let textColor = document.getElementsByClassName('Virtual-detail-left-text-color') let textColor = document.getElementsByClassName('Virtual-detail-left-text-color')
if (textColor && textColor.length > 0) { if (textColor && textColor.length > 0) {
@@ -466,6 +630,10 @@
} }
this.JTextLoading = false this.JTextLoading = false
this.visible = false this.visible = false
},
PersonnelSelectionChange(value, id, index) {
this.dataSource[index][value] = id
this.dataSource = [...this.dataSource]
} }
} }
} }
@@ -597,6 +765,19 @@
.operator-text-title-color { .operator-text-title-color {
color: #00B3BE; color: #00B3BE;
} }
.drawer-bootom-button {
position: absolute;
bottom: 0;
z-index: 100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style> </style>
<style> <style>
.popconfirmDetails { .popconfirmDetails {