package com.hzs.third.job;

import com.hzs.activity.tourism.IAcTourismServiceApi;
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;

/**
 * 活动涉及定时任务
 */
@Slf4j
@ConditionalOnProperty(name = "xxl-job.start", havingValue = "true")
@Component
public class ActivityJob {

    @DubboReference
    IAcTourismServiceApi iAcTourismServiceApi;

    /**
     * 旅游活动更新积分 定时任务
     */
    @XxlJob("handleTourismData")
    public void handleTourismData() {
        log.info("旅游活动更新积分 开始执行");
        R<?> resultR = iAcTourismServiceApi.handleTourismData();
        if (resultR.isSuccess()) {
            log.info("旅游活动更新积分 执行成功");
        } else {
            log.error("旅游活动更新积分 执行失败");
        }
        log.info("旅游活动更新积分 结束执行");
    }

}
