deason 1 year ago
parent
commit
9d041c7af2

+ 13 - 6
src/main/java/cn/com/qmth/examcloud/tool/service/export_student_answer_and_score_detail/ExportStudentAnswerAndScoreDetailTask.java

@@ -56,7 +56,8 @@ public class ExportStudentAnswerAndScoreDetailTask {
         Long examId = jsonParams.get("examId").asLong(0L);
         Long examId = jsonParams.get("examId").asLong(0L);
         String courseCodes = jsonParams.get("courseCodes").asText("");
         String courseCodes = jsonParams.get("courseCodes").asText("");
         Boolean needSubjective = jsonParams.get("needSubjective").asBoolean(false);
         Boolean needSubjective = jsonParams.get("needSubjective").asBoolean(false);
-        log.info("examId = {}, courseCodes = {}, needSubjective = {}", examId, courseCodes, needSubjective);
+        Boolean needQuestionId = jsonParams.get("needQuestionId").asBoolean(false);
+        log.info("examId = {}, courseCodes = {}, needSubjective = {}, needQuestionId = {}", examId, courseCodes, needSubjective, needQuestionId);
 
 
         // 待处理的课程列表(未指定课程则按考试的全部课程)
         // 待处理的课程列表(未指定课程则按考试的全部课程)
         List<CourseVO> todoCourses;
         List<CourseVO> todoCourses;
@@ -79,13 +80,13 @@ public class ExportStudentAnswerAndScoreDetailTask {
         int index = 0;
         int index = 0;
         for (CourseVO course : todoCourses) {
         for (CourseVO course : todoCourses) {
             // 按考试课程逐个处理
             // 按考试课程逐个处理
-            this.export(examId, course, needSubjective, user, tempDir);
+            this.export(examId, course, needSubjective, needQuestionId, user, tempDir);
 
 
             log.info("examId:{} courseId:{} 已处理课程数:{}", examId, course.getCourseId(), ++index);
             log.info("examId:{} courseId:{} 已处理课程数:{}", examId, course.getCourseId(), ++index);
         }
         }
     }
     }
 
 
-    private void export(Long examId, CourseVO course, Boolean needSubjective, User user, String tempDir) {
+    private void export(Long examId, CourseVO course, Boolean needSubjective, Boolean needQuestionId, User user, String tempDir) {
         List<ExamStudentScoreVO> examStudentScoreList = this.getExamStudentScoreList(user.getKey(), user.getToken(), examId, course.getCourseId());
         List<ExamStudentScoreVO> examStudentScoreList = this.getExamStudentScoreList(user.getKey(), user.getToken(), examId, course.getCourseId());
 
 
         // Excel动态列
         // Excel动态列
@@ -126,7 +127,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
                         continue;
                         continue;
                     }
                     }
 
 
-                    // dynamicExcelHeaders.add(String.format("%s%s-%s-ID", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
+                    if (needQuestionId) {
+                        dynamicExcelHeaders.add(String.format("%s%s-%s-ID", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
+                    }
                     dynamicExcelHeaders.add(String.format("%s%s-%s答案", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
                     dynamicExcelHeaders.add(String.format("%s%s-%s答案", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
                     dynamicExcelHeaders.add(String.format("%s%s-%s作答", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
                     dynamicExcelHeaders.add(String.format("%s%s-%s作答", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
                     dynamicExcelHeaders.add(String.format("%s%s-%s得分", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
                     dynamicExcelHeaders.add(String.format("%s%s-%s得分", question.getQuestionType().getDesc(), question.getMainNumber(), question.getOrder()));
@@ -160,7 +163,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
                         studentAnswer = numbersToLetters(question.getStudentAnswer());
                         studentAnswer = numbersToLetters(question.getStudentAnswer());
                     }
                     }
 
 
-                    // dynamicColumnValues.add(question.getQuestionId());
+                    if (needQuestionId) {
+                        dynamicColumnValues.add(question.getQuestionId());
+                    }
                     dynamicColumnValues.add(correctAnswer);
                     dynamicColumnValues.add(correctAnswer);
                     dynamicColumnValues.add(studentAnswer);
                     dynamicColumnValues.add(studentAnswer);
                     if (correctAnswer.equals(studentAnswer)) {
                     if (correctAnswer.equals(studentAnswer)) {
@@ -170,7 +175,9 @@ public class ExportStudentAnswerAndScoreDetailTask {
                     }
                     }
                 } else {
                 } else {
                     if (needSubjective) {
                     if (needSubjective) {
-                        // dynamicColumnValues.add(question.getQuestionId());
+                        if (needQuestionId) {
+                            dynamicColumnValues.add(question.getQuestionId());
+                        }
                         String correctAnswer = question.getCorrectAnswer() != null ? question.getCorrectAnswer() : "";
                         String correctAnswer = question.getCorrectAnswer() != null ? question.getCorrectAnswer() : "";
                         dynamicColumnValues.add(Jsoup.clean(correctAnswer, Safelist.simpleText()));
                         dynamicColumnValues.add(Jsoup.clean(correctAnswer, Safelist.simpleText()));
                         String studentAnswer = question.getStudentAnswer() != null ? question.getStudentAnswer() : "";
                         String studentAnswer = question.getStudentAnswer() != null ? question.getStudentAnswer() : "";

+ 9 - 1
src/main/resources/templates/admin/exportStudentAnswerAndScoreDetail.ftlh

@@ -31,6 +31,13 @@
                             </el-radio-group>
                             </el-radio-group>
                         </el-form-item>
                         </el-form-item>
 
 
+                        <el-form-item label="包含试题ID">
+                            <el-radio-group v-model="curForm.needQuestionId">
+                                <el-radio label="true">是</el-radio>
+                                <el-radio label="false">否</el-radio>
+                            </el-radio-group>
+                        </el-form-item>
+
                         <el-form-item>
                         <el-form-item>
                             <el-button type="primary" @click="doSubmit" round>确 认</el-button>
                             <el-button type="primary" @click="doSubmit" round>确 认</el-button>
                         </el-form-item>
                         </el-form-item>
@@ -48,7 +55,8 @@
             curForm: {
             curForm: {
                 examId: null,
                 examId: null,
                 courseCodes: null,
                 courseCodes: null,
-                needSubjective: "true"
+                needSubjective: "true",
+                needQuestionId: "false",
             },
             },
             rules: {
             rules: {
                 examId: [
                 examId: [