package com.muyu.remote.factory;

import com.muyu.common.core.domain.Result;
import com.muyu.domain.req.MessageValueReq;
import com.muyu.domain.resp.MessageValueListResp;
import com.muyu.remote.RemoteMessageValueService;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

/**
 * 文件服务降级工厂
 * @version 1.0
 * @Author xie ya ru
 * @Date 2024/9/28 21:04
 */
@Log4j2
public class RemoteMessageValueFallbackFactory implements FallbackFactory<RemoteMessageValueService> {
    @Override
    public RemoteMessageValueService create(Throwable cause) {
        log.error("文件服务调用失败：{}",cause.getMessage());
        return new RemoteMessageValueService() {
            @Override
            public Result<List<MessageValueListResp>> findAll(MessageValueReq messageValueReq) {
                return Result.error("查询数据失败："+cause.getMessage());
            }

            @Override
            public Result<Long> findByTemplateId(String stringVin) {
                return Result.error("查询数据失败："+cause.getMessage());
            }
        };
    }
}
