Commit 2b9f784c authored by 韩桐桐's avatar 韩桐桐

fix(jg):bug 24340 气瓶 校验制造单位统一信用代码与出场编码唯一

parent 28219b61
......@@ -118,11 +118,11 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
/**
* 查询出厂编码是否重复
* @param factoryNum 出厂编码
* @param sequenceNbr id
* @param record 设备record
* @return Integer
*/
Integer checkFactoryNumUnique(@Param("factoryNum") String factoryNum,
@Param("sequenceNbr") String sequenceNbr,
@Param("record") String record,
@Param("produceUnitCreditCode") String produceUnitCreditCode);
/**
......
......@@ -804,6 +804,9 @@
AND ibjfi."FACTORY_NUM" = #{factoryNum}
AND ibjfi."PRODUCE_UNIT_CREDIT_CODE" = #{produceUnitCreditCode}
AND joi.CLAIM_STATUS = '已认领'
<if test="record != null and record !=''">
AND ibjfi."RECORD" <![CDATA[ <> ]]> #{record}
</if>
</select>
<select id="useRegistrationCertificateAccountUnique" resultType="java.lang.Integer">
......
......@@ -13,7 +13,6 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.base.Joiner;
......@@ -24,6 +23,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.CodeGenerateDto;
......@@ -379,11 +379,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (paramMap == null) {
throw new IllegalArgumentException("参数Map不能为空");
}
String record = null;
LinkedHashMap equipmentClassForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_CLASS_FORM_ID));
LinkedHashMap equipmentInfoForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_INFO_FORM_ID));
LinkedHashMap equipmentParamsForm = (LinkedHashMap) checkAndCast(paramMap.get(EQUIP_PARAMS_FORM_ID));
String submitType = String.valueOf(paramMap.get("submitType"));
String record = (String) equipmentInfoForm.get(RECORD);
try {
// 设备代码 字段的唯一性校验
......@@ -393,9 +393,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 96333码 字段的唯一性校验
check96333Code(equipmentInfoForm);
// 气瓶 校验制造单位统一信用代码与出场编码唯一
if (equipmentInfoForm.get(EQU_LIST).equals("2000") && equipmentInfoForm.get(EQU_CATEGORY).equals("2300") && commonMapper.checkFactoryNumUnique(String.valueOf(equipmentInfoForm.get(FACTORY_NUM)), null, String.valueOf(equipmentInfoForm.get("PRODUCE_UNIT_CREDIT_CODE"))) > 0) {
throw new BadRequest("出厂编号/产品编码在该企业中已存在!");
}
checkFactoryNumUniqueWithGasCylinder(equipmentInfoForm, record);
} catch (Exception e) {
handleError(e, null);
}
......@@ -405,7 +403,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
boolean isManageType = (!ObjectUtils.isEmpty(manageType) && MANAGE_TYPE_UNIT.equals(manageType));
if (!isManageType) {
// 编辑校验
this.checkForEquipEdit(equipmentInfoForm.get(RECORD));
this.checkForEquipEdit(record);
}
// 操作类型
try {
......@@ -457,6 +455,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
private void checkFactoryNumUniqueWithGasCylinder(LinkedHashMap equipmentInfoForm, String record) {
if (equipmentInfoForm.get(EQU_LIST).equals("2000")
&& equipmentInfoForm.get(EQU_CATEGORY).equals("2300")
&& commonMapper.checkFactoryNumUnique(String.valueOf(equipmentInfoForm.get(FACTORY_NUM)), record, String.valueOf(equipmentInfoForm.get("PRODUCE_UNIT_CREDIT_CODE"))) > 0) {
throw new BadRequest("出厂编号/产品编码在该企业中已存在!");
}
}
private void checkFactoryNumUniqueness(LinkedHashMap equipmentInfoForm) {
// 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一)
Integer factoryNum = commonMapper.checkFactoryNumUniquenessForVehicleCylinder((String) equipmentInfoForm.get(FACTORY_NUM), (String) equipmentInfoForm.get(RECORD));
......@@ -484,10 +490,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
throw new BadRequest(e.getMessage());
}
private void checkForEquipEdit(Object record) {
private void checkForEquipEdit(String record) {
// 标识编辑
if (record != null) {
Integer inUseTime = commonService.countEquipInUseTimesForEdit(record.toString());
if (!ValidationUtil.isEmpty(record)) {
Integer inUseTime = commonService.countEquipInUseTimesForEdit(record);
if (inUseTime > 0) {
throw new BadRequest("此设备在被其他业务引用,不可编辑!");
}
......
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