|
@@ -1,5 +1,6 @@
|
|
package cn.com.qmth.stmms.ms.marking.api;
|
|
package cn.com.qmth.stmms.ms.marking.api;
|
|
|
|
|
|
|
|
+import cn.com.qmth.stmms.ms.commons.threadPool.MyThreadPool;
|
|
import cn.com.qmth.stmms.ms.commons.utils.SqlUtil;
|
|
import cn.com.qmth.stmms.ms.commons.utils.SqlUtil;
|
|
import cn.com.qmth.stmms.ms.core.domain.Level;
|
|
import cn.com.qmth.stmms.ms.core.domain.Level;
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkStage;
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkStage;
|
|
@@ -15,17 +16,15 @@ import cn.com.qmth.stmms.ms.marking.assembler.QuestionStatAssembler;
|
|
import cn.com.qmth.stmms.ms.marking.dto.LevelStatDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.LevelStatDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.MarkerDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.MarkerDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.QuestionStatDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.QuestionStatDTO;
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.concurrent.Callable;
|
|
|
|
+import java.util.concurrent.Future;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -100,6 +99,9 @@ public class MakrerApi {
|
|
return markUsers;
|
|
return markUsers;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ MyThreadPool myThreadPool;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 评卷员分档数量及占比数据
|
|
* 评卷员分档数量及占比数据
|
|
*
|
|
*
|
|
@@ -113,19 +115,34 @@ public class MakrerApi {
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
List<Level> levels = levelRepo.findByWorkId(markSubject.getWorkId());
|
|
List<Level> levels = levelRepo.findByWorkId(markSubject.getWorkId());
|
|
Map<String, Level> levelMap = levels.stream().collect(Collectors.toMap(Level::getCode, l -> l));
|
|
Map<String, Level> levelMap = levels.stream().collect(Collectors.toMap(Level::getCode, l -> l));
|
|
|
|
+ Long batchNo = paperRepo.findByQuestionId(questionId);
|
|
|
|
+ Future future = myThreadPool.arbitratePoolTaskExecutor.submit(new Callable<Map<String, Long>>() {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Long> call() throws Exception {
|
|
|
|
+ Map<String, Long> map = new HashMap<>();
|
|
|
|
+ //当前老师当前试卷的评档次数(不分档位)
|
|
|
|
+ long kdtotal = markTaskRepo.countByQuestionId(questionId, batchNo, marker.getId());
|
|
|
|
+ //当前老师所有的评档次数(不分档位)
|
|
|
|
+ long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
|
+ map.put("kdtotal", kdtotal);
|
|
|
|
+ map.put("total", total);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
//统计workId下各考点的数量
|
|
//统计workId下各考点的数量
|
|
- paperRepo.countGroupByLevel(questionId, questionId)
|
|
|
|
|
|
+ paperRepo.countGroupByLevel(questionId, batchNo)
|
|
.forEach(o -> {
|
|
.forEach(o -> {
|
|
LevelStatDTO levelStatDTO = levelStatAssembler.toDTO(o);
|
|
LevelStatDTO levelStatDTO = levelStatAssembler.toDTO(o);
|
|
levelStatDTO.setGcount(levelStatDTO.getCount());
|
|
levelStatDTO.setGcount(levelStatDTO.getCount());
|
|
if (Objects.isNull(levelStatDTO.getId())) {
|
|
if (Objects.isNull(levelStatDTO.getId())) {
|
|
//求任务数为null的条数
|
|
//求任务数为null的条数
|
|
// int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNull(questionId, marker.getId(), MarkStage.LEVEL);
|
|
// int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNull(questionId, marker.getId(), MarkStage.LEVEL);
|
|
- int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false, questionId);
|
|
|
|
|
|
+ int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), false, batchNo);
|
|
levelStatDTO.setCount(count);
|
|
levelStatDTO.setCount(count);
|
|
} else {
|
|
} else {
|
|
// int count = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, levelStatDTO.getId().toString());
|
|
// int count = markTaskRepo.countByQuestionIdAndStageAndResult(questionId, MarkStage.LEVEL, levelStatDTO.getId().toString());
|
|
- int count = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), levelStatDTO.getId().toString(), false, questionId, marker.getId());
|
|
|
|
|
|
+ int count = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), levelStatDTO.getId().toString(), false, batchNo, marker.getId());
|
|
levelStatDTO.setCount(count);
|
|
levelStatDTO.setCount(count);
|
|
}
|
|
}
|
|
levelStatDTOs.add(levelStatDTO);
|
|
levelStatDTOs.add(levelStatDTO);
|
|
@@ -140,33 +157,42 @@ public class MakrerApi {
|
|
dto.setPercent(0.0);
|
|
dto.setPercent(0.0);
|
|
|
|
|
|
//当前老师当前档位评档次数(所有考试)
|
|
//当前老师当前档位评档次数(所有考试)
|
|
- int countNew = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), level.getCode(), false, questionId, marker.getId());
|
|
|
|
|
|
+ int countNew = markTaskRepo.countByQuestionIdAndStageAndResultAndIsMissing(questionId, MarkStage.LEVEL.ordinal(), level.getCode(), false, batchNo, marker.getId());
|
|
|
|
+ dto.setPercent(countNew == 0 ? 0D : dto.getPercent());
|
|
dto.setCount(countNew);
|
|
dto.setCount(countNew);
|
|
levelStatDTOs.add(dto);
|
|
levelStatDTOs.add(dto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //当前老师当前试卷的评档次数(不分档位)
|
|
|
|
- long kdtotal = markTaskRepo.countByQuestionId(questionId, questionId, marker.getId());
|
|
|
|
- //当前老师所有的评档次数(不分档位)
|
|
|
|
- long total = paperRepo.countByWorkIdAndQuestionId(markSubject.getWorkId(), questionId);
|
|
|
|
|
|
+ long kdtotal = 0L,total = 0L;
|
|
|
|
+ if(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 finalKdtotal = kdtotal;
|
|
|
|
+ long finalTotal = total;
|
|
levelStatDTOs.forEach(o -> {
|
|
levelStatDTOs.forEach(o -> {
|
|
if (o.getId() != null) {
|
|
if (o.getId() != null) {
|
|
o.setPt(levelMap.get(o.getId()).getPt());
|
|
o.setPt(levelMap.get(o.getId()).getPt());
|
|
o.setKdpt(levelMap.get(o.getId()).getKdpt());
|
|
o.setKdpt(levelMap.get(o.getId()).getKdpt());
|
|
o.setCount(Objects.isNull(o.getCount()) ? 0 : o.getCount());
|
|
o.setCount(Objects.isNull(o.getCount()) ? 0 : o.getCount());
|
|
- double p = (double) o.getCount() / kdtotal;
|
|
|
|
|
|
+ double p = (double) o.getCount() / finalKdtotal;
|
|
BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
|
|
BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
|
|
o.setPercent(bd.doubleValue());
|
|
o.setPercent(bd.doubleValue());
|
|
|
|
|
|
o.setGcount(Objects.isNull(o.getGcount()) ? 0 : o.getGcount());
|
|
o.setGcount(Objects.isNull(o.getGcount()) ? 0 : o.getGcount());
|
|
- double gp = (double) o.getGcount() / total;
|
|
|
|
|
|
+ double gp = (double) o.getGcount() / finalTotal;
|
|
BigDecimal gbd = new BigDecimal(gp).setScale(3, RoundingMode.HALF_EVEN);
|
|
BigDecimal gbd = new BigDecimal(gp).setScale(3, RoundingMode.HALF_EVEN);
|
|
o.setGpercent(gbd.doubleValue());
|
|
o.setGpercent(gbd.doubleValue());
|
|
|
|
|
|
- int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), o.getId().toString(), questionId);
|
|
|
|
- o.setPercent(count == 0 ? 0 : o.getPercent());
|
|
|
|
- o.setCount(count);
|
|
|
|
|
|
+// int count = markTaskRepo.countByQuestionIdAndMarkerIdAndStageAndResult(questionId, marker.getId(), MarkStage.LEVEL.ordinal(), o.getId().toString(), batchNo);
|
|
|
|
+// o.setPercent(count == 0 ? 0 : o.getPercent());
|
|
|
|
+// o.setCount(count);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
return levelStatDTOs;
|
|
return levelStatDTOs;
|