Commit 61251a80 authored by suhuiguang's avatar suhuiguang

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

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