分销者修改调整
This commit is contained in:
parent
2d15dada61
commit
171bcec9e6
|
|
@ -4,6 +4,7 @@ import com.ghy.common.adapay.model.AnalyseItemEnum;
|
|||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.PlaceStatus;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.customer.domain.Customer;
|
||||
import com.ghy.customer.service.CustomerService;
|
||||
|
|
@ -164,18 +165,30 @@ 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());
|
||||
Customer curCustomer = customerService.selectByCustomerId(customer.getCustomerId());
|
||||
Customer placeCustomer = customerService.selectByCustomerId(customer.getCustomerPlace());
|
||||
if (curCustomer.getCustomerPlace() != null) {
|
||||
logger.info("消费者已存在分销人信息,customerId=" + curCustomer.getCustomerId());
|
||||
return AjaxResult.success("消费者已存在分销信息");
|
||||
}
|
||||
if (customer.getCustomerPlace() == customer.getCustomerId()) {
|
||||
logger.info("消费者id与父级分销人id相同,无效分销信息,customerId=" + lowerCustomer.getCustomerId());
|
||||
logger.info("消费者id与父级分销人id相同,无效分销信息,customerId=" + curCustomer.getCustomerId());
|
||||
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.setParentCustomerPlace(upperCustomer.getCustomerPlace());
|
||||
customer.setCustomerPlace(placeCustomer.getCustomerId());
|
||||
customer.setParentCustomerPlace(placeCustomer.getCustomerPlace());
|
||||
}
|
||||
customerService.updateCustomer(customer);
|
||||
return AjaxResult.success("更新消费者信息成功");
|
||||
|
|
|
|||
Loading…
Reference in New Issue