package com.malk.siku.schedule;

import com.malk.siku.service.SikuTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * @EnableScheduling 开启定时任务 [配置参考McScheduleTask]
 */
@Slf4j
@Configuration
@EnableScheduling
@ConditionalOnProperty(name = {"enable.scheduling"})
public class SikuTask {

    @Autowired
    private SikuTaskService sikuTaskService;

    //定时同步借款台账
    //早上9点至晚上6点 每小时同步一次
    @Scheduled(cron = "0 0 9-18 * * ?")
    public void syncMaterial(){
        sikuTaskService.syncLoanManage();
    }

}
