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 @@
and tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
<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 test="dto.equListCode != null and dto.equListCode != ''">
and tjurm.equ_list_code = #{dto.equListCode}
......@@ -129,7 +130,8 @@
and tjurm.use_unit_name like concat ('%',#{dto.useUnitCreditNameForSearch},'%')
</if>
<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 test="dto.dataType == 'company' ">
......
......@@ -109,8 +109,8 @@ public class CommonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/creatTree")
@ApiOperation(httpMethod = "GET", value = "获取管辖分局树", notes = "获取管辖分局树")
public ResponseModel<Object> creatTree() {
return ResponseHelper.buildResponse(commonService.getTree(getSelectedOrgInfo()));
public ResponseModel<Object> creatTree(@RequestParam(required = false) String client) {
return ResponseHelper.buildResponse(commonService.getTree(client, getSelectedOrgInfo()));
}
......
......@@ -354,4 +354,11 @@ public class DataHandlerController extends BaseController {
public ResponseModel<String> 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 {
public static final Set<String> USE_CERT_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"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 {
public static final Set<String> USE_FLAG_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equDefine", "equCode", "useInnerCode", "inspectOrgName", "nextInspectDate",
"emergencyTel", "maintenanceUnitName","useOrgCode"
"emergencyTel", "maintenanceUnitName", "useOrgCode", "useRegistrationCode"
)));
/**
......@@ -28,7 +28,7 @@ public class ChangeFieldWatchConstants {
public static final Set<String> USE_FLAG_VEHICLE_MONITORED_FIELDS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"productName", "carNumber", "factoryNum", "gasNum", "volume", "fillingMedium", "inspectOrgName",
"nextInspectDate","useOrgCode"
"nextInspectDate", "useOrgCode", "useRegistrationCode"
)));
/**
......@@ -55,7 +55,7 @@ public class ChangeFieldWatchConstants {
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equCode", "productName", "contactPhone", "installUnitName",
"equipType", "factoryNum", "produceUnitName", "produceLicenseNum", "province",
"city", "county", "street", "address","useOrgCode"
"city", "county", "street", "address", "useOrgCode", "useRegistrationCode"
)));
/**
......
......@@ -142,6 +142,7 @@ public class ChangeEquipImpactCertListener {
manage.setEquDefine(EquDefineConverter.getKeyByValue(afterValue));
break;
case "useOrgCode":
case "useRegistrationCode":
manage.setUseRegistrationCode(afterValue);
break;
case "carNumber":
......@@ -333,9 +334,9 @@ public class ChangeEquipImpactCertListener {
private void handleNewProjectEdit(List<FieldChangeMeta> fieldChangeMetaList, String projectContraptionId) {
log.info("处理 handleNewProjectEdit 类型逻辑");
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(projectContraptionId);
JSONObject certificatePrintTag = Optional.ofNullable(projectContraption.getCertificatePrintTag())
.map(JSONObject::parseObject).orElse(new JSONObject());
JSONObject tagJson = this.handleFieldChangeProject(fieldChangeMetaList, certificatePrintTag);
JSONObject certificatePrintTag = Optional.ofNullable(projectContraption.getCertificatePrintTag())
.map(JSONObject::parseObject).orElse(new JSONObject());
JSONObject tagJson = this.handleFieldChangeProject(fieldChangeMetaList, certificatePrintTag);
projectContraption.setCertificatePrintTag(JSONObject.toJSONString(tagJson));
jgProjectContraptionService.updateById(projectContraption);
}
......
......@@ -30,7 +30,7 @@ public interface ICommonService {
List<LinkedHashMap> getRegion(String level, String parentId);
List<LinkedHashMap> getTree(ReginParams selectedOrgInfo);
List<LinkedHashMap> getTree(String client, ReginParams selectedOrgInfo);
List<LinkedHashMap> getApproveTree(ReginParams reginParams);
......
......@@ -733,9 +733,9 @@ public class CommonServiceImpl implements ICommonService {
}
@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);
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree();
......@@ -871,7 +871,7 @@ public class CommonServiceImpl implements ICommonService {
Iterator it = result.iterator();
while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next();
// 删除非行政审批局
// 删除非监管机构
Object companyTypeObj = e.get("companyType");
if (companyTypeObj == null || !companyTypeObj.toString().contains(companyType)) {
it.remove();
......@@ -2368,13 +2368,13 @@ public class CommonServiceImpl implements ICommonService {
List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) {
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;
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;
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;
}
return result;
......@@ -2404,13 +2404,13 @@ public class CommonServiceImpl implements ICommonService {
List<EquipmentCategoryDto> result = Collections.emptyList();
switch (type) {
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;
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;
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;
}
return result;
......
......@@ -564,7 +564,7 @@ public class DataDockServiceImpl {
otherInfo.setClaimStatus("已认领");
otherInfo.setRecDate(new Date());
if (EquipmentClassifityEnum.DT.getCode().equals(equList)) {
otherInfo.setCode96333Type("1");
otherInfo.setCode96333Type(ValidationUtil.isEmpty(equ.get("code96333")) ? "2" : "1");
}
idxBizJgOtherInfoService.save(otherInfo);
}
......
......@@ -2186,27 +2186,97 @@ public class DataHandlerServiceImpl {
List<Long> manageSeqs = manageList.stream()
.map(JgUseRegistrationManage::getSequenceNbr)
.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()
.map(JgUseRegistrationManage::getUseRegistrationCode)
.collect(Collectors.toList());
List<String> recordList = registerInfoService.lambdaQuery()
.in(IdxBizJgRegisterInfo::getUseOrgCode, useRegistrantionCodeList)
.list()
.stream()
.map(IdxBizJgRegisterInfo::getRecord)
List<List<String>> useRegistrationCodes = Lists.partition(useRegistrantionCodeList, BATCH_SIZE);
for (List<String> useRegistrations : useRegistrationCodes) {
List<String> recordList = registerInfoService.lambdaQuery()
.in(IdxBizJgRegisterInfo::getUseOrgCode, useRegistrations)
.list()
.stream()
.map(IdxBizJgRegisterInfo::getRecord)
.collect(Collectors.toList());
// 批量查询 & 更新设备数据
Iterable<ESEquipmentInfo> esEquipmentBatch = esEquipmentDao.findAllById(recordList);
esEquipmentBatch.forEach(x -> {
x.setUSE_PLACE("陕西省/西安市");
x.setUSE_PLACE_CODE("610000#610100");
x.setIS_DO_BUSINESS(Boolean.TRUE);
});
esEquipmentDao.saveAll(esEquipmentBatch);
// 批量查询 & 更新设备分类数据
Iterable<ESEquipmentCategoryDto> equipmentCategoryBatch = esEquipmentCategory.findAllById(recordList);
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());
// 更新数据 --- 证管理数据
jgUseRegistrationManageServiceImpl.lambdaUpdate()
.set(JgUseRegistrationManage::getIsDoBusiness, Boolean.TRUE)
.in(JgUseRegistrationManage::getSequenceNbr, manageSeqs)
.update();
// 更新数据 --- 设备数据
Iterable<ESEquipmentInfo> esEquipmentDaoAllById = esEquipmentDao.findAllById(recordList);
esEquipmentDaoAllById.forEach(x -> x.setIS_DO_BUSINESS(Boolean.TRUE));
esEquipmentDao.saveAll(esEquipmentDaoAllById);
Iterable<ESEquipmentCategoryDto> equipmentCategoryAllById = esEquipmentCategory.findAllById(recordList);
equipmentCategoryAllById.forEach(x -> x.setIS_DO_BUSINESS(Boolean.TRUE));
esEquipmentCategory.saveAll(equipmentCategoryAllById);
return String.format("刷新证管理表数据:%s 条;对应设备ES数据:%s 条。", manageList.size(), recordList.size());
}
}
......@@ -594,6 +594,8 @@ public class JgCertificateReplenishServiceImpl extends BaseService<JgCertificate
public void updateManageWithPass(JgCertificateReplenish certRep) {
registrationManageService.update(new LambdaUpdateWrapper<JgUseRegistrationManage>()
.eq(JgUseRegistrationManage::getUseRegistrationCode, certRep.getUseRegistrationCode())
.set(JgUseRegistrationManage::getReceiveCompanyCode, certRep.getReceiveOrgCode())
.set(JgUseRegistrationManage::getReceiveOrgName, certRep.getReceiveOrgName())
.set(JgUseRegistrationManage::getReissueDate, certRep.getReissueDate()));
}
......
......@@ -944,6 +944,12 @@ public class JgChangeRegistrationNameServiceImpl extends BaseService<JgChangeReg
.setUseUnitName(jgChangeRegistrationName.getNewUseUnitName())
.setAuditPassDate(now)
.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()));
jgUseRegistrationManageService.updateBatchById(manages);
}
......
......@@ -784,6 +784,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgUseRegistrationManage.setAuditPassDate(new Date());
jgUseRegistrationManage.setApplyNo(jgChangeRegistrationReform.getApplyNo());
jgUseRegistrationManage.setRecDate(new Date());
if (StringUtils.isEmpty(jgUseRegistrationManage.getReceiveCompanyCode())) {
jgUseRegistrationManage.setReceiveOrgName(jgChangeRegistrationReform.getReceiveOrgName());
jgUseRegistrationManage.setReceiveCompanyCode(jgChangeRegistrationReform.getReceiveCompanyCode());
}
jgUseRegistrationManageService.updateById(jgUseRegistrationManage);
// 2.生成业务流水信息
JgCertificateChangeRecord jgCertificateChangeRecord = new JgCertificateChangeRecord();
......
......@@ -839,6 +839,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
String city = Objects.toString(tableData.get("city"), "");
String userCity = Optional.ofNullable(city).map(c -> c.split("_")[0]).orElseThrow(() -> new BadRequest("请选择地市后暂存!"));
this.validateDeviceCity(deviceList, userCity, "0".equals(model.getChangeType()));
this.setEquAddress(model);
}
// 获取单位变更单号
......@@ -914,7 +915,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
model.setCreateUserName(reginParams.getUserModel().getRealName());
model.setUseRegistCode(String.join(",", registrationNoList));
model.setEquList(registrationList.get(0).get("equList").toString());
this.setEquAddress(model);
JgChangeRegistrationUnit registrationUnit = new JgChangeRegistrationUnit();
BeanUtils.copyProperties(model, registrationUnit);
setNewUnitInfo(reginParams, registrationUnit);
......@@ -1018,7 +1018,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
private String getRegionNameByCode(String type, String code) {
List<LinkedHashMap<String, Object>> regions = (List<LinkedHashMap<String, Object>>) redisUtils.get(type.toUpperCase());
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"))
.findFirst()
.orElse("");
......
......@@ -36,4 +36,6 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
void setOrgBranchCodeIsNullByRecords(@Param("records") List<String> records);
void updateOrgBranchCodeByRecords(@Param("dataList") List<Map<String, Object>> dataList);
List<String> getSubCodes(String code);
}
......@@ -87,6 +87,14 @@
AND ibjri."EQU_CATEGORY" = #{code}
</if>
</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 amos_tzs_biz.idx_biz_jg_supervision_info set "ORG_BRANCH_CODE" = null where "RECORD" in
......
......@@ -51,9 +51,9 @@ public class DPSubController {
if (ValidationUtil.isEmpty(param.get("equList"))){
param.put("equList", param.get("EQU_LIST_CODE"));
}
// if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){
// param.put("PRODUCT_NAME", param.get("EQU_LIST"));
// }
if (ValidationUtil.isEmpty(param.get("PRODUCT_NAME"))){
param.put("PRODUCT_NAME", "--");
}
if (!ValidationUtil.isEmpty(param.get("equListCode"))){ // 问题列表关联设备
param.put("equList", param.get("equListCode"));
param.put("EQU_LIST_CODE", param.get("equListCode"));
......
......@@ -886,6 +886,28 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
// 筛选
if (!ObjectUtils.isEmpty(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");
// 组装查询条件
getEquipmentBoolQueryBuilder(boolMust, filterParams, filterType);
......
......@@ -710,7 +710,7 @@
<select id="selectClassifyNoStart7ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%'
is_delete = 0
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</if>
......@@ -721,7 +721,7 @@
<select id="selectClassifyNoStart7And8ByParentCode" resultType="com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto">
select * from tz_equipment_category
<where>
code NOT LIKE '7%' AND code NOT LIKE '8%'
is_delete = 0
<if test="parentCode != null and parentCode != ''">
and parent_id = (SELECT id FROM tz_equipment_category WHERE code = #{parentCode} )
</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