Commit 40ca35e7 authored by 韩桐桐's avatar 韩桐桐

feat(jg):刷入工程装置id到es的idx_biz_view_jg_all索引

parent f6d1f7ff
...@@ -41,4 +41,12 @@ public class DataHandlerController extends BaseController { ...@@ -41,4 +41,12 @@ public class DataHandlerController extends BaseController {
return ResponseHelper.buildResponse(dataHandlerService.writeData2ProjectContraption()); return ResponseHelper.buildResponse(dataHandlerService.writeData2ProjectContraption());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "刷入工程装置id到es的idx_biz_view_jg_all索引", notes = "刷入工程装置id到es的idx_biz_view_jg_all索引")
@GetMapping(value = "/jgAllIndex/writeProjectContraptionId")
public ResponseModel<String> writeProjectContraptionId() {
return ResponseHelper.buildResponse(dataHandlerService.writeProjectContraptionId());
}
} }
...@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
...@@ -14,10 +17,12 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,10 +17,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -69,6 +74,9 @@ public class DataHandlerServiceImpl { ...@@ -69,6 +74,9 @@ public class DataHandlerServiceImpl {
@Resource @Resource
private IdxBizJgFactoryInfoServiceImpl factoryInfoService; private IdxBizJgFactoryInfoServiceImpl factoryInfoService;
@Resource
private ESEquipmentCategory esEquipmentCategory;
/** /**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式 * 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
...@@ -296,4 +304,31 @@ public class DataHandlerServiceImpl { ...@@ -296,4 +304,31 @@ public class DataHandlerServiceImpl {
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
/**
* 刷入工程装置id到es的idx_biz_view_jg_all索引
*
* @return result
*/
public String writeProjectContraptionId() {
AtomicReference<Long> size = new AtomicReference<>(0L);
StopWatch stopWatch = new StopWatch("writeProjectContraptionId");
stopWatch.start();
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery()
.select(IdxBizJgUseInfo::getRecord, IdxBizJgUseInfo::getProjectContraptionId)
.isNotNull(IdxBizJgUseInfo::getProjectContraptionId)
.list();
for (IdxBizJgUseInfo useInfo : useInfos) {
Optional<ESEquipmentCategoryDto> equInfosWithEs = esEquipmentCategory.findById(useInfo.getRecord());
equInfosWithEs.ifPresent(equInfoEs -> {
if (PipelineEnum.INDUSTRIAL_PIPELINE.getCode().equals(equInfoEs.getEQU_CATEGORY_CODE())) {
equInfoEs.setProjectContraptionId(useInfo.getProjectContraptionId());
esEquipmentCategory.save(equInfoEs);
size.getAndSet(size.get() + 1);
}
});
}
stopWatch.stop();
return String.format("接口调用成功,更新数据:%s条,耗时:%s s", size.get(), stopWatch.getTotalTimeSeconds());
}
} }
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