Commit 61251a80 authored by suhuiguang's avatar suhuiguang

fix(设备创建) :es双写优化

1.写es移动到最后执行
parent 31ee2ca6
...@@ -105,15 +105,15 @@ public class BatchEquipResultDataProcessor implements SupportableResultDataProce ...@@ -105,15 +105,15 @@ public class BatchEquipResultDataProcessor implements SupportableResultDataProce
} }
// 3.更新使用信息表,最新检验信息 // 3.更新使用信息表,最新检验信息
useInfoMapper.updateByRecord(record, jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo()); useInfoMapper.updateByRecord(record, jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.更新es下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, record);
}); });
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// 5.新计算管道长度 // 5.新计算管道长度
inspectionResultService.calAndWriteTotalPipelineLength(jyjcInspectionResult.getEquipUnicode()); inspectionResultService.calAndWriteTotalPipelineLength(jyjcInspectionResult.getEquipUnicode());
// 6.发送数据刷新消息 // 6.更新es下次检验日期
commonService.updateEquipNextInspectDateBatch(jyjcInspectionResult.getNextInspectionDate(), new ArrayList<>(records));
// 7.发送数据刷新消息
inspectionResultService.sendDataRefreshMsg(records); inspectionResultService.sendDataRefreshMsg(records);
} }
} }
......
...@@ -92,10 +92,10 @@ public class SingleEquipResultDataProcessor implements SupportableResultDataProc ...@@ -92,10 +92,10 @@ public class SingleEquipResultDataProcessor implements SupportableResultDataProc
inspectionResultService.updateTechParam(jyjcInspectionResult.getSequenceNbr(), record); inspectionResultService.updateTechParam(jyjcInspectionResult.getSequenceNbr(), record);
// 3.更新使用信息表最新的检验信息 // 3.更新使用信息表最新的检验信息
useInfoMapper.updateByRecord(jyjcInspectionResult.getEquipUnicode(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo()); useInfoMapper.updateByRecord(jyjcInspectionResult.getEquipUnicode(), jyjcInspectionResult.getNextInspectionDate(), jyjcInspectionResult.getInspectionType(), jyjcInspectionResult.getApplicationNo());
// 4.es更新下次检验日期 // 4.气瓶时记录气瓶附件表
commonService.updateEquipNextInspectDate(jyjcInspectionResult, jyjcInspectionResult.getEquipUnicode());
// 5.气瓶时记录气瓶附件表
this.saveOrUpdateCylinderAttachment(jyjcInspectionResult, info); this.saveOrUpdateCylinderAttachment(jyjcInspectionResult, info);
// 5.es更新下次检验日期
commonService.updateEquipNextInspectDate(jyjcInspectionResult, jyjcInspectionResult.getEquipUnicode());
// 发送数据刷新消息 // 发送数据刷新消息
inspectionResultService.sendDataRefreshMsg(Collections.singleton(record)); inspectionResultService.sendDataRefreshMsg(Collections.singleton(record));
} }
......
...@@ -402,9 +402,7 @@ public class CommonServiceImpl { ...@@ -402,9 +402,7 @@ public class CommonServiceImpl {
public void updateEquipNextInspectDateBatch(Date nextInspectionDate, List<String> records) { public void updateEquipNextInspectDateBatch(Date nextInspectionDate, List<String> records) {
if (nextInspectionDate != null) { if (nextInspectionDate != null) {
Iterable<ESEquipmentCategoryDto> equipmentCategoryDtos = esEquipmentCategory.findAllById(records); Iterable<ESEquipmentCategoryDto> equipmentCategoryDtos = esEquipmentCategory.findAllById(records);
equipmentCategoryDtos.forEach(esEquipmentCategoryDto->{ equipmentCategoryDtos.forEach(esEquipmentCategoryDto-> esEquipmentCategoryDto.setNEXT_INSPECT_DATE(nextInspectionDate.getTime()));
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(nextInspectionDate.getTime());
});
esEquipmentCategory.saveAll(equipmentCategoryDtos); esEquipmentCategory.saveAll(equipmentCategoryDtos);
} }
} }
......
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