Commit ddfe5922 authored by suhuiguang's avatar suhuiguang

fix(大编辑) :es顺序

1.写es移动到最后执行
parent 8fd6fe17
...@@ -26,7 +26,7 @@ public class DataRefreshDispatcher implements IDataRefreshDispatch { ...@@ -26,7 +26,7 @@ public class DataRefreshDispatcher implements IDataRefreshDispatch {
public void doDispatch(List<IDataRefreshHandler> dataRefreshHandlers, List<TzsDataRefreshMessage> messages) { public void doDispatch(List<IDataRefreshHandler> dataRefreshHandlers, List<TzsDataRefreshMessage> messages) {
int total = dataRefreshHandlers.size(); int total = dataRefreshHandlers.size();
dataRefreshHandlers.forEach(dataRefreshHandler -> { dataRefreshHandlers.forEach(dataRefreshHandler -> {
messages.forEach(message -> { messages.parallelStream().forEach(message -> {
try { try {
message.setDistributions(total); message.setDistributions(total);
dataRefreshHandler.doRefresh(message); dataRefreshHandler.doRefresh(message);
......
...@@ -2048,6 +2048,7 @@ public class DataDockServiceImpl { ...@@ -2048,6 +2048,7 @@ public class DataDockServiceImpl {
equipmentCategoryDto.setSEQUENCE_NBR(record); equipmentCategoryDto.setSEQUENCE_NBR(record);
return equipmentCategoryDto; return equipmentCategoryDto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.error("导入失败,开始回滚删除数据:{}", JSONObject.toJSONString(dtoList));
esEquipmentCategory.deleteAll(dtoList); esEquipmentCategory.deleteAll(dtoList);
} }
throw e; throw e;
......
...@@ -4832,6 +4832,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4832,6 +4832,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip)); eventPublisher.publish(new EquipCreateOrEditEvent(this, BusinessTypeEnum.JG_NEW_EQUIP.name(), recordSet, EquipCreateOrEditEvent.EquipType.equip));
} catch (Exception e) { } catch (Exception e) {
if(!esEquipmentCategoryList.isEmpty()){ if(!esEquipmentCategoryList.isEmpty()){
log.error("导入失败,开始回滚删除数据:{}", JSONObject.toJSONString(esEquipmentCategoryList));
esEquipmentCategory.deleteAll(esEquipmentCategoryList); esEquipmentCategory.deleteAll(esEquipmentCategoryList);
} }
throw e; throw e;
......
...@@ -3526,9 +3526,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3526,9 +3526,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} catch (Exception e) { } catch (Exception e) {
// 报错时回滚 // 报错时回滚
if(equipmentCategoryDtosSnapshot.iterator().hasNext()){ if(equipmentCategoryDtosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复老索引设备数据:{}", JSONObject.toJSONString(equipmentCategoryDtosSnapshot));
esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot); esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot);
} }
if(esEquipmentInfosSnapshot.iterator().hasNext()){ if(esEquipmentInfosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复新索引设备数据:{}", JSONObject.toJSONString(esEquipmentInfosSnapshot));
esEquipmentDao.saveAll(esEquipmentInfosSnapshot); esEquipmentDao.saveAll(esEquipmentInfosSnapshot);
} }
throw new RuntimeException(e); throw new RuntimeException(e);
...@@ -3765,9 +3767,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3765,9 +3767,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
esEquipmentDao.saveAll(esEquipmentInfoDtoMap.values()); esEquipmentDao.saveAll(esEquipmentInfoDtoMap.values());
} catch (Exception e) { } catch (Exception e) {
if(!equipmentCategoryDtosSnapshot.isEmpty()){ if(!equipmentCategoryDtosSnapshot.isEmpty()){
log.error("使用登记作废报错开始按照快照恢复老索引设备数据:{}", JSONObject.toJSONString(equipmentCategoryDtosSnapshot));
esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot); esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot);
} }
if(!esEquipmentInfosSnapshot.isEmpty()){ if(!esEquipmentInfosSnapshot.isEmpty()){
log.error("使用登记作废报错开始按照快照恢复新索引设备数据:{}", JSONObject.toJSONString(esEquipmentInfosSnapshot));
esEquipmentDao.saveAll(esEquipmentInfosSnapshot); esEquipmentDao.saveAll(esEquipmentInfosSnapshot);
} }
throw new RuntimeException(e); throw new RuntimeException(e);
...@@ -3814,9 +3818,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3814,9 +3818,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 报错时按照快照数据恢复 // 报错时按照快照数据恢复
if(oldStatus.equals(FlowStatusEnum.TO_BE_FINISHED.getName())) { if(oldStatus.equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
if(equipmentCategoryDtosSnapshot.iterator().hasNext()){ if(equipmentCategoryDtosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复老索引设备数据:{}", JSONObject.toJSONString(equipmentCategoryDtosSnapshot));
esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot); esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot);
} }
if(esEquipmentInfosSnapshot.iterator().hasNext()){ if(esEquipmentInfosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复新索引设备数据:{}", JSONObject.toJSONString(esEquipmentInfosSnapshot));
esEquipmentDao.saveAll(esEquipmentInfosSnapshot); esEquipmentDao.saveAll(esEquipmentInfosSnapshot);
} }
} }
...@@ -3851,9 +3857,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3851,9 +3857,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 报错时按照快照数据恢复 // 报错时按照快照数据恢复
if(oldStatus.equals(FlowStatusEnum.TO_BE_FINISHED.getName())) { if(oldStatus.equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
if(equipmentCategoryDtosSnapshot.iterator().hasNext()){ if(equipmentCategoryDtosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复老索引设备数据:{}", JSONObject.toJSONString(equipmentCategoryDtosSnapshot));
esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot); esEquipmentCategory.saveAll(equipmentCategoryDtosSnapshot);
} }
if(equipmentCategoryDtosSnapshot.iterator().hasNext()){ if(equipmentCategoryDtosSnapshot.iterator().hasNext()){
log.error("使用登记作废报错开始按照快照恢复新索引设备数据:{}", JSONObject.toJSONString(equipmentCategoryDtosSnapshot));
esEquipmentDao.saveAll(esEquipmentInfosSnapshot); esEquipmentDao.saveAll(esEquipmentInfosSnapshot);
} }
} }
......
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