deason 1 سال پیش
والد
کامیت
aaf5eecb89

+ 1 - 1
src/main/java/cn/com/qmth/examcloud/tool/enums/TaskType.java

@@ -13,7 +13,7 @@ public enum TaskType {
 
     EXPORT_STUDENT_ANSWER_AND_SCORE_DETAIL("导出考生试题作答和得分明细", ExportStudentAnswerAndScoreDetailTask.class),
 
-    UPDATE_CORRECT_ANSWER_AND_RE_FIX_SCORE("更新正确答案并重新算分", UpdateCorrectAnswerAndReFixScoreTask.class),
+    UPDATE_CORRECT_ANSWER_AND_RE_FIX_SCORE("重新算分", UpdateCorrectAnswerAndReFixScoreTask.class),
 
     CONFIG_EXAM_PAPER("配置考试调卷规则", ConfigExamPaperTask.class),
 

+ 26 - 11
src/main/java/cn/com/qmth/examcloud/tool/service/update_correct_answer_and_re_fix_score/UpdateCorrectAnswerAndReFixScoreTask.java

@@ -55,7 +55,16 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
     private void execute(User user, JsonNode jsonParams) {
         Long examId = jsonParams.get("examId").asLong(0L);
         String courseCodes = jsonParams.get("courseCodes").asText("");
-        log.info("examId = {}, courseCodes = {}", examId, courseCodes);
+
+        //是否更新客观题答案
+        Boolean updateObjectiveAnswer = jsonParams.get("updateObjectiveAnswer").asBoolean(false);
+        //是否更新客观题分值
+        Boolean updateObjectiveScore = jsonParams.get("updateObjectiveScore").asBoolean(false);
+        //是否更新主观题分值
+        Boolean updateSubjectiveScore = jsonParams.get("updateSubjectiveScore").asBoolean(false);
+
+        log.info("examId:{} courseCodes:{} updateObjectiveAnswer:{} updateObjectiveScore:{} updateSubjectiveScore:{}",
+                examId, courseCodes, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
 
         // 待处理的课程列表(未指定课程则按考试的全部课程)
         List<CourseVO> todoCourses;
@@ -77,17 +86,19 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
 
         for (CourseVO course : todoCourses) {
             // 按考试课程逐个处理
-            this.process(user, examId, course);
+            this.process(user, examId, course, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
         }
     }
 
-    public void process(User user, Long examId, CourseVO course) {
+    public void process(User user, Long examId, CourseVO course, Boolean updateObjectiveAnswer,
+            Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
         List<ExamStudentVO> examStudents = this.getExamStudentList(user, examId, course.getCourseId());
 
         int index = 0, total = examStudents.size();
         for (ExamStudentVO examStudent : examStudents) {
             // 按考生逐个更新正确答案并重新算分
-            this.fix(user, examId, course.getCourseId(), examStudent.getExamStudentId());
+            this.fix(user, examId, course.getCourseId(), examStudent.getExamStudentId(), updateObjectiveAnswer,
+                    updateObjectiveScore, updateSubjectiveScore);
 
             index++;
             if (index % 100 == 0) {
@@ -103,18 +114,22 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
         examStudents.clear();
     }
 
-    private void fix(User user, Long examId, Long courseId, Long examStudentId) {
-        Map<String, String> params = new HashMap<>();
-        params.put("examId", String.valueOf(examId));
-        params.put("courseId", String.valueOf(courseId));
-        params.put("examStudentId", String.valueOf(examStudentId));
+    private void fix(User user, Long examId, Long courseId, Long examStudentId, Boolean updateObjectiveAnswer,
+            Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("examId", examId);
+        params.put("courseId", courseId);
+        params.put("examStudentId", examStudentId);
+        params.put("updateObjectiveAnswer", updateObjectiveAnswer);
+        params.put("updateObjectiveScore", updateObjectiveScore);
+        params.put("updateSubjectiveScore", updateSubjectiveScore);
 
         Map<String, String> headers = new HashMap<>();
         headers.put("key", user.getKey());
         headers.put("token", user.getToken());
 
-        String url = user.getServerUrl() + "/api/ecs_oe_admin/exam/score/updateCorrectAnswerAndReFixScore";
-        HttpHelper.get(url, headers, params);
+        String url = user.getServerUrl() + "/api/ecs_oe_admin/exam/score/reFixScore";
+        HttpHelper.post(url, headers, params);
     }
 
     /**

+ 32 - 2
src/main/resources/templates/admin/updateCorrectAnswerAndReFixScore.ftlh

@@ -13,9 +13,9 @@
         <el-main>
             <el-row>
                 <el-col :span="8" :offset="8">
-                    <h3 style="text-align: center">更新正确答案并重新算分</h3>
+                    <h3 style="text-align: center">重新算分</h3>
 
-                    <el-form label-position="right" label-width="100px" :model="curForm" ref="curForm" :rules="rules">
+                    <el-form label-position="right" label-width="140px" :model="curForm" ref="curForm" :rules="rules">
                         <el-form-item label="考试ID" prop="examId">
                             <el-input v-model="curForm.examId"></el-input>
                         </el-form-item>
@@ -24,6 +24,33 @@
                             <el-input v-model="curForm.courseCodes" placeholder="多个值逗号分隔"></el-input>
                         </el-form-item>
 
+                        <el-form-item label="是否更新客观题答案" prop="updateObjectiveAnswer">
+                            <el-switch
+                                    v-model="curForm.updateObjectiveAnswer"
+                                    active-color="#13ce66"
+                                    inactive-color="#e6e6e6">
+                            </el-switch>
+                        </el-form-item>
+
+                        <el-form-item label="是否更新客观题分值" prop="updateObjectiveScore">
+                            <el-switch
+                                    v-model="curForm.updateObjectiveScore"
+                                    active-color="#13ce66"
+                                    inactive-color="#e6e6e6">
+                            </el-switch>
+                        </el-form-item>
+
+                        <el-form-item label="是否更新主观题分值" prop="updateSubjectiveScore">
+                            <el-switch
+                                    v-model="curForm.updateSubjectiveScore"
+                                    active-color="#13ce66"
+                                    inactive-color="#e6e6e6">
+                            </el-switch>
+                            <span style="color: orange">
+                                <i class="el-icon-warning-outline"></i> 慎重选择,更新后建议重新阅卷!</span>
+                        </el-form-item>
+                        </el-form-item>
+
                         <el-form-item>
                             <el-button type="primary" @click="doSubmit" round>确 认</el-button>
                         </el-form-item>
@@ -41,6 +68,9 @@
             curForm: {
                 examId: null,
                 courseCodes: null,
+                updateObjectiveAnswer: false,
+                updateObjectiveScore: false,
+                updateSubjectiveScore: false,
             },
             rules: {
                 examId: [

+ 1 - 2
src/main/resources/templates/admin/workspace.ftlh

@@ -22,8 +22,7 @@
 
                     <el-col :span="8">
                         <el-card shadow="hover">
-                            <el-link href="${base}/admin/updateCorrectAnswerAndReFixScore">更新正确答案并重新算分
-                            </el-link>
+                            <el-link href="${base}/admin/updateCorrectAnswerAndReFixScore">重新算分</el-link>
                         </el-card>
                     </el-col>
                 </el-row>