Authored by zhaojun2

bugfix

1 package com.yohoufo.product.controller; 1 package com.yohoufo.product.controller;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import com.yoho.tools.docs.ApiOperation; 4 import com.yoho.tools.docs.ApiOperation;
4 import com.yohoufo.common.annotation.IgnoreSignature; 5 import com.yohoufo.common.annotation.IgnoreSignature;
5 import com.yohoufo.common.utils.UfoJsonUtil; 6 import com.yohoufo.common.utils.UfoJsonUtil;
  7 +import com.yohoufo.product.helper.SearchHelpService;
6 import com.yohoufo.product.request.ProductSearchReq; 8 import com.yohoufo.product.request.ProductSearchReq;
7 import com.yohoufo.product.response.SearchBrandListResp; 9 import com.yohoufo.product.response.SearchBrandListResp;
8 import com.yohoufo.product.response.SearchProductListFilterResp; 10 import com.yohoufo.product.response.SearchProductListFilterResp;
9 import com.yohoufo.product.response.SearchProductListResp; 11 import com.yohoufo.product.response.SearchProductListResp;
10 import com.yohoufo.product.response.SearchProductRecommendResp; 12 import com.yohoufo.product.response.SearchProductRecommendResp;
  13 +import com.yohoufo.product.service.ProductSearchService;
11 import org.slf4j.Logger; 14 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.web.bind.annotation.RequestMapping; 17 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RequestParam; 18 import org.springframework.web.bind.annotation.RequestParam;
15 19
@@ -23,7 +27,11 @@ public class ProductSearchController { @@ -23,7 +27,11 @@ public class ProductSearchController {
23 27
24 private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class); 28 private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class);
25 29
26 - @IgnoreSignature 30 +// @Autowired
  31 +// private ProductSearchService productSearchService;
  32 +// @Autowired
  33 +// private SearchHelpService searchHelpService;
  34 +
27 @ApiOperation(name = "ufo.product.search.list", desc="首页商品推荐") 35 @ApiOperation(name = "ufo.product.search.list", desc="首页商品推荐")
28 @RequestMapping(params = "method=ufo.product.search.list") 36 @RequestMapping(params = "method=ufo.product.search.list")
29 @IgnoreSession 37 @IgnoreSession
@@ -42,14 +50,21 @@ public class ProductSearchController { @@ -42,14 +50,21 @@ public class ProductSearchController {
42 @RequestParam(value = "page", required = false)Integer page 50 @RequestParam(value = "page", required = false)Integer page
43 ) { 51 ) {
44 52
45 - ProductSearchReq req = new ProductSearchReq().setType(type).setOrder(order).setProductPool(productPool).setSort(sort).setBrand(brand)  
46 - .setSeries(series).setGender(gender).setSize(size).setQuery(query).setLimit(limit).setPage(page);  
47 - return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductList(req)).build(); 53 +// ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(midSort)
  54 +// .setSeries(series).setGender(gender).setSize(size).setViewNum(limit).setPage(page);
  55 +
  56 +// // 获取处理过的关键词,且记录搜索记录
  57 +// searchHelpService.setQuery(query, req);
  58 +//
  59 +// JSONObject jsonObject = productSearchService.searchProductList(req);
  60 +
  61 +
  62 + return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductList()).build();
48 } 63 }
49 64
50 65
51 - private SearchProductListResp mockSearchProductList(ProductSearchReq req){  
52 - String mockJson = "{\"total\":4,\"page_total\":1,\"page\":1,\"page_size\":4,\"product_list\":[{\"product_id\":51189414,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img10.static.yhbimg.com/goodsimg/2015/12/31/04/01d1f809fded2473409a0ae2a3b4d57bc2.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\"},{\"product_id\":51189413,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img10.static.yhbimg.com/goodsimg/2015/12/31/04/01d1f809fded2473409a0ae2a3b4d57bc2.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\"},{\"product_id\":51189412,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img10.static.yhbimg.com/goodsimg/2015/12/31/04/01d1f809fded2473409a0ae2a3b4d57bc2.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\"},{\"product_id\":51189411,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img10.static.yhbimg.com/goodsimg/2015/12/31/04/01d1f809fded2473409a0ae2a3b4d57bc2.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\"}]}"; 66 + private SearchProductListResp mockSearchProductList(){
  67 + String mockJson = "{\"total\":4,\"page_total\":1,\"page\":1,\"page_size\":4,\"product_list\":[{\"id\":1,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img11.static.yhbimg.com/brandImage/2017/02/17/11/0148abe1e3334b377da73b849949b5fbe8.jpg\"},{\"id\":2,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img11.static.yhbimg.com/brandImage/2017/02/17/11/0148abe1e3334b377da73b849949b5fbe8.jpg\"},{\"id\":51189412,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img11.static.yhbimg.com/brandImage/2017/02/17/11/0148abe1e3334b377da73b849949b5fbe8.jpg\"},{\"id\":51189411,\"price\":350,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"default_images\":\"http://img11.static.yhbimg.com/brandImage/2017/02/17/11/0148abe1e3334b377da73b849949b5fbe8.jpg\"}]}";
53 SearchProductListResp data = UfoJsonUtil.safelyParseObject(mockJson, SearchProductListResp.class); 68 SearchProductListResp data = UfoJsonUtil.safelyParseObject(mockJson, SearchProductListResp.class);
54 return data; 69 return data;
55 } 70 }
@@ -62,7 +77,7 @@ public class ProductSearchController { @@ -62,7 +77,7 @@ public class ProductSearchController {
62 public ApiResponse searchProductRecommendById( 77 public ApiResponse searchProductRecommendById(
63 @RequestParam(value = "product_id", required = false) Integer productId) { 78 @RequestParam(value = "product_id", required = false) Integer productId) {
64 79
65 - ProductSearchReq req = new ProductSearchReq().setProductId(productId); 80 + ProductSearchReq req = new ProductSearchReq().setId(productId);
66 return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductRecommendById(req)).build(); 81 return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductRecommendById(req)).build();
67 } 82 }
68 83
@@ -6,8 +6,8 @@ import java.math.BigDecimal; @@ -6,8 +6,8 @@ import java.math.BigDecimal;
6 6
7 public class ProductBrief { 7 public class ProductBrief {
8 8
9 - @JSONField(name="product_id")  
10 - private Integer productId; 9 + @JSONField(name="id")
  10 + private Integer id;
11 11
12 @JSONField(name="product_name") 12 @JSONField(name="product_name")
13 private String productName; 13 private String productName;
@@ -18,12 +18,12 @@ public class ProductBrief { @@ -18,12 +18,12 @@ public class ProductBrief {
18 private String defaultImages; 18 private String defaultImages;
19 19
20 20
21 - public Integer getProductId() {  
22 - return productId; 21 + public Integer getId() {
  22 + return id;
23 } 23 }
24 24
25 - public void setProductId(Integer productId) {  
26 - this.productId = productId; 25 + public void setId(Integer id) {
  26 + this.id = id;
27 } 27 }
28 28
29 public String getProductName() { 29 public String getProductName() {