package com.rongwei.training.controller;

import com.rongwei.trainingcommon.sys.service.SendMailService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮件提醒Controller
 * SendMailController class
 *
 * @author XH
 * @date 2020/11/27
 */
@RestController
@RequestMapping("mail")
@Slf4j
public class SendMailController {
    @Autowired
    private SendMailService sendMailService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @PostMapping("/start/reminder-email")
    public void startReminderMail() {
        log.info("开始发送培训提醒邮件");
        sendMailService.startReminderEmail();
    }

    @PostMapping("/end/reminder-email")
    public void endReminderMail() {
        log.info("开始发送考试截止提醒邮件");
        sendMailService.endReminderEmail(false);
    }
    @PostMapping("/no/take-exam")
    public void notTestMail(){
        log.info("开始发送未考试人员提醒邮件");
        sendMailService.endReminderEmail(true);
    }
}
