Commit f6cab0c1 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents c93dc05c d7c100f1
...@@ -90,7 +90,7 @@ public class BizDataChangeController extends BaseController { ...@@ -90,7 +90,7 @@ public class BizDataChangeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/change-logs") @GetMapping(value = "/v2/{bizType}/change-logs")
@ApiOperation(value = "编辑级页面详情查询--通用", httpMethod = "GET") @ApiOperation(value = "编辑级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<IPage<?>> getChangeLogPage(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId, public ResponseModel<IPage<?>> getChangeLogPage(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId,
@ApiParam(required = true, value = "业务类型") @PathVariable String bizType, @ApiParam(required = true, value = "业务类型") @PathVariable String bizType,
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
......
...@@ -33,7 +33,6 @@ public class FillingCompanyTypeForCurrentUser extends BaseUseRegisterResultData ...@@ -33,7 +33,6 @@ public class FillingCompanyTypeForCurrentUser extends BaseUseRegisterResultData
} else { } else {
jsonObject.put(COMPANY_TYPE, BaseController.COMPANY_TYPE_SUPERVISION); jsonObject.put(COMPANY_TYPE, BaseController.COMPANY_TYPE_SUPERVISION);
} }
} }
} }
...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData; ...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum; import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl; import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl;
...@@ -107,6 +108,8 @@ public class CommonEquipDataProcessService { ...@@ -107,6 +108,8 @@ public class CommonEquipDataProcessService {
private final JgUseRegistrationServiceImpl jgUseRegistrationService; private final JgUseRegistrationServiceImpl jgUseRegistrationService;
private final CommonServiceImpl commonService;
public static final String BASE_COLUMN_REC_DATE = "\"REC_DATE\""; public static final String BASE_COLUMN_REC_DATE = "\"REC_DATE\"";
public static final String BASE_COLUMN_REC_USERID = "\"REC_USER_ID\""; public static final String BASE_COLUMN_REC_USERID = "\"REC_USER_ID\"";
......
...@@ -174,6 +174,7 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -174,6 +174,7 @@ public class EquipChangeDataUpdateServiceImpl {
esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType()); esEquipmentCategoryDto.setEQU_TYPE(registerChangeDataDto.getEquType());
esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory()); esEquipmentCategoryDto.setEQU_CATEGORY_CODE(registerChangeDataDto.getEquCategory());
esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine()); esEquipmentCategoryDto.setEQU_DEFINE_CODE(registerChangeDataDto.getEquDefine());
esEquipmentCategoryDto.setUSE_ORG_CODE(registerChangeDataDto.getUseOrgCode());
// 冗余设备类别名称 // 冗余设备类别名称
if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) { if (StringUtils.isEmpty(registerChangeDataDto.getEquCategory())) {
esEquipmentCategoryDto.setEQU_CATEGORY(null); esEquipmentCategoryDto.setEQU_CATEGORY(null);
......
...@@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,12 +4,16 @@ 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.FieldChangeMeta; import com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta;
import com.yeejoin.amos.boot.module.jg.api.enums.CylinderTypeEnum;
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;
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 com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -40,6 +44,9 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -40,6 +44,9 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
CommonEquipDataProcessService.castMap2Bean(changeJson, registerInfoNew); CommonEquipDataProcessService.castMap2Bean(changeJson, registerInfoNew);
registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr()); registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr());
// 历史有证设备检验(台套类设备+气瓶)
beforeCheckForUseOrgCode(useInfoOld, registerInfoNew);
IdxBizJgFactoryInfo factoryInfoOld = commonEquipDataProcessService.getJgFactoryInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record)); IdxBizJgFactoryInfo factoryInfoOld = commonEquipDataProcessService.getJgFactoryInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record));
IdxBizJgFactoryInfo factoryInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgFactoryInfo.class); IdxBizJgFactoryInfo factoryInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgFactoryInfo.class);
CommonEquipDataProcessService.castMap2Bean(changeJson, factoryInfoNew); CommonEquipDataProcessService.castMap2Bean(changeJson, factoryInfoNew);
...@@ -54,7 +61,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -54,7 +61,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
IdxBizJgOtherInfo otherInfoNew = BeanUtil.copyProperties(otherInfoOld, IdxBizJgOtherInfo.class); IdxBizJgOtherInfo otherInfoNew = BeanUtil.copyProperties(otherInfoOld, IdxBizJgOtherInfo.class);
CommonEquipDataProcessService.castMap2Bean(changeJson, otherInfoNew); CommonEquipDataProcessService.castMap2Bean(changeJson, otherInfoNew);
otherInfoNew.setSequenceNbr(otherInfoOld.getSequenceNbr()); otherInfoNew.setSequenceNbr(otherInfoOld.getSequenceNbr());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, record)); IdxBizJgSupervisionInfo idxBizJgSupervisionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, record));
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoNew = BeanUtil.copyProperties(idxBizJgSupervisionInfoOld, IdxBizJgSupervisionInfo.class); IdxBizJgSupervisionInfo idxBizJgSupervisionInfoNew = BeanUtil.copyProperties(idxBizJgSupervisionInfoOld, IdxBizJgSupervisionInfo.class);
CommonEquipDataProcessService.castMap2Bean(changeJson, idxBizJgSupervisionInfoNew); CommonEquipDataProcessService.castMap2Bean(changeJson, idxBizJgSupervisionInfoNew);
...@@ -112,6 +119,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -112,6 +119,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
List<FieldChangeMeta> idxBizJgSupervisionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper(), idxBizJgSupervisionInfoOld, idxBizJgSupervisionInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord()); List<FieldChangeMeta> idxBizJgSupervisionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper(), idxBizJgSupervisionInfoOld, idxBizJgSupervisionInfoNew, useInfoNew.getRecord(), "record", useInfoNew.getRecord());
allChangeColumns.addAll(idxBizJgSupervisionInfoFieldChangeMetas); allChangeColumns.addAll(idxBizJgSupervisionInfoFieldChangeMetas);
commonEquipDataProcessService.updateEsDataOfEquip(record, registerInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, useInfoNew); commonEquipDataProcessService.updateEsDataOfEquip(record, useInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, designInfoNew); commonEquipDataProcessService.updateEsDataOfEquip(record, designInfoNew);
commonEquipDataProcessService.updateEsDataOfEquip(record, otherInfoNew); commonEquipDataProcessService.updateEsDataOfEquip(record, otherInfoNew);
...@@ -121,6 +129,29 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -121,6 +129,29 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
return allChangeColumns; return allChangeColumns;
} }
private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) {
// 1.使用登记证编辑时重复性校验
if (!CylinderTypeEnum.CYLINDER.getCode().equals(registerInfoNew.getEquCategory())) { // 非气瓶逻辑,所有设备不能重复
if(useInfoOld.getDataSource().equals("jg_his") && StringUtils.isNotEmpty(registerInfoNew.getUseOrgCode())) {
Boolean isUsed = commonEquipDataProcessService.getCommonService().useRegistrationCertificateAccountUnique(registerInfoNew.getUseOrgCode(), useInfoOld.getRecord());
if(isUsed){
throw new BadRequest("使用登记证编号已存在!");
}
}
} else { // 气瓶逻辑,使用单位下不能重复
if (StringUtils.isNotEmpty(useInfoOld.getUseUnitCreditCode())) {
// 需求 35094 历史设备(有使用登记证)需按证录入。录入时先录入使用登记证编号。
// 需验证录入的使用登记证编号平台是否跟当前用户(使用单位类型)一致,如跟当前用户不一致,系统给出提示“该使用登记证编号”已被“单位名称“使用”,请确认后再录入”。
// 历史设备不限制使用登记证编号在一个单位重复录入,但需验证使用登记证编号+单位内编号唯一。(下面方法checkFactoryNumUniqueWithGasCylinder中已经校验)
String occupiedUseUnitName = commonEquipDataProcessService.getCommonService().isRegistrationNumberUsedByOtherUnits(registerInfoNew.getUseOrgCode(), useInfoOld.getUseUnitCreditCode());
if (!ValidationUtil.isEmpty(occupiedUseUnitName)) {
throw new BadRequest("该使用登记证编号已被【" + occupiedUseUnitName + "】使用,请确认后再录入!");
}
}
}
}
@Override @Override
public IBizDataChangeHandleStrategy.ModelType canHandleMode() { public IBizDataChangeHandleStrategy.ModelType canHandleMode() {
return DefaultBizDataChangeHandler.ModelType.singleEquip; return DefaultBizDataChangeHandler.ModelType.singleEquip;
......
...@@ -3015,10 +3015,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -3015,10 +3015,7 @@ public class CommonServiceImpl implements ICommonService {
*/ */
public Boolean useRegistrationCertificateAccountUnique(String useRegistrationCode, String equipId) { public Boolean useRegistrationCertificateAccountUnique(String useRegistrationCode, String equipId) {
Integer count = commonMapper.useRegistrationCertificateAccountUnique(useRegistrationCode, equipId); Integer count = commonMapper.useRegistrationCertificateAccountUnique(useRegistrationCode, equipId);
if (count > 0) { return count > 0;
return true;
}
return false;
} }
/** /**
...@@ -3037,6 +3034,17 @@ public class CommonServiceImpl implements ICommonService { ...@@ -3037,6 +3034,17 @@ public class CommonServiceImpl implements ICommonService {
} }
/** /**
* 判断使用登记证编号是否被其他单位使用
* @param useRegistrationCode 使用登记证编号
* @param companyCode 使用登记证所在单位编码
* @return 使用的单位
*/
public String isRegistrationNumberUsedByOtherUnits(String useRegistrationCode, String companyCode) {
String companyCodeReal = companyCode.contains("_") ? companyCode.split("_")[1] : companyCode;
return commonMapper.isRegistrationNumberUsedByOtherUnits(useRegistrationCode, companyCodeReal);
}
/**
* 根据单位ID查询单位的信用代码及名称 * 根据单位ID查询单位的信用代码及名称
* @param unitSeq 单位seq * @param unitSeq 单位seq
* @return 单位信用代码_单位名称 * @return 单位信用代码_单位名称
......
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