deason před 7 měsíci
rodič
revize
fa73e0bdda

+ 9 - 7
src/main/java/cn/com/qmth/examcloud/tool/service/update_correct_answer_and_re_fix_score/UpdateCorrectAnswerAndReFixScoreTask.java

@@ -55,6 +55,7 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
 
         Long examId = jsonParams.get("examId").asLong(0L);
         String courseCodes = jsonParams.get("courseCodes").asText("");
+        String questionIds = jsonParams.get("questionIds").asText("");
 
         //是否更新客观题答案
         Boolean updateObjectiveAnswer = jsonParams.get("updateObjectiveAnswer").asBoolean(false);
@@ -63,8 +64,8 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
         //是否更新主观题分值
         Boolean updateSubjectiveScore = jsonParams.get("updateSubjectiveScore").asBoolean(false);
 
-        log.info("examId:{} courseCodes:{} updateObjectiveAnswer:{} updateObjectiveScore:{} updateSubjectiveScore:{}",
-                examId, courseCodes, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
+        log.info("examId:{} courseCodes:{} questionIds:{} updateObjectiveAnswer:{} updateObjectiveScore:{} updateSubjectiveScore:{}",
+                examId, courseCodes, questionIds, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
 
         // 待处理的课程列表(未指定课程则按考试的全部课程)
         List<CourseVO> todoCourses;
@@ -88,20 +89,20 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
         for (CourseVO course : todoCourses) {
             // 按考试课程逐个处理
             log.info("examId:{} todoCourseCount:{} curIndex:{}", examId, todoCourses.size(), index);
-            this.process(loginUser, examId, course, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
+            this.process(loginUser, examId, course, questionIds, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
             index++;
         }
     }
 
-    public void process(User loginUser, Long examId, CourseVO course, Boolean updateObjectiveAnswer,
-                        Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
+    public void process(User loginUser, Long examId, CourseVO course, String questionIds,
+                        Boolean updateObjectiveAnswer, Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
         List<ExamStudentVO> examStudents = this.getExamStudentList(loginUser, examId, course.getCourseId());
 
         int index = 0, total = examStudents.size();
         for (ExamStudentVO examStudent : examStudents) {
             // 按考生逐个重新算分
             this.fix(loginUser, examId, course.getCourseId(), examStudent.getExamStudentId(), updateObjectiveAnswer,
-                    updateObjectiveScore, updateSubjectiveScore);
+                    updateObjectiveScore, updateSubjectiveScore, questionIds);
 
             index++;
             if (index % 100 == 0) {
@@ -118,7 +119,7 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
     }
 
     private void fix(User loginUser, Long examId, Long courseId, Long examStudentId, Boolean updateObjectiveAnswer,
-                     Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
+                     Boolean updateObjectiveScore, Boolean updateSubjectiveScore, String questionIds) {
         Map<String, Object> params = new HashMap<>();
         params.put("examId", examId);
         params.put("courseId", courseId);
@@ -126,6 +127,7 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
         params.put("updateObjectiveAnswer", updateObjectiveAnswer);
         params.put("updateObjectiveScore", updateObjectiveScore);
         params.put("updateSubjectiveScore", updateSubjectiveScore);
+        params.put("questionIds", questionIds);
 
         Map<String, String> headers = new HashMap<>();
         headers.put("key", loginUser.getKey());

+ 7 - 0
src/main/resources/templates/admin/updateCorrectAnswerAndReFixScore.ftlh

@@ -24,6 +24,12 @@
                             <el-input v-model="curForm.courseCodes" placeholder="多个值逗号分隔"></el-input>
                         </el-form-item>
 
+                        <el-form-item label="试题ID集合" prop="questionIds">
+                            <el-input v-model="curForm.questionIds" placeholder="多个值逗号分隔"></el-input>
+                            <span style="color: orange">
+                                <i class="el-icon-warning-outline"></i> 慎重填写,对应试题ID会忽略考生作答,直接给分!</span>
+                        </el-form-item>
+
                         <el-form-item label="是否更新客观题答案" prop="updateObjectiveAnswer">
                             <el-switch
                                     v-model="curForm.updateObjectiveAnswer"
@@ -73,6 +79,7 @@
                 updateObjectiveAnswer: false,
                 updateObjectiveScore: false,
                 updateSubjectiveScore: false,
+                questionIds: null,
             },
             rules: {
                 examId: [