Commit c682eb68 authored by hcing's avatar hcing

feat(jyjc): 报检结果更新时刷新设备对应的安全追溯问题

parent 155b74a9
......@@ -179,10 +179,10 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
model = new JyjcInspectionResultModel();
}
if (type) {
//检验检测单位分页查询
// 检验检测单位分页查询
model.setInspectionUnitCode(reginParams.getCompany().getCompanyCode());
} else {
//报检单位分页查询
// 报检单位分页查询
model.setApplicationUnitCode(reginParams.getCompany().getCompanyCode());
}
Page<JyjcInspectionResultModel> resultPage = resultMapper.selectJyjcInspectionResultpPage(page, model);
......@@ -806,12 +806,13 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
useInfoMapper.updateByRecord(inspectionDetectionInfo.getRecord(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord());
sendDataRefreshMsg(records);
bizEmqPublisher.sendInspectionMsgAfterSave(inspectionDetectionInfo, "insert");
} catch (Exception e) {
log.warn(e.getMessage());
throw new BadRequest("数据异常,请联系管理员!");
}
}
sendDataRefreshMsg(records);
return Boolean.TRUE;
}
......@@ -940,6 +941,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
commonService.updateEquipNextInspectDate(jyjcInspectionResult, inspectionDetectionInfo.getRecord());
// 发送数据变更消息
sendDataRefreshMsg(Sets.newHashSet(inspectionDetectionInfo.getRecord()));
bizEmqPublisher.sendInspectionMsgAfterSave(inspectionDetectionInfo, "update");
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("数据异常,请联系管理员!");
......@@ -976,9 +978,33 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
jyjcInspectionHistoryService.getBaseMapper().delete(new LambdaQueryWrapper<JyjcInspectionHistory>().eq(JyjcInspectionHistory::getSSeq, resultSeq));
// 发送数据变更消息
sendDataRefreshMsg(records);
records.stream()
.filter(Objects::nonNull)
.map(this::getTheLatestInspectionInformation)
.filter(Objects::nonNull)
.forEach(info -> bizEmqPublisher.sendInspectionMsgAfterSave(info, "update"));
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)
public List<PipelineInspectionResultDto> receivePipelineResultData(List<PipelineInspectionResultDto> 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