fuliqi
2024-10-29 8883d90ba7d60a61590b715d1a3be9e3ae2adb2d
src/main/java/com/ycl/jxkg/controller/admin/DashboardController.java
@@ -1,44 +1,36 @@
package com.ycl.jxkg.controller.admin;
import com.ycl.jxkg.base.BaseApiController;
import com.ycl.jxkg.base.RestResponse;
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.service.*;
import com.ycl.jxkg.utility.DateTimeUtil;
import com.ycl.jxkg.viewmodel.admin.dashboard.IndexVM;
import org.springframework.beans.factory.annotation.Autowired;
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.domain.vo.admin.dashboard.IndexVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequiredArgsConstructor
@RestController("AdminDashboardController")
@RequestMapping(value = "/api/admin/dashboard")
public class DashboardController extends BaseApiController {
    private final ExamPaperService examPaperService;
    private final QuestionService questionService;
    private final ExamPaperAnswerService examPaperAnswerService;
    private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
    private final ExamPaperScoreService examPaperScoreService;
    private final ExamPaperScoreDetailService examPaperScoreDetailService;
    private final UserEventLogService userEventLogService;
    @Autowired
    public DashboardController(ExamPaperService examPaperService, QuestionService questionService, ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, UserEventLogService userEventLogService) {
        this.examPaperService = examPaperService;
        this.questionService = questionService;
        this.examPaperAnswerService = examPaperAnswerService;
        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
        this.userEventLogService = userEventLogService;
    }
    @RequestMapping(value = "/index", method = RequestMethod.POST)
    public RestResponse<IndexVM> Index() {
        IndexVM vm = new IndexVM();
    public Result<IndexVO> Index() {
        IndexVO vm = new IndexVO();
        Integer examPaperCount = examPaperService.selectAllCount();
        Integer questionCount = questionService.selectAllCount();
        Integer doExamPaperCount = examPaperAnswerService.selectAllCount();
        Integer doQuestionCount = examPaperQuestionCustomerAnswerService.selectAllCount();
        Integer doExamPaperCount = examPaperScoreService.selectAllCount();
        Integer doQuestionCount = examPaperScoreService.selectAllQuestionCount();
        vm.setExamPaperCount(examPaperCount);
        vm.setQuestionCount(questionCount);
@@ -46,11 +38,11 @@
        vm.setDoQuestionCount(doQuestionCount);
        List<Integer> mothDayUserActionValue = userEventLogService.selectMothCount();
        List<Integer> mothDayDoExamQuestionValue = examPaperQuestionCustomerAnswerService.selectMothCount();
        List<Integer> mothDayDoExamQuestionValue = examPaperScoreDetailService.selectMothCount();
        vm.setMothDayUserActionValue(mothDayUserActionValue);
        vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue);
        vm.setMothDayText(DateTimeUtil.MothDay());
        return RestResponse.ok(vm);
        return Result.ok(vm);
    }
}