package com.ycl.jxkg.controller.admin; import com.ycl.jxkg.base.BaseApiController; import com.ycl.jxkg.base.Result; import com.ycl.jxkg.service.*; 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 ExamPaperScoreService examPaperScoreService; private final ExamPaperScoreDetailService examPaperScoreDetailService; private final UserEventLogService userEventLogService; @RequestMapping(value = "/index", method = RequestMethod.POST) public Result Index() { IndexVO vm = new IndexVO(); Integer examPaperCount = examPaperService.selectAllCount(); Integer questionCount = questionService.selectAllCount(); Integer doExamPaperCount = examPaperScoreService.selectAllCount(); Integer doQuestionCount = examPaperScoreService.selectAllQuestionCount(); vm.setExamPaperCount(examPaperCount); vm.setQuestionCount(questionCount); vm.setDoExamPaperCount(doExamPaperCount); vm.setDoQuestionCount(doQuestionCount); List mothDayUserActionValue = userEventLogService.selectMothCount(); List mothDayDoExamQuestionValue = examPaperScoreDetailService.selectMothCount(); vm.setMothDayUserActionValue(mothDayUserActionValue); vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue); vm.setMothDayText(DateTimeUtil.MothDay()); return Result.ok(vm); } }