Commit 53a509b5 authored by suhuiguang's avatar suhuiguang

refactor(大编辑):代码合并错误处理

1.通用保存 2.通用详情
parent 721e7a64
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.edit;
import com.yeejoin.amos.boot.module.jg.biz.context.BizDataHandleStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.dto.RequestChangeData;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......
package com.yeejoin.amos.boot.module.jg.biz.edit.event;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import lombok.Getter;
import org.typroject.tyboot.core.foundation.context.RequestContextModel;
import java.util.List;
/**
* @author Administrator
*/
@Getter
public class ChangeLogInsertEvent extends BaseBizDataChangeEvent {
private final List<ChangeDataDto> data;
private final RequestContextModel requestContext;
private String applyNo;
private String bizType;
/**
* Create a new {@code ApplicationEvent}.
*
* @param source the object on which the event initially occurred or with
* which the event is associated (never {@code null})
*/
public ChangeLogInsertEvent(Object source, List<ChangeDataDto> data, RequestContextModel requestContext) {
super(source);
this.data = data;
this.requestContext = requestContext;
}
/**
*
* @param source 对象
* @param applyNo 单据编号
* @param bizType 业务类型(表名)
* @param data 变化的数据
* @param requestContext 上下文
*/
public ChangeLogInsertEvent(Object source, String applyNo, String bizType, List<ChangeDataDto> data, RequestContextModel requestContext) {
super(source);
this.data = data;
this.applyNo = applyNo;
this.bizType = bizType;
this.requestContext = requestContext;
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.listener;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESDataChangeLogDao;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.ChangeLogInsertEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContextModel;
import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
/**
* @author Administrator
*/
@Component
@Slf4j
public class ChangeLogInsertEventListener {
@Value("${changeData.deal.thread.number:1}")
private int threadNumber;
private final ESDataChangeLogDao esDataChangeLogDao;
private final BlockingQueue<ChangeLogInsertEvent> queue = new LinkedBlockingQueue<>();
public ChangeLogInsertEventListener(ESDataChangeLogDao esDataChangeLogDao) {
this.esDataChangeLogDao = esDataChangeLogDao;
}
@EventListener(value = ChangeLogInsertEvent.class)
public void handleTransactionalEvent(ChangeLogInsertEvent event) {
log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event));
queue.add(event);
}
@PostConstruct
public void init() {
ExecutorService executorService = Executors.newFixedThreadPool(threadNumber);
for (int i = 0; i < threadNumber; i++) {
executorService.execute(() -> {
while (true) {
try {
ChangeLogInsertEvent event = queue.take();
this.dealData(event);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
});
}
}
private void dealData(ChangeLogInsertEvent event) {
List<ChangeDataDto> changeDataDtos = event.getData();
RequestContextModel requestContextModel = event.getRequestContext();
Date date = new Date();
List<ESDataChangeLogDto> logs = changeDataDtos.parallelStream().map(changeDataDto -> {
ESDataChangeLogDto changeLogDto = new ESDataChangeLogDto();
changeLogDto.setColumnKey(changeDataDto.getColumnKey());
changeLogDto.setColumnKeyLabel(changeDataDto.getColumnLabel());
changeLogDto.setBeforeData(changeDataDto.getColumnOldValue());
changeLogDto.setAfterData(changeDataDto.getColumnNewValue());
changeLogDto.setUserId(requestContextModel.getExcutedUserId());
changeLogDto.setCreateDate(date.getTime());
changeLogDto.setRequestDate(DateUtil.formatDateTime(date));
changeLogDto.setChangeId(changeDataDto.getChangeId());
changeLogDto.setColumnFamily(changeDataDto.getColumnFamily());
changeLogDto.setBizType(changeDataDto.getBizType());
changeLogDto.setBatchId(requestContextModel.getTraceId());
return changeLogDto;
}).collect(Collectors.toList());
esDataChangeLogDao.saveAll(logs);
log.info("es 操作日志数据入库成功:{}条", logs.size());
}
}
......@@ -7,7 +7,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESDataChangeLogDao;
import com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -52,12 +52,12 @@ public class ChangeLogInsertListener {
private final JgBizChangeLogServiceImpl bizChangeLogService;
private final BlockingQueue<ChangeDataEvent> queue = new LinkedBlockingQueue<>();
private final BlockingQueue<BaseBizDataChangeEvent> queue = new LinkedBlockingQueue<>();
@TransactionalEventListener(value = ChangeDataEvent.class)
@TransactionalEventListener(value = BaseBizDataChangeEvent.class)
@Async
public void handleTransactionalEvent(ChangeDataEvent event) {
public void handleTransactionalEvent(BaseBizDataChangeEvent event) {
log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event));
queue.add(event);
}
......@@ -69,7 +69,7 @@ public class ChangeLogInsertListener {
executorService.execute(() -> {
while (true) {
try {
ChangeDataEvent event = queue.take();
BaseBizDataChangeEvent event = queue.take();
processEvent(event);
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -79,7 +79,7 @@ public class ChangeLogInsertListener {
});
}
private void processEvent(ChangeDataEvent event) {
private void processEvent(BaseBizDataChangeEvent event) {
List<ChangeDataDto> changeDataDtos = event.getData();
RequestContextModel requestContextModel = event.getRequestContext();
Date date = new Date();
......@@ -112,7 +112,7 @@ public class ChangeLogInsertListener {
return logs;
}
private JgBizChangeLog saveLog(ChangeDataEvent event) {
private JgBizChangeLog saveLog(BaseBizDataChangeEvent event) {
JgBizChangeLog changeLog = new JgBizChangeLog();
BeanUtil.copyProperties(event.getBizRelationData(), changeLog);
changeLog.setBizTable(bizTypeTableMap.get(changeLog.getBizType()));
......
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz;
import com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipDataProcessStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.IEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.ChangeLogInsertEvent;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -28,20 +28,16 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve
List<ChangeDataDto> allChangeColumns = dataProcessor.handle(changeData, applyNo);
List<ChangeDataDto> bizEditColumns = bizDataSave(applyNo, model, changeData);
allChangeColumns.addAll(bizEditColumns);
// 发送数据变更
publish2OtherBiz(buildEvent(applyNo, model, changeData));
// 异步记录日志
writeLog(allChangeColumns, applyNo);
// 发送数据变更实践
publish2OtherBiz(allChangeColumns, applyNo);
}
}
protected abstract U buildEvent(String applyNo, ModelType model, Map<String, Object> changeData);
private void publish2OtherBiz(U event) {
eventPublisher.publish(event);
}
private void writeLog(List<ChangeDataDto> allChangeColumns, String applyNo) {
eventPublisher.publish(new ChangeLogInsertEvent(this, applyNo, canHandleBizType(), allChangeColumns, RequestContext.cloneRequestContext()));
private void publish2OtherBiz(List<ChangeDataDto> allChangeColumns, String applyNo) {
BizRelationDataDto bizRelationDataDto = new BizRelationDataDto();
bizRelationDataDto.setBizId(applyNo);
bizRelationDataDto.setBizType(canHandleBizType());
bizRelationDataDto.setRecords(getEqs(applyNo));
eventPublisher.publish(new BaseBizDataChangeEvent(this, bizRelationDataDto, allChangeColumns, RequestContext.cloneRequestContext()));
}
}
......@@ -4,11 +4,11 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Component
public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
......@@ -17,11 +17,6 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
}
@Override
protected BaseBizDataChangeEvent buildEvent(String applyNo, ModelType model, Map<String, Object> changeData) {
return new BaseBizDataChangeEvent(this, applyNo, RequestContext.cloneRequestContext());
}
@Override
public String canHandleBizType() {
return "tzs_jg_installation_notice";
}
......@@ -40,4 +35,9 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
public Boolean beforeCheck(String applyNo, ModelType model, Map<String, Object> changeData) {
return null;
}
@Override
public Set<String> getEqs(String applyNo) {
return Collections.emptySet();
}
}
......@@ -3,23 +3,15 @@ package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterUpdateService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.*;
@Service
public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
......@@ -56,7 +48,6 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
// 选择是台套、还是单位办理的方式,进行分类数据的解析
// 更新历史的JSON的数据
this.updateHistoryJson(applyNo);
this.buildLogData(bizEditColumns);
return bizEditColumns;
}
......@@ -65,21 +56,20 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
return true;
}
private void updateHistoryJson(String applyNo) {
useRegisterUpdateService.updateHisData(applyNo);
@Override
public Set<String> getEqs(String applyNo) {
return Collections.emptySet();
}
private void buildLogData(List<ChangeDataDto> allChangeColumns) {
allChangeColumns.forEach(column -> {
column.setBizType("使用登记");
});
private void updateHistoryJson(String applyNo) {
useRegisterUpdateService.updateHisData(applyNo);
}
@Override
public Map<String, ?> getDetail(String applyNo, String bizId) {
Map<String, Object> detail = new HashMap<>();
JgUseRegistration useRegistration = useRegisterUpdateService.useRegistrationService.getOne(new LambdaQueryWrapper<JgUseRegistration>().eq(JgUseRegistration::getApplyNo, applyNo));
JgUseRegistration useRegistration = useRegisterUpdateService.getUseRegistrationService().getOne(new LambdaQueryWrapper<JgUseRegistration>().eq(JgUseRegistration::getApplyNo, applyNo));
JSONObject lastDetailDataForEdit = useRegisterUpdateService.getLastDetailDataForEdit(useRegistration);
BeanUtil.copyProperties(lastDetailDataForEdit, detail);
BeanUtil.copyProperties(useRegistration, detail);
......@@ -88,19 +78,4 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
return detail;
}
@Override
protected BaseBizDataChangeEvent buildEvent(String applyNo, ModelType model, Map<String, Object> changeData) {
return new BaseBizDataChangeEvent(this, applyNo, RequestContext.cloneRequestContext());
}
private void publishEvent2Logger(String applyNo, List<ChangeDataDto> allChangeColumns) {
List<JgUseRegistrationEqDto> eqDtos = useRegisterUpdateService.useRegistrationEqService.getBaseMapper().queryEqListByApplyNo(applyNo);
BizRelationDataDto bizRelationDataDto = new BizRelationDataDto();
bizRelationDataDto.setBizId(applyNo);
bizRelationDataDto.setBizType(canHandleBizType());
bizRelationDataDto.setRecords(eqDtos.stream().map(JgUseRegistrationEqDto::getEquId).collect(Collectors.toSet()));
// 异步记录日志
publisher.publish(new BaseBizDataChangeEvent(this, bizRelationDataDto, allChangeColumns, RequestContext.cloneRequestContext()));
}
}
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.InformationManageTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -26,6 +27,7 @@ import static java.util.stream.Collectors.toList;
@Service
@RequiredArgsConstructor
@Getter
public class UseRegisterUpdateService {
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
......@@ -47,10 +49,6 @@ public class UseRegisterUpdateService {
// 更新数据
useRegistrationService.updateHistory(hisData, null, jgUseRegistration.getSequenceNbr().toString(), jgUseRegistration.getSupervisoryCode());
}
public CommonServiceImpl getCommonService() {
return commonService;
}
public JSONObject buildLastDetailData(JgUseRegistration jgUseRegistration) {
JgRegistrationHistory jgRegistrationHistory = getJgRegistrationHistory(jgUseRegistration);
......
......@@ -4,8 +4,9 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IBizDataChangeHandleStrategy {
public interface IBizDataChangeHandleStrategy {
/**
* 可处理的业务类型(使用登记等)
......@@ -25,6 +26,7 @@ public interface IBizDataChangeHandleStrategy {
/**
* 保存
*
* @param applyNo 单据编号
* @param model @see ModelType
* @param changeData 变更数据
......@@ -34,8 +36,9 @@ public interface IBizDataChangeHandleStrategy {
/**
* 前置校验 如业务字段的重复性检验
* @param applyNo 单据编号
* @param model 类型
*
* @param applyNo 单据编号
* @param model 类型
* @param changeData 数据
* @return 是否通过前置校验
*/
......@@ -52,5 +55,13 @@ public interface IBizDataChangeHandleStrategy {
batchCylinder
}
void doSave(String applyNo, ModelType model, Map<String, Object> changeData) ;
void doSave(String applyNo, ModelType model, Map<String, Object> changeData);
/**
* 获取子表的设备或者使用登记证
*
* @param applyNo 单据编号
* @return 设备record或者证数组
*/
Set<String> getEqs(String applyNo);
}
......@@ -17,12 +17,12 @@ import java.util.Map;
* 批量维护气瓶-策略实现类
*/
@Component
public class BatchCylinderDataEquipChangeProcess implements IEquipChangeDataProcessStrategy {
public class BatchCylinderEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService;
public BatchCylinderDataEquipChangeProcess(CommonEquipDataProcessService commonEquipDataProcessService) {
public BatchCylinderEquipChangeProcess(CommonEquipDataProcessService commonEquipDataProcessService) {
this.commonEquipDataProcessService = commonEquipDataProcessService;
}
......@@ -55,11 +55,13 @@ public class BatchCylinderDataEquipChangeProcess implements IEquipChangeDataProc
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, allChangeColumns);
EquipUseInfoChangeDataDto useInfoChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipUseInfoChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, useInfoChangeDataDto, allChangeColumns);
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns);
}
......
......@@ -55,11 +55,13 @@ public class BatchEquipDataEquipChangeProcess implements IEquipChangeDataProcess
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, allChangeColumns);
EquipUseInfoChangeDataDto useInfoChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipUseInfoChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, useInfoChangeDataDto, allChangeColumns);
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns);
}
......
......@@ -21,7 +21,7 @@ import java.util.Map;
*/
@Component
@RequiredArgsConstructor
public class BatchProjectDataEquipChangeProcess implements IEquipChangeDataProcessStrategy {
public class BatchProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService;
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
......@@ -80,7 +80,7 @@ public class EquipChangeDataUpdateServiceImpl {
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);
}
......@@ -154,10 +154,10 @@ public class EquipChangeDataUpdateServiceImpl {
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);
}
}
......
......@@ -3,10 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.EquipDesignChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipFactoryChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipRegisterChangeDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
......@@ -24,7 +21,7 @@ import java.util.Map;
* 单个维护设备-策略实现类
*/
@Component
public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStrategy {
public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final JgUseRegistrationServiceImpl useRegistrationService;
......@@ -34,7 +31,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
private final CommonEquipDataProcessService commonEquipDataProcessService;
public SingleEquipEquipChangeProcess(JgUseRegistrationServiceImpl useRegistrationService, JgUseRegistrationEqMapper jgRelationEquipMapper, CommonEquipDataProcessService commonEquipDataProcessService) {
public SingleEquipChangeProcess(JgUseRegistrationServiceImpl useRegistrationService, JgUseRegistrationEqMapper jgRelationEquipMapper, CommonEquipDataProcessService commonEquipDataProcessService) {
this.useRegistrationService = useRegistrationService;
this.jgRelationEquipMapper = jgRelationEquipMapper;
this.commonEquipDataProcessService = commonEquipDataProcessService;
......@@ -49,7 +46,8 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipDesignChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, allChangeColumns);
EquipUseInfoChangeDataDto useInfoChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipUseInfoChangeDataDto.class);
commonEquipDataProcessService.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto,useInfoChangeDataDto, allChangeColumns);
// 前置校验
commonEquipDataProcessService.checkValidField(record, registerChangeDataDto, null, null, null);
commonEquipDataProcessService.checkValidField(record, factoryChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
......@@ -58,6 +56,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, changeData, allChangeColumns);
return allChangeColumns;
......
......@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
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.api.dto.TechParamsPipelineChangeFieldDto;
import com.yeejoin.amos.boot.module.jg.biz.dto.RequestChangeData;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
......@@ -23,7 +26,7 @@ import java.util.Map;
*/
@Component
@RequiredArgsConstructor
public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProcessStrategy {
public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService;
......@@ -43,7 +46,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc
if (items.size() != items.stream().map(TechParamsPipelineChangeFieldDto::getPipelineNumber).distinct().count()) {
throw new BadRequest("同一工程装置下管道编号不能重复!");
}
if(deletedPieLines != null && !deletedPieLines.isEmpty()) {
if (deletedPieLines != null && !deletedPieLines.isEmpty()) {
List<PipelineChangeItemDto> deletedPieLinesJavaList = deletedPieLines.toJavaList(PipelineChangeItemDto.class);
pieLineDataChangeService.deletePieLineBatch(deletedPieLinesJavaList, allChangeColumns, defaultChangeId);
}
......@@ -54,7 +57,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc
// 3.管道信息入库保存
items.forEach(item -> {
String record = item.getRecord();
if(record == null) { // 新增的管道逻辑
if (record == null) { // 新增的管道逻辑
pieLineDataChangeService.newPieLine(projectContraptionChangeDataDto.getProjectContraptionId(), item, allChangeColumns, defaultChangeId);
} else { // 更新逻辑
// 设计信息更新
......
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