Commit df96cf02 authored by 刘林's avatar 刘林

fix(jg):【现场问题】压力管道-压力容器导入优化

parent 61e12da9
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgResumeInfoDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo; import com.yeejoin.amos.boot.module.jg.api.entity.JgResumeInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -15,7 +14,7 @@ import java.util.Set; ...@@ -15,7 +14,7 @@ import java.util.Set;
* @author system_generator * @author system_generator
* @date 2024-05-29 * @date 2024-05-29
*/ */
public interface JgResumeInfoMapper extends BaseMapper<JgResumeInfo> { public interface JgResumeInfoMapper extends CustomBaseMapper<JgResumeInfo> {
void deleteBatchByBusinessId(@Param("idList") Set<String> idList); void deleteBatchByBusinessId(@Param("idList") Set<String> idList);
......
...@@ -4176,7 +4176,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4176,7 +4176,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
SearchRequest request = new SearchRequest(IDX_BIZ_EQUIPMENT_INFO); SearchRequest request = new SearchRequest(IDX_BIZ_EQUIPMENT_INFO);
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder().size(10000) SearchSourceBuilder sourceBuilder = new SearchSourceBuilder().size(10000)
.fetchSource(new String[]{"FACTORY_NUM", "PRODUCE_UNIT_NAME"}, null); .fetchSource(new String[]{"FACTORY_NUM", "USE_UNIT_NAME"}, null);
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
boolQuery.must(QueryBuilders.termQuery("EQU_LIST_CODE", "2000")) boolQuery.must(QueryBuilders.termQuery("EQU_LIST_CODE", "2000"))
...@@ -4198,8 +4198,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4198,8 +4198,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
for (SearchHit hit : response.getHits().getHits()) { for (SearchHit hit : response.getHits().getHits()) {
Map<String, Object> src = hit.getSourceAsMap(); Map<String, Object> src = hit.getSourceAsMap();
String factoryNum = Objects.toString(src.get("FACTORY_NUM"), ""); String factoryNum = Objects.toString(src.get("FACTORY_NUM"), "");
String produceUnitName = Objects.toString(src.get("PRODUCE_UNIT_NAME"), ""); String useUnitName = Objects.toString(src.get("USE_UNIT_NAME"), "");
resultMap.put(factoryNum, produceUnitName); resultMap.put(factoryNum, useUnitName);
} }
return resultMap; return resultMap;
} }
...@@ -4563,17 +4563,35 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4563,17 +4563,35 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
.collect(Collectors.toList()) .collect(Collectors.toList())
); );
} }
batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息"); List<CompletableFuture<Void>> futures = new ArrayList<>();
batchInsert(idxBizJgUseInfoMapper, useInfoList, "使用信息"); futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgDesignInfoMapper, designInfoList, "设计信息"); batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息")
batchInsert(idxBizJgRegisterInfoMapper, registerInfoList, "注册信息"); ));
batchInsert(idxBizJgFactoryInfoMapper, factoryInfoList, "制造信息"); futures.add(CompletableFuture.runAsync(() ->
batchInsert(otherInfoMapper, otherInfoList, "其他信息"); batchInsert(idxBizJgUseInfoMapper, useInfoList, "使用信息")
batchInsert(idxBizJgTechParamsVesselMapper, paramsVesselList, "容器参数信息"); ));
batchInsert(idxBizJgInspectionDetectionInfoMapper, inspectionDetectionInfoList, "检验检测信息"); futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgDesignInfoMapper, designInfoList, "设计信息")
));
futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgRegisterInfoMapper, registerInfoList, "注册信息")
));
futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgFactoryInfoMapper, factoryInfoList, "制造信息")
));
futures.add(CompletableFuture.runAsync(() ->
batchInsert(otherInfoMapper, otherInfoList, "其他信息")
));
futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgTechParamsVesselMapper, paramsVesselList, "容器参数信息")
));
futures.add(CompletableFuture.runAsync(() ->
batchInsert(idxBizJgInspectionDetectionInfoMapper, inspectionDetectionInfoList, "检验检测信息")
));
if (!esEquipmentCategoryList.isEmpty()) { if (!esEquipmentCategoryList.isEmpty()) {
esEquipmentCategory.saveAll(esEquipmentCategoryList); futures.add(CompletableFuture.runAsync(() -> esEquipmentCategory.saveAll(esEquipmentCategoryList)));
} }
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
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));
return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size()); return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size());
} }
...@@ -4581,10 +4599,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4581,10 +4599,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
/** 通用批量插入方法 */ /** 通用批量插入方法 */
public <T> void batchInsert(CustomBaseMapper<T> mapper, List<T> list, String name) { public <T> void batchInsert(CustomBaseMapper<T> mapper, List<T> list, String name) {
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
mapper.insertBatchSomeColumn(list, 1000); mapper.insertBatchSomeColumn(list, 500);
log.info("{} 批量插入完成,数量:{}", name, list.size()); log.info("{} 批量插入完成,数量:{}", name, list.size());
} else {
log.info("{} 列表为空,无需插入", name);
} }
} }
......
...@@ -40,14 +40,14 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu ...@@ -40,14 +40,14 @@ public class JgResumeInfoServiceImpl extends BaseService<JgResumeInfoDto, JgResu
} }
public void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) { public void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) {
Collection<JgResumeInfo> jgResumeInfoCollection = jgResumeInfoDtoList.stream() List<JgResumeInfo> jgResumeInfoCollection = jgResumeInfoDtoList.stream()
.map(dto -> { .map(dto -> {
JgResumeInfo info = new JgResumeInfo(); JgResumeInfo info = new JgResumeInfo();
BeanUtils.copyProperties(dto, info); BeanUtils.copyProperties(dto, info);
return info; return info;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
this.saveBatch(jgResumeInfoCollection); this.baseMapper.insertBatchSomeColumn(jgResumeInfoCollection,500);
} }
/** /**
......
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