|
@@ -133,11 +133,19 @@ public class MakrerApi {
|
|
|
@RequestMapping(value = "{marker}/stat/levels", method = RequestMethod.GET)
|
|
|
public List<LevelStatDTO> levelStats(@PathVariable MarkUser marker, @RequestParam Long questionId) throws Exception {
|
|
|
List<LevelStatDTO> levelStatDTOs = new ArrayList<>();
|
|
|
+ long t1 = System.currentTimeMillis();
|
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
|
List<Level> levels = levelRepo.findByWorkId(markSubject.getWorkId());
|
|
|
Map<String, Level> levelMap = levels.stream().collect(Collectors.toMap(Level::getCode, l -> l));
|
|
|
-// Long batchNo = paperRepo.findByQuestionId(questionId);
|
|
|
- Long batchNo = paperRepo.findMaxBatchNoByWorkIdAndSubject(marker.getWorkId(), marker.getSubject());
|
|
|
+
|
|
|
+ Integer levelShowAllPaper = ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper();
|
|
|
+ Long batchNo = null;
|
|
|
+ if(levelShowAllPaper == 0){
|
|
|
+ batchNo = paperRepo.findMaxBatchNoByWorkIdAndSubject(marker.getWorkId(), marker.getSubject());
|
|
|
+ }
|
|
|
+ long t2 = System.currentTimeMillis();
|
|
|
+ System.out.println("l1:"+(t2-t1));
|
|
|
+ Long finalBatchNo = batchNo;
|
|
|
Future future = myThreadPool.arbitratePoolTaskExecutor.submit(new Callable<Map<String, Long>>() {
|
|
|
|
|
|
@Override
|
|
@@ -145,11 +153,15 @@ public class MakrerApi {
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
//当前老师当前批次试卷总数
|
|
|
long kdtotal;
|
|
|
- if (ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper() == 1) {
|
|
|
+ long t21 = System.currentTimeMillis();
|
|
|
+ if (levelShowAllPaper == 1) {
|
|
|
kdtotal = markTaskRepo.countByQuestionIdAll(questionId, marker.getId());
|
|
|
} else {
|
|
|
- kdtotal = markTaskRepo.countByQuestionId(questionId, batchNo, marker.getId());
|
|
|
+// kdtotal = markTaskRepo.countByQuestionId(questionId, finalBatchNo, marker.getId());
|
|
|
+ kdtotal = markTaskRepo.countByQuestionIdAndBatchNo(questionId, finalBatchNo, marker.getId());
|
|
|
}
|
|
|
+ long t22 = System.currentTimeMillis();
|
|
|
+ System.out.println("l61:"+(t22-t21));
|
|
|
//当前考区内试卷总数
|
|
|
long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
map.put("kdtotal", kdtotal);
|
|
@@ -157,27 +169,38 @@ public class MakrerApi {
|
|
|
return map;
|
|
|
}
|
|
|
});
|
|
|
- long t1 = System.currentTimeMillis();
|
|
|
+ long t3 = System.currentTimeMillis();
|
|
|
+ System.out.println("l2:"+(t3-t2));
|
|
|
//当前考区各档位定档数量
|
|
|
- paperRepo.countGroupByLevel(questionId)
|
|
|
- .forEach(o -> {
|
|
|
+ List<Object[]> list = paperRepo.countGroupByLevel(questionId);
|
|
|
+ long t4 = System.currentTimeMillis();
|
|
|
+ System.out.println("l3:"+(t4-t3));
|
|
|
+ list.forEach(o -> {
|
|
|
LevelStatDTO levelStatDTO = levelStatAssembler.toDTO(o);
|
|
|
levelStatDTO.setGcount(levelStatDTO.getCount());
|
|
|
if (Objects.isNull(levelStatDTO.getId())) {
|
|
|
//求任务数为null的条数
|
|
|
int count;
|
|
|
- if (ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper() == 1) {
|
|
|
- count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissingAll(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false);
|
|
|
+ long t41 = System.currentTimeMillis();
|
|
|
+ if (levelShowAllPaper == 1) {
|
|
|
+ count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNullAll(questionId, marker.getId(), MarkStage.LEVEL.ordinal());
|
|
|
} else {
|
|
|
- count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false, batchNo);
|
|
|
+ count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultNull(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), finalBatchNo);
|
|
|
}
|
|
|
+ long t42 = System.currentTimeMillis();
|
|
|
+ System.out.println("l41:"+(t42-t41));
|
|
|
//查询当前老师打回个数
|
|
|
- int rejectCount = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndIsRejectedTrueAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false);
|
|
|
+// int rejectCount = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndIsRejectedTrueAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false);
|
|
|
+ int rejectCount = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndIsRejectedTrue(questionId, marker.getId(), MarkStage.LEVEL.ordinal());
|
|
|
+ long t43 = System.currentTimeMillis();
|
|
|
+ System.out.println("l42:"+(t43-t42));
|
|
|
levelStatDTO.setCount(count);
|
|
|
levelStatDTO.setRejected(rejectCount);
|
|
|
}
|
|
|
levelStatDTOs.add(levelStatDTO);
|
|
|
});
|
|
|
+ long t5 = System.currentTimeMillis();
|
|
|
+ System.out.println("l4:"+(t5-t4));
|
|
|
for (Level level : levels) {
|
|
|
//所有档位依次比较
|
|
|
long count = levelStatDTOs.stream().filter(l -> String.valueOf(l.getId()).equals(level.getCode())).count();
|
|
@@ -186,28 +209,19 @@ public class MakrerApi {
|
|
|
dto.setId(level.getCode());
|
|
|
dto.setCount(0);
|
|
|
dto.setPercent(0.0);
|
|
|
-
|
|
|
- //当前老师当前档位评档次数(所有考试)
|
|
|
-// int countNew;
|
|
|
-// if (ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper() == 1) {
|
|
|
-//// countNew = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissingAll(questionId, MarkStage.LEVEL.ordinal(), level.getCode(), false, marker.getId());
|
|
|
-// } else {
|
|
|
-// countNew = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), level.getCode(), false, batchNo, marker.getId());
|
|
|
-// }
|
|
|
-// dto.setCount(countNew);
|
|
|
levelStatDTOs.add(dto);
|
|
|
}
|
|
|
}
|
|
|
+ long t6 = System.currentTimeMillis();
|
|
|
+ System.out.println("l5:"+(t6-t5));
|
|
|
long kdtotal = 0L, total = 0L;
|
|
|
if (Objects.nonNull(future) && Objects.nonNull(future.get())) {
|
|
|
Map<String, Long> map = (Map<String, Long>) future.get();
|
|
|
kdtotal = map.get("kdtotal");
|
|
|
total = map.get("total");
|
|
|
}
|
|
|
-// //当前老师当前试卷的评档次数(不分档位)
|
|
|
-// long kdtotal = markTaskRepo.countByQuestionId(questionId, batchNo, marker.getId());
|
|
|
-// //当前老师所有的评档次数(不分档位)
|
|
|
-// long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
+ long t7 = System.currentTimeMillis();
|
|
|
+ System.out.println("l6:"+(t7-t6));
|
|
|
|
|
|
long finalKdtotal = kdtotal;
|
|
|
long finalTotal = total;
|
|
@@ -215,21 +229,19 @@ public class MakrerApi {
|
|
|
if (o.getId() != null) {
|
|
|
//当前老师各档位数量
|
|
|
int countNew;
|
|
|
- if (ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper() == 1) {
|
|
|
-// count = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissingAll(questionId, MarkStage.LEVEL.ordinal(), levelStatDTO.getId().toString(), false, marker.getId());
|
|
|
+ if (levelShowAllPaper == 1) {
|
|
|
countNew = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultAll(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), String.valueOf(o.getId()));
|
|
|
} else {
|
|
|
-// count = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), levelStatDTO.getId().toString(), false, batchNo, marker.getId());
|
|
|
- countNew = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), String.valueOf(o.getId()), batchNo);
|
|
|
+ countNew = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), String.valueOf(o.getId()), finalBatchNo);
|
|
|
}
|
|
|
o.setCount(countNew);
|
|
|
//该档位考区内已定档数量
|
|
|
- long gcountNew = paperRepo.countByWorkIdAndSubjectAndQuestionIdAndLevel(marker.getWorkId(), markSubject.getSubject(), questionId, String.valueOf(o.getId()));
|
|
|
+// long gcountNew = paperRepo.countByWorkIdAndSubjectAndQuestionIdAndLevel(marker.getWorkId(), markSubject.getSubject(), questionId, String.valueOf(o.getId()));
|
|
|
+ long gcountNew = paperRepo.countByQuestionIdAndLevelAndSubjectAndWorkId(questionId, String.valueOf(o.getId()), markSubject.getSubject(), marker.getWorkId());
|
|
|
o.setGcount((int) gcountNew);
|
|
|
|
|
|
o.setPt(levelMap.get(o.getId()).getPt());
|
|
|
o.setKdpt(levelMap.get(o.getId()).getKdpt());
|
|
|
-// o.setCount(Objects.isNull(o.getCount()) ? 0 : o.getCount());
|
|
|
double p = finalKdtotal == 0 ? 0 : (double) o.getCount() / finalKdtotal * 100;
|
|
|
BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
|
|
|
o.setPercent(bd.doubleValue());
|
|
@@ -238,16 +250,10 @@ public class MakrerApi {
|
|
|
double gp = finalTotal == 0 ? 0 : (double) o.getGcount() / finalTotal * 100;
|
|
|
BigDecimal gbd = new BigDecimal(gp).setScale(3, RoundingMode.HALF_EVEN);
|
|
|
o.setGpercent(gbd.doubleValue());
|
|
|
-// int count;
|
|
|
-// if (ParamCache.paramMap.get(marker.getWorkId()).getLevelShowAllPaper() == 1) {
|
|
|
-// count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultAll(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), o.getId().toString());
|
|
|
-// } else {
|
|
|
-// count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), o.getId().toString(), batchNo);
|
|
|
-// }
|
|
|
-// o.setPercent(count == 0 ? 0 : o.getPercent());
|
|
|
-// o.setCount(count);
|
|
|
}
|
|
|
});
|
|
|
+ long t8 = System.currentTimeMillis();
|
|
|
+ System.out.println("l7:"+(t8-t7));
|
|
|
Collections.sort(levelStatDTOs, (o1, o2) -> {
|
|
|
if (o1.getId() == null || o2.getId() == null) {
|
|
|
return 1;
|
|
@@ -267,36 +273,46 @@ public class MakrerApi {
|
|
|
@RequestMapping(value = "{marker}/stat/scores", method = RequestMethod.GET)
|
|
|
public List<LevelStatDTO> scoreStats(@PathVariable MarkUser marker, @RequestParam Long questionId) throws Exception {
|
|
|
List<LevelStatDTO> levelStatDTOs = new ArrayList<>();
|
|
|
+ long t1 = System.currentTimeMillis();
|
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
|
List<Level> levels = levelRepo.findByWorkId(markSubject.getWorkId());
|
|
|
Map<String, Level> levelMap = levels.stream().collect(Collectors.toMap(Level::getCode, l -> l));
|
|
|
-// Long batchNo = paperRepo.findScoreBatchNoByQuestionId(questionId);
|
|
|
Long batchNo = paperRepo.findMaxScoreBatchNoByWorkIdAndSubject(marker.getWorkId(), marker.getSubject());
|
|
|
+ long t2 = System.currentTimeMillis();
|
|
|
+ System.out.println("s1:"+(t2-t1));
|
|
|
Future future = myThreadPool.arbitratePoolTaskExecutor.submit(new Callable<Map<String, Long>>() {
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Long> call() throws Exception {
|
|
|
+ public Map<String, Long> call() {
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
|
- //当前老师当前试卷的评档次数(不分档位)
|
|
|
-// long kdtotal = markTaskRepo.countScoreByQuestionId(questionId, batchNo, marker.getId());
|
|
|
//当前老师所有的评档次数(不分档位)
|
|
|
- long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
-// map.put("kdtotal", kdtotal);
|
|
|
+// long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
+ long total = paperRepo.countByQuestionId(questionId);
|
|
|
map.put("total", total);
|
|
|
return map;
|
|
|
}
|
|
|
});
|
|
|
+ long t3 = System.currentTimeMillis();
|
|
|
+ System.out.println("s2:"+(t3-t2));
|
|
|
LevelStatDTO levelStatDTO = new LevelStatDTO();
|
|
|
//求任务数为null的条数
|
|
|
- int totalCount = markTaskRepo.countScoreByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.SCORE.ordinal(), false, batchNo);
|
|
|
+// int totalCount = markTaskRepo.countScoreByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.SCORE.ordinal(), false, batchNo);
|
|
|
+ int totalCount = markTaskRepo.countScoreByQuestionIdAndMarkerIdAndStageAndResultIsNull(questionId, marker.getId(), MarkStage.SCORE.ordinal(), batchNo);
|
|
|
levelStatDTO.setCount(totalCount);
|
|
|
+ long t4 = System.currentTimeMillis();
|
|
|
+ System.out.println("s3:"+(t4-t3));
|
|
|
//查询改档
|
|
|
int shiftCount = markTaskRepo.countShiftByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false);
|
|
|
levelStatDTO.setShift(shiftCount);
|
|
|
+ long t5 = System.currentTimeMillis();
|
|
|
+ System.out.println("s4:"+(t5-t4));
|
|
|
//查询改档打分
|
|
|
- int shiftScoreCount = markTaskRepo.countShiftScoreByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.SCORE.ordinal(), false);
|
|
|
+// int shiftScoreCount = markTaskRepo.countShiftScoreByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.SCORE.ordinal(), false);
|
|
|
+ int shiftScoreCount = markTaskRepo.countShiftScoreByQuestionIdAndMarkerIdAndStageAndResultIsNull(questionId, marker.getId(), MarkStage.SCORE.ordinal());
|
|
|
levelStatDTO.setShiftScore(shiftScoreCount);
|
|
|
levelStatDTOs.add(levelStatDTO);
|
|
|
+ long t6 = System.currentTimeMillis();
|
|
|
+ System.out.println("s5:"+(t6-t5));
|
|
|
|
|
|
for (Level level : levels) {
|
|
|
//所有档位依次比较
|
|
@@ -308,32 +324,26 @@ public class MakrerApi {
|
|
|
dto.setPercent(0.0);
|
|
|
|
|
|
//当前老师当前档位评档次数(所有考试)
|
|
|
- int countNew = 0;
|
|
|
- /*if (ParamCache.paramMap.get(marker.getWorkId()).getScoreShowAllPaper() == 1) {
|
|
|
- countNew = markTaskRepo.countScoreByQuestionIdAndStageAndResultAndIsMissingAll(questionId, MarkStage.SCORE.ordinal(), level.getCode(), false, marker.getId());
|
|
|
- } else {
|
|
|
- countNew = markTaskRepo.countScoreByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.SCORE.ordinal(), level.getCode(), false, batchNo, marker.getId());
|
|
|
- }*/
|
|
|
- dto.setCount(countNew);
|
|
|
+ dto.setCount(0);
|
|
|
levelStatDTOs.add(dto);
|
|
|
}
|
|
|
}
|
|
|
- long kdtotal = 0L, total = 0L;
|
|
|
+ long t7 = System.currentTimeMillis();
|
|
|
+ System.out.println("s6:"+(t7-t6));
|
|
|
+ long total = 0L;
|
|
|
if (Objects.nonNull(future) && Objects.nonNull(future.get())) {
|
|
|
Map<String, Long> map = (Map<String, Long>) future.get();
|
|
|
-// kdtotal = map.get("kdtotal");
|
|
|
total = map.get("total");
|
|
|
}
|
|
|
+ long t8 = System.currentTimeMillis();
|
|
|
+ System.out.println("s7:"+(t8-t7));
|
|
|
|
|
|
- long finalKdtotal = kdtotal;
|
|
|
long finalTotal = total;
|
|
|
levelStatDTOs.forEach(o -> {
|
|
|
if (o.getId() != null) {
|
|
|
o.setPt(levelMap.get(o.getId()).getPt());
|
|
|
o.setKdpt(levelMap.get(o.getId()).getKdpt());
|
|
|
o.setCount(Objects.isNull(o.getCount()) ? 0 : o.getCount());
|
|
|
-// double p = (double) o.getCount() / finalKdtotal;
|
|
|
-// BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
|
|
|
o.setPercent(0D);
|
|
|
|
|
|
o.setGcount(Objects.isNull(o.getGcount()) ? 0 : o.getGcount());
|
|
@@ -351,6 +361,8 @@ public class MakrerApi {
|
|
|
o.setCount(count);
|
|
|
}
|
|
|
});
|
|
|
+ long t9 = System.currentTimeMillis();
|
|
|
+ System.out.println("s8:"+(t9-t8));
|
|
|
return levelStatDTOs;
|
|
|
}
|
|
|
|