Ver Fonte

美术阅卷11月新增需求-BUG修复

wangliang há 5 anos atrás
pai
commit
b495a30ce2

+ 3 - 3
stmms-ms-admin/src/main/java/cn/com/qmth/stmms/ms/admin/exporter/ScoreExporter.java

@@ -269,9 +269,9 @@ public class ScoreExporter {
     @RequestMapping(value = "exportLevelResult", method = RequestMethod.GET)
     @RequestMapping(value = "exportLevelResult", method = RequestMethod.GET)
     public void exportLevelResult(@RequestParam Long workId, HttpServletResponse response) {
     public void exportLevelResult(@RequestParam Long workId, HttpServletResponse response) {
         //测试-导出档位成绩表
         //测试-导出档位成绩表
-        String scSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SC' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SC' and mu.enabled = 1) temp, student t where p.is_missing = true and p.work_id = ? and p.subject = 'SC' and t.exam_number = p.exam_number ";
-        String smSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SM' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SM' and mu.enabled = 1) temp, student t where p.is_missing = true and p.work_id = ? and p.subject = 'SM' and t.exam_number = p.exam_number ";
-        String sxSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SX' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SX' and mu.enabled = 1) temp, student t where p.is_missing = true and p.work_id = ? and p.subject = 'SX' and t.exam_number = p.exam_number ";
+        String scSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SC' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SC' and mu.enabled = 1) temp, student t where (p.is_missing = true or p.is_test = 3) and p.work_id = ? and p.subject = 'SC' and t.exam_number = p.exam_number ";
+        String smSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SM' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SM' and mu.enabled = 1) temp, student t where (p.is_missing = true or p.is_test = 3) and p.work_id = ? and p.subject = 'SM' and t.exam_number = p.exam_number ";
+        String sxSql = "select temp.*, mt.`result`, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from mark_task as mt , (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER'and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SX' and mu.enabled = 1) temp, paper p, student t where mt.marker_id = temp.id and mt.paper_id = p.id and t.exam_number = p.exam_number and mt.work_id = ? and mt.stage = 1 and p.is_missing = false UNION ALL select temp.*, null as result, p.source_name as sourceName, p.exam_number as examNumber, p.student_name as studentName, t.area_name as areaName, p.mark_by_leader as markByLeader, p.`level` from paper p, (select mu.id, mu.name as teacherName, mu.`role`, mu.subject, mu.work_id as workId from mark_user as mu where mu.work_id = ? and mu.`role` = 'MARKER' and (mu.mark_right = 0 or mu.mark_right = 2) and mu.subject = 'SX' and mu.enabled = 1) temp, student t where (p.is_missing = true or p.is_test = 3) and p.work_id = ? and p.subject = 'SX' and t.exam_number = p.exam_number ";
         //拼装问号
         //拼装问号
         scSql = sqlUtil.sqlPrint(scSql, workId, workId, workId, workId);
         scSql = sqlUtil.sqlPrint(scSql, workId, workId, workId, workId);
         smSql = sqlUtil.sqlPrint(smSql, workId, workId, workId, workId);
         smSql = sqlUtil.sqlPrint(smSql, workId, workId, workId, workId);

+ 4 - 93
stmms-ms-core/src/main/java/cn/com/qmth/stmms/ms/core/repository/MarkTaskRepo.java

