package com.kxs.daemon.quartz.task;

import com.kxs.common.core.constant.SecurityConstants;
import com.kxs.daemon.quartz.constants.SkyQuartzEnum;
import com.kxs.system.api.feign.RemoteSysService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 系统模块 Bean 任务
 *
 * @author 没秃顶的码农
 * @date 2024-03-21
 */
@Slf4j
@Component("systemBeanTask")
@RequiredArgsConstructor
public class SystemBeanTask {

    private final RemoteSysService remoteSysJobService;


    /**
     *  统计训练营奖金池
     */
    @SneakyThrows
    public String campPrizePoolSchedule() {
        log.info("统计训练营奖金池:{}", LocalDateTime.now());
        try {
            remoteSysJobService.poweronQuantityStatistics(SecurityConstants.FROM_IN);
            return SkyQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();

        }catch (Exception e){
            log.error(e.getLocalizedMessage());
        }
        return SkyQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
    }
}
