basic
parent
249c0c1404
commit
0835f88a6c
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 备案变更机构端CO(Client Object)
|
||||
|
|
@ -61,7 +62,7 @@ public class QualFilingChangeOrgCO {
|
|||
private String filingNo;
|
||||
|
||||
@ApiModelProperty(value = "经营范围")
|
||||
private String businessScope;
|
||||
private List<String> businessScope;
|
||||
|
||||
@ApiModelProperty(value = "注册地址")
|
||||
private String registerAddress;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package org.qinan.safetyeval.infrastructure.convertor;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.qinan.safetyeval.client.co.IndustryProfessionalPersonCo;
|
||||
import org.qinan.safetyeval.client.dto.QualFilingPersonnelAddCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 备案申请人员对象转行业专业能力人员CO
|
||||
*
|
||||
* @Author: ltq
|
||||
* @date 2026-07-15 10:00:00
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface QualFilingPersonnelCoConvertor {
|
||||
|
||||
@Mapping(target = "industryCode", source = "qualScope")
|
||||
@Mapping(target = "personNum", constant = "1L")
|
||||
IndustryProfessionalPersonCo convertCmdToCo(QualFilingPersonnelAddCmd qualFilingPersonnelAddCmd);
|
||||
|
||||
List<IndustryProfessionalPersonCo> convertCmdsToCos(List<QualFilingPersonnelAddCmd> qualFilingPersonnelAddCmds);
|
||||
}
|
||||
|
|
@ -2,27 +2,28 @@ package org.qinan.safetyeval.infrastructure.utils;
|
|||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.qinan.safetyeval.client.co.IndustryProfessionalPersonCo;
|
||||
import org.qinan.safetyeval.client.co.QualFilingComplianceCheckResultCO;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.domain.constant.*;
|
||||
import org.qinan.safetyeval.infrastructure.convertor.QualFilingPersonnelCoConvertor;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.IndustryProfessionalStandardsDO;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgPersonnelLeaderCountDO;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.mapper.IndustryProfessionalStandardsMapper;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 资质备案合规检查工具类
|
||||
*/
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public class ComplianceCheckUtil {
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ public class ComplianceCheckUtil {
|
|||
results.add(checkPersonnelCount(filing, personnelList));
|
||||
|
||||
// 6. 人员比例
|
||||
results.add(checkPersonnelRatio(personnelList));
|
||||
results.add(checkPersonnelRatio(filing.getBusinessScope(), personnelList));
|
||||
|
||||
// 7. 负责人配备
|
||||
results.add(checkKeyPosition(filing, personnelList));
|
||||
|
|
@ -127,7 +128,8 @@ public class ComplianceCheckUtil {
|
|||
/**
|
||||
* 人员比例:中级注安师 >= 30%,高级职称 >= 30%,合计 >= 60%
|
||||
*/
|
||||
private QualFilingComplianceCheckResultCO checkPersonnelRatio(List<QualFilingPersonnelAddCmd> personnelList) {
|
||||
private QualFilingComplianceCheckResultCO checkPersonnelRatio(List<String> businessScope
|
||||
, List<QualFilingPersonnelAddCmd> personnelList) {
|
||||
if (personnelList == null || personnelList.isEmpty()) {
|
||||
return buildResult(QualFilingComplianceCheckEnum.PERSONNEL_RATIO,
|
||||
QualFilingComplianceCheckEnum.STATUS_FAIL, "无人员数据");
|
||||
|
|
@ -147,7 +149,10 @@ public class ComplianceCheckUtil {
|
|||
&& sumRate >= 60;
|
||||
String currentValue = "注册安全工程师 " + engineerRate + "%,高级职称 " + seniorTitleRate + "%,合计 " + sumRate + "%";
|
||||
|
||||
// TODO 是否需要校验 @{org.qinan.safetyeval.infrastructure.utils.ComplianceCheckUtil.industryProfessionalStandardsValid}
|
||||
|
||||
List<IndustryProfessionalPersonCo> industryProfessionalPersonCos = SpringUtil.getBean(QualFilingPersonnelCoConvertor.class)
|
||||
.convertCmdsToCos(personnelList);
|
||||
industryProfessionalStandardsValid(businessScope, industryProfessionalPersonCos);
|
||||
|
||||
return buildResult(QualFilingComplianceCheckEnum.PERSONNEL_RATIO,
|
||||
pass ? QualFilingComplianceCheckEnum.STATUS_PASS : QualFilingComplianceCheckEnum.STATUS_FAIL,
|
||||
|
|
@ -252,6 +257,43 @@ public class ComplianceCheckUtil {
|
|||
return co;
|
||||
}
|
||||
|
||||
/**
|
||||
* industryProfessionalStandardsValid
|
||||
*
|
||||
* @param industryCodeList industryCodeList
|
||||
* @param industryProfessionalPersonCos industryProfessionalPersonCos
|
||||
* @return Pair<Boolean, String> key 是否通过 ,value 失败消息(通过时为 null)
|
||||
*/
|
||||
public static Pair<Boolean, String> industryProfessionalStandardsValid(List<String> industryCodeList
|
||||
, List<IndustryProfessionalPersonCo> industryProfessionalPersonCos) {
|
||||
if (CollectionUtils.isEmpty(industryCodeList)) {
|
||||
return Pair.of(false, "没有业务范围");
|
||||
}
|
||||
// 通过 SpringUtil 获取 Mapper,根据 industryCodeList 查询专业能力配备标准
|
||||
IndustryProfessionalStandardsMapper mapper = SpringUtil.getBean(IndustryProfessionalStandardsMapper.class);
|
||||
LambdaQueryWrapper<IndustryProfessionalStandardsDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(IndustryProfessionalStandardsDO::getIndustryCode, industryCodeList)
|
||||
.eq(IndustryProfessionalStandardsDO::getDeleteEnum, BooleanQAEnum.FALSE.getValue());
|
||||
List<IndustryProfessionalStandardsDO> standardsDOList = mapper.selectList(queryWrapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(standardsDOList)) {
|
||||
log.warn("没有配置标准");
|
||||
return Pair.of(true, null);
|
||||
}
|
||||
|
||||
// 按 industryCode 分组后循环调用 doIndustryProfessionalStandardsValid
|
||||
Map<String, List<IndustryProfessionalStandardsDO>> standardsGroupByIndustry = standardsDOList.stream()
|
||||
.collect(Collectors.groupingBy(IndustryProfessionalStandardsDO::getIndustryCode));
|
||||
|
||||
StringJoiner failureMsg = new StringJoiner(";");
|
||||
for (Map.Entry<String, List<IndustryProfessionalStandardsDO>> entry : standardsGroupByIndustry.entrySet()) {
|
||||
Pair<Boolean, String> result = doIndustryProfessionalStandardsValid(entry.getValue(), industryProfessionalPersonCos);
|
||||
if (Boolean.FALSE.equals(result.getKey()) && result.getValue() != null) {
|
||||
failureMsg.add(result.getValue());
|
||||
}
|
||||
}
|
||||
return failureMsg.length() > 1 ? Pair.of(false, failureMsg.toString()) : Pair.of(true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行业专业能力人员要求校验
|
||||
|
|
@ -260,7 +302,7 @@ public class ComplianceCheckUtil {
|
|||
* @param industryProfessionalPersonCos 当前实际人员数(按 行业code + 专业能力code 分类汇总)
|
||||
* @return Pair<Boolean, String> key 是否通过 ,value 失败消息(通过时为 null)
|
||||
*/
|
||||
public static Pair<Boolean, String> industryProfessionalStandardsValid(List<IndustryProfessionalStandardsDO> standardsDOList
|
||||
public static Pair<Boolean, String> doIndustryProfessionalStandardsValid(List<IndustryProfessionalStandardsDO> standardsDOList
|
||||
, List<IndustryProfessionalPersonCo> industryProfessionalPersonCos) {
|
||||
if (CollectionUtils.isEmpty(standardsDOList)) {
|
||||
return Pair.of(true, null);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@
|
|||
<result column="filing_unit_type_code" property="filingUnitTypeCode"/>
|
||||
<result column="filing_unit_type_name" property="filingUnitTypeName"/>
|
||||
<result column="filing_no" property="filingNo"/>
|
||||
<result column="business_scope" property="businessScope"/>
|
||||
<result column="business_scope" property="businessScope"
|
||||
typeHandler="org.qinan.safetyeval.infrastructure.handler.JsonStringListTypeHandler"/>
|
||||
<result column="register_address" property="registerAddress"/>
|
||||
<result column="office_address" property="officeAddress"/>
|
||||
<result column="credit_code" property="creditCode"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue