package com.zhongshu.card.server.core.service.schedule;

import com.zhongshu.card.client.type.ScheduleType;
import com.zhongshu.card.server.core.domain.schedule.ScheduleTaskConfig;
import com.zhongshu.card.server.core.service.payment.PayCallService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author TRX
 * @date 2024/11/6
 */
@Slf4j
@Service
public class TaskContextService {

    @Autowired
    private PayCallService payCallService;

    /**
     * 执行接收
     *
     * @param taskConfig
     */
    public void execute(ScheduleTaskConfig taskConfig) {
        log.info("定时任务执行： {}", taskConfig.getScheduleType().getRemark());
        ScheduleType scheduleType = taskConfig.getScheduleType();
        if (scheduleType == ScheduleType.SettlementTask) {
            payCallService.settlement(taskConfig);
        } else {
            log.error("定时任务为");
        }
    }

}
