Authored by 胡古飞

temp commit

  1 +package com.yoho.search.service.restapi;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import javax.servlet.http.HttpServletRequest;
  6 +
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Controller;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.ResponseBody;
  12 +
  13 +import com.yoho.search.service.servicenew.IGoodProductsService;
  14 +import com.yoho.search.service.utils.HttpServletRequestUtils;
  15 +import com.yoho.search.service.vo.SearchApiResult;
  16 +
  17 +@Controller
  18 +public class GoodProductListController {
  19 +
  20 + @Autowired
  21 + private IGoodProductsService goodProductsService;
  22 +
  23 + @RequestMapping(method = RequestMethod.GET, value = "/productindex/goodProductList")
  24 + @ResponseBody
  25 + public SearchApiResult goodProductList(HttpServletRequest request) {
  26 + Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
  27 + return goodProductsService.goodProductList(paramMap);
  28 + }
  29 +
  30 +}
@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RequestMethod; 12 import org.springframework.web.bind.annotation.RequestMethod;
13 import org.springframework.web.bind.annotation.ResponseBody; 13 import org.springframework.web.bind.annotation.ResponseBody;
14 14
15 -import com.alibaba.fastjson.JSON;  
16 import com.alibaba.fastjson.JSONObject; 15 import com.alibaba.fastjson.JSONObject;
17 import com.yoho.search.service.servicenew.IProductListService; 16 import com.yoho.search.service.servicenew.IProductListService;
18 import com.yoho.search.service.utils.HttpServletRequestUtils; 17 import com.yoho.search.service.utils.HttpServletRequestUtils;
@@ -4,7 +4,6 @@ import java.util.ArrayList; @@ -4,7 +4,6 @@ import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 -import org.apache.commons.lang.StringUtils;  
8 import org.elasticsearch.index.query.BoolQueryBuilder; 7 import org.elasticsearch.index.query.BoolQueryBuilder;
9 import org.elasticsearch.index.query.QueryBuilders; 8 import org.elasticsearch.index.query.QueryBuilders;
10 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; 9 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
@@ -21,7 +20,6 @@ import com.yoho.search.core.es.model.SearchParam; @@ -21,7 +20,6 @@ import com.yoho.search.core.es.model.SearchParam;
21 import com.yoho.search.core.es.model.SearchResult; 20 import com.yoho.search.core.es.model.SearchResult;
22 import com.yoho.search.service.service.SearchCommonService; 21 import com.yoho.search.service.service.SearchCommonService;
23 import com.yoho.search.service.servicenew.IGoodProductsService; 22 import com.yoho.search.service.servicenew.IGoodProductsService;
24 -import com.yoho.search.service.utils.SearchRequestParams;  
25 import com.yoho.search.service.vo.SearchApiResult; 23 import com.yoho.search.service.vo.SearchApiResult;
26 24
27 @Service 25 @Service
@@ -32,10 +30,14 @@ public class GoodProductListService implements IGoodProductsService { @@ -32,10 +30,14 @@ public class GoodProductListService implements IGoodProductsService {
32 30
33 @Override 31 @Override
34 public SearchApiResult goodProductList(Map<String, String> paramMap) { 32 public SearchApiResult goodProductList(Map<String, String> paramMap) {
35 - String productSkns = paramMap.get(SearchRequestParams.PARAM_SYNC_SKN);  
36 - if (StringUtils.isBlank(productSkns)) {  
37 - return new SearchApiResult().setCode(400).setData("请输入skn");  
38 - } 33 + //String productSkns = paramMap.get(SearchRequestParams.PARAM_SYNC_SKN);
  34 + BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
  35 + boolFilter.must(QueryBuilders.termQuery("isPhraseExist","Y"));
  36 + boolFilter.must(QueryBuilders.termQuery("productSkn", "50002052"));
  37 + SearchParam searchParam = new SearchParam();
  38 + searchParam.setFiter(boolFilter);
  39 + searchCommonService.doSearch("productindex", searchParam);
  40 + return null;
39 } 41 }
40 42
41 /** 43 /**