bug66869修改

This commit is contained in:
cuijiaming
2023-04-04 14:19:18 +08:00
parent 70ba019844
commit be9a659bad
2 changed files with 264 additions and 71 deletions
@@ -164,6 +164,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
private IOSSFileService iOSSFileService;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService;
/**
* 保存
@@ -266,10 +268,22 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
saveOrUpdate(projectCertificationInventoryEO);
// //获取责任人的所有用户
// List<SysUser> listUserName = new ArrayList<>();
// listUserName = sysUserMapper.getListUserName();
// listUserName = listUserName.stream().distinct().collect(Collectors.toList());
//获取当前的projectId
String projectId = projectCertificationInventoryEO.getProjectLibraryId();
String cut = projectCertificationInventoryEO.getCut();
//获取当前用户
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
Map<String,Object> params = new HashMap<>();
params.put("projectLibraryId",projectId);
params.put("userId",currentUser.getId());
params.put("modelType",RoleRelModelTypeEnum.CERTIFICATION_INVENTORY.getValue());
ProjectLibraryRoleRelEO projectLibraryRoleRelEO = projectLibraryRoleRelEOService.queryByProjectLibraryIdAndUserId(params);
String roleCode = projectLibraryRoleRelEO.getRoleCode();
// //判断当前用户与studio工程师是否一致,一致的话具有studio角色的切换
// if(studionList.contains(currentUser)){
// //用户有studio工程师的操作
// }
//获取当前的责任人
String dutyPerson = projectCertificationInventoryEO.getDutyPerson();
@@ -277,30 +291,115 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
List<String> dutyTerritoryList = new ArrayList<>();
dutyTerritoryList = Arrays.asList(projectCertificationInventoryEO.getDutyTerritory().split(","));
dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
//获取当前的projectId
String projectId = projectCertificationInventoryEO.getProjectLibraryId();
//根据责任领域个projectId去查相关人员名单
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectId, dutyTerritoryList);
//根据相关人员名单获取的工程接口人
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){
enginnerList.add(relatedPersonnel.getEngineeringInterfacePerson());
}
for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){
//如果工程接口人不为空的话
if(enginnerList.size()>0){
//判断哪个不存在 再去去存入
if(!enginnerList.contains(dutyPerson)){
relatedPersonnel.setEngineerAttSet(dutyPerson);
// projectRelatedPersonnelService.editById(relatedPersonnel);
}
}else {
//工程接口人为空的话,直接将责任设置到认证工程师下
relatedPersonnel.setEngineerAttSet(dutyPerson);
// projectRelatedPersonnelService.editById(relatedPersonnel);
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(projectId, 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);
}
}
// studionList = studionList.stream().distinct().collect(Collectors.toList());
// certificationEngineerList = certificationEngineerList.stream().distinct().collect(Collectors.toList());
allList = allList.stream().distinct().collect(Collectors.toList());
for(String all : allList){
if(all.equals("")){
allList.remove(all);
}
}
//遍历所有人alllist中是否包含责任人,如果包含,不用操作。
//-------如果不包含,再去判断当前用户的角色是studio、法规还是认证
for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){
if(allList.size()>0){
if(!allList.contains(dutyPerson)){
if(roleCode.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(roleCode.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(roleCode.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);
}
}
}
}
}
// for(ProjectRelatedPersonnel relatedPersonnel : projectRelatedPersonnelList){
// //如果工程接口人不为空的话
// if(enginnerList.size()>0){
// //判断哪个不存在 再去去存入
// if(!enginnerList.contains(dutyPerson)){
// relatedPersonnel.setEngineerAttSet(dutyPerson);
//// projectRelatedPersonnelService.editById(relatedPersonnel);
// }
// }else {
// //工程接口人为空的话,直接将责任设置到认证工程师下
// relatedPersonnel.setEngineerAttSet(dutyPerson);
//// projectRelatedPersonnelService.editById(relatedPersonnel);
// }
// }
this.projectRelatedPersonnelService.updateBatchById(projectRelatedPersonnelList);
@@ -258,6 +258,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
private ISysDictItemService sysDictItemService;
@Autowired
private IProjectLibraryRoleRelEOService projectLibraryRoleRelEOService;
/**
* 保存
@@ -517,72 +519,164 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.update(projectLawsInventoryEO,updateWrapper);
// saveOrUpdate(projectLawsInventoryEO);
//获取编辑中的责任领域
List<String> dutyTerritoryList = new ArrayList<>();
dutyTerritoryList = Arrays.asList(projectLawsInventoryEO.getDutyTerritory().split(","));
dutyTerritoryList = dutyTerritoryList.stream().distinct().collect(Collectors.toList());
//获取当前的projectLibrartId
String projectLibrartId = projectLawsInventoryEO.getProjectLibraryId();
String cut = projectLawsInventoryEO.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();
//分别获取当前编辑中的设计符合性和认证符合性责任人
List<String> designDutyIdList = new ArrayList<>();
designDutyIdList = Arrays.asList(projectLawsInventoryEO.getDesignDutyId().split(","));
designDutyIdList = designDutyIdList.stream().distinct().collect(Collectors.toList());
List<String> verifyDutyIdList = new ArrayList<>();
verifyDutyIdList = Arrays.asList(projectLawsInventoryEO.getVerifyDutyId().split(","));
verifyDutyIdList = verifyDutyIdList.stream().distinct().collect(Collectors.toList());
//allList 为法规工程师中验证符合性和确认符合中的责任人
List<String> allList = new ArrayList<>();
// allList = Arrays.asList(designDutyIdList.toString()+","+verifyDutyIdList.toString());
allList.addAll(designDutyIdList);
allList.addAll(verifyDutyIdList);
allList = allList.stream().distinct().collect(Collectors.toList());
//allDutyList 为法规工程师中验证符合性和确认符合中的责任人
List<String> allDutyList = new ArrayList<>();
allDutyList.addAll(designDutyIdList);
allDutyList.addAll(verifyDutyIdList);
allDutyList = allDutyList.stream().distinct().collect(Collectors.toList());
//获取相关责任领域下的和projectLibrartId的相关人员名单的信息
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = projectRelatedPersonnelService.queryByProjectIdAndDutyTerritoy(projectLibrartId, dutyTerritoryList);
//enginnerList为每一条的工程接口人的集合
List<String> allList = new ArrayList<>();
List<String> enginnerList = new ArrayList<>();
for(ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnelList){
enginnerList.add(projectRelatedPersonnel.getEngineeringInterfacePerson());
}
if(projectRelatedPersonnelList.size()>0){
for(ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnelList){
if(enginnerList.size()<0){
//直接将allList存入到
String all = String.join(",",allList);
projectRelatedPersonnel.setEngineerLawSet(all);
// projectRelatedPersonnelService.editById(projectRelatedPersonnel);
}else {
enginnerList = enginnerList.stream().distinct().collect(Collectors.toList());
//比较allList中有而enginnerList中没有的工程接口人
allList.removeAll(enginnerList);
// if(allList.size()>0){
// flag = CollectionUtils.isEqualCollection(allList,enginnerList);
// if(!flag){
// //进行遍历两个list将allList中有的而enginnerList没有的存入到相关人员名单中的法规那里
//
// for(String all : allList){
// boolean flag1 = true;
// for(String enginner : enginnerList){
// if(all.equals(enginner)){
// flag1 = false;
// break;
// }
// }
// if(flag1){
// resultList.add(all);
// }
// }
// }
// }
//将相关人员名单中没有的resultList添加到相关人员记录表中
String result = String.join(",",allList);
projectRelatedPersonnel.setEngineerLawSet(result);
// projectRelatedPersonnelService.editById(projectRelatedPersonnel);
}
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().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(!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);
}
}
}
}
}
}
// 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);