diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java index 2aedb852..45216d6f 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java @@ -70,6 +70,11 @@ public class CustomerSelectionController extends BaseController @ResponseBody public AjaxResult listNoPage(@RequestBody CustomerSelection customerSelection) { + // 判断是否有上级,有上级则取上级的 -- 没有则就是自身 + Customer customer = customerService.selectByCustomerId(customerSelection.getCustomerId()); + if(customer.getPlaceStatus() != 2 && customer.getCustomerPlace() != null){ + customerSelection.setCustomerId(customer.getCustomerPlace()); + } List list = customerSelectionService.selectCustomerSelectionList(customerSelection); return AjaxResult.success(list.stream().map(CustomerSelection::getDeptCategoryId).collect(Collectors.toList())); } @@ -146,14 +151,16 @@ public class CustomerSelectionController extends BaseController hisParam.setCustomerId(customerSelection.getCustomerId()); hisParam.setSelectionType(customerSelection.getSelectionType()); List hisList = customerSelectionService.selectCustomerSelectionList(hisParam); - List hisIds = hisList.stream().map(CustomerSelection::getCustomerId).collect(Collectors.toList()); - StringBuilder ids = new StringBuilder(); - hisIds.forEach(model->{ - ids.append(model).append(","); - }); - if(!StringUtil.isEmpty(ids)){ - String idString = ids.substring(0, ids.length()-1); - customerSelectionService.deleteCustomerSelectionByIds(idString); + if(!CollectionUtils.isEmpty(hisList)){ + List hisIds = hisList.stream().map(CustomerSelection::getId).collect(Collectors.toList()); + StringBuilder ids = new StringBuilder(); + hisIds.forEach(model->{ + ids.append(model.trim()).append(","); + }); + if(!StringUtil.isEmpty(ids)){ + String idString = ids.substring(0, ids.length()-1); + customerSelectionService.deleteCustomerSelectionByIds(idString); + } } // 判断是否有历史数据 - 有则删除 customerSelection.getDeptCategoryIds().forEach(selection->{