正选问题

This commit is contained in:
kuang.yife 2024-08-29 17:26:21 +08:00
parent d8b6c15034
commit d44591330a
1 changed files with 15 additions and 8 deletions

View File

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