正选问题
This commit is contained in:
parent
cf7c708f3a
commit
d8b6c15034
|
|
@ -141,18 +141,25 @@ public class CustomerSelectionController extends BaseController
|
|||
}else {
|
||||
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.setWorkId(workId);
|
||||
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);
|
||||
}
|
||||
});
|
||||
return AjaxResult.success("新增成功");
|
||||
}catch (Exception e){
|
||||
|
|
|
|||
Loading…
Reference in New Issue