记一次报错
private AjaxResult disCollectionCase(List<Long> taskIdList, List<Long> sysUserIds, Long allocateUserId) {
//3查询员工已分配未完成用户数
List<Map<String, Long>> maps = collectionCaseCenterMapper.selectCollectionUnFinishUserCount(sysUserIds);
Map<Long, Long> userCountMap = new HashMap<>();
for (Map<String, Long> map : maps) {
userCountMap.put(map.get("sysUserId"), map.get("count"));
}
//调用分配方法返回Map
Map<Long, List<Long>> longListMap = automaticSingleService.automaticSingle(taskIdList, sysUserIds, userCountMap);//批量分配保存用户
for (Map.Entry<Long, List<Long>> entry : longListMap.entrySet()) {
Long userId = entry.getKey();
List<Long> caseIds = entry.getValue();
if (CollectionUtils.isNotEmpty(caseIds)) {
// 已经分配未回收的,不能再分配
caseIds = this.filterDistributedList(caseIds);
if(CollectionUtils.isNotEmpty(caseIds)){
//保存分配案件
collectionCaseCenterMapper.beachdisCollection(userId, caseIds);
//批量保存分配信息
batchSaveCollectionCaseRecord(userId, caseIds, allocateUserId);
}
}
}
return AjaxResult.success("{}:催收案件分配完成", DateUtil.getCurrentDate());
}
private List<Long> filterDistributedList(List<Long> caseIds) {
List<Long> distributedList = collectionCaseRecordService.getDistributedList(caseIds);
if(CollectionUtils.isNotEmpty(distributedList)){
caseIds.removeAll(distributedList);
}
return caseIds;
}
记一次查看同事代码报错问题
Map<Long, List> longListMap
由于返回的这个map value 是用的ArrayList中subList 在 function 2 中remove了
所以在后续removeAll 的过程中 抛出异常 因为 CollectionUtils.isNotEmpty 函数会调用
size() 方法 而 subList size() 函数 会检测 是否被 修改过 所以抛出了一个这个异常
private void checkForComodification() {
if (ArrayList.this.modCount != this.modCount)
throw new ConcurrentModificationException();
}