Browse Source

人评分数更新

xiatian 3 months ago
parent
commit
a9e0f58d69

+ 92 - 0
src/main/java/cn/com/qmth/am/bean/StudentScoreVo.java

@@ -0,0 +1,92 @@
+package cn.com.qmth.am.bean;
+
+import cn.com.qmth.am.enums.DataStatus;
+
+public class StudentScoreVo {
+
+    private Long id;
+
+    private Long questionId;
+
+    private String examNumber;
+
+    // 机评分
+    private Double aiScore;
+
+    // 人评分
+    private Double markingScore;
+
+    // ocr状态
+    private DataStatus answerStatus;
+
+    // 评分状态
+    private DataStatus scoreStatus;
+
+    // 机评返回null
+    private Boolean scoreNone;
+
+    public Double getAiScore() {
+        return aiScore;
+    }
+
+    public void setAiScore(Double aiScore) {
+        this.aiScore = aiScore;
+    }
+
+    public Double getMarkingScore() {
+        return markingScore;
+    }
+
+    public void setMarkingScore(Double markingScore) {
+        this.markingScore = markingScore;
+    }
+
+    public String getExamNumber() {
+        return examNumber;
+    }
+
+    public void setExamNumber(String examNumber) {
+        this.examNumber = examNumber;
+    }
+
+    public DataStatus getAnswerStatus() {
+        return answerStatus;
+    }
+
+    public void setAnswerStatus(DataStatus answerStatus) {
+        this.answerStatus = answerStatus;
+    }
+
+    public DataStatus getScoreStatus() {
+        return scoreStatus;
+    }
+
+    public void setScoreStatus(DataStatus scoreStatus) {
+        this.scoreStatus = scoreStatus;
+    }
+
+    public Long getQuestionId() {
+        return questionId;
+    }
+
+    public void setQuestionId(Long questionId) {
+        this.questionId = questionId;
+    }
+
+    public Boolean getScoreNone() {
+        return scoreNone;
+    }
+
+    public void setScoreNone(Boolean scoreNone) {
+        this.scoreNone = scoreNone;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+}

+ 67 - 0
src/main/java/cn/com/qmth/am/consumer/UpdateMarkingScoreConsumer.java

@@ -0,0 +1,67 @@
+package cn.com.qmth.am.consumer;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.am.bean.StudentScoreVo;
+import cn.com.qmth.am.entity.QuestionEntity;
+import cn.com.qmth.am.service.StudentService;
+
+@Scope("prototype")
+@Service
+public class UpdateMarkingScoreConsumer implements Runnable {
+
+    private CountDownLatch endGate;
+
+    private QuestionEntity question;
+
+    private StudentScoreVo vo;
+
+    @Autowired
+    private StudentService studentService;
+
+    @Override
+    public void run() {
+        try {
+            studentService.updateMarkingScore(question, vo);
+        } finally {
+            endGate.countDown();
+        }
+    }
+
+    public CountDownLatch getEndGate() {
+        return endGate;
+    }
+
+    public void setEndGate(CountDownLatch endGate) {
+        this.endGate = endGate;
+    }
+
+    public QuestionEntity getQuestion() {
+        return question;
+    }
+
+    public void setQuestion(QuestionEntity question) {
+        this.question = question;
+    }
+
+    public StudentService getStudentService() {
+        return studentService;
+    }
+
+    public void setStudentService(StudentService studentService) {
+        this.studentService = studentService;
+    }
+
+    public StudentScoreVo getVo() {
+        return vo;
+    }
+
+    public void setVo(StudentScoreVo vo) {
+        this.vo = vo;
+    }
+
+}

+ 34 - 16
src/main/java/cn/com/qmth/am/controller/AdminController.java

@@ -30,6 +30,7 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.core.concurrent.service.ConcurrentService;
 
 import cn.com.qmth.am.bean.DataKey;
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.config.SysProperty;
 import cn.com.qmth.am.entity.QuestionEntity;
 import cn.com.qmth.am.entity.StudentScoreEntity;
@@ -267,29 +268,46 @@ public class AdminController {
         sb.append("评分任务是否开启:" + (sysProperty.getMarkingTaskEnable() ? "是" : "否") + "\r\n");
         sb.append("试卷科目总数:" + qsCourse + "\r\n");
         sb.append("试卷小题总数:" + qstotal + "\r\n");
-        // int total = studentService.countBy(examId);
-        // if (total == 0) {
-        // sb.append("考生总数:0");
-        // returnJson(sb.toString(), response);
-        // return;
-        // }
-        // sb.append("考生总数:" + total + "\r\n");
-        int qtotal = studentScoreService.countBy(examId, null);
-        if (qtotal == 0) {
-            sb.append("试题总数:0");
+        Set<String> studentSet = new HashSet<>();
+        int qocrsuc = 0;
+        int qocrfailed = 0;
+        int qsuc = 0;
+        int qfailed = 0;
+        int qtotal = 0;
+        int markingtotal = 0;
+        List<StudentScoreVo> vos = studentScoreService.getInfoByExam(examId);
+        if (CollectionUtils.isNotEmpty(vos)) {
+            qtotal = vos.size();
+            for (StudentScoreVo vo : vos) {
+                studentSet.add(vo.getExamNumber());
+                if (DataStatus.SUCCESS.equals(vo.getAnswerStatus())) {
+                    qocrsuc++;
+                }
+                if (DataStatus.FAILED.equals(vo.getAnswerStatus())) {
+                    qocrfailed++;
+                }
+                if (DataStatus.SUCCESS.equals(vo.getScoreStatus())) {
+                    qsuc++;
+                }
+                if (DataStatus.FAILED.equals(vo.getScoreStatus())) {
+                    qfailed++;
+                }
+                if (vo.getMarkingScore() != null) {
+                    markingtotal++;
+                }
+            }
+        }
+        if (studentSet.size() == 0) {
+            sb.append("考生总数:0");
             returnJson(sb.toString(), response);
             return;
         }
+        sb.append("考生总数:" + studentSet.size() + "\r\n");
         sb.append("考生试题总数:" + qtotal + "\r\n");
-
-        int qocrsuc = studentScoreService.countOcrBy(examId, DataStatus.SUCCESS);
+        sb.append("考生试题已人评总数:" + markingtotal + "\r\n");
         sb.append("考生试题OCR成功总数:" + qocrsuc + "\r\n");
-        int qocrfailed = studentScoreService.countOcrBy(examId, DataStatus.FAILED);
         sb.append("考生试题OCR失败总数:" + qocrfailed + "\r\n");
-
-        int qsuc = studentScoreService.countBy(examId, DataStatus.SUCCESS);
         sb.append("考生试题评分成功总数:" + qsuc + "\r\n");
-        int qfailed = studentScoreService.countBy(examId, DataStatus.FAILED);
         sb.append("考生试题评分失败总数:" + qfailed + "\r\n");
         returnJson(sb.toString(), response);
     }

+ 5 - 0
src/main/java/cn/com/qmth/am/dao/local/StudentScoreDao.java

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import cn.com.qmth.am.bean.StudentScoreInfo;
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.entity.StudentScoreEntity;
 
 public interface StudentScoreDao extends BaseMapper<StudentScoreEntity> {
@@ -15,4 +16,8 @@ public interface StudentScoreDao extends BaseMapper<StudentScoreEntity> {
 
     void saveSheetPath(@Param("id") Long id, @Param("sheet") String sheet);
 
+    List<StudentScoreVo> getInfoByExam(@Param("examId") Long examId);
+
+    List<StudentScoreVo> getAllInfoForUpdateScore();
+
 }

+ 6 - 4
src/main/java/cn/com/qmth/am/dao/stmms/StmmsDao.java

@@ -6,11 +6,13 @@ import org.apache.ibatis.annotations.Param;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 
-import cn.com.qmth.am.entity.StudentScoreEntity;
-
 @DS("data-source-stmms")
 public interface StmmsDao {
 
-    List<StudentScoreEntity> getMarkStudent(@Param("examId") Long examId, @Param("subjectCode") String subjectCode,
-            @Param("mainNumber") Integer mainNumber, @Param("subNumber") String subNumber);
+    List<Double> getMarkStudent(@Param("examId") Long examId, @Param("subjectCode") String subjectCode,
+            @Param("mainNumber") Integer mainNumber, @Param("subNumber") String subNumber,
+            @Param("examNumber") String examNumber);
+
+    List<String> getUploadStudent(@Param("examId") Long examId, @Param("subjectCode") String subjectCode);
+
 }

+ 4 - 3
src/main/java/cn/com/qmth/am/service/StmmsService.java

@@ -2,12 +2,13 @@ package cn.com.qmth.am.service;
 
 import java.util.List;
 
-import cn.com.qmth.am.entity.StudentScoreEntity;
-
 /**
  * 类注释
  */
 public interface StmmsService {
 
-    List<StudentScoreEntity> getMarkStudent(Long examId, String subjectCode, Integer mainNumber, String subNumber);
+    List<Double> getMarkStudent(Long examId, String subjectCode, Integer mainNumber, String subNumber,
+            String examNumber);
+
+    List<String> getUploadStudent(Long examId, String subjectCode);
 }

+ 10 - 1
src/main/java/cn/com/qmth/am/service/StudentScoreService.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import cn.com.qmth.am.bean.StudentScoreImageDto;
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.entity.QuestionEntity;
 import cn.com.qmth.am.entity.StudentScoreEntity;
 import cn.com.qmth.am.enums.DataStatus;
@@ -36,6 +37,14 @@ public interface StudentScoreService extends IService<StudentScoreEntity> {
 
     List<StudentScoreEntity> findAllToOcr();
 
-    void saveByQuestion(QuestionEntity q, List<StudentScoreEntity> scores);
+    void saveByQuestion(List<QuestionEntity> qlist, List<String> students);
+
+    StudentScoreEntity findUpdateMarkingScore();
+
+    void updateMarkingScore(StudentScoreVo score);
+
+    List<StudentScoreVo> getInfoByExam(Long examId);
+
+    List<StudentScoreVo> getAllInfoForUpdateScore();
 
 }

+ 3 - 0
src/main/java/cn/com/qmth/am/service/StudentService.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.am.service;
 
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.entity.QuestionEntity;
 import cn.com.qmth.am.entity.StudentScoreEntity;
 
@@ -18,4 +19,6 @@ public interface StudentService {
 
     void clear(Long examId, String subjectCode);
 
+    void updateMarkingScore(QuestionEntity q, StudentScoreVo score);
+
 }

+ 7 - 4
src/main/java/cn/com/qmth/am/service/impl/StmmsServiceImpl.java

@@ -8,7 +8,6 @@ import org.springframework.stereotype.Service;
 import com.baomidou.dynamic.datasource.annotation.DS;
 
 import cn.com.qmth.am.dao.stmms.StmmsDao;
-import cn.com.qmth.am.entity.StudentScoreEntity;
 import cn.com.qmth.am.service.StmmsService;
 
 @Service
@@ -19,9 +18,13 @@ public class StmmsServiceImpl implements StmmsService {
     private StmmsDao stmmsDao;
 
     @Override
-    public List<StudentScoreEntity> getMarkStudent(Long examId, String subjectCode, Integer mainNumber,
-            String subNumber) {
-        return stmmsDao.getMarkStudent(examId, subjectCode, mainNumber, subNumber);
+    public List<Double> getMarkStudent(Long examId, String subjectCode, Integer mainNumber, String subNumber,
+            String examNumber) {
+        return stmmsDao.getMarkStudent(examId, subjectCode, mainNumber, subNumber, examNumber);
     }
 
+    @Override
+    public List<String> getUploadStudent(Long examId, String subjectCode) {
+        return stmmsDao.getUploadStudent(examId, subjectCode);
+    }
 }

+ 47 - 14
src/main/java/cn/com/qmth/am/service/impl/StudentScoreServiceImpl.java

@@ -38,6 +38,7 @@ import cn.com.qmth.am.bean.AutoScoreEnRequest;
 import cn.com.qmth.am.bean.ImageSlice;
 import cn.com.qmth.am.bean.StudentScoreImageDto;
 import cn.com.qmth.am.bean.StudentScoreInfo;
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.bean.ds.AutoScoreResult;
 import cn.com.qmth.am.config.SysProperty;
 import cn.com.qmth.am.dao.local.StudentScoreDao;
@@ -71,26 +72,29 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 
     @Transactional
     @Override
-    public void saveByQuestion(QuestionEntity q, List<StudentScoreEntity> ss) {
-        if (q == null) {
+    public void saveByQuestion(List<QuestionEntity> qlist, List<String> examNumbers) {
+        if (CollectionUtils.isEmpty(qlist)) {
             throw new StatusException("试题信息为空");
         }
         Set<String> allStudent = getAllStudent();
 
-        BatchSetDataUtil<StudentScoreEntity> bs = new BatchSetDataUtil<StudentScoreEntity>() {
+        BatchSetDataUtil<String> bs = new BatchSetDataUtil<String>() {
 
             @Override
-            protected void setData(List<StudentScoreEntity> dataList) {
+            protected void setData(List<String> dataList) {
                 List<StudentScoreEntity> adds = new ArrayList<>();
-                for (StudentScoreEntity stu : dataList) {
-                    String scorekey = q.getId() + "-" + stu.getExamNumber();
-                    if (!allStudent.contains(scorekey)) {
-                        adds.add(stu);
-                        allStudent.add(scorekey);
-                        stu.setQuestionId(q.getId());
-                        stu.setAnswerStatus(DataStatus.WAITING);
-                        stu.setScoreStatus(DataStatus.WAITING);
-                        stu.setExamNumber(stu.getExamNumber());
+                for (String examNumber : dataList) {
+                    for (QuestionEntity q : qlist) {
+                        String scorekey = q.getId() + "-" + examNumber;
+                        if (!allStudent.contains(scorekey)) {
+                            StudentScoreEntity stu = new StudentScoreEntity();
+                            adds.add(stu);
+                            allStudent.add(scorekey);
+                            stu.setQuestionId(q.getId());
+                            stu.setAnswerStatus(DataStatus.WAITING);
+                            stu.setScoreStatus(DataStatus.WAITING);
+                            stu.setExamNumber(examNumber);
+                        }
                     }
                 }
                 if (CollectionUtils.isNotEmpty(adds)) {
@@ -98,7 +102,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
                 }
             }
         };
-        bs.setDataForBatch(ss, 1000);
+        bs.setDataForBatch(examNumbers, 500);
 
     }
 
@@ -624,4 +628,33 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
         }
         return r;
     }
+
+    @Override
+    public StudentScoreEntity findUpdateMarkingScore() {
+        QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
+        LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
+        lw.isNull(StudentScoreEntity::getMarkingScore);
+        wrapper.last("LIMIT 1");
+        return this.getOne(wrapper);
+    }
+
+    @Transactional
+    @Override
+    public void updateMarkingScore(StudentScoreVo score) {
+        UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
+        LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
+        lw.set(StudentScoreEntity::getMarkingScore, score.getMarkingScore());
+        lw.eq(StudentScoreEntity::getId, score.getId());
+        this.update(wrapper);
+    }
+
+    @Override
+    public List<StudentScoreVo> getInfoByExam(Long examId) {
+        return this.baseMapper.getInfoByExam(examId);
+    }
+
+    @Override
+    public List<StudentScoreVo> getAllInfoForUpdateScore() {
+        return this.baseMapper.getAllInfoForUpdateScore();
+    }
 }

+ 38 - 7
src/main/java/cn/com/qmth/am/service/impl/StudentServiceImpl.java

@@ -1,6 +1,9 @@
 package cn.com.qmth.am.service.impl;
 
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;
@@ -11,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.qmth.boot.core.exception.StatusException;
 
+import cn.com.qmth.am.bean.StudentScoreVo;
 import cn.com.qmth.am.entity.QuestionEntity;
 import cn.com.qmth.am.entity.StudentScoreEntity;
 import cn.com.qmth.am.enums.DataStatus;
@@ -42,23 +46,39 @@ public class StudentServiceImpl implements StudentService {
         if (CollectionUtils.isEmpty(qs)) {
             return;
         }
+        Map<String, List<QuestionEntity>> qmap = new LinkedHashMap<>();
         for (QuestionEntity q : qs) {
-            List<StudentScoreEntity> scores = stmmsService.getMarkStudent(q.getExamId(), q.getSubjectCode(),
-                    q.getMainNumber(), q.getSubNumber());
-            if (CollectionUtils.isEmpty(scores)) {
+            String key = q.getExamId() + "-" + q.getSubjectCode();
+            List<QuestionEntity> tem = qmap.get(key);
+            if (tem == null) {
+                tem = new ArrayList<>();
+                qmap.put(key, tem);
+            }
+            tem.add(q);
+        }
+        for (List<QuestionEntity> qlist : qmap.values()) {
+            List<String> students = stmmsService.getUploadStudent(qlist.get(0).getExamId(),
+                    qlist.get(0).getSubjectCode());
+            if (CollectionUtils.isEmpty(students)) {
                 continue;
             }
-            questionService.updateStatus(q.getId(), DataStatus.PROCESSING);
+            updateQuestionsStatus(qlist, DataStatus.PROCESSING);
             try {
-                studentScoreService.saveByQuestion(q, scores);
-                questionService.updateStatus(q.getId(), DataStatus.SUCCESS);
+                studentScoreService.saveByQuestion(qlist, students);
+                updateQuestionsStatus(qlist, DataStatus.SUCCESS);
             } catch (Exception e) {
                 log.error("同步考生出错", e);
-                questionService.updateStatus(q.getId(), DataStatus.FAILED);
+                updateQuestionsStatus(qlist, DataStatus.FAILED);
             }
         }
     }
 
+    private void updateQuestionsStatus(List<QuestionEntity> qlist, DataStatus st) {
+        for (QuestionEntity q : qlist) {
+            questionService.updateStatus(q.getId(), DataStatus.PROCESSING);
+        }
+    }
+
     @Override
     public void buildImage(StudentScoreEntity score, QuestionEntity quetion) {
         if (DataStatus.WAITING.equals(score.getAnswerStatus()) || DataStatus.FAILED.equals(score.getAnswerStatus())) {
@@ -96,4 +116,15 @@ public class StudentServiceImpl implements StudentService {
         studentScoreService.removeBy(examId, subjectCode);
         questionService.removeBy(examId, subjectCode);
     }
+
+    @Override
+    public void updateMarkingScore(QuestionEntity q, StudentScoreVo score) {
+        List<Double> list = stmmsService.getMarkStudent(q.getExamId(), q.getSubjectCode(), q.getMainNumber(),
+                q.getSubNumber(), score.getExamNumber());
+        if (CollectionUtils.isEmpty(list)) {
+            return;
+        }
+        score.setMarkingScore(list.get(0));
+        studentScoreService.updateMarkingScore(score);
+    }
 }

+ 100 - 0
src/main/java/cn/com/qmth/am/task/StudentScoreImportJob.java

@@ -0,0 +1,100 @@
+package cn.com.qmth.am.task;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import com.qmth.boot.core.concurrent.service.ConcurrentService;
+
+import cn.com.qmth.am.bean.StudentScoreVo;
+import cn.com.qmth.am.consumer.UpdateMarkingScoreConsumer;
+import cn.com.qmth.am.entity.QuestionEntity;
+import cn.com.qmth.am.enums.LockType;
+import cn.com.qmth.am.service.QuestionService;
+import cn.com.qmth.am.service.StudentScoreService;
+import cn.com.qmth.am.utils.SpringContextHolder;
+
+@Service
+public class StudentScoreImportJob {
+
+    @Autowired
+    private QuestionService questionService;
+
+    @Autowired
+    private StudentScoreService studentScoreService;
+
+    @Autowired
+    private ConcurrentService concurrentService;
+
+    private ExecutorService executor;
+
+    @PostConstruct
+    public void initExecutor() {
+        int threadCount = 16;
+        executor = new ThreadPoolExecutor(threadCount, threadCount, 0L, TimeUnit.SECONDS,
+                new LinkedBlockingQueue<>(threadCount * 2), r -> {
+                    Thread t = new Thread(r);
+                    return t;
+                }, (r, executor) -> {
+                    if (!executor.isShutdown()) {
+                        try {
+                            executor.getQueue().put(r);
+                        } catch (InterruptedException e) {
+                            throw new RuntimeException(e);
+                        }
+                    }
+                });
+    }
+
+    @Scheduled(fixedDelay = 5 * 1000, initialDelay = 5 * 1000)
+    public void doJob() {
+        boolean lock = concurrentService.getReadWriteLock(LockType.MARKING_SCORE_IMPORT.name()).writeLock().tryLock();
+        try {
+            if (!lock) {
+                return;
+            }
+            List<QuestionEntity> qs = questionService.list();
+            if (CollectionUtils.isEmpty(qs)) {
+                return;
+            }
+            Map<Long, QuestionEntity> qmap = new LinkedHashMap<>();
+            for (QuestionEntity q : qs) {
+                qmap.put(q.getId(), q);
+            }
+            List<StudentScoreVo> vos = studentScoreService.getAllInfoForUpdateScore();
+            if (CollectionUtils.isEmpty(vos)) {
+                return;
+            }
+            CountDownLatch endGate = new CountDownLatch(vos.size());
+            for (StudentScoreVo vo : vos) {
+                UpdateMarkingScoreConsumer com = SpringContextHolder.getBean(UpdateMarkingScoreConsumer.class);
+                com.setVo(vo);
+                com.setQuestion(qmap.get(vo.getQuestionId()));
+                com.setEndGate(endGate);
+                executor.execute(com);
+            }
+            try {
+                endGate.await();
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+        } finally {
+            if (lock) {
+                concurrentService.getReadWriteLock(LockType.MARKING_SCORE_IMPORT.name()).writeLock().unlock();
+            }
+        }
+    }
+
+}

+ 11 - 3
src/main/resources/mapper/StmmsMapper.xml

@@ -2,12 +2,20 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.qmth.am.dao.stmms.StmmsDao">
 	<select id="getMarkStudent"
-		resultType="cn.com.qmth.am.entity.StudentScoreEntity">
-		select s.exam_number,ss.score markingScore
+		resultType="double">
+		select ss.score markingScore
 		from eb_subjective_score ss left join eb_exam_student s on
 		ss.student_id =s.id
 		where
-		ss.exam_id=#{examId} and s.subject_code =#{subjectCode}
+		ss.exam_id=#{examId} and s.subject_code =#{subjectCode} and s.exam_number=#{examNumber}
 		and s.is_upload=1 and s.subjective_status!='UNMARK' and ss.main_number=#{mainNumber} and ss.sub_number=#{subNumber}
 	</select>
+	<select id="getUploadStudent"
+		resultType="string">
+		select s.exam_number
+		from  eb_exam_student s 
+		where
+		s.exam_id=#{examId} and s.subject_code =#{subjectCode}
+		and s.is_upload=1 and s.is_absent=0
+	</select>
 </mapper>

+ 31 - 4
src/main/resources/mapper/StudentScoreMapper.xml

@@ -1,12 +1,39 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.qmth.am.dao.local.StudentScoreDao">
-	<select id="getAllList" resultType="cn.com.qmth.am.bean.StudentScoreInfo">
+	<select id="getAllList"
+		resultType="cn.com.qmth.am.bean.StudentScoreInfo">
 		select t.question_id,t.exam_number from am_student_score t
 	</select>
-	
+
 	<update id="saveSheetPath">
-		update am_student_score t set t.sheet=#{sheet} where t.id=#{id}
+		update am_student_score t set t.sheet=#{sheet} where
+		t.id=#{id}
 	</update>
-	
+
+	<select id="getInfoByExam"
+		resultType="cn.com.qmth.am.bean.StudentScoreVo">
+		select
+		f.question_id,
+		f.exam_number,
+		f.answer_status,
+		f.score_status,
+		f.ai_score,
+		f.marking_score,
+		f.score_none,
+		f.step_score
+		from am_question t
+		inner join am_student_score f on f.question_id=t.id
+		where
+		t.exam_id=#{examId}
+	</select>
+	<select id="getAllInfoForUpdateScore"
+		resultType="cn.com.qmth.am.bean.StudentScoreVo">
+		select
+		f.id,
+		f.exam_number,
+		f.question_id
+		from am_student_score f 
+		where f.marking_score is null
+	</select>
 </mapper>