/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.distribution.platform.task;


import cn.hutool.core.date.DateUtil;
import com.yami.shop.common.config.Constant;
import com.yami.shop.distribution.comment.service.DistributionUserIncomeService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 分销佣金结算
 */
@Slf4j
@Component("distributionCommissionSettlementTask")
@AllArgsConstructor
public class DistributionCommissionSettlementTask {

    private final DistributionUserIncomeService distributionUserIncomeService;

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

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

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