package com.zhongzheng.controller.schedule;

import com.zhongzheng.common.core.controller.BaseController;
import com.zhongzheng.common.core.domain.AjaxResult;
import com.zhongzheng.modules.schedule.service.IScheduleService;
import com.zhongzheng.modules.user.bo.UserQueryBo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 定时任务
 *
 * @author ruoyi
 * @date 2021-11-10
 */
@Api(value = "定时任务", tags = {"定时任务管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/app/common")
public class ScheduleController extends BaseController {

    private final IScheduleService iScheduleService;


    /**
     * 商品购买发送消息
     * @return
     */
    @ApiOperation("商品购买发送消息")
    @GetMapping("/updateGoodsSend")
    public AjaxResult updateGoodsSend(UserQueryBo bo) {
        iScheduleService.updateGoodsSend(bo);
        return AjaxResult.success();
    }


    /**
     * 考试提醒
     * @return
     */
    @ApiOperation("考试预约提醒")
    @GetMapping("/updateExamSend")
    public AjaxResult updateExamSend(UserQueryBo bo) {
        iScheduleService.updateExamSend(bo);
        return AjaxResult.success();
    }


    /**
     * 考试提醒
     * @return
     */
    @ApiOperation("每天10点请求的考试提醒")
    @GetMapping("/timeSend")
    public AjaxResult timeSend(UserQueryBo bo) {
        iScheduleService.timeSend(bo);
        return AjaxResult.success();
    }


    /**
     * 订单超时关闭
     * @return
     */
    @ApiOperation("订单超时关闭")
    @GetMapping("/outTimeOrder")
    public AjaxResult outTimeOrder() {
        iScheduleService.closeTimeOutOrder();
        return AjaxResult.success();
    }

    /**
     * 考试提醒
     * @return
     */
    @ApiOperation("考试预约提醒")
    @GetMapping("/issue")
    public AjaxResult updateIssue(UserQueryBo bo) {
        iScheduleService.updateIssue(bo);
        return AjaxResult.success();
    }
}
