dev-tmp1
luotaiqian 2026-08-08 18:29:48 +08:00
parent ef3d3f751b
commit 8698b88518
4 changed files with 129 additions and 53 deletions

View File

@ -0,0 +1,38 @@
package org.qinan.safetyeval.client.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.qinan.safetyeval.domain.entity.CapabilityAssessmentDTO;
import org.qinan.safetyeval.domain.entity.TitleCodeCo;
import java.util.List;
/**
*
*
* @author safety-eval
*/
@Data
public class QualFilingPersonnelFilingCheckDTO {
@ApiModelProperty("人员id")
private Long id;
@ApiModelProperty(value = "人员岗位类型: TECHNICAL_LEADER=>技术负责人; PROCESS_CONTROL_LEADER=>过程控制负责人")
private String personnelPositionType;
@ApiModelProperty(value = "能力认定")
private List<CapabilityAssessmentDTO> capabilityAssessment;
@ApiModelProperty(value = "是否技术负责人(false否true是)")
private Boolean technicalDirectorFlag;
@ApiModelProperty(value = "是否过程控制负责人(false否true是)")
private Boolean processControlLeaderFlag;
@ApiModelProperty(value = "职称(多个逗号分隔)")
private List<TitleCodeCo> titleCodeArr;
// @ApiModelProperty(value = "人员证书信息")
// private List<PersonnelCertFilingPageCO> personnelCertFilingPageCOList;
}

View File

@ -12,11 +12,12 @@ public enum PersonnelPositionTypeEnum {
TECHNICAL_LEADER("TECHNICAL_LEADER", "技术负责人"), TECHNICAL_LEADER("TECHNICAL_LEADER", "技术负责人"),
PROCESS_CONTROL_LEADER("PROCESS_CONTROL_LEADER", "过程控制负责人"), PROCESS_CONTROL_LEADER("PROCESS_CONTROL_LEADER", "过程控制负责人"),
BASIC("BASIC", "基础人员"),
; ;
private final String value; private final String value;
private final String label; private final String label;
public static final String REMARKS = "人员岗位类型: TECHNICAL_LEADER=>技术负责人;" + public static final String REMARKS = "人员岗位类型: TECHNICAL_LEADER=>技术负责人;" +
"PROCESS_CONTROL_LEADER=>过程控制负责人"; "PROCESS_CONTROL_LEADER=>过程控制负责人;BASIC=>基础人员" ;
} }

View File

