import
parent
73370b5d78
commit
e8e4b61553
|
|
@ -17,9 +17,11 @@ import org.qinan.safetyeval.infrastructure.persistence.domainobject.IndustryProf
|
||||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgPersonnelLeaderCountDO;
|
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgPersonnelLeaderCountDO;
|
||||||
import org.qinan.safetyeval.infrastructure.persistence.mapper.IndustryProfessionalStandardsMapper;
|
import org.qinan.safetyeval.infrastructure.persistence.mapper.IndustryProfessionalStandardsMapper;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.qinan.safetyeval.domain.exception.ErrorCode.PERSON_NOT_ENOUGH;
|
import static org.qinan.safetyeval.domain.exception.ErrorCode.PERSON_NOT_ENOUGH;
|
||||||
|
|
@ -355,15 +357,16 @@ public class ComplianceCheckUtil {
|
||||||
// 按 industryCode 分组后循环调用 doIndustryProfessionalStandardsValid
|
// 按 industryCode 分组后循环调用 doIndustryProfessionalStandardsValid
|
||||||
Map<String, List<IndustryProfessionalStandardsDO>> standardsGroupByIndustry = standardsDOList.stream()
|
Map<String, List<IndustryProfessionalStandardsDO>> standardsGroupByIndustry = standardsDOList.stream()
|
||||||
.collect(Collectors.groupingBy(IndustryProfessionalStandardsDO::getIndustryCode));
|
.collect(Collectors.groupingBy(IndustryProfessionalStandardsDO::getIndustryCode));
|
||||||
Map<String, List<IndustryProfessionalPersonCo>> personnelCoGroupByIndustry = personnelCoList.stream()
|
|
||||||
.collect(Collectors.groupingBy(IndustryProfessionalPersonCo::getIndustryCode));
|
List<IndustryProfessionalPersonCo> personnelCoCopyList = new ArrayList<>(personnelCoList);
|
||||||
Map<String, List<OrgPersonnelCertCapabilityComplianceCheckCO>> personnelCertCoGroupByIndustry = personnelCertCoList.stream()
|
|
||||||
.collect(Collectors.groupingBy(OrgPersonnelCertCapabilityComplianceCheckCO::getBusinessScope));
|
Map<String, List<OrgPersonnelCertCapabilityComplianceCheckCO>> personnelCertCoGroupByIndustry =
|
||||||
|
personnelCertCoList.stream().collect(
|
||||||
|
Collectors.groupingBy(OrgPersonnelCertCapabilityComplianceCheckCO::getBusinessScope));
|
||||||
|
|
||||||
StringJoiner failureMsg = new StringJoiner(";");
|
StringJoiner failureMsg = new StringJoiner(";");
|
||||||
for (Map.Entry<String, List<IndustryProfessionalStandardsDO>> entry : standardsGroupByIndustry.entrySet()) {
|
for (Map.Entry<String, List<IndustryProfessionalStandardsDO>> entry : standardsGroupByIndustry.entrySet()) {
|
||||||
Pair<Boolean, String> result = doIndustryProfessionalStandardsValid(
|
Pair<Boolean, String> result = doIndustryProfessionalStandardsValid(entry.getValue(), personnelCoCopyList
|
||||||
entry.getValue(), personnelCoGroupByIndustry.getOrDefault(entry.getKey(), new ArrayList<>())
|
|
||||||
, personnelCertCoGroupByIndustry.getOrDefault(entry.getKey(), new ArrayList<>()));
|
, personnelCertCoGroupByIndustry.getOrDefault(entry.getKey(), new ArrayList<>()));
|
||||||
if (Boolean.FALSE.equals(result.getKey()) && result.getValue() != null) {
|
if (Boolean.FALSE.equals(result.getKey()) && result.getValue() != null) {
|
||||||
failureMsg.add(result.getValue());
|
failureMsg.add(result.getValue());
|
||||||
|
|
@ -386,8 +389,11 @@ public class ComplianceCheckUtil {
|
||||||
* @param certCapabilityList 人员证书专业能力信息(提供人员→专业能力映射)
|
* @param certCapabilityList 人员证书专业能力信息(提供人员→专业能力映射)
|
||||||
* @return Pair<Boolean, String> key 是否通过 ,value 失败消息(通过时为 null)
|
* @return Pair<Boolean, String> key 是否通过 ,value 失败消息(通过时为 null)
|
||||||
*/
|
*/
|
||||||
public static Pair<Boolean, String> doIndustryProfessionalStandardsValid(List<IndustryProfessionalStandardsDO> standardsDOList
|
public static Pair<Boolean, String> doIndustryProfessionalStandardsValid(
|
||||||
, List<IndustryProfessionalPersonCo> industryProfessionalPersonCos, List<OrgPersonnelCertCapabilityComplianceCheckCO> certCapabilityList) {
|
List<IndustryProfessionalStandardsDO> standardsDOList
|
||||||
|
, List<IndustryProfessionalPersonCo> industryProfessionalPersonCos
|
||||||
|
, List<OrgPersonnelCertCapabilityComplianceCheckCO> certCapabilityList) {
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(standardsDOList)) {
|
if (CollectionUtils.isEmpty(standardsDOList)) {
|
||||||
return Pair.of(true, null);
|
return Pair.of(true, null);
|
||||||
}
|
}
|
||||||
|
|
@ -398,19 +404,26 @@ public class ComplianceCheckUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 构建人员→可担任专业能力code集合(同一人可能具备多个专业能力)
|
// 3. 构建人员→可担任专业能力code集合(同一人可能具备多个专业能力)
|
||||||
Map<Long, Set<String>> personCapabilityMap = new HashMap<>();
|
Map<Long, IndustryProfessionalPersonCo> personnelMap = industryProfessionalPersonCos.stream()
|
||||||
industryProfessionalPersonCos.forEach(p ->
|
.collect(Collectors.toMap(IndustryProfessionalPersonCo::getSourcePersonnelId, Function.identity()));
|
||||||
personCapabilityMap.computeIfAbsent(p.getSourcePersonnelId(), k -> new HashSet<>())
|
|
||||||
.add(p.getProfessionalCapabilityCode()));
|
|
||||||
certCapabilityList.forEach(c ->
|
|
||||||
personCapabilityMap.computeIfAbsent(c.getPersonnelId(), k -> new HashSet<>())
|
|
||||||
.add(c.getProfessionalCapabilityCode()));
|
|
||||||
|
|
||||||
|
Map<Long, Set<String>> personCapabilityMap = new HashMap<>();
|
||||||
|
for (OrgPersonnelCertCapabilityComplianceCheckCO pc : certCapabilityList) {
|
||||||
|
// 人员证书的能力
|
||||||
|
personCapabilityMap.computeIfAbsent(pc.getPersonnelId(), k -> new HashSet<>())
|
||||||
|
.add(pc.getProfessionalCapabilityCode());
|
||||||
|
IndustryProfessionalPersonCo co = personnelMap.get(pc.getPersonnelId());
|
||||||
|
|
||||||
|
// 人员学科能力
|
||||||
|
Set<String> pdcSet = Arrays.stream(co.getProfessionalCapabilityCode().split(","))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
personCapabilityMap.computeIfAbsent(pc.getPersonnelId(), k -> new HashSet<>())
|
||||||
|
.addAll(pdcSet);
|
||||||
|
}
|
||||||
|
|
||||||
// 数据来源:industryProfessionalPersonCos(备案人员自带专业能力)+ certCapabilityList(证书专业能力)
|
// 数据来源:industryProfessionalPersonCos(备案人员自带专业能力)+ certCapabilityList(证书专业能力)
|
||||||
Map<String, Long> assignedMap = canFullyAssign(personCapabilityMap, requiredMap);
|
Map<String, Long> assignedMap = canFullyAssign(personCapabilityMap, requiredMap);
|
||||||
|
|
||||||
|
|
||||||
IndustryEnum industryEnum = IndustryEnum.ofCode(standardsDOList.get(0).getIndustryCode());
|
IndustryEnum industryEnum = IndustryEnum.ofCode(standardsDOList.get(0).getIndustryCode());
|
||||||
String industryName = industryEnum != null ? industryEnum.getValue() : standardsDOList.get(0).getIndustryCode();
|
String industryName = industryEnum != null ? industryEnum.getValue() : standardsDOList.get(0).getIndustryCode();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue