package com.gree.mall.manager.schedule;



import com.gree.mall.manager.logic.SyncOrderInfoLogic;
import com.gree.mall.manager.logic.policy.AgreementLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.mail.MessagingException;
import java.io.IOException;

/**
 * 定时购买保险
 */
@ConditionalOnProperty(name = "schedule.gongdan.enable", havingValue = "true", matchIfMissing = true)
@Component
public class SyncSchedule {


    @Autowired
    private SyncOrderInfoLogic syncOrderInfoLogic;



    //同步工单数据
    @Scheduled(fixedDelay =10* 1000)
    public void task() throws IOException {
        syncOrderInfoLogic.syncGuang();
    }


    //同步工单数据
    @Scheduled(fixedDelay = 10* 1000)
    public void task2() throws IOException, MessagingException {
        syncOrderInfoLogic.syncDetail();
    }



    //同步工单数据
    @Scheduled(fixedDelay = 5* 1000)
    public void task3() throws IOException, MessagingException {
        syncOrderInfoLogic.task3();
    }

}
