1 package com.fdd.op.autoconfigure.http.client.service; 2 3 import com.alibaba.fastjson.JSONObject; 4 import com.fdd.op.autoconfigure.http.feign.FeignHttpClientConfiguration; 5 import org.springframework.cloud.openfeign.FeignClient; 6 import org.springframework.web.bind.annotation.PostMapping; 7 import org.springframework.web.bind.annotation.RequestBody; 8 import org.springframework.web.bind.annotation.RequestHeader; 9 10 import java.net.URI; 11 12 13 /** 14 * API 回調 feign 15 * url = "EMPTY" 隨便填都行,會被下方的參數URI 覆蓋 16 * 17 * @author kuangql 18 */ 19 @FeignClient(name = "apiServiceClient", url = "EMPTY", configuration = FeignHttpClientConfiguration.class) 20 public interface ApiServiceClient { 21 22 23 /** 24 * api 回調 25 * 26 * @param url 動態地址 27 * @param jsonObject json 回調值 28 * @param opAppId head 29 * @param opNonce head 30 * @param opTimestamp head 31 * @param opSignType head 32 * @param opVersion head 33 * @param opSign head 34 * @return result 35 */ 36 @PostMapping(headers = {"Content-Type: application/json"}) 37 String sendApiNotify(URI url, @RequestBody JSONObject jsonObject, 38 @RequestHeader("opAppId") String opAppId, @RequestHeader("opNonce") String opNonce, 39 @RequestHeader("opTimestamp") String opTimestamp, @RequestHeader("opSignType") String opSignType, 40 @RequestHeader("opVersion") String opVersion, @RequestHeader("opSign") String opSign 41 ); 42 43 }
測試過很多注解傳header,但是會翻車。
需要設置超時,重試次數,參考。
https://blog.csdn.net/kysmkj/article/details/89672952