package cn.pluss.platform.job;

import cn.pluss.platform.user.UserProfitService;
import cn.pluss.platform.userApp.UserAppService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 *
 *计算每个月用户流水是否达标进行升级
 *@author: bzg
 *@time: 2022/1/20 16:46
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = "scheduling", name = "enabled", havingValue = "true")
public class CalcUserLevelJob {

    @Resource
    private UserProfitService userProfitService;

    /**
     * 计算每个月用户流水是否达标进行升级
     * 每个月1号 1：30执行 获取上个月的交易流水 判断是否达标进行升级
     * @date: 2022/1/14 14:14
     */
    @Scheduled(cron = "0 30 1 1 * ?")
    public void calcLevelTask(){
        log.info("~~~~~~~~~统计用户流水是否达标定时任务开始~~~~~~~~~~~~");
        userProfitService.calcLevelTask();
        log.info("~~~~~~~~统计用户流水是否达标定时任务结束~~~~~~~~~~~~");
    }
}
