Commit 5a07dfa7 authored by 刘林's avatar 刘林

fix(jg):拆分检验检测机构

parent bba83569
......@@ -20,8 +20,8 @@ public enum UnitTypeEnum {
//充装单位
CZDW("充装单位","1231","3","充装单位"),
//检验检测机构
JYJCJG("检验检测机构","1233","4","检验检测机构"),
JYJG("检验机构","1233-1","4","检验机构"),
JCJG("检测机构","1233-2","4","检测机构"),
;
String name;
......
......@@ -921,49 +921,77 @@ public class CommonServiceImpl implements ICommonService {
@Override
public List<Map<String, Object>> getUnitListByType(String type, String business, Boolean needAuth) {
List<Map<String, Object>> unitList = new ArrayList<>(Collections.emptyList());
List<Map<String, Object>> unitList = new ArrayList<>();
String internalType;
switch (type) {
case "use":
type = "使用单位";
internalType = "使用单位";
break;
case "maintenance":
type = "安装改造维修单位";
internalType = "安装改造维修单位";
break;
case "inspection":
type = "检验检测机构";
// 拆分:包含检验机构和检测机构
internalType = "检验机构|检测机构";
break;
case "manufacture":
type = "制造单位";
internalType = "制造单位";
break;
case "all":
type = "all";
internalType = "all";
break;
default:
internalType = type;
break;
}
// 检验检测机构 追加车用气瓶
if ("检验检测机构".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSPECTION_TESTING_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList));
// 提取字典逻辑(抽成方法)
if ("gasCylindersForCars".equals(business)) {
if ("检验机构|检测机构".equals(internalType)) {
addDictUnitsToList("OLD_INSPECTION_TESTING_UNIT", unitList);
}
if ("安装改造维修单位".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_INSTALLATION_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList));
if ("安装改造维修单位".equals(internalType)) {
addDictUnitsToList("OLD_INSTALLATION_UNIT", unitList);
}
// 使用单位追加 三环认领的(业主可能未注册系统,别人帮忙认领的,帮忙认领后会保存一份原使用单位的数据到字典)
if ("使用单位".equals(type) && "gasCylindersForCars".equals(business)) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues("OLD_USE_UNIT").getResult();
result.forEach(x -> convertAndAddToUnitList(x, unitList));
if ("使用单位".equals(internalType)) {
addDictUnitsToList("OLD_USE_UNIT", unitList);
}
}
List<Map<String, Object>> unitListByType;
if ("检验机构|检测机构".equals(internalType)) {
// 合并两种子类型的数据
List<Map<String, Object>> list1 = needAuth
? commonMapper.getUnitInfoListByType("检验机构")
: commonMapper.getUnitListByType("检验机构");
List<Map<String, Object>> list2 = needAuth
? commonMapper.getUnitInfoListByType("检测机构")
: commonMapper.getUnitListByType("检测机构");
unitListByType = new ArrayList<>();
unitListByType.addAll(list1);
unitListByType.addAll(list2);
} else {
unitListByType = needAuth
? commonMapper.getUnitInfoListByType(internalType)
: commonMapper.getUnitListByType(internalType);
}
List<Map<String, Object>> unitListByType = needAuth ? commonMapper.getUnitInfoListByType(type) : commonMapper.getUnitListByType(type);
// 数据去重:原因车用气瓶在字典里进行维护,如果维护的单位注册上来,则会出现数据重复,故按照useCode去重
return new ArrayList<>(Stream.concat(
unitList.stream(),
unitListByType.stream()
).collect(Collectors.toMap(
map -> String.valueOf(map.get("useCode")), // 以 unitCode 作为 key
return new ArrayList<>(Stream.concat(unitList.stream(), unitListByType.stream())
.collect(Collectors.toMap(
map -> String.valueOf(map.get("useCode")),
map -> map,
(existing, replacement) -> existing // 如果 key 冲突,保留原有的
)).values());
(existing, replacement) -> existing
))
.values());
}
private void addDictUnitsToList(String dictKey, List<Map<String, Object>> unitList) {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues(dictKey).getResult();
if (result != null) {
result.forEach(x -> convertAndAddToUnitList(x, unitList));
}
}
@Override
......
......@@ -19,7 +19,9 @@ public enum UnitTypeEnum {
sydw("使用单位", "1232", "use"),
czdw("充装单位", "1231", "license"),
jyjcjg("检验检测机构", "1233", "license"),
//jyjcjg("检验检测机构", "1233", "license"),//未使用
jyjg("检验机构", "1233-1", "license"),
jcjg("检测机构", "1233-2", "license"),
azgzwxdw("安装改造维修单位", "1234", "license"),
zzdw("制造单位", "1236", "license"),
sjdw("设计单位", "1235", "license"),
......
......@@ -52,6 +52,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
......@@ -303,7 +304,7 @@ public class EnterpriseBizByTCMServiceImpl {
unitLicencesCollect = unitLicences;
} else {
Predicate<BaseUnitLicence> certTypePredicate;
if (INSPECTION_AND_TESTING_INSTITUTIONS.equals(tzBaseEnterpriseInfoDto.getUnitType())) {
if (Stream.of(INSPECTION_AGENCY,TESTING_INSTITUTIONS).anyMatch(tzBaseEnterpriseInfoDto.getUnitType()::contains)) {
certTypePredicate = baseUnitLicence -> INSPECTION_AGENCY.equals(baseUnitLicence.getCertType()) ||
TESTING_INSTITUTIONS.equals(baseUnitLicence.getCertType());
} else {
......
......@@ -15,7 +15,6 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
......@@ -34,6 +33,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
import java.util.stream.Stream;
/**
* @author Administrator
......@@ -101,7 +101,8 @@ public class EnterpriseBizServiceImpl {
unitTypeList.add(UnitTypeEnum.GRZT.getName());
}
if(tzBaseEnterpriseInfoDto.getUnitType() != null && tzBaseEnterpriseInfoDto.getUnitType().contains(UnitTypeEnum.JYJCJG.getName())){
if(tzBaseEnterpriseInfoDto.getUnitType() != null && Stream.of(UnitTypeEnum.JYJG.getName(), UnitTypeEnum.JCJG.getName())
.anyMatch(tzBaseEnterpriseInfoDto.getUnitType()::contains)){
if(StringUtils.isNotEmpty(tzBaseEnterpriseInfoDto.getJyjcStatus())){
String jyjcStatus = tzBaseEnterpriseInfoDto.getJyjcStatus().trim();
String[] array = jyjcStatus.split("-");
......
......@@ -147,9 +147,14 @@ public class JGDPStatisticsServiceImpl {
/**
* 检验检测机构-检验检测机构
* 检验检测机构-检验机构
*/
private final static String COMPANY_TYPE_JYJC = "检验检测机构";
private final static String COMPANY_TYPE_JY = "检验机构";
/**
* 检验检测机构-检测机构
*/
private final static String COMPANY_TYPE_JC = "检测机构";
/**
......@@ -561,7 +566,13 @@ public class JGDPStatisticsServiceImpl {
int u3 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum();
int u4 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
//int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> {
String key = c.getKeyStr();
return key != null && (key.contains(COMPANY_TYPE_JY) || key.contains(COMPANY_TYPE_JC));
})
.mapToInt(CountDto::getIntValue)
.sum();
countItemDto.setCompany(String.valueOf(u1 + u2 + u3 + u4 + u5 + u6));
}
......@@ -3925,7 +3936,13 @@ public class JGDPStatisticsServiceImpl {
int u3 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum();
int u2 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum();
int u4 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
//int u6 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_JYJC)).mapToInt(CountDto::getIntValue).sum();
int u6 = countDtos.stream().filter(c -> {
String key = c.getKeyStr();
return key != null && (key.contains(COMPANY_TYPE_JY) || key.contains(COMPANY_TYPE_JC));
})
.mapToInt(CountDto::getIntValue)
.sum();
int u5 = countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum();
companyCountItemDto.setSydw(String.valueOf(u1));
companyCountItemDto.setZzdw(String.valueOf(u3));
......
......@@ -16,7 +16,9 @@ public enum UnitTypeEnum {
sydw("使用单位", "1232"),
czdw("充装单位", "1231"),
jyjcjg("检验检测机构", "1233"),
//jyjcjg("检验检测机构", "1233"),//未使用
jyjg("检验机构", "1233-1"),
jcjg("检测机构", "1233-2"),
azgzwxdw("安装改造维修单位", "1234"),
zzdw("制造单位", "1236"),
sjdw("设计单位", "1235"),
......
......@@ -236,7 +236,7 @@
AND pc.org_code IS NOT NULL
AND tzei.is_delete = '0'
AND pc.is_deleted = 'f'
AND tzei.unit_type <![CDATA[<>]]> '检验检测机构'
AND (tzei.unit_type <![CDATA[<>]]> '检验机构' OR tzei.unit_type <![CDATA[<>]]> '检测机构')
AND tui.amos_user_id IN (SELECT USER_ID FROM privilege_group_user WHERE GROUP_SEQ = #{groupId})
</select>
......
......@@ -349,7 +349,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
continue;
}
// 删除检验检测机构类似公司
if (excludeCompanyType.equals(e.get("companyType"))) {
// if (excludeCompanyType.equals(e.get("companyType"))) {
// it.remove();
// // 一行数据可能 满足几个remove,所以需要删除后,继续下一循环
// continue;
// }
if (e.get("companyType") != null && Arrays.asList("检验机构", "检测机构").contains(e.get("companyType").toString())) {
it.remove();
// 一行数据可能 满足几个remove,所以需要删除后,继续下一循环
continue;
......
......@@ -292,7 +292,7 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
//对应orgCode下所有注册企业列表
List<ThreeSystemsDto> allUnit = StaffingCompanyList.stream().filter(ii -> ii.getSupervisoryUnitOrgCode().startsWith(i.get("orgCode").toString())).collect(Collectors.toList());
//对应注册企业下所有应排查的企业列表
List<ThreeSystemsDto> shouldCheckUnit = allUnit.stream().filter(ii -> !(ii.getUnitType().contains("个人主体") || ii.getUnitType().equals("检验检测机构"))).collect(Collectors.toList());
List<ThreeSystemsDto> shouldCheckUnit = allUnit.stream().filter(ii -> !(ii.getUnitType().contains("个人主体") || ii.getUnitType().equals("检验机构") || ii.getUnitType().equals("检测机构"))).collect(Collectors.toList());
//应排查的企业下已排查完成的企业列表
List<ThreeSystemsDto> checkCompleteUnit = shouldCheckUnit.stream().filter(ii -> "1".equals(ii.getCheckStatus())).collect(Collectors.toList());
......
......@@ -707,7 +707,7 @@ public class TzBaseEnterpriseInfoServiceImpl
}
//许可信息先登录人选择的身份删除相应的许可信息,原因前端列表对数据可增减
removeLicenceDataBeforeSave(reginParams, tzBaseEnterpriseInfo);
//报错许可许可信息
//保存许可信息
saveLicenceData(map);
// 企业信息变更-同步修改企业下人员绑定设备类型
ArrayList<String> newData = new ArrayList<>();
......@@ -847,7 +847,7 @@ public class TzBaseEnterpriseInfoServiceImpl
}
private void fillCertTypeName(BaseUnitLicence baseUnitLicence, List<DataDictionary> dictionaries, String companyType) {
if (INSPECTION_AND_TESTING_INSTITUTIONS.equals(companyType)) {
if (Arrays.asList(INSPECTION_AGENCY, TESTING_INSTITUTIONS).contains(companyType)) {
if(StringUtils.isEmpty(baseUnitLicence.getCertType())){
String certTypeName = JYJC_CERT_MAP.get(baseUnitLicence.getCertTypeCode());
baseUnitLicence.setCertType(certTypeName);
......
......@@ -596,7 +596,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
if (companyType.contains("安装改造维修单位")) {
installCompany = true;
}
if (companyType.contains("检验检测机构")) {
if (Arrays.asList("检验机构", "检测机构").contains(companyType)) {
inspectionCompany = true;
}
}
......@@ -641,7 +641,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
if (companyType.contains("安装改造维修单位")) {
installCompany = true;
}
if (companyType.contains("检验检测机构")) {
if (Arrays.asList("检验机构", "检测机构").contains(companyType)) {
inspectionCompany = true;
}
StringBuilder companyTypeStr = new StringBuilder();
......
......@@ -100,7 +100,7 @@
COALESCE(use_unit_certificate, '身份证') AS useUnitCertificate
FROM
tz_base_enterprise_info
<if test=" tzBaseEnterpriseInfoDto.unitType.indexOf('检验检测机构') !=-1 ">
<if test=" tzBaseEnterpriseInfoDto.unitType.indexOf('检验机构') !=-1 OR tzBaseEnterpriseInfoDto.unitType.indexOf('检测机构') !=-1 ">
JOIN (select unit_code,max(accept_date) from tz_jyjc_opening_application
where 1=1
<if test=" tzBaseEnterpriseInfoDto.jyjcStatus!=null and tzBaseEnterpriseInfoDto.jyjcStatus!='' ">
......
......@@ -526,7 +526,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
it.remove();
}
// 删除检验检测机构
if (!"company".equals(e.get("level")) && e.get("companyType").toString().contains("检验检测机构")) {
// if (!"company".equals(e.get("level")) && e.get("companyType").toString().contains("检验检测机构")) {
// it.remove();
// }
if (!"company".equals(String.valueOf(e.get("level"))) &&
Arrays.asList("检验机构", "检测机构").stream().anyMatch(type -> String.valueOf(e.get("companyType")).contains(type))) {
it.remove();
}
if (!ObjectUtils.isEmpty(e.get("children"))) {
......
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