Authored by zhaojun2

bugfix

package com.yohoufo.product.controller;
import com.alibaba.fastjson.JSONObject;
import com.yoho.tools.docs.ApiOperation;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.utils.UfoJsonUtil;
import com.yohoufo.product.helper.SearchHelpService;
import com.yohoufo.product.request.ProductSearchReq;
import com.yohoufo.product.response.SearchBrandListResp;
import com.yohoufo.product.response.SearchProductListFilterResp;
import com.yohoufo.product.response.SearchProductListResp;
import com.yohoufo.product.response.SearchProductRecommendResp;
import com.yohoufo.product.service.ProductSearchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -23,7 +27,11 @@ public class ProductSearchController {
private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class);
@IgnoreSignature
// @Autowired
// private ProductSearchService productSearchService;
// @Autowired
// private SearchHelpService searchHelpService;
@ApiOperation(name = "ufo.product.search.list", desc="首页商品推荐")
@RequestMapping(params = "method=ufo.product.search.list")
@IgnoreSession
... ... @@ -42,14 +50,21 @@ public class ProductSearchController {
@RequestParam(value = "page", required = false)Integer page
) {
ProductSearchReq req = new ProductSearchReq().setType(type).setOrder(order).setProductPool(productPool).setSort(sort).setBrand(brand)
.setSeries(series).setGender(gender).setSize(size).setQuery(query).setLimit(limit).setPage(page);
return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductList(req)).build();
// ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(midSort)
// .setSeries(series).setGender(gender).setSize(size).setViewNum(limit).setPage(page);
// // 获取处理过的关键词,且记录搜索记录
// searchHelpService.setQuery(query, req);
//
// JSONObject jsonObject = productSearchService.searchProductList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductList()).build();
}
private SearchProductListResp mockSearchProductList(ProductSearchReq req){
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\"}]}";
private SearchProductListResp mockSearchProductList(){
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\"}]}";
SearchProductListResp data = UfoJsonUtil.safelyParseObject(mockJson, SearchProductListResp.class);
return data;
}
... ... @@ -62,7 +77,7 @@ public class ProductSearchController {
public ApiResponse searchProductRecommendById(
@RequestParam(value = "product_id", required = false) Integer productId) {
ProductSearchReq req = new ProductSearchReq().setProductId(productId);
ProductSearchReq req = new ProductSearchReq().setId(productId);
return new ApiResponse.ApiResponseBuilder().code(200).message("Category Product List.").data(mockSearchProductRecommendById(req)).build();
}
... ...
... ... @@ -6,8 +6,8 @@ import java.math.BigDecimal;
public class ProductBrief {
@JSONField(name="product_id")
private Integer productId;
@JSONField(name="id")
private Integer id;
@JSONField(name="product_name")
private String productName;
... ... @@ -18,12 +18,12 @@ public class ProductBrief {
private String defaultImages;
public Integer getProductId() {
return productId;
public Integer getId() {
return id;
}
public void setProductId(Integer productId) {
this.productId = productId;
public void setId(Integer id) {
this.id = id;
}
public String getProductName() {
... ...