package com.yuchen.saas.park.api.feign.service.park;

import com.yuchen.saas.park.api.dto.park.AddSubSiteNumReqDTO;
import com.yuchen.saas.park.api.entity.park.PmgBatParkInfo;
import com.yuchen.saas.park.api.util.SaasParkFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author: 肖润飞
 * @Description: TODO
 */
@Component
public class PmgBatParkInfoFeignFallback implements FallbackFactory<PmgBatParkInfoFeignServer> {

    @Override
    public PmgBatParkInfoFeignServer create(Throwable throwable) {

        return new PmgBatParkInfoFeignServer() {
            @Override
            public R<PmgBatParkInfo> detail(PmgBatParkInfo pmgBatParkInfo) {

                return R.error("远程调用失败");
            }

            @Override
            public R addSubSiteNum(AddSubSiteNumReqDTO reqDTO) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}