回传地址修改

master
anthonyywj2 3 years ago
parent 1563527fa1
commit 37addc4eb0

@ -1,12 +1,7 @@
package com.glxp.mipsdl.admin.controller;
import com.glxp.mipsdl.admin.client.http.PhxyyClient;
import com.glxp.mipsdl.admin.req.*;
import com.glxp.mipsdl.common.res.BaseResponse;
import com.glxp.mipsdl.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
@ -18,29 +13,29 @@ public class TestController {
private PhxyyClient phxyyClient;
@PostMapping("/test/getUnit")
public BaseResponse getUnit(@RequestBody UdiwmsUnitRequest unitRequest) {
return ResultVOUtils.success(phxyyClient.getUnit(unitRequest));
}
@PostMapping("/test/getPrdoucts")
public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest){
return ResultVOUtils.success(phxyyClient.getProducts(udiwmsProductRequest));
}
@PostMapping("/test/getOrderTypes")
public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest){
return ResultVOUtils.success(phxyyClient.getOrderTypes(udiwmsBusTypeRequest));
}
@PostMapping("/test/submitOrders")
public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest){
return ResultVOUtils.success(phxyyClient.submitOrders(udiwmsOrderRequest));
}
@PostMapping("/test/getWarehouse")
public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest){
return ResultVOUtils.success(phxyyClient.getWarehouse(udiwmsWarehouseRequest));
}
// @PostMapping("/test/getUnit")
// public BaseResponse getUnit(@RequestBody UdiwmsUnitRequest unitRequest) {
// return ResultVOUtils.success(phxyyClient.getUnit(unitRequest));
// }
//
// @PostMapping("/test/getPrdoucts")
// public BaseResponse getProducts(UdiwmsProductRequest udiwmsProductRequest){
// return ResultVOUtils.success(phxyyClient.getProducts(udiwmsProductRequest));
// }
//
// @PostMapping("/test/getOrderTypes")
// public BaseResponse getOrderTypes(UdiwmsBusTypeRequest udiwmsBusTypeRequest){
// return ResultVOUtils.success(phxyyClient.getOrderTypes(udiwmsBusTypeRequest));
// }
//
// @PostMapping("/test/submitOrders")
// public BaseResponse submitOrders(UdiwmsOrderRequest udiwmsOrderRequest){
// return ResultVOUtils.success(phxyyClient.submitOrders(udiwmsOrderRequest));
// }
//
// @PostMapping("/test/getWarehouse")
// public BaseResponse getWarehouse(UdiwmsWarehouseRequest udiwmsWarehouseRequest){
// return ResultVOUtils.success(phxyyClient.getWarehouse(udiwmsWarehouseRequest));
// }
}

@ -2,36 +2,40 @@ package com.glxp.mipsdl.admin.http;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.mipsdl.admin.config.ThirdSysConfig;
import com.glxp.mipsdl.admin.req.system.PostFileThrOrderRequest;
import com.glxp.mipsdl.admin.req.system.PostThrCorpRequest;
import com.glxp.mipsdl.admin.req.system.PostThrInvProductsRequest;
import com.glxp.mipsdl.admin.req.system.PostThrProductsRequest;
import com.glxp.mipsdl.admin.util.HttpClient;
import com.glxp.mipsdl.common.res.BaseResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class UdiwmsClient {
@Resource
private ThirdSysConfig thirdSysConfig;
@Value("${UDIWMS_IP}")
private String udiWmsUrl;
@Value("${API_KEY}")
private String apiKey;
@Value("${API_SECRET}")
private String apiSecret;
public HttpHeaders getHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("api_key", thirdSysConfig.getThirdSysConfig().getApikey());
headers.add("secret_key", thirdSysConfig.getThirdSysConfig().getSecretkey());
headers.add("api_key", apiKey);
headers.add("secret_key", apiSecret);
return headers;
}
public BaseResponse postProducts(PostThrProductsRequest postThrProductsRequest) {
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + "/udiwms/thrsys/postThrProducts", postThrProductsRequest, getHeaders());
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postThrProducts", postThrProductsRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
@ -40,7 +44,7 @@ public class UdiwmsClient {
public BaseResponse postCorps(PostThrCorpRequest postThrCorpRequest) {
postThrCorpRequest.setUploadType("文件导入");
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + "/udiwms/thrsys/postCorps", postThrCorpRequest, getHeaders());
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postCorps", postThrCorpRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
@ -48,7 +52,7 @@ public class UdiwmsClient {
}
public BaseResponse postOrderDetail(PostFileThrOrderRequest postFileThrOrderRequest) {
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + "/udiwms/thrsys/postFileOrder", postFileThrOrderRequest, getHeaders());
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postFileOrder", postFileThrOrderRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});
@ -56,7 +60,7 @@ public class UdiwmsClient {
}
public BaseResponse postInvProducts(PostThrInvProductsRequest postThrInvProductsRequest) {
String response = HttpClient.postJson(thirdSysConfig.getThirdSysConfig().getThirdSysUrl() + "/udiwms/thrsys/postInvProducts", postThrInvProductsRequest, getHeaders());
String response = HttpClient.postJson(udiWmsUrl + "/udiwms/thrsys/postInvProducts", postThrInvProductsRequest, getHeaders());
BaseResponse baseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
});

Loading…
Cancel
Save