Merge branch 'master' of https://gitee.com/op-souls/ghy-all
This commit is contained in:
commit
5371b43766
|
|
@ -4,6 +4,7 @@ import com.ghy.common.adapay.model.AnalyseItemEnum;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.common.core.page.TableDataInfo;
|
import com.ghy.common.core.page.TableDataInfo;
|
||||||
|
import com.ghy.common.enums.PlaceStatus;
|
||||||
import com.ghy.common.utils.ExceptionUtil;
|
import com.ghy.common.utils.ExceptionUtil;
|
||||||
import com.ghy.customer.domain.Customer;
|
import com.ghy.customer.domain.Customer;
|
||||||
import com.ghy.customer.service.CustomerService;
|
import com.ghy.customer.service.CustomerService;
|
||||||
|
|
@ -164,18 +165,30 @@ 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());
|
Customer curCustomer = customerService.selectByCustomerId(customer.getCustomerId());
|
||||||
if (lowerCustomer.getCustomerPlace() != null) {
|
Customer placeCustomer = customerService.selectByCustomerId(customer.getCustomerPlace());
|
||||||
logger.info("消费者已存在分销人信息,customerId=" + lowerCustomer.getCustomerId());
|
if (curCustomer.getCustomerPlace() != null) {
|
||||||
|
logger.info("消费者已存在分销人信息,customerId=" + curCustomer.getCustomerId());
|
||||||
return AjaxResult.success("消费者已存在分销信息");
|
return AjaxResult.success("消费者已存在分销信息");
|
||||||
}
|
}
|
||||||
if (customer.getCustomerPlace() == customer.getCustomerId()) {
|
if (customer.getCustomerPlace() == customer.getCustomerId()) {
|
||||||
logger.info("消费者id与父级分销人id相同,无效分销信息,customerId=" + lowerCustomer.getCustomerId());
|
logger.info("消费者id与父级分销人id相同,无效分销信息,customerId=" + curCustomer.getCustomerId());
|
||||||
return AjaxResult.success("无效分销信息");
|
return AjaxResult.success("无效分销信息");
|
||||||
}
|
}
|
||||||
|
logger.info("开始查找有效分销者");
|
||||||
|
if (!PlaceStatus.CAN_PLACE.getCode().equals(placeCustomer.getPlaceStatus())) {
|
||||||
|
// 当前placeCustomer未通过分销资格审核,查找再上一级分销者
|
||||||
|
if (placeCustomer.getCustomerPlace() == null) {
|
||||||
|
logger.info("无有效上级分销者");
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
placeCustomer = customerService.selectByCustomerId(placeCustomer.getCustomerPlace());
|
||||||
|
logger.info("存在有效上级分销者:" + placeCustomer.getCustomerId());
|
||||||
|
}
|
||||||
|
}
|
||||||
// 更新父级分销人时需要查询是否有祖父分销人,并进行同步更新
|
// 更新父级分销人时需要查询是否有祖父分销人,并进行同步更新
|
||||||
Customer upperCustomer = customerService.selectByCustomerId(customer.getCustomerPlace());
|
customer.setCustomerPlace(placeCustomer.getCustomerId());
|
||||||
customer.setParentCustomerPlace(upperCustomer.getCustomerPlace());
|
customer.setParentCustomerPlace(placeCustomer.getCustomerPlace());
|
||||||
}
|
}
|
||||||
customerService.updateCustomer(customer);
|
customerService.updateCustomer(customer);
|
||||||
return AjaxResult.success("更新消费者信息成功");
|
return AjaxResult.success("更新消费者信息成功");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue