Commit d1d2375a authored by suhuiguang's avatar suhuiguang

refactor(大编辑):代码重构

1.公共编辑接口 2.公共详情接口
parent 96b228a1
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import lombok.Data;
import java.io.Serializable;
@Data
public class BaseChangeDataDto implements Serializable {
public class BaseChangeDataDto implements Serializable, IBaseChangeData {
private String changeId;
}
......@@ -56,20 +56,20 @@ public class BizDataChangeController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/detail")
@ApiOperation(value = "编辑一级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<IPage<?>> getDetailV2(@RequestParam String applyNo,
@PathVariable String bizType,
@RequestParam DetailType type,
@RequestParam JSONObject searchParams) {
public ResponseModel<IPage<?>> getDetailV2(@ApiParam(value = "单据编号或者设备装置唯一标识") @RequestParam String applyNo,
@ApiParam(value = "业务类型") @PathVariable String bizType,
@ApiParam(value = "详情类型:设备、装置列表") @RequestParam DetailType type,
@ApiParam(value = "查询参数") @RequestParam JSONObject searchParams) {
return ResponseHelper.buildResponse(bizDataChangeService.queryDetail(applyNo, bizType, type, searchParams));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/sub-detail")
@ApiOperation(value = "编辑二级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<Map<String, ?>> getSubDetailV2(@RequestParam String bizId,
@RequestParam(required = false) String applyNo,
@RequestParam DetailType type,
@PathVariable String bizType) {
public ResponseModel<Map<String, ?>> getSubDetailV2(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId,
@ApiParam(value = "单据编号") @RequestParam(required = false) String applyNo,
@ApiParam(value = "详情类型:设备、装置") @RequestParam DetailType type,
@ApiParam(value = "业务类型") @PathVariable String bizType) {
return ResponseHelper.buildResponse(bizDataChangeService.querySubDetail(applyNo, bizId, bizType, type));
}
......@@ -89,8 +89,8 @@ public class BizDataChangeController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/change-logs")
@ApiOperation(value = "编辑二级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<IPage<?>> getChangeLogPage(@RequestParam String bizId,
@PathVariable String bizType) {
public ResponseModel<IPage<?>> getChangeLogPage(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId,
@ApiParam(required = true, value = "业务类型") @PathVariable String bizType) {
return ResponseHelper.buildResponse(bizDataChangeService.getChangeLogPage(bizId, bizType));
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.installNotice;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
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.process.biz.DefaultBizDataChangeHandler;
......@@ -20,7 +21,7 @@ public class InstallNoticeDataChangeHandler extends DefaultBizDataChangeHandler<
@Override
public String canHandleBizType() {
return "installationNotice";
return BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.name();
}
@Override
......
......@@ -63,8 +63,7 @@ public interface IBizDataChangeHandleStrategy {
*/
enum ModelType {
singleProject,
singleEquip,
singleCylinder
singleEquip
}
void doSave(String applyNo, ModelType model, Map<String, Object> changeData);
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
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.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController;
import com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent;
......@@ -31,7 +32,7 @@ public class UseRegisterDataChangeHandler extends DefaultBizDataChangeHandler<Ba
@Override
public String canHandleBizType() {
return "useRegistration";
return BusinessTypeEnum.JG_USAGE_REGISTRATION.name();
}
......
......@@ -29,6 +29,7 @@ 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.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -66,6 +67,7 @@ import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgCertificateRepl
@Component
@RequiredArgsConstructor
@Slf4j
@Getter
public class CommonEquipDataProcessService {
private final IdxBizJgDesignInfoMapper idxBizJgDesignInfoMapper;
......@@ -104,6 +106,7 @@ public class CommonEquipDataProcessService {
private final JgUseRegistrationServiceImpl jgUseRegistrationService;
@PostConstruct
public void init() {
Set<Class<? extends IBaseChangeData>> subClasses = getAllSubClasses();
......@@ -148,6 +151,24 @@ public class CommonEquipDataProcessService {
}
}
public void checkValidField2(String record, IBaseChangeData changeDataDto, String equList, String equCategory, String equDefine) {
// 注册信息
if (changeDataDto instanceof IdxBizJgRegisterInfo) {
IdxBizJgRegisterInfo registerChangeDataDto = (IdxBizJgRegisterInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.checkRegisterChangeData(record, registerChangeDataDto);
}
// 制造信息
if (changeDataDto instanceof IdxBizJgFactoryInfo) {
IdxBizJgFactoryInfo equipFactoryChangeDataDto = (IdxBizJgFactoryInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.checkFactoryChangeData(record, equipFactoryChangeDataDto, equList, equCategory, equDefine);
}
// 设计信息
if (changeDataDto instanceof IdxBizJgDesignInfo) {
IdxBizJgDesignInfo equipDesignChangeDataDto = (IdxBizJgDesignInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.checkDesignChangeData(record, equipDesignChangeDataDto);
}
}
public void buildChangeFields(String record, EquipDesignChangeDataDto equipDesignChangeDataDto, EquipFactoryChangeDataDto equipFactoryChangeDataDto, EquipRegisterChangeDataDto registerChangeDataDto, EquipOtherInfoChangeDataDto otherInfoChangeDataDto, EquipUseInfoChangeDataDto useInfoChangeDataDto, List<FieldChangeMeta> allChangeColumns) {
// 构造新对象行转列
......@@ -191,6 +212,7 @@ public class CommonEquipDataProcessService {
allChangeColumns.addAll(mergeChangeFields(useInfoChangeNew, useInfoOld));
}
/**
* 业务处理-业务对象
*
......@@ -319,8 +341,8 @@ public class CommonEquipDataProcessService {
}
void updateTechParamInfo(EquipRegisterChangeDataDto equipRegisterChangeDataDto, String record, Map<String, Object> changeData, List<FieldChangeMeta> allChange) {
EquipmentClassifityEnum equipmentClassifityEnum = EquipmentClassifityEnum.getOne(equipRegisterChangeDataDto.getEquList());
void updateTechParamInfo(String equListCode, String record, Map<String, Object> changeData, List<FieldChangeMeta> allChange) {
EquipmentClassifityEnum equipmentClassifityEnum = EquipmentClassifityEnum.getOne(equListCode);
switch (Objects.requireNonNull(equipmentClassifityEnum)) {
case GL:
// 锅炉
......@@ -861,4 +883,33 @@ public class CommonEquipDataProcessService {
}
return pageList;
}
public void updateEsDataOfEquip(String record, IBaseChangeData changeDataDto) {
// 注册信息
if (changeDataDto instanceof IdxBizJgRegisterInfo) {
IdxBizJgRegisterInfo registerChangeDataDto = (IdxBizJgRegisterInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.updateRegisterEsData(record, registerChangeDataDto);
}
// 制造信息
if (changeDataDto instanceof IdxBizJgFactoryInfo) {
IdxBizJgFactoryInfo equipFactoryChangeDataDto = (IdxBizJgFactoryInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.updateFactoryEsData(record, equipFactoryChangeDataDto);
}
// 设计信息
if (changeDataDto instanceof IdxBizJgDesignInfo) {
IdxBizJgDesignInfo equipDesignChangeDataDto = (IdxBizJgDesignInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.checkDesignChangeData(record, equipDesignChangeDataDto);
}
// 使用信息
if (changeDataDto instanceof IdxBizJgUseInfo) {
IdxBizJgUseInfo equipUseInfoChangeDataDto = (IdxBizJgUseInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.updateUseInfoEsData(record, equipUseInfoChangeDataDto);
}
// 检验信息
if (changeDataDto instanceof IdxBizJgInspectionDetectionInfo) {
IdxBizJgInspectionDetectionInfo equipUseInfoChangeDataDto = (IdxBizJgInspectionDetectionInfo) changeDataDto;
equipChangeDataUpdateServiceImpl.updateInspectInfoEs(record, equipUseInfoChangeDataDto);
}
}
}
......@@ -119,8 +119,52 @@ public class EquipChangeDataUpdateServiceImpl {
}
}
public void updateFactoryEsData(String record, IdxBizJgFactoryInfo equipFactoryChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCE_DATE(DateUtil.formatDate(equipFactoryChangeDataDto.getProduceDate()));
esEquipmentCategoryDto.setFACTORY_NUM(equipFactoryChangeDataDto.getFactoryNum());
esEquipmentCategoryDto.setPRODUCE_UNIT_NAME(equipFactoryChangeDataDto.getProduceUnitName());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateRegisterEsData(String record, EquipRegisterChangeDataDto registerChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setPRODUCT_NAME(registerChangeDataDto.getProductName());
esEquipmentCategoryDto.setEQU_CODE(registerChangeDataDto.getEquCode());
esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType());
esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory());
esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine());
// 冗余设备类别名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) {
esEquipmentCategoryDto.setEQU_CATEGORY(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquCategory());
if (category != null) {
esEquipmentCategoryDto.setEQU_CATEGORY(category.getName());
}
}
// 冗余设备品种名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquDefine())) {
esEquipmentCategoryDto.setEQU_DEFINE(null);
} else {
EquipmentCategory category = getEquipmentCategory(registerChangeDataDto.getEquDefine());
if (category != null) {
esEquipmentCategoryDto.setEQU_DEFINE(category.getName());
}
}
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
private void updateRegisterEsData(String record, EquipRegisterChangeDataDto registerChangeDataDto) {
public void updateRegisterEsData(String record, IdxBizJgRegisterInfo registerChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
......@@ -189,6 +233,16 @@ public class EquipChangeDataUpdateServiceImpl {
}
}
public void checkFactoryChangeData(String record, IdxBizJgFactoryInfo equipFactoryChangeDataDto, String equList, String equCategory, String equDefine) {
// 气瓶时检验出厂编号-普通气瓶,车用气瓶不再此范围内
if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) && StringUtils.isNotEmpty(equipFactoryChangeDataDto.getFactoryNum())) {
boolean isUsed = this.checkFactoryNumUnique(equipFactoryChangeDataDto.getFactoryNum(), record, equipFactoryChangeDataDto.getProduceUnitCreditCode());
if (isUsed) {
throw new BadRequest("出厂编号/产品编码在该企业中已存在!");
}
}
}
/**
* 普通气瓶检验-同制造单位下唯一
*
......@@ -211,6 +265,16 @@ public class EquipChangeDataUpdateServiceImpl {
}
}
public void checkRegisterChangeData(String record, IdxBizJgRegisterInfo registerChangeDataDto) {
// 自行输入时,检验设备代码的全局唯一性
if (registerChangeDataDto.getEquCodeType().equals(EquCodeTypeEnum.INPUT.getCode()) && StringUtils.isNotEmpty(registerChangeDataDto.getEquCode())) {
Boolean isUsed = this.checkEquCodeUniqueness(registerChangeDataDto.getEquCode(), record);
if (isUsed) {
throw new BadRequest("设备代码:" + registerChangeDataDto.getEquCode() + "在系统中已存在!");
}
}
}
private Boolean checkEquCodeUniqueness(String equCode, String record) {
// 根据设备代码检查唯一性
......@@ -220,6 +284,9 @@ public class EquipChangeDataUpdateServiceImpl {
public void checkDesignChangeData(String record, EquipDesignChangeDataDto equipDesignChangeDataDto) {
}
public void checkDesignChangeData(String record, IdxBizJgDesignInfo equipDesignChangeDataDto) {
}
public void updatePieLineDesignData(String record, PieLineDesignChangeDataDto equipDesignChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgDesignInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgDesignInfo::getRecord, record);
......@@ -238,6 +305,18 @@ public class EquipChangeDataUpdateServiceImpl {
this.updateUseInfoEsData(record, equipUseInfoChangeDataDto);
}
public void updateUseInfoEsData(String record, IdxBizJgUseInfo equipUseInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setUSE_UNIT_CREDIT_CODE(equipUseInfoChangeDataDto.getUseUnitCreditCode());
esEquipmentCategoryDto.setUSC_UNIT_NAME(equipUseInfoChangeDataDto.getUseUnitName());
esEquipmentCategoryDto.setUSE_INNER_CODE(equipUseInfoChangeDataDto.getUseInnerCode());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
private void updateUseInfoEsData(String record, EquipUseInfoChangeDataDto equipUseInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
......@@ -278,6 +357,16 @@ public class EquipChangeDataUpdateServiceImpl {
}
}
public void updateInspectInfoEs(String record, IdxBizJgInspectionDetectionInfo equipUseInfoChangeDataDto) {
// es 数据更新
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
esEquipmentCategoryDto.setNEXT_INSPECT_DATE(DateUtil.parse(DateUtil.format(equipUseInfoChangeDataDto.getNextInspectDate(), DatePattern.NORM_DATE_PATTERN)).getTime());
esEquipmentCategory.save(esEquipmentCategoryDto);
}
}
public void updateOtherInfoChangeData(String record, EquipOtherInfoChangeDataDto otherInfoChangeDataDto) {
LambdaUpdateWrapper<IdxBizJgOtherInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgOtherInfo::getRecord, record);
......
package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
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.equip.strategy.IEquipChangeDataProcessStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 批量维护气瓶-策略实现类
*/
@Component
@RequiredArgsConstructor
public class SingleCylinderChangeProcess implements IEquipChangeDataProcessStrategy {
private final CommonEquipDataProcessService commonEquipDataProcessService;
@Override
public List<FieldChangeMeta> handle(Map<String, Object> changeData, String record) {
List<FieldChangeMeta> allChangeColumns = new ArrayList<>();
// 新数据解析
EquipRegisterChangeDataDto registerChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipDesignChangeDataDto.class);
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());
commonEquipDataProcessService.checkValidField(record, designChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, changeData, allChangeColumns);
return allChangeColumns;
}
@Override
public IBizDataChangeHandleStrategy.ModelType canHandleMode() {
return DefaultBizDataChangeHandler.ModelType.singleCylinder;
}
}
package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
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.FieldChangeMeta;
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.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
......@@ -23,24 +27,97 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
@Override
public List<FieldChangeMeta> handle(Map<String, Object> changeData, String record) {
JSONObject changeJson = new JSONObject(changeData);
List<FieldChangeMeta> allChangeColumns = new ArrayList<>();
// 新数据解析
EquipRegisterChangeDataDto registerChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipRegisterChangeDataDto.class);
EquipFactoryChangeDataDto factoryChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipFactoryChangeDataDto.class);
EquipDesignChangeDataDto designChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, EquipDesignChangeDataDto.class);
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());
commonEquipDataProcessService.checkValidField(record, designChangeDataDto, registerChangeDataDto.getEquList(), registerChangeDataDto.getEquCategory(), registerChangeDataDto.getEquDefine());
IdxBizJgUseInfo useInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, record));
IdxBizJgUseInfo useInfoNew = BeanUtil.copyProperties(useInfoOld, IdxBizJgUseInfo.class);
BeanUtil.copyProperties(changeJson, useInfoNew);
useInfoNew.setSequenceNbr(useInfoOld.getSequenceNbr());
IdxBizJgRegisterInfo registerInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgRegisterInfoService().getOne(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, record));
IdxBizJgRegisterInfo registerInfoNew = BeanUtil.copyProperties(registerInfoOld, IdxBizJgRegisterInfo.class);
BeanUtil.copyProperties(changeJson, registerInfoNew);
registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr());
IdxBizJgFactoryInfo factoryInfoOld = commonEquipDataProcessService.getJgFactoryInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record));
IdxBizJgFactoryInfo factoryInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgFactoryInfo.class);
BeanUtil.copyProperties(changeJson, factoryInfoNew);
factoryInfoNew.setSequenceNbr(factoryInfoOld.getSequenceNbr());
IdxBizJgDesignInfo designInfoOld = commonEquipDataProcessService.getIdxBizJgDesignInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgDesignInfo>().eq(IdxBizJgDesignInfo::getRecord, record));
IdxBizJgDesignInfo designInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgDesignInfo.class);
BeanUtil.copyProperties(changeJson, designInfoNew);
designInfoNew.setSequenceNbr(designInfoOld.getSequenceNbr());
IdxBizJgOtherInfo otherInfoOld = commonEquipDataProcessService.getIdxBizJgOtherInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getRecord, record));
IdxBizJgOtherInfo otherInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgOtherInfo.class);
BeanUtil.copyProperties(changeJson, otherInfoNew);
otherInfoNew.setSequenceNbr(otherInfoOld.getSequenceNbr());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, record));
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgSupervisionInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgSupervisionInfoNew);
idxBizJgSupervisionInfoNew.setSequenceNbr(idxBizJgSupervisionInfoOld.getSequenceNbr());
String jySeq = changeJson.getString("jySeq");
String maintenanceSeq = changeJson.getString("maintenanceSeq");
String constructionInfoSeq = changeJson.getString("constructionInfoSeq");
if (jySeq != null) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getById(jySeq);
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoNew = BeanUtil.copyProperties(inspectionDetectionInfoOld, IdxBizJgInspectionDetectionInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgSupervisionInfoNew);
inspectionDetectionInfoNew.setSequenceNbr(inspectionDetectionInfoOld.getSequenceNbr());
List<FieldChangeMeta> inspectionFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getBaseMapper(), inspectionDetectionInfoOld, inspectionDetectionInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", inspectionDetectionInfoOld.getSequenceNbr());
allChangeColumns.addAll(inspectionFieldChangeMetas);
commonEquipDataProcessService.updateEsDataOfEquip(record, inspectionDetectionInfoNew);
}
if (maintenanceSeq != null) {
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgMaintenanceRecordInfoService().getById(maintenanceSeq);
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgMaintenanceRecordInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgMaintenanceRecordInfoNew);
idxBizJgMaintenanceRecordInfoNew.setSequenceNbr(idxBizJgMaintenanceRecordInfoOld.getSequenceNbr());
List<FieldChangeMeta> idxBizJgMaintenanceFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgMaintenanceRecordInfoService().getBaseMapper(), idxBizJgMaintenanceRecordInfoOld, idxBizJgMaintenanceRecordInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", idxBizJgMaintenanceRecordInfoOld.getSequenceNbr());
allChangeColumns.addAll(idxBizJgMaintenanceFieldChangeMetas);
}
if (constructionInfoSeq != null) {
IdxBizJgConstructionInfo constructionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getById(constructionInfoSeq);
IdxBizJgConstructionInfo constructionInfoNew = BeanUtil.copyProperties(constructionInfoOld, IdxBizJgConstructionInfo.class);
BeanUtil.copyProperties(changeJson, constructionInfoNew);
constructionInfoNew.setSequenceNbr(constructionInfoOld.getSequenceNbr());
List<FieldChangeMeta> constructionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getBaseMapper(), constructionInfoOld, constructionInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", constructionInfoOld.getSequenceNbr());
allChangeColumns.addAll(constructionInfoFieldChangeMetas);
}
// 前置校验、新数据解析
commonEquipDataProcessService.checkValidField2(record, registerInfoNew, null, null, null);
commonEquipDataProcessService.checkValidField2(record, factoryInfoNew, registerInfoNew.getEquList(), registerInfoNew.getEquCategory(), registerInfoNew.getEquDefine());
commonEquipDataProcessService.checkValidField2(record, designInfoNew, registerInfoNew.getEquList(), registerInfoNew.getEquCategory(), registerInfoNew.getEquDefine());
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService.dealBizDataForEquip(record, registerChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, factoryChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, designChangeDataDto);
commonEquipDataProcessService.dealBizDataForEquip(record, useInfoChangeDataDto);
List<FieldChangeMeta> useInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper(), useInfoOld, useInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(useInfoFieldChangeMetas);
List<FieldChangeMeta> registerInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgRegisterInfoService().getBaseMapper(), registerInfoOld, registerInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(registerInfoFieldChangeMetas);
List<FieldChangeMeta> factoryInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgFactoryInfoMapper(), factoryInfoOld, factoryInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(factoryInfoFieldChangeMetas);
List<FieldChangeMeta> designInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getIdxBizJgDesignInfoMapper(), designInfoOld, designInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(designInfoFieldChangeMetas);
List<FieldChangeMeta> otherInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getIdxBizJgOtherInfoMapper(), otherInfoOld, otherInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(otherInfoFieldChangeMetas);
List<FieldChangeMeta> idxBizJgSupervisionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper(), idxBizJgSupervisionInfoOld, idxBizJgSupervisionInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(idxBizJgSupervisionInfoFieldChangeMetas);
commonEquipDataProcessService.updateEsDataOfEquip(record, useInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, designInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, otherInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, factoryInfoNew);
// 设备技术参数入库处理
commonEquipDataProcessService.updateTechParamInfo(registerChangeDataDto, record, changeData, allChangeColumns);
commonEquipDataProcessService.updateTechParamInfo(registerInfoOld.getEquList(), record, changeData, allChangeColumns);
return allChangeColumns;
}
......
package com.yeejoin.amos.boot.module.ymt.api.entity;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -18,7 +22,8 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("idx_biz_jg_design_info")
public class IdxBizJgDesignInfo extends TzsBaseEntity {
@Group(value = "idx_biz_jg_design_info")
public class IdxBizJgDesignInfo extends TzsBaseEntity implements IBaseChangeData {
......@@ -44,72 +49,84 @@ public class IdxBizJgDesignInfo extends TzsBaseEntity {
*
*/
@TableField("\"DESIGN_UNIT_CREDIT_CODE\"")
@FieldDisplayDefine(value = "设计单位统一社会信用代码")
private String designUnitCreditCode;
/**
*
*/
@TableField("\"DESIGN_UNIT_NAME\"")
@FieldDisplayDefine(value = "设计单位名称")
private String designUnitName;
/**
*
*/
@TableField("\"DESIGN_LICENSE_NUM\"")
@FieldDisplayDefine(value = "设计许可编号")
private String designLicenseNum;
/**
*
*/
@TableField("\"DESIGN_USE_DATE\"")
@FieldDisplayDefine(value = "设计使用年限")
private String designUseDate;
/**
*
*/
@TableField("\"DESIGN_DATE\"")
@FieldDisplayDefine(value = "设计日期")
private Date designDate;
/**
*
*/
@TableField("\"DRAWING_DO\"")
@FieldDisplayDefine(value = "总图图号")
private String drawingDo;
/**
*
*/
@TableField("\"DESIGN_DOC\"")
@FieldDisplayDefine(value = "设计文件", type = JSON.class)
private String designDoc;
/**
*
*/
@TableField("\"APPRAISAL_UNIT\"")
@FieldDisplayDefine(value = "设计文件鉴定单位")
private String appraisalUnit;
/**
*
*/
@TableField("\"APPRAISAL_DATE\"")
@FieldDisplayDefine(value = "设计文件鉴定日期")
private String appraisalDate;
/**
*
*/
@TableField("\"DESIGN_STANDARD\"")
@FieldDisplayDefine(value = "设计规范", type = JSON.class)
private String designStandard;
/**
*其他附件
*/
@TableField("\"OTHER_ACCESSORIES_DES\"")
@FieldDisplayDefine(value = "其他附件", type = JSON.class)
private String otherAccessoriesDes;
/**
* 资料是否完整齐全:1-齐全;2-不齐全【历史无证设备需要】
*/
@TableField("\"DESIGN_IS_COMPLETE\"")
@FieldDisplayDefine(value = "设计资料是否完整齐全")
private String designIsComplete;
/**
......
......@@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -29,7 +30,7 @@ import java.util.Date;
@Accessors(chain = true)
@TableName("idx_biz_jg_factory_info")
@Group(value = "idx_biz_jg_factory_info")
public class IdxBizJgFactoryInfo extends TzsBaseEntity {
public class IdxBizJgFactoryInfo extends TzsBaseEntity implements IBaseChangeData {
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -19,7 +20,7 @@ import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("idx_biz_jg_other_info")
public class IdxBizJgOtherInfo extends TzsBaseEntity {
public class IdxBizJgOtherInfo extends TzsBaseEntity implements IBaseChangeData {
/**
*
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine;
import com.yeejoin.amos.boot.biz.common.annotation.Group;
import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -21,7 +22,7 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@TableName("idx_biz_jg_register_info")
@Group(value = "idx_biz_jg_register_info")
public class IdxBizJgRegisterInfo extends TzsBaseEntity {
public class IdxBizJgRegisterInfo extends TzsBaseEntity implements IBaseChangeData {
......
......@@ -11,29 +11,30 @@ import java.util.Map;
public enum EquipmentClassifityEnum {
/**
**设备分类
* *设备分类
*/
GL("锅炉","1000"),
YLRQ("压力容器","2000"),
DT("电梯","3000"),
QZJX("起重机械","4000"),
CC("场(厂)内专用机动车辆","5000"),
YLSS("大型游乐设施","6000"),
YLGDYJ("压力管道元件","7000"),
YLGD("压力管道","8000"),
KYSD("客运索道","9000"),
GL("锅炉", "1000"),
YLRQ("压力容器", "2000"),
DT("电梯", "3000"),
QZJX("起重机械", "4000"),
CC("场(厂)内专用机动车辆", "5000"),
YLSS("大型游乐设施", "6000"),
YLGDYJ("压力管道元件", "7000"),
YLGD("压力管道", "8000"),
KYSD("客运索道", "9000"),
//树类型
//设备认领状态
SBRLZT("设备认领状态","rlzt"),
BDLS("八大类树","eightCategory"),
RENLING("其他","other");
SBRLZT("设备认领状态", "rlzt"),
BDLS("八大类树", "eightCategory"),
RENLING("其他", "other");
private String name;
private String code;
public static Map<String,String> getName=new HashMap<>();
public static Map<String,String> getCode=new HashMap<>();
public static Map<String, String> getName = new HashMap<>();
public static Map<String, String> getCode = new HashMap<>();
static {
for (EquipmentClassifityEnum e : EquipmentClassifityEnum.values()){
for (EquipmentClassifityEnum e : EquipmentClassifityEnum.values()) {
getName.put(e.code, e.name);
getCode.put(e.name, e.code);
}
......@@ -41,18 +42,18 @@ public enum EquipmentClassifityEnum {
}
public static String getNameByCode(String code){
public static String getNameByCode(String code) {
for (EquipmentClassifityEnum value : EquipmentClassifityEnum.values()) {
if (value.getCode().equals(code)){
if (value.getCode().equals(code)) {
return value.getName();
}
}
return "";
}
public static EquipmentClassifityEnum getOne(String code){
public static EquipmentClassifityEnum getOne(String code) {
for (EquipmentClassifityEnum value : EquipmentClassifityEnum.values()) {
if (value.getCode().equals(code)){
if (value.getCode().equals(code)) {
return value;
}
}
......
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