Commit b8c8bc83 authored by hcing's avatar hcing

feat(amos-boot-module-jg): 添加刷新西安电梯数据功能

- 在 DataHandlerController 中添加 refreshXianData 方法,用于刷新西安电梯数据 - 在 DataHandlerServiceImpl 中实现 refreshXianData 方法,更新证管理表和设备数据 - 刷新数据包括:证管理表中的 isDoBusiness 字段从0 到 1,以及对应设备数据的 isDoBusiness 字段从 0 到 1
parent ff5e1cd8
......@@ -347,4 +347,11 @@ public class DataHandlerController extends BaseController {
public ResponseModel<String> safetyProblemDataWriteRegionCodeAndName() {
return ResponseHelper.buildResponse(dataHandlerService.safetyProblemDataWriteRegionCodeAndName());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "刷新西安电梯数据,使其可以做后续业务", notes = "刷新西安电梯数据,使其可以做后续业务")
@GetMapping(value = "/refreshXianData")
public ResponseModel<String> refreshXianData() {
return ResponseHelper.buildResponse(dataHandlerService.refreshXianData());
}
}
\ No newline at end of file
......@@ -2169,4 +2169,44 @@ public class DataHandlerServiceImpl {
}
return String.format("刷新数据数量:%s", result);
}
/**
* 刷新西安电梯数据,使其可以做后续业务
* 使用登记证表的isDoBusiness 0 -> 1 ,与之对应的设备数据 isDoBusiness 0 -> 1
*
* @return 刷新使用登记证数量和设备数量
*/
public String refreshXianData() {
// 证管理表中sDoBusiness 0 数据
List<JgUseRegistrationManage> manageList = jgUseRegistrationManageServiceImpl.lambdaQuery()
.eq(JgUseRegistrationManage::getIsDoBusiness, Boolean.FALSE)
.eq(JgUseRegistrationManage::getIsDelete, Boolean.FALSE)
.list();
// 对应的设备数据
List<Long> manageSeqs = manageList.stream()
.map(JgUseRegistrationManage::getSequenceNbr)
.collect(Collectors.toList());
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)
.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());
}
}
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