package com.boman.web.core.controller;

import com.boman.common.core.utils.DateUtils;
import com.boman.web.core.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author tjf
 * @Date: 2021/08/04/17:48
 */
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
@RestController
@RequestMapping("/task")
public class TaskController {
    @Resource
    private TaskService taskService;
    /**
     * 每月1号往考勤记录表根据用户插入当月的数据 每月一号00:00:05秒
     */
    @Scheduled(cron = "5 0 0 1 * ?")
    private void configureTasks() {
        System.out.println(DateUtils.getNowDate() +"开始执行定时任务");
        taskService.configureTasks();
        System.out.println(DateUtils.getNowDate() +"定时任务结束");
    }

    @GetMapping("/execute")
    private void execute() {
        taskService.execute();
    }

    @GetMapping("/getNewborn")
    private void getNewborn() {
        taskService.getNewborn();
    }

    @GetMapping("/insertAccountingData")
    private void insertAccountingData() {
        taskService.insertAccountingData();
    }


    @GetMapping("/thirdNucleicAcid")
    private void thirdNucleicAcid() {
        taskService.thirdNucleicAcid();
    }


    @GetMapping("/pphshj")
    private void pphshj() {
        taskService.pphshj();
    }


    /**
     * 修改starTime
     */
    @GetMapping("/upStarTime")
    private void upStarTime(String starTime) {
        taskService.upStarTime(starTime);
    }

    @GetMapping("/pphshjNo")
    private void pphshjNo() {
        taskService.pphshjNo();
    }

    @GetMapping("/nucleicAcidStatistics")
    private void nucleicAcidStatistics() {
        taskService.nucleicAcidStatistics();
    }

    @GetMapping("/toQianshanData")
    private void toQianshanData() {
        taskService.toQianshanData();
    }



}
