法规清单-批量设置-中相关人员名单

This commit is contained in:
cuijiaming
2023-04-19 11:05:47 +08:00
parent 79faea7462
commit e4efca2365
@@ -643,45 +643,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
}
}
// if(projectRelatedPersonnelList.size()>0){
// for(ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnelList){
// if(enginnerList.size()<0){
// //直接将allList存入到
// String all = String.join(",",allDutyList);
// projectRelatedPersonnel.setEngineerLawSet(all);
//// projectRelatedPersonnelService.editById(projectRelatedPersonnel);
//
// }else {
// enginnerList = enginnerList.stream().distinct().collect(Collectors.toList());
// //比较allList中有而enginnerList中没有的工程接口人
// allDutyList.removeAll(enginnerList);
//// if(allDutyList.size()>0){
//// flag = CollectionUtils.isEqualCollection(allDutyList,enginnerList);
//// if(!flag){
//// //进行遍历两个list将allList中有的而enginnerList没有的存入到相关人员名单中的法规那里
////
//// for(String all : allDutyList){
//// boolean flag1 = true;
//// for(String enginner : enginnerList){
//// if(all.equals(enginner)){
//// flag1 = false;
//// break;
//// }
//// }
//// if(flag1){
//// resultList.add(all);
//// }
//// }
//// }
//// }
// //将相关人员名单中没有的resultList添加到相关人员记录表中
// String result = String.join(",",allDutyList);
// projectRelatedPersonnel.setEngineerLawSet(result);
//// projectRelatedPersonnelService.editById(projectRelatedPersonnel);
// }
// }
// }
this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList);
@@ -4400,6 +4361,174 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.updateBatchById(projectLawsInventoryEOList);
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String DesdutyId = projectLawsInventoryEOList.get(0).getDesignDutyId();
String VerdutyId = projectLawsInventoryEOList.get(0).getVerifyDutyId();
List<String> dutyTerritoryList = new ArrayList<>();
//获取批量设置中责任领域
String dutyTerritory = projectLawsInventoryEOList.get(0).getDutyTerritory();
if(!StringUtils.isEmpty(dutyTerritory)){
for(ProjectLawsInventoryEO info : infoList) {
info.setDutyTerritory(dutyTerritory);
}
}
if(!StringUtils.isEmpty(DesdutyId)){
for(ProjectLawsInventoryEO info : infoList) {
info.setDesignDutyId(DesdutyId);
}
}
if(!StringUtils.isEmpty(VerdutyId)){
for(ProjectLawsInventoryEO info : infoList) {
info.setVerifyDutyId(VerdutyId);
}
}
if(!StringUtils.isEmpty(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);
}
dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
}
// 获取当前的projectLibrartId
String projectLibrartId = infoEOList.get(0).getProjectLibraryId();
String cut = infoEOList.get(0).getCut();
Map<String,Object> params = new HashMap<>();
params.put("projectLibraryId",projectLibrartId);
params.put("userId",currentUser.getId());
params.put("modelType",RoleRelModelTypeEnum.LAWS_INVENTORY.getValue());
ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params);
String roleCode1 = projectLibraryRoleRelEO.getRoleCode();
//获取相关责任领域下的和projectLibrartId的相关人员名单的信息
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectLibrartId, dutyTerritoryList);
List<ProjectRelatedPersonnel> list = new ArrayList<>();
for(ProjectLawsInventoryEO projectLawsInventoryEO1 : infoList){
//分别获取当前编辑中的设计符合性和认证符合性责任人
List<String> designDutyIdList = new ArrayList<>();
designDutyIdList = Arrays.asList(projectLawsInventoryEO1.getDesignDutyId().split(","));
List<String> verifyDutyIdList = new ArrayList<>();
verifyDutyIdList = Arrays.asList(projectLawsInventoryEO1.getVerifyDutyId().split(","));
//allDutyList 为法规工程师中验证符合性和确认符合中的责任人
List<String> allDutyList = new ArrayList<>();
allDutyList.addAll(designDutyIdList);
allDutyList.addAll(verifyDutyIdList);
allDutyList = allDutyList.stream().distinct().collect(Collectors.toList());
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 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.isEmpty(dutyPerson)){
if(!allList.contains(dutyPerson)){
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);
}
}
}
}
}
}
}
list.addAll(projectRelatedPersonnelList);
// this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList);
}
this.projectRelatedPersonnelService.updateBatchById(list);
projectLawsInventoryEOList.forEach(projectLawsInventory -> {
//更新三个符合性流程中的处理人
this.updateFlowInfo(projectLawsInventory);