消费者分销信息更新加判断
This commit is contained in:
parent
c150b97111
commit
a50ccc7f1a
|
|
@ -57,9 +57,18 @@ public class CustomerController extends BaseController {
|
||||||
public AjaxResult updateCustomer(@RequestBody Customer customer){
|
public AjaxResult updateCustomer(@RequestBody Customer customer){
|
||||||
try {
|
try {
|
||||||
if (customer.getCustomerPlace() != null) {
|
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 upperCustomer = customerService.selectByCustomerId(customer.getCustomerPlace());
|
||||||
customer.setParentCustomerPlace(customerPlaceInfo.getCustomerPlace());
|
customer.setParentCustomerPlace(upperCustomer.getCustomerPlace());
|
||||||
}
|
}
|
||||||
customerService.updateCustomer(customer);
|
customerService.updateCustomer(customer);
|
||||||
return AjaxResult.success("更新消费者信息成功");
|
return AjaxResult.success("更新消费者信息成功");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue