From 7488d60cafea1d0dec6b1f8951acfb2c51e55dee Mon Sep 17 00:00:00 2001 From: xyiege Date: Mon, 26 Sep 2022 00:09:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chjyj/szwh/controller/api/OrderController.java | 14 ++++++++------ .../java/cn/chjyj/szwh/utils/SzwhApiUtils.java | 13 ++++++++++++- src/test/java/cn/chjyj/szwh/ApiTest.java | 7 +++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/main/java/cn/chjyj/szwh/controller/api/OrderController.java b/src/main/java/cn/chjyj/szwh/controller/api/OrderController.java index 4b0dfd9..39be3b8 100644 --- a/src/main/java/cn/chjyj/szwh/controller/api/OrderController.java +++ b/src/main/java/cn/chjyj/szwh/controller/api/OrderController.java @@ -4,11 +4,9 @@ import cn.chjyj.szwh.bean.Order; import cn.chjyj.szwh.controller.BaseController; import cn.chjyj.szwh.service.OrderService; import com.alibaba.fastjson2.JSONObject; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; @@ -78,11 +76,15 @@ public class OrderController extends BaseController { /** * 创建订单 - * + * @param reqString 接收到的数据为json字符串 * @return */ @RequestMapping("/createOrder") - public JSONObject createOrder() { + public JSONObject createOrder(@RequestBody String reqString) { + if(StringUtils.isBlank(reqString)){ + JSONObject json = JSONObject.parseObject(reqString); + + } return jsonObject; } diff --git a/src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java b/src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java index 6de5649..ac1fdb5 100644 --- a/src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java +++ b/src/main/java/cn/chjyj/szwh/utils/SzwhApiUtils.java @@ -82,6 +82,16 @@ public class SzwhApiUtils { return json; } + /** + * 获取撤销的商品列表 + * @return + */ + public static JSONObject revocationGoods(){ + JSONObject json = new JSONObject(); + String surl="/consign/exchange/v1/selectRevokeEntrust/exchange"; + return json; + } + /** * 远程获取产品 * @return @@ -110,7 +120,8 @@ public class SzwhApiUtils { String sign=SignUtils.createSign("entrust"); Map hmap = new HashMap(); hmap.put("entrust_token",sign); - JSONObject json = RequestUtils.GetData(url,hmap,true); + // post 方式提交给对方服务器 + JSONObject json = RequestUtils.postData(url,"",hmap); return json; } /** diff --git a/src/test/java/cn/chjyj/szwh/ApiTest.java b/src/test/java/cn/chjyj/szwh/ApiTest.java index 10b38dd..f9af22b 100644 --- a/src/test/java/cn/chjyj/szwh/ApiTest.java +++ b/src/test/java/cn/chjyj/szwh/ApiTest.java @@ -141,6 +141,13 @@ public class ApiTest { } + } + //商品详情 + @Test + public void gdtest(){ + String islicode ="010005-000000000000033057001001-4,010005-000000000000033057001002-3"; + JSONObject retjson = SzwhApiUtils.apiGoodsDetail(islicode); + System.out.println(retjson); } }