Commit 40721d4a authored by 刘林's avatar 刘林

fix(jg):西安电梯做业务修改

parent 232e04dc
......@@ -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' ">
......
......@@ -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
......@@ -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);
}
......
......@@ -2195,18 +2195,90 @@ public class DataHandlerServiceImpl {
.stream()
.map(IdxBizJgRegisterInfo::getRecord)
.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);
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<List<String>> recordPartitions = Lists.partition(recordList, BATCH_SIZE);
for (List<String> part : recordPartitions) {
// 批量查询 & 更新设备数据
Iterable<ESEquipmentInfo> esEquipmentBatch = esEquipmentDao.findAllById(part);
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(part);
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(), recordList.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
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();
......
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