Commit e1727802 authored by tianbo's avatar tianbo

refactor(common): 将saveAllWithCache重命名为saveAllWithFallback

- 将saveWithCache重命名为saveWithFallback
parent 9a987ff9
...@@ -27,7 +27,7 @@ public interface ESEquipmentCategory extends PagingAndSortingRepository<ESEquipm ...@@ -27,7 +27,7 @@ public interface ESEquipmentCategory extends PagingAndSortingRepository<ESEquipm
@Query("{\"prefix\": {\"ORG_BRANCH_CODE.keyword\": \"?0\"}}") @Query("{\"prefix\": {\"ORG_BRANCH_CODE.keyword\": \"?0\"}}")
List<ESEquipmentCategoryDto> findByOrgBranchCodeKeywordStartingWith(String orgBranchCodePrefix); List<ESEquipmentCategoryDto> findByOrgBranchCodeKeywordStartingWith(String orgBranchCodePrefix);
default Iterable<ESEquipmentCategoryDto> saveAllWithCache(Iterable<ESEquipmentCategoryDto> dtos) { default Iterable<ESEquipmentCategoryDto> saveAllWithFallback(Iterable<ESEquipmentCategoryDto> dtos) {
int batchSize = 2000; int batchSize = 2000;
List<ESEquipmentCategoryDto> dtoList = StreamSupport.stream(dtos.spliterator(), false) List<ESEquipmentCategoryDto> dtoList = StreamSupport.stream(dtos.spliterator(), false)
...@@ -105,10 +105,10 @@ public interface ESEquipmentCategory extends PagingAndSortingRepository<ESEquipm ...@@ -105,10 +105,10 @@ public interface ESEquipmentCategory extends PagingAndSortingRepository<ESEquipm
return dtoList; return dtoList;
} }
default ESEquipmentCategoryDto saveWithCache(ESEquipmentCategoryDto dto) { default ESEquipmentCategoryDto saveWithFallback(ESEquipmentCategoryDto dto) {
// 将单个对象转换为列表进行处理 // 将单个对象转换为列表进行处理
List<ESEquipmentCategoryDto> dtoList = Collections.singletonList(dto); List<ESEquipmentCategoryDto> dtoList = Collections.singletonList(dto);
Iterable<ESEquipmentCategoryDto> result = saveAllWithCache(dtoList); Iterable<ESEquipmentCategoryDto> result = saveAllWithFallback(dtoList);
// 返回处理后的单个对象 // 返回处理后的单个对象
return result.iterator().next(); return result.iterator().next();
} }
......
...@@ -1554,7 +1554,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -1554,7 +1554,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgInstallationNotice)); commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgInstallationNotice));
if (!ValidationUtil.isEmpty(esEquipmentDtos)) { if (!ValidationUtil.isEmpty(esEquipmentDtos)) {
// 只有审批完成后esEquipmentDtos不为空,才会更新es信息 // 只有审批完成后esEquipmentDtos不为空,才会更新es信息
esEquipmentCategory.saveAllWithCache(esEquipmentDtos); esEquipmentCategory.saveAllWithFallback(esEquipmentDtos);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -2549,7 +2549,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -2549,7 +2549,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
commonService.saveExecuteFlowData2Redis(jgInstallationNotice.getInstanceId(), this.buildInstanceRuntimeData(jgInstallationNotice)); commonService.saveExecuteFlowData2Redis(jgInstallationNotice.getInstanceId(), this.buildInstanceRuntimeData(jgInstallationNotice));
if (!ValidationUtil.isEmpty(esEquipmentDtos)) { if (!ValidationUtil.isEmpty(esEquipmentDtos)) {
// 只有审批完成后esEquipmentDtos不为空,才会更新es信息 // 只有审批完成后esEquipmentDtos不为空,才会更新es信息
esEquipmentCategory.saveAllWithCache(esEquipmentDtos); esEquipmentCategory.saveAllWithFallback(esEquipmentDtos);
} }
} }
} }
\ No newline at end of file
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