Commit 727e0380 authored by suhuiguang's avatar suhuiguang

fix(大编辑) :es顺序

1.写es移动到最后执行
parent d24de51a
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.edit;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback;
import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData;
......@@ -34,6 +35,7 @@ public class BizDataChangeServiceImpl {
* @param selectedOrgInfo 登录人信息
*/
@Transactional(rollbackFor = Exception.class)
@EnableEsRollback
public void save(String bizId,
String applyNo,
String bizType,
......
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......@@ -16,16 +17,16 @@ import java.util.stream.Collectors;
@Slf4j
public class EsUpdateService {
private final List<EsUpdateStrategy<?>> strategies;
private final List<EsBuildStrategy<?>> strategies;
// 类型→策略的缓存Map
private Map<Class<?>, EsUpdateStrategy<?>> strategyMap;
private Map<Class<?>, EsBuildStrategy<?>> strategyMap;
@PostConstruct
public void init() {
// 初始化策略映射
strategyMap = strategies.stream()
.collect(Collectors.toMap(
EsUpdateStrategy::getSupportType,
EsBuildStrategy::getSupportType,
strategy -> strategy
));
}
......@@ -33,22 +34,19 @@ public class EsUpdateService {
/**
* 统一入口方法
*/
public void updateEsData(String record, IBaseChangeData data) {
public void buildEsData(ESEquipmentCategoryDto esEquipmentCategoryDto, IBaseChangeData data) {
if (data == null) return;
EsUpdateStrategy<?> strategy = strategyMap.get(data.getClass());
EsBuildStrategy<?> strategy = strategyMap.get(data.getClass());
if (strategy != null) {
executeStrategy(record, data, strategy);
executeStrategy(esEquipmentCategoryDto, data, strategy);
} else {
log.warn("No strategy found for type: {}", data.getClass());
}
}
public void updateEsDataBatch(String record, List<? extends IBaseChangeData> dataList) {
dataList.forEach(data -> updateEsData(record, data));
}
@SuppressWarnings("unchecked")
private <T extends IBaseChangeData> void executeStrategy(String record, T data, EsUpdateStrategy<?> strategy) {
((EsUpdateStrategy<T>) strategy).updateEsData(record, data);
private <T extends IBaseChangeData> void executeStrategy(ESEquipmentCategoryDto esEquipmentCategoryDto, T data, EsBuildStrategy<?> strategy) {
((EsBuildStrategy<T>) strategy).buildEsData(esEquipmentCategoryDto, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgDesignInfo;
import lombok.RequiredArgsConstructor;
......@@ -10,7 +11,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
@Slf4j
public class DesignEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgDesignInfo> {
public class DesignEsBuildStrategy implements EsBuildStrategy<IdxBizJgDesignInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
......@@ -20,7 +21,7 @@ public class DesignEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgDesignIn
}
@Override
public void updateEsData(String record, IdxBizJgDesignInfo data) {
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgDesignInfo data) {
log.warn("do no thing");
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgFactoryInfo;
import lombok.RequiredArgsConstructor;
......@@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class FactoryEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgFactoryInfo> {
public class FactoryEsBuildStrategy implements EsBuildStrategy<IdxBizJgFactoryInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
@Override
......@@ -17,7 +18,7 @@ public class FactoryEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgFactory
}
@Override
public void updateEsData(String record, IdxBizJgFactoryInfo data) {
equipChangeDataUpdateServiceImpl.updateFactoryEsData(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgFactoryInfo data) {
equipChangeDataUpdateServiceImpl.buildFactoryEsData(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import lombok.RequiredArgsConstructor;
......@@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class InspectionEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgInspectionDetectionInfo> {
public class InspectionEsBuildStrategy implements EsBuildStrategy<IdxBizJgInspectionDetectionInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
@Override
......@@ -17,7 +18,7 @@ public class InspectionEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgInsp
}
@Override
public void updateEsData(String record, IdxBizJgInspectionDetectionInfo data) {
equipChangeDataUpdateServiceImpl.updateInspectInfoEs(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgInspectionDetectionInfo data) {
equipChangeDataUpdateServiceImpl.buildInspectInfoEs(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class OtherInfoEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgOtherInfo> {
public class OtherInfoEsBuildStrategy implements EsBuildStrategy<IdxBizJgOtherInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
......@@ -19,7 +19,7 @@ public class OtherInfoEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgOther
}
@Override
public void updateEsData(String record, IdxBizJgOtherInfo data) {
equipChangeDataUpdateServiceImpl.updateOtherInfoEsData(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgOtherInfo data) {
equipChangeDataUpdateServiceImpl.buildOtherInfoEsData(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import lombok.RequiredArgsConstructor;
......@@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class RegisterEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgRegisterInfo> {
public class RegisterEsBuildStrategy implements EsBuildStrategy<IdxBizJgRegisterInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
......@@ -18,7 +19,7 @@ public class RegisterEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgRegist
}
@Override
public void updateEsData(String record, IdxBizJgRegisterInfo data) {
equipChangeDataUpdateServiceImpl.updateRegisterEsData(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgRegisterInfo data) {
equipChangeDataUpdateServiceImpl.buildRegisterEsData(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import lombok.RequiredArgsConstructor;
......@@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class SupervisionEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgSupervisionInfo> {
public class SupervisionEsBuildStrategy implements EsBuildStrategy<IdxBizJgSupervisionInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
......@@ -18,7 +19,7 @@ public class SupervisionEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgSup
}
@Override
public void updateEsData(String record, IdxBizJgSupervisionInfo data) {
equipChangeDataUpdateServiceImpl.updateSupervisionInfoEs(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgSupervisionInfo data) {
equipChangeDataUpdateServiceImpl.buildSupervisionInfoEs(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.service.impl;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsUpdateStrategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy.EsBuildStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.EquipChangeDataUpdateServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import lombok.RequiredArgsConstructor;
......@@ -8,7 +9,7 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class UseInfoEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgUseInfo> {
public class UseInfoEsBuildStrategy implements EsBuildStrategy<IdxBizJgUseInfo> {
private final EquipChangeDataUpdateServiceImpl equipChangeDataUpdateServiceImpl;
......@@ -18,7 +19,7 @@ public class UseInfoEsUpdateStrategy implements EsUpdateStrategy<IdxBizJgUseInfo
}
@Override
public void updateEsData(String record, IdxBizJgUseInfo data) {
equipChangeDataUpdateServiceImpl.updateUseInfoEsData(record, data);
public void buildEsData(ESEquipmentCategoryDto es, IdxBizJgUseInfo data) {
equipChangeDataUpdateServiceImpl.buildUseInfoEsData(es, data);
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.esUpdate.strategy;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
public interface EsUpdateStrategy<T extends IBaseChangeData> {
public interface EsBuildStrategy<T extends IBaseChangeData> {
Class<T> getSupportType();
void updateEsData(String record, T data);
void buildEsData(ESEquipmentCategoryDto es, T data);
}
......@@ -94,12 +94,12 @@ public class ChangeLogInsertListener {
JgBizChangeLog changeLog = saveLog(event);
// 2.子表字段保存
List<ESDataChangeLogDto> logs = saveColumnsChange2Es(fieldChangeMetas, requestContextModel, date, changeLog);
// 3.异步记录履历日志
// 3.记录履历日志
this.insertCertLog(changeLog, event);
log.info("es 操作日志数据入库成功:{}条", logs.size());
}
@Async
protected void insertCertLog(JgBizChangeLog changeLog, BaseBizDataChangeEvent event) {
try {
BizRelationDataDto data = event.getBizRelationData();
......
......@@ -42,10 +42,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgFactoryInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -148,6 +145,8 @@ public class CommonEquipDataProcessService {
private final JgUseRegistrationManageServiceImpl jgUseRegistrationManageService;
private final SuperviseInfoMapper superviseInfoMapper;
public static final String BASE_COLUMN_REC_DATE = "\"REC_DATE\"";
public static final String BASE_COLUMN_REC_USERID = "\"REC_USER_ID\"";
......@@ -1166,7 +1165,7 @@ public class CommonEquipDataProcessService {
esEquipmentCategoryDto.setIS_INTO_MANAGEMENT(true);
esEquipmentCategoryDto.setEQU_STATE(EquipmentEnum.ZAIYONG.getCode());
esEquipmentCategoryDto.setUSE_ORG_CODE(useOrgCode);
esEquipmentCategory.save(esEquipmentCategoryDto);
esEquipmentCategory.saveWithFallback(esEquipmentCategoryDto);
}
}
......
......@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.dto.*;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
......@@ -119,19 +119,7 @@ public class EquipChangeDataUpdateServiceImpl {
esEquipmentCategoryDto.setPRODUCE_DATE(equipFactoryChangeDataDto.getProduceDate());
esEquipmentCategoryDto.setFACTORY_NUM(equipFactoryChangeDataDto.getFactoryNum());
esEquipmentCategoryDto.setPRODUCE_UNIT_NAME(equipFactoryChangeDataDto.getProduceUnitName());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateFactoryEsData(String record, IdxBizJgFactoryInfo equipFactoryChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCE_DATE(DateUtil.formatDate(equipFactoryChangeDataDto.getProduceDate()));
esEquipmentCategoryDto.setFACTORY_NUM(equipFactoryChangeDataDto.getFactoryNum());
esEquipmentCategoryDto.setPRODUCE_UNIT_NAME(equipFactoryChangeDataDto.getProduceUnitName());
esEquipmentCategory.save(esEquipmentCategoryDto);
esEquipmentCategory.saveWithFallback(esEquipmentCategoryDto);
}
}
......@@ -165,41 +153,7 @@ public class EquipChangeDataUpdateServiceImpl {
esEquipmentCategoryDto.setEQU_DEFINE(category.getName());
}
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateRegisterEsData(String record, IdxBizJgRegisterInfo registerChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCT_NAME(registerChangeDataDto.getProductName());
esEquipmentCategoryDto.setEQU_CODE(registerChangeDataDto.getEquCode());
esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType());
esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory());
esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine());
esEquipmentCategoryDto.setUSE_ORG_CODE(registerChangeDataDto.getUseOrgCode());
esEquipmentCategoryDto.setWhetherSphericalTank(registerChangeDataDto.getWhetherSphericalTank());
// 冗余设备类别名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) {
esEquipmentCategoryDto.setEQU_CATEGORY(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquCategory());
if (category != null) {
esEquipmentCategoryDto.setEQU_CATEGORY(category.getName());
}
}
// 冗余设备品种名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquDefine())) {
esEquipmentCategoryDto.setEQU_DEFINE(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquDefine());
if (category != null) {
esEquipmentCategoryDto.setEQU_DEFINE(category.getName());
}
}
esEquipmentCategory.save(esEquipmentCategoryDto);
esEquipmentCategory.saveWithFallback(esEquipmentCategoryDto);
}
}
......@@ -210,7 +164,7 @@ public class EquipChangeDataUpdateServiceImpl {
esEquipmentCategoryDto.setPROJECT_CONTRAPTION(registerChangeDataDto.getProjectContraption());
}
if (!pieLines.isEmpty()) {
esEquipmentCategory.saveAll(pieLines);
esEquipmentCategory.saveAllWithFallback(pieLines);
}
}
......@@ -328,7 +282,7 @@ public class EquipChangeDataUpdateServiceImpl {
if (!ValidationUtil.isEmpty(equipUseInfoChangeDataDto.getEquState())) {
esEquipmentCategoryDto.setEQU_STATE(Integer.parseInt(equipUseInfoChangeDataDto.getEquState()));
}
esEquipmentCategory.save(esEquipmentCategoryDto);
esEquipmentCategory.saveWithFallback(esEquipmentCategoryDto);
}
}
......@@ -338,7 +292,7 @@ public class EquipChangeDataUpdateServiceImpl {
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setCODE96333(equipOtherInfoChangeDataDto.getCode96333());
esEquipmentCategory.save(esEquipmentCategoryDto);
esEquipmentCategory.saveWithFallback(esEquipmentCategoryDto);
}
}
......@@ -382,30 +336,6 @@ public class EquipChangeDataUpdateServiceImpl {
}
}
public void updateInspectInfoEs(String record, IdxBizJgInspectionDetectionInfo equipUseInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
if(equipUseInfoChangeDataDto.getNextInspectDate() != null) {
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(equipUseInfoChangeDataDto.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)).getTime());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
}
public void updateSupervisionInfoEs(String record, IdxBizJgSupervisionInfo equipSupervisionInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
if(equipSupervisionInfoChangeDataDto.getOrgBranchCode() != null) {
esEquipmentCategoryDto.setOrgBranchCode(equipSupervisionInfoChangeDataDto.getOrgBranchCode());
esEquipmentCategoryDto.setORG_BRANCH_NAME(equipSupervisionInfoChangeDataDto.getOrgBranchName());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
}
public void updateOtherInfoChangeData(String record, EquipOtherInfoChangeDataDto otherInfoChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgOtherInfo> updateWrapper = new LambdaUpdateWrapper<>();
......@@ -415,4 +345,55 @@ public class EquipChangeDataUpdateServiceImpl {
updateWrapper.set(IdxBizJgOtherInfo::getInformationSituation, otherInfoChangeDataDto.getInformationSituation());
idxBizJgOtherInfoMapper.update(null, updateWrapper);
}
public void buildFactoryEsData(ESEquipmentCategoryDto esEquipmentCategoryDto, IdxBizJgFactoryInfo equipFactoryChangeDataDto) {
esEquipmentCategoryDto.setPRODUCE_DATE(DateUtil.formatDate(equipFactoryChangeDataDto.getProduceDate()));
esEquipmentCategoryDto.setFACTORY_NUM(equipFactoryChangeDataDto.getFactoryNum());
esEquipmentCategoryDto.setPRODUCE_UNIT_NAME(equipFactoryChangeDataDto.getProduceUnitName());
}
public void buildInspectInfoEs(ESEquipmentCategoryDto esEquipmentCategoryDto, IdxBizJgInspectionDetectionInfo data) {
if (data.getNextInspectDate() != null) {
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(data.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)).getTime());
}
}
public void buildRegisterEsData(ESEquipmentCategoryDto esEquipmentCategoryDto, IdxBizJgRegisterInfo registerChangeDataDto) {
esEquipmentCategoryDto.setPRODUCT_NAME(registerChangeDataDto.getProductName());
esEquipmentCategoryDto.setEQU_CODE(registerChangeDataDto.getEquCode());
esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType());
esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory());
esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine());
esEquipmentCategoryDto.setUSE_ORG_CODE(registerChangeDataDto.getUseOrgCode());
esEquipmentCategoryDto.setWhetherSphericalTank(registerChangeDataDto.getWhetherSphericalTank());
// 冗余设备类别名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) {
esEquipmentCategoryDto.setEQU_CATEGORY(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquCategory());
if (category != null) {
esEquipmentCategoryDto.setEQU_CATEGORY(category.getName());
}
}
// 冗余设备品种名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquDefine())) {
esEquipmentCategoryDto.setEQU_DEFINE(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquDefine());
if (category != null) {
esEquipmentCategoryDto.setEQU_DEFINE(category.getName());
}
}
}
public void buildSupervisionInfoEs(ESEquipmentCategoryDto esEquipmentCategoryDto, IdxBizJgSupervisionInfo idxBizJgSupervisionInfo) {
esEquipmentCategoryDto.setOrgBranchCode(idxBizJgSupervisionInfo.getOrgBranchCode());
esEquipmentCategoryDto.setORG_BRANCH_NAME(idxBizJgSupervisionInfo.getOrgBranchName());
}
public void buildUseInfoEsData(ESEquipmentCategoryDto esEquipmentCategoryDto, IdxBizJgUseInfo idxBizJgUseInfo) {
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(idxBizJgUseInfo.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSE_UNIT_NAME(idxBizJgUseInfo.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(idxBizJgUseInfo.getUseInnerCode());
}
}
......@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.jce.provider.JCERSACipher;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -36,6 +37,7 @@ import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -243,6 +245,8 @@ public class PieLineDataChangeServiceImpl {
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(new Date());
supervisionInfo.setSequenceNbr(null);
supervisionInfo.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode());
supervisionInfo.setOrgBranchName(projectContraptionChangeDataDto.getOrgName());
supervisionInfoService.save(supervisionInfo);
// 其他信息
......@@ -265,15 +269,12 @@ public class PieLineDataChangeServiceImpl {
newPieLine.setPipeLength(pipelineInfo.getPipeLength());
registerInfo.setProductName(pipelineInfo.getPipeName());
commonEquipDataProcessService.getJgRegisterInfoService().save(registerInfo);
ESEquipmentCategoryDto esEquipmentDto = BeanUtil.copyProperties(newPieLine, ESEquipmentCategoryDto.class);
esEquipmentDto.setDATA_SOURCE(useInfo.getDataSource());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentDto.setREC_DATE(new Date().getTime());
esEquipmentDto.setSEQUENCE_NBR(record);
esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setIS_INTO_MANAGEMENT(true);
esEquipmentDto.setUSE_ORG_CODE(projectContraptionChangeDataDto.getUseRegistrationCode());
esEquipmentDto.setEQU_CATEGORY_CODE(projectContraptionChangeDataDto.getEquCategory());
esEquipmentDto.setEQU_CATEGORY(projectContraptionChangeDataDto.getEquCategoryName());
esEquipmentDto.setEQU_LIST_CODE(projectContraptionChangeDataDto.getEquList());
......@@ -281,18 +282,20 @@ public class PieLineDataChangeServiceImpl {
esEquipmentDto.setEQU_DEFINE_CODE(projectContraptionChangeDataDto.getEquDefine());
esEquipmentDto.setEQU_DEFINE(projectContraptionChangeDataDto.getEquDefineName());
esEquipmentDto.setSTATUS("已认领");
esEquipmentDto.setIS_INTO_MANAGEMENT(false);
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraptionChangeDataDto.getUscUnitName());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUseUnitCreditCode());
esEquipmentDto.setUSE_UNIT_NAME(projectContraptionChangeDataDto.getUseUnitName());
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraptionChangeDataDto.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineInfo.getPipeName());
esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName());
esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode());
esEquipmentDto.setCREATE_DATE(new Date().getTime());
esEquipmentDto.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId());
if (inspectionDetectionInfo.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(inspectionDetectionInfo.getNextInspectDate().getTime());
}
esEquipmentCategory.save(esEquipmentDto);
esEquipmentCategory.saveWithFallback(esEquipmentDto);
}
private void buildNewPieLineLog(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, String record, List<FieldChangeMeta> allChangeColumns, PipelineChangeItemDto newPieLine) {
......@@ -370,4 +373,24 @@ public class PieLineDataChangeServiceImpl {
return Stream.concat(newPipelines.stream(), updPipelines.stream()).filter(i -> i.getPipeLength() != null).map(e -> new BigDecimal(e.getPipeLength())).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).toPlainString();
}
public void updatePieLineEs(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, PipelineChangeItemDto pipelineNew, String record) {
Optional<ESEquipmentCategoryDto> dtoOptional = esEquipmentCategory.findById(record);
if(dtoOptional.isPresent()) {
ESEquipmentCategoryDto esEquipmentDto = dtoOptional.get();
esEquipmentDto.setREC_DATE(new Date().getTime());
esEquipmentDto.setUSC_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUscUnitCreditCode());
esEquipmentDto.setUSC_UNIT_NAME(projectContraptionChangeDataDto.getUscUnitName());
esEquipmentDto.setUSE_UNIT_CREDIT_CODE(projectContraptionChangeDataDto.getUseUnitCreditCode());
esEquipmentDto.setUSE_UNIT_NAME(projectContraptionChangeDataDto.getUseUnitName());
esEquipmentDto.setPROJECT_CONTRAPTION(projectContraptionChangeDataDto.getProjectContraption());
esEquipmentDto.setPRODUCT_NAME(pipelineNew.getPipeName());
esEquipmentDto.setORG_BRANCH_NAME(projectContraptionChangeDataDto.getOrgName());
esEquipmentDto.setOrgBranchCode(projectContraptionChangeDataDto.getOrgCode());
esEquipmentDto.setUSE_ORG_CODE(projectContraptionChangeDataDto.getUseRegistrationCode());
if (pipelineNew.getNextInspectDate() != null) {
esEquipmentDto.setNEXT_INSPECT_DATE(pipelineNew.getNextInspectDate().getTime());
}
esEquipmentCategory.saveWithFallback(esEquipmentDto);
}
}
}
......@@ -4,10 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.annotation.EnableEsRollback;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
......@@ -23,19 +23,10 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
......@@ -54,17 +45,19 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
private final EsUpdateService esUpdateService;
private final RestHighLevelClient restHighLevelClient;
private final EsEquipmentDao esEquipmentDao;
private final IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoServiceImpl;
@Override
public HandleResult handle(Map<String, Object> changeData, String record) {
Optional<ESEquipmentCategoryDto> optional = commonEquipDataProcessService.getEsEquipmentCategory().findById(record);
if(!optional.isPresent()){
log.error("要编辑的设备:{},不存在", record);
throw new RuntimeException("设备数据存在异常,无法保存!");
}
ESEquipmentCategoryDto equipmentCategoryDto = optional.get();
JSONObject changeJson = new JSONObject(changeData);
List<FieldChangeMeta> allChangeColumns = new ArrayList<>();
IdxBizJgUseInfo useInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, record));
IdxBizJgUseInfo useInfoNew = BeanUtil.copyProperties(useInfoOld, IdxBizJgUseInfo.class);
CommonEquipDataProcessService.castMap2Bean(changeJson, useInfoNew);
......@@ -79,8 +72,8 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
if (!ValidationUtil.isEmpty(registerInfoOld.getUseOrgCode())) {
JgUseRegistrationManage jgUseRegistrationManage = commonEquipDataProcessService.getJgUseRegistrationManageService().lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, registerInfoOld.getUseOrgCode())
.eq(JgUseRegistrationManage::getIsDelete,0)
.eq(JgUseRegistrationManage::getCertificateStatus,YIDENGJI.getName())
.eq(JgUseRegistrationManage::getIsDelete, 0)
.eq(JgUseRegistrationManage::getCertificateStatus, YIDENGJI.getName())
.select(JgUseRegistrationManage::getSequenceNbr, JgUseRegistrationManage::getReceiveCompanyCode).one();
useInfoOld.setReceiveCompanyCode(jgUseRegistrationManage.getReceiveCompanyCode());
}
......@@ -121,7 +114,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
inspectionDetectionInfoNew.setSequenceNbr(inspectionDetectionInfoOld.getSequenceNbr());
List<FieldChangeMeta> inspectionFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getBaseMapper(), inspectionDetectionInfoOld, inspectionDetectionInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", inspectionDetectionInfoOld.getSequenceNbr());
allChangeColumns.addAll(inspectionFieldChangeMetas);
esUpdateService.updateEsData(record, inspectionDetectionInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, inspectionDetectionInfoNew);
}
if (maintenanceSeq != null) {
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgMaintenanceRecordInfoService().getById(maintenanceSeq);
......@@ -164,27 +157,18 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
List<FieldChangeMeta> idxBizJgSupervisionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper(), idxBizJgSupervisionInfoOld, idxBizJgSupervisionInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(idxBizJgSupervisionInfoFieldChangeMetas);
esUpdateService.updateEsData(record, registerInfoNew);
esUpdateService.updateEsData(record, useInfoNew);
esUpdateService.updateEsData(record, designInfoNew);
esUpdateService.updateEsData(record, otherInfoNew);
esUpdateService.updateEsData(record, factoryInfoNew);
esUpdateService.updateEsData(record, idxBizJgSupervisionInfoNew);
if("50*X".equals(idxBizJgSupervisionInfoOld.getOrgBranchCode()) && !"50*X".equals(idxBizJgSupervisionInfoNew.getOrgBranchCode())){
Optional<ESEquipmentInfo> esEquipmentDto = esEquipmentDao.findById(record);
if (esEquipmentDto.isPresent()) {
ESEquipmentInfo esEquipmentInfo = esEquipmentDto.get();
esEquipmentInfo.setORG_BRANCH_CODE(idxBizJgSupervisionInfoNew.getOrgBranchCode());
esEquipmentInfo.setORG_BRANCH_NAME(idxBizJgSupervisionInfoNew.getOrgBranchName());
esEquipmentDao.save(esEquipmentInfo);
}
}
esUpdateService.buildEsData(equipmentCategoryDto, registerInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, useInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, designInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, otherInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, factoryInfoNew);
esUpdateService.buildEsData(equipmentCategoryDto, idxBizJgSupervisionInfoNew);
// 如果是气瓶则按照证更新其他同证下的气瓶字段
this.updateOtherEquipInSameCert(useInfoNew, registerInfoNew, registerInfoOld, allChangeColumns);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerInfoOld.getEquList(), record, changeData, allChangeColumns);
// es设备保存
commonEquipDataProcessService.getEsEquipmentCategory().saveWithFallback(equipmentCategoryDto);
return HandleResult.builder().fieldChangeMetas(allChangeColumns).build();
}
......@@ -241,46 +225,13 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
String orgCode = idxBizJgSupervisionInfo.getOrgBranchCode();
// 按照org_code查询
if (StringUtils.isNotEmpty(orgCode)) {
// 特殊处理orgCode
orgCode = changeOrgBranchCode(idxBizJgSupervisionInfo.getRecord(), orgCode);
if (!"50*X".equals(orgCode)) {
CompanyBo companyBo = commonEquipDataProcessService.getCommonMapper().queryCompanyByOrgCode(orgCode);
idxBizJgSupervisionInfo.setOrgBranchCode(companyBo.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(companyBo.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(companyBo.getCompanyCode());
} else {
log.info(String.format("设备编辑未从es中查询到正确的orgCode,record为:%s", idxBizJgSupervisionInfo.getRecord()));
}
CompanyBo companyBo = commonEquipDataProcessService.getCommonMapper().queryCompanyByOrgCode(orgCode);
idxBizJgSupervisionInfo.setOrgBranchCode(companyBo.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(companyBo.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(companyBo.getCompanyCode());
}
}
private String changeOrgBranchCode(String record, String orgCode) {
if (!"50*X".equals(orgCode)) {
return orgCode;
} else {
// 查询es
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
boolMust.must(QueryBuilders.termsQuery("SEQUENCE_NBR.keyword", record));
builder.query(boolMust);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
if (response.getHits().getHits().length != 0) {
for (SearchHit hit : response.getHits().getHits()) {
JSONObject jsonObject = ((JSONObject) JSONObject.toJSON(hit)).getJSONObject("sourceAsMap");
return jsonObject.getString("ORG_BRANCH_CODE");
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return orgCode;
}
private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) {
// 1.使用登记证编辑时重复性校验
......@@ -302,7 +253,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
}
}
}
if (!ValidationUtil.isEmpty(registerInfoNew.getUseOrgCode())){
if (!ValidationUtil.isEmpty(registerInfoNew.getUseOrgCode())) {
idxBizJgRegisterInfoServiceImpl.checkUseRegistrationCode(registerInfoNew.getUseOrgCode(), "unit");
}
}
......
......@@ -20,10 +20,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.PieLineLevelTypeHandler;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -61,11 +58,6 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
JSONArray deletedPieLines = data.getJSONArray(RequestChangeData.deletedDataKey);
List<FieldChangeMeta> allChangeColumns = new ArrayList<>();
List<PipelineChangeItemDto> items = insertOrEditPieLines.toJavaList(PipelineChangeItemDto.class);
// 1.设备技术参数入库前校验,约束:同一个装置下的管道编号不能重复
// 同一工程装置下管道编号不能重复校验
// if (items.size() != items.stream().map(TechParamsPipelineChangeFieldDto::getPipelineNumber).distinct().count()) {
// throw new BadRequest("同一工程装置下管道编号不能重复!");
// }
List<PipelineChangeItemDto> newPipelines = new ArrayList<>();
List<PipelineChangeItemDto> updatePipelines = new ArrayList<>();
List<PipelineChangeItemDto> deletePipelines = new ArrayList<>();
......@@ -117,12 +109,16 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
this.updateInspectInfo(pipelineNew, projectContraptionChangeDataDto, allChangeColumns);
// 设计信息更新
pieLineDataChangeService.saveDesignForPieLine(record, allChangeColumns, pipelineNew);
// 更新属地信息
this.updateSuperviseInfo(projectContraptionChangeDataDto, record);
// 技术参数入库保存
TechParamsPipelineChangeFieldDto paramsPipelineChangeFieldDto = new TechParamsPipelineChangeFieldDto();
// 手工计算求和管道长度业务使用
pipelineNew.setPipeLength(PipLenCalUtils.cal(pipelineNew.getPipeLengthText()));
BeanUtil.copyProperties(pipelineNew, paramsPipelineChangeFieldDto, true);
commonEquipDataProcessService.savePieLineTechParam(record, allChangeColumns, paramsPipelineChangeFieldDto);
// 更新管道信息的es
pieLineDataChangeService.updatePieLineEs(projectContraptionChangeDataDto, pipelineNew, record);
}
updatePipelines.add(pipelineNew);
}
......@@ -135,6 +131,14 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
return HandleResult.builder().fieldChangeMetas(allChangeColumns).pipelineChangeItemMap(pmap).build();
}
private void updateSuperviseInfo(ProjectContraptionChangeDataDto projectContraptionChangeDataDto, String record) {
LambdaUpdateWrapper<SuperviseInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(AbstractEquipBaseEntity::getRecord, record);
updateWrapper.set(SuperviseInfo::getOrgBranchCode, projectContraptionChangeDataDto.getOrgCode());
updateWrapper.set(SuperviseInfo::getOrgBranchName, projectContraptionChangeDataDto.getOrgName());
commonEquipDataProcessService.getSuperviseInfoMapper().update(null, updateWrapper);
}
private void updateRegisterInfo(String record, ProjectContraptionChangeDataDto projectContraptionChangeDataDto) {
// 管道不记录使用信息变化,使用信息的变化已装置来体现
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new LambdaUpdateWrapper<>();
......@@ -212,7 +216,7 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
inspectionDetectionInfoNew.setSequenceNbr(inspectionDetectionInfoOld.getSequenceNbr());
List<FieldChangeMeta> inspectionFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getBaseMapper(), inspectionDetectionInfoOld, inspectionDetectionInfoNew, projectContraptionChangeDataDto.getProjectContraptionId() + "/" + item.getRecord(), "SEQUENCE_NBR", inspectionDetectionInfoOld.getSequenceNbr());
allChangeColumns.addAll(inspectionFieldChangeMetas);
esUpdateService.updateEsData(item.getRecord(), inspectionDetectionInfoNew);
esUpdateService.buildEsData(item.getRecord(), inspectionDetectionInfoNew);
}
}
......@@ -240,6 +244,8 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
BeanUtil.copyProperties(updatePieLine, useInfoNew, true);
useInfoNew.setUseDate(projectContraptionChangeDataDto.getUseDate());
useInfoNew.setSequenceNbr(useInfoOld.getSequenceNbr());
useInfoNew.setProjectContraptionId(projectContraptionChangeDataDto.getProjectContraptionId());
useInfoNew.setProjectContraption(projectContraptionChangeDataDto.getProjectContraption());
setNewUseAddressInfo(projectContraptionChangeDataDto, useInfoNew);
// 冗余的字典名称字段更新
commonEquipDataProcessService.setNameByCode2UseInfo(useInfoNew);
......
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