项目库-全局替换用户功能优化。

This commit is contained in:
wangzhijiang
2023-07-17 11:52:12 +08:00
parent 75125dd49b
commit 749c14dcef
3 changed files with 80 additions and 31 deletions
@@ -44,12 +44,22 @@ public class ProjectLawsInventoryEOEditServiceImpl {
* @param newPliEo 新的法规清单对象
* @param oldPliEoList 旧的法规清单数组
*/
public void updateRegulationOwner(ProjectLawsInventoryEO newPliEo, List<ProjectLawsInventoryEO> oldPliEoList) {
public void updateRegulationOwner(ProjectLawsInventoryEO newPliEo, List<ProjectLawsInventoryEO> oldPliEoList,List<ProcessInfoDetailEO> pidList) {
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);
// QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
// pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList);
// List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
List<ProcessInfoDetailEO> pidEoList = pidList.stream().filter(pid -> {
boolean flag = false;
for (String oldPliEoId : oldPliEoIdList) {
if(StringUtils.equals(oldPliEoId,pid.getProjectLawsInventoryId())){
flag = true;
break;
}
}
return flag;
}).distinct().collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pidEoList)){
List<String> taskIdList = new ArrayList<>();
List<ProcessInfoDetailEO> updatePidEoList = new ArrayList<>();
@@ -231,12 +241,22 @@ public class ProjectLawsInventoryEOEditServiceImpl {
* @param newPliEo 新的法规清单对象
* @param oldPliEoList 旧的法规清单数组
*/
public void updateDutyPerson(ProjectLawsInventoryEO newPliEo, List<ProjectLawsInventoryEO> oldPliEoList) {
public void updateDutyPerson(ProjectLawsInventoryEO newPliEo, List<ProjectLawsInventoryEO> oldPliEoList,List<ProcessInfoDetailEO> pidList) {
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);
// QueryWrapper<ProcessInfoDetailEO> pidEoQueryWrap = new QueryWrapper<>();
// pidEoQueryWrap.lambda().in(ProcessInfoDetailEO::getProjectLawsInventoryId, oldPliEoIdList);
// List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidEoQueryWrap);
List<ProcessInfoDetailEO> pidEoList = pidList.stream().filter(pid -> {
boolean flag = false;
for (String oldPliEoId : oldPliEoIdList) {
if(StringUtils.equals(oldPliEoId,pid.getProjectLawsInventoryId())){
flag = true;
break;
}
}
return flag;
}).distinct().collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pidEoList)){
List<String> designTaskIdList = new ArrayList<>();
List<String> verifyTaskIdList = new ArrayList<>();
@@ -6287,9 +6287,10 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
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);
// QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
// certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,pciEo.getId());
// List<ProjectCertificationInventoryEO> oldPciEoList = this.list(certificationQueryWrap);
List<ProjectCertificationInventoryEO> oldPciEoList = pciEoList.stream().filter(p -> StringUtils.equals(p.getId(),pciEo.getId())).distinct().collect(Collectors.toList());
// 编辑责任人处理逻辑
this.editDutyPerson(newPciEo, oldPciEoList);
@@ -507,10 +507,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<ProjectLawsInventoryEO> oldPliEoList = this.list(oldPliQueryWrap);
this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO);
// 处理编辑法规工程师的逻辑
this.editService.updateRegulationOwner(projectLawsInventoryEO,oldPliEoList);
// 处理编辑责任人的逻辑
this.editService.updateDutyPerson(projectLawsInventoryEO,oldPliEoList);
// 根据法规清单id获取该法规清单在待办中心的任务明细
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)){
// 处理编辑法规工程师的逻辑
this.editService.updateRegulationOwner(projectLawsInventoryEO,oldPliEoList,pidEoList);
// 处理编辑责任人的逻辑
this.editService.updateDutyPerson(projectLawsInventoryEO,oldPliEoList,pidEoList);
}
// 处理修改设计或验证符合性截止日期的逻辑
this.editService.updateDesignOrVerifyEndTime(projectLawsInventoryEO,oldPliEoList);
@@ -4329,10 +4337,16 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
// 发送消息
this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO);
}
// 根据法规清单id获取该法规清单在待办中心的任务明细
List<String> oldPliEoIdList = infoList.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);
// 处理编辑法规工程师的逻辑
this.editService.updateRegulationOwner(projectLawsInventoryEO,infoList);
this.editService.updateRegulationOwner(projectLawsInventoryEO,infoList,pidEoList);
// 处理编辑责任人的逻辑
this.editService.updateDutyPerson(projectLawsInventoryEO,infoList);
this.editService.updateDutyPerson(projectLawsInventoryEO,infoList,pidEoList);
// 处理修改设计或验证符合性截止日期的逻辑
this.editService.updateDesignOrVerifyEndTime(projectLawsInventoryEO,infoList);
@@ -13728,6 +13742,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId, projectLibraryId);
List<ProjectLawsInventoryEO> pliEoList = this.list(pliQueryWrap);
// 根据法规清单id获取该法规清单在待办中心的任务明细
List<String> oldPliEoIdList = pliEoList.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);
List<ProjectLawsInventoryEO> updateEoList = new ArrayList<>();
for (Map<String, Object> replacementUserMap : replacementUserList) {
String dutyTerritory = (String) replacementUserMap.get("dutyTerritory");
@@ -13735,31 +13755,39 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
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);
// QueryWrapper<ProjectLawsInventoryEO> oldPliQueryWrap = new QueryWrapper<>();
// oldPliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getId,pliEo.getId());
// List<ProjectLawsInventoryEO> oldPliEoList = this.list(oldPliQueryWrap);
// 过滤出来修改之前的法规清单数据
List<ProjectLawsInventoryEO> oldPliEoList = pliEoList.stream().filter(p -> StringUtils.equals(p.getId(),pliEo.getId())).distinct().collect(Collectors.toList());
ProjectLawsInventoryEO newPliEo = new ProjectLawsInventoryEO();
if (StringUtils.equals(pliEo.getRegulationOwnerId(), userId)) {
newPliEo.setRegulationOwnerId(newUserId);
// 处理编辑法规工程师的逻辑
this.editService.updateRegulationOwner(newPliEo, oldPliEoList);
this.editService.updateRegulationOwner(newPliEo, oldPliEoList,pidEoList);
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);
if(StringUtils.equals(pliEo.getDesignDutyId(), userId) || StringUtils.equals(pliEo.getVerifyDutyId(), userId)){
if (StringUtils.equals(pliEo.getDesignDutyId(), userId)) {
newPliEo.setDesignDutyId(newUserId);
}
if (StringUtils.equals(pliEo.getVerifyDutyId(), userId)) {
newPliEo.setVerifyDutyId(newUserId);
}
// 处理编辑责任人的逻辑
this.editService.updateDutyPerson(newPliEo, oldPliEoList,pidEoList);
if (StringUtils.equals(pliEo.getDesignDutyId(), userId)) {
pliEo.setDesignDutyId(newUserId);
}
if (StringUtils.equals(pliEo.getVerifyDutyId(), userId)) {
pliEo.setVerifyDutyId(newUserId);
}
}
updateEoList.add(pliEo);
}
}