Commit fd2ac89b authored by 韩桐桐's avatar 韩桐桐

fix(jg): 车用气瓶历史设备登记限制一证多设备分批次登记情况

parent f2bf67b4
...@@ -1768,6 +1768,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1768,6 +1768,8 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
public List<JgVehicleInformation> saveOrUpdateHisData(JSONObject map) { public List<JgVehicleInformation> saveOrUpdateHisData(JSONObject map) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
CompanyBo company = reginParams.getCompany();
// 使用登记证编号 // 使用登记证编号
String useRegistrationCode = String.valueOf(map.get("useRegistrationCode")).trim(); String useRegistrationCode = String.valueOf(map.get("useRegistrationCode")).trim();
// 车辆VIN码 // 车辆VIN码
...@@ -1795,17 +1797,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1795,17 +1797,11 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
}) })
.orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!")); .orElseThrow(() -> new BadRequest("使用登记证号、车辆VIN码与所选设备不一致,请重新选择设备!"));
// 校验使用登记证编号的唯一性 ====> 20241202 任务ID 32776 将校验前置到了新增历史设备阶段
// Boolean used = commonService.useRegistrationCertificateAccountUnique(useRegistrationCode, equipId);
// if (used){
// throw new BadRequest("使用登记证编号已存在!");
// }
// 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来 // 检测是否三环系统中的车用气瓶数据 不让三环系统数据通过设备新增方式进来
// this.checkIsSanSystemHanData(map); // this.checkIsSanSystemHanData(map);
//使用登记证编号判断是否使用未来系统生成编号 //使用登记证编号判断是否使用未来系统生成编号
idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode, "vehicle"); idxBizJgRegisterInfoService.checkUseRegistrationCode(useRegistrationCode, "vehicle");
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())) + "", ReginParams.class);
JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class); JgVehicleInformationDto vehicleInfoDto = JSON.parseObject(JSON.toJSONString(map), JgVehicleInformationDto.class);
List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo( List<IdxBizJgInspectionDetectionInfo> inspectionDetectionInfoList = idxBizJgInspectionDetectionInfoService.checkInspectionInfo(
...@@ -1825,8 +1821,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1825,8 +1821,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
.filter(Objects::nonNull) .filter(Objects::nonNull)
.min(Date::compareTo) .min(Date::compareTo)
.orElse(null)); .orElse(null));
CompanyBo company = reginParams.getCompany();
vehicleInfoDto.setCreateDate(new Date()); vehicleInfoDto.setCreateDate(new Date());
vehicleInfoDto.setPromoter(reginParams.getUserModel().getUserId()); vehicleInfoDto.setPromoter(reginParams.getUserModel().getUserId());
...@@ -1844,14 +1838,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -1844,14 +1838,31 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
// 【A109】 车用气瓶登记业务 车辆VIN码 校验唯一性 // 【A109】 车用气瓶登记业务 车辆VIN码 校验唯一性
LambdaQueryWrapper<JgVehicleInformation> informationLambdaQueryWrapper = new LambdaQueryWrapper<JgVehicleInformation>() LambdaQueryWrapper<JgVehicleInformation> informationLambdaQueryWrapper = new LambdaQueryWrapper<JgVehicleInformation>()
.select(JgVehicleInformation::getUseUnitCreditCode)
.eq(JgVehicleInformation::getIdentificationCode, vehicleInfoDto.getIdentificationCode()) .eq(JgVehicleInformation::getIdentificationCode, vehicleInfoDto.getIdentificationCode())
.eq(JgVehicleInformation::getIsDelete, false) .eq(JgVehicleInformation::getIsDelete, false)
.ne(JgVehicleInformation::getStatus, "已作废") .ne(JgVehicleInformation::getStatus, "已作废")
.ne(JgVehicleInformation::getStatus, "使用单位待提交") .ne(JgVehicleInformation::getStatus, "使用单位待提交")
.ne(!ValidationUtil.isEmpty(vehicleInfoDto.getSequenceNbr()), JgVehicleInformation::getSequenceNbr, vehicleInfoDto.getSequenceNbr()); .ne(!ValidationUtil.isEmpty(vehicleInfoDto.getSequenceNbr()), JgVehicleInformation::getSequenceNbr, vehicleInfoDto.getSequenceNbr());
Integer identificationCodeCount = this.baseMapper.selectCount(informationLambdaQueryWrapper); List<JgVehicleInformation> vehicleInfoVINs = this.baseMapper.selectList(informationLambdaQueryWrapper);
if (identificationCodeCount > 0) { if (!vehicleInfoVINs.isEmpty()) {
throw new BadRequest("车辆VIN码已存在,请重新输入!"); String companyCode = company.getCompanyCode();
String errMsg = JSON.toJSONString(vehicleInfoVINs).contains(companyCode) ? "已经发起过相同车辆VIN码的历史登记,不支持重复发起!" : "车辆VIN码已存在,请重新输入!";
throw new BadRequest(errMsg);
}
// 车用气瓶登记业务 使用登记证 校验唯一性
LambdaQueryWrapper<JgVehicleInformation> vehicleInformationLambdaQueryWrapper = new LambdaQueryWrapper<JgVehicleInformation>()
.select(JgVehicleInformation::getUseUnitCreditCode)
.eq(JgVehicleInformation::getUseRegistrationCode, vehicleInfoDto.getUseRegistrationCode())
.eq(JgVehicleInformation::getIsDelete, false)
.ne(JgVehicleInformation::getStatus, "已作废")
.ne(JgVehicleInformation::getStatus, "使用单位待提交")
.ne(!ValidationUtil.isEmpty(vehicleInfoDto.getSequenceNbr()), JgVehicleInformation::getSequenceNbr, vehicleInfoDto.getSequenceNbr());
List<JgVehicleInformation> vehicleInfoUseRegs = this.baseMapper.selectList(vehicleInformationLambdaQueryWrapper);
if (!vehicleInfoUseRegs.isEmpty()) {
String companyCode = company.getCompanyCode();
String errMsg = JSON.toJSONString(vehicleInfoUseRegs).contains(companyCode) ? "已经发起过相同使用登记证号的历史登记,不支持重复发起!" : "车辆VIN码已存在,请重新输入!";
throw new BadRequest(errMsg);
} }
// 使用单位信息 // 使用单位信息
......
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