修改统计去除不涉及状态

This commit is contained in:
高嵩
2023-07-27 11:34:36 +08:00
parent f20941ecbc
commit e3936a5eb0
8 changed files with 152 additions and 7 deletions
@@ -354,4 +354,16 @@ public class ProjectCertificationInventoryEOController extends JeroController<Pr
public Result<?> queryDutyPersonByProjectId(@RequestParam Map<String,Object> params) {
return Result.OK(this.projectCertificationInventoryEOService.queryDutyPersonByProjectId(params));
}
/**
* 匹配相关人员
* @param params
* @return
*/
@AutoLog(value = "项目库-认证清单表-匹配相关人员")
@ApiOperation(value="项目库-认证清单表-匹配相关人员", notes="项目库-法规清单表-匹配相关人员")
@PostMapping(value = "/matchRelevantPeople")
public Result<?> matchRelevantPeople(@RequestBody Map<String,Object> params){
return this.projectCertificationInventoryEOService.matchRelevantPeople(params);
}
}
@@ -332,4 +332,11 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
* @param json
*/
void replacementUser(JSONObject json);
/**
* 匹配相关人员
* @param params
* @return
*/
Result<?> matchRelevantPeople(Map<String, Object> params);
}
@@ -43,6 +43,8 @@ import com.jero.modules.project.entity.ProjectCertificationInventoryLogEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
import com.jero.modules.project.service.*;
import com.jero.modules.split.common.FileUnZip;
import com.jero.modules.system.enums.ProjectRoleEnum;
@@ -134,6 +136,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Autowired
private IProjectRelatedPersonnelService projectRelatedPersonnelService;
@Autowired
private ProjectRelatedPersonnelMapper projectRelatedPersonnelMapper;
@Autowired
private SysRoleMapper sysRoleMapper;
@Autowired
private IFeishuService feishuService;
@@ -155,6 +159,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
@Autowired
private IProjectLawsInventoryEOService projectLawsInventoryEOService;
@Autowired
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
@Value(value = "${jero.backUrl}")
private String backUrl;
@@ -6353,4 +6360,114 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
}
}
/**
* 匹配相关人员
*
* @param params
* @return
*/
@Override
public Result<?> matchRelevantPeople(Map<String, Object> params) {
String projectLibraryId = (String) params.get("projectLibraryId");//项目id
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
int isProjectRole = this.checkUserRole(projectLibraryId, currentUser.getId());
//验证用户是否是该项目的studio工程师或者认证工程师才能匹配相关人员
if (isProjectRole == Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue())
||isProjectRole == Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())) {
//获取当前项目中的相关人员信息
QueryWrapper<ProjectRelatedPersonnel> queryProjectPerson = new QueryWrapper<>();
queryProjectPerson.lambda().eq(ProjectRelatedPersonnel::getProjectId, projectLibraryId);
List<ProjectRelatedPersonnel> projectRelatedPersonnels = this.projectRelatedPersonnelMapper.selectList(queryProjectPerson);
if (CollectionUtils.isNotEmpty(projectRelatedPersonnels)) {
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
List<ProjectCertificationInventoryEO> certificationInventoryEOs = this.list(queryWrapper);
List<ProjectCertificationInventoryEO> updateList = new ArrayList<>();
for (ProjectCertificationInventoryEO certificationInventoryEO : certificationInventoryEOs) {
//只留下清单状态为 未发起认证退回的认证清单
if(CertificationInventoryFlowStatusEnum.LIST_TO_BE_RELEASED.getValue().equals(certificationInventoryEO.getFlowStatus())
||CertificationInventoryFlowStatusEnum.CERTIFICATION_RETURNED.getValue().equals(certificationInventoryEO.getFlowStatus())){
String dutyTerritory = certificationInventoryEO.getDutyTerritory();
if (StringUtils.isNotEmpty(dutyTerritory)) {
List<ProjectRelatedPersonnel> projectRelatedPersonnelTempList = projectRelatedPersonnels.stream().filter(relatedPersonnel -> {
boolean flag = false;
for (String duty : dutyTerritory.split(",")) {
if (StringUtils.equals(duty, relatedPersonnel.getDutyTerritory())) {
flag = true;
}
}
return flag;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(projectRelatedPersonnelTempList)) {
List<String> relatedPerson = new ArrayList<>();
for (ProjectRelatedPersonnel prp : projectRelatedPersonnelTempList) {
String engineeringInterfacePerson = prp.getEngineeringInterfacePerson();
if (StringUtils.isNotEmpty(engineeringInterfacePerson)) {
for (String eip : engineeringInterfacePerson.split(",")) {
if (StringUtils.isNotEmpty(eip)) {
relatedPerson.add(eip);
}
}
}
}
if (CollectionUtils.isNotEmpty(relatedPerson) && relatedPerson.size() == 1) {
certificationInventoryEO.setSdt(relatedPerson.get(0));
certificationInventoryEO.setDutyPerson(relatedPerson.get(0));
updateList.add(certificationInventoryEO);
}
}
}
}
}
if(CollectionUtils.isNotEmpty(updateList)) {
this.updateBatchById(updateList);
}
} else {
throw new JeroBootException("当前项目中,未找到相关维护人员信息");
}
} else {
throw new JeroBootException("当前操作用户不是该项目的studio工程师或认证工程师,没有权限操作!");
}
//更新log
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// String username = sysUser.getUsername();
// String contentLog = username + "带入了相关人员名单信息";
// String enContentLog = username + " brought in the list information of relevant personnel.";
// projectLawsInventoryLogEOService.updateLog(contentLog, projectLibraryId, CutEnum.CN.getValue());
// projectLawsInventoryLogEOService.updateLog(enContentLog, projectLibraryId, CutEnum.EN.getValue());
return new Result<>().success("带入成功!");
}
/**
* 验证用户在该项目中的角色
*
* @param projectLibraryId 项目库id
* @param currentUserId 登录人id
* @return
*/
public int checkUserRole(String projectLibraryId, String currentUserId) {
int result = -1;
try {
QueryWrapper<ProjectLibraryBase> projectLibraryBaseQueryWrapper = new QueryWrapper<>();
projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId, projectLibraryId);
projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getStudioEngineer, currentUserId);
Integer projectLibrayBaseCount = projectLibraryBaseMapper.selectCount(projectLibraryBaseQueryWrapper);
if (projectLibrayBaseCount > 0) {
result = Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.STUDIO_ENGINEER.getValue());
if(result == -1){
result = Integer.parseInt(com.jero.modules.project.enums.ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue());
}
}
} catch (Exception ex) {
log.error("验证用户在该项目中的角色失败:" + ex.getMessage());
throw new JeroBootException("验证用户在该项目中的角色失败!");
}
return result;
}
}
@@ -12608,7 +12608,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|| StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue())
|| StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue())
|| StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue())
|| StringUtils.equals(pliEo.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue())
);
return flag;
}).count();
@@ -12619,7 +12618,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|| StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue())
|| StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue())
|| StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue())
|| StringUtils.equals(pliEo.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue())
);
return flag;
}).count();
@@ -1653,7 +1653,13 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().in(ProjectCertificationInventoryEO::getProjectLibraryId,Arrays.asList(id.split(",")));
List<ProjectCertificationInventoryEO> pciEoList = this.projectCertificationInventoryEOService.list(pciQueryWrap);
List<ProjectCertificationInventoryEO> pciEoList = this.projectCertificationInventoryEOService.list(pciQueryWrap).stream().filter(pciEo -> {
boolean flag = false;
if (!StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue())) {
flag = true;
}
return flag;
}).distinct().collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(pciEoList)){
// 认证清单-任务确认统计
List<Map<String,Object>> rzTaskToConfirmMapList = this.projectCertificationInventoryEOService.getTaskToConfirmStatistics(pciEoList);
@@ -2881,7 +2887,13 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
String projectLibraryId = (String) params.get("projectLibraryId");
QueryWrapper<ProjectCertificationInventoryEO> pciQueryWrap = new QueryWrapper<>();
pciQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId,projectLibraryId);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(pciQueryWrap);
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(pciQueryWrap).stream().filter(pciEo -> {
boolean flag = false;
if (!StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.UNINVOLVED.getValue())) {
flag = true;
}
return flag;
}).distinct().collect(Collectors.toList());
String pciDutyTerritoryStr = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyTerritory).collect(Collectors.joining(","));
List<SysDictItem> sysDictItems = new ArrayList<>();
if (StringUtils.isNotEmpty(pciDutyTerritoryStr)) {
@@ -93,7 +93,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati
|| StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue())
|| StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue())
|| StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue())
|| StringUtils.equals(data.getDesignFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue())
);
return flag;
}).collect(Collectors.toList());
@@ -104,7 +103,6 @@ public class ProjectLibraryStatisticsServiceImpl implements IProjectLibraryStati
|| StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.CONFORMITY.getValue())
|| StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.INCONFORMITY.getValue())
|| StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TO_TRACK.getValue())
|| StringUtils.equals(data.getVerifyFlowStatus(),ComplianceFlowStatusEnum.UNINVOLVED.getValue())
);
return flag;
}).collect(Collectors.toList());
@@ -362,6 +362,7 @@
handleChange(value) {
this.formInline.sdt = undefined
this.queryPersonByProject(this.formInline.dutyTerritory.join(','))
this.formInline = {...this.formInline}
},
queryPersonByProject(row) {
let query = {
@@ -306,7 +306,7 @@
}
this.regulatoryCertificationTaskPlanList.forEach(val => {
if (val.name == this.$t('initiatingProcess')) {
val.userName = this.$t('regulatoryEngineer')
val.userName = this.$t('Sponsor')
} else if (val.name == this.$t('Taskresponsibilityrecognition')) {
val.userName = this.$t('personLiable')
} else if (val.name == this.$t('designComplianceReview')) {