package com.hzs.third.job;

import com.hzs.activity.other.IAcOtherServiceApi;
import com.hzs.common.core.domain.R;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@ConditionalOnProperty(name = "xxl-job.start", havingValue = "true")
public class ActivityJob {

    @DubboReference
    IAcOtherServiceApi iAcOtherServiceApi;

    /**
     * 车奖、旅游奖等定时任务
     */
    @XxlJob("acOtherPrice")
    public void acOtherPrice() {
        log.info("车奖、旅游奖等业绩处理");
        R<?> resultR = iAcOtherServiceApi.acOtherPriceHandle();
        if (resultR.isSuccess()) {
            log.info("车奖、旅游奖等业绩处理完成");
        } else {
            log.warn("车奖、旅游奖等业绩处理失败，{}", resultR.getMsg());
        }
    }

}
