Browse Source

搜索 接口修复

wangdy 8 years ago
parent
commit
d8e1825335

+ 2 - 2
src/main/java/com/uas/platform/b2c/common/search/rpc/service/Impl/SearchServiceImpl.java

@@ -92,14 +92,14 @@ public class SearchServiceImpl implements SearchService{
     }
 
     @Override
-    public SPage<Map<String, List<Integer>>> getBrands(String keyword, Integer page, Integer size) throws SearchException {
+    public SPage<Map<String, Object>> getBrands(String keyword, Integer page, Integer size) throws SearchException {
         Map<String, Object> map = initSearchMap(keyword, page, size);
         String str = restTemplate.getForObject(sysConf.getSearchUrl() + SearchUrl.BRAND_INFO_URL, String.class, map);
         if(StringUtils.isEmpty(str)) {
             return null;
         }else {
             try {
-                SPage<Map<String, List<Integer>>> sPage = FastjsonUtils.fromJson(str, SPage.class);
+                SPage<Map<String, Object>> sPage = FastjsonUtils.fromJson(str, SPage.class);
                 return sPage;
             }catch (Exception e) {
                 e.printStackTrace();

+ 2 - 3
src/main/java/com/uas/platform/b2c/common/search/rpc/service/SearchService.java

@@ -5,7 +5,6 @@ package com.uas.platform.b2c.common.search.rpc.service;
  *
  * 通过http方式调用远端的搜索接口
  */
-import com.uas.platform.b2c.common.search.constant.SearchParam;
 import com.uas.search.exception.SearchException;
 import com.uas.platform.b2c.common.search.util.CollectField;
 import com.uas.platform.b2c.common.search.util.PageParams;
@@ -24,7 +23,7 @@ public interface SearchService {
 
     SPage<Map<String, Object>> getBrands(String keyword, Integer page, Integer size) throws SearchException;
 
-    Map<String, Object> getComponentIds(String keyword, SearchParam var2) throws SearchException;
+    Map<String, Object> getComponentIds(String keyword, PageParams var2) throws SearchException;
 
     Set<Long> getKindIdsBySearchComponent(String keyword, String brandId) throws SearchException;
 
@@ -48,7 +47,7 @@ public interface SearchService {
 
     List<Map<String, String>> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum) throws SearchException;
 
-    Map<String, Object> getGoodsIds(String keyword, SearchParam var2) throws SearchException;
+    Map<String, Object> getGoodsIds(String keyword, PageParams var2) throws SearchException;
 
     List<Map<String, Object>> collectBySearchGoods(String keyword, CollectField collectField, Map<PageParams.FilterField, Object> filters);
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/search/service/impl/SearcherServiceImpl.java

@@ -111,7 +111,7 @@ public class SearcherServiceImpl implements SearcherService {
     @Override
     public ModelMap searchBrand(String keyword, String field) {
         ModelMap map = new ModelMap();
-        SPage<Map<String, List<Integer>>> brands = null;
+        SPage<Map<String, Object>> brands = null;
         try {
             brands = searchService.getBrands(keyword, DEFAULT_PAGE, DEFAULT_SIZE);
         } catch (SearchException e) {

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/dao/BrandDao.java

@@ -81,6 +81,7 @@ public interface BrandDao extends JpaSpecificationExecutor<Brand>, JpaRepository
 	@Modifying
 	@Transactional
 	@Query( nativeQuery = true, value = "update product$brand b set b.br_visit_count = ifnull(b.br_visit_count, 0) + 1 where b.br_uuid = :uuid")
+	public void addVisitCount(@Param("uuid") String uuid);
 
     /**
      * 获取搜索量最高的2个品牌
@@ -89,7 +90,6 @@ public interface BrandDao extends JpaSpecificationExecutor<Brand>, JpaRepository
     @Query(nativeQuery = true , value = "select b from product$brand b order by br_search_count desc LIMIT 2)")
     public List<Brand> findMostSearchBrands();
 
-    public void addVisitCount(@Param("uuid") String uuid);
     /**
      * 分页根据首字母获取品牌信息
      * @param initals

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandServiceImpl.java

@@ -19,7 +19,7 @@ import com.uas.platform.core.persistence.criteria.CriterionExpression.Operator;
 import com.uas.platform.core.persistence.criteria.LogicalExpression;
 import com.uas.platform.core.persistence.criteria.SimpleExpression;
 import com.uas.search.exception.SearchException;
-import com.uas.search.model.SPage;
+import com.uas.platform.b2c.common.search.util.SPage;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;

+ 4 - 5
src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentGoodsServiceImpl.java

@@ -1,7 +1,6 @@
 package com.uas.platform.b2c.prod.product.component.service.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.uas.platform.b2c.common.search.constant.SearchParam;
 import com.uas.platform.b2c.common.search.rpc.service.SearchService;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentGoodsDao;
 import com.uas.platform.b2c.prod.product.component.modal.ComponentGoods;
@@ -53,10 +52,10 @@ public class ComponentGoodsServiceImpl implements ComponentGoodsService {
 		if(filter != null) {
 			if(filter.get("properties") != null) {
 				String property = filter.get("properties").toString();
-				SearchParam pageParams = new SearchParam(info.getPageNumber(), info.getPageSize());
-				pageParams.filter(SearchParam.FilterField.COMPONENT_PROPERTIES, property);
-				pageParams.filter(SearchParam.FilterField.COMPONENT_KINDID, filter.get("kindid"));
-				pageParams.filter(SearchParam.FilterField.COMPONENT_BRANDID, filter.get("brandid"));
+				PageParams pageParams = new PageParams(info.getPageNumber(), info.getPageSize());
+				pageParams.filter(PageParams.FilterField.COMPONENT_PROPERTIES, property);
+				pageParams.filter(PageParams.FilterField.COMPONENT_KINDID, filter.get("kindid"));
+				pageParams.filter(PageParams.FilterField.COMPONENT_BRANDID, filter.get("brandid"));
 				filter.remove("properties");
 				filter.remove("kindid");
 				filter.remove("brandid");

+ 4 - 5
src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentServiceImpl.java

@@ -1,7 +1,6 @@
 package com.uas.platform.b2c.prod.product.component.service.impl;
 
 import com.uas.platform.b2c.common.account.model.User;
-import com.uas.platform.b2c.common.search.constant.SearchParam;
 import com.uas.platform.b2c.common.search.rpc.service.SearchService;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.constant.SplitChar;
@@ -192,10 +191,10 @@ public class ComponentServiceImpl implements ComponentService {
 		if (filter != null) {
 			if (filter.get("properties") != null) {
 				String property = filter.get("properties").toString();
-				SearchParam pageParams = new SearchParam(info.getPageNumber(), info.getPageSize());
-				pageParams.filter(SearchParam.FilterField.COMPONENT_PROPERTIES, property);
-				pageParams.filter(SearchParam.FilterField.COMPONENT_KINDID, filter.get("kindid"));
-				pageParams.filter(SearchParam.FilterField.COMPONENT_BRANDID, filter.get("brandid"));
+				PageParams pageParams = new PageParams(info.getPageNumber(), info.getPageSize());
+				pageParams.filter(PageParams.FilterField.COMPONENT_PROPERTIES, property);
+				pageParams.filter(PageParams.FilterField.COMPONENT_KINDID, filter.get("kindid"));
+				pageParams.filter(PageParams.FilterField.COMPONENT_BRANDID, filter.get("brandid"));
 //				pageParams.filter("code", filter.get("code"));
 				filter.remove("properties");
 				filter.remove("kindid");