Commit 5bd10269 authored by tianbo's avatar tianbo

feat(jg): 增加设备数据来源标识及历史登记逻辑控制

- 修改CommonMapper.xml查询条件,排除历史设备登记业务类型并限定数据源为0 - 在DataDockServiceImpl中增加dataSource字段处理,用于区分设备数据来源 - 调整历史设备登记判断逻辑,新增dataSource等于jg_his_xa时才执行历史登记 - 保存履历信息时设置业务类型为历史使用登记 - XiAnDataDockServiceImpl中批量保存接口增加isRegistration参数以控制数据源标记 - 根据是否已登记设置设备数据源为jg_his_xa或jg_xa- XiAnElevatorExcelDto中添加dataSource字段用于标识数据来源
parent 3f59e642
...@@ -438,6 +438,10 @@ public class XiAnElevatorExcelDto extends BaseDto { ...@@ -438,6 +438,10 @@ public class XiAnElevatorExcelDto extends BaseDto {
@ExcelProperty(value = "市场监管所代码") @ExcelProperty(value = "市场监管所代码")
private String supervisionOfficeCode; private String supervisionOfficeCode;
@ApiModelProperty(value = "数据来源")
@ExcelIgnore
private String dataSource;
public void setoRegUnit(String oRegUnit) { public void setoRegUnit(String oRegUnit) {
this.oRegUnit = oRegUnit; this.oRegUnit = oRegUnit;
} }
......
...@@ -565,7 +565,7 @@ public class XiAnDataDockServiceImpl { ...@@ -565,7 +565,7 @@ public class XiAnDataDockServiceImpl {
return ResponseHelper.buildFailureResponse(e.getMessage(), "参数校验失败,详细请看返回信息", HttpStatus.BAD_REQUEST); return ResponseHelper.buildFailureResponse(e.getMessage(), "参数校验失败,详细请看返回信息", HttpStatus.BAD_REQUEST);
} }
return ResponseHelper.buildResponse(this.batchSaveElevatorData(elevatorExcelDtos)); return ResponseHelper.buildResponse(this.batchSaveElevatorData(elevatorExcelDtos, isRegistration));
} }
/** /**
...@@ -774,8 +774,9 @@ public class XiAnDataDockServiceImpl { ...@@ -774,8 +774,9 @@ public class XiAnDataDockServiceImpl {
* 批量异步保存设备数据 * 批量异步保存设备数据
* *
* @param elevatorExcelDtos * @param elevatorExcelDtos
* @param isRegistration
*/ */
public Map<String, Object> batchSaveElevatorData(List<XiAnElevatorExcelDto> elevatorExcelDtos) { public Map<String, Object> batchSaveElevatorData(List<XiAnElevatorExcelDto> elevatorExcelDtos, Boolean isRegistration) {
log.info("解析成功,准备上传数据,条数:{}", elevatorExcelDtos.size()); log.info("解析成功,准备上传数据,条数:{}", elevatorExcelDtos.size());
int batchSize = 1000; int batchSize = 1000;
int totalSize = elevatorExcelDtos.size(); int totalSize = elevatorExcelDtos.size();
...@@ -793,6 +794,17 @@ public class XiAnDataDockServiceImpl { ...@@ -793,6 +794,17 @@ public class XiAnDataDockServiceImpl {
try { try {
semaphore.acquire(); // 获取许可 semaphore.acquire(); // 获取许可
contextWrapper.apply(); contextWrapper.apply();
batch.forEach(equ -> {
if (isRegistration) {
// 已登记的设备作为历史设备
equ.setDataSource("jg_his_xa");
} else {
// 未做过登记的新设备
equ.setDataSource("jg_xa");
}
});
Object result = jgServiceFeignClient.saveElevatorData(batch); Object result = jgServiceFeignClient.saveElevatorData(batch);
LinkedHashMap<String, Object> resultMap = (LinkedHashMap<String, Object>) result; LinkedHashMap<String, Object> resultMap = (LinkedHashMap<String, Object>) result;
......
...@@ -3326,7 +3326,8 @@ ...@@ -3326,7 +3326,8 @@
from from
tzs_jg_resume_info tzs_jg_resume_info
where where
equ_id = #{record} and change_content = '设备编辑' equ_id = #{record} AND business_type <![CDATA[ <> ]]> '历史设备登记'
AND data_source = 0
) a ) a
</select> </select>
</mapper> </mapper>
...@@ -2660,6 +2660,8 @@ public class DataDockServiceImpl { ...@@ -2660,6 +2660,8 @@ public class DataDockServiceImpl {
String businessId = Optional.ofNullable(equ.get("businessId")).map(String::valueOf).orElse(""); String businessId = Optional.ofNullable(equ.get("businessId")).map(String::valueOf).orElse("");
String isCompleteXa = Optional.ofNullable(equ.get("isCompleteXa")).map(String::valueOf).orElse(""); String isCompleteXa = Optional.ofNullable(equ.get("isCompleteXa")).map(String::valueOf).orElse("");
String useRegistrationCode = Optional.ofNullable(equ.get("useOrgCode")).map(String::valueOf).orElse("").trim(); String useRegistrationCode = Optional.ofNullable(equ.get("useOrgCode")).map(String::valueOf).orElse("").trim();
dataSource = !ValidationUtil.isEmpty(equ.get("dataSource")) ? MapUtil.getStr(equ, "dataSource") : dataSource;
try { try {
if (!equList.isEmpty()) { if (!equList.isEmpty()) {
// 判断设备是否已经做过除历史登记外的其他业务,如果做了其他业务则不能更新并记录反馈 // 判断设备是否已经做过除历史登记外的其他业务,如果做了其他业务则不能更新并记录反馈
...@@ -2690,8 +2692,8 @@ public class DataDockServiceImpl { ...@@ -2690,8 +2692,8 @@ public class DataDockServiceImpl {
saveEquInfoToEs(record, isCompleteXa); saveEquInfoToEs(record, isCompleteXa);
this.saveInstallInfo(equ);//安装信息 this.saveInstallInfo(equ);//安装信息
this.historyEquUpdateMaintenanceInfo(equ);//维保信息 this.historyEquUpdateMaintenanceInfo(equ);//维保信息
// isRegistered=false是未做过登记设备,且有使用登记证号则做历史登记 // isRegistered=false是未做过登记设备,且dataSource=jg_his,且有使用登记证号则做历史登记
if (!ValidationUtil.isEmpty(useRegistrationCode) && !isRegistered) { if (!ValidationUtil.isEmpty(useRegistrationCode) && !isRegistered && "jg_his_xa".equals(dataSource)) {
this.handleHistoryEquip(equ);//历史登记 this.handleHistoryEquip(equ);//历史登记
} }
// isRegistered=true表示已做过历史平台登记,则需更新历史单据等信息。 // isRegistered=true表示已做过历史平台登记,则需更新历史单据等信息。
...@@ -2916,6 +2918,7 @@ public class DataDockServiceImpl { ...@@ -2916,6 +2918,7 @@ public class DataDockServiceImpl {
JgResumeInfo resumeInfo = jgResumeInfoService.lambdaQuery().eq(JgResumeInfo::getApplyNo, jgUseRegistration.getApplyNo()).one(); JgResumeInfo resumeInfo = jgResumeInfoService.lambdaQuery().eq(JgResumeInfo::getApplyNo, jgUseRegistration.getApplyNo()).one();
if (ValidationUtil.isEmpty(resumeInfo)) { if (ValidationUtil.isEmpty(resumeInfo)) {
resumeInfo = new JgResumeInfo(); resumeInfo = new JgResumeInfo();
resumeInfo.setBusinessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName());
resumeInfo.setEquId(equ.get("record").toString()); resumeInfo.setEquId(equ.get("record").toString());
resumeInfo.setApplyNo(jgUseRegistration.getApplyNo()); resumeInfo.setApplyNo(jgUseRegistration.getApplyNo());
resumeInfo.setBusinessId(jgUseRegistration.getSequenceNbr() + ""); resumeInfo.setBusinessId(jgUseRegistration.getSequenceNbr() + "");
......
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