package com.dayou.dyoa.task;

import com.dayou.dyoa.IDyoaHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class FetchDyoaDataSchedule {

    @Autowired
    private IDyoaHistoryService dyoaHistoryService;

    //每天凌晨01:30触发
    @Scheduled(cron = "0 30 1 * * ?")
    public void syncDyoaPersonalData(){
        dyoaHistoryService.fetchDyoaPersonalOrder();
        log.info("同步个贷数据完成");
    }

    //每天凌晨02:30触发
    @Scheduled(cron = "0 30 2 * * ?")
    public void syncDyoaMajorData(){
        dyoaHistoryService.fetchDyoaMajorOrderProduction();
        log.info("同步大中型数据完成");
    }



    //每天凌晨03:30触发
    @Scheduled(cron = "0 30 3 * * ?")
    public void syncAssetsData(){
        dyoaHistoryService.fetchAssetsOrderProduction();
        log.info("同步资产数据完成");
    }

    //每天凌晨03:30触发
    @Scheduled(cron = "0 40 3 * * ?")
    public void updateAssetsMembers(){
        dyoaHistoryService.updateAssetsMembers();
        log.info("更新资产订单的项目成员和签字师完成");
    }

    //每天凌晨04:30触发
    @Scheduled(cron = "0 30 4 * * ?")
    public void syncRealAmountData(){
        dyoaHistoryService.fetchRealAmount();
        log.info("同步实收款数据完成");
    }

    //每天凌晨05:00触发
    @Scheduled(cron = "0 0 5 * * ?")
    public void syncRealClaimData(){
        dyoaHistoryService.fetchRealAmountClaimData();
        log.info("同步实收款认领数据完成");
    }

    //每天凌晨06:00触发
    @Scheduled(cron = "0 0 6 * * ?")
    public void syncFinanceInvoiceData(){
        dyoaHistoryService.fetchFinanceInvoiceRecord();
        log.info("同步财务开票数据完成");
    }


    //每天凌晨06:10触发
    @Scheduled(cron = "0 10 6 * * ?")
    public void updateMajorProduction(){
        dyoaHistoryService.updateMajorProduction();
        log.info("同步大中型产品信息完成");
    }

    //每天凌晨06:20触发
    @Scheduled(cron = "0 20 6 * * ?")
    public void updateMajorProductionTime(){
        dyoaHistoryService.majorProductionTime();
        log.info("同步大中型产品出具时间完成");
    }

    //每天凌晨06:40触发
    @Scheduled(cron = "0 40 6 * * ?")
    public void updateProductionFund(){
        dyoaHistoryService.updateProductionFund();
        log.info("更新产品应收款记录");
    }

    //每天凌晨06:50触发
    @Scheduled(cron = "0 50 6 * * ?")
    public void updateClaimProductionId(){
        dyoaHistoryService.updateClaimProductionId();
        log.info("更新实收款认领记录的产品收款id");
    }

    //每天凌晨06:55触发
    @Scheduled(cron = "0 55 6 * * ?")
    public void updateCommissionDeclare(){
        dyoaHistoryService.updateCommissionDeclare();
        log.info("更新大中型提成申报完成");
    }


    //每天凌晨06:55触发
    @Scheduled(cron = "0 58 6 * * ?")
    public void updateAssetsProduction(){
        dyoaHistoryService.updateAssetsProduction();
        log.info("更新资产产品出入库状态");
    }

    //每天凌晨07：00触发
    @Scheduled(cron = "0 00 7 * * ?")
    public void updatePersonalProduction(){
        dyoaHistoryService.updatePersonalProduction();
        log.info("更新个贷出入库状态");
    }


}
