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