Commit 8eac96bd authored by suhuiguang's avatar suhuiguang

refact(综合搜索):数据同步调整

1.设备同步改成批量查询 2.检验巡检依赖
parent 81426848
......@@ -25,7 +25,7 @@ import java.util.List;
@Data
@Accessors(chain = true)
@Slf4j
@Document(indexName = "idx_biz_equipment_info", shards = 3, replicas = 2)
@Document(indexName = "idx_biz_equipment_info", shards = 3, replicas = 2, createIndex = false)
public class ESEquipmentInfo {
@Id
......
......@@ -15,7 +15,7 @@ import java.util.List;
* 企业
*/
@Data
@Document(indexName = "idx_biz_enterprise_info", shards = 3, replicas = 2)
@Document(indexName = "idx_biz_enterprise_info", shards = 3, replicas = 2, createIndex = false)
public class EsBaseEnterpriseInfo {
@Id
private String sequenceNbr;
......
package com.yeejoin.amos.boot.module.common.api.entity;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author LiuLin
* @date 2023年10月11日 09:31
*/
@Setter
@Getter
public final class EsEntity<T> {
private String id;
private T data;
public EsEntity() {
}
public EsEntity(String id, T data) {
this.data = data;
this.id = id;
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import java.util.List;
* 人员
*/
@Data
@Document(indexName = "idx_biz_user_info", shards = 3, replicas = 2)
@Document(indexName = "idx_biz_user_info", shards = 3, replicas = 2, createIndex = false)
public class EsUserInfo {
@Id
private String sequenceNbr;
......
......@@ -250,7 +250,7 @@ public class DataHandlerController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "初始化综合搜索数据-设备", notes = "初始化综合搜索数据-设备")
@PutMapping(value = "/equip/initStatistData2Es")
public ResponseModel<Integer> initEquipStatistData2Es() {
return ResponseHelper.buildResponse(dataHandlerService.initEquipStatistData2Es());
return ResponseHelper.buildResponse(dataHandlerService.initEquipStatistData2EsBatch());
}
......
package com.yeejoin.amos.boot.module.jg.biz.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import java.util.List;
......@@ -9,7 +10,7 @@ import java.util.List;
* @author system_generator
* @date 2023-08-17
*/
public interface IIdxBizJgInspectionDetectionInfoService {
public interface IIdxBizJgInspectionDetectionInfoService extends IService<IdxBizJgInspectionDetectionInfo> {
boolean saveOrUpdateData(IdxBizJgInspectionDetectionInfo inspectionDetectionInfo);
......
......@@ -42,7 +42,6 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ProblemHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore;
import com.yeejoin.amos.boot.module.ymt.api.dto.ProjectWaitRefreshDataQualityScore;
import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto;
......@@ -71,6 +70,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.toJSONString;
......@@ -106,7 +106,7 @@ public class DataHandlerServiceImpl {
private final JgInstallationNoticeEqMapper jgInstallationNoticeEqMapper;
private final DataDictionaryMapper dataDictionaryMapper;
private final IdxBizJgProjectInspectionMapper projectInspectionMapper;
private final IIdxBizJgInspectionDetectionInfoService iIdxBizJgInspectionDetectionInfoService;
private final IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
private final IdxBizJgProjectContraptionMapper idxBizJgProjectContraptionMapper;
private final JgInstallationNoticeMapper jgInstallationNoticeMapper;
private final DataHandlerMapper dataHandlerMapper;
......@@ -145,6 +145,8 @@ public class DataHandlerServiceImpl {
private final BaseEnterpriseUpdate baseEnterpriseUpdate;
private final EsBulkService esBulkService;
/**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
......@@ -826,7 +828,7 @@ public class DataHandlerServiceImpl {
);
if (!equipmentLists.isEmpty()) {
Object record = equipmentLists.get(0).get("record");
IdxBizJgInspectionDetectionInfo idxBizJgInspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(String.valueOf(record));
IdxBizJgInspectionDetectionInfo idxBizJgInspectionDetectionInfo = idxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(String.valueOf(record));
BeanUtil.copyProperties(idxBizJgInspectionDetectionInfo, inspectionDetectionInfo);
inspectionDetectionInfo.setRecord(null);
}
......@@ -1508,7 +1510,7 @@ public class DataHandlerServiceImpl {
}).collect(Collectors.toList());
}
public Integer initEquipStatistData2Es() {
public Integer initEquipStatistData2EsBatch() {
log.info("综合统计设备信息入库开始");
StopWatch watch = new StopWatch();
watch.start();
......@@ -1516,24 +1518,41 @@ public class DataHandlerServiceImpl {
Integer nextVersion = maxVersion + 1;
List<String> refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionAll(nextVersion);
while (!refreshRecords.isEmpty()) {
StopWatch watch0 = new StopWatch();
watch0.start();
List<Map<String, Object>> details = useInfoService.getBaseMapper().queryDetailBatch(refreshRecords);
Map<String, Map<String, Object>> recordDetailMap = details.stream().collect(Collectors.toMap(e -> (String) e.get("SEQUENCE_NBR"), Function.identity(), (k1, k2) -> k2));
// 设备最新的维保信息-维度:设备
List<IdxBizJgMaintenanceRecordInfo> lastMaintenanceRecordInfos = maintenanceRecordInfoService.getBaseMapper().selectLastedMainInfoBatch(refreshRecords);
Map<String, List<IdxBizJgMaintenanceRecordInfo>> recordLastMaintMap = lastMaintenanceRecordInfos.stream().collect(Collectors.groupingBy(IdxBizJgMaintenanceRecordInfo::getRecord));
// 设备、各检验类型下最新的检验信息-维度:设备、检验类型
List<IdxBizJgInspectionDetectionInfo> lastedInspectInfosGroupByInspectType = idxBizJgInspectionDetectionInfoService.getBaseMapper().selectLastedGroupByInspectTypeBatch(refreshRecords);
Map<String, List<IdxBizJgInspectionDetectionInfo>> recordInspectInfosGroupByInspectTypeMap = lastedInspectInfosGroupByInspectType.stream().collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord));
// 设备最新的检验信息-维度:设备
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e->e.getInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getInspectDate))));
List<ESEquipmentInfo> esEquipmentInfos = refreshRecords.parallelStream().map(record -> {
ESEquipmentInfo esEquipmentInfo = null;
try {
esEquipmentInfo = new ESEquipmentInfo();
Map<String,Object> detail = useInfoService.getBaseMapper().queryDetail(record);
Map<String, Object> detail = recordDetailMap.get(record);
StatisticsDataUpdateService.formatUseDate(detail);
BeanUtil.copyProperties(detail, esEquipmentInfo, true);
Optional<ESEquipmentCategoryDto> esOptional = esEquipmentCategory.findById(record);
if(esOptional.isPresent()){
if (esOptional.isPresent()) {
ESEquipmentCategoryDto dto = esOptional.get();
esEquipmentInfo.setUSC_UNIT_CREDIT_CODE(dto.getUSC_UNIT_CREDIT_CODE());
esEquipmentInfo.setUSC_UNIT_NAME(dto.getUSC_UNIT_NAME());
esEquipmentInfo.setIS_DO_BUSINESS(dto.getIS_DO_BUSINESS());
}
// 检验信息按照不同检验类型,存最新的一条
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfos = iIdxBizJgInspectionDetectionInfoService.queryLastedGroupByInspectType(record);
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(record);
IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo = maintenanceRecordInfoService.queryNewestDetailByRecord(record);
// 最新检验信息-维度record
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = Optional.ofNullable(recordLastInspectionMap.get(record)).flatMap(i->i).orElse(new IdxBizJgInspectionDetectionInfo());
// 最新维保信息-维度record
IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo = Optional.ofNullable(recordLastMaintMap.get(record)).filter(l -> !l.isEmpty()).map(list -> list.get(0)).orElse(new IdxBizJgMaintenanceRecordInfo());
// 最新检验信息-维度record、检验类型,存最新的一条
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfos = recordInspectInfosGroupByInspectTypeMap.getOrDefault(record, new ArrayList<>());
StatisticsDataUpdateService.formatInspectDate(esEquipmentInfo, inspectionDetectionInfo, record);
esEquipmentInfo.setIssueDate(getIssueDate(esEquipmentInfo.getUSE_ORG_CODE()));
esEquipmentInfo.setMAINTAIN_UNIT(lastMaintenanceRecordInfo.getMeUnitCreditCode());
......@@ -1547,12 +1566,26 @@ public class DataHandlerServiceImpl {
}
return esEquipmentInfo;
}).collect(Collectors.toList());
esEquipmentInfos = esEquipmentInfos.stream().filter(e-> StringUtils.isNotEmpty(e.getSEQUENCE_NBR())).collect(Collectors.toList());
if(!esEquipmentInfos.isEmpty()){
watch0.stop();
log.warn("多线程处理查询设备详情耗时:{}", watch0.getTotalTimeSeconds());
esEquipmentInfos = esEquipmentInfos.stream().filter(e -> StringUtils.isNotEmpty(e.getSEQUENCE_NBR())).collect(Collectors.toList());
if (!esEquipmentInfos.isEmpty()) {
StopWatch watch1 = new StopWatch();
watch1.start();
esEquipmentDao.saveAll(esEquipmentInfos);
watch1.stop();
log.warn("es批量入库条数:{},耗时:{}s", esEquipmentInfos.size(), watch1.getTotalTimeSeconds());
}
StopWatch watch2 = new StopWatch();
watch2.start();
useInfoService.getBaseMapper().updateVersionBatch(refreshRecords, nextVersion);
watch2.stop();
log.warn("批量更新条数:{} 使用信息版本号,耗时:{}s", esEquipmentInfos.size(), watch2.getTotalTimeSeconds());
StopWatch watch3 = new StopWatch();
watch3.start();
refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionAll(nextVersion);
watch3.stop();
log.warn("查询最多版本号耗时:{}s", watch3.getTotalTimeSeconds());
}
watch.stop();
log.info("综合统计设备信息入库结束,耗时:{}秒", watch.getTotalTimeSeconds());
......@@ -1560,7 +1593,6 @@ public class DataHandlerServiceImpl {
}
private List<ESEquipmentInfo.TechParam> buildTechParamByEquList(String record, String equListCode) {
return StringUtils.isNotEmpty(equListCode) ? statisticsDataUpdateService.getTechParams(equListCode, record) : new ArrayList<>();
}
......@@ -1569,7 +1601,7 @@ public class DataHandlerServiceImpl {
List<IdxBizJgRegisterInfo> registerInfoList = registerInfoMapper.selectList(new QueryWrapper<IdxBizJgRegisterInfo>().lambda().isNotNull(IdxBizJgRegisterInfo::getCarNumber));
Map<String, Map<String, Object>> resultMap = new HashMap<>();
if (!CollectionUtils.isEmpty(registerInfoList)) {
registerInfoList.parallelStream().forEach(v->{
registerInfoList.parallelStream().forEach(v -> {
Map<String, Object> param = new HashMap<>();
param.put("CAR_NUMBER", v.getCarNumber());
resultMap.put(v.getRecord(), param);
......@@ -1579,17 +1611,17 @@ public class DataHandlerServiceImpl {
return registerInfoList.size();
}
private LocalDate getIssueDate(String useRegistrationCode){
if(StringUtils.isEmpty(useRegistrationCode)){
return null;
private LocalDate getIssueDate(String useRegistrationCode) {
if (StringUtils.isEmpty(useRegistrationCode)) {
return null;
}
LambdaQueryWrapper<JgUseRegistrationManage> useRegistrationManageWrapper = new LambdaQueryWrapper<>();
useRegistrationManageWrapper.eq(JgUseRegistrationManage::getUseRegistrationCode, useRegistrationCode)
.isNotNull(JgUseRegistrationManage::getUseRegistrationCode)
.eq(JgUseRegistrationManage::getCertificateStatus, "已登记")
.eq(BaseEntity::getIsDelete, false).select(BaseEntity::getSequenceNbr,JgUseRegistrationManage::getRegDate);
JgUseRegistrationManage manage = jgUseRegistrationManageServiceImpl.getBaseMapper().selectOne(useRegistrationManageWrapper);
return Optional.ofNullable(manage).map(JgUseRegistrationManage::getRegDate).map(d-> d.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()).orElse(null);
.eq(BaseEntity::getIsDelete, false).select(BaseEntity::getSequenceNbr, JgUseRegistrationManage::getRegDate);
JgUseRegistrationManage manage = jgUseRegistrationManageServiceImpl.getBaseMapper().selectOne(useRegistrationManageWrapper);
return Optional.ofNullable(manage).map(JgUseRegistrationManage::getRegDate).map(d -> d.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()).orElse(null);
}
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.common.api.entity.EsEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@RequiredArgsConstructor
@Slf4j
public class EsBulkService {
private final RestHighLevelClient restHighLevelClient;
public <T> void bulkUpsert(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> {
request.add(new UpdateRequest(index, item.getId())
.doc(JSON.toJSONString(item.getData()), XContentType.JSON)
.upsert(JSON.toJSONString(item.getData()), XContentType.JSON));
});
try {
// request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
} catch (Exception e) {
log.error("批量写入数据失败:{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
}
......@@ -148,6 +148,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
@Autowired
RestHighLevelClient restHighLevelClient;
@Autowired
@Lazy
private JyjcInspectionResultServiceImpl inspectionResultService;
@Autowired
private JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
......
......@@ -53,6 +53,7 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -135,6 +136,7 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
private ESEquipmentCategory esEquipmentCategory;
@Autowired
@Lazy
JyjcInspectionApplicationServiceImpl inspectionApplicationService;
@Autowired
......
package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -15,4 +15,7 @@ import java.util.List;
public interface IdxBizJgInspectionDetectionInfoMapper extends BaseMapper<IdxBizJgInspectionDetectionInfo> {
List<IdxBizJgInspectionDetectionInfo> selectLastedGroupByInspectType(@Param("record") String record);
List<IdxBizJgInspectionDetectionInfo> selectLastedGroupByInspectTypeBatch(@Param("records") List<String> records);
}
......@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 安全追溯-维保备案信息表 Mapper 接口
......@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface IdxBizJgMaintenanceRecordInfoMapper extends BaseMapper<IdxBizJgMaintenanceRecordInfo> {
List<IdxBizJgMaintenanceRecordInfo> selectLastedMainInfoBatch(@Param("records") List<String> records);
}
......@@ -31,4 +31,6 @@ public interface IdxBizJgUseInfoMapper extends BaseMapper<IdxBizJgUseInfo> {
void updateVersionBatch(@Param("records") List<String> records, @Param("version") int version);
Map<String,Object> queryDetail(@Param("record") String record);
List<Map<String,Object>> queryDetailBatch(@Param("records") List<String> records);
}
......@@ -12,4 +12,17 @@
"RECORD" = #{record}
ORDER BY "INSPECT_TYPE", "INSPECT_DATE" DESC, "SEQUENCE_NBR" DESC
</select>
<select id="selectLastedGroupByInspectTypeBatch"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo">
SELECT
DISTINCT ON ("RECORD", "INSPECT_TYPE") *
FROM
idx_biz_jg_inspection_detection_info
WHERE
"RECORD" in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
ORDER BY "RECORD", "INSPECT_TYPE", "INSPECT_DATE" DESC, "SEQUENCE_NBR" DESC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgMaintenanceRecordInfoMapper">
<select id="selectLastedMainInfoBatch"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgMaintenanceRecordInfo">
SELECT
DISTINCT ON ("RECORD") *
FROM
idx_biz_jg_maintenance_record_info
WHERE
"RECORD" IN
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
ORDER BY "RECORD", "REC_DATE" DESC
</select>
</mapper>
......@@ -65,68 +65,7 @@
FROM "idx_biz_jg_use_info"
</select>
<select id="queryDetail" resultType="java.util.Map">
SELECT
ibjui."RECORD" AS "SEQUENCE_NBR",
ibjui."PROJECT_CONTRAPTION",
ibjui."PROJECT_CONTRAPTION_ID",
ibjsi."ORG_BRANCH_NAME",
ibjsi."ORG_BRANCH_CODE",
ibjui."REC_DATE",
ibjui."USE_UNIT_NAME",
ibjui."USE_UNIT_CREDIT_CODE",
ibjui."USC_UNIT_NAME",
ibjui."USC_UNIT_CREDIT_CODE",
ibjri."EQU_LIST" AS "EQU_LIST_CODE",
ibjri."EQU_DEFINE" AS "EQU_DEFINE_CODE",
ibjri."PRODUCT_NAME",
ibjri."BRAND_NAME",
ibjri."EQU_TYPE",
ibjri."EQU_CATEGORY" AS "EQU_CATEGORY_CODE",
tec2.NAME AS "EQU_DEFINE",
tec1.NAME AS "EQU_LIST",
tec.NAME AS "EQU_CATEGORY",
ibjri."USE_ORG_CODE",
ibjui."USE_INNER_CODE",
ibjui."DATA_SOURCE",
ibjoi."CODE96333",
ibjri."EQU_CODE",
ibjoi."SUPERVISORY_CODE",
ibjri."WHETHER_VEHICLE_CYLINDER",
ibjri."WHETHER_SKID_MOUNTED_PRESSURE_VESSEL",
ibjri."CYLINDER_CATEGORY",
ibjri."WHETHER_SPHERICAL_TANK",
ibjri."CAR_NUMBER",
ibjri."EQU_PRICE",
concat_ws ( '/', ibjui."PROVINCE_NAME", ibjui."CITY_NAME", ibjui."COUNTY_NAME", ibjui."STREET_NAME" ) AS "USE_PLACE",
concat_ws ( '#', ibjui."PROVINCE", ibjui."CITY", ibjui."COUNTY", ibjui."FACTORY_USE_SITE_STREET" ) AS "USE_PLACE_CODE",
ibjui."ADDRESS",
ibjui."EQU_STATE",
ibjui."IS_INTO_MANAGEMENT",
ibjoi."CLAIM_STATUS" AS "STATUS",
ibjfi."FACTORY_NUM",
ibjfi."PRODUCE_UNIT_NAME",
ibjfi."PRODUCE_UNIT_CREDIT_CODE",
ibjfi."PRODUCE_DATE",
ibjui."CREATE_DATE" ,
ibjui."SAFETY_MANAGER" ,
ibjui."PHONE",
ibjui."USE_DATE",
ibjui."USE_PLACE" as USE_SITE_CODE,
ibjui."DATA_QUALITY_SCORE",
ibjoi."INFORMATION_SITUATION",
di."DESIGN_UNIT_CREDIT_CODE",
di."DESIGN_UNIT_NAME",
di."DESIGN_DATE"
FROM
amos_tzs_biz.idx_biz_jg_use_info ibjui
LEFT JOIN amos_tzs_biz.idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_factory_info ibjfi ON ibjui."RECORD" = ibjfi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_design_info di ON di."RECORD" = ibjui."RECORD"
LEFT JOIN amos_tzs_biz.tz_equipment_category tec ON ibjri."EQU_CATEGORY" = tec.code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec1 ON ibjri."EQU_LIST" = tec1.code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec2 ON ibjri."EQU_DEFINE" = tec2.code
<include refid="equip-detail-es"/>
WHERE
ibjui."RECORD" = #{record}
</select>
......@@ -135,4 +74,79 @@
UPDATE idx_biz_jg_use_info SET "VERSION"=#{version} WHERE record = #{record}
</foreach>
</update>
<sql id="equip-detail-es">
SELECT
ibjui."RECORD" AS "SEQUENCE_NBR",
ibjui."PROJECT_CONTRAPTION",
ibjui."PROJECT_CONTRAPTION_ID",
ibjsi."ORG_BRANCH_NAME",
ibjsi."ORG_BRANCH_CODE",
ibjui."REC_DATE",
ibjui."USE_UNIT_NAME",
ibjui."USE_UNIT_CREDIT_CODE",
ibjui."USC_UNIT_NAME",
ibjui."USC_UNIT_CREDIT_CODE",
ibjri."EQU_LIST" AS "EQU_LIST_CODE",
ibjri."EQU_DEFINE" AS "EQU_DEFINE_CODE",
ibjri."PRODUCT_NAME",
ibjri."BRAND_NAME",
ibjri."EQU_TYPE",
ibjri."EQU_CATEGORY" AS "EQU_CATEGORY_CODE",
tec2.NAME AS "EQU_DEFINE",
tec1.NAME AS "EQU_LIST",
tec.NAME AS "EQU_CATEGORY",
ibjri."USE_ORG_CODE",
ibjui."USE_INNER_CODE",
ibjui."DATA_SOURCE",
ibjoi."CODE96333",
ibjri."EQU_CODE",
ibjoi."SUPERVISORY_CODE",
ibjri."WHETHER_VEHICLE_CYLINDER",
ibjri."WHETHER_SKID_MOUNTED_PRESSURE_VESSEL",
ibjri."CYLINDER_CATEGORY",
ibjri."WHETHER_SPHERICAL_TANK",
ibjri."CAR_NUMBER",
ibjri."EQU_PRICE",
concat_ws ( '/', ibjui."PROVINCE_NAME", ibjui."CITY_NAME", ibjui."COUNTY_NAME", ibjui."STREET_NAME" ) AS "USE_PLACE",
concat_ws ( '#', ibjui."PROVINCE", ibjui."CITY", ibjui."COUNTY", ibjui."FACTORY_USE_SITE_STREET" ) AS "USE_PLACE_CODE",
ibjui."ADDRESS",
ibjui."EQU_STATE",
ibjui."IS_INTO_MANAGEMENT",
ibjoi."CLAIM_STATUS" AS "STATUS",
ibjfi."FACTORY_NUM",
ibjfi."PRODUCE_UNIT_NAME",
ibjfi."PRODUCE_UNIT_CREDIT_CODE",
ibjfi."PRODUCE_DATE",
ibjui."CREATE_DATE" ,
ibjui."SAFETY_MANAGER" ,
ibjui."PHONE",
ibjui."USE_DATE",
ibjui."USE_PLACE" as USE_SITE_CODE,
ibjui."DATA_QUALITY_SCORE",
ibjoi."INFORMATION_SITUATION",
di."DESIGN_UNIT_CREDIT_CODE",
di."DESIGN_UNIT_NAME",
di."DESIGN_DATE"
FROM
idx_biz_jg_use_info ibjui
LEFT JOIN amos_tzs_biz.idx_biz_jg_supervision_info ibjsi ON ibjui."RECORD" = ibjsi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_factory_info ibjfi ON ibjui."RECORD" = ibjfi."RECORD"
LEFT JOIN amos_tzs_biz.idx_biz_jg_design_info di ON di."RECORD" = ibjui."RECORD"
LEFT JOIN amos_tzs_biz.tz_equipment_category tec ON ibjri."EQU_CATEGORY" = tec.code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec1 ON ibjri."EQU_LIST" = tec1.code
LEFT JOIN amos_tzs_biz.tz_equipment_category tec2 ON ibjri."EQU_DEFINE" = tec2.code
</sql>
<select id="queryDetailBatch" resultType="java.util.Map">
<include refid="equip-detail-es"/>
WHERE
ibjui."RECORD" in
<foreach item="record" collection="records" open="(" separator="," close=")">
#{record}
</foreach>
</select>
</mapper>
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