项目库-全局替换用户功能开发。
This commit is contained in:
+7
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.cert.collect.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@@ -107,4 +108,10 @@ public interface IParamsManifestEOService extends IService<ParamsManifestEO> {
|
||||
* @return
|
||||
*/
|
||||
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 替换用户
|
||||
* @param json
|
||||
*/
|
||||
void replacementUser(JSONObject json);
|
||||
}
|
||||
|
||||
+46
-1
@@ -2,6 +2,7 @@ package com.jero.modules.cert.collect.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -1151,7 +1152,7 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
|
||||
QueryWrapper<ParamsCollectManifestEO> pcmQueryWrap = new QueryWrapper<>();
|
||||
pcmQueryWrap.lambda().in(ParamsCollectManifestEO::getParamsManifestId,pmEoIdList);
|
||||
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);
|
||||
if(CollectionUtils.isNotEmpty(pcmEoList)){
|
||||
@@ -1171,4 +1172,48 @@ public class ParamsManifestEOServiceImpl extends ServiceImpl<ParamsManifestEOMap
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -300,4 +300,11 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -326,4 +326,10 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
|
||||
* @return
|
||||
*/
|
||||
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 替换用户
|
||||
* @param json
|
||||
*/
|
||||
void replacementUser(JSONObject json);
|
||||
}
|
||||
|
||||
+6
@@ -316,4 +316,10 @@ public interface IProjectLawsInventoryEOService extends IService<ProjectLawsInve
|
||||
* @return
|
||||
*/
|
||||
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
|
||||
|
||||
/***
|
||||
* 替换用户
|
||||
* @param params
|
||||
*/
|
||||
void replacementUser(JSONObject json);
|
||||
}
|
||||
|
||||
+9
@@ -1,8 +1,10 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
|
||||
@@ -175,4 +177,11 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
|
||||
* @return
|
||||
*/
|
||||
List<DictModel> getUserAllDutyTerritoryList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 全局替换用户
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
Result<?> overallReplacementUser(JSONObject json);
|
||||
}
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
@@ -112,4 +113,10 @@ public interface IProjectRelatedPersonnelService extends IService<ProjectRelated
|
||||
* @return
|
||||
*/
|
||||
List<SysDictItem> getUserDutyTerritoryList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 替换用户
|
||||
* @param json
|
||||
*/
|
||||
void replacementUser(JSONObject json);
|
||||
}
|
||||
|
||||
+60
-56
@@ -242,65 +242,69 @@ public class ProjectLawsInventoryEOEditServiceImpl {
|
||||
List<String> verifyTaskIdList = new ArrayList<>();
|
||||
List<ProcessInfoDetailEO> updatePidEoList = new ArrayList<>();
|
||||
for (ProjectLawsInventoryEO oldPliEo : oldPliEoList) {
|
||||
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.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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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(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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
-2
@@ -6240,8 +6240,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
|
||||
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
|
||||
pciQueryWrap.and(pciQuery -> {
|
||||
pciQuery.lambda().like(ProjectCertificationInventoryEO::getDutyPerson,userId)
|
||||
.or().like(ProjectCertificationInventoryEO::getSdt,userId);
|
||||
pciQuery.lambda().eq(ProjectCertificationInventoryEO::getDutyPerson,userId)
|
||||
.or().eq(ProjectCertificationInventoryEO::getSdt,userId);
|
||||
});
|
||||
List<ProjectCertificationInventoryEO> pciEoList = this.list(pciQueryWrap);
|
||||
|
||||
@@ -6265,4 +6265,48 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+55
-3
@@ -13694,9 +13694,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
QueryWrapper<ProjectLawsInventoryEO> pliQueryWrap = new QueryWrapper<>();
|
||||
pliQueryWrap.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
|
||||
pliQueryWrap.and(pliQuery -> {
|
||||
pliQuery.lambda().like(ProjectLawsInventoryEO::getRegulationOwnerId,userId)
|
||||
.or().like(ProjectLawsInventoryEO::getDesignDutyId,userId)
|
||||
.or().like(ProjectLawsInventoryEO::getVerifyDutyId,userId);
|
||||
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)){
|
||||
@@ -13718,4 +13718,56 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
@@ -2628,6 +2629,23 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
||||
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
|
||||
|
||||
+87
-6
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -1903,13 +1904,51 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
List<SysDictItem> dutyTerritorySdiList = (List<SysDictItem>) params.get("dutyTerritorySdiList");
|
||||
QueryWrapper<ProjectRelatedPersonnel> prpQueryWrap = new QueryWrapper<>();
|
||||
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);
|
||||
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 -> {
|
||||
@@ -1926,4 +1965,46 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user