package com.jeesharp.business.modules.finance.platformrevenue.application;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 平台收入日汇总定时任务：每日凌晨汇总昨日全平台代收佣金。
 *
 * @author jeesharp
 * @since 2026-06-29
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class PlatformRevenueRollupJob {

    private final PlatformRevenueApplicationService platformRevenueApplicationService;

    @XxlJob("platformRevenueRollupJob")
    public void execute() {
        XxlJobHelper.log("param={}", XxlJobHelper.getJobParam());
        platformRevenueApplicationService.rollupYesterday();
        log.info("平台收入日汇总任务已完成（昨日）");
        XxlJobHelper.handleSuccess("平台收入日汇总任务已完成（昨日）");
    }
}
