|
@@ -251,7 +251,28 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
|
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(exam.getSchoolId())) {
|
|
|
throw new StatusException("没有权限");
|
|
|
}
|
|
|
- return this.baseMapper.list(examId,user.getId());
|
|
|
+ List<PaperVo> ret=this.baseMapper.list(examId,user.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(ret)) {
|
|
|
+ new BatchSetDataUtil<PaperVo>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void setData(List<PaperVo> dataList) {
|
|
|
+ List<Long> paperIds = dataList.stream().map(dto -> dto.getId()).distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<GroupCountVo> ret = paperGroupService.findGroupCount(paperIds);
|
|
|
+ if (ret != null && ret.size() > 0) {
|
|
|
+ Map<Long, Integer> countMap = new HashMap<>();
|
|
|
+ for (GroupCountVo item : ret) {
|
|
|
+ countMap.put(item.getPaperId(), item.getGroupCount());
|
|
|
+ }
|
|
|
+ for (PaperVo vo : dataList) {
|
|
|
+ vo.setGroupCount(countMap.get(vo.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.setDataForBatch(ret, 20);
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
@Override
|