法规清单-带入相关人员- 最新带入逻辑修改。

This commit is contained in:
wangzhijiang
2022-08-22 17:19:43 +08:00
parent 8db96ffbfd
commit 8cde7284d8
@@ -1737,6 +1737,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.NOT_STARTED.getValue());
inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.REJECTED.getValue()); inventoryAffirmStatusList.add(InventoryAffirmStatusEnum.REJECTED.getValue());
queryWrapper.lambda().in(ProjectLawsInventoryEO::getInventoryAffirmStatus,inventoryAffirmStatusList);*/ queryWrapper.lambda().in(ProjectLawsInventoryEO::getInventoryAffirmStatus,inventoryAffirmStatusList);*/
String ids = (String) params.get("ids");
if(StringUtils.isNotEmpty(ids)){
List<String> projectLawsInventoryIdList = Arrays.asList(ids.split(","));
queryWrapper.lambda().in(ProjectLawsInventoryEO::getId,projectLawsInventoryIdList);
}
queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
//查询当前项目下,清单状态为 未发起、拒绝状态的法规清单。 //查询当前项目下,清单状态为 未发起、拒绝状态的法规清单。
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); List<ProjectLawsInventoryEO> projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper);
@@ -1751,7 +1758,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) {
//法规清单的责任领域 //法规清单的责任领域
String dutyTerritory = projectLawsInventoryEO.getDutyTerritory(); /*String dutyTerritory = projectLawsInventoryEO.getDutyTerritory();
if(StringUtils.isNotBlank(dutyTerritory)){ if(StringUtils.isNotBlank(dutyTerritory)){
List<ProjectRelatedPersonnel> projectRelatedPersonnelList = new ArrayList<>(); List<ProjectRelatedPersonnel> projectRelatedPersonnelList = new ArrayList<>();
for (String s : dutyTerritory.split(",")) { for (String s : dutyTerritory.split(",")) {
@@ -1828,102 +1835,185 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
} }
} }
} }*/
for (ProjectRelatedPersonnel projectRelatedPersonnel : projectRelatedPersonnels) { String dutyTerritory = projectLawsInventoryEO.getDutyTerritory();
if(StringUtils.equals(projectRelatedPersonnel.getDutyTerritory(),projectLawsInventoryEO.getDutyTerritory())){ if(StringUtils.isNotEmpty(dutyTerritory)){
// //法规工程师 List<ProjectRelatedPersonnel> projectRelatedPersonnelTempList = projectRelatedPersonnels.stream().filter(relatedPersonnel -> {
// if (StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerId())) { boolean flag = false;
// String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), projectRelatedPersonnel,studioEngineer); for (String duty : dutyTerritory.split(",")) {
// if(StringUtils.isNotEmpty(userId)){ if(StringUtils.equals(duty,relatedPersonnel.getDutyTerritory())){
// projectLawsInventoryEO.setRegulationOwnerId(userId); flag = true;
// } }
// } }
// return flag;
// //认证工程师 }).collect(Collectors.toList());
// if (StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerId())) {
// String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), projectRelatedPersonnel,studioEngineer); if(CollectionUtils.isNotEmpty(projectRelatedPersonnelTempList)){
// if(StringUtils.isNotEmpty(userId)){
// projectLawsInventoryEO.setHomologationEngineerId(userId); LambdaUpdateWrapper<ProjectLawsInventoryEO> updateWrapper = new LambdaUpdateWrapper<>();
// }
// } //法规工程师
// if (StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerId())) {
// //项目接口人 String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), projectRelatedPersonnelTempList,studioEngineer);
// if (StringUtils.isEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) { if(StringUtils.isNotEmpty(userId)){
// String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), projectRelatedPersonnel,studioEngineer); projectLawsInventoryEO.setRegulationOwnerId(userId);
// if(StringUtils.isNotEmpty(userId)){ }
// projectLawsInventoryEO.setEngineeringInterfacePerson(userId); }else {
// } String userId = ToGetAUserId(ProjectRoleEnum.REGULATI_ENGINEER.getValue(), projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getRegulationOwnerId());
// } if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setRegulationOwnerId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getRegulationOwnerId,null);
}
}
//认证工程师
if (StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerId())) {
String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setHomologationEngineerId(userId);
}
}else {
String userId = ToGetAUserId(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue(), projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getHomologationEngineerId());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setHomologationEngineerId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getHomologationEngineerId,null);
}
}
//项目接口人
if (StringUtils.isEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setEngineeringInterfacePerson(userId);
}
}else {
String userId = ToGetAUserId(ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue(), projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getEngineeringInterfacePerson());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setEngineeringInterfacePerson(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getEngineeringInterfacePerson,null);
}
}
//设计符合性确认 //设计符合性确认
//发起人角色 //发起人角色
if(StringUtils.isEmpty(projectLawsInventoryEO.getDesignInitiatorId())){ String designInitiator = projectLawsInventoryEO.getDesignInitiator();
String designInitiator = projectLawsInventoryEO.getDesignInitiator(); if(StringUtils.isNotEmpty(designInitiator)){
if(StringUtils.isNotEmpty(designInitiator)){ if(StringUtils.isEmpty(projectLawsInventoryEO.getDesignInitiatorId())){
String userId = ToGetAUserId(designInitiator, projectRelatedPersonnel,studioEngineer); String userId = ToGetAUserId(designInitiator, projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setDesignInitiatorId(userId); projectLawsInventoryEO.setDesignInitiatorId(userId);
} }
} }else {
} String userId = ToGetAUserId(designInitiator, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getDesignInitiatorId());
//责任人角色
if(StringUtils.isEmpty(projectLawsInventoryEO.getDesignDutyId())){
String designDuty = projectLawsInventoryEO.getDesignDuty();
if(StringUtils.isNotEmpty(designDuty)){
String userId = ToGetAUserId(designDuty, projectRelatedPersonnel,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setDesignDutyId(userId); projectLawsInventoryEO.setDesignInitiatorId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getDesignInitiatorId,null);
} }
} }
} }
//prehomo确认 //责任人角色
//发起人角色 String designDuty = projectLawsInventoryEO.getDesignDuty();
if(StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){ if(StringUtils.isNotEmpty(designDuty)){
String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiator(); if(StringUtils.isEmpty(projectLawsInventoryEO.getDesignDutyId())){
if(StringUtils.isNotEmpty(prehomoInitiator)){ String userId = ToGetAUserId(designDuty, projectRelatedPersonnelTempList,studioEngineer);
String userId = ToGetAUserId(prehomoInitiator, projectRelatedPersonnel,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setPrehomoInitiatorId(userId); projectLawsInventoryEO.setDesignDutyId(userId);
}
}else {
String userId = ToGetAUserId(designDuty, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getDesignDutyId());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setDesignDutyId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getDesignDutyId,null);
} }
} }
} }
if(StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
//责任人角色
String prehomoDuty = projectLawsInventoryEO.getPrehomoDuty(); //prehomo确认
if(StringUtils.isNotEmpty(prehomoDuty)){ //发起人角色
String userId = ToGetAUserId(prehomoDuty, projectRelatedPersonnel,studioEngineer); String prehomoInitiator = projectLawsInventoryEO.getPrehomoInitiator();
if(StringUtils.isNotEmpty(prehomoInitiator)){
if(StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
String userId = ToGetAUserId(prehomoInitiator, projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setPrehomoInitiatorId(userId);
}
}else {
String userId = ToGetAUserId(prehomoInitiator, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getPrehomoInitiatorId());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setPrehomoInitiatorId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getPrehomoInitiatorId,null);
}
}
}
//责任人角色
String prehomoDuty = projectLawsInventoryEO.getPrehomoDuty();
if(StringUtils.isNotEmpty(prehomoDuty)){
if(StringUtils.isEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
String userId = ToGetAUserId(prehomoDuty, projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setPrehomoDutyId(userId); projectLawsInventoryEO.setPrehomoDutyId(userId);
} }
}else {
String userId = ToGetAUserId(prehomoDuty, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getPrehomoDutyId());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setPrehomoDutyId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getPrehomoDutyId,null);
}
} }
} }
//验证符合性确认 //验证符合性确认
if(StringUtils.isEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){ //发起人角色
//发起人角色 String verifyInitiator = projectLawsInventoryEO.getVerifyInitiator();
String verifyInitiator = projectLawsInventoryEO.getVerifyInitiator(); if(StringUtils.isNotEmpty(verifyInitiator)){
if(StringUtils.isNotEmpty(verifyInitiator)){ if(StringUtils.isEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
String userId = ToGetAUserId(verifyInitiator, projectRelatedPersonnel,studioEngineer); String userId = ToGetAUserId(verifyInitiator, projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setVerifyInitiatorId(userId); projectLawsInventoryEO.setVerifyInitiatorId(userId);
} }
} }else {
} String userId = ToGetAUserId(verifyInitiator, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getVerifyInitiatorId());
if(StringUtils.isEmpty(projectLawsInventoryEO.getVerifyDutyId())){
//责任人角色
String verifyDuty = projectLawsInventoryEO.getVerifyDuty();
if(StringUtils.isNotEmpty(verifyDuty)){
String userId = ToGetAUserId(verifyDuty, projectRelatedPersonnel,studioEngineer);
if(StringUtils.isNotEmpty(userId)){ if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setVerifyDutyId(userId); projectLawsInventoryEO.setVerifyInitiatorId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getVerifyInitiatorId,null);
} }
} }
} }
//责任人角色
String verifyDuty = projectLawsInventoryEO.getVerifyDuty();
if(StringUtils.isNotEmpty(verifyDuty)){
if(StringUtils.isEmpty(projectLawsInventoryEO.getVerifyDutyId())){
String userId = ToGetAUserId(verifyDuty, projectRelatedPersonnelTempList,studioEngineer);
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setVerifyDutyId(userId);
}
}else {
String userId = ToGetAUserId(verifyDuty, projectRelatedPersonnelTempList,studioEngineer,projectLawsInventoryEO.getVerifyDutyId());
if(StringUtils.isNotEmpty(userId)){
projectLawsInventoryEO.setVerifyDutyId(userId);
}else {
updateWrapper.set(ProjectLawsInventoryEO::getVerifyDutyId,null);
}
}
}
updateWrapper.eq(ProjectLawsInventoryEO::getId,projectLawsInventoryEO.getId());
super.update(projectLawsInventoryEO, updateWrapper);
} }
} }
this.baseMapper.updateById(projectLawsInventoryEO); //this.baseMapper.updateById(projectLawsInventoryEO);
} }
}else { }else {
throw new JeroBootException("当前项目中,未找到相关维护人员信息"); throw new JeroBootException("当前项目中,未找到相关维护人员信息");
@@ -1946,14 +2036,20 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
/** /**
* 获取一个用户的id * 获取一个用户的id
* @param roleCode * @param roleCode
* @param projectRelatedPersonnel * @param projectRelatedPersonnelList
* @return * @return
*/ */
public String ToGetAUserId(String roleCode,ProjectRelatedPersonnel projectRelatedPersonnel,String studioEngineer){ public String ToGetAUserId(String roleCode,List<ProjectRelatedPersonnel> projectRelatedPersonnelList,String studioEngineer){
String resultUserId = ""; String resultUserId = "";
//法规工程师 //法规工程师
if(StringUtils.equals(roleCode,ProjectRoleEnum.REGULATI_ENGINEER.getValue())){ if(StringUtils.equals(roleCode,ProjectRoleEnum.REGULATI_ENGINEER.getValue())){
String lawEngineer = projectRelatedPersonnel.getLawEngineer(); String lawEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getLawEngineer).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(lawEngineer)){ if(StringUtils.isNotEmpty(lawEngineer)){
String[] lawEngineerArr = lawEngineer.split(","); String[] lawEngineerArr = lawEngineer.split(",");
if(lawEngineerArr.length == 1){ if(lawEngineerArr.length == 1){
@@ -1963,7 +2059,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
//认证工程师 //认证工程师
if(StringUtils.equals(roleCode,ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){ if(StringUtils.equals(roleCode,ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){
String certificationEngineer = projectRelatedPersonnel.getCertificationEngineer(); String certificationEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getCertificationEngineer).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(certificationEngineer)){ if(StringUtils.isNotEmpty(certificationEngineer)){
String[] certificationEngineerArr = certificationEngineer.split(","); String[] certificationEngineerArr = certificationEngineer.split(",");
if(certificationEngineerArr.length == 1){ if(certificationEngineerArr.length == 1){
@@ -1973,7 +2075,13 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
//工程接口人 //工程接口人
if(StringUtils.equals(roleCode,ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue())){ if(StringUtils.equals(roleCode,ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue())){
String engineeringInterfacePerson = projectRelatedPersonnel.getEngineeringInterfacePerson(); String engineeringInterfacePerson = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getEngineeringInterfacePerson).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(engineeringInterfacePerson)){ if(StringUtils.isNotEmpty(engineeringInterfacePerson)){
String[] engineeringInterfacePersonArr = engineeringInterfacePerson.split(","); String[] engineeringInterfacePersonArr = engineeringInterfacePerson.split(",");
if(engineeringInterfacePersonArr.length == 1){ if(engineeringInterfacePersonArr.length == 1){
@@ -2557,10 +2665,53 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDueDate())){ if(ObjectUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDueDate())){
projectLawsInventoryEOTemp.setVerifyDueDate(projectLawsInventoryEO.getVerifyDueDate()); projectLawsInventoryEOTemp.setVerifyDueDate(projectLawsInventoryEO.getVerifyDueDate());
} }
//================================批量设置人员===================================================
//法规工程师id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())){
projectLawsInventoryEOTemp.setRegulationOwnerId(projectLawsInventoryEO.getRegulationOwnerId());
}
//认证工程师id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId())){
projectLawsInventoryEOTemp.setHomologationEngineerId(projectLawsInventoryEO.getHomologationEngineerId());
}
//工程接口人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())){
projectLawsInventoryEOTemp.setEngineeringInterfacePerson(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
//设计符合性流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignInitiatorId())){
projectLawsInventoryEOTemp.setDesignInitiatorId(projectLawsInventoryEO.getDesignInitiatorId());
}
//设计符合性流程责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
projectLawsInventoryEOTemp.setDesignDutyId(projectLawsInventoryEO.getDesignDutyId());
}
//Pre-homo确认流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
projectLawsInventoryEOTemp.setPrehomoInitiatorId(projectLawsInventoryEO.getPrehomoInitiatorId());
}
//Pre-homo确认责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
projectLawsInventoryEOTemp.setPrehomoDutyId(projectLawsInventoryEO.getPrehomoDutyId());
}
//验证符合性流程发起人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
projectLawsInventoryEOTemp.setVerifyInitiatorId(projectLawsInventoryEO.getVerifyInitiatorId());
}
//验证符合性流程责任人id
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
projectLawsInventoryEOTemp.setVerifyDutyId(projectLawsInventoryEO.getVerifyDutyId());
}
projectLawsInventoryEOList.add(projectLawsInventoryEOTemp); projectLawsInventoryEOList.add(projectLawsInventoryEOTemp);
} }
this.updateBatchById(projectLawsInventoryEOList); this.updateBatchById(projectLawsInventoryEOList);
projectLawsInventoryEOList.forEach(projectLawsInventory -> {
//更新三个符合性流程中的处理人。
this.updateFlowInfo(projectLawsInventory);
});
// for (ProjectLawsInventoryEO lawsInventoryEO : projectLawsInventoryEOList) { // for (ProjectLawsInventoryEO lawsInventoryEO : projectLawsInventoryEOList) {
// LambdaUpdateWrapper<ProjectLawsInventoryEO> updateWrapper = new LambdaUpdateWrapper<>(); // LambdaUpdateWrapper<ProjectLawsInventoryEO> updateWrapper = new LambdaUpdateWrapper<>();
// updateWrapper.in(ProjectLawsInventoryEO::getId,lawsInventoryEO.getId()); // updateWrapper.in(ProjectLawsInventoryEO::getId,lawsInventoryEO.getId());
@@ -7060,4 +7211,86 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} }
return sysRoles; return sysRoles;
} }
/**
* 获取一个用户的id
* 例如:如果法规工程师不是空,判断当前这个法规工程师,是否在这个责任领域的数组里,
* 1、如果在的话,不用管他;
* 2、如果只有一个人,则把这个用户设置进来;
* 3、如果不在,判断这个责任领域下是否有多个法规工程师,如果是,则把这个法规工程师设置为空;
*
* @param roleCode 角色编码
* @param projectRelatedPersonnelList 相关人员对象数组
* @param studioEngineer studioCode
* @param engineersId 现有的工程师id
* @return
*/
public String ToGetAUserId(String roleCode,List<ProjectRelatedPersonnel> projectRelatedPersonnelList,String studioEngineer,String engineersId){
String resultUserId = "";
//法规工程师
if(StringUtils.equals(roleCode,ProjectRoleEnum.REGULATI_ENGINEER.getValue())){
String lawEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getLawEngineer).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(lawEngineer)){
if(!StringUtils.contains(lawEngineer,engineersId)){
String[] lawEngineerArr = lawEngineer.split(",");
if(lawEngineerArr.length == 1){
resultUserId = lawEngineer;
}
}else {
resultUserId = engineersId;
}
}
}
//认证工程师
if(StringUtils.equals(roleCode,ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){
String certificationEngineer = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getCertificationEngineer).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(certificationEngineer)){
if(!StringUtils.contains(certificationEngineer,engineersId)){
String[] certificationEngineerArr = certificationEngineer.split(",");
if(certificationEngineerArr.length == 1){
resultUserId = certificationEngineer;
}
}else {
resultUserId = engineersId;
}
}
}
//工程接口人
if(StringUtils.equals(roleCode,ProjectRoleEnum.ENGINEERING_INTERFACE_PERSON.getValue())){
String engineeringInterfacePerson = projectRelatedPersonnelList.stream().filter(relatedPersonnel -> {
boolean flag = false;
if(StringUtils.isNotEmpty(relatedPersonnel.getLawEngineer())){
flag = true;
}
return flag;
}).map(ProjectRelatedPersonnel::getEngineeringInterfacePerson).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(engineeringInterfacePerson)){
if(!StringUtils.contains(engineeringInterfacePerson,engineersId)){
String[] engineeringInterfacePersonArr = engineeringInterfacePerson.split(",");
if(engineeringInterfacePersonArr.length == 1){
resultUserId = engineeringInterfacePerson;
}
}else {
resultUserId = engineersId;
}
}
}
//studio
if(StringUtils.equals(roleCode,ProjectRoleEnum.STUDIO_ENGINEER.getValue())){
resultUserId = studioEngineer;
}
return resultUserId;
}
} }