
package com.tmerclub.cloud.distribution.task;

import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.distribution.service.DistributionUserIncomeService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 分销佣金结算
 * @author cl
 * @date 2021-08-23 09:26:53
 */
@Component
public class DistributionCommissionSettlementTask {

    private static final Logger log = LoggerFactory.getLogger(DistributionCommissionSettlementTask.class);

    @Autowired
    private DistributionUserIncomeService distributionUserIncomeService;

    /**
     * 确认收货15天后分销订单结算
     */
    @XxlJob("distributionCommissionSettlement")
    public void distributionCommissionSettlement() {
        log.info("开始执行分销订单结算任务》》》》》》》》》》》》》》》》》》》》》");

        distributionUserIncomeService.commissionSettlementHandle(DateUtil.offsetDay(new Date(), -Constant.DISTRIBUTION_SETTLEMENT_TIME));

        log.info("结束执行分销订单结算任务》》》》》》》》》》》》》》》》》》》》》");
    }
}
