package com.kxs.daemon.quartz.task;

import com.kxs.common.core.constant.SecurityConstants;
import com.kxs.daemon.quartz.constants.SkyQuartzEnum;
import com.kxs.product.api.feign.RemoteKxsProductService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 产品模块 Bean 任务
 *
 * @author 没秃顶的码农
 * @date 2024-03-21
 */
@Slf4j
@Component("productBeanTask")
@RequiredArgsConstructor
public class ProductBeanTask {

    private final RemoteKxsProductService remoteKxsProductService;

    /**
     *  循环过期机具添加预扣款
     */
    @SneakyThrows
    public String recycleMachineSchedule(String para) {
        log.info("循环过期机具添加预扣款:{}，输入参数{}", LocalDateTime.now(), para);
        try {
            remoteKxsProductService.recycleMachineSchedule(para, SecurityConstants.FROM_IN);
            return SkyQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();

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