|
@@ -5,6 +5,8 @@ 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;
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkSubject;
|
|
import cn.com.qmth.stmms.ms.core.domain.MarkSubject;
|
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.Student;
|
|
|
|
+import cn.com.qmth.stmms.ms.core.domain.enums.TrialEnum;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.MarkRight;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.MarkRight;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.MarkUser;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.MarkUser;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.Role;
|
|
import cn.com.qmth.stmms.ms.core.domain.user.Role;
|
|
@@ -13,12 +15,11 @@ import cn.com.qmth.stmms.ms.core.vo.Subject;
|
|
import cn.com.qmth.stmms.ms.marking.assembler.LevelStatAssembler;
|
|
import cn.com.qmth.stmms.ms.marking.assembler.LevelStatAssembler;
|
|
import cn.com.qmth.stmms.ms.marking.assembler.MarkerAssembler;
|
|
import cn.com.qmth.stmms.ms.marking.assembler.MarkerAssembler;
|
|
import cn.com.qmth.stmms.ms.marking.assembler.QuestionStatAssembler;
|
|
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.LevleProgressDTO;
|
|
|
|
-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.*;
|
|
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.http.HttpStatus;
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -67,6 +68,9 @@ public class MakrerApi {
|
|
@Autowired
|
|
@Autowired
|
|
PaperRepo paperRepo;
|
|
PaperRepo paperRepo;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ StudentRepo studentRepo;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 评卷员信息
|
|
* 评卷员信息
|
|
*
|
|
*
|
|
@@ -79,6 +83,20 @@ public class MakrerApi {
|
|
return markerAssembler.toDTO(marker);
|
|
return markerAssembler.toDTO(marker);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 更新默认显示试卷数量
|
|
|
|
+ *
|
|
|
|
+ * @param markerId 评卷员用户id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @RequestMapping(value = "updateDisplayCount", method = RequestMethod.POST)
|
|
|
|
+ public ResponseEntity getMarker(Long markerId, Integer displayCount) {
|
|
|
|
+ MarkUser marker = markUserRepo.findOne(markerId);
|
|
|
|
+ marker.setDisplayCount(displayCount);
|
|
|
|
+ markUserRepo.saveAndFlush(marker);
|
|
|
|
+ return new ResponseEntity(HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 评卷员列表
|
|
* 评卷员列表
|
|
*
|
|
*
|
|
@@ -225,52 +243,89 @@ public class MakrerApi {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 各评卷员评卷进度、老区评卷进度
|
|
|
|
|
|
+ * 各评卷员评卷进度、考区评卷进度
|
|
*
|
|
*
|
|
- * @param marker 评卷员用户对象
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/stat/progress", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/stat/progress", method = RequestMethod.GET)
|
|
- public Map markProgress(@PathVariable MarkUser marker) {
|
|
|
|
|
|
+ public Map markProgress(@RequestParam Long workId, @RequestParam Subject subject) {
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
- MarkSubject markSubject = markSubjectRepo.findOne(marker.getWorkId() + "-" + marker.getSubject().toString());
|
|
|
|
|
|
+ MarkSubject markSubject = markSubjectRepo.findOne(workId + "-" + subject.toString());
|
|
|
|
|
|
//总体进度
|
|
//总体进度
|
|
- Long workId = markSubject.getWorkId();
|
|
|
|
- Subject subject = markSubject.getSubject();
|
|
|
|
- //已评任务数
|
|
|
|
- int successCount = paperRepo.countByWorkIdAndSubjectAndLevelNotNullAndIsMissingFalseAndActiveTrueAndTest(workId, subject, 0);
|
|
|
|
- //所有任务数(查询所有有效试卷)
|
|
|
|
- int totalCount = paperRepo.countByWorkIdAndSubjectAndIsMissingFalseAndTest(workId, subject, 0);
|
|
|
|
-
|
|
|
|
- BigDecimal waitTotal = BigDecimal.valueOf(totalCount).subtract(BigDecimal.valueOf(successCount));
|
|
|
|
- //进度
|
|
|
|
- BigDecimal progress = BigDecimal.ZERO.compareTo(BigDecimal.valueOf(totalCount)) == 0 ? BigDecimal.ZERO : BigDecimal.valueOf(successCount).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(totalCount), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
-
|
|
|
|
- LevleProgressDTO progressDTO = new LevleProgressDTO();
|
|
|
|
- progressDTO.setSuccessCount(successCount);
|
|
|
|
- progressDTO.setTotalCount(totalCount);
|
|
|
|
- progressDTO.setWaitCount(waitTotal.intValue());
|
|
|
|
- progressDTO.setProgress(progress.doubleValue());
|
|
|
|
- objectMap.put("totalProgress", progressDTO);
|
|
|
|
|
|
+ if(markSubject.getStage() == MarkStage.INIT){
|
|
|
|
+ List<Student> students = studentRepo.findByWorkIdAndTest(workId, String.valueOf(TrialEnum.DEFAULT.getId()));
|
|
|
|
+ long stuTotalCount = students.stream().count();
|
|
|
|
+ long stuAbsentCount = students.stream().filter(s -> s.isAbsent()).count();
|
|
|
|
+ long c = 0L;
|
|
|
|
+ for (Student student : students) {
|
|
|
|
+ String[] uploadStatus = student.getUploadStatus().split(",");
|
|
|
|
+ for (String s : uploadStatus) {
|
|
|
|
+ if ("1".equals(s.split(":")[1])) {
|
|
|
|
+ if(subject.name().equals(s.split(":")[0])){
|
|
|
|
+ ++c;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ LevleProgressDTO progressDTO = new LevleProgressDTO();
|
|
|
|
+ progressDTO.setSuccessCount((int) c);
|
|
|
|
+ progressDTO.setTotalCount((int) stuTotalCount);
|
|
|
|
+ progressDTO.setWaitCount((int) (stuTotalCount-c));
|
|
|
|
+ BigDecimal progress = new BigDecimal(c*100).divide(new BigDecimal(stuTotalCount), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ progressDTO.setProgress(progress.doubleValue());
|
|
|
|
+ objectMap.put("totalProgress", progressDTO);
|
|
|
|
+ } else {
|
|
|
|
+ //已评任务数
|
|
|
|
+ int successCount = paperRepo.countByWorkIdAndSubjectAndLevelNotNullAndIsMissingFalseAndActiveTrueAndTest(workId, subject, 0);
|
|
|
|
+ //所有任务数(查询所有有效试卷)
|
|
|
|
+ int totalCount = paperRepo.countByWorkIdAndSubjectAndIsMissingFalseAndTest(workId, subject, 0);
|
|
|
|
+
|
|
|
|
+ BigDecimal waitTotal = BigDecimal.valueOf(totalCount).subtract(BigDecimal.valueOf(successCount));
|
|
|
|
+ //进度
|
|
|
|
+ BigDecimal progress = BigDecimal.ZERO.compareTo(BigDecimal.valueOf(totalCount)) == 0 ? BigDecimal.ZERO : BigDecimal.valueOf(successCount).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(totalCount), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
+
|
|
|
|
+ LevleProgressDTO progressDTO = new LevleProgressDTO();
|
|
|
|
+ progressDTO.setSuccessCount(successCount);
|
|
|
|
+ progressDTO.setTotalCount(totalCount);
|
|
|
|
+ progressDTO.setWaitCount(waitTotal.intValue());
|
|
|
|
+ progressDTO.setProgress(progress.doubleValue());
|
|
|
|
+ objectMap.put("totalProgress", progressDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
//考区进度
|
|
//考区进度
|
|
- List<Map> areas = null;
|
|
|
|
|
|
+ List<Object[]> areas = null;
|
|
if (markSubject.getStage() == MarkStage.SCORE) {
|
|
if (markSubject.getStage() == MarkStage.SCORE) {
|
|
- areas = markTaskRepo.countGroupByAreaName(markSubject.getSubject().name(), markSubject.getStage().ordinal());
|
|
|
|
|
|
+ areas = markTaskRepo.listGroupByAreaName(workId, markSubject.getSubject().name(), markSubject.getStage().ordinal());
|
|
} else {
|
|
} else {
|
|
- areas = markTaskRepo.countGroupByAreaName(markSubject.getSubject().name(), markSubject.getStage().ordinal(), markSubject.getTest());
|
|
|
|
|
|
+ areas = markTaskRepo.listGroupByAreaName(workId, markSubject.getSubject().name(), markSubject.getStage().ordinal(), markSubject.getTest());
|
|
|
|
+ }
|
|
|
|
+ if (areas != null) {
|
|
|
|
+ List<QuestionStatDTO> questionStatDTOs = new ArrayList<>();
|
|
|
|
+ for (Object[] objects : areas) {
|
|
|
|
+ QuestionStatDTO dto = questionStatAssembler.toProgressDTO(objects);
|
|
|
|
+ questionStatDTOs.add(dto);
|
|
|
|
+ }
|
|
|
|
+ objectMap.put("areaProgress", questionStatDTOs);
|
|
}
|
|
}
|
|
- objectMap.put("areaProgress", areas);
|
|
|
|
|
|
|
|
//各评卷员评卷进度
|
|
//各评卷员评卷进度
|
|
- List<Map> qStats = null;
|
|
|
|
|
|
+ List<Object[]> qStats = null;
|
|
if (markSubject.getStage() == MarkStage.SCORE) {
|
|
if (markSubject.getStage() == MarkStage.SCORE) {
|
|
- qStats = markTaskRepo.countGroupByQuestionAndMarker(markSubject.getSubject().name(), markSubject.getStage().ordinal());
|
|
|
|
|
|
+ qStats = markTaskRepo.listGroupByQuestionAndMarker(workId, markSubject.getSubject().name(), markSubject.getStage().ordinal());
|
|
} else {
|
|
} else {
|
|
- qStats = markTaskRepo.countGroupByQuestionAndMarker(markSubject.getSubject().name(), markSubject.getStage().ordinal(), markSubject.getTest());
|
|
|
|
|
|
+ qStats = markTaskRepo.listGroupByQuestionAndMarker(workId, markSubject.getSubject().name(), markSubject.getStage().ordinal(), markSubject.getTest());
|
|
|
|
+ }
|
|
|
|
+ if (qStats != null) {
|
|
|
|
+ List<MarkQuestionStatDTO> questionStatDTOs = new ArrayList<>();
|
|
|
|
+ for (Object[] objects : qStats) {
|
|
|
|
+ MarkQuestionStatDTO dto = questionStatAssembler.toMarkProgressDTO(objects);
|
|
|
|
+ questionStatDTOs.add(dto);
|
|
|
|
+ }
|
|
|
|
+ objectMap.put("markerProgress", questionStatDTOs);
|
|
}
|
|
}
|
|
- objectMap.put("markerProgress", qStats);
|
|
|
|
return objectMap;
|
|
return objectMap;
|
|
}
|
|
}
|
|
|
|
|