package com.mindskip.xzs.controller.admin;
|
|
import com.mindskip.xzs.base.BaseApiController;
|
import com.mindskip.xzs.base.RestResponse;
|
import com.mindskip.xzs.service.*;
|
import com.mindskip.xzs.utility.DateTimeUtil;
|
import com.mindskip.xzs.viewmodel.admin.dashboard.IndexVM;
|
import lombok.AllArgsConstructor;
|
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;
|
|
/**
|
* @version 2.2.0
|
* @description: 主页
|
* Copyright (C), 2020-2021, 武汉思维跳跃科技有限公司
|
* @date 2021 /9/7 9:45
|
*/
|
@RestController("AdminDashboardController")
|
@RequestMapping(value = "/api/admin/dashboard")
|
@AllArgsConstructor
|
public class DashboardController extends BaseApiController {
|
|
|
private final ExamPaperService examPaperService;
|
private final QuestionService questionService;
|
private final ExamPaperAnswerService examPaperAnswerService;
|
private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
|
private final UserEventLogService userEventLogService;
|
|
/**
|
* 月答题数、答卷数、用户活跃度
|
*
|
* @return the rest response
|
*/
|
@RequestMapping(value = "/index", method = RequestMethod.POST)
|
public RestResponse<IndexVM> Index() {
|
IndexVM vm = new IndexVM();
|
|
Integer examPaperCount = examPaperService.selectAllCount();
|
Integer questionCount = questionService.selectAllCount();
|
Integer doExamPaperCount = examPaperAnswerService.selectAllCount();
|
Integer doQuestionCount = examPaperQuestionCustomerAnswerService.selectAllCount();
|
|
vm.setExamPaperCount(examPaperCount);
|
vm.setQuestionCount(questionCount);
|
vm.setDoExamPaperCount(doExamPaperCount);
|
vm.setDoQuestionCount(doQuestionCount);
|
|
List<Integer> mothDayUserActionValue = userEventLogService.selectMothCount();
|
List<Integer> mothDayDoExamQuestionValue = examPaperQuestionCustomerAnswerService.selectMothCount();
|
vm.setMothDayUserActionValue(mothDayUserActionValue);
|
vm.setMothDayDoExamQuestionValue(mothDayDoExamQuestionValue);
|
|
vm.setMothDayText(DateTimeUtil.MothDay());
|
return RestResponse.ok(vm);
|
}
|
}
|