项目库-全局替换用户功能开发。

This commit is contained in:
wangzhijiang
2023-07-14 18:01:17 +08:00
parent 7ed4fabd8d
commit 75125dd49b
14 changed files with 923 additions and 619 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;
@@ -107,4 +108,10 @@ public interface IParamsManifestEOService extends IService<ParamsManifestEO> {
* @return * @return
*/ */
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params); List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
} }
@@ -2,6 +2,7 @@ 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -1151,7 +1152,7 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
QueryWrapper<ParamsCollectManifestEO> pcmQueryWrap = new QueryWrapper<>(); QueryWrapper<ParamsCollectManifestEO> pcmQueryWrap = new QueryWrapper<>();
pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList); pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList);
pcmQueryWrap.and(pcmQuery -> { pcmQueryWrap.and(pcmQuery -> {
pcmQuery.lambda().eq(ParamsCollectManifestEO::getDre,userName).or().like(ParamsCollectManifestEO::getSdt,userName); pcmQuery.lambda().eq(ParamsCollectManifestEO::getDre,userName).or().eq(ParamsCollectManifestEO::getSdt,userName);
}); });
List<ParamsCollectManifestEO> pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap); List<ParamsCollectManifestEO> pcmEoList = this.paramsCollectManifestEOService.list(pcmQueryWrap);
if(CollectionUtils.isNotEmpty(pcmEoList)){ if(CollectionUtils.isNotEmpty(pcmEoList)){
@@ -1171,4 +1172,48 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
} }
return result; 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);
}
}
}
}
} }
@@ -300,4 +300,11 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
List<DictModel> resList = this.projectLibraryBaseService.getUserAllDutyTerritoryList(params); List<DictModel> resList = this.projectLibraryBaseService.getUserAllDutyTerritoryList(params);
return Result.OK(resList); return Result.OK(resList);
} }
@AutoLog(value = "全局替换用户")
@ApiOperation(value="全局替换用户", notes="全局替换用户")
@PostMapping(value = "/overallReplacementUser")
public Result<?> overallReplacementUser(@RequestBody JSONObject json){
return this.projectLibraryBaseService.overallReplacementUser(json);
}
} }
@@ -326,4 +326,10 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @return * @return
*/ */
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params); List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
} }
@@ -316,4 +316,10 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
* @return * @return
*/ */
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params); List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/***
* 替换用户
* @param params
*/
void replacementUser(JSONObject json);
} }
@@ -1,8 +1,10 @@
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.common.system.vo.DictModel;
import com.jero.modules.project.entity.ProjectLibraryBase; import com.jero.modules.project.entity.ProjectLibraryBase;
@@ -175,4 +177,11 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
* @return * @return
*/ */
List<DictModel> getUserAllDutyTerritoryList(Map<String, Object> params); List<DictModel> getUserAllDutyTerritoryList(Map<String, Object> params);
/**
* 全局替换用户
* @param json
* @return
*/
Result<?> overallReplacementUser(JSONObject json);
} }
@@ -1,5 +1,6 @@
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.common.system.vo.DictModel;
@@ -112,4 +113,10 @@ public interface IProjectRelatedPersonnelService extends IService<ProjectRelated
* @return * @return
*/ */
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params); List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
/**
* 替换用户
* @param json
*/
void replacementUser(JSONObject json);
} }
@@ -242,6 +242,7 @@ public class ProjectLawsInventoryEOEditServiceImpl {
List<String> verifyTaskIdList = new ArrayList<>(); List<String> verifyTaskIdList = new ArrayList<>();
List<ProcessInfoDetailEO> updatePidEoList = new ArrayList<>(); List<ProcessInfoDetailEO> updatePidEoList = new ArrayList<>();
for (ProjectLawsInventoryEO oldPliEo : oldPliEoList) { for (ProjectLawsInventoryEO oldPliEo : oldPliEoList) {
if(StringUtils.isNotEmpty(newPliEo.getDesignDutyId())){
boolean designDutyTaskFlag = ( boolean designDutyTaskFlag = (
StringUtils.equals(oldPliEo.getDesignFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) 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.RESULTS_TO_BE_SUBMITTED.getValue())
@@ -272,7 +273,9 @@ public class ProjectLawsInventoryEOEditServiceImpl {
designTaskIdList.addAll(designPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList())); designTaskIdList.addAll(designPidEoList.stream().map(ProcessInfoDetailEO::getTaskId).collect(Collectors.toList()));
} }
} }
}
if(StringUtils.isNotEmpty(newPliEo.getVerifyDutyId())){
boolean verifyDutyTaskFlag = ( boolean verifyDutyTaskFlag = (
StringUtils.equals(oldPliEo.getVerifyFlowStatus(), ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) 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.RESULTS_TO_BE_SUBMITTED.getValue())
@@ -304,6 +307,7 @@ public class ProjectLawsInventoryEOEditServiceImpl {
} }
} }
} }
}
if (CollectionUtils.isNotEmpty(updatePidEoList)) { if (CollectionUtils.isNotEmpty(updatePidEoList)) {
// 更新组装好的 责任人待办任务。 // 更新组装好的 责任人待办任务。
this.processInfoDetailEOService.updateBatchById(updatePidEoList); this.processInfoDetailEOService.updateBatchById(updatePidEoList);
@@ -6240,8 +6240,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>(); QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId); pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
pciQueryWrap.and(pciQuery -> { pciQueryWrap.and(pciQuery -> {
pciQuery.lambda().like(ProjectCertificationInventoryEO::getDutyPerson,userId) pciQuery.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,userId)
.or().like(ProjectCertificationInventoryEO::getSdt,userId); .or().eq(ProjectCertificationInventoryEO::getSdt,userId);
}); });
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap); List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
@@ -6265,4 +6265,48 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
return result; 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);
}
}
} }
@@ -13694,9 +13694,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
QueryWrapper<ProjectLawsInventoryEO> pliQueryWrap = new QueryWrapper<>(); QueryWrapper<ProjectLawsInventoryEO> pliQueryWrap = new QueryWrapper<>();
pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
pliQueryWrap.and(pliQuery -> { pliQueryWrap.and(pliQuery -> {
pliQuery.lambda().like(ProjectLawsInventoryEO::getRegulationOwnerId,userId) pliQuery.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId,userId)
.or().like(ProjectLawsInventoryEO::getDesignDutyId,userId) .or().eq(ProjectLawsInventoryEO::getDesignDutyId,userId)
.or().like(ProjectLawsInventoryEO::getVerifyDutyId,userId); .or().eq(ProjectLawsInventoryEO::getVerifyDutyId,userId);
}); });
List<ProjectLawsInventoryEO> pliEoList = this.list(pliQueryWrap); List<ProjectLawsInventoryEO> pliEoList = this.list(pliQueryWrap);
if(CollectionUtils.isNotEmpty(pliEoList)){ if(CollectionUtils.isNotEmpty(pliEoList)){
@@ -13718,4 +13718,56 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
return result; 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;
@@ -2628,6 +2629,23 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
return result; 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;
@@ -1903,13 +1904,51 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList"); List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
QueryWrapper<ProjectRelatedPersonnel> prpQueryWrap = new QueryWrapper<>(); QueryWrapper<ProjectRelatedPersonnel> prpQueryWrap = new QueryWrapper<>();
prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId,projectLibraryId); prpQueryWrap.lambda().eq(ProjectRelatedPersonnel::getProjectId,projectLibraryId);
prpQueryWrap.and(prpQuery -> {
prpQuery.lambda().like(ProjectRelatedPersonnel::getLawEngineer,userId)
.or().like(ProjectRelatedPersonnel::getEngineerLawSet,userId)
.or().like(ProjectRelatedPersonnel::getEngineeringInterfacePerson,userId)
.or().like(ProjectRelatedPersonnel::getEngineerAttSet,userId);
});
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = this.list(prpQueryWrap); 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)){ if(CollectionUtils.isNotEmpty(projectRelatedPersonnelList)){
List<String> dutyTerritoryIdList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getDutyTerritory).distinct().collect(Collectors.toList()); List<String> dutyTerritoryIdList = projectRelatedPersonnelList.stream().map(ProjectRelatedPersonnel::getDutyTerritory).distinct().collect(Collectors.toList());
result = dutyTerritorySdiList.stream().filter(dutyTerritory -> { result = dutyTerritorySdiList.stream().filter(dutyTerritory -> {
@@ -1926,4 +1965,46 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
return result; 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);
}
}
} }
@@ -7,7 +7,7 @@
style="margin-right: 8px;font-size: 30px;color: #21c9cc;"/> style="margin-right: 8px;font-size: 30px;color: #21c9cc;"/>
</span> </span>
<span> <span>
{{this.title}} {{ this.title }}
</span> </span>
</div> </div>
<div class="Virtual-detail-text-right"> <div class="Virtual-detail-text-right">
@@ -15,7 +15,7 @@
v-has="'projectComment:list'" v-has="'projectComment:list'"
@click="globalReplacementClick"> @click="globalReplacementClick">
<a-icon type="qrcode"/> <a-icon type="qrcode"/>
{{$t('globalReplacement')}} {{ $t('globalReplacement') }}
</div> </div>
<!-- <div class="operator-text"--> <!-- <div class="operator-text"-->
<!-- v-if="textTitle === $t('listOfRegulations')"--> <!-- v-if="textTitle === $t('listOfRegulations')"-->
@@ -29,19 +29,19 @@
v-has="'projectComment:list'" v-has="'projectComment:list'"
@click="todocenterClick"> @click="todocenterClick">
<a-icon type="qrcode"/> <a-icon type="qrcode"/>
{{$t('todocenter')}} {{ $t('todocenter') }}
</div> </div>
<div class="operator-text" v-has="'projectLawsInventoryLog:page'" <div class="operator-text" v-has="'projectLawsInventoryLog:page'"
v-if="textTitle === $t('listOfRegulations')" v-if="textTitle === $t('listOfRegulations')"
@click="UpdateLogClick"> @click="UpdateLogClick">
<a-icon type="reload"/> <a-icon type="reload"/>
{{$t('UpdateLog')}} {{ $t('UpdateLog') }}
</div> </div>
<div class="operator-text" v-has="'projectHistoryVersions:list'" <div class="operator-text" v-has="'projectHistoryVersions:list'"
v-if="textTitle === $t('listOfRegulations')" v-if="textTitle === $t('listOfRegulations')"
@click="historicalVersionClick"> @click="historicalVersionClick">
<a-icon type="clock-circle"/> <a-icon type="clock-circle"/>
{{$t('historicalVersion')}} {{ $t('historicalVersion') }}
</div> </div>
<a-popconfirm overlayClassName="popconfirmDetails" <a-popconfirm overlayClassName="popconfirmDetails"
:visible="visible" :visible="visible"
@@ -60,7 +60,7 @@
<div class="operator-text" style="position: relative" <div class="operator-text" style="position: relative"
v-if="(textTitle === $t('certificationList') || textTitle === $t('listOfRegulations')) && roleSwitchName"> v-if="(textTitle === $t('certificationList') || textTitle === $t('listOfRegulations')) && roleSwitchName">
<a-icon type="select"/> <a-icon type="select"/>
{{roleSwitchName}} {{ roleSwitchName }}
</div> </div>
</a-popconfirm> </a-popconfirm>
<!-- <div class="operator-text"--> <!-- <div class="operator-text"-->
@@ -79,18 +79,18 @@
v-if="isTrue" v-if="isTrue"
@click="textClick(0,$t('projectDetails'))"> @click="textClick(0,$t('projectDetails'))">
<a-icon type="container"/> <a-icon type="container"/>
{{$t('projectDetails')}} {{ $t('projectDetails') }}
</div> </div>
<div class="Virtual-detail-left-text" v-has="'projectLawsInventory:list'" :title="$t('listOfRegulations')" <div class="Virtual-detail-left-text" v-has="'projectLawsInventory:list'" :title="$t('listOfRegulations')"
@click="textClick(1,$t('listOfRegulations'))"> @click="textClick(1,$t('listOfRegulations'))">
<a-icon type="control"/> <a-icon type="control"/>
{{$t('listOfRegulations')}} {{ $t('listOfRegulations') }}
</div> </div>
<div class="Virtual-detail-left-text" :title="$t('certificationList')" <div class="Virtual-detail-left-text" :title="$t('certificationList')"
v-has="'projectLawsInventory:CertificationList'" v-has="'projectLawsInventory:CertificationList'"
@click="textClick(6,$t('certificationList'))"> @click="textClick(6,$t('certificationList'))">
<a-icon type="safety"/> <a-icon type="safety"/>
{{$t('certificationList')}} {{ $t('certificationList') }}
</div> </div>
<!-- <div class="Virtual-detail-left-text" :title="$t('taskList')"--> <!-- <div class="Virtual-detail-left-text" :title="$t('taskList')"-->
<!-- v-has="'projectLawsInventory:taskList'"--> <!-- v-has="'projectLawsInventory:taskList'"-->
@@ -107,7 +107,7 @@
:title="$t('TaskParameterCollection')" :title="$t('TaskParameterCollection')"
@click="textClick(4,$t('TaskParameterCollection'))"> @click="textClick(4,$t('TaskParameterCollection'))">
<a-icon type="profile"/> <a-icon type="profile"/>
{{$t('TaskParameterCollection')}} {{ $t('TaskParameterCollection') }}
</div> </div>
<!-- <div class="Virtual-detail-left-text"--> <!-- <div class="Virtual-detail-left-text"-->
<!-- :title="$t('projectStatus')"--> <!-- :title="$t('projectStatus')"-->
@@ -219,30 +219,30 @@
</a-table> </a-table>
</a-spin> </a-spin>
<div class="drawer-bootom-button"> <div class="drawer-bootom-button">
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-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> <a-button @click="handleSubmit" type="primary" :loading="submitLoading">{{ $t('submit') }}</a-button>
</div> </div>
</a-drawer> </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 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'
import nonConformance from '../components/nonConformance' import nonConformance from '../components/nonConformance'
import projectStatus from '../components/projectStatus' import projectStatus from '../components/projectStatus'
import updateLog from '@/components/UpdateLog/index' import updateLog from '@/components/UpdateLog/index'
import historicalVersionList from '../components/historicalVersionList' import historicalVersionList from '../components/historicalVersionList'
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 PersonnelSelection from '@/components/PersonnelSelection/index'
import { mapGetters } from 'vuex' import {mapGetters} from 'vuex'
export default { export default {
name: 'ProjectDetails', name: 'ProjectDetails',
components: { components: {
TaskList, TaskList,
@@ -343,7 +343,7 @@
align: 'left', align: 'left',
dataIndex: 'replacementPerson', dataIndex: 'replacementPerson',
width: 180, width: 180,
scopedSlots: { customRender: 'replacementPerson' } scopedSlots: {customRender: 'replacementPerson'}
} }
] ]
} }
@@ -449,14 +449,18 @@
let query = { let query = {
userId: this.userIds, userId: this.userIds,
projectLibraryId: this.$route.query.id, projectLibraryId: this.$route.query.id,
userName: this.userName,
replacementUserList: replacementUserList replacementUserList: replacementUserList
} }
this.submitLoading = true this.submitLoading = true
getAction('/project/projectLibraryBase/overallReplacementUser', query).then((res) => { postAction('/project/projectLibraryBase/overallReplacementUser', query).then((res) => {
if (res.success) { if (res.success) {
this.$message.success(this.$t('OperationSuccessful')) this.$message.success(this.$t('OperationSuccessful'))
this.submitLoading = false this.submitLoading = false
this.selectVisible = false this.selectVisible = false
this.dataSource = []
this.userName = ''
this.userIds = ''
let textTitle = this.textTitle let textTitle = this.textTitle
this.textTitle = '' this.textTitle = ''
this.$nextTick(() => { this.$nextTick(() => {
@@ -531,7 +535,7 @@
}) })
}, },
UpdateLogClick() { UpdateLogClick() {
this.$refs.updateLogRef.getList({ projectLibraryId: this.$route.query.id }) this.$refs.updateLogRef.getList({projectLibraryId: this.$route.query.id})
}, },
historicalVersionClick() { historicalVersionClick() {
this.$refs.historicalVersionListRef.getList() this.$refs.historicalVersionListRef.getList()
@@ -632,13 +636,13 @@
this.dataSource = [...this.dataSource] this.dataSource = [...this.dataSource]
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
.doc-detail { .doc-detail {
background: #fff; background: #fff;
height: 100%; height: 100%;
position: relative; position: relative;
@@ -716,53 +720,53 @@
overflow: auto; overflow: auto;
transition: all 0.2s; transition: all 0.2s;
} }
} }
.Virtual-detail-left-text-color { .Virtual-detail-left-text-color {
background: #eff1f3; background: #eff1f3;
border-radius: 4px; border-radius: 4px;
} }
.Virtual-detail-text-right { .Virtual-detail-text-right {
} }
.text-icon { .text-icon {
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
font-size: 22px; font-size: 22px;
position: absolute; position: absolute;
left: 200px; left: 200px;
bottom: 20px; bottom: 20px;
transition: all 0.2s; transition: all 0.2s;
} }
.text-icon-one { .text-icon-one {
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
font-size: 22px; font-size: 22px;
position: absolute; position: absolute;
left: 22px; left: 22px;
bottom: 20px; bottom: 20px;
transition: all 0.2s; transition: all 0.2s;
} }
.operator-text-title { .operator-text-title {
cursor: pointer; cursor: pointer;
margin-right: 22px; margin-right: 22px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #040B29; color: #040B29;
margin-bottom: 22px; margin-bottom: 22px;
} }
.operator-text-title:last-child { .operator-text-title:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.operator-text-title-color { .operator-text-title-color {
color: #00B3BE; color: #00B3BE;
} }
.drawer-bootom-button { .drawer-bootom-button {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
z-index: 100; z-index: 100;
@@ -773,19 +777,19 @@
left: 0; left: 0;
background: #fff; background: #fff;
border-radius: 0 0 2px 2px; border-radius: 0 0 2px 2px;
} }
</style> </style>
<style> <style>
.popconfirmDetails { .popconfirmDetails {
z-index: 999; z-index: 999;
top: 42px !important; top: 42px !important;
} }
.popconfirmDetails .ant-popover-buttons { .popconfirmDetails .ant-popover-buttons {
display: none !important; display: none !important;
} }
.popconfirmDetails .anticon-exclamation-circle { .popconfirmDetails .anticon-exclamation-circle {
display: none !important; display: none !important;
} }
</style> </style>