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

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