Commit ccaea804 authored by suhuiguang's avatar suhuiguang

1.检验检测报检规则3.0版本

parent ddb50201
......@@ -128,27 +128,16 @@ public class RuleActionHandler {
return tzBaseUnitLicences;
}
public List<TzBaseEnterpriseInfoDto> getInspectionUnitList(List<TzBaseUnitLicence> unitLicenceList, Boolean isMatchArea, String record, String openBizType) {
// 是否进行属地过滤
String areaCode = isMatchArea ? this.getArea(record) : "";
// 所有符合单位的code
List<String> unitCodes = unitLicenceList.stream().map(TzBaseUnitLicence::getUnitCode).collect(Collectors.toList());
// 按照资质 + areaCode,进行设备单位的筛选
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(unitCodes, areaCode, openBizType);
if (matchEnterpriseInfos.isEmpty()) {
log.info("按照资质、区域未匹配到对应的单位、按照地市未匹配到单位,将返回全部单位");
return tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(null, null, openBizType);
}
return matchEnterpriseInfos;
}
private List<TzBaseEnterpriseInfoDto> getInspectionUnitListForNoAccept(List<TzBaseUnitLicence> unitLicenceList, Boolean isMatchArea, String record, String openBizType, String defaultInspectionCode, String legalInspectionCodes, String inspectionCompanyType) {
// 是否进行属地过滤
String areaCode = isMatchArea ? this.getArea(record) : "";
// 所有符合单位的code
List<String> unitCodes = unitLicenceList.stream().map(TzBaseUnitLicence::getUnitCode).collect(Collectors.toList());
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = new ArrayList<>();
// 按照资质 + areaCode,进行设备单位的筛选
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(unitCodes, areaCode, openBizType);
if (unitCodes.size() > 0) {
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(unitCodes, areaCode, openBizType);
}
// 第三方时需要去掉法定机构
if (inspectionCompanyType.equals(InspectionCompanyType.THIRD.getCode())) {
log.info("第三方检验机构开始匹配");
......@@ -180,8 +169,11 @@ public class RuleActionHandler {
.collect(Collectors.toList());
// 将法定机构和符合资质要求的机构取交集
List<String> legalUnitCodes = Arrays.stream(legalInspectionCodes.split(",")).filter(unitCodes::contains).collect(Collectors.toList());
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = new ArrayList<>();
// 按照资质 + areaCode,进行设备单位的筛选
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(legalUnitCodes, areaCode, openBizType);
if (legalUnitCodes.size() > 0) {
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(legalUnitCodes, areaCode, openBizType);
}
// 未匹配到法定机构时,返回指定的默认的法定机构
if (matchEnterpriseInfos.isEmpty()) {
log.info("按照资质、区域未匹配到法定检验机构");
......@@ -221,5 +213,22 @@ public class RuleActionHandler {
throw e;
}
}
public List<TzBaseEnterpriseInfoDto> getInspectionUnitList(List<TzBaseUnitLicence> unitLicenceList, Boolean isMatchArea, String record, String openBizType) {
// 是否进行属地过滤
String areaCode = isMatchArea ? this.getArea(record) : "";
// 所有符合单位的code
List<String> unitCodes = unitLicenceList.stream().map(TzBaseUnitLicence::getUnitCode).collect(Collectors.toList());
List<TzBaseEnterpriseInfoDto> matchEnterpriseInfos = new ArrayList<>();
// 按照资质 + areaCode,进行设备单位的筛选
if (unitCodes.size() > 0) {
matchEnterpriseInfos = tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(unitCodes, areaCode, openBizType);
}
if (matchEnterpriseInfos.isEmpty()) {
log.info("按照资质、区域未匹配到对应的单位、按照地市未匹配到单位,将返回全部单位");
return tzBaseEnterpriseInfoMapper.getInspectionUnitListByCode(null, null, openBizType);
}
return matchEnterpriseInfos;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment