Commit 9cc60269 authored by tianbo's avatar tianbo

feat(jg): 添加设备变更中的监管机构信息更新功能

- 新增对orgBranchName字段的监听和处理逻辑 - 实现了使用登记管理中的监管机构代码和名称同步更新
parent efb3e7df
......@@ -11,7 +11,7 @@ public class ChangeFieldWatchConstants {
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"equDefine", "equCode", "useInnerCode", "factoryNum",
"province", "city", "county", "street", "factoryUseSiteStreet", "address", "useOrgCode", "carNumber", "useRegistrationCode",
"receiveCompanyCode"
"receiveCompanyCode", "orgBranchName"
)));
/**
......
......@@ -18,9 +18,11 @@ import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServ
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationManageServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -30,6 +32,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.*;
......@@ -40,6 +43,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationManageServiceImpl.*;
import static org.apache.commons.lang3.StringUtils.defaultString;
......@@ -59,6 +63,7 @@ public class ChangeEquipImpactCertListener {
private final JgInstallationNoticeEqServiceImpl jgInstallationNoticeEqService;
private final IdxBizJgUseInfoMapper useInfoMapper;
private final IdxBizJgRegisterInfoMapper registerInfoMapper;
private final IdxBizJgSupervisionInfoMapper supervisionInfoMapper;
/**
* 事件监听:只把事件放入队列
......@@ -181,12 +186,21 @@ public class ChangeEquipImpactCertListener {
manage.setVolume(new BigDecimal(manage.getVolume())
.add(new BigDecimal(afterValue).subtract(new BigDecimal(beforeValue))).toPlainString());
break;
case "orgBranchName":
this.updateUseRegistrationManagement(manage, meta.getChangeId());
default:
log.warn("未处理的USE_CERT字段:[{}]", columnKey);
break;
}
}
private void updateUseRegistrationManagement(JgUseRegistrationManage manage, Object changeId) {
LambdaQueryWrapper<IdxBizJgSupervisionInfo> lambda = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda().select(IdxBizJgSupervisionInfo::getOrgBranchCode, IdxBizJgSupervisionInfo::getOrgBranchName).eq(IdxBizJgSupervisionInfo::getRecord, changeId);
IdxBizJgSupervisionInfo supervisionInfo = supervisionInfoMapper.selectOne(lambda);
manage.setSuperviseOrgCode(supervisionInfo.getOrgBranchCode());
manage.setSuperviseOrgName(supervisionInfo.getOrgBranchName());
}
private void updateEquUseAddressByChangeId(JgUseRegistrationManage manage, Object changeId) {
LambdaQueryWrapper<IdxBizJgUseInfo> lambda = new QueryWrapper<IdxBizJgUseInfo>().lambda();
lambda.eq(IdxBizJgUseInfo::getRecord, String.valueOf(changeId));
......
......@@ -102,7 +102,7 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
// 基本信息-特殊管道的使用信息变化更新但是不记录变更流水
this.updateUseInfo(pipelineNew, projectContraptionChangeDataDto, allChangeColumns);
// 更新管道的使用登记证编号
this.updateRegisterInfo(record, projectContraptionChangeDataDto);
this.updateRegisterInfo(record, projectContraptionChangeDataDto, pipelineNew);
// 安装信息
this.updateConstructionInfo(pipelineNew, projectContraptionChangeDataDto, allChangeColumns);
// 检验信息
......@@ -139,11 +139,12 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
commonEquipDataProcessService.getSuperviseInfoMapper().update(null, updateWrapper);
}
private void updateRegisterInfo(String record, ProjectContraptionChangeDataDto projectContraptionChangeDataDto) {
private void updateRegisterInfo(String record, ProjectContraptionChangeDataDto projectContraptionChangeDataDto, PipelineChangeItemDto pipelineNew) {
// 管道不记录使用信息变化,使用信息的变化已装置来体现
LambdaUpdateWrapper<IdxBizJgRegisterInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgRegisterInfo::getRecord, record);
updateWrapper.set(IdxBizJgRegisterInfo::getUseOrgCode, projectContraptionChangeDataDto.getUseRegistrationCode());
updateWrapper.set(IdxBizJgRegisterInfo::getProductName, pipelineNew.getPipeName());
idxBizJgRegisterInfoServiceImpl.update(updateWrapper);
}
......
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