@ -13,8 +13,10 @@ import org.qinan.safetyeval.client.dto.*;
import org.qinan.safetyeval.domain.constant.*; import org.qinan.safetyeval.domain.constant.*;
import org.qinan.safetyeval.domain.constant.basic.IndustryEnum; import org.qinan.safetyeval.domain.constant.basic.IndustryEnum;
import org.qinan.safetyeval.domain.constant.basic.ProfessionalCapabilityEnum; import org.qinan.safetyeval.domain.constant.basic.ProfessionalCapabilityEnum;
import org.qinan.safetyeval.domain.entity.CapabilityAssessmentDTO;
import org.qinan.safetyeval.domain.entity.TitleCodeCo; import org.qinan.safetyeval.domain.entity.TitleCodeCo;
import org.qinan.safetyeval.domain.exception.BizException; import org.qinan.safetyeval.domain.exception.BizException;
import org.qinan.safetyeval.domain.exception.ErrorCode;
import org.qinan.safetyeval.infrastructure.dataobject.OrgPersonnelDO; import org.qinan.safetyeval.infrastructure.dataobject.OrgPersonnelDO;
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelCertMapper; import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelCertMapper;
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper; import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
@ -53,12 +55,15 @@ public class ComplianceCheckUtil {
List<QualFilingComplianceCheckResultCO> results = new ArrayList<>(); List<QualFilingComplianceCheckResultCO> results = new ArrayList<>();
// 0. 查询人员证书专业能力信息 // 0. 查询人员备案数据
List<OrgPersonnelCertCapabilityComplianceCheckCO> List<QualFilingPersonnelFilingCheckDTO> personnelFilingCheckList = queryPersonnelFilingCheck(personnelList);
certCapabilityList = queryOrgPersonnelCertCapability(personnelList);
// // 0. 查询人员证书专业能力信息
// List<OrgPersonnelCertCapabilityComplianceCheckCO>
// certCapabilityList = queryOrgPersonnelCertCapability(personnelList);
// 0.1 查询人员职称信息并回填到 personnelList // 0.1 查询人员职称信息并回填到 personnelList
fillTitleCodeArr(personnelList); fillTitleCodeArr(personnelList, personnelFilingCheckList);
// 1. 独立法人资格 // 1. 独立法人资格
results.add(checkMainQualification(filing)); results.add(checkMainQualification(filing));
@ -77,7 +82,7 @@ public class ComplianceCheckUtil {
results.add(checkPersonnelCount(filing, personnelList)); results.add(checkPersonnelCount(filing, personnelList));
// 6. 人员比例 // 6. 人员比例
results.add(checkPersonnelRatio(filing.getBusinessScope(), personnelList, certCapabilityList, throwException)); results.add(checkPersonnelRatio(filing.getBusinessScope(), personnelList, personnelFilingCheckList, throwException));
// 7. 负责人配备 // 7. 负责人配备
results.add(checkKeyPosition(filing, personnelList)); results.add(checkKeyPosition(filing, personnelList));
@ -142,36 +147,72 @@ public class ComplianceCheckUtil {
} }
/** /**
* org_personnel title_code_arr *
* <p> * <p>
* sourcePersonnelId org_personnel.id title_code_arr * sourcePersonnelId org_personnel.id
* JSON {@link TitleCodeCo} personnelList *
* *
* @param personnelList * @param personnelList
* @return
*/ */
private void fillTitleCodeArr(List<QualFilingPersonnelAddCmd> personnelList) { private List<QualFilingPersonnelFilingCheckDTO> queryPersonnelFilingCheck(
List<QualFilingPersonnelAddCmd> personnelList) {
if (CollectionUtils.isEmpty(personnelList)) { if (CollectionUtils.isEmpty(personnelList)) {
return; return Collections.emptyList();
}
List<Long> sourcePersonnelIds = personnelList.stream()
.map(QualFilingPersonnelAddCmd::getSourcePersonnelId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
if (sourcePersonnelIds.isEmpty()) {
return;
} }
Map<Long, QualFilingPersonnelAddCmd> sourcePersonnelIds = personnelList.stream()
.collect(Collectors.toMap(QualFilingPersonnelAddCmd::getSourcePersonnelId, Function.identity()));
LambdaQueryWrapper<OrgPersonnelDO> wrapper = new LambdaQueryWrapper<OrgPersonnelDO>() LambdaQueryWrapper<OrgPersonnelDO> wrapper = new LambdaQueryWrapper<OrgPersonnelDO>()
.select(OrgPersonnelDO::getId, OrgPersonnelDO::getTitleCodeArr) .select(OrgPersonnelDO::getId, OrgPersonnelDO::getPersonnelPositionType,
.in(OrgPersonnelDO::getId, sourcePersonnelIds); OrgPersonnelDO::getCapabilityAssessment, OrgPersonnelDO::getTechnicalDirectorFlag,
OrgPersonnelDO::getProcessControlLeaderFlag, OrgPersonnelDO::getTitleCodeArr)
.in(OrgPersonnelDO::getId, sourcePersonnelIds.keySet());
List<OrgPersonnelDO> orgPersonnelList = SpringUtil.getBean(OrgPersonnelMapper.class).selectList(wrapper); List<OrgPersonnelDO> orgPersonnelList = SpringUtil.getBean(OrgPersonnelMapper.class).selectList(wrapper);
Map<Long, String> titleCodeArrMap = orgPersonnelList.stream() List<QualFilingPersonnelFilingCheckDTO> result = new ArrayList<>();
.filter(p -> p.getTitleCodeArr() != null) for (OrgPersonnelDO personnel : orgPersonnelList) {
.collect(Collectors.toMap(OrgPersonnelDO::getId, OrgPersonnelDO::getTitleCodeArr, (a, b) -> a)); sourcePersonnelIds.remove(personnel.getId());
QualFilingPersonnelFilingCheckDTO dto = new QualFilingPersonnelFilingCheckDTO();
dto.setId(personnel.getId());
dto.setPersonnelPositionType(personnel.getPersonnelPositionType());
dto.setCapabilityAssessment(
JSONUtil.toList(personnel.getCapabilityAssessment(), CapabilityAssessmentDTO.class));
dto.setTechnicalDirectorFlag(personnel.getTechnicalDirectorFlag());
dto.setProcessControlLeaderFlag(personnel.getProcessControlLeaderFlag());
dto.setTitleCodeArr(JSONUtil.toList(personnel.getTitleCodeArr(), TitleCodeCo.class));
result.add(dto);
}
// 人员缺少返回
if (!CollectionUtils.isEmpty(sourcePersonnelIds)) {
String collect = sourcePersonnelIds.values().stream()
.map(QualFilingPersonnelAddCmd::getPersonName)
.filter(Objects::nonNull)
.collect(Collectors.joining(CommonUtil.COMMA));
throw new BizException(ErrorCode.UNKNOWN_ERROR, "人员信息不存在" + collect);
}
return result;
}
/**
*
*
* @param personnelList
* @param personnelFilingCheckList
*/
private void fillTitleCodeArr(List<QualFilingPersonnelAddCmd> personnelList,
List<QualFilingPersonnelFilingCheckDTO> personnelFilingCheckList) {
if (CollectionUtils.isEmpty(personnelList) || CollectionUtils.isEmpty(personnelFilingCheckList)) {
return;
}
Map<Long, List<TitleCodeCo>> titleCodeArrMap = personnelFilingCheckList.stream()
.filter(p -> p.getId() != null && p.getTitleCodeArr() != null)
.collect(Collectors.toMap(QualFilingPersonnelFilingCheckDTO::getId,
QualFilingPersonnelFilingCheckDTO::getTitleCodeArr, (a, b) -> a));
for (QualFilingPersonnelAddCmd personnel : personnelList) { for (QualFilingPersonnelAddCmd personnel : personnelList) {
String titleCodeArrJson = titleCodeArrMap.get(personnel.getSourcePersonnelId()); List<TitleCodeCo> titleCodeArr = titleCodeArrMap.get(personnel.getSourcePersonnelId());
if (StringUtils.hasText(titleCodeArrJson)) { if (titleCodeArr != null) {
personnel.setTitleCodeArr(JSONUtil.toList(titleCodeArrJson, TitleCodeCo.class)); personnel.setTitleCodeArr(titleCodeArr);
} }
} }
} }
@ -213,7 +254,7 @@ public class ComplianceCheckUtil {
} }
/** /**
* >= 25 * >= 25+-1*5
*/ */
private QualFilingComplianceCheckResultCO checkPersonnelCount(QualFilingAddCmd filing, List<QualFilingPersonnelAddCmd> personnelList) { private QualFilingComplianceCheckResultCO checkPersonnelCount(QualFilingAddCmd filing, List<QualFilingPersonnelAddCmd> personnelList) {
int scopeCount = filing.getBusinessScope() != null ? filing.getBusinessScope().size() : 0; int scopeCount = filing.getBusinessScope() != null ? filing.getBusinessScope().size() : 0;
@ -230,16 +271,16 @@ public class ComplianceCheckUtil {
*/ */
private QualFilingComplianceCheckResultCO checkPersonnelRatio( private QualFilingComplianceCheckResultCO checkPersonnelRatio(
List<String> businessScope, List<QualFilingPersonnelAddCmd> personnelList List<String> businessScope, List<QualFilingPersonnelAddCmd> personnelList
, List<OrgPersonnelCertCapabilityComplianceCheckCO> personnelCertCoList, boolean throwException) { , List<QualFilingPersonnelFilingCheckDTO> personnelCertCoList, boolean throwException) {
if (personnelList == null || personnelList.isEmpty()) { if (personnelList == null || personnelList.isEmpty()) {
return buildResult(QualFilingComplianceCheckEnum.PERSONNEL_RATIO, return buildResult(QualFilingComplianceCheckEnum.PERSONNEL_RATIO,
QualFilingComplianceCheckEnum.STATUS_FAIL, "无人员数据"); QualFilingComplianceCheckEnum.STATUS_FAIL, "无人员数据");
} }
int total = personnelList.size(); int total = personnelList.size();
Set<Long> engineerSet = personnelCertCoList.stream() Set<Long> engineerSet = personnelCertCoList.stream()
.filter(p -> CertTypeCodeEnum.REGISTERED_SAFETY_ENGINEER // .filter(p -> CertTypeCodeEnum.REGISTERED_SAFETY_ENGINEER
.getCode().equals(p.getCertTypeCode()) && !CertLevelEnum.JUNIOR.getCode().equals(p.getCertLevel())) // .getCode().equals(p.getCertTypeCode()) && !CertLevelEnum.JUNIOR.getCode().equals(p.getCertLevel()))
.map(OrgPersonnelCertCapabilityComplianceCheckCO::getPersonnelId) .map(QualFilingPersonnelFilingCheckDTO::getId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
Set<Long> seniorTitleSet = personnelList.stream() Set<Long> seniorTitleSet = personnelList.stream()
.filter(p -> p.getTitleCodeArr() != null && p.getTitleCodeArr().stream() .filter(p -> p.getTitleCodeArr() != null && p.getTitleCodeArr().stream()
@ -266,7 +307,11 @@ public class ComplianceCheckUtil {
List<IndustryProfessionalPersonCo> personnelCoList = SpringUtil.getBean(OrgPersonnelMapper.class) List<IndustryProfessionalPersonCo> personnelCoList = SpringUtil.getBean(OrgPersonnelMapper.class)
.selectProfessionalCapabilityByPersonnelIds(sourcePersonnelIds); .selectProfessionalCapabilityByPersonnelIds(sourcePersonnelIds);
Pair<Boolean, String> booleanStringPair = industryProfessionalStandardsValid( Pair<Boolean, String> booleanStringPair = industryProfessionalStandardsValid(
businessScope, personnelCoList, personnelCertCoList); businessScope, personnelCoList, null);
/*Pair<Boolean, String> booleanStringPair = industryProfessionalStandardsValid(
businessScope, personnelCoList, personnelCertCoList);*/
boolean personPassed = Boolean.TRUE.equals(booleanStringPair.getKey()); boolean personPassed = Boolean.TRUE.equals(booleanStringPair.getKey());
if (!personPassed && throwException) { if (!personPassed && throwException) {
throw new BizException(PERSON_NOT_ENOUGH, booleanStringPair.getValue()); throw new BizException(PERSON_NOT_ENOUGH, booleanStringPair.getValue());
@ -291,10 +336,6 @@ public class ComplianceCheckUtil {
return buildResult(QualFilingComplianceCheckEnum.KEY_POSITION, QualFilingComplianceCheckEnum.STATUS_PASS, return buildResult(QualFilingComplianceCheckEnum.KEY_POSITION, QualFilingComplianceCheckEnum.STATUS_PASS,
"满足条件"); "满足条件");
} }
if (personnelList == null || personnelList.isEmpty()) {
return buildResult(QualFilingComplianceCheckEnum.KEY_POSITION,
QualFilingComplianceCheckEnum.STATUS_FAIL, "无人员数据");
}
// 提取所有来源人员id对应 org_personnel.id // 提取所有来源人员id对应 org_personnel.id
List<Long> sourcePersonnelIds = personnelList.stream() List<Long> sourcePersonnelIds = personnelList.stream()
@ -303,10 +344,6 @@ public class ComplianceCheckUtil {
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
if (sourcePersonnelIds.isEmpty()) {
return buildResult(QualFilingComplianceCheckEnum.KEY_POSITION,
QualFilingComplianceCheckEnum.STATUS_FAIL, "无来源人员id");
}
// 通过 SpringUtil 获取 OrgPersonnelMapper按业务范围qual_scope分组统计负责人数量 // 通过 SpringUtil 获取 OrgPersonnelMapper按业务范围qual_scope分组统计负责人数量
OrgPersonnelMapper orgPersonnelMapper = SpringUtil.getBean(OrgPersonnelMapper.class); OrgPersonnelMapper orgPersonnelMapper = SpringUtil.getBean(OrgPersonnelMapper.class);

View File

@ -91,10 +91,10 @@
AND p.user_name LIKE CONCAT('%', #{query.personName}, '%') AND p.user_name LIKE CONCAT('%', #{query.personName}, '%')
</if> </if>
<if test="query.managementFlag != null and query.managementFlag == true"> <if test="query.managementFlag != null and query.managementFlag == true">
AND (p.technical_director_flag =1 or p.process_control_leader_flag =1) AND (p.personnel_position_type =1 or p.process_control_leader_flag =1)
</if> </if>
<if test="query.managementFlag != null and query.managementFlag == false"> <if test="query.managementFlag != null and query.managementFlag == false">
AND (p.technical_director_flag !=1 and p.process_control_leader_flag !=1) AND (p.technical_director_flag =0 and p.process_control_leader_flag =0)
</if> </if>
</where> </where>
ORDER BY p.id DESC ORDER BY p.id DESC