Browse Source

调整代码

master
xyiege 3 years ago
parent
commit
8d7ac07e59
  1. 25
      src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java
  2. 4
      src/test/java/cn/chjyj/szwh/ApiTest.java

25
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<Goods> 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);

4
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

Loading…
Cancel
Save