Commit e327f438 authored by tianyiming's avatar tianyiming

添加96333码唯一校验

parent b5722f2d
......@@ -41,10 +41,7 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
......@@ -126,6 +123,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private static final String MANAGE_TYPE = "manageType";
// 设备代码
private static final String EQU_CODE = "EQU_CODE";
// 96333识别码
private static final String CODE96333 = "CODE96333";
private static final String SEQUENCE_NBR = "SEQUENCE_NBR";
private static final String FACTORY_NUM = "FACTORY_NUM";
// 新增设备是否复制而来
......@@ -172,6 +171,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper;
@Autowired
OtherInfoMapper otherInfoMapper;
@Autowired
IIdxBizJgUseInfoService idxBizJgUseInfoService;
@Autowired
IIdxBizJgDesignInfoService iIdxBizJgDesignInfoService;
......@@ -307,6 +308,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
checkEquCodeUniqueness(equipmentInfoForm);
// 车用气瓶业务里面的 产品编号 校验唯一性(产品编号在车用气瓶范围内全局唯一)
checkFactoryNumUniqueness(equipmentInfoForm);
// 96333码 字段的唯一性校验
check96333Code(equipmentInfoForm);
} catch (Exception e) {
handleError(e, null);
}
......@@ -352,6 +355,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
throw new BadRequest("设备代码已存在,请重新输入!");
}
}
private void check96333Code(LinkedHashMap equipmentInfoForm) {
if(!ObjectUtils.isEmpty(equipmentInfoForm.get(CODE96333))){
// 根据96333码检查唯一性
LambdaQueryWrapper<OtherInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OtherInfo::getCode96333, equipmentInfoForm.get(CODE96333));
wrapper.ne(!ObjectUtils.isEmpty(equipmentInfoForm.get(SEQUENCE_NBR)), OtherInfo::getSequenceNbr, equipmentInfoForm.get(SEQUENCE_NBR));
Integer count = otherInfoMapper.selectCount(wrapper);
if (count > 0) {
throw new BadRequest("96333码已存在,请确认后重新输入!");
}
}
}
private void checkFactoryNumUniqueness(LinkedHashMap equipmentInfoForm) {
// 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一)
......
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