From 37addc4eb0db86effb7baa7d781ae7780ea3faa7 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Thu, 19 May 2022 16:48:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E4=BC=A0=E5=9C=B0=E5=9D=80=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/TestController.java | 53 +++++++++---------- .../glxp/mipsdl/admin/http/UdiwmsClient.java | 26 +++++---- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/api-sync/src/main/java/com/glxp/mipsdl/admin/controller/TestController.java b/api-sync/src/main/java/com/glxp/mipsdl/admin/controller/TestController.java index dd32a97..f6902d4 100644 --- a/api-sync/src/main/java/com/glxp/mipsdl/admin/controller/TestController.java +++ b/api-sync/src/main/java/com/glxp/mipsdl/admin/controller/TestController.java @@ -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)); +// } } diff --git a/api-sync/src/main/java/com/glxp/mipsdl/admin/http/UdiwmsClient.java b/api-sync/src/main/java/com/glxp/mipsdl/admin/http/UdiwmsClient.java index f1f33b9..5a68bc6 100644 --- a/api-sync/src/main/java/com/glxp/mipsdl/admin/http/UdiwmsClient.java +++ b/api-sync/src/main/java/com/glxp/mipsdl/admin/http/UdiwmsClient.java @@ -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() { }); @@ -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() { }); @@ -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() { }); @@ -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() { });