From a50ccc7f1a8db677453a64a8ab573879e0642845 Mon Sep 17 00:00:00 2001 From: donqi Date: Thu, 14 Jul 2022 16:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E8=B4=B9=E8=80=85=E5=88=86=E9=94=80?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=96=B0=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/customer/CustomerController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java index 56727927..b5040b27 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerController.java @@ -57,9 +57,18 @@ public class CustomerController extends BaseController { public AjaxResult updateCustomer(@RequestBody Customer customer){ try { if (customer.getCustomerPlace() != null) { + Customer lowerCustomer = customerService.selectByCustomerId(customer.getCustomerId()); + if (lowerCustomer.getCustomerPlace() != null) { + logger.info("消费者已存在分销人信息,customerId=" + lowerCustomer.getCustomerId()); + return AjaxResult.success("消费者已存在分销信息"); + } + if (customer.getCustomerPlace() == customer.getCustomerId()) { + logger.info("消费者id与父级分销人id相同,无效分销信息,customerId=" + lowerCustomer.getCustomerId()); + return AjaxResult.success("无效分销信息"); + } // 更新父级分销人时需要查询是否有祖父分销人,并进行同步更新 - Customer customerPlaceInfo = customerService.selectByCustomerId(customer.getCustomerPlace()); - customer.setParentCustomerPlace(customerPlaceInfo.getCustomerPlace()); + Customer upperCustomer = customerService.selectByCustomerId(customer.getCustomerPlace()); + customer.setParentCustomerPlace(upperCustomer.getCustomerPlace()); } customerService.updateCustomer(customer); return AjaxResult.success("更新消费者信息成功");