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