package com.yonge.cooleshow.student.task;

import com.yonge.cooleshow.biz.dal.entity.StudentTotal;
import com.yonge.cooleshow.biz.dal.service.*;
import com.yonge.cooleshow.common.controller.BaseController;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @Author: liweifan
 * @Data: 2022/3/28 15:50
 */
@RestController
@RequestMapping("/task")
@ApiIgnore
public class TaskController extends BaseController {
    @Autowired
    private StudentTotalService studentTotalService;
    @Autowired
    private StudentTimeService studentTimeService;
    @Autowired
    private VipCardRecordService vipCardRecordService;
    @Autowired
    private CourseRepliedService repliedService;
    /***
     * 查询所有学生统计数据
     * @author liweifan
     * @updateTime 2022/4/29 19:12
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.util.List<com.yonge.cooleshow.biz.dal.entity.StudentTotal>>
     */
    @GetMapping("/queryStudentTotal")
    public HttpResponseResult<List<StudentTotal>> queryStudentTotal() {
        return succeed(studentTotalService.queryStudentTotal());
    }

    /***
     * 半小时一次
     * @author liweifan
     * @updateTime 2022/4/29 19:12
     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.lang.Boolean>
     */
    @GetMapping("/halfHourTask")
    public HttpResponseResult<Boolean> halfHourTask() {
        //统计学员第一次购买时间
        studentTimeService.totalStudentTime();
        //会员卡到期提醒
        vipCardRecordService.pollExpireMsg();
        return succeed(true);
    }

    /**
     * @Description: 当日陪练课未对老师评价（每晚9点，已评价不发）
     * @Author: cy
     * @Date: 2022/5/6
     */
    @GetMapping("/noRepliedTeacher")
    public HttpResponseResult noRepliedTeacher() {
        repliedService.noRepliedTeacher();
        return succeed();
    }
}
