48 lines
1.6 KiB
Java
48 lines
1.6 KiB
Java
package com.ping.study.test;
|
|
|
|
import com.ping.study.model.dto.tx.TxMatchRequest;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
|
|
|
|
@RestController
|
|
@RequestMapping("/test")
|
|
public class TxMatch {
|
|
|
|
private final WebClient webClient;
|
|
|
|
public TxMatch(@Qualifier("matchWebClient") WebClient webClient) {
|
|
this.webClient = webClient;
|
|
}
|
|
|
|
@RequestMapping("/match")
|
|
public String getMatch() {
|
|
TxMatchRequest request = new TxMatchRequest();
|
|
System.out.println("TxMatchRequest = " + request);
|
|
|
|
// 正式发起请求
|
|
return webClient.get()
|
|
.uri(uriBuilder -> {
|
|
uriBuilder.path("/matchUnion/list")
|
|
.queryParam("today", request.getToday())
|
|
.queryParam("startTime", request.getStartTime())
|
|
.queryParam("endTime", request.getEndTime())
|
|
.queryParam("columnId", request.getColumnId())
|
|
.queryParam("index", request.getIndex())
|
|
.queryParam("isInit", request.getIsInit())
|
|
.queryParam("timestamp", request.getTimestamp())
|
|
.queryParam("callback", request.getCallback());
|
|
return uriBuilder.build();
|
|
})
|
|
.retrieve()
|
|
.bodyToMono(String.class)
|
|
.block();
|
|
}
|
|
|
|
|
|
|
|
}
|