Commit d2af7815 authored by suhuiguang's avatar suhuiguang

feat(综合搜索):实体类创建

1.人员、企业、设备 2.技术参数
parent 0c1ed10f
...@@ -340,6 +340,12 @@ public class ESEquipmentInfo { ...@@ -340,6 +340,12 @@ public class ESEquipmentInfo {
@Field(type = FieldType.Nested) @Field(type = FieldType.Nested)
private List<Maintenance> maintenances; private List<Maintenance> maintenances;
/**
* 技术参数
*/
@Field(type = FieldType.Nested)
private List<TechParam> techParams;
@Data @Data
public static class TechParam { public static class TechParam {
...@@ -361,13 +367,13 @@ public class ESEquipmentInfo { ...@@ -361,13 +367,13 @@ public class ESEquipmentInfo {
@Field(type = FieldType.Boolean) @Field(type = FieldType.Boolean)
private Boolean boolValue; private Boolean boolValue;
@Field(type = FieldType.Date) @Field(type = FieldType.Date, format = DateFormat.date)
private Date dateValue; private Date dateValue;
public TechParam(TechParamItem meta, Object rawValue) { public TechParam(TechParamItem paramItem, Object rawValue) {
this.paramKey = meta.getParamKey(); this.paramKey = paramItem.getParamKey();
this.paramLabel = meta.getParamLabel(); this.paramLabel = paramItem.getParamLabel();
setValueByType(meta.getParamType(), rawValue, meta.getMaxPrecision()); setValueByType(paramItem.getParamType(), rawValue, paramItem.getMaxPrecision());
} }
......
...@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.*; ...@@ -40,6 +40,7 @@ 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.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ProblemHandleStrategy; import com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ProblemHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.statistics.service.StatisticsDataUpdateService;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipWaitRefreshDataQualityScore; 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.ProjectWaitRefreshDataQualityScore;
import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto; import com.yeejoin.amos.boot.module.ymt.api.dto.RefreshDataDto;
...@@ -136,6 +137,8 @@ public class DataHandlerServiceImpl { ...@@ -136,6 +137,8 @@ public class DataHandlerServiceImpl {
private static final String ROOT_ORG_CODE = "50"; private static final String ROOT_ORG_CODE = "50";
private final IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoServiceImpl; private final IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoServiceImpl;
private final StatisticsDataUpdateService statisticsDataUpdateService;
/** /**
* 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式 * 安装告知压力管道历史数据修复-详情中的设备列表修改为汇总表格式
* *
...@@ -1420,7 +1423,9 @@ public class DataHandlerServiceImpl { ...@@ -1420,7 +1423,9 @@ public class DataHandlerServiceImpl {
EsBaseEnterpriseInfo esBaseEnterpriseInfo = new EsBaseEnterpriseInfo(); EsBaseEnterpriseInfo esBaseEnterpriseInfo = new EsBaseEnterpriseInfo();
BeanUtil.copyProperties(enterpriseInfo, esBaseEnterpriseInfo); BeanUtil.copyProperties(enterpriseInfo, esBaseEnterpriseInfo);
esBaseEnterpriseInfo.setSequenceNbr(enterpriseInfo.getSequenceNbr() + ""); esBaseEnterpriseInfo.setSequenceNbr(enterpriseInfo.getSequenceNbr() + "");
List<TzBaseUnitLicence> unitLicences = licenceMapper.selectList(new LambdaQueryWrapper<TzBaseUnitLicence>().eq(TzBaseUnitLicence::getUnitCode, enterpriseInfo.getUseUnitCode())); List<TzBaseUnitLicence> unitLicences = licenceMapper.selectList(new LambdaQueryWrapper<TzBaseUnitLicence>()
.eq(TzBaseUnitLicence::getUnitCode, enterpriseInfo.getUseUnitCode())
.eq(TzBaseUnitLicence::getIsDelete, false));
List<EsBaseEnterpriseInfo.License> licenses = unitLicences.stream().map(lis -> { List<EsBaseEnterpriseInfo.License> licenses = unitLicences.stream().map(lis -> {
EsBaseEnterpriseInfo.License esLicense = new EsBaseEnterpriseInfo.License(); EsBaseEnterpriseInfo.License esLicense = new EsBaseEnterpriseInfo.License();
BeanUtil.copyProperties(lis, esLicense); BeanUtil.copyProperties(lis, esLicense);
...@@ -1449,7 +1454,6 @@ public class DataHandlerServiceImpl { ...@@ -1449,7 +1454,6 @@ public class DataHandlerServiceImpl {
Map<String, TzBaseEnterpriseInfo> useCodeEnterpriseMap = units.stream().collect(Collectors.toMap(TzBaseEnterpriseInfo::getUseCode, Function.identity(),(k1,k2)->k2)); Map<String, TzBaseEnterpriseInfo> useCodeEnterpriseMap = units.stream().collect(Collectors.toMap(TzBaseEnterpriseInfo::getUseCode, Function.identity(),(k1,k2)->k2));
LambdaQueryWrapper<TzsUserInfo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TzsUserInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false) wrapper.eq(BaseEntity::getIsDelete, false)
.and(w->w.ne(TzsUserInfo::getTransferOut, "1").or().isNull(TzsUserInfo::getTransferOut))
.orderByDesc(BaseEntity::getSequenceNbr); .orderByDesc(BaseEntity::getSequenceNbr);
Integer userNum = userInfoMapper.selectCount(wrapper); Integer userNum = userInfoMapper.selectCount(wrapper);
int pageSize = 1000; int pageSize = 1000;
...@@ -1500,22 +1504,30 @@ public class DataHandlerServiceImpl { ...@@ -1500,22 +1504,30 @@ public class DataHandlerServiceImpl {
.eq(IdxBizJgFactoryInfo::getRecord, record) .eq(IdxBizJgFactoryInfo::getRecord, record)
.select(IdxBizJgFactoryInfo::getRecord, IdxBizJgFactoryInfo::getProduceUnitCreditCode)); .select(IdxBizJgFactoryInfo::getRecord, IdxBizJgFactoryInfo::getProduceUnitCreditCode));
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(record); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(record);
IdxBizJgMaintenanceRecordInfo lastMaintenanceRecordInfo = maintenanceRecordInfoService.queryNewestDetailByRecord(record);
esEquipmentInfo.setINSPECT_DATE(inspectionDetectionInfo != null ? inspectionDetectionInfo.getInspectDate() : null); esEquipmentInfo.setINSPECT_DATE(inspectionDetectionInfo != null ? inspectionDetectionInfo.getInspectDate() : null);
esEquipmentInfo.setNEXT_INSPECT_DATE(inspectionDetectionInfo != null ? inspectionDetectionInfo.getNextInspectDate() : null); esEquipmentInfo.setNEXT_INSPECT_DATE(inspectionDetectionInfo != null ? inspectionDetectionInfo.getNextInspectDate() : null);
esEquipmentInfo.setDesignUnitCreditCode(designInfo.getDesignUnitCreditCode()); esEquipmentInfo.setDesignUnitCreditCode(designInfo.getDesignUnitCreditCode());
esEquipmentInfo.setMAINTAIN_UNIT(lastMaintenanceRecordInfo.getMeUnitCreditCode());
esEquipmentInfo.setMAINTAIN_UNIT_NAME(lastMaintenanceRecordInfo.getMeUnitName());
esEquipmentInfo.setDesignUnitName(designInfo.getDesignUnitName()); esEquipmentInfo.setDesignUnitName(designInfo.getDesignUnitName());
esEquipmentInfo.setProduceUnitCreditCode(factoryInfo.getProduceUnitCreditCode()); esEquipmentInfo.setProduceUnitCreditCode(factoryInfo.getProduceUnitCreditCode());
esEquipmentInfo.setInspections(Collections.singletonList(BeanUtil.copyProperties(inspectionDetectionInfo, ESEquipmentInfo.Inspection.class))); esEquipmentInfo.setInspections(Collections.singletonList(BeanUtil.copyProperties(inspectionDetectionInfo, ESEquipmentInfo.Inspection.class)));
esEquipmentInfo.setMaintenances(Collections.singletonList(BeanUtil.copyProperties(maintenanceRecordInfoService.queryNewestDetailByRecord(record), ESEquipmentInfo.Maintenance.class))); esEquipmentInfo.setMaintenances(Collections.singletonList(BeanUtil.copyProperties(lastMaintenanceRecordInfo, ESEquipmentInfo.Maintenance.class)));
esEquipmentInfo.setTechParams(this.buildTechParamByEquList(record, categoryEs.getEQU_LIST_CODE()));
}); });
return esEquipmentInfo; return esEquipmentInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
useInfoService.getBaseMapper().updateVersionBatch(refreshRecords, maxVersion + 1);
esEquipmentDao.saveAll(esEquipmentInfos); esEquipmentDao.saveAll(esEquipmentInfos);
useInfoService.getBaseMapper().updateVersionBatch(refreshRecords, maxVersion + 1);
refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionAll(maxVersion); refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionAll(maxVersion);
} }
watch.stop(); watch.stop();
log.info("综合统计设备信息入库结束,耗时:{}秒", watch.getTotalTimeSeconds()); log.info("综合统计设备信息入库结束,耗时:{}秒", watch.getTotalTimeSeconds());
return refreshRecords.size(); return refreshRecords.size();
} }
private List<ESEquipmentInfo.TechParam> buildTechParamByEquList(String record, String equListCode) {
return statisticsDataUpdateService.getTechParams(equListCode, record);
}
} }
package com.yeejoin.amos.boot.module.jg.biz.statistics.service;
import cn.hutool.core.bean.BeanUtil;
import com.yeejoin.amos.boot.module.common.api.dto.TechParamItem;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil;
import com.yeejoin.amos.boot.module.jg.biz.edit.backup.TechParamsBackupService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
@RequiredArgsConstructor
public class StatisticsDataUpdateService {
private final TechParamsBackupService techParamsBackupService;
public List<ESEquipmentInfo.TechParam> getTechParams(String equList, String record) {
Object params = techParamsBackupService.getTechParams(equList, record);
Map<String, Object> paramsMap = BeanUtil.beanToMap(params);
List<TechParamItem> techParamItems = TechParamUtil.getParamMetaList(equList);
List<ESEquipmentInfo.TechParam> techParams = new ArrayList<>();
techParamItems.forEach(techParamItem -> {
ESEquipmentInfo.TechParam techParam = new ESEquipmentInfo.TechParam(techParamItem, paramsMap.get(techParamItem.getParamKey()));
techParams.add(techParam);
});
return techParams;
}
}
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