测试测试环境转发同程请求

This commit is contained in:
lulz1 2024-03-17 22:16:14 +08:00
parent 69bb2ae132
commit 13408b23ef
4 changed files with 34 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.chint.domain.aggregates.order.OrderTravel;
import com.chint.domain.repository.SupplierCallBackLogRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ly.LYNoteResponse;
import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.dto.*;
@ -20,6 +21,7 @@ import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeReques
import com.chint.interfaces.rest.ly.tools.GetObjectNature;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
@Slf4j
@RestController
@ -50,6 +53,9 @@ public class CommonController {
@Autowired
private LYPostRequest postRequest;
@Autowired
private PostRequest basePostRequest;
@Value("${ly.baseUrl}")
private String lyBaseUrl;
@ -58,11 +64,31 @@ public class CommonController {
@Autowired
private SupplierCallBackLogRepository supplierCallBackLogRepository;
@Value("${ly.ifForwardRequest}")
private boolean ifForwardRequest;
@Value("${ly.forwardRequestBaseUrl}")
private String forwardRequestBaseUrl;
private String forwardRequestPath = "/public/common/back";
private String lyConfirmPath = "/api/DomesticFlight/ConfirmFlightOrderChange";
@PostMapping("/back")
public LYNoteResponse Back(@RequestBody Notification notification) {
if(ifForwardRequest){
CompletableFuture.runAsync(()->{
log.info("转发同程订单状态推送");
LYNoteResponse response = basePostRequest
.post(forwardRequestBaseUrl + forwardRequestPath, notification, LYNoteResponse.class);
if(response.getResCode().equals("100")){
log.info("转发同程订单状态推送成功");
} else {
log.info("转发同程订单状态推送失败");
}
});
}
String json = gson.toJson(notification);
log.info(json);

View File

@ -18,6 +18,8 @@ chint:
password: Worktask@Redis2023
database: 5
logging:
level:
org.springframework.jdbc.core.JdbcTemplate: trace
@ -40,6 +42,8 @@ ly:
password: glHRJJ9JMUwNfQ8OwAQi
secret: MnghmYJpM1U2RaLx
baseUrl: https://api.dttrip.cn/openapi
ifForwardRequest: true
forwardRequestBaseUrl: https://gxdev03.chint.com/routeapi/
sf:
openApiBaseUrl: https://openapi.chintcloud.net

View File

@ -38,6 +38,8 @@ ly:
password: glHRJJ9JMUwNfQ8OwAQi
secret: MnghmYJpM1U2RaLx
baseUrl: https://api.dttrip.cn/openapi
ifForwardRequest: true
forwardRequestBaseUrl: https://gxdev03.chint.com/routeapi/
sf:
openApiBaseUrl: https://openapi.chint.com

View File

@ -52,7 +52,8 @@ ly:
password: glHRJJ9JMUwNfQ8OwAQi
secret: MnghmYJpM1U2RaLx
baseUrl: https://api.dttrip.cn/openapi
ifForwardRequest: false
forwardRequestBaseUrl: https://gxdev03.chint.com/routeapi/
sf:
openApiBaseUrl: https://openapi.chintcloud.net