From 47cd9ecc0eff38ffe6b3b794b2bf197e958f4403 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 14 五月 2025 15:50:57 +0800
Subject: [PATCH] bug:学员有状态不能修改问题

---
 src/main/java/com/mindskip/xzs/controller/student/QuestionAnswerController.java |   44 +++++++++-----------------------------------
 1 files changed, 9 insertions(+), 35 deletions(-)

diff --git a/src/main/java/com/mindskip/xzs/controller/student/QuestionAnswerController.java b/src/main/java/com/mindskip/xzs/controller/student/QuestionAnswerController.java
index a703e38..881fc36 100644
--- a/src/main/java/com/mindskip/xzs/controller/student/QuestionAnswerController.java
+++ b/src/main/java/com/mindskip/xzs/controller/student/QuestionAnswerController.java
@@ -1,25 +1,17 @@
 package com.mindskip.xzs.controller.student;
 
+import com.github.pagehelper.PageInfo;
 import com.mindskip.xzs.base.BaseApiController;
 import com.mindskip.xzs.base.RestResponse;
-import com.mindskip.xzs.domain.*;
-import com.mindskip.xzs.domain.question.QuestionObject;
+import com.mindskip.xzs.domain.ExamPaperQuestionCustomerAnswer;
 import com.mindskip.xzs.service.*;
-import com.mindskip.xzs.utility.DateTimeUtil;
-import com.mindskip.xzs.utility.HtmlUtil;
-import com.mindskip.xzs.utility.JsonUtil;
-import com.mindskip.xzs.utility.PageInfoHelper;
-import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM;
+import com.mindskip.xzs.viewmodel.admin.question.ExamQuestionVO;
 import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM;
-import com.mindskip.xzs.viewmodel.student.question.answer.QuestionAnswerVM;
+import com.mindskip.xzs.viewmodel.student.question.answer.QuestionAnswerVO;
 import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentRequestVM;
 import com.mindskip.xzs.viewmodel.student.question.answer.QuestionPageStudentResponseVM;
-import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.stream.Collectors;
 
 @RestController("StudentQuestionAnswerController")
 @RequestMapping(value = "/api/student/question/answer")
@@ -43,35 +35,17 @@
     @RequestMapping(value = "/page", method = RequestMethod.POST)
     public RestResponse<PageInfo<QuestionPageStudentResponseVM>> pageList(@RequestBody QuestionPageStudentRequestVM model) {
         model.setCreateUser(getCurrentUser().getId());
-        PageInfo<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
-        PageInfo<QuestionPageStudentResponseVM> page = PageInfoHelper.copyMap(pageInfo, q -> {
-//            Subject subject = subjectService.selectById(q.getSubjectId());
-            Integer[] ids = questionSubjectService.getQuestion(q.getQuestionId())
-                    .stream().map(QuestionSubject::getSubjectId).toArray(Integer[]::new);
-            String name = "";
-            if (ids.length > 0) {
-                name = subjectService.selectByIds(ids)
-                        .stream().map(Subject::getName).collect(Collectors.joining(","));
-            }
-            QuestionPageStudentResponseVM vm = modelMapper.map(q, QuestionPageStudentResponseVM.class);
-            vm.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime()));
-            TextContent textContent = textContentService.selectById(q.getQuestionTextContentId());
-            QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class);
-            String clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
-            vm.setShortTitle(clearHtml);
-            vm.setSubjectName(name);
-            return vm;
-        });
-        return RestResponse.ok(page);
+        PageInfo<QuestionPageStudentResponseVM> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
+        return RestResponse.ok(pageInfo);
     }
 
 
     @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
-    public RestResponse<QuestionAnswerVM> select(@PathVariable Integer id) {
-        QuestionAnswerVM vm = new QuestionAnswerVM();
+    public RestResponse<QuestionAnswerVO> select(@PathVariable Integer id) {
+        QuestionAnswerVO vm = new QuestionAnswerVO();
         ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id);
         ExamPaperSubmitItemVM questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer);
-        QuestionEditRequestVM questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
+        ExamQuestionVO questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
         vm.setQuestionVM(questionVM);
         vm.setQuestionAnswerVM(questionAnswerVM);
         return RestResponse.ok(vm);

--
Gitblit v1.8.0