Commit 4e86d2f6 authored by suhuiguang's avatar suhuiguang

refactor(大编辑):代码重构

1.冲突处理
parent e066ad18
......@@ -61,7 +61,7 @@ public class EquipChangeDataUpdateService {
public void updateDesignChangeData(String record, EquipDesignChangeDataDto equipDesignChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgDesignInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgDesignInfo::getRecord, record);
updateWrapper.set(IdxBizJgDesignInfo::getDesignDate, StringUtils.isNotEmpty(equipDesignChangeDataDto.getDesignDate()) ? DateUtil.parse(equipDesignChangeDataDto.getDesignDate(), "yyyy-MM-dd") : null);
updateWrapper.set(IdxBizJgDesignInfo::getDesignDate, equipDesignChangeDataDto.getDesignDate());
updateWrapper.set(IdxBizJgDesignInfo::getDesignDoc, equipDesignChangeDataDto.getDesignDoc());
updateWrapper.set(IdxBizJgDesignInfo::getDesignUnitCreditCode, equipDesignChangeDataDto.getDesignUnitCreditCode());
updateWrapper.set(IdxBizJgDesignInfo::getDesignUnitName, equipDesignChangeDataDto.getDesignUnitName());
......@@ -72,7 +72,7 @@ public class EquipChangeDataUpdateService {
updateWrapper.set(IdxBizJgDesignInfo::getAppraisalDate, equipDesignChangeDataDto.getAppraisalDate());
updateWrapper.set(IdxBizJgDesignInfo::getDrawingDo, equipDesignChangeDataDto.getDrawingDo());
updateWrapper.set(IdxBizJgDesignInfo::getDesignStandard, equipDesignChangeDataDto.getDesignStandard());
updateWrapper.set(equipDesignChangeDataDto.getDesignIsComplete() != null , IdxBizJgDesignInfo::getDesignIsComplete, equipDesignChangeDataDto.getDesignIsComplete());
updateWrapper.set(equipDesignChangeDataDto.getDesignIsComplete() != null, IdxBizJgDesignInfo::getDesignIsComplete, equipDesignChangeDataDto.getDesignIsComplete());
idxBizJgDesignInfoMapper.update(null, updateWrapper);
}
......@@ -146,10 +146,10 @@ public class EquipChangeDataUpdateService {
public void updateRegisterEsDataPieLine(ProjectContraptionChangeDataDto registerChangeDataDto) {
// es 数据更新
List<ESEquipmentCategoryDto> pieLines = esEquipmentCategory.findAllByProjectContraptionId(registerChangeDataDto.getProjectContraptionId());
for(ESEquipmentCategoryDto esEquipmentCategoryDto: pieLines) {
for (ESEquipmentCategoryDto esEquipmentCategoryDto : pieLines) {
esEquipmentCategoryDto.setPROJECT_CONTRAPTION(registerChangeDataDto.getProjectContraption());
}
if(!pieLines.isEmpty()){
if (!pieLines.isEmpty()) {
esEquipmentCategory.saveAll(pieLines);
}
}
......@@ -159,7 +159,7 @@ public class EquipChangeDataUpdateService {
}
public void updateTechParamByRecord(String tableName, String record, List<ChangeDataDto> changeDataDtos) {
public void updateTechParamByRecord(String tableName, String record, List<FieldChangeMeta> changeDataDtos) {
List<DynamicColumnDto> columns = changeDataDtos.stream().map(c -> {
DynamicColumnDto columnDto = new DynamicColumnDto();
columnDto.setColumnName(String.format("\"%s\"", StrUtil.toUnderlineCase(c.getColumnKey()).toUpperCase()));
......
......@@ -3,10 +3,11 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.dto.PieLineDesignChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ProjectContraptionChangeDataDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.CommonEquipDataProcessService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import org.springframework.stereotype.Component;
......@@ -27,12 +28,12 @@ public class PieLineDataChangeServiceImpl {
this.equipChangeDataUpdateService = equipChangeDataUpdateService;
}
public void update(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew, List<ChangeDataDto> allChangeColumns) {
public void update(ProjectContraptionChangeDataDto projectContraptionChangeDataDtoNew, List<FieldChangeMeta> allChangeColumns) {
// 原有对象行转列
ProjectContraptionChangeDataDto projectContraptionChangeDataDtoOld = getOldProjectContratData(projectContraptionChangeDataDtoNew);
List<ChangeDataDto> newProjectContraptionChangeData = commonEquipDataProcessService.convertBeanField2Column2(projectContraptionChangeDataDtoNew, projectContraptionChangeDataDtoNew.getProjectContraptionId());
List<FieldChangeMeta> newProjectContraptionChangeData = commonEquipDataProcessService.convertBeanField2Column2(projectContraptionChangeDataDtoNew, projectContraptionChangeDataDtoNew.getProjectContraptionId());
// 新对象构造行转列
List<ChangeDataDto> oldProjectContraptionChangeData = commonEquipDataProcessService.convertBeanField2Column2(projectContraptionChangeDataDtoOld, projectContraptionChangeDataDtoNew.getProjectContraptionId());
List<FieldChangeMeta> oldProjectContraptionChangeData = commonEquipDataProcessService.convertBeanField2Column2(projectContraptionChangeDataDtoOld, projectContraptionChangeDataDtoNew.getProjectContraptionId());
// 数据比对记录变化字段列表
allChangeColumns.addAll(commonEquipDataProcessService.mergeChangeFields(newProjectContraptionChangeData, oldProjectContraptionChangeData));
// 数据入库
......@@ -52,14 +53,14 @@ public class PieLineDataChangeServiceImpl {
return BeanUtil.copyProperties(projectContraption, ProjectContraptionChangeDataDto.class);
}
public void saveDesignForPieLine(String record, List<ChangeDataDto> allChangeColumns, PipelineChangeItemDto pipelineChangeItemDto) {
public void saveDesignForPieLine(String record, List<FieldChangeMeta> allChangeColumns, PipelineChangeItemDto pipelineChangeItemDto) {
// 1.记录变化的数据对象
PieLineDesignChangeDataDto pieLineDesignChangeDataDto = BeanUtil.copyProperties(pipelineChangeItemDto, PieLineDesignChangeDataDto.class);
// 构造新对象行转列
List<ChangeDataDto> designInfoNew = commonEquipDataProcessService.buildDesignInfoNew(pieLineDesignChangeDataDto, record);
List<FieldChangeMeta> designInfoNew = commonEquipDataProcessService.buildDesignInfoNew(pieLineDesignChangeDataDto, record);
// 老数据查询行转列
List<ChangeDataDto> designInfoOld = commonEquipDataProcessService.buildDesignInfoOld(record);
allChangeColumns.addAll(commonEquipDataProcessService.mergeChangeFields(designInfoNew, designInfoOld));
List<FieldChangeMeta> designInfoOld = commonEquipDataProcessService.buildDesignInfoOld(record);
allChangeColumns.addAll(CommonEquipDataProcessService.mergeChangeFields(designInfoNew, designInfoOld));
// 2.更新管道的设计单位名称
equipChangeDataUpdateService.updatePieLineDesignData(record, pieLineDesignChangeDataDto);
}
......
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