package com.yida.data.school.fallback.transaction;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.school.feign.transaction.RemoteProductService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteProductService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteProductServiceFallback implements FallbackFactory<RemoteProductService> {

    @Override
    public RemoteProductService create(Throwable throwable) {
        log.error("RemoteProductService fallback reason:{}", throwable.getMessage());

        return new RemoteProductService() {
            @Override
            public ResultBean upDateProductById(Long id) {
                return null;
            }

            /**
             * 商品催缴任务
             *
             * @param id
             * @return
             */
            @Override
            public ResultBean productSendNotice(Long id) {
                return null;
            }

            /**
             * 监视商品是否失效
             *
             * @return
             */
            @Override
            public ResultBean productMonitor() {
                return null;
            }
        };
    }
}
