From 8d7ac07e5966987c1d4ba55988e2c2b53bdbb5db Mon Sep 17 00:00:00 2001 From: xyiege Date: Sat, 22 Oct 2022 21:08:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../szwh/controller/api/GoodsController.java | 25 ++++++++++++++++--- src/test/java/cn/chjyj/szwh/ApiTest.java | 4 +-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java b/src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java index e83af23..97bcb26 100644 --- a/src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java +++ b/src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java @@ -68,7 +68,7 @@ public class GoodsController extends BaseController { * @param goods_type * @return */ - @PostMapping("/getTypeGoods") + @RequestMapping("/getTypeGoods") public JSONObject getTypeGoods(String type,String createtime,String goods_type){ //10长的时间戳 long startTime = System.currentTimeMillis(); @@ -76,9 +76,9 @@ public class GoodsController extends BaseController { long endtime = System.currentTimeMillis(); JSONObject outjson = new JSONObject(); if(goodsList!=null){ - outjson.put("code","success"); + outjson.put("code","00000000"); outjson.put("msg","成功"); - outjson.put("userTime",(endtime-startTime)/1000l+"ms"); + outjson.put("useTime",(endtime-startTime)/1000l+"ms"); outjson.put("data",goodsList); }else{ outjson.put("code","failure"); @@ -87,11 +87,28 @@ public class GoodsController extends BaseController { return outjson; } + @PostMapping("/getTypeGoods/{type}") + public JSONObject getTypeGoodsRest(@PathVariable String type){ + long startTime = System.currentTimeMillis(); + List goodsList = goodsService.getTypeGoods(type,"",""); + long endtime = System.currentTimeMillis(); + JSONObject outjson = new JSONObject(); + if(goodsList!=null){ + outjson.put("code","00000000"); + outjson.put("msg","成功"); + outjson.put("useTime",(endtime-startTime)/1000l+"ms"); + outjson.put("data",goodsList); + }else{ + outjson.put("code","failure"); + outjson.put("msg","请求失败"); + } + return outjson; + } /** * 接口处理搜索 * @return */ - @PostMapping("/searchGoods") + @RequestMapping("/searchGoods") public JSONObject searchGoods(@RequestBody String reqstr){ //{"pay_type":1,"goods_status":1,"record_type":"","entrust_name":"clytest1012-1","entrust_user_name":"","page":1,"limit":8} log.info("查询委托信息接口:"+reqstr); diff --git a/src/test/java/cn/chjyj/szwh/ApiTest.java b/src/test/java/cn/chjyj/szwh/ApiTest.java index b31924b..c4b5915 100644 --- a/src/test/java/cn/chjyj/szwh/ApiTest.java +++ b/src/test/java/cn/chjyj/szwh/ApiTest.java @@ -187,8 +187,8 @@ public class ApiTest { @Test public void syncOrder(){ System.out.println("同步订单信息"); - JSONObject json = SzwhApiUtils.synchInfo(); - System.out.println(json); + //JSONObject json = SzwhApiUtils.synchInfo(); + //System.out.println(json); } @Test