正选问题

This commit is contained in:
kuang.yife 2024-08-26 10:43:34 +08:00
parent cf7c708f3a
commit d8b6c15034
1 changed files with 15 additions and 8 deletions

View File

@ -141,18 +141,25 @@ public class CustomerSelectionController extends BaseController
}else { }else {
workId = workList.get(0).getWorkerId(); workId = workList.get(0).getWorkerId();
} }
// 删除历史的
CustomerSelection hisParam = new CustomerSelection();
hisParam.setCustomerId(customerSelection.getCustomerId());
hisParam.setSelectionType(customerSelection.getSelectionType());
List<CustomerSelection> hisList = customerSelectionService.selectCustomerSelectionList(hisParam);
List<Long> 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);
}
// 判断是否有历史数据 - 有则删除 // 判断是否有历史数据 - 有则删除
customerSelection.getDeptCategoryIds().forEach(selection->{ customerSelection.getDeptCategoryIds().forEach(selection->{
customerSelection.setWorkId(workId); customerSelection.setWorkId(workId);
customerSelection.setDeptCategoryId(selection); customerSelection.setDeptCategoryId(selection);
CustomerSelection param = new CustomerSelection();
param.setDeptCategoryId(selection);
param.setSelectionType(customerSelection.getSelectionType());
param.setCustomerId(customerSelection.getCustomerId());
List<CustomerSelection> customerSelections = customerSelectionService.selectCustomerSelectionList(param);
if(CollectionUtils.isEmpty(customerSelections)){
customerSelectionService.insertCustomerSelection(customerSelection); customerSelectionService.insertCustomerSelection(customerSelection);
}
}); });
return AjaxResult.success("新增成功"); return AjaxResult.success("新增成功");
}catch (Exception e){ }catch (Exception e){