Commit 9f86b7c3 authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_register

parents 52fc54eb 0a2226b5
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
and tjurm.use_unit_credit_code = #{dto.useUnitCreditCode} and tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if> </if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != '' "> <if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != '' ">
and tjurm.receive_company_code = #{dto.receiveCompanyCode} and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if> </if>
<if test="dto.equListCode != null and dto.equListCode != ''"> <if test="dto.equListCode != null and dto.equListCode != ''">
and tjurm.equ_list_code = #{dto.equListCode} and tjurm.equ_list_code = #{dto.equListCode}
...@@ -129,7 +130,8 @@ ...@@ -129,7 +130,8 @@
and tjurm.use_unit_name like concat ('%',#{dto.useUnitCreditNameForSearch},'%') and tjurm.use_unit_name like concat ('%',#{dto.useUnitCreditNameForSearch},'%')
</if> </if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''"> <if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
and tjurm.receive_company_code = #{dto.receiveCompanyCode} and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if> </if>
-- 企业根据企业统一信用代码匹配 -- 企业根据企业统一信用代码匹配
<if test="dto.dataType == 'company' "> <if test="dto.dataType == 'company' ">
......
...@@ -384,13 +384,36 @@ ...@@ -384,13 +384,36 @@
<!-- 情况1:有设备过滤条件 --> <!-- 情况1:有设备过滤条件 -->
<when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or <when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null"> dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
WITH filtered_main_ids AS ( WITH pre_filtered_equipment AS (
SELECT DISTINCT fu.sequence_nbr SELECT DISTINCT re.equip_transfer_id
FROM tzs_jg_use_registration fu FROM tzs_jg_use_registration_eq re
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id WHERE EXISTS (
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" SELECT 1 FROM idx_biz_jg_register_info jri,idx_biz_jg_other_info other
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD" WHERE jri."RECORD" = re.equ_id AND other."RECORD" = re.equ_id
WHERE fu.is_delete = '0' <!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."EQU_CATEGORY" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
)
AND EXISTS (
SELECT 1 FROM tzs_jg_use_registration fu
WHERE fu.sequence_nbr = re.equip_transfer_id
AND fu.is_delete = '0'
<!-- 公共主表过滤条件 --> <!-- 公共主表过滤条件 -->
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != ''">
AND fu.status = #{dto.status} AND fu.status = #{dto.status}
...@@ -442,31 +465,13 @@ ...@@ -442,31 +465,13 @@
AND (fu.use_unit_credit_code = #{dto.unitCode} AND (fu.use_unit_credit_code = #{dto.unitCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%')) OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if> </if>
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri.EQU_LIST = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri.EQU_CATEGORY = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri.EQU_DEFINE = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri.EQU_CODE LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other.CODE96333 LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other.supervisory_code LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
) )
),
main_data AS (
SELECT SELECT
fu.sequence_nbr AS sequenceNbr, fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus, fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate, DATE_FORMAT ( fu.reg_date, '%Y-%m-%d' ) AS regDate,
fu.use_unit_name AS useUnitName, fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode, fu.supervision_org_code AS supervisionOrgCode,
fu.status, fu.status,
...@@ -477,8 +482,8 @@ ...@@ -477,8 +482,8 @@
fu.next_execute_ids AS nextExecuteIds, fu.next_execute_ids AS nextExecuteIds,
fu.promoter, fu.promoter,
fu.use_registration_code AS useRegistrationCode, fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate, DATE_FORMAT ( fu.audit_pass_date, '%Y-%m-%d' ) AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate, DATE_FORMAT ( fu.create_date, '%Y-%m-%d' ) AS createDate,
fu.receive_org_name AS receiveOrgName, fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds, fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId, fu.next_task_id AS nextTaskId,
...@@ -495,43 +500,63 @@ ...@@ -495,43 +500,63 @@
fu.use_address AS fullAddress, fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason, fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId, fu.project_contraption_id AS projectContraptionId,
(select company_name from privilege_company where org_code = fu.supervision_org_code and is_deleted = false limit 1) AS orgBranchName, ( SELECT company_name FROM privilege_company WHERE org_code = fu.supervision_org_code AND is_deleted = FALSE LIMIT 1 ) AS orgBranchName
FROM pre_filtered_equipment pfe
COALESCE(GROUP_CONCAT(DISTINCT re.equ_id), '') AS equipId, JOIN tzs_jg_use_registration fu ON pfe.equip_transfer_id = fu.sequence_nbr
COALESCE(GROUP_CONCAT(DISTINCT other.supervisory_code), '') AS supervisoryCode, ORDER BY fu.create_date DESC, fu.apply_no DESC
COALESCE(GROUP_CONCAT(DISTINCT other.CODE96333), '') AS code96333, LIMIT 20 OFFSET 0
COALESCE(GROUP_CONCAT(DISTINCT jri.PRODUCT_NAME), '') AS productName, )
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CODE), '') AS equCode, SELECT
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_LIST), '') AS equListCode, md.*,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CATEGORY), '') AS equCategoryCode, (SELECT STRING_AGG(DISTINCT other.code96333, ',')
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_DEFINE), '') AS equDefineCode, FROM tzs_jg_use_registration_eq re
COALESCE(GROUP_CONCAT(DISTINCT c_list.name), '') AS equListName, JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
COALESCE(GROUP_CONCAT(DISTINCT c_cate.name), '') AS equCategory, JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
COALESCE(GROUP_CONCAT(DISTINCT c_def.name), '') AS equDefine WHERE re.equip_transfer_id = md.sequenceNbr) AS code96333,
(SELECT STRING_AGG(DISTINCT other.supervisory_code, ',')
FROM filtered_main_ids fm FROM tzs_jg_use_registration_eq re
JOIN tzs_jg_use_registration fu ON fm.sequence_nbr = fu.sequence_nbr JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" WHERE re.equip_transfer_id = md.sequenceNbr) AS supervisoryCode,
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD" (SELECT STRING_AGG(DISTINCT jri.PRODUCT_NAME, ',')
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code FROM tzs_jg_use_registration_eq re
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code WHERE re.equip_transfer_id = md.sequenceNbr) AS productName ,
GROUP BY fu.sequence_nbr (SELECT STRING_AGG(DISTINCT jri.EQU_CODE, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCode,
(SELECT STRING_AGG(DISTINCT jri.EQU_LIST, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equListCode ,
(SELECT STRING_AGG(DISTINCT jri.EQU_CATEGORY, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCategoryCode ,
(SELECT STRING_AGG(DISTINCT jri.EQU_DEFINE, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equDefineCode,
(SELECT name from tz_equipment_category where code = equListCode ) AS equListName,
(SELECT name from tz_equipment_category where code = equCategoryCode ) AS equCategory,
(SELECT name from tz_equipment_category where code = equDefineCode ) AS equDefine
FROM main_data md
GROUP BY md.sequenceNbr
ORDER BY ORDER BY
<choose> <choose>
<when test="sort != null and sort.field != null and sort.sortType != null"> <when test="sort != null and sort.field != null and sort.sortType != null">
<choose> <choose>
<when test="sort.field == 'create_date'">fu.create_date</when> <when test="sort.field == 'create_date'">md.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when> <when test="sort.field == 'apply_no'">md.applyNo</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when> <when test="sort.field == 'reg_date'">md.regType</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when> <when test="sort.field == 'audit_pass_date'">fu.auditPassDate</when>
<otherwise>${sort.field}</otherwise> <otherwise>${sort.field}</otherwise>
</choose> </choose>
${sort.sortType} ${sort.sortType}
</when> </when>
<otherwise> <otherwise>
fu.create_date DESC, fu.apply_no DESC md.create_date DESC, md.applyNo DESC
</otherwise> </otherwise>
</choose> </choose>
LIMIT #{size} OFFSET #{offset} LIMIT #{size} OFFSET #{offset}
......
...@@ -109,8 +109,8 @@ public class CommonController extends BaseController { ...@@ -109,8 +109,8 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/creatTree") @GetMapping(value = "/creatTree")
@ApiOperation(httpMethod = "GET", value = "获取管辖分局树", notes = "获取管辖分局树") @ApiOperation(httpMethod = "GET", value = "获取管辖分局树", notes = "获取管辖分局树")
public ResponseModel<Object> creatTree() { public ResponseModel<Object> creatTree(@RequestParam(required = false) String client) {
return ResponseHelper.buildResponse(commonService.getTree(getSelectedOrgInfo())); return ResponseHelper.buildResponse(commonService.getTree(client, getSelectedOrgInfo()));
} }
......
...@@ -354,4 +354,11 @@ public class DataHandlerController extends BaseController { ...@@ -354,4 +354,11 @@ public class DataHandlerController extends BaseController {
public ResponseModel<String> refreshXianData() { public ResponseModel<String> refreshXianData() {
return ResponseHelper.buildResponse(dataHandlerService.refreshXianData()); return ResponseHelper.buildResponse(dataHandlerService.refreshXianData());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "刷新西安电梯数据,使其可以做后续业务", notes = "刷新西安电梯数据,使其可以做后续业务")
@GetMapping(value = "/refreshXianData2ES")
public ResponseModel<String> refreshXianData2ES(@RequestParam(value = "isUpdate", defaultValue = "false") boolean isUpdate) throws IOException {
return ResponseHelper.buildResponse(dataHandlerService.refreshXianData2ES(isUpdate));
}
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ public class ChangeFieldWatchConstants { ...@@ -10,7 +10,7 @@ public class ChangeFieldWatchConstants {
public static final Set<String> USE_CERT_MONITORED_FIELDS = public static final Set<String> USE_CERT_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equDefine", "equCode", "useInnerCode", "factoryNum", "equDefine", "equCode", "useInnerCode", "factoryNum",
"province", "city", "county", "street", "address", "useOrgCode", "carNumber" "province", "city", "county", "street", "address", "useOrgCode", "carNumber", "useRegistrationCode"
))); )));
/** /**
...@@ -19,7 +19,7 @@ public class ChangeFieldWatchConstants { ...@@ -19,7 +19,7 @@ public class ChangeFieldWatchConstants {
public static final Set<String> USE_FLAG_MONITORED_FIELDS = public static final Set<String> USE_FLAG_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equDefine", "equCode", "useInnerCode", "inspectOrgName", "nextInspectDate", "equDefine", "equCode", "useInnerCode", "inspectOrgName", "nextInspectDate",
"emergencyTel", "maintenanceUnitName","useOrgCode" "emergencyTel", "maintenanceUnitName", "useOrgCode", "useRegistrationCode"
))); )));
/** /**
...@@ -28,7 +28,7 @@ public class ChangeFieldWatchConstants { ...@@ -28,7 +28,7 @@ public class ChangeFieldWatchConstants {
public static final Set<String> USE_FLAG_VEHICLE_MONITORED_FIELDS = public static final Set<String> USE_FLAG_VEHICLE_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"productName", "carNumber", "factoryNum", "gasNum", "volume", "fillingMedium", "inspectOrgName", "productName", "carNumber", "factoryNum", "gasNum", "volume", "fillingMedium", "inspectOrgName",
"nextInspectDate","useOrgCode" "nextInspectDate", "useOrgCode", "useRegistrationCode"
))); )));
/** /**
...@@ -55,7 +55,7 @@ public class ChangeFieldWatchConstants { ...@@ -55,7 +55,7 @@ public class ChangeFieldWatchConstants {
Collections.unmodifiableSet(new HashSet<>(Arrays.asList( Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equCode", "productName", "contactPhone", "installUnitName", "equCode", "productName", "contactPhone", "installUnitName",
"equipType", "factoryNum", "produceUnitName", "produceLicenseNum", "province", "equipType", "factoryNum", "produceUnitName", "produceLicenseNum", "province",
"city", "county", "street", "address","useOrgCode" "city", "county", "street", "address", "useOrgCode", "useRegistrationCode"
))); )));
/** /**
......
...@@ -142,6 +142,7 @@ public class ChangeEquipImpactCertListener { ...@@ -142,6 +142,7 @@ public class ChangeEquipImpactCertListener {
manage.setEquDefine(EquDefineConverter.getKeyByValue(afterValue)); manage.setEquDefine(EquDefineConverter.getKeyByValue(afterValue));
break; break;
case "useOrgCode": case "useOrgCode":
case "useRegistrationCode":
manage.setUseRegistrationCode(afterValue); manage.setUseRegistrationCode(afterValue);
break; break;
case "carNumber": case "carNumber":
......
...@@ -30,7 +30,7 @@ public interface ICommonService { ...@@ -30,7 +30,7 @@ public interface ICommonService {
List<LinkedHashMap> getRegion(String level, String parentId); List<LinkedHashMap> getRegion(String level, String parentId);
List<LinkedHashMap> getTree(ReginParams selectedOrgInfo); List<LinkedHashMap> getTree(String client, ReginParams selectedOrgInfo);
List<LinkedHashMap> getApproveTree(ReginParams reginParams); List<LinkedHashMap> getApproveTree(ReginParams reginParams);
......
...@@ -733,9 +733,9 @@ public class CommonServiceImpl implements ICommonService { ...@@ -733,9 +733,9 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public List<LinkedHashMap> getTree(ReginParams reginParams) { public List<LinkedHashMap> getTree(String client, ReginParams reginParams) {
// 企业逻辑 // 企业逻辑
if (reginParams.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY)) { if (reginParams.getCompany().getLevel().equals(BaseController.COMPANY_TYPE_COMPANY) || "jgLook".equals(client)) {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE); List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
// 判断redis是否存在管辖机构树 // 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree(); return !ObjectUtils.isEmpty(result) ? result : creatTree();
...@@ -871,7 +871,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -871,7 +871,7 @@ public class CommonServiceImpl implements ICommonService {
Iterator it = result.iterator(); Iterator it = result.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next(); LinkedHashMap e = (LinkedHashMap) it.next();
// 删除非行政审批局 // 删除非监管机构
Object companyTypeObj = e.get("companyType"); Object companyTypeObj = e.get("companyType");
if (companyTypeObj == null || !companyTypeObj.toString().contains(companyType)) { if (companyTypeObj == null || !companyTypeObj.toString().contains(companyType)) {
it.remove(); it.remove();
...@@ -2368,13 +2368,13 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2368,13 +2368,13 @@ public class CommonServiceImpl implements ICommonService {
List<EquipmentCategoryDto> result = Collections.emptyList(); List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) { switch (type) {
case "1": case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_LIST")).collect(Collectors.toList());
break; break;
case "2": case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_CATEGORY")).collect(Collectors.toList());
break; break;
case "3": case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_DEFINE")).collect(Collectors.toList());
break; break;
} }
return result; return result;
...@@ -2404,13 +2404,13 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2404,13 +2404,13 @@ public class CommonServiceImpl implements ICommonService {
List<EquipmentCategoryDto> result = Collections.emptyList(); List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) { switch (type) {
case "1": case "1":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0]*000$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_LIST")).collect(Collectors.toList());
break; break;
case "2": case "2":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\0]*00$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_CATEGORY")).collect(Collectors.toList());
break; break;
case "3": case "3":
result = categoryList.stream().filter(category -> Pattern.compile("^[^\\D0A-Za-z]*[A-Za-z0-9]*[^0]0$").matcher(category.getCode()).matches()).collect(Collectors.toList()); result = categoryList.stream().filter(category -> category.getDescription().equals("EQU_DEFINE")).collect(Collectors.toList());
break; break;
} }
return result; return result;
......
...@@ -564,7 +564,7 @@ public class DataDockServiceImpl { ...@@ -564,7 +564,7 @@ public class DataDockServiceImpl {
otherInfo.setClaimStatus("已认领"); otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date()); otherInfo.setRecDate(new Date());
if (EquipmentClassifityEnum.DT.getCode().equals(equList)) { if (EquipmentClassifityEnum.DT.getCode().equals(equList)) {
otherInfo.setCode96333Type("1"); otherInfo.setCode96333Type(ValidationUtil.isEmpty(equ.get("code96333")) ? "2" : "1");
} }
idxBizJgOtherInfoService.save(otherInfo); idxBizJgOtherInfoService.save(otherInfo);
} }
......
...@@ -2186,27 +2186,97 @@ public class DataHandlerServiceImpl { ...@@ -2186,27 +2186,97 @@ public class DataHandlerServiceImpl {
List<Long> manageSeqs = manageList.stream() List<Long> manageSeqs = manageList.stream()
.map(JgUseRegistrationManage::getSequenceNbr) .map(JgUseRegistrationManage::getSequenceNbr)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<List<Long>> managePartitions = Lists.partition(manageSeqs, BATCH_SIZE);
for (List<Long> part : managePartitions) {
jgUseRegistrationManageServiceImpl.lambdaUpdate()
.set(JgUseRegistrationManage::getIsDoBusiness, Boolean.TRUE)
.in(JgUseRegistrationManage::getSequenceNbr, part)
.update();
}
List<String> useRegistrantionCodeList = manageList.stream() List<String> useRegistrantionCodeList = manageList.stream()
.map(JgUseRegistrationManage::getUseRegistrationCode) .map(JgUseRegistrationManage::getUseRegistrationCode)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<List<String>> useRegistrationCodes = Lists.partition(useRegistrantionCodeList, BATCH_SIZE);
for (List<String> useRegistrations : useRegistrationCodes) {
List<String> recordList = registerInfoService.lambdaQuery() List<String> recordList = registerInfoService.lambdaQuery()
.in(IdxBizJgRegisterInfo::getUseOrgCode, useRegistrantionCodeList) .in(IdxBizJgRegisterInfo::getUseOrgCode, useRegistrations)
.list() .list()
.stream() .stream()
.map(IdxBizJgRegisterInfo::getRecord) .map(IdxBizJgRegisterInfo::getRecord)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 更新数据 --- 证管理数据
jgUseRegistrationManageServiceImpl.lambdaUpdate() // 批量查询 & 更新设备数据
.set(JgUseRegistrationManage::getIsDoBusiness, Boolean.TRUE) Iterable<ESEquipmentInfo> esEquipmentBatch = esEquipmentDao.findAllById(recordList);
.in(JgUseRegistrationManage::getSequenceNbr, manageSeqs) esEquipmentBatch.forEach(x -> {
.update(); x.setUSE_PLACE("陕西省/西安市");
// 更新数据 --- 设备数据 x.setUSE_PLACE_CODE("610000#610100");
Iterable<ESEquipmentInfo> esEquipmentDaoAllById = esEquipmentDao.findAllById(recordList); x.setIS_DO_BUSINESS(Boolean.TRUE);
esEquipmentDaoAllById.forEach(x -> x.setIS_DO_BUSINESS(Boolean.TRUE)); });
esEquipmentDao.saveAll(esEquipmentDaoAllById); esEquipmentDao.saveAll(esEquipmentBatch);
Iterable<ESEquipmentCategoryDto> equipmentCategoryAllById = esEquipmentCategory.findAllById(recordList);
equipmentCategoryAllById.forEach(x -> x.setIS_DO_BUSINESS(Boolean.TRUE)); // 批量查询 & 更新设备分类数据
esEquipmentCategory.saveAll(equipmentCategoryAllById); Iterable<ESEquipmentCategoryDto> equipmentCategoryBatch = esEquipmentCategory.findAllById(recordList);
return String.format("刷新证管理表数据:%s 条;对应设备ES数据:%s 条。", manageList.size(), recordList.size()); equipmentCategoryBatch.forEach(x -> {
x.setIS_DO_BUSINESS(Boolean.TRUE);
x.setUSE_PLACE("陕西省/西安市");
x.setUSE_PLACE_CODE("610000#610100");
});
esEquipmentCategory.saveAll(equipmentCategoryBatch);
}
return String.format("刷新证管理表数据:%s 条;对应设备ES数据:%s 条。", manageList.size(), useRegistrantionCodeList.size());
}
public String refreshXianData2ES(boolean isUpdate) throws IOException {
List<String> records = this.queryIsDoBusinessRecords();
if (records.isEmpty()) {
return "没有需要刷新数据!";
}
if (isUpdate) {
int batchSize = 1000;
int total = records.size();
for (int i = 0; i < total; i += batchSize) {
int end = Math.min(i + batchSize, total);
List<String> batch = new ArrayList<>(records.subList(i, end));
Iterable<ESEquipmentCategoryDto> equipmentCategoryBatch = esEquipmentCategory.findAllById(batch);
// 批量修改
for (ESEquipmentCategoryDto x : equipmentCategoryBatch) {
x.setIS_DO_BUSINESS(Boolean.TRUE);
x.setUSE_PLACE("陕西省/西安市");
x.setUSE_PLACE_CODE("610000#610100");
}
esEquipmentCategory.saveAll(equipmentCategoryBatch);
Iterable<ESEquipmentInfo> esEquipmentBatch = esEquipmentDao.findAllById(batch);
esEquipmentBatch.forEach(x -> {
x.setUSE_PLACE("陕西省/西安市");
x.setUSE_PLACE_CODE("610000#610100");
x.setIS_DO_BUSINESS(Boolean.TRUE);
});
esEquipmentDao.saveAll(esEquipmentBatch);
}
}
return String.format("刷新对应设备ES数据: %d 条。", records.size());
}
/**
* 查询需要删除的设备
*/
private List<String> queryIsDoBusinessRecords() throws IOException {
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("IS_DO_BUSINESS", false))
.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", false))
.must(QueryBuilders.termQuery("STATUS", "已认领"));
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder()
.query(boolQuery)
.fetchSource(new String[]{"SEQUENCE_NBR"}, null)
.size(10000);
SearchRequest request = new SearchRequest(IDX_BIZ_VIEW_JG_ALL).source(sourceBuilder);
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
return Arrays.stream(response.getHits().getHits())
.map(hit -> (String) hit.getSourceAsMap().get("SEQUENCE_NBR"))
.filter(Objects::nonNull)
.collect(Collectors.toList());
} }
} }
...@@ -594,6 +594,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate ...@@ -594,6 +594,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public void updateManageWithPass(JgCertificateReplenish certRep) { public void updateManageWithPass(JgCertificateReplenish certRep) {
registrationManageService.update(new LambdaUpdateWrapper<JgUseRegistrationManage>() registrationManageService.update(new LambdaUpdateWrapper<JgUseRegistrationManage>()
.eq(JgUseRegistrationManage::getUseRegistrationCode, certRep.getUseRegistrationCode()) .eq(JgUseRegistrationManage::getUseRegistrationCode, certRep.getUseRegistrationCode())
.set(JgUseRegistrationManage::getReceiveCompanyCode, certRep.getReceiveOrgCode())
.set(JgUseRegistrationManage::getReceiveOrgName, certRep.getReceiveOrgName())
.set(JgUseRegistrationManage::getReissueDate, certRep.getReissueDate())); .set(JgUseRegistrationManage::getReissueDate, certRep.getReissueDate()));
} }
......
...@@ -944,6 +944,12 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg ...@@ -944,6 +944,12 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
.setUseUnitName(jgChangeRegistrationName.getNewUseUnitName()) .setUseUnitName(jgChangeRegistrationName.getNewUseUnitName())
.setAuditPassDate(now) .setAuditPassDate(now)
.setVersion(manage.getVersion() + 1) .setVersion(manage.getVersion() + 1)
.setReceiveCompanyCode(ValidationUtil.isEmpty(manage.getReceiveCompanyCode())
? jgChangeRegistrationName.getReceiveCompanyCode() : manage.getReceiveCompanyCode()
)
.setReceiveOrgName(ValidationUtil.isEmpty(manage.getReceiveOrgName())
? jgChangeRegistrationName.getReceiveOrgName() : manage.getReceiveOrgName()
)
.setChangeReason(BusinessTypeEnum.JG_NAME_CHANGE_REGISTRATION.getName())); .setChangeReason(BusinessTypeEnum.JG_NAME_CHANGE_REGISTRATION.getName()));
jgUseRegistrationManageService.updateBatchById(manages); jgUseRegistrationManageService.updateBatchById(manages);
} }
......
...@@ -784,6 +784,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -784,6 +784,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgUseRegistrationManage.setAuditPassDate(new Date()); jgUseRegistrationManage.setAuditPassDate(new Date());
jgUseRegistrationManage.setApplyNo(jgChangeRegistrationReform.getApplyNo()); jgUseRegistrationManage.setApplyNo(jgChangeRegistrationReform.getApplyNo());
jgUseRegistrationManage.setRecDate(new Date()); jgUseRegistrationManage.setRecDate(new Date());
if (StringUtils.isEmpty(jgUseRegistrationManage.getReceiveCompanyCode())) {
jgUseRegistrationManage.setReceiveOrgName(jgChangeRegistrationReform.getReceiveOrgName());
jgUseRegistrationManage.setReceiveCompanyCode(jgChangeRegistrationReform.getReceiveCompanyCode());
}
jgUseRegistrationManageService.updateById(jgUseRegistrationManage); jgUseRegistrationManageService.updateById(jgUseRegistrationManage);
// 2.生成业务流水信息 // 2.生成业务流水信息
JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord(); JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord();
......
...@@ -839,6 +839,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -839,6 +839,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
String city = Objects.toString(tableData.get("city"), ""); String city = Objects.toString(tableData.get("city"), "");
String userCity = Optional.ofNullable(city).map(c -> c.split("_")[0]).orElseThrow(() -> new BadRequest("请选择地市后暂存!")); String userCity = Optional.ofNullable(city).map(c -> c.split("_")[0]).orElseThrow(() -> new BadRequest("请选择地市后暂存!"));
this.validateDeviceCity(deviceList, userCity, "0".equals(model.getChangeType())); this.validateDeviceCity(deviceList, userCity, "0".equals(model.getChangeType()));
this.setEquAddress(model);
} }
// 获取单位变更单号 // 获取单位变更单号
...@@ -914,7 +915,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -914,7 +915,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
model.setCreateUserName(reginParams.getUserModel().getRealName()); model.setCreateUserName(reginParams.getUserModel().getRealName());
model.setUseRegistCode(String.join(",", registrationNoList)); model.setUseRegistCode(String.join(",", registrationNoList));
model.setEquList(registrationList.get(0).get("equList").toString()); model.setEquList(registrationList.get(0).get("equList").toString());
this.setEquAddress(model);
JgChangeRegistrationUnit registrationUnit = new JgChangeRegistrationUnit(); JgChangeRegistrationUnit registrationUnit = new JgChangeRegistrationUnit();
BeanUtils.copyProperties(model, registrationUnit); BeanUtils.copyProperties(model, registrationUnit);
setNewUnitInfo(reginParams, registrationUnit); setNewUnitInfo(reginParams, registrationUnit);
...@@ -1018,7 +1018,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg ...@@ -1018,7 +1018,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
private String getRegionNameByCode(String type, String code) { private String getRegionNameByCode(String type, String code) {
List<LinkedHashMap<String, Object>> regions = (List<LinkedHashMap<String, Object>>) redisUtils.get(type.toUpperCase()); List<LinkedHashMap<String, Object>> regions = (List<LinkedHashMap<String, Object>>) redisUtils.get(type.toUpperCase());
return regions.stream() return regions.stream()
.filter(item -> code.equals(String.valueOf(item.get("regionCode")))) .filter(item -> String.valueOf(item.get("regionCode")).equals(code))
.map(item -> (String) item.get("regionName")) .map(item -> (String) item.get("regionName"))
.findFirst() .findFirst()
.orElse(""); .orElse("");
......
...@@ -36,4 +36,6 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> { ...@@ -36,4 +36,6 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
void setOrgBranchCodeIsNullByRecords(@Param("records") List<String> records); void setOrgBranchCodeIsNullByRecords(@Param("records") List<String> records);
void updateOrgBranchCodeByRecords(@Param("dataList") List<Map<String, Object>> dataList); void updateOrgBranchCodeByRecords(@Param("dataList") List<Map<String, Object>> dataList);
List<String> getSubCodes(String code);
} }
...@@ -87,6 +87,14 @@ ...@@ -87,6 +87,14 @@
AND ibjri."EQU_CATEGORY" = #{code} AND ibjri."EQU_CATEGORY" = #{code}
</if> </if>
</select> </select>
<select id="getSubCodes" resultType="java.lang.String">
SELECT
code
FROM
tz_equipment_category
WHERE
is_delete = 0 AND parent_id = ( SELECT id FROM tz_equipment_category where code = #{code} )
</select>
<update id="setOrgBranchCodeIsNullByRecords"> <update id="setOrgBranchCodeIsNullByRecords">
update amos_tzs_biz.idx_biz_jg_supervision_info set "ORG_BRANCH_CODE" = null where "RECORD" in update amos_tzs_biz.idx_biz_jg_supervision_info set "ORG_BRANCH_CODE" = null where "RECORD" in
......
...@@ -51,9 +51,9 @@ public class DPSubController { ...@@ -51,9 +51,9 @@ public class DPSubController {
if (ValidationUtil.isEmpty(param.get("equList"))){ if (ValidationUtil.isEmpty(param.get("equList"))){
param.put("equList", param.get("EQU_LIST_CODE")); param.put("equList", param.get("EQU_LIST_CODE"));
} }
// if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){ if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){
// param.put("PRODUCT_NAME", param.get("EQU_LIST")); param.put("PRODUCT_NAME", "--");
// } }
if (!ValidationUtil.isEmpty(param.get("equListCode"))){ // 问题列表关联设备 if (!ValidationUtil.isEmpty(param.get("equListCode"))){ // 问题列表关联设备
param.put("equList", param.get("equListCode")); param.put("equList", param.get("equListCode"));
param.put("EQU_LIST_CODE", param.get("equListCode")); param.put("EQU_LIST_CODE", param.get("equListCode"));
......
...@@ -886,6 +886,28 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -886,6 +886,28 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 筛选 // 筛选
if (!ObjectUtils.isEmpty(filter.get("filterParams"))) { if (!ObjectUtils.isEmpty(filter.get("filterParams"))) {
filterParams = JSONObject.parseObject(JSONObject.toJSONString(filter.get("filterParams"))); filterParams = JSONObject.parseObject(JSONObject.toJSONString(filter.get("filterParams")));
if (filterParams.containsKey("dp_filter_business_type") && filterParams.containsKey("DATA_QUALITY_SCORE") && !filterParams.containsKey("EQU_LIST")) {
List<String> equListCode = Arrays.asList("1000", "2000", "3000", "4000", "5000", "6000", "9000");
boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", equListCode));
boolMust.mustNot(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
}
if (filterParams.containsKey("other")) {
if (!filterParams.containsKey("EQU_LIST")) {
boolMust.mustNot(QueryBuilders.termsQuery("EQU_LIST_CODE", equList));
} else if (!filterParams.containsKey("EQU_CATEGORY")) {
JSONArray jsonArray = (JSONArray) filterParams.get("EQU_LIST");
if (!ObjectUtils.isEmpty(jsonArray)) {
List<String> subCodes = tzsCustomFilterMapper.getSubCodes(String.valueOf(jsonArray.get(0)));
boolMust.mustNot(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", subCodes));
}
} else if (!filterParams.containsKey("EQU_DEFINE")) {
JSONArray jsonArray = (JSONArray) filterParams.get("EQU_CATEGORY");
if (!ObjectUtils.isEmpty(jsonArray)) {
List<String> subCodes = tzsCustomFilterMapper.getSubCodes(String.valueOf(jsonArray.get(0)));
boolMust.mustNot(QueryBuilders.termsQuery("EQU_DEFINE_CODE", subCodes));
}
}
}
String filterType = filter.getString("filterType"); String filterType = filter.getString("filterType");
// 组装查询条件 // 组装查询条件
getEquipmentBoolQueryBuilder(boolMust, filterParams, filterType); getEquipmentBoolQueryBuilder(boolMust, filterParams, filterType);
......
...@@ -710,7 +710,7 @@ ...@@ -710,7 +710,7 @@
<select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto"> <select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category select * from tz_equipment_category
<where> <where>
code NOT LIKE '7%' is_delete = 0
<if test="parentCode != null and parentCode != ''"> <if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} ) and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if> </if>
...@@ -721,7 +721,7 @@ ...@@ -721,7 +721,7 @@
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto"> <select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category select * from tz_equipment_category
<where> <where>
code NOT LIKE '7%' AND code NOT LIKE '8%' is_delete = 0
<if test="parentCode != null and parentCode != ''"> <if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} ) and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if> </if>
......
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