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

import com.yuchen.saas.park.api.dto.repair.PmgBatRepairRecordDTO;
import com.yuchen.saas.park.api.util.SaasParkFeignFallbackUtils;
import com.yuchen.saas.park.api.vo.repair.PmgBatRepairRecordAppVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;
/**
 * @Author 蔡文强
 * @Date 2023/6/25 15:56
 * @Description 报修记录远程调用熔断
 */
@Component
public class PmgBatRepairRecordFeignServiceFallback implements FallbackFactory<PmgBatRepairRecordFeignService> {
    @Override
    public PmgBatRepairRecordFeignService create(Throwable throwable) {
        return new PmgBatRepairRecordFeignService() {

            @Override
            public R<Boolean> saveRepairRecord(PmgBatRepairRecordDTO repairRecordDTO) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<PmgBatRepairRecordAppVO>> getMyRepairRecordList() {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
