luohairen
2024-11-14 247cb86585a1d1894596ed18a6c93efecb992946
src/main/java/com/ycl/jxkg/controller/student/DashboardController.java
@@ -2,19 +2,19 @@
import com.ycl.jxkg.base.BaseApiController;
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.domain.TaskExam;
import com.ycl.jxkg.domain.TaskExamCustomerAnswer;
import com.ycl.jxkg.domain.TextContent;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
import com.ycl.jxkg.domain.entity.TaskExam;
import com.ycl.jxkg.domain.entity.TaskExamCustomerAnswer;
import com.ycl.jxkg.domain.entity.TextContent;
import com.ycl.jxkg.domain.entity.User;
import com.ycl.jxkg.enums.ExamPaperTypeEnum;
import com.ycl.jxkg.domain.task.TaskItemAnswerObject;
import com.ycl.jxkg.domain.task.TaskItemObject;
import com.ycl.jxkg.service.*;
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.utils.JsonUtil;
import com.ycl.jxkg.vo.student.dashboard.*;
import com.ycl.jxkg.domain.vo.student.dashboard.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@RestController("StudentDashboardController")
@RequestMapping(value = "/api/student/dashboard")
public class DashboardController extends BaseApiController {
@@ -34,16 +35,6 @@
    private final TaskExamService taskExamService;
    private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
    private final TextContentService textContentService;
    @Autowired
    public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
        this.userService = userService;
        this.examPaperService = examPaperService;
        this.questionService = questionService;
        this.taskExamService = taskExamService;
        this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
        this.textContentService = textContentService;
    }
    @RequestMapping(value = "/index", method = RequestMethod.POST)
    public Result<IndexVO> index() {
@@ -58,7 +49,7 @@
        PaperFilter timeLimitPaperFilter = new PaperFilter();
        timeLimitPaperFilter.setDateTime(new Date());
        timeLimitPaperFilter.setGradeLevel(user.getUserLevel());
        timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode());
        timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.Random.getCode());
        List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter);
        List<PaperInfoVO> paperInfoVOS = limitPaper.stream().map(d -> {
@@ -97,12 +88,12 @@
    private List<TaskItemPaperVO> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) {
        TextContent textContent = textContentService.selectById(tFrameId);
        TextContent textContent = textContentService.getById(tFrameId);
        List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class);
        List<TaskItemAnswerObject> answerPaperItems = null;
        if (null != taskExamCustomerAnswers) {
            TextContent answerTextContent = textContentService.selectById(taskExamCustomerAnswers.getTextContentId());
            TextContent answerTextContent = textContentService.getById(taskExamCustomerAnswers.getTextContentId());
            answerPaperItems = JsonUtil.toJsonListObject(answerTextContent.getContent(), TaskItemAnswerObject.class);
        }