@@ -14,8 +14,6 @@ import java.util.List;
  */
  */
 public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecificationExecutor {
 public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecificationExecutor {
 
 
-    int countByMarkerIdAndPaperIdAndWorkIdAndRandomSeqNew(Long markerId, Long paperId, Long randomSeqNew, Long workId);
-
     /**
     /**
      * 查询指定阶段试卷的评卷任务
      * 查询指定阶段试卷的评卷任务
      *
      *
@@ -33,29 +31,12 @@ public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecific
      */
      */
     long countByMarkerId(Long markerId);
     long countByMarkerId(Long markerId);
 
 
-    long countByMarkerIdAndQuestionId(Long markerId, Long questionId);
-
-    long countByQuestionIdIn(List<Long> questionIds);
-
-    @Query(value = "select count(1) from mark_task m left join paper p on m.paper_id = p.id and p.batch_no = ?2 where m.question_id = ?1 and m.marker_id = ?3", nativeQuery = true)
+    @Query(value = "select count(1) from mark_task m inner join paper p on m.paper_id = p.id and p.batch_no = ?2 where m.question_id = ?1 and m.marker_id = ?3", nativeQuery = true)
     long countByQuestionId(Long questionId, Long batchNo, Long markerId);
     long countByQuestionId(Long questionId, Long batchNo, Long markerId);
 
 
-    @Query(value = "select count(1) from mark_task m left join paper p on m.paper_id = p.id where m.question_id = ?1 and m.stage = ?2 and m.result = ?3 and p.batch_no = ?4", nativeQuery = true)
-    int countByQuestionIdAndStageAndResult(Long questionId, int stage, String result,Long batchNo);
-
-    int countByQuestionIdAndMarkerIdAndStageAndResultIsNull(Long questionId, Long markerId, MarkStage stage);
-
-    @Query(value = "select count(1) from mark_task m left join paper p on m.paper_id = p.id where m.question_id = ?1 and m.marker_id = ?2 and m.stage = ?3 and m.result = ?4 and p.batch_no = ?5", nativeQuery = true)
+    @Query(value = "select count(1) from mark_task m inner join paper p on m.paper_id = p.id where m.question_id = ?1 and m.marker_id = ?2 and m.stage = ?3 and m.result = ?4 and p.batch_no = ?5", nativeQuery = true)
     int countByQuestionIdAndMarkerIdAndStageAndResult(Long questionId, Long markerId, int stage, String result, Long batchNo);
     int countByQuestionIdAndMarkerIdAndStageAndResult(Long questionId, Long markerId, int stage, String result, Long batchNo);
 
 
-    int countByWorkIdAndSubjectAndMarkerIdAndStageAndResult(Long workId, Subject subject, Long markerId, MarkStage stage, String result);
-
-    int countByWorkIdAndSubjectAndMarkerIdAndStageAndQuestionIdAndResult(Long workId, Subject subject, Long markerId, MarkStage stage, Long questionId, String result);
-
-    int countByWorkIdAndSubjectAndMarkerIdAndStage(Long workId, Subject subject, Long markerId, MarkStage stage);
-
-    int countByWorkIdAndSubjectAndMarkerIdAndStageAndQuestionId(Long workId, Subject subject, Long markerId, MarkStage stage, Long questionId);
-
     /**
     /**
      * 查询评卷员的评卷任务
      * 查询评卷员的评卷任务
      *
      *
@@ -66,17 +47,6 @@ public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecific
     @Query(value = "select mt from MarkTask mt left outer join fetch mt.paper where mt.markerId = ? and mt.stage = ?")
     @Query(value = "select mt from MarkTask mt left outer join fetch mt.paper where mt.markerId = ? and mt.stage = ?")
     List<MarkTask> findByMarkerIdAndStage(Long markerId, MarkStage stage);
     List<MarkTask> findByMarkerIdAndStage(Long markerId, MarkStage stage);
 
 
-    /**
-     * 查询评卷员的评卷任务
-     *
-     * @param markerId
-     * @param stage
-     * @param questionId
-     * @return
-     */
-    @Query(value = "select mt from MarkTask mt left outer join fetch mt.paper where mt.markerId = ? and mt.stage = ? and mt.questionId = ? order by mt.updatedOn desc")
-    List<MarkTask> findByMarkerIdAndStageAndQuestionId(Long markerId, MarkStage stage, Long questionId);
-
     /**
     /**
      * 删除评卷员所有任务
      * 删除评卷员所有任务
      *
      *
@@ -117,52 +87,6 @@ public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecific
             "t.`marker_id` = ? and t.stage = ? and p.is_missing = false GROUP BY t.`question_id` ORDER BY q.`id`", nativeQuery = true)
             "t.`marker_id` = ? and t.stage = ? and p.is_missing = false GROUP BY t.`question_id` ORDER BY q.`id`", nativeQuery = true)
     List<Object[]> countGroupByQuestion(Long markerId, Integer stageId);
     List<Object[]> countGroupByQuestion(Long markerId, Integer stageId);
 
 
-
-    /**
-     * 统计评卷员指定试题的各档位数量
-     *
-     * @param questionIds
-     * @param markerId
-     * @return
-     */
-    @Query(value = "SELECT t.result,COUNT(*) FROM mark_task t " +
-            "WHERE t.`question_id` = ? AND t.`marker_id` = ? and t.stage = 1 " +
-            "GROUP BY t.`result` ORDER BY t.result", nativeQuery = true)
-    List<Object[]> countGroupByQuestionIdAndLevel(Long questionId, Long markerId);
-
-    //2019.10.16修改为所有试卷
-    @Query(value = "SELECT t.result,COUNT(*) FROM mark_task t " +
-            "WHERE t.`question_id` in (?) and t.stage = 1 " +
-            "GROUP BY t.`result`,t.question_id ORDER BY t.result", nativeQuery = true)
-    List<Object[]> countGroupByQuestionIdAndLevel(List<Long> questionId);
-
-    @Query(value = "SELECT t.result,COUNT(*) FROM mark_task t " +
-            "WHERE t.`marker_id` = ? and t.stage = 1 " +
-            "GROUP BY t.`result` ORDER BY t.result", nativeQuery = true)
-    List<Object[]> countGroupByLevel(Long markerId);
-
-
-    @Query(value = "SELECT COUNT(*) FROM mark_task t " +
-            "WHERE t.`marker_id` = ? and t.stage = 1 and t.result = ? ", nativeQuery = true)
-    int countByLevelAndResult(Long markerId, String result);
-    //2019.10.16修改为所有老师的评卷
-//    @Query(value = "SELECT COUNT(*) FROM mark_task t " +
-//            "WHERE t.`question_id` in (?) and t.stage = 1 and t.result = ? ", nativeQuery = true)
-//    int countByLevelAndResult(Long questionId, String result);
-
-    @Query(value = "SELECT COUNT(*) FROM mark_task t " +
-            "WHERE t.`marker_id` = ? and t.stage = 1 and t.result is null", nativeQuery = true)
-    int countByLevel(Long markerId);
-    //2019.10.16修改为所有老师的评卷
-//    @Query(value = "SELECT COUNT(*) FROM mark_task t " +
-//            "WHERE t.`question_id` in (?) and t.stage = 1 and t.result is null", nativeQuery = true)
-//    int countByLevel(Long questionId);
-
-    int countByQuestionIdInAndStageAndResult(List<Long> questionIds, MarkStage stage, String result);
-
-    int countByQuestionIdInAndStageAndResultIsNull(List<Long> questionIds, MarkStage stage);
-
-
     /**
     /**
      * 统计指定试卷的所有任务数量
      * 统计指定试卷的所有任务数量
      *
      *
@@ -171,32 +95,19 @@ public interface MarkTaskRepo extends JpaRepository<MarkTask, Long>, JpaSpecific
      */
      */
     Long countByPaperId(Long id);
     Long countByPaperId(Long id);
 
 
-    int countByWorkIdAndSubjectAndStageAndResult(Long workId, Subject markSubject, MarkStage level, String code);
-
-    int countByWorkIdAndSubjectAndStage(Long workId, Subject markSubject, MarkStage level);
-
-    int countByWorkIdAndSubjectAndStageAndQuestionIdAndResult(Long workId, Subject subject, MarkStage level, Long id, String code);
-
-    int countByWorkIdAndSubjectAndStageAndQuestionId(Long workId, Subject subject, MarkStage level, Long id);
-
     List<MarkTask> findByWorkIdAndSecretNumber(Long workId, String secretNumber);
     List<MarkTask> findByWorkIdAndSecretNumber(Long workId, String secretNumber);
 
 
     @Query(value = "SELECT max(t.randomSeq) FROM MarkTask t " +
     @Query(value = "SELECT max(t.randomSeq) FROM MarkTask t " +
             "WHERE t.workId = ?1 and t.subject = ?2 and t.markerId = ?3 and t.stage = ?4 and t.questionId = ?5 ")
             "WHERE t.workId = ?1 and t.subject = ?2 and t.markerId = ?3 and t.stage = ?4 and t.questionId = ?5 ")
     Integer findRandomSeqByWorkIdAndSubjectAndMarkerIdAndStageAndQuestionId(Long workId, Subject subject, Long markerId, MarkStage stage, Long questionId);
     Integer findRandomSeqByWorkIdAndSubjectAndMarkerIdAndStageAndQuestionId(Long workId, Subject subject, Long markerId, MarkStage stage, Long questionId);
 
 
-    @Query(value = "SELECT count(1) from mark_task m left join paper p on m.paper_id = p.id and p.is_missing = ?4 and p.batch_no = ?5 where m.question_id = ?1 and m.marker_id = ?2 and m.stage = ?3 and m.result is null", nativeQuery = true)
+    @Query(value = "SELECT count(1) from mark_task m inner join paper p on m.paper_id = p.id and p.is_missing = ?4 and p.batch_no = ?5 where m.question_id = ?1 and m.marker_id = ?2 and m.stage = ?3 and m.result is null", nativeQuery = true)
     int countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(Long questionId, Long markerId, int stage, boolean isMissing, Long batchNo);
     int countByQuestionIdAndMarkerIdAndStageAndResultIsNullAndIsMissing(Long questionId, Long markerId, int stage, boolean isMissing, Long batchNo);
 
 
-    @Query(value = "SELECT count(1) from mark_task m left join paper p on m.paper_id = p.id and p.is_missing = ?4 and p.batch_no = ?5 where m.question_id = ?1 and m.marker_id = ?6 and m.stage = ?2 and m.result =?3", nativeQuery = true)
+    @Query(value = "SELECT count(1) from mark_task m inner join paper p on m.paper_id = p.id and p.is_missing = ?4 and p.batch_no = ?5 where m.question_id = ?1 and m.marker_id = ?6 and m.stage = ?2 and m.result =?3", nativeQuery = true)
     int countByQuestionIdAndStageAndResultAndIsMissing(Long questionId, int stage, String result, boolean isMissing,Long batchNo,Long markerId);
     int countByQuestionIdAndStageAndResultAndIsMissing(Long questionId, int stage, String result, boolean isMissing,Long batchNo,Long markerId);
 
 
-    MarkTask findByPaperIdAndSecretNumber(Long paperId, String secretNumber);
-
     MarkTask findByPaperIdAndMarkerId(Long paperId, Long markId);
     MarkTask findByPaperIdAndMarkerId(Long paperId, Long markId);
 
 
-    @Query("select max(mt.batchNo) from MarkTask mt where mt.questionId = ?1")
-    Long findByQuestionId(Long questionId);
-
     List<MarkTask> findByWorkIdAndSubjectAndStage(Long workId, Subject subject, MarkStage markStage);
     List<MarkTask> findByWorkIdAndSubjectAndStage(Long workId, Subject subject, MarkStage markStage);
 }
 }