content: package com.george.springcloud.controller;
  
  import com.george.springcloud.entities.CommonResult;
  import com.george.springcloud.entities.Payment;
  import com.george.springcloud.service.PaymentFeignService;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.annotation.Resource;
  
  /**
   * @author Yang Hao
   * @description
   * @date 2020-09-16 16:43
   */
  @RestController
  @Slf4j
  public class OrderFeignController {
  
      @Resource
      private PaymentFeignService paymentFeignService;
  
      @GetMapping(value = "/consumer/payment/get/{id}")
      public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
          return paymentFeignService.getPaymentById(id);
      }
  
      /**
       * openfeign-ribbon 客户端一般默认等待1秒钟
       * 在服务提供方, 模拟暂停三秒
       *
       * @return
       */
      @GetMapping(value = "/consumer/payment/feign/timeout")
      public String paymentFeignTimeOut() {
          //客户端默认等待1秒钟
          return paymentFeignService.paymentFeignTimeOut();
      }
  }
  