diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index a89228f6..247cae51 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -437,13 +437,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = customerService.list(new LambdaQueryWrapper().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber())); + if (CollectionUtil.isNotEmpty(list)){ + throw exception0(500, "电话号码重复"); + } customerService.save(customerAndCarVO.getUserInfo()); + // 如果新增了数据,id没有回填 + if (ObjectUtil.isEmpty(customerAndCarVO.getUserInfo().getId())){ + CustomerMain byPhoneNumber = customerService.getOne(new LambdaQueryWrapper().eq(CustomerMain::getPhoneNumber, customerAndCarVO.getUserInfo().getPhoneNumber())); + customerAndCarVO.getUserInfo().setId(byPhoneNumber.getId()); + } } else { customerService.updateById(customerAndCarVO.getUserInfo()); } @@ -452,7 +467,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl list = carMainService.list(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber())); + if (CollectionUtil.isNotEmpty(list)){ + throw exception0(500, "车牌重复"); + } carMainService.createCarMain(customerAndCarVO.getCarInfo()); + // 如果新增了数据,id没有回填 + if (ObjectUtil.isEmpty(customerAndCarVO.getCarInfo().getId())){ + CarMain byLicenseNumber = carMainService.getOne(new LambdaQueryWrapper().eq(CarMain::getLicenseNumber, customerAndCarVO.getCarInfo().getLicenseNumber())); + customerAndCarVO.getCarInfo().setId(byLicenseNumber.getId()); + } } else { carMainService.updateCarMain(customerAndCarVO.getCarInfo()); }