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; ...@@ -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.context.BizDataHandleStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.dto.RequestChangeData; 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 com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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; ...@@ -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.dto.ESDataChangeLogDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog; 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.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 com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -52,12 +52,12 @@ public class ChangeLogInsertListener { ...@@ -52,12 +52,12 @@ public class ChangeLogInsertListener {
private final JgBizChangeLogServiceImpl bizChangeLogService; 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 @Async
public void handleTransactionalEvent(ChangeDataEvent event) { public void handleTransactionalEvent(BaseBizDataChangeEvent event) {
log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event)); log.info("收到用户变更业务数据消息:{}", JSONObject.toJSONString(event));
queue.add(event); queue.add(event);
} }
...@@ -69,7 +69,7 @@ public class ChangeLogInsertListener { ...@@ -69,7 +69,7 @@ public class ChangeLogInsertListener {
executorService.execute(() -> { executorService.execute(() -> {
while (true) { while (true) {
try { try {
ChangeDataEvent event = queue.take(); BaseBizDataChangeEvent event = queue.take();
processEvent(event); processEvent(event);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -79,7 +79,7 @@ public class ChangeLogInsertListener { ...@@ -79,7 +79,7 @@ public class ChangeLogInsertListener {
}); });
} }
private void processEvent(ChangeDataEvent event) { private void processEvent(BaseBizDataChangeEvent event) {
List<ChangeDataDto> changeDataDtos = event.getData(); List<ChangeDataDto> changeDataDtos = event.getData();
RequestContextModel requestContextModel = event.getRequestContext(); RequestContextModel requestContextModel = event.getRequestContext();
Date date = new Date(); Date date = new Date();
...@@ -112,7 +112,7 @@ public class ChangeLogInsertListener { ...@@ -112,7 +112,7 @@ public class ChangeLogInsertListener {
return logs; return logs;
} }
private JgBizChangeLog saveLog(ChangeDataEvent event) { private JgBizChangeLog saveLog(BaseBizDataChangeEvent event) {
JgBizChangeLog changeLog = new JgBizChangeLog(); JgBizChangeLog changeLog = new JgBizChangeLog();
BeanUtil.copyProperties(event.getBizRelationData(), changeLog); BeanUtil.copyProperties(event.getBizRelationData(), changeLog);
changeLog.setBizTable(bizTypeTableMap.get(changeLog.getBizType())); changeLog.setBizTable(bizTypeTableMap.get(changeLog.getBizType()));
......
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz; 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.api.dto.ChangeDataDto;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipDataProcessStrategyContext; 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.core.IEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent; 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.biz.strategy.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -28,20 +28,16 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve ...@@ -28,20 +28,16 @@ public abstract class DefaultBizDataChangeHandler<U extends BaseBizDataChangeEve
List<ChangeDataDto> allChangeColumns = dataProcessor.handle(changeData, applyNo); List<ChangeDataDto> allChangeColumns = dataProcessor.handle(changeData, applyNo);
List<ChangeDataDto> bizEditColumns = bizDataSave(applyNo, model, changeData); List<ChangeDataDto> bizEditColumns = bizDataSave(applyNo, model, changeData);
allChangeColumns.addAll(bizEditColumns); allChangeColumns.addAll(bizEditColumns);
// 发送数据变更 // 发送数据变更实践
publish2OtherBiz(buildEvent(applyNo, model, changeData)); publish2OtherBiz(allChangeColumns, applyNo);
// 异步记录日志
writeLog(allChangeColumns, applyNo);
} }
} }
protected abstract U buildEvent(String applyNo, ModelType model, Map<String, Object> changeData); private void publish2OtherBiz(List<ChangeDataDto> allChangeColumns, String applyNo) {
BizRelationDataDto bizRelationDataDto = new BizRelationDataDto();
private void publish2OtherBiz(U event) { bizRelationDataDto.setBizId(applyNo);
eventPublisher.publish(event); bizRelationDataDto.setBizType(canHandleBizType());
} bizRelationDataDto.setRecords(getEqs(applyNo));
eventPublisher.publish(new BaseBizDataChangeEvent(this, bizRelationDataDto, allChangeColumns, RequestContext.cloneRequestContext()));
private void writeLog(List<ChangeDataDto> allChangeColumns, String applyNo) {
eventPublisher.publish(new ChangeLogInsertEvent(this, applyNo, canHandleBizType(), allChangeColumns, RequestContext.cloneRequestContext()));
} }
} }
...@@ -4,11 +4,11 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto; ...@@ -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.core.RouterEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent; import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
@Component @Component
public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> { public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
...@@ -17,11 +17,6 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler< ...@@ -17,11 +17,6 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
} }
@Override @Override
protected BaseBizDataChangeEvent buildEvent(String applyNo, ModelType model, Map<String, Object> changeData) {
return new BaseBizDataChangeEvent(this, applyNo, RequestContext.cloneRequestContext());
}
@Override
public String canHandleBizType() { public String canHandleBizType() {
return "tzs_jg_installation_notice"; return "tzs_jg_installation_notice";
} }
...@@ -40,4 +35,9 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler< ...@@ -40,4 +35,9 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
public Boolean beforeCheck(String applyNo, ModelType model, Map<String, Object> changeData) { public Boolean beforeCheck(String applyNo, ModelType model, Map<String, Object> changeData) {
return null; 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; ...@@ -3,23 +3,15 @@ package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.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.api.entity.JgUseRegistration;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher; 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.edit.event.BaseBizDataChangeEvent;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterUpdateService; import com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterUpdateService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> { public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<BaseBizDataChangeEvent> {
...@@ -56,7 +48,6 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba ...@@ -56,7 +48,6 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
// 选择是台套、还是单位办理的方式,进行分类数据的解析 // 选择是台套、还是单位办理的方式,进行分类数据的解析
// 更新历史的JSON的数据 // 更新历史的JSON的数据
this.updateHistoryJson(applyNo); this.updateHistoryJson(applyNo);
this.buildLogData(bizEditColumns);
return bizEditColumns; return bizEditColumns;
} }
...@@ -65,21 +56,20 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba ...@@ -65,21 +56,20 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
return true; return true;
} }
private void updateHistoryJson(String applyNo) { @Override
useRegisterUpdateService.updateHisData(applyNo); public Set<String> getEqs(String applyNo) {
return Collections.emptySet();
} }
private void buildLogData(List<ChangeDataDto> allChangeColumns) { private void updateHistoryJson(String applyNo) {
allChangeColumns.forEach(column -> { useRegisterUpdateService.updateHisData(applyNo);
column.setBizType("使用登记");
});
} }
@Override @Override
public Map<String, ?> getDetail(String applyNo, String bizId) { public Map<String, ?> getDetail(String applyNo, String bizId) {
Map<String, Object> detail = new HashMap<>(); 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); JSONObject lastDetailDataForEdit = useRegisterUpdateService.getLastDetailDataForEdit(useRegistration);
BeanUtil.copyProperties(lastDetailDataForEdit, detail); BeanUtil.copyProperties(lastDetailDataForEdit, detail);
BeanUtil.copyProperties(useRegistration, detail); BeanUtil.copyProperties(useRegistration, detail);
...@@ -88,19 +78,4 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba ...@@ -88,19 +78,4 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
return detail; 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; ...@@ -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.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel; import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -26,6 +27,7 @@ import static java.util.stream.Collectors.toList; ...@@ -26,6 +27,7 @@ import static java.util.stream.Collectors.toList;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter
public class UseRegisterUpdateService { public class UseRegisterUpdateService {
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper; private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
...@@ -47,10 +49,6 @@ public class UseRegisterUpdateService { ...@@ -47,10 +49,6 @@ public class UseRegisterUpdateService {
// 更新数据 // 更新数据
useRegistrationService.updateHistory(hisData, null, jgUseRegistration.getSequenceNbr().toString(), jgUseRegistration.getSupervisoryCode()); useRegistrationService.updateHistory(hisData, null, jgUseRegistration.getSequenceNbr().toString(), jgUseRegistration.getSupervisoryCode());
} }
public CommonServiceImpl getCommonService() {
return commonService;
}
public JSONObject buildLastDetailData(JgUseRegistration jgUseRegistration) { public JSONObject buildLastDetailData(JgUseRegistration jgUseRegistration) {
JgRegistrationHistory jgRegistrationHistory = getJgRegistrationHistory(jgUseRegistration); JgRegistrationHistory jgRegistrationHistory = getJgRegistrationHistory(jgUseRegistration);
......
...@@ -4,8 +4,9 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto; ...@@ -4,8 +4,9 @@ import com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
public interface IBizDataChangeHandleStrategy { public interface IBizDataChangeHandleStrategy {
/** /**
* 可处理的业务类型(使用登记等) * 可处理的业务类型(使用登记等)
...@@ -25,6 +26,7 @@ public interface IBizDataChangeHandleStrategy { ...@@ -25,6 +26,7 @@ public interface IBizDataChangeHandleStrategy {
/** /**
* 保存 * 保存
*
* @param applyNo 单据编号 * @param applyNo 单据编号
* @param model @see ModelType * @param model @see ModelType
* @param changeData 变更数据 * @param changeData 变更数据
...@@ -34,8 +36,9 @@ public interface IBizDataChangeHandleStrategy { ...@@ -34,8 +36,9 @@ public interface IBizDataChangeHandleStrategy {
/** /**
* 前置校验 如业务字段的重复性检验 * 前置校验 如业务字段的重复性检验
* @param applyNo 单据编号 *
* @param model 类型 * @param applyNo 单据编号
* @param model 类型
* @param changeData 数据 * @param changeData 数据
* @return 是否通过前置校验 * @return 是否通过前置校验
*/ */
...@@ -52,5 +55,13 @@ public interface IBizDataChangeHandleStrategy { ...@@ -52,5 +55,13 @@ public interface IBizDataChangeHandleStrategy {
batchCylinder 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; ...@@ -17,12 +17,12 @@ import java.util.Map;
* 批量维护气瓶-策略实现类 * 批量维护气瓶-策略实现类
*/ */
@Component @Component
public class BatchCylinderDataEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class BatchCylinderEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService; private final CommonEquipDataProcessService commonEquipDataProcessService;
public BatchCylinderDataEquipChangeProcess(CommonEquipDataProcessService commonEquipDataProcessService) { public BatchCylinderEquipChangeProcess(CommonEquipDataProcessService commonEquipDataProcessService) {
this.commonEquipDataProcessService = commonEquipDataProcessService; this.commonEquipDataProcessService = commonEquipDataProcessService;
} }
...@@ -55,11 +55,13 @@ public class BatchCylinderDataEquipChangeProcess implements IEquipChangeDataProc ...@@ -55,11 +55,13 @@ public class BatchCylinderDataEquipChangeProcess implements IEquipChangeDataProc
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class); EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class); EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.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, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理 // 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns); commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns);
} }
......
...@@ -55,11 +55,13 @@ public class BatchEquipDataEquipChangeProcess implements IEquipChangeDataProcess ...@@ -55,11 +55,13 @@ public class BatchEquipDataEquipChangeProcess implements IEquipChangeDataProcess
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class); EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class); EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(itemData, EquipDesignChangeDataDto.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, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理 // 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns); commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, itemData, allChangeColumns);
} }
......
...@@ -21,7 +21,7 @@ import java.util.Map; ...@@ -21,7 +21,7 @@ import java.util.Map;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class BatchProjectDataEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class BatchProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService; private final CommonEquipDataProcessService commonEquipDataProcessService;
......
...@@ -15,7 +15,10 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceIm ...@@ -15,7 +15,10 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceIm
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*; 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 lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -62,6 +65,8 @@ public class CommonEquipDataProcessService { ...@@ -62,6 +65,8 @@ public class CommonEquipDataProcessService {
private final List<String> jsonFields = new ArrayList<>(); private final List<String> jsonFields = new ArrayList<>();
private final IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
@PostConstruct @PostConstruct
public void init() { public void init() {
...@@ -89,7 +94,6 @@ public class CommonEquipDataProcessService { ...@@ -89,7 +94,6 @@ public class CommonEquipDataProcessService {
} }
public void checkValidField(String record, BaseChangeDataDto changeDataDto, String equList, String equCategory, String equDefine) { public void checkValidField(String record, BaseChangeDataDto changeDataDto, String equList, String equCategory, String equDefine) {
// 注册信息 // 注册信息
if (changeDataDto instanceof EquipRegisterChangeDataDto) { if (changeDataDto instanceof EquipRegisterChangeDataDto) {
...@@ -114,12 +118,12 @@ public class CommonEquipDataProcessService { ...@@ -114,12 +118,12 @@ public class CommonEquipDataProcessService {
List<ChangeDataDto> designInfoNew = this.buildDesignInfoNew(equipDesignChangeDataDto, record); List<ChangeDataDto> designInfoNew = this.buildDesignInfoNew(equipDesignChangeDataDto, record);
List<ChangeDataDto> factoryInfoNew = this.buildFactoryInfoNew(equipFactoryChangeDataDto, record); List<ChangeDataDto> factoryInfoNew = this.buildFactoryInfoNew(equipFactoryChangeDataDto, record);
List<ChangeDataDto> registerInfoNew = this.buildRegisterInfoNew(registerChangeDataDto, record); List<ChangeDataDto> registerInfoNew = this.buildRegisterInfoNew(registerChangeDataDto, record);
if(useInfoChangeDataDto != null) { if (useInfoChangeDataDto != null) {
List<ChangeDataDto> useInfoNew = this.convertBeanField2Column2(useInfoChangeDataDto, record); List<ChangeDataDto> useInfoNew = this.convertBeanField2Column2(useInfoChangeDataDto, record);
List<ChangeDataDto> useInfoOld = this.buildUseInfoOld(record); List<ChangeDataDto> useInfoOld = this.buildUseInfoOld(record);
allChangeColumns.addAll(this.mergeChangeFields(useInfoNew, useInfoOld)); allChangeColumns.addAll(this.mergeChangeFields(useInfoNew, useInfoOld));
} }
if(otherInfoChangeDataDto != null){ if (otherInfoChangeDataDto != null) {
List<ChangeDataDto> otherInfoNew = this.convertBeanField2Column2(otherInfoChangeDataDto, record); List<ChangeDataDto> otherInfoNew = this.convertBeanField2Column2(otherInfoChangeDataDto, record);
List<ChangeDataDto> otherInfoOld = this.buildOtherInfoOld(record); List<ChangeDataDto> otherInfoOld = this.buildOtherInfoOld(record);
allChangeColumns.addAll(this.mergeChangeFields(otherInfoNew, otherInfoOld)); allChangeColumns.addAll(this.mergeChangeFields(otherInfoNew, otherInfoOld));
...@@ -284,7 +288,7 @@ public class CommonEquipDataProcessService { ...@@ -284,7 +288,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> boilerChangeFields = this.mergeChangeFields(boilerChangeDataNew, boilerChangeDataOld); List<ChangeDataDto> boilerChangeFields = this.mergeChangeFields(boilerChangeDataNew, boilerChangeDataOld);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsBoilerChangeFieldDto.class), record, boilerChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsBoilerChangeFieldDto.class), record, boilerChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(boilerChangeDataNew); allChange.addAll(boilerChangeDataNew);
break; break;
...@@ -300,7 +304,7 @@ public class CommonEquipDataProcessService { ...@@ -300,7 +304,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> vesselChangeFields = this.mergeChangeFields(newVesselChangeData, oldVesselChangeData); List<ChangeDataDto> vesselChangeFields = this.mergeChangeFields(newVesselChangeData, oldVesselChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsVesselChangeFieldDto.class), record, vesselChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsVesselChangeFieldDto.class), record, vesselChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(vesselChangeFields); allChange.addAll(vesselChangeFields);
break; break;
...@@ -317,7 +321,7 @@ public class CommonEquipDataProcessService { ...@@ -317,7 +321,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> elevatorChangeFields = this.mergeChangeFields(newElevatorChangeData, oldElevatorChangeData); List<ChangeDataDto> elevatorChangeFields = this.mergeChangeFields(newElevatorChangeData, oldElevatorChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsElevatorChangeFieldDto.class), record, elevatorChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsElevatorChangeFieldDto.class), record, elevatorChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(elevatorChangeFields); allChange.addAll(elevatorChangeFields);
break; break;
...@@ -335,7 +339,7 @@ public class CommonEquipDataProcessService { ...@@ -335,7 +339,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> liftingChangeFields = this.mergeChangeFields(newLiftingChangeData, oldLiftingChangeData); List<ChangeDataDto> liftingChangeFields = this.mergeChangeFields(newLiftingChangeData, oldLiftingChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsLiftingChangeFieldDto.class), record, liftingChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsLiftingChangeFieldDto.class), record, liftingChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(liftingChangeFields); allChange.addAll(liftingChangeFields);
break; break;
...@@ -352,7 +356,7 @@ public class CommonEquipDataProcessService { ...@@ -352,7 +356,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> vehicleChangeFields = this.mergeChangeFields(newVehicleChangeData, oldVehicleChangeData); List<ChangeDataDto> vehicleChangeFields = this.mergeChangeFields(newVehicleChangeData, oldVehicleChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsVehicleChangeFieldDto.class), record, vehicleChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsVehicleChangeFieldDto.class), record, vehicleChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(vehicleChangeFields); allChange.addAll(vehicleChangeFields);
break; break;
...@@ -370,7 +374,7 @@ public class CommonEquipDataProcessService { ...@@ -370,7 +374,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> ridesChangeFields = this.mergeChangeFields(newRidesChangeData, oldRidesChangeData); List<ChangeDataDto> ridesChangeFields = this.mergeChangeFields(newRidesChangeData, oldRidesChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsRidesChangeFieldDto.class), record, ridesChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsRidesChangeFieldDto.class), record, ridesChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(ridesChangeFields); allChange.addAll(ridesChangeFields);
break; break;
...@@ -394,7 +398,7 @@ public class CommonEquipDataProcessService { ...@@ -394,7 +398,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> ropewayChangeFields = this.mergeChangeFields(newRopewayChangeData, oldRopewayChangeData); List<ChangeDataDto> ropewayChangeFields = this.mergeChangeFields(newRopewayChangeData, oldRopewayChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsRopewayChangeFieldDto.class), record, ropewayChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsRopewayChangeFieldDto.class), record, ropewayChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(ropewayChangeFields); allChange.addAll(ropewayChangeFields);
break; break;
...@@ -413,7 +417,7 @@ public class CommonEquipDataProcessService { ...@@ -413,7 +417,7 @@ public class CommonEquipDataProcessService {
// 比对 // 比对
List<ChangeDataDto> pipelineChangeFields = this.mergeChangeFields(newPipelineChangeData, oldPipelineChangeData); List<ChangeDataDto> pipelineChangeFields = this.mergeChangeFields(newPipelineChangeData, oldPipelineChangeData);
// 业务处理 // 业务处理
equipChangeDataUpdateService.updateTechParamByRecord(this.buildTableName(TechParamsPipelineChangeFieldDto.class), record, pipelineChangeFields); equipChangeDataUpdateServiceImpl.updateTechParamByRecord(this.buildTableName(TechParamsPipelineChangeFieldDto.class), record, pipelineChangeFields);
// 日志数据记录 // 日志数据记录
allChange.addAll(pipelineChangeFields); allChange.addAll(pipelineChangeFields);
} }
...@@ -493,7 +497,7 @@ public class CommonEquipDataProcessService { ...@@ -493,7 +497,7 @@ public class CommonEquipDataProcessService {
BeanUtil.copyProperties(useInfo, changeDataDto); BeanUtil.copyProperties(useInfo, changeDataDto);
return this.convertBeanField2Column2(changeDataDto, record); return this.convertBeanField2Column2(changeDataDto, record);
} }
public Map<String, Object> cast2UnderCase(Map<String, Object> re) { public Map<String, Object> cast2UnderCase(Map<String, Object> re) {
// 由于历史遗留问题,和前端保存统一,要转成大写下滑线驼峰 // 由于历史遗留问题,和前端保存统一,要转成大写下滑线驼峰
...@@ -542,10 +546,6 @@ public class CommonEquipDataProcessService { ...@@ -542,10 +546,6 @@ public class CommonEquipDataProcessService {
return changeDataDto; return changeDataDto;
} }
public void buildChangeFields(String record, EquipDesignChangeDataDto designChangeDataDto, EquipFactoryChangeDataDto factoryChangeDataDto, EquipRegisterChangeDataDto registerChangeDataDto, EquipInspectChangeDataDto inspectChangeDataDto, List<ChangeDataDto> allChangeColumns) {
this.buildChangeFields(record, designChangeDataDto, factoryChangeDataDto, registerChangeDataDto, allChangeColumns);
this.buildInspectChangeFields(record, inspectChangeDataDto, allChangeColumns);
}
public void buildInspectChangeFields(String record, EquipInspectChangeDataDto inspectChangeDataDto, List<ChangeDataDto> allChangeColumns) { public void buildInspectChangeFields(String record, EquipInspectChangeDataDto inspectChangeDataDto, List<ChangeDataDto> allChangeColumns) {
if (StringUtils.isNotEmpty(inspectChangeDataDto.getJySeq())) { if (StringUtils.isNotEmpty(inspectChangeDataDto.getJySeq())) {
...@@ -570,4 +570,11 @@ public class CommonEquipDataProcessService { ...@@ -570,4 +570,11 @@ public class CommonEquipDataProcessService {
return fields; return fields;
} }
private List<ChangeDataDto> buildOtherInfoOld(String record) {
EquipOtherInfoChangeDataDto changeDataDto = new EquipOtherInfoChangeDataDto();
IdxBizJgOtherInfo otherInfo = idxBizJgOtherInfoMapper.selectOne(new LambdaQueryWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getRecord, record));
BeanUtil.copyProperties(otherInfo, changeDataDto);
return this.convertBeanField2Column2(changeDataDto, record);
}
} }
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.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
...@@ -80,7 +80,7 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -80,7 +80,7 @@ public class EquipChangeDataUpdateServiceImpl {
updateWrapper.set(IdxBizJgDesignInfo::getAppraisalDate, equipDesignChangeDataDto.getAppraisalDate()); updateWrapper.set(IdxBizJgDesignInfo::getAppraisalDate, equipDesignChangeDataDto.getAppraisalDate());
updateWrapper.set(IdxBizJgDesignInfo::getDrawingDo, equipDesignChangeDataDto.getDrawingDo()); updateWrapper.set(IdxBizJgDesignInfo::getDrawingDo, equipDesignChangeDataDto.getDrawingDo());
updateWrapper.set(IdxBizJgDesignInfo::getDesignStandard, equipDesignChangeDataDto.getDesignStandard()); 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); idxBizJgDesignInfoMapper.update(null, updateWrapper);
} }
...@@ -154,10 +154,10 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -154,10 +154,10 @@ public class EquipChangeDataUpdateServiceImpl {
public void updateRegisterEsDataPieLine(ProjectContraptionChangeDataDto registerChangeDataDto) { public void updateRegisterEsDataPieLine(ProjectContraptionChangeDataDto registerChangeDataDto) {
// es 数据更新 // es 数据更新
List<ESEquipmentCategoryDto> pieLines = esEquipmentCategory.findAllByProjectContraptionId(registerChangeDataDto.getProjectContraptionId()); List<ESEquipmentCategoryDto> pieLines = esEquipmentCategory.findAllByProjectContraptionId(registerChangeDataDto.getProjectContraptionId());
for(ESEquipmentCategoryDto esEquipmentCategoryDto: pieLines) { for (ESEquipmentCategoryDto esEquipmentCategoryDto : pieLines) {
esEquipmentCategoryDto.setPROJECT_CONTRAPTION(registerChangeDataDto.getProjectContraption()); esEquipmentCategoryDto.setPROJECT_CONTRAPTION(registerChangeDataDto.getProjectContraption());
} }
if(!pieLines.isEmpty()){ if (!pieLines.isEmpty()) {
esEquipmentCategory.saveAll(pieLines); esEquipmentCategory.saveAll(pieLines);
} }
} }
......
...@@ -3,10 +3,7 @@ package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip; ...@@ -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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; 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.*;
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.entity.JgUseRegistration; 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.entity.JgUseRegistrationEq;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
...@@ -24,7 +21,7 @@ import java.util.Map; ...@@ -24,7 +21,7 @@ import java.util.Map;
* 单个维护设备-策略实现类 * 单个维护设备-策略实现类
*/ */
@Component @Component
public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final JgUseRegistrationServiceImpl useRegistrationService; private final JgUseRegistrationServiceImpl useRegistrationService;
...@@ -34,7 +31,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr ...@@ -34,7 +31,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
private final CommonEquipDataProcessService commonEquipDataProcessService; private final CommonEquipDataProcessService commonEquipDataProcessService;
public SingleEquipEquipChangeProcess(JgUseRegistrationServiceImpl useRegistrationService, JgUseRegistrationEqMapper jgRelationEquipMapper, CommonEquipDataProcessService commonEquipDataProcessService) { public SingleEquipChangeProcess(JgUseRegistrationServiceImpl useRegistrationService, JgUseRegistrationEqMapper jgRelationEquipMapper, CommonEquipDataProcessService commonEquipDataProcessService) {
this.useRegistrationService = useRegistrationService; this.useRegistrationService = useRegistrationService;
this.jgRelationEquipMapper = jgRelationEquipMapper; this.jgRelationEquipMapper = jgRelationEquipMapper;
this.commonEquipDataProcessService = commonEquipDataProcessService; this.commonEquipDataProcessService = commonEquipDataProcessService;
...@@ -49,7 +46,8 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr ...@@ -49,7 +46,8 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipRegisterChangeDataDto.class); EquipRegisterChangeDataDto registerChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipFactoryChangeDataDto.class); EquipFactoryChangeDataDto factoryChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = commonEquipDataProcessService.castMap2Bean(changeData, EquipDesignChangeDataDto.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, registerChangeDataDto, null, null, null);
commonEquipDataProcessService.checkValidField(record, factoryChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine()); commonEquipDataProcessService.checkValidField(record, factoryChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
...@@ -58,6 +56,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr ...@@ -58,6 +56,7 @@ public class SingleEquipEquipChangeProcess implements IEquipChangeDataProcessStr
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto); commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理 // 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, changeData, allChangeColumns); commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, changeData, allChangeColumns);
return allChangeColumns; return allChangeColumns;
......
...@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.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.DefaultBizDataChangeHandler;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy; import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
...@@ -23,7 +26,7 @@ import java.util.Map; ...@@ -23,7 +26,7 @@ import java.util.Map;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProcessStrategy { public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService; private final CommonEquipDataProcessService commonEquipDataProcessService;
...@@ -43,7 +46,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc ...@@ -43,7 +46,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc
if (items.size() != items.stream().map(TechParamsPipelineChangeFieldDto::getPipelineNumber).distinct().count()) { if (items.size() != items.stream().map(TechParamsPipelineChangeFieldDto::getPipelineNumber).distinct().count()) {
throw new BadRequest("同一工程装置下管道编号不能重复!"); throw new BadRequest("同一工程装置下管道编号不能重复!");
} }
if(deletedPieLines != null && !deletedPieLines.isEmpty()) { if (deletedPieLines != null && !deletedPieLines.isEmpty()) {
List<PipelineChangeItemDto> deletedPieLinesJavaList = deletedPieLines.toJavaList(PipelineChangeItemDto.class); List<PipelineChangeItemDto> deletedPieLinesJavaList = deletedPieLines.toJavaList(PipelineChangeItemDto.class);
pieLineDataChangeService.deletePieLineBatch(deletedPieLinesJavaList, allChangeColumns, defaultChangeId); pieLineDataChangeService.deletePieLineBatch(deletedPieLinesJavaList, allChangeColumns, defaultChangeId);
} }
...@@ -54,7 +57,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc ...@@ -54,7 +57,7 @@ public class SingleProjectDataEquipChangeProcess implements IEquipChangeDataProc
// 3.管道信息入库保存 // 3.管道信息入库保存
items.forEach(item -> { items.forEach(item -> {
String record = item.getRecord(); String record = item.getRecord();
if(record == null) { // 新增的管道逻辑 if (record == null) { // 新增的管道逻辑
pieLineDataChangeService.newPieLine(projectContraptionChangeDataDto.getProjectContraptionId(), item, allChangeColumns, defaultChangeId); pieLineDataChangeService.newPieLine(projectContraptionChangeDataDto.getProjectContraptionId(), item, allChangeColumns, defaultChangeId);
} else { // 更新逻辑 } 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