修改法规清单批量设置报错

This commit is contained in:
高嵩
2023-06-14 15:55:01 +08:00
parent 7c019a8d66
commit 522475cfd7
@@ -4433,27 +4433,27 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<String> dutyTerritoryList = new ArrayList<>(); List<String> dutyTerritoryList = new ArrayList<>();
//获取批量设置中责任领域 //获取批量设置中责任领域
String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); String dutyTerritory = projectLawsInventoryEO.getDutyTerritory();
if (!StringUtils.isEmpty(dutyTerritory)) { if (StringUtils.isNotEmpty(dutyTerritory)) {
for (ProjectLawsInventoryEO info : infoList) { for (ProjectLawsInventoryEO info : infoList) {
info.setDutyTerritory(dutyTerritory); info.setDutyTerritory(dutyTerritory);
} }
dutyTerritoryList = Arrays.asList(dutyTerritory.split(",")); dutyTerritoryList = Arrays.asList(dutyTerritory.split(","));
dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
} else { } else {
for (ProjectLawsInventoryEO info : infoList) { for (ProjectLawsInventoryEO info : infoList) {
List<String> dutyList = new ArrayList<>(); if (StringUtils.isNotEmpty(info.getDutyTerritory())) {
dutyList = Arrays.asList(info.getDutyTerritory().split(",")); dutyTerritoryList.addAll(Arrays.asList(info.getDutyTerritory().split(",")));
dutyTerritoryList.addAll(dutyList); }
} }
dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
} }
if (!StringUtils.isEmpty(desdutyId)) { dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
if (StringUtils.isNotEmpty(desdutyId)) {
for (ProjectLawsInventoryEO info : infoList) { for (ProjectLawsInventoryEO info : infoList) {
info.setDesignDutyId(desdutyId); info.setDesignDutyId(desdutyId);
} }
} }
if (!StringUtils.isEmpty(verdutyId)) { if (StringUtils.isNotEmpty(verdutyId)) {
for (ProjectLawsInventoryEO info : infoList) { for (ProjectLawsInventoryEO info : infoList) {
info.setVerifyDutyId(verdutyId); info.setVerifyDutyId(verdutyId);
} }
@@ -4467,132 +4467,125 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
params.put("userId", currentUser.getId()); params.put("userId", currentUser.getId());
params.put("modelType", RoleRelModelTypeEnum.LAWS_INVENTORY.getValue()); params.put("modelType", RoleRelModelTypeEnum.LAWS_INVENTORY.getValue());
ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params); ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params);
//获取当前项目库id的studio工程师和认证工程师
List<String> studionList = new ArrayList<>();
List<String> certificationEngineerList = new ArrayList<>();
List<ProjectLibraryBase> projectLibraryBases = projectLibraryBaseService.queryById(projectLibrartId, cut);
String roleCode1 = projectLibraryRoleRelEO.getRoleCode(); String roleCode1 = projectLibraryRoleRelEO.getRoleCode();
if(CollectionUtils.isNotEmpty(dutyTerritoryList)){
//获取相关责任领域下的和projectLibrartId的相关人员名单的信息
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectLibrartId, dutyTerritoryList);
if(CollectionUtils.isNotEmpty(projectRelatedPersonnelList)){
List<ProjectRelatedPersonnel> updatePrpEoList = new ArrayList<>();
//获取相关责任领域下的和projectLibrartId的相关人员名单的信息 for (ProjectLawsInventoryEO projectLawsInventoryEO1 : infoList) {
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectLibrartId, dutyTerritoryList);
List<ProjectRelatedPersonnel> list = new ArrayList<>(); //分别获取当前编辑中的设计符合性和认证符合性责任人
List<String> designDutyIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO1.getDesignDutyId())) {
designDutyIdList = Arrays.asList(projectLawsInventoryEO1.getDesignDutyId().split(","));
}
for (ProjectLawsInventoryEO projectLawsInventoryEO1 : infoList) { List<String> verifyDutyIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO1.getVerifyDutyId())) {
verifyDutyIdList = Arrays.asList(projectLawsInventoryEO1.getVerifyDutyId().split(","));
}
//分别获取当前编辑中的设计符合性和认证符合性责任人 //allDutyList 为法规工程师中验证符合性和确认符合中的责任人
List<String> designDutyIdList = new ArrayList<>(); List<String> allDutyList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO1.getDesignDutyId())) { allDutyList.addAll(designDutyIdList);
designDutyIdList = Arrays.asList(projectLawsInventoryEO1.getDesignDutyId().split(",")); allDutyList.addAll(verifyDutyIdList);
} allDutyList = allDutyList.stream().distinct().collect(Collectors.toList());
List<String> verifyDutyIdList = new ArrayList<>(); List<String> allList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO1.getVerifyDutyId())) { List<String> enginnerList = new ArrayList<>();
verifyDutyIdList = Arrays.asList(projectLawsInventoryEO1.getVerifyDutyId().split(",")); List<String> lawEnginnerList = new ArrayList<>();
} List<String> enginnerLawSetList = new ArrayList<>();
List<String> enginnerAttSetList = new ArrayList<>();
//allDutyList 为法规工程师中验证符合性和确认符合中的责任人 for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
List<String> allDutyList = new ArrayList<>(); // 工程接口人
allDutyList.addAll(designDutyIdList); String enginneringInterfacePerson = relatedPersonnel.getEngineeringInterfacePerson();
allDutyList.addAll(verifyDutyIdList); if (!StringUtils.isEmpty(enginneringInterfacePerson)) {
allDutyList = allDutyList.stream().distinct().collect(Collectors.toList()); enginnerList = Arrays.stream(enginneringInterfacePerson.split(",")).collect(Collectors.toList());
allList.addAll(enginnerList);
}
List<String> allList = new ArrayList<>(); // 法规工程师
List<String> enginnerList = new ArrayList<>(); String lawEngineer = relatedPersonnel.getLawEngineer();
List<String> lawEnginnerList = new ArrayList<>(); if (!StringUtils.isEmpty(lawEngineer)) {
List<String> enginnerLawSetList = new ArrayList<>(); lawEnginnerList = Arrays.stream(lawEngineer.split(",")).collect(Collectors.toList());
List<String> enginnerAttSetList = new ArrayList<>(); allList.addAll(lawEnginnerList);
//根据相关人员名单获取的工程接口人 }
for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
String enginneringInterfacePerson = relatedPersonnel.getEngineeringInterfacePerson();
if (!StringUtils.isEmpty(enginneringInterfacePerson)) {
enginnerList = Arrays.stream(enginneringInterfacePerson.split(",")).collect(Collectors.toList());
allList.addAll(enginnerList);
}
}
//获取相关人员名单中的法规工程师
for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
String lawEngineer = relatedPersonnel.getLawEngineer();
if (!StringUtils.isEmpty(lawEngineer)) {
lawEnginnerList = Arrays.stream(lawEngineer.split(",")).collect(Collectors.toList());
allList.addAll(lawEnginnerList);
}
}
//获取相关人员名单中的工程接口-法规工程师设置
for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
String engineerLawSet = relatedPersonnel.getEngineerLawSet();
if (!StringUtils.isEmpty(engineerLawSet)) {
enginnerLawSetList = Arrays.stream(engineerLawSet.split(",")).collect(Collectors.toList());
allList.addAll(enginnerLawSetList);
}
}
//获取相关人员名单中的工程接口-认证工程师设置
for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
String engineerAttSet = relatedPersonnel.getEngineerAttSet();
if (!StringUtils.isEmpty(engineerAttSet)) {
enginnerAttSetList = Arrays.stream(engineerAttSet.split(",")).collect(Collectors.toList());
allList.addAll(enginnerAttSetList);
}
}
//获取当前项目库id的studio工程师和认证工程师
List<String> studionList = new ArrayList<>();
List<String> certificationEngineerList = new ArrayList<>();
List<ProjectLibraryBase> projectLibraryBases = projectLibraryBaseService.queryById(projectLibrartId, cut);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBases) {
studionList.add(projectLibraryBase.getStudioEngineer());
String certificationEngineer = projectLibraryBase.getCertificationEngineer(); // 工程接口-法规工程师设置
if (!StringUtils.isEmpty(certificationEngineer)) { String engineerLawSet = relatedPersonnel.getEngineerLawSet();
certificationEngineerList = Arrays.stream(certificationEngineer.split(",")).collect(Collectors.toList()); if (!StringUtils.isEmpty(engineerLawSet)) {
allList.addAll(certificationEngineerList); enginnerLawSetList = Arrays.stream(engineerLawSet.split(",")).collect(Collectors.toList());
} allList.addAll(enginnerLawSetList);
} }
allList = allList.stream().filter(all -> {
return StringUtils.isNotBlank(all); // 工程接口-认证工程师设置
}).distinct().collect(Collectors.toList()); String engineerAttSet = relatedPersonnel.getEngineerAttSet();
/* if (!StringUtils.isEmpty(engineerAttSet)) {
for(String all : allList){ enginnerAttSetList = Arrays.stream(engineerAttSet.split(",")).collect(Collectors.toList());
if(all.equals("")){ allList.addAll(enginnerAttSetList);
allList.remove(all); }
} }
}
*/ for (ProjectLibraryBase projectLibraryBase : projectLibraryBases) {
//遍历所有人alllist中是否包含责任人,如果包含,不用操作。 studionList.add(projectLibraryBase.getStudioEngineer());
//-------如果不包含,再去判断当前用户的角色是studio、法规还是认证
for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) { String certificationEngineer = projectLibraryBase.getCertificationEngineer();
if (allList.size() > 0) { if (!StringUtils.isEmpty(certificationEngineer)) {
for (String allDuty : allDutyList) { certificationEngineerList = Arrays.stream(certificationEngineer.split(",")).collect(Collectors.toList());
String dutyPerson = allDuty; allList.addAll(certificationEngineerList);
if (StringUtils.isNotEmpty(dutyPerson) && !allList.contains(dutyPerson) && StringUtils.isNotEmpty(roleCode1)) { }
if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue())) { }
if (relatedPersonnel.getEngineeringInterfacePerson() != null) { allList = allList.stream().filter(all -> {
String engineeringInterfacePerson = dutyPerson + "," + relatedPersonnel.getEngineeringInterfacePerson(); return StringUtils.isNotBlank(all);
relatedPersonnel.setEngineeringInterfacePerson(engineeringInterfacePerson); }).distinct().collect(Collectors.toList());
} else { //遍历所有人alllist中是否包含责任人,如果包含,不用操作。
relatedPersonnel.setEngineeringInterfacePerson(dutyPerson); //-------如果不包含,再去判断当前用户的角色是studio、法规还是认证
} for (ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList) {
} else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue())) { if (allList.size() > 0) {
if (relatedPersonnel.getEngineerLawSet() != null) { for (String allDuty : allDutyList) {
String engineerLawSet = dutyPerson + "," + relatedPersonnel.getEngineerLawSet(); String dutyPerson = allDuty;
relatedPersonnel.setEngineerLawSet(engineerLawSet); if (StringUtils.isNotEmpty(dutyPerson) && !allList.contains(dutyPerson) && StringUtils.isNotEmpty(roleCode1)) {
} else { if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue())) {
relatedPersonnel.setEngineerLawSet(dutyPerson); if (relatedPersonnel.getEngineeringInterfacePerson() != null) {
} String engineeringInterfacePerson = dutyPerson + "," + relatedPersonnel.getEngineeringInterfacePerson();
} else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) { relatedPersonnel.setEngineeringInterfacePerson(engineeringInterfacePerson);
if (relatedPersonnel.getEngineerAttSet() != null) { } else {
String engineerAttSet = dutyPerson + "," + relatedPersonnel.getEngineerAttSet(); relatedPersonnel.setEngineeringInterfacePerson(dutyPerson);
relatedPersonnel.setEngineerAttSet(engineerAttSet); }
} else { } else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.REGULATI_ENGINEER.getValue())) {
relatedPersonnel.setEngineerAttSet(dutyPerson); if (relatedPersonnel.getEngineerLawSet() != null) {
String engineerLawSet = dutyPerson + "," + relatedPersonnel.getEngineerLawSet();
relatedPersonnel.setEngineerLawSet(engineerLawSet);
} else {
relatedPersonnel.setEngineerLawSet(dutyPerson);
}
} else if (roleCode1.equals(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) {
if (relatedPersonnel.getEngineerAttSet() != null) {
String engineerAttSet = dutyPerson + "," + relatedPersonnel.getEngineerAttSet();
relatedPersonnel.setEngineerAttSet(engineerAttSet);
} else {
relatedPersonnel.setEngineerAttSet(dutyPerson);
}
}
} }
} }
} }
} }
updatePrpEoList.addAll(projectRelatedPersonnelList);
} }
this.projectRelatedPersonnelService.updateBatchById(updatePrpEoList);
} }
list.addAll(projectRelatedPersonnelList);
// this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList);
} }
this.projectRelatedPersonnelService.updateBatchById(list);
projectLawsInventoryEOList.forEach(projectLawsInventory -> { projectLawsInventoryEOList.forEach(projectLawsInventory -> {
//更新三个符合性流程中的处理人。 //更新三个符合性流程中的处理人。
this.updateFlowInfo(projectLawsInventory); this.updateFlowInfo(projectLawsInventory);