|
@@ -37,19 +37,19 @@ public class MakrerApi {
|
|
|
|
|
|
@Autowired
|
|
|
private MarkUserRepo markUserRepo;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkTaskRepo markTaskRepo;
|
|
|
|
|
|
- @Autowired
|
|
|
- private MarkerAssembler markerAssembler;
|
|
|
+ @Autowired
|
|
|
+ private MarkerAssembler markerAssembler;
|
|
|
|
|
|
@Autowired
|
|
|
private QuestionStatAssembler questionStatAssembler;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkSubjectRepo markSubjectRepo;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private LevelRepo levelRepo;
|
|
|
|
|
@@ -58,66 +58,92 @@ public class MakrerApi {
|
|
|
|
|
|
/**
|
|
|
* 评卷员信息
|
|
|
+ *
|
|
|
* @param markerId 评卷员用户id
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "{markerId}",method = RequestMethod.GET)
|
|
|
- public MarkerDTO getMarker(@PathVariable Long markerId){
|
|
|
- MarkUser marker = markUserRepo.findOne(markerId);
|
|
|
- return markerAssembler.toDTO(marker);
|
|
|
- }
|
|
|
+ @RequestMapping(value = "{markerId}", method = RequestMethod.GET)
|
|
|
+ public MarkerDTO getMarker(@PathVariable Long markerId) {
|
|
|
+ MarkUser marker = markUserRepo.findOne(markerId);
|
|
|
+ return markerAssembler.toDTO(marker);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 评卷员列表
|
|
|
- * @param workId 评卷工作id
|
|
|
- * @param subject 科目
|
|
|
+ *
|
|
|
+ * @param workId 评卷工作id
|
|
|
+ * @param subject 科目
|
|
|
* @param markStage 允许参与的阶段
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
public List<MarkUser> list(@RequestParam Long workId,
|
|
|
@RequestParam Subject subject,
|
|
|
- @RequestParam MarkStage markStage){
|
|
|
- List<MarkUser> markUsers = markUserRepo.findByWorkIdAndSubjectAndRole(workId,subject, Role.MARKER);
|
|
|
- if(MarkStage.LEVEL == markStage ){
|
|
|
- markUsers = markUsers.stream().filter(m -> m.getMarkRight() == MarkRight.ALLOW_LEVELING||m.getMarkRight() == MarkRight.ALLOW_ALL).collect(Collectors.toList());
|
|
|
- }else if(MarkStage.SCORE == markStage){
|
|
|
- markUsers = markUsers.stream().filter(m -> m.getMarkRight() == MarkRight.ALLOW_SCORING||m.getMarkRight() == MarkRight.ALLOW_ALL).collect(Collectors.toList());
|
|
|
- }
|
|
|
+ @RequestParam MarkStage markStage) {
|
|
|
+ List<MarkUser> markUsers = markUserRepo.findByWorkIdAndSubjectAndRole(workId, subject, Role.MARKER);
|
|
|
+ if (MarkStage.LEVEL == markStage) {
|
|
|
+ markUsers = markUsers.stream().filter(m -> m.getMarkRight() == MarkRight.ALLOW_LEVELING || m.getMarkRight() == MarkRight.ALLOW_ALL).collect(Collectors.toList());
|
|
|
+ } else if (MarkStage.SCORE == markStage) {
|
|
|
+ markUsers = markUsers.stream().filter(m -> m.getMarkRight() == MarkRight.ALLOW_SCORING || m.getMarkRight() == MarkRight.ALLOW_ALL).collect(Collectors.toList());
|
|
|
+ }
|
|
|
return markUsers;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 评卷员分档数量及占比数据
|
|
|
- * @param marker 评卷员用户id
|
|
|
+ *
|
|
|
+ * @param marker 评卷员用户id
|
|
|
* @param questionId 试题id
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "{marker}/stat/levels",method = RequestMethod.GET)
|
|
|
- public List<LevelStatDTO> levelStats(@PathVariable MarkUser marker, @RequestParam Long questionId){
|
|
|
- List<LevelStatDTO> levelStatDTOs = new ArrayList<>();
|
|
|
- markTaskRepo.countGroupByLevel(questionId,marker.getId())
|
|
|
+ @RequestMapping(value = "{marker}/stat/levels", method = RequestMethod.GET)
|
|
|
+ public List<LevelStatDTO> levelStats(@PathVariable MarkUser marker, @RequestParam Long questionId) {
|
|
|
+ List<LevelStatDTO> levelStatDTOs = new ArrayList<>();
|
|
|
+// markTaskRepo.countGroupByLevel(marker.getId())
|
|
|
+// .forEach(o -> {
|
|
|
+// levelStatAssembler.toDTO(o);
|
|
|
+// levelStatDTOs.add();
|
|
|
+// });
|
|
|
+
|
|
|
+ markTaskRepo.countGroupByQuestionIdAndLevel(questionId, marker.getId())
|
|
|
.forEach(o -> {
|
|
|
- levelStatDTOs.add(levelStatAssembler.toDTO(o));
|
|
|
+ LevelStatDTO levelStatDTO = levelStatAssembler.toDTO(o);
|
|
|
+ if (levelStatDTO.getId() == null) {
|
|
|
+ int gcount = markTaskRepo.countByLevel(marker.getId());
|
|
|
+ levelStatDTO.setGcount(gcount);
|
|
|
+ } else {
|
|
|
+ int gcount = markTaskRepo.countByLevelAndResult(marker.getId(), levelStatDTO.getId().toString());
|
|
|
+ levelStatDTO.setGcount(gcount);
|
|
|
+ }
|
|
|
+ levelStatDTOs.add(levelStatDTO);
|
|
|
});
|
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
|
List<Level> levels = levelRepo.findByWorkId(markSubject.getWorkId());
|
|
|
- for(Level level : levels){
|
|
|
+ for (Level level : levels) {
|
|
|
long count = levelStatDTOs.stream().filter(l -> String.valueOf(l.getId()).equals(level.getCode())).count();
|
|
|
- if(count == 0){
|
|
|
+ if (count == 0) {
|
|
|
LevelStatDTO dto = new LevelStatDTO();
|
|
|
dto.setId(level.getCode());
|
|
|
dto.setCount(0);
|
|
|
dto.setPercent(0.0);
|
|
|
+
|
|
|
+ int gcount = markTaskRepo.countByLevelAndResult(marker.getId(), level.getCode());
|
|
|
+ dto.setGcount(gcount);
|
|
|
levelStatDTOs.add(dto);
|
|
|
}
|
|
|
}
|
|
|
- long total = markTaskRepo.countByMarkerIdAndQuestionId(marker.getId(),questionId);
|
|
|
+ long kdtotal = markTaskRepo.countByMarkerIdAndQuestionId(marker.getId(), questionId);
|
|
|
+ long total = markTaskRepo.countByMarkerId(marker.getId());
|
|
|
+
|
|
|
levelStatDTOs.forEach(o -> {
|
|
|
- if(o.getId()!=null){
|
|
|
- double p = (double)o.getCount()/total;
|
|
|
+ if (o.getId() != null) {
|
|
|
+ double p = (double) o.getCount() / kdtotal;
|
|
|
BigDecimal bd = new BigDecimal(p).setScale(3, RoundingMode.HALF_EVEN);
|
|
|
- o.setPercent(bd.doubleValue());
|
|
|
+ o.setPercent(bd.doubleValue());
|
|
|
+
|
|
|
+ double gp = (double) o.getGcount() / total;
|
|
|
+ BigDecimal gbd = new BigDecimal(gp).setScale(3, RoundingMode.HALF_EVEN);
|
|
|
+ o.setGpercent(gbd.doubleValue());
|
|
|
}
|
|
|
});
|
|
|
return levelStatDTOs;
|
|
@@ -125,16 +151,17 @@ public class MakrerApi {
|
|
|
|
|
|
/**
|
|
|
* 各试题统计数据
|
|
|
+ *
|
|
|
* @param marker 评卷员用户id
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(value = "{marker}/stat/questions",method = RequestMethod.GET)
|
|
|
- public List<QuestionStatDTO> questions(@PathVariable MarkUser marker){
|
|
|
+ @RequestMapping(value = "{marker}/stat/questions", method = RequestMethod.GET)
|
|
|
+ public List<QuestionStatDTO> questions(@PathVariable MarkUser marker) {
|
|
|
List<QuestionStatDTO> questionStatDTOs = new ArrayList<>();
|
|
|
List<Object[]> qStats = null;
|
|
|
MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
|
- qStats = markTaskRepo.countGroupByQuestion(marker.getId(),markSubject.getStage().ordinal());
|
|
|
- if(qStats != null) {
|
|
|
+ qStats = markTaskRepo.countGroupByQuestion(marker.getId(), markSubject.getStage().ordinal());
|
|
|
+ if (qStats != null) {
|
|
|
for (Object[] objects : qStats) {
|
|
|
QuestionStatDTO dto = questionStatAssembler.toDTO(objects);
|
|
|
questionStatDTOs.add(dto);
|
|
@@ -142,5 +169,5 @@ public class MakrerApi {
|
|
|
}
|
|
|
return questionStatDTOs;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|