Commit c88f7898 authored by hcing's avatar hcing

refactor(jyjc): 修改检验结果录入保存后的消息发送逻辑

parent 4b03e7bc
...@@ -806,12 +806,15 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -806,12 +806,15 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
useInfoMapper.updateByRecord(inspectionDetectionInfo.getRecord(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo()); useInfoMapper.updateByRecord(inspectionDetectionInfo.getRecord(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.更新es下次检验日期 // 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord()); commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord());
sendDataRefreshMsg(records);
// 发送 type = update的数据,为了兼容检验机构对接时会先产生一条检验结果信息,此时还没有设备的检验信息,后续会更新该条检验信息,
// 所以 sendInspectionMsgAfterSave 方法在处理时只处理了update 操作。
bizEmqPublisher.sendInspectionMsgAfterSave(inspectionDetectionInfo, "update");
} catch (Exception e) { } catch (Exception e) {
log.warn(e.getMessage()); log.warn(e.getMessage());
throw new BadRequest("数据异常,请联系管理员!"); throw new BadRequest("数据异常,请联系管理员!");
} }
} }
sendDataRefreshMsg(records);
return Boolean.TRUE; return Boolean.TRUE;
} }
...@@ -940,6 +943,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -940,6 +943,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord()); commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord());
// 发送数据变更消息 // 发送数据变更消息
sendDataRefreshMsg(Sets.newHashSet(inspectionDetectionInfo.getRecord())); sendDataRefreshMsg(Sets.newHashSet(inspectionDetectionInfo.getRecord()));
bizEmqPublisher.sendInspectionMsgAfterSave(inspectionDetectionInfo, "update");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new BadRequest("数据异常,请联系管理员!"); throw new BadRequest("数据异常,请联系管理员!");
...@@ -976,9 +980,32 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -976,9 +980,32 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
jyjcInspectionHistoryService.getBaseMapper().delete(new LambdaQueryWrapper<JyjcInspectionHistory>().eq(JyjcInspectionHistory::getSSeq, resultSeq)); jyjcInspectionHistoryService.getBaseMapper().delete(new LambdaQueryWrapper<JyjcInspectionHistory>().eq(JyjcInspectionHistory::getSSeq, resultSeq));
// 发送数据变更消息 // 发送数据变更消息
sendDataRefreshMsg(records); sendDataRefreshMsg(records);
records.stream()
.filter(Objects::nonNull)
.map(this::getTheLatestInspectionInformation)
.filter(Objects::nonNull)
.forEach(info -> bizEmqPublisher.sendInspectionMsgAfterSave(info, "update"));
return Boolean.TRUE; return Boolean.TRUE;
} }
/**
* 获取最新的一条检验检测信息
*
* @param record 设备 record
* @return 最新的一条检验检测信息
*/
private IdxBizJgInspectionDetectionInfo getTheLatestInspectionInformation(String record) {
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoMapper.selectList(
new LambdaQueryWrapper<IdxBizJgInspectionDetectionInfo>()
.eq(IdxBizJgInspectionDetectionInfo::getRecord, record)
.orderByDesc(IdxBizJgInspectionDetectionInfo::getInspectDate)
.last("LIMIT 1")
);
return inspectionDetectionInfoList.stream()
.findFirst()
.orElse(null);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<PipelineInspectionResultDto> receivePipelineResultData(List<PipelineInspectionResultDto> resultData) { public List<PipelineInspectionResultDto> receivePipelineResultData(List<PipelineInspectionResultDto> resultData) {
log.info("收到检验检测厂商推送的压力管道结果数据:{}", JSONArray.toJSONString(resultData)); log.info("收到检验检测厂商推送的压力管道结果数据:{}", JSONArray.toJSONString(resultData));
......
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