Commit 41be91ae by 刘宇峰

行程油耗等

1 parent 2e0f353f
package cn.com.glsx.stdinterface.factory;
import cn.com.glsx.stdinterface.api.RouteOilMileageClient;
import cn.com.glsx.stdinterface.fallback.RouteOilMileageFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class RouteOilMileageFallbackFactory implements FallbackFactory<RouteOilMileageClient> {
@Override
public RouteOilMileageClient create(Throwable throwable) {
RouteOilMileageFallbackImpl fallback = new RouteOilMileageFallbackImpl();
fallback.setCause(throwable);
return fallback;
}
}
package cn.com.glsx.stdinterface.fallback;
import cn.com.glsx.stdinterface.api.RouteOilMileageClient;
import cn.com.glsx.stdinterface.dto.RouteOilMileageDto;
import com.glsx.plat.core.web.R;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
@Slf4j
@Component
public class RouteOilMileageFallbackImpl implements RouteOilMileageClient {
@Setter
private Throwable cause;
@Override
public R<List<RouteOilMileageDto>> getListBySn(String sn, String beginTime, String endTime) {
log.warn("getListBySn 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R<Integer> insert(RouteOilMileageDto routeOilMileageDto) {
log.warn("insert 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R<Integer> storeIgnoreExists(Collection<RouteOilMileageDto> collection) {
log.warn("storeIgnoreExists 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
}
...@@ -6,4 +6,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ ...@@ -6,4 +6,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.com.glsx.stdinterface.factory.ElectricFenceFallbackFactory,\ cn.com.glsx.stdinterface.factory.ElectricFenceFallbackFactory,\
cn.com.glsx.stdinterface.fallback.ElectricFenceFallbackImpl,\ cn.com.glsx.stdinterface.fallback.ElectricFenceFallbackImpl,\
cn.com.glsx.stdinterface.factory.ElectricInStoreFallbackFactory,\ cn.com.glsx.stdinterface.factory.ElectricInStoreFallbackFactory,\
cn.com.glsx.stdinterface.fallback.ElectricInStoreFallbackImpl cn.com.glsx.stdinterface.fallback.ElectricInStoreFallbackImpl,\
cn.com.glsx.stdinterface.fallback.RouteOilMileageFallbackImpl
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!