From c4d996a265dee94f89cf1c7f5414043ed0898c46 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Thu, 31 Oct 2024 14:35:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=B4=E4=BF=AE=E5=BC=80?= =?UTF-8?q?=E5=8D=95=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E3=80=81=E8=BD=A6?= =?UTF-8?q?=E8=BE=86=E4=BF=A1=E6=81=AFID=E4=B8=8D=E5=9B=9E=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DlRepairTicketsServiceImpl.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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()); }