package com.ruoyi.zzb.study.controller;

import com.ruoyi.zzb.study.service.CrondCrawlerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Slf4j
@RestController
@RequestMapping("/api/study")
public class CrondCrawlerController {
    @Autowired
    private CrondCrawlerService crondCrawlerService;

    @RequestMapping(value = "/crawlergaw", method = RequestMethod.GET)
    public void crawlerGAWSchedule() throws IOException {
        log.info("{} ： {} ms",  "GAW理论前沿调度任务开始！");
        int nums =  crondCrawlerService.crawlerDocGawLLQY();
        log.info("{} ： {} 条",  "GAW理论前沿调度任务结束！",nums);


        log.info("{} ： {} ms",  "GAW学习园地调度任务开始！");
        nums =  crondCrawlerService.crawlerDocGawXXYD();
        log.info("{} ： {} 条",  "GAW学习园地调度任务结束！",nums);
    }

}
