Browse Source

Merge branch 'erpReserveSort' into feature-wangyc-erpReserve-1219

yangc 8 years ago
parent
commit
6413eee6f1
25 changed files with 976 additions and 385 deletions
  1. 3 4
      src/main/java/com/uas/platform/b2c/common/search/rpc/service/Impl/SearchServiceImpl.java
  2. 3 3
      src/main/java/com/uas/platform/b2c/common/search/rpc/service/SearchService.java
  3. 370 357
      src/main/java/com/uas/platform/b2c/common/search/service/impl/SearcherServiceImpl.java
  4. 32 0
      src/main/java/com/uas/platform/b2c/common/search/util/CollectField.java
  5. 235 0
      src/main/java/com/uas/platform/b2c/common/search/util/PageParams.java
  6. 100 0
      src/main/java/com/uas/platform/b2c/common/search/util/SPage.java
  7. 96 0
      src/main/java/com/uas/platform/b2c/common/search/util/Sort.java
  8. 11 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/api/BrandController.java
  9. 7 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/dao/BrandDao.java
  10. 6 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/service/BrandService.java
  11. 5 0
      src/main/java/com/uas/platform/b2c/prod/product/brand/service/impl/BrandServiceImpl.java
  12. 12 0
      src/main/java/com/uas/platform/b2c/prod/product/component/api/ComponentController.java
  13. 8 0
      src/main/java/com/uas/platform/b2c/prod/product/component/dao/ComponentDao.java
  14. 7 0
      src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentService.java
  15. 2 2
      src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentGoodsServiceImpl.java
  16. 7 2
      src/main/java/com/uas/platform/b2c/prod/product/component/service/impl/ComponentServiceImpl.java
  17. 4 1
      src/main/java/com/uas/platform/b2c/trade/rate/service/impl/RateServiceImpl.java
  18. 2 2
      src/main/resources/dev/sys.properties
  19. 2 2
      src/main/resources/test/sys.properties
  20. 7 0
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js
  21. 16 2
      src/main/webapp/resources/view/usercenter/forstore/home_center.html
  22. 10 1
      src/main/webapp/resources/view/vendor/forstore/erp/vendor_material_erp.html
  23. 16 2
      src/main/webapp/resources/view/vendor/forstore/vendor_index.html
  24. 4 0
      src/main/webapp/resources/view/vendor/forstore/vendor_store_maintain.html
  25. 11 7
      src/main/webapp/resources/view/vendor/modal/recommend_product_modal.html

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

@@ -1,16 +1,15 @@
 package com.uas.platform.b2c.common.search.rpc.service.Impl;
 
 
-import com.alibaba.fastjson.JSONArray;
 import com.uas.platform.b2c.common.search.constant.SearchUrl;
 import com.uas.platform.b2c.common.search.rpc.service.SearchService;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
 import com.uas.search.exception.SearchException;
-import com.uas.search.model.CollectField;
-import com.uas.search.model.PageParams;
-import com.uas.search.model.SPage;
+import com.uas.platform.b2c.common.search.util.CollectField;
+import com.uas.platform.b2c.common.search.util.PageParams;
+import com.uas.platform.b2c.common.search.util.SPage;
 import org.apache.commons.collections.map.HashedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

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

@@ -6,9 +6,9 @@ package com.uas.platform.b2c.common.search.rpc.service;
  * 通过http方式调用远端的搜索接口
  */
 import com.uas.search.exception.SearchException;
-import com.uas.search.model.CollectField;
-import com.uas.search.model.PageParams;
-import com.uas.search.model.SPage;
+import com.uas.platform.b2c.common.search.util.CollectField;
+import com.uas.platform.b2c.common.search.util.PageParams;
+import com.uas.platform.b2c.common.search.util.SPage;
 
 import java.util.List;
 import java.util.Map;

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

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.common.search.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.search.dao.SearchHistoryDao;
@@ -19,10 +20,10 @@ import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.search.exception.SearchException;
-import com.uas.search.model.CollectField;
-import com.uas.search.model.PageParams.FilterField;
-import com.uas.search.model.SPage;
-import com.uas.search.model.Sort;
+import com.uas.platform.b2c.common.search.util.CollectField;
+import com.uas.platform.b2c.common.search.util.PageParams.FilterField;
+import com.uas.platform.b2c.common.search.util.SPage;
+import com.uas.platform.b2c.common.search.util.Sort;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,379 +48,391 @@ import java.util.Map.Entry;
 @Service
 public class SearcherServiceImpl implements SearcherService {
 
-	@Autowired
-	private ComponentInfoDao componentInfoDao;
+    @Autowired
+    private ComponentInfoDao componentInfoDao;
 
-	@Autowired
-	private ComponentGoodsDao componentGoodsDao;
+    @Autowired
+    private ComponentGoodsDao componentGoodsDao;
 
-	@Autowired
-	private SearchService searchService;
+    @Autowired
+    private SearchService searchService;
 
-	@Autowired
-	private BrandDao brandDao;
+    @Autowired
+    private BrandDao brandDao;
 
-	@Autowired
-	private GoodsDao goodsDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
-	@Autowired
-	private SearchHistoryDao searchHistoryDao;
+    @Autowired
+    private SearchHistoryDao searchHistoryDao;
 
-	private Logger logger = LoggerFactory.getLogger(getClass());
-	private final DeviceResolver deviceResolver = new LiteDeviceResolver();
+    private Logger logger = LoggerFactory.getLogger(getClass());
 
-	/**
-	 * 智能搜索类目
-	 *
-	 * @param keyword
-	 * @param field
-	 * @return
-	 * @throws IOException
-	 * @throws InterruptedException
-	 */
-	@Override
-	public ModelMap searchKind(String keyword, String field) {
-		ModelMap map = new ModelMap();
-		SPage<Map<String, Object>> kinds = null;
-		try {
-			kinds = searchService.getKinds(keyword,1,1024*1024*1024);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		map.put("total", kinds.getTotalElement());// 结果总数
-		map.put("kinds", kinds.getContent());
-		return map;
-	}
+    private final DeviceResolver deviceResolver = new LiteDeviceResolver();
 
-	/**
-	 * 智能搜索品牌
-	 *
-	 * @param keyword
-	 * @param field
-	 * @return
-	 * @throws IOException
-	 * @throws InterruptedException
-	 */
-	@Override
-	public ModelMap searchBrand(String keyword, String field) {
-		ModelMap map = new ModelMap();
-		SPage<Map<String, List<Integer>>> brands = null;
-		try {
-			brands = searchService.getBrands(keyword,1,1024*1024*1024);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		map.put("brands", brands.getContent());// 结果集
-		map.put("total", brands.getTotalElement());// 结果总数
-		return map;
-	}
+    private final int DEFAULT_PAGE = 1;
 
-	/**
-	 * 智能搜索器件
-	 *
-	 * @param keyword
-	 * @return
-	 * @throws InterruptedException
-	 * @throws IOException
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public ModelMap searchComponent(String keyword, PageParams page) {
-		ModelMap map = new ModelMap();
-		Map<String, Object> results = new HashMap<>();
-		try {
-			results = searchService.getComponentIds(keyword, convertPageParams(page));
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		List<Long> componentIds = (List<Long>) results.get("componentIds");
-		if (!CollectionUtils.isEmpty(componentIds)) {
-			List<ComponentInfo> components = componentInfoDao
-					.findByIdsInOrder(componentIds.toArray(new Long[componentIds.size()]));
-			map.put("components", components);// 当前页器件内容
-		}
-		map.put("total", results.get("total"));// 搜索结果总数
-		map.put("page", results.get("page"));// 当前页面
-		map.put("size", results.get("size"));// 每页个数
-		return map;
-	}
-	/**
-	 * 智能搜索批次
-	 *
-	 * @param keyword
-	 * @param page
-	 * @return
-	 * @throws InterruptedException
-	 * @throws IOException
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public ModelMap searchComponentGoods(String keyword, PageParams page , HttpServletRequest request) {
-		if (this.deviceResolver.resolveDevice(request).isMobile()) {
-			SystemSession.setUser((User)request.getSession().getAttribute("user"));
-			if (null != SystemSession.getUser() && null!= SystemSession.getUser().getUserUU()){
-				SearchHistory searchHistory = null;
-				List<SearchHistory> searchHistories = searchHistoryDao.findByKeywordAndUserUUAndUserEnuu(keyword,SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
-				if (searchHistories.size()>0){
-					searchHistory = searchHistories.get(0);
-				}else {
-					searchHistory = new SearchHistory();
-				}
-				searchHistory.setKeyword(keyword);
-				searchHistory.setSearchTime(new Date(System.currentTimeMillis()));
-				searchHistory.setUserUU(SystemSession.getUser().getUserUU());
-				searchHistory.setUserEnuu(SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
-				searchHistoryDao.save(searchHistory);
-				searchHistories = searchHistoryDao.findByUserUUAndUserEnuuOrderBySearchTimeDesc(SystemSession.getUser().getUserUU(),SystemSession.getUser().getEnterprise() != null ?SystemSession.getUser().getEnterprise().getUu():null);
-				if (searchHistories.size()>10){
-					searchHistoryDao.delete(searchHistories.subList(10,searchHistories.size()));
-				}
-			}
-		}
-		ModelMap map = new ModelMap();
-		Map<String,Object> results = null;
-		//Map<String, Object> results = new HashMap<>();
-		try {
-			results = searchService.getGoodsIds(keyword, convertPageParams(page));
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		//统计精准匹配到品牌的数量(便于展示唯一的品牌)
-		ModelMap brandMap = searchBrand(keyword,null);
-		List<Map<String, Object>> brands = (List)brandMap.get("brands");
-		if (!CollectionUtils.isEmpty(brands)) {
-			for (Map<String, Object> brand : brands){
-				if (keyword.equalsIgnoreCase(brand.get("nameCn").toString()) || keyword.equalsIgnoreCase(brand.get("nameEn").toString())){
-					map.put("brands",brand);
-				}
-			}
-		}
-		if ((int)results.get("total") == 0){
-			map.put("total", results.get("total"));// 搜索结果总数
-			map.put("page", results.get("page"));// 当前页面
-			map.put("size", results.get("size"));// 每页个数
-			map.put("components", new ArrayList<>());// 当前页器件内容
-			return map;
-		}
-		List<Integer> componentIds = (List<Integer>)results.get("componentIds");
-		List<Integer> goodsIds = (List<Integer>)results.get("goodsIds");
-		List<ComponentGoods> components = new ArrayList<>();
-		if (!CollectionUtils.isEmpty(componentIds)) {
-			for (int i = 0 ;i < componentIds.size() ; i++){
-				Long cid = null;
-				if(!StringUtils.isEmpty
-						(componentIds.get(i)))  {
-					cid = Long.valueOf(componentIds.get(i).toString());
-				}
-				Long gid = goodsIds.get(i) == null ? 0L : Long.valueOf(goodsIds.get(i).toString());
-				if((cid == null) && (gid != 0L)) {
-					Goods goods = goodsDao.findOne(gid);
-					if(goods != null) {
-						components.add(new ComponentGoods(goods));
-					}
-				}else if(cid != null){
-					ComponentGoods componentGoods = componentGoodsDao.findByCmpIdAndGoId(cid, gid);
-					if (componentGoods != null){
-						components.add(componentGoods);
-					}
-				}
-			}
-			map.put("components", components);// 当前页器件内容
-		}
+    private final int DEFAULT_SIZE = 1024 * 1024 * 1024;
 
-		map.put("total", results.get("total"));// 搜索结果总数
-		map.put("page", results.get("page"));// 当前页面
-		map.put("size", results.get("size"));// 每页个数
+    /**
+     * 智能搜索类目
+     *
+     * @param keyword
+     * @param field
+     * @return
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    @Override
+    public ModelMap searchKind(String keyword, String field) {
+        ModelMap map = new ModelMap();
+        SPage<Map<String, Object>> kinds = null;
+        try {
+            kinds = searchService.getKinds(keyword, DEFAULT_PAGE, DEFAULT_SIZE);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        map.put("total", kinds.getTotalElement());// 结果总数
+        map.put("kinds", kinds.getContent());
+        return map;
+    }
 
-		return map;
-	}
-	/**
-	 * 批次搜索数量统计
-	 *
-	 * @param keyword
-	 * @param page
-	 * @return
-	 * @throws InterruptedException
-	 * @throws IOException
-	 */
-	@SuppressWarnings("unchecked")
-	@Override
-	public ModelMap searchComponentGoodsNums(String keyword, PageParams page) {
-		ModelMap map = new ModelMap();
-		Map<String, Object> results = null;
-		//Map<String, Object> results = new HashMap<>();
-		try {
-			results = searchService.getGoodsIds(keyword, convertPageParams(page));
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		map.put("total", results.get("total"));// 搜索结果总数
-		return map;
-	}
+    /**
+     * 智能搜索品牌
+     *
+     * @param keyword
+     * @param field
+     * @return
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    @Override
+    public ModelMap searchBrand(String keyword, String field) {
+        ModelMap map = new ModelMap();
+        SPage<Map<String, List<Integer>>> brands = null;
+        try {
+            brands = searchService.getBrands(keyword, DEFAULT_PAGE, DEFAULT_SIZE);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        map.put("brands", brands.getContent());// 结果集
+        map.put("total", brands.getTotalElement());// 结果总数
+        return map;
+    }
 
+    /**
+     * 智能搜索器件
+     *
+     * @param keyword
+     * @return
+     * @throws InterruptedException
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public ModelMap searchComponent(String keyword, PageParams page) {
+        ModelMap map = new ModelMap();
+        Map<String, Object> results = new HashMap<>();
+        try {
+            results = searchService.getComponentIds(keyword, convertPageParams(page));
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        List<Long> componentIds = (List<Long>) results.get("componentIds");
+        if (!CollectionUtils.isEmpty(componentIds)) {
+            List<ComponentInfo> components = componentInfoDao
+                    .findByIdsInOrder(componentIds.toArray(new Long[componentIds.size()]));
+            map.put("components", components);// 当前页器件内容
+        }
+        map.put("total", results.get("total"));// 搜索结果总数
+        map.put("page", results.get("page"));// 当前页面
+        map.put("size", results.get("size"));// 每页个数
+        return map;
+    }
 
+    /**
+     * 智能搜索批次
+     *
+     * @param keyword
+     * @param page
+     * @return
+     * @throws InterruptedException
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public ModelMap searchComponentGoods(String keyword, PageParams page, HttpServletRequest request) {
+        if (this.deviceResolver.resolveDevice(request).isMobile()) {
+            SystemSession.setUser((User) request.getSession().getAttribute("user"));
+            if (null != SystemSession.getUser() && null != SystemSession.getUser().getUserUU()) {
+                SearchHistory searchHistory = null;
+                List<SearchHistory> searchHistories = searchHistoryDao.findByKeywordAndUserUUAndUserEnuu(keyword, SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null);
+                if (searchHistories.size() > 0) {
+                    searchHistory = searchHistories.get(0);
+                } else {
+                    searchHistory = new SearchHistory();
+                }
+                searchHistory.setKeyword(keyword);
+                searchHistory.setSearchTime(new Date(System.currentTimeMillis()));
+                searchHistory.setUserUU(SystemSession.getUser().getUserUU());
+                searchHistory.setUserEnuu(SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null);
+                searchHistoryDao.save(searchHistory);
+                searchHistories = searchHistoryDao.findByUserUUAndUserEnuuOrderBySearchTimeDesc(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null);
+                if (searchHistories.size() > 10) {
+                    searchHistoryDao.delete(searchHistories.subList(10, searchHistories.size()));
+                }
+            }
+        }
+        ModelMap map = new ModelMap();
+        Map<String, Object> results = null;
+        //Map<String, Object> results = new HashMap<>();
+        try {
+            results = searchService.getGoodsIds(keyword, convertPageParams(page));
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        //统计精准匹配到品牌的数量(便于展示唯一的品牌)
+        ModelMap brandMap = searchBrand(keyword, null);
+        List<Map<String, Object>> brands = (List) brandMap.get("brands");
+        if (!CollectionUtils.isEmpty(brands)) {
+            for (Map<String, Object> brand : brands) {
+                if (keyword.equalsIgnoreCase(brand.get("nameCn").toString()) || keyword.equalsIgnoreCase(brand.get("nameEn").toString())) {
+                    map.put("brands", brand);
+                }
+            }
+        }
+        if ((int) results.get("total") == 0) {
+            map.put("total", results.get("total"));// 搜索结果总数
+            map.put("page", results.get("page"));// 当前页面
+            map.put("size", results.get("size"));// 每页个数
+            map.put("components", new ArrayList<>());// 当前页器件内容
+            return map;
+        }
+        List<Integer> componentIds = (List<Integer>) results.get("componentIds");
+        List<Integer> goodsIds = (List<Integer>) results.get("goodsIds");
+        List<ComponentGoods> components = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(componentIds)) {
+            for (int i = 0; i < componentIds.size(); i++) {
+                Long cid = null;
+                if (!StringUtils.isEmpty
+                        (componentIds.get(i))) {
+                    cid = Long.valueOf(componentIds.get(i).toString());
+                }
+                Long gid = goodsIds.get(i) == null ? 0L : Long.valueOf(goodsIds.get(i).toString());
+                if ((cid == null) && (gid != 0L)) {
+                    Goods goods = goodsDao.findOne(gid);
+                    if (goods != null) {
+                        components.add(new ComponentGoods(goods));
+                    }
+                } else if (cid != null) {
+                    ComponentGoods componentGoods = componentGoodsDao.findByCmpIdAndGoId(cid, gid);
+                    if (componentGoods != null) {
+                        components.add(componentGoods);
+                    }
+                }
+            }
+            map.put("components", components);// 当前页器件内容
+        }
 
-	/**
-	 * 获取器件搜索的类目统计
-	 *
-	 * @param keyword
-	 * @return
-	 */
-	@Override
-	public List<Map<String, Object>> getKindsBySearchComponent(String keyword, String brandId) {
-		List<Map<String, Object>> kinds = new ArrayList<>();
-		try {
-			kinds = searchService.getKindsBySearchComponent(keyword, brandId);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		return kinds;
-	}
+        map.put("total", results.get("total"));// 搜索结果总数
+        map.put("page", results.get("page"));// 当前页面
+        map.put("size", results.get("size"));// 每页个数
 
-	/**
-	 * 获取器件搜索的品牌统计列表
-	 *
-	 * @param keyword
-	 * @return
-	 */
-	@Override
-	public List<Map<String, Object>> getBrandsBySearchComponent(String keyword, String kindId) {
-		List<Map<String, Object>> brands = new ArrayList<>();
-		try {
-			brands = searchService.getBrandsBySearchComponent(keyword, kindId);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		return brands;
-	}
-	/**
-	 * 批次搜索结构的类目,器件,店铺类型,货币类型统计
-	 *
-	 * @param keyword
-	 * @return
-	 */
-	@Override
-	public List<Map<String, Object>> getCollectlistBySearchComponentGoods(String keyword, String collectList, String paramJSON , HttpServletRequest request) {
-		List<Map<String, Object>> collectResult = new ArrayList<>();
-		JSONObject jsonObject = FastjsonUtils.parseObject(paramJSON);
-		Set<Entry<String,Object>> paramEntry = jsonObject.entrySet();
-		Map<com.uas.search.model.PageParams.FilterField,Object> param= new LinkedHashMap<>();
-		for (Entry<String, Object> entry : paramEntry) {
-			param.put(FilterField.valueOf(entry.getKey().toUpperCase()), entry.getValue());
-		}
-		try {
-			collectResult = searchService.collectBySearchGoods(keyword, CollectField.valueOf(collectList.toUpperCase()),param);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		if ("goods_brand".equals(collectList)) {
-			if (this.deviceResolver.resolveDevice(request).isMobile()) {
-				for (Map<String, Object> m : collectResult) {
-					m.put("logoUrl", brandDao.findOne(Long.parseLong(m.get("br_id").toString())).getLogoUrl());
-				}
-			}
-		}
-		return collectResult;
-	}
+        return map;
+    }
 
-	@Override
-	public Map<String,Object> getSimilarKeywords(String keyword) {
-		Map<String,Object> result = null;
-		try {
-			result = searchService.getSimilarKeywords(keyword);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		for (Entry<String, Object> entry : result.entrySet()) {
-			if(((List)entry.getValue()).size()>8){
-				entry.setValue(((List)entry.getValue()).subList(0,8));
-			}
-		}
-		return result;
-	}
+    /**
+     * 批次搜索数量统计
+     *
+     * @param keyword
+     * @param page
+     * @return
+     * @throws InterruptedException
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public ModelMap searchComponentGoodsNums(String keyword, PageParams page) {
+        ModelMap map = new ModelMap();
+        Map<String, Object> results = null;
+        //Map<String, Object> results = new HashMap<>();
+        try {
+            results = searchService.getGoodsIds(keyword, convertPageParams(page));
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        map.put("total", results.get("total"));// 搜索结果总数
+        return map;
+    }
 
-	@Override
-	public List<Map<String, Object>> getSimilarComponents(String componentCode) {
-		List<Map<String, Object>> components = new ArrayList<>();
-		try {
-			components = searchService.getSimilarComponents(componentCode);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		return components;
-	}
 
-	/**
-	 * 把平台中PageParams对象转化为搜索API封装的PageParams对象
-	 *
-	 * @param params
-	 * @return
-	 */
-	private com.uas.search.model.PageParams convertPageParams(PageParams params) {
-		PageInfo pageinfo = new PageInfo(params);
-		com.uas.search.model.PageParams pageParams = new com.uas.search.model.PageParams();
-		pageParams.setPage(params.getPage());
-		pageParams.setSize(params.getCount());
-		if (!StringUtils.isEmpty(params.getFilter())) {
-			JSONObject jsonObject = FastjsonUtils.parseObject(params.getFilter());
-			Set<Entry<String, Object>> entrySet = jsonObject.entrySet();
-			for (Entry<String, Object> entry : entrySet) {
-				pageParams.filter(FilterField.valueOf(entry.getKey().toUpperCase()), entry.getValue());
-			}
-		}
-		if (!StringUtils.isEmpty(params.getSorting())){
-			//com.alibaba.fastjson.JSONObject sort = FastjsonUtils.parseObject(params.getSorting());
-			Iterator<org.springframework.data.domain.Sort.Order> iterator = pageinfo.getSort().iterator();
-			List<Sort> psort = new ArrayList<>();
-			while (iterator.hasNext()){
-				org.springframework.data.domain.Sort.Order order = iterator.next();
-				boolean reverse= false;
-				if ( "DESC".equals( order.getDirection().toString())){
-					reverse = true;
-				}
-				Sort b= new Sort( Sort.Field.valueOf(order.getProperty()),reverse);
-				psort.add(b);
-			}
-			pageParams.setSort(psort);
-		}
-		return pageParams;
-	}
+    /**
+     * 获取器件搜索的类目统计
+     *
+     * @param keyword
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getKindsBySearchComponent(String keyword, String brandId) {
+        List<Map<String, Object>> kinds = new ArrayList<>();
+        try {
+            kinds = searchService.getKindsBySearchComponent(keyword, brandId);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        return kinds;
+    }
 
-	@Override
-	public List<Map<String, Object>> getSimilarKinds(String kindName) {
-		List<Map<String, Object>> kinds = new ArrayList<>();
-		try {
-			kinds = searchService.getSimilarKinds(kindName);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		return kinds;
-	}
+    /**
+     * 获取器件搜索的品牌统计列表
+     *
+     * @param keyword
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getBrandsBySearchComponent(String keyword, String kindId) {
+        List<Map<String, Object>> brands = new ArrayList<>();
+        try {
+            brands = searchService.getBrandsBySearchComponent(keyword, kindId);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        return brands;
+    }
 
-	@Override
-	public List<Map<String, Object>> getSimilarLeafKinds(String kindName) {
-		return searchService.getSimilarLeafKinds(kindName);
-	}
+    /**
+     * 批次搜索结构的类目,器件,店铺类型,货币类型统计
+     *
+     * @param keyword
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getCollectlistBySearchComponentGoods(String keyword, String collectList, String paramJSON, HttpServletRequest request) {
+        List<Map<String, Object>> collectResult = new ArrayList<>();
+        JSONObject jsonObject = FastjsonUtils.parseObject(paramJSON);
+        Set<Entry<String, Object>> paramEntry = jsonObject.entrySet();
+        Map<com.uas.platform.b2c.common.search.util.PageParams.FilterField, Object> param = new LinkedHashMap<>();
+        for (Entry<String, Object> entry : paramEntry) {
+            param.put(FilterField.valueOf(entry.getKey().toUpperCase()), entry.getValue());
+        }
+        try {
+            collectResult = searchService.collectBySearchGoods(keyword, CollectField.valueOf(collectList.toUpperCase()), param);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        if ("goods_brand".equals(collectList)) {
+            if (this.deviceResolver.resolveDevice(request).isMobile()) {
+                for (Map<String, Object> m : collectResult) {
+                    m.put("logoUrl", brandDao.findOne(Long.parseLong(m.get("br_id").toString())).getLogoUrl());
+                }
+            }
+        }
+        return collectResult;
+    }
 
-	@Override
-	public List<Map<String, Object>> getSimilarBrands(String brandName) {
-		List<Map<String, Object>> brands = new ArrayList<Map<String, Object>>();
-		try {
-			brands = searchService.getSimilarBrands(brandName);
-		} catch (SearchException e) {
-			throwSystemException(e);
-		}
-		return brands;
-	}
+    @Override
+    public Map<String, Object> getSimilarKeywords(String keyword) {
+        Map<String, Object> result = null;
+        try {
+            result = searchService.getSimilarKeywords(keyword);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        for (Entry<String, Object> entry : result.entrySet()) {
+            if (((List) entry.getValue()).size() > 8) {
+                entry.setValue(((List) entry.getValue()).subList(0, 8));
+            }
+        }
+        return result;
+    }
 
-	/**
-	 * 捕获SearchException抛出SystemException
-	 *
-	 * @param e
-	 * @return
-	 */
-	private void throwSystemException(SearchException e) {
-		logger.error(e.getMessage(), e);
-		throw new SystemException(e.getMessage());
-	}
+    @Override
+    public List<Map<String, Object>> getSimilarComponents(String componentCode) {
+        List<Map<String, Object>> components = new ArrayList<>();
+        try {
+            components = searchService.getSimilarComponents(componentCode);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        return components;
+    }
+
+    /**
+     * 把平台中PageParams对象转化为搜索API封装的PageParams对象
+     *
+     * @param params
+     * @return
+     */
+    private com.uas.platform.b2c.common.search.util.PageParams convertPageParams(PageParams params) {
+        PageInfo pageinfo = null;
+        if (null == params.getSorting() || "".equals(params.getSorting()) || "{}".equals(params.getSorting()) || JSON.parseObject(params.getSorting()).size() == 0) {
+            pageinfo = new PageInfo();
+        } else {
+            pageinfo = new PageInfo(params);
+        }
+        com.uas.platform.b2c.common.search.util.PageParams pageParams = new com.uas.platform.b2c.common.search.util.PageParams();
+        pageParams.setPage(params.getPage());
+        pageParams.setSize(params.getCount());
+        if (!StringUtils.isEmpty(params.getFilter())) {
+            JSONObject jsonObject = FastjsonUtils.parseObject(params.getFilter());
+            Set<Entry<String, Object>> entrySet = jsonObject.entrySet();
+            for (Entry<String, Object> entry : entrySet) {
+                pageParams.filter(FilterField.valueOf(entry.getKey().toUpperCase()), entry.getValue());
+            }
+        }
+        if (!StringUtils.isEmpty(pageinfo.getSort())) {
+            //com.alibaba.fastjson.JSONObject sort = FastjsonUtils.parseObject(params.getSorting());
+            Iterator<org.springframework.data.domain.Sort.Order> iterator = pageinfo.getSort().iterator();
+            com.uas.platform.b2c.common.search.util.Sort sort = new com.uas.platform.b2c.common.search.util.Sort();
+            Sort newSort = null;
+            while (iterator.hasNext()) {
+                org.springframework.data.domain.Sort.Order order = iterator.next();
+                boolean reverse = false;
+                if ("DESC".equals(order.getDirection().toString())) {
+                    reverse = true;
+                }
+                newSort = new Sort(Sort.Field.valueOf(order.getProperty()), reverse);
+            }
+            pageParams.setSort(newSort);
+        }
+        return pageParams;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSimilarKinds(String kindName) {
+        List<Map<String, Object>> kinds = new ArrayList<>();
+        try {
+            kinds = searchService.getSimilarKinds(kindName);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        return kinds;
+    }
+
+    @Override
+    public List<Map<String, Object>> getSimilarLeafKinds(String kindName) {
+        return searchService.getSimilarLeafKinds(kindName);
+    }
+
+    @Override
+    public List<Map<String, Object>> getSimilarBrands(String brandName) {
+        List<Map<String, Object>> brands = new ArrayList<Map<String, Object>>();
+        try {
+            brands = searchService.getSimilarBrands(brandName);
+        } catch (SearchException e) {
+            throwSystemException(e);
+        }
+        return brands;
+    }
+
+    /**
+     * 捕获SearchException抛出SystemException
+     *
+     * @param e
+     * @return
+     */
+    private void throwSystemException(SearchException e) {
+        logger.error(e.getMessage(), e);
+        throw new SystemException(e.getMessage());
+    }
 }

+ 32 - 0
src/main/java/com/uas/platform/b2c/common/search/util/CollectField.java

@@ -0,0 +1,32 @@
+package com.uas.platform.b2c.common.search.util;
+
+
+/**
+ * 统计信息时需要的字段
+ *
+ * @author sunyj
+ * @since 2017年7月12日 上午9:03:29
+ */
+public enum CollectField {
+
+    // 批次统计
+    /**
+     * 类目
+     */
+    GOODS_KIND,
+
+    /**
+     * 品牌
+     */
+    GOODS_BRAND,
+
+    /**
+     * 货源
+     */
+    GOODS_STORE_TYPE,
+
+    /**
+     * 货币
+     */
+    GOODS_CRNAME;
+}

+ 235 - 0
src/main/java/com/uas/platform/b2c/common/search/util/PageParams.java

@@ -0,0 +1,235 @@
+package com.uas.platform.b2c.common.search.util;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 分页参数
+ *
+ * @author suntg
+ * @since 2016年8月3日下午9:10:47
+ */
+public class PageParams implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 页码
+     */
+    private int page;
+
+    /**
+     * 页大小
+     */
+    private int size;
+
+    /**
+     * 过滤
+     */
+    private Map<FilterField, Object> filters;
+
+    /**
+     * 排序
+     */
+    private Sort sort;
+
+    public PageParams() {
+    }
+
+    /**
+     * @param page
+     *            页码
+     * @param size
+     *            页大小
+     */
+    public PageParams(int page, int size) {
+        this.page = page;
+        this.size = size;
+    }
+
+    /**
+     * @return 页码
+     */
+    public int getPage() {
+        return page;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    /**
+     * @return 页大小
+     */
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    /**
+     * @return 过滤
+     */
+    public Map<FilterField, Object> getFilters() {
+        return filters;
+    }
+
+    public void setFilters(Map<FilterField, Object> filters) {
+        this.filters = filters;
+    }
+
+    public void filter(FilterField key, Object value) {
+        if (this.filters == null) {
+            this.filters = new HashMap<FilterField, Object>();
+        }
+        this.filters.put(key, value);
+    }
+
+    public void removeFilter(FilterField key) {
+        if (this.filters != null) {
+            this.filters.remove(key);
+        }
+    }
+
+    /**
+     * @return 排序
+     */
+    public Sort getSort() {
+        return sort;
+    }
+
+    public void setSort(Sort sort) {
+        this.sort = sort;
+    }
+
+    @Override
+    public String toString() {
+        return "PageParams [page=" + page + ", size=" + size + ", filters=" + filters + ", sort=" + sort + "]";
+    }
+
+    /**
+     * 过滤的字段
+     *
+     * @author sunyj
+     * @since 2017年7月8日 下午5:00:55
+     */
+    public enum FilterField {
+
+        // 器件搜索
+        /**
+         * 类目id
+         */
+        COMPONENT_KINDID,
+
+        /**
+         * 品牌id
+         */
+        COMPONENT_BRANDID,
+
+        /**
+         * 属性信息
+         */
+        COMPONENT_PROPERTIES,
+
+        /**
+         * 有库存
+         */
+        COMPONENT_HAS_RESERVE,
+
+        /**
+         * 有样品
+         */
+        COMPONENT_HAS_SAMPLE,
+
+        /**
+         * 有现货
+         */
+        COMPONENT_HAS_ORIGINAL,
+
+        /**
+         * 有呆滞库存
+         */
+        COMPONENT_HAS_INACTION_STOCK,
+
+        // 批次搜索
+        /**
+         * 类目id
+         */
+        GOODS_KINDID,
+
+        /**
+         * 品牌id
+         */
+        GOODS_BRANDID,
+
+        /**
+         * 货源
+         */
+        GOODS_STORE_TYPE,
+
+        /**
+         * 货币
+         */
+        GOODS_CRNAME,
+
+        /**
+         * 状态
+         */
+        GOODS_STATUS,
+
+        /**
+         * 价格区间过滤:人民币最低价格
+         */
+        GOODS_MINPRICERMB,
+
+        /**
+         * 价格区间过滤:人民币最高价格
+         */
+        GOODS_MAXPRICERMB,
+
+        /**
+         * 价格区间过滤:美元最低价格
+         */
+        GOODS_MINPRICEUSD,
+
+        /**
+         * 价格区间过滤:美元最高价格
+         */
+        GOODS_MAXPRICEUSD,
+
+        // 以下字段用于单据搜索
+
+        /**
+         * 订单状态
+         */
+        ORDER_STATUS,
+
+        /**
+         * 买方个人uu号
+         */
+        ORDER_BUYER_UU,
+
+        /**
+         * 买方企业UU号
+         */
+        ORDER_BUYER_EN_UU,
+
+        /**
+         * 卖方企业UU号
+         */
+        ORDER_SELLER_EN_UU,
+
+        /**
+         * 单据搜索时,若限定时间范围,可以键值对的形式传递参数,该键代表最小(远)时间
+         */
+        ORDER_MIN_TIME,
+
+        /**
+         * 单据搜索时,若限定时间范围,可以键值对的形式传递参数,该键代表最大(近)时间
+         */
+        ORDER_MAX_TIME;
+    }
+}

+ 100 - 0
src/main/java/com/uas/platform/b2c/common/search/util/SPage.java

@@ -0,0 +1,100 @@
+package com.uas.platform.b2c.common.search.util;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class SPage<T> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private int totalPage;
+
+    private long totalElement;
+
+    private int page;
+
+    private int size;
+
+    private boolean first;
+
+    private boolean last;
+
+    private List<T> content;
+
+    public SPage() {
+        super();
+    }
+
+    public SPage(int totalPage, long totalElement, int page, int size, boolean first, boolean last) {
+        super();
+        this.totalPage = totalPage;
+        this.totalElement = totalElement;
+        this.page = page;
+        this.size = size;
+        this.first = first;
+        this.last = last;
+    }
+
+    public int getTotalPage() {
+        return totalPage;
+    }
+
+    public void setTotalPage(int totalPage) {
+        this.totalPage = totalPage;
+    }
+
+    public long getTotalElement() {
+        return totalElement;
+    }
+
+    public void setTotalElement(long totalElement) {
+        this.totalElement = totalElement;
+    }
+
+    public int getPage() {
+        return page;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public boolean isFirst() {
+        return first;
+    }
+
+    public void setFirst(boolean first) {
+        this.first = first;
+    }
+
+    public boolean isLast() {
+        return last;
+    }
+
+    public void setLast(boolean last) {
+        this.last = last;
+    }
+
+    public List<T> getContent() {
+        return content;
+    }
+
+    public void setContent(List<T> content) {
+        this.content = content;
+    }
+
+    @Override
+    public String toString() {
+        return "SPage [totalPage=" + totalPage + ", totalElement=" + totalElement + ", page=" + page + ", size=" + size
+                + ", first=" + first + ", last=" + last + ", content=" + content + "]";
+    }
+
+}

+ 96 - 0
src/main/java/com/uas/platform/b2c/common/search/util/Sort.java

@@ -0,0 +1,96 @@
+package com.uas.platform.b2c.common.search.util;
+
+import java.io.Serializable;
+
+/**
+ * 排序
+ *
+ * @author sunyj
+ * @since 2016年11月23日 下午1:47:44
+ */
+public class Sort implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 排序的字段
+     */
+    private Field field;
+
+    /**
+     * 排序默认为升序,若为true,则进行反转
+     */
+    private boolean reverse = false;
+
+    /**
+     * @param field
+     *            排序的字段
+     * @param reverse
+     *            如果为true,则反转默认的升序
+     */
+    public Sort(Field field, boolean reverse) {
+        this.field = field;
+        this.reverse = reverse;
+    }
+
+    /**
+     * @param field
+     *            排序的字段
+     */
+    public Sort(Field field) {
+        this(field, false);
+    }
+
+    public Sort() {
+
+    }
+
+    /**
+     * @return 排序的字段
+     */
+    public Field getField() {
+        return field;
+    }
+
+    public void setField(Field field) {
+        this.field = field;
+    }
+
+    /**
+     * 排序是否应该被反转
+     *
+     * @return 如果为true,则反转默认的升序
+     */
+    public boolean isReverse() {
+        return reverse;
+    }
+
+    public void setReverse(boolean reverse) {
+        this.reverse = reverse;
+    }
+
+    @Override
+    public String toString() {
+        return "Sort [field=" + field + ", reverse=" + reverse + "]";
+    }
+
+    /**
+     * 排序的字段
+     *
+     * @author sunyj
+     * @since 2017年7月8日 下午5:12:07
+     */
+    public enum Field {
+
+        /**
+         * 库存
+         */
+        RESERVE,
+
+        /**
+         * 价格(人民币)
+         */
+        PRICE
+    }
+
+}

+ 11 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/api/BrandController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.prod.product.brand.api;
 
+import com.uas.platform.b2c.core.support.log.ControllerUsageLog;
 import com.uas.platform.b2c.prod.product.brand.modal.Brand;
 import com.uas.platform.b2c.prod.product.brand.modal.BrandInfo;
 import com.uas.platform.b2c.prod.product.brand.modal.BrandMostSimpleInfo;
@@ -230,4 +231,14 @@ public class BrandController {
 	public List<BrandMostSimpleInfo> getBatchBrands(@RequestBody List<Long> batchIds) {
 		return brandService.getBatchBrandMostSimpleInfs(batchIds);
 	}
+
+	/**
+	 * 获取搜索量最高的2个品牌
+	 * @return 品牌信息
+	 */
+	@RequestMapping(value = "/mostSearchBrands", method = RequestMethod.GET)
+	@ControllerUsageLog(module = "品牌查询接口", detail = "获取搜索量最高的2个品牌")
+	public List<Brand> getMostSearchBrands() {
+		return brandService.getMostSearchBrands();
+	}
 }

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

@@ -81,6 +81,13 @@ public interface BrandDao extends JpaSpecificationExecutor<Brand>, JpaRepository
 	@Query(value = "select b from Brand b  where b.inital in :initals and (b.nameEn like %:keyword% or b.nameCn like %:keyword%)")
 	public Page<Brand> findInInitalsPage(@Param("initals") String[] initals ,@Param("keyword") String keyword, Pageable pageable);
 
+	/**
+	 * 获取搜索量最高的2个品牌
+	 * @return
+	 */
+	@Query(nativeQuery = true , value = "select b from product$brand b order by br_search_count desc LIMIT 2)")
+	public List<Brand> findMostSearchBrands();
+
 	/**
 	 * 器件点击次数加一
 	 * @param uuid

+ 6 - 0
src/main/java/com/uas/platform/b2c/prod/product/brand/service/BrandService.java

@@ -179,6 +179,12 @@ public interface BrandService {
 	 */
 	public List<BrandMostSimpleInfo> getBatchBrandMostSimpleInfs(List<Long> batchIds);
 
+	/**
+	 * 获取搜索量最高的2个品牌
+	 * @return 品牌信息
+	 */
+	public List<Brand> getMostSearchBrands();
+
 	/**
 	 * 器件点击次数加一
 	 * @param uuid

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

@@ -385,6 +385,11 @@ public class BrandServiceImpl implements BrandService {
 		return brandMostSimpleInfoDao.findBatchBrands(batchIds);
 	}
 
+	@Override
+	public List<Brand> getMostSearchBrands() {
+		return brandDao.findMostSearchBrands();
+	}
+
 	@Override
 	public void addVisitCount(String uuid) {
 		brandDao.addVisitCount(uuid);

+ 12 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/api/ComponentController.java

@@ -1,6 +1,7 @@
 package com.uas.platform.b2c.prod.product.component.api;
 
 import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.core.support.log.ControllerUsageLog;
 import com.uas.platform.b2c.prod.commodity.model.Goods;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.product.component.modal.Component;
@@ -277,4 +278,15 @@ public class ComponentController {
 	public List<ComponentInfo> getBatchBrands(@RequestBody List<Long> batchIds) {
 		return componentService.getBatchComponents(batchIds);
 	}
+
+
+	/**
+	 * 获取搜索量最高的2个器件
+	 * @return 品牌信息
+	 */
+	@RequestMapping(value = "/mostSearchComponent", method = RequestMethod.GET)
+	@ControllerUsageLog(module = "品牌查询接口", detail = "获取搜索量最高的2个器件")
+	public List<Component> getMostSearchBrands() {
+		return componentService.getMostSearchComponent();
+	}
 }

+ 8 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/dao/ComponentDao.java

@@ -121,6 +121,14 @@ public interface ComponentDao extends JpaSpecificationExecutor<Component>, JpaRe
 	@Query("select count(1) from Component")
 	public Integer findAllCount();
 
+	/**
+	 * 获取搜索量最高的2个器件
+	 * @return
+	 */
+	@Query(nativeQuery = true , value = "select c from product$component c order by cmp_search_count desc LIMIT 2)")
+	public List<Component> findMostSearchComponent();
+
+
 	/**
 	 * 器件点击次数加一
 	 * @param uuid

+ 7 - 0
src/main/java/com/uas/platform/b2c/prod/product/component/service/ComponentService.java

@@ -217,4 +217,11 @@ public interface ComponentService {
 	 * @return
 	 */
 	public void addVisitCount(String uuid);
+
+	/**
+	 * 获取搜索量最高的2个器件
+	 * @return 品牌信息
+	 */
+	public List<Component> getMostSearchComponent();
+
 }

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

@@ -9,8 +9,8 @@ import com.uas.platform.b2c.prod.product.kind.service.KindService;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
-import com.uas.search.model.PageParams;
-import com.uas.search.model.PageParams.FilterField;
+import com.uas.platform.b2c.common.search.util.PageParams;
+import com.uas.platform.b2c.common.search.util.PageParams.FilterField;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;

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

@@ -30,8 +30,8 @@ import com.uas.platform.core.model.Type;
 import com.uas.platform.core.persistence.criteria.CriterionExpression.Operator;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
 import com.uas.platform.core.persistence.criteria.SimpleExpression;
-import com.uas.search.model.PageParams;
-import com.uas.search.model.PageParams.FilterField;
+import com.uas.platform.b2c.common.search.util.PageParams;
+import com.uas.platform.b2c.common.search.util.PageParams.FilterField;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -548,4 +548,9 @@ public class ComponentServiceImpl implements ComponentService {
 	public void addVisitCount(String uuid) {
 		componentDao.addVisitCount(uuid);
 	}
+
+	@Override
+	public List<Component> getMostSearchComponent() {
+		return componentDao.findMostSearchComponent();
+	}
 }

+ 4 - 1
src/main/java/com/uas/platform/b2c/trade/rate/service/impl/RateServiceImpl.java

@@ -107,7 +107,10 @@ public class RateServiceImpl implements RateService{
             String[] idArray = ids.split(SplitChar.HYPHEN);
             for (String id : idArray) {
                 Order order = orderDao.findByOrderid(id);
-                if(order.getRateStatus() == 523 || order.getRateStatus() == 522){continue;}
+                if (null == order){
+                    continue;
+                }
+                if (order.getRateStatus() == 523 || order.getRateStatus() == 522) { continue;}
                 rateGoodsDao.delete(rateGoodsDao.findByOrderId(order.getOrderid()));
                 for (OrderDetail orderDetail : order.getOrderDetails()){
                     RateGoods rateGoods = new RateGoods();

+ 2 - 2
src/main/resources/dev/sys.properties

@@ -28,8 +28,8 @@ reportUploadUrl=http://print.ubtob.com/report/fileUpload?userName=B2C
 microServiceIp=10.10.101.23
 newsMicroServiceIp=news.usoftchina.com
 newsRedisRefresh=3600
-floorMicroServiceIp=10.10.101.23
-carouselMicroServiceIp=10.10.101.23
+floorMicroServiceIp=10.10.100.23
+carouselMicroServiceIp=10.10.100.23
 storecmsMicroServiceIp=192.168.253.12
 endpointUri=10.10.101.23
 recommendPort=20100

+ 2 - 2
src/main/resources/test/sys.properties

@@ -28,8 +28,8 @@ reportUploadUrl=http://print.ubtob.com/report/fileUpload?userName=B2C
 microServiceIp=10.10.101.23
 newsMicroServiceIp=news.usoftchina.com
 newsRedisRefresh=3600
-floorMicroServiceIp=10.10.101.23
-carouselMicroServiceIp=10.10.101.23
+floorMicroServiceIp=10.10.100.23
+carouselMicroServiceIp=10.10.100.23
 storecmsMicroServiceIp=192.168.253.12
 endpointUri=10.10.101.23
 recommendPort=20100

+ 7 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -18,6 +18,13 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
             type : "standard"
         };
 
+        $scope.sortByERP = 'none';
+        $scope.sortByERPReserve = function (type) {
+			$scope.param.sorting = {'stock': type};
+			$scope.sortByERP = type == $scope.sortByERP ? 'none' : type;
+			loadData();
+		}
+
 		if ($location.$$path.endsWith('vendor_material_unstandard_erp')) {
 			$scope.tab = 'unstandard_material';
 			// $scope.standard_tab = 'unstandard';

+ 16 - 2
src/main/webapp/resources/view/usercenter/forstore/home_center.html

@@ -9,6 +9,20 @@
     p.address span {
         font-weight: 500!important;
     }
+    /*公司名称和用户名称做超出隐藏*/
+    .user_r_01 dl dd span{
+        display: inline-block;
+        margin-top: 18px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+    }
+    .user_r_01 dl dd span.user{
+        max-width: 150px;
+    }
+    .user_r_01 dl dd span.enName{
+        max-width: 305px;
+    }
 </style>
 <!--右侧主体部分-->
 <div class="user_home">
@@ -18,8 +32,8 @@
                 <dl>
                     <dt><img src="static/img/user/images/user_photo.png" /></dt>
                     <dd>
-                       <span ng-cloak ng-bind="userInfo.userName + '&nbsp;|'"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
-                        <span ng-cloak ng-bind="userInfo.enterprise.enName || '个人账户'"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
+                        <span ng-cloak ng-bind="userInfo.userName" class="user" title="{{userInfo.userName}}"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
+                        <span ng-cloak ng-bind="'|&nbsp;' + userInfo.enterprise.enName || '个人账户'" class="enName" title="{{userInfo.enterprise.enName}}"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
                         <a ui-sref="account_manager" href="#/accountManager/">账户设置&nbsp;》</a>
                     </dd>
                 </dl>

+ 10 - 1
src/main/webapp/resources/view/vendor/forstore/erp/vendor_material_erp.html

@@ -96,6 +96,9 @@
 		font-size: 14px;
 		vertical-align: middle !important;
 	}
+	.public-tab.table tr th >div i.active {
+		color: #5078cb;
+	}
 	.public-tab.table>tbody+tbody{
 		border-top: none;
 	}
@@ -465,7 +468,13 @@
 					<thead>
 					<tr>
 						<th width="80">序号</th>
-						<th width="80">ERP空闲库存</th>
+						<th width="80">
+							<div>
+								ERP空闲库存
+								<i class=" fa fa-long-arrow-up" ng-click="sortByERPReserve('ASC')" ng-class="{'active': sortByERP == 'ASC'}"></i>
+								<i class=" fa fa-long-arrow-down" ng-click="sortByERPReserve('DESC')" ng-class="{'active': sortByERP == 'DESC'}"></i>
+							</div>
+						</th>
 						<th width="160">产品编号</th>
 						<th width="180">产品名称(类目)</th>
 						<th width="130">品牌</th>

+ 16 - 2
src/main/webapp/resources/view/vendor/forstore/vendor_index.html

@@ -15,6 +15,20 @@
     .modal-backdrop {
     /*background-color: transparent ;*/
     }
+    /*公司名称和用户名称做超出隐藏*/
+    .seller_data dl dd span{
+        display: inline-block;
+        margin-top: 18px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+    }
+    .seller_data dl dd span.user{
+        max-width: 150px;
+    }
+    .seller_data dl dd span.enName{
+        max-width: 305px;
+    }
 </style>
 <div class="user_right fr">
     <div class="right_l">
@@ -22,8 +36,8 @@
             <dl>
                 <dt><img src="static/img/vendor/images/user_photo.png" /></dt>
                 <dd>
-                    <span ng-bind="userInfo.userName + '&nbsp;|'"><br/><!--<em>账户余额:¥68899.99</em>--></span>
-                    <span ng-bind="vendor.enName || '个人账户'"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
+                    <span ng-bind="userInfo.userName" class="user" title="{{userInfo.userName}}"><br/><!--<em>账户余额:¥68899.99</em>--></span>
+                    <span ng-bind="'|&nbsp;' + vendor.enName || '个人账户'" class="enName" title="{{vendor.enName}}"><br/> <!--<em>账户余额:¥68899.99</em>--></span>
                     <a ui-sref="vendor_account_management" href="#/account/management/">账户设置&nbsp;》</a>
                     <!--<p><img src="static/img/vendor/images/sell_grade.png"/>专有服务:******</p>-->
                 </dd>

+ 4 - 0
src/main/webapp/resources/view/vendor/forstore/vendor_store_maintain.html

@@ -501,6 +501,10 @@
 	.pro-recommend .check-active span{
 		font-weight: normal;
 	}
+	.pro-recommend .check-active span:hover{
+		color: #5078cb;
+		cursor: pointer;
+	}
 	.pro-recommend .pro-recommend-list ul li .pro-list-edit{
 		display: none;
 		width: 100%;

+ 11 - 7
src/main/webapp/resources/view/vendor/modal/recommend_product_modal.html

@@ -126,6 +126,7 @@
 .content-tab .table tbody tr div{
     width: 100%;
     line-height: 24px;
+    overflow: hidden ;
 }
 .content-tab .table tbody tr div span{
     float: left;
@@ -152,6 +153,9 @@
     vertical-align: top !important;
     padding-top: 15px !important;
 }
+.v-top div p.produceDate{
+    text-align: left !important ;
+}
 .record-line {
     font-size: 12px;
     min-height: 30px;
@@ -293,7 +297,7 @@ input[type="number"] {
     <div class="menu">
         <div class="fl">请选择要推荐的产品<em ng-if="isBatch">({{countOfProduct}}/10)</em></div>
         <div class="fr">
-            <span><input type="text" class="form-control search" placeholder="类目/型号/品牌" ng-model="keyword"></span>
+            <span><input type="search" class="form-control search" placeholder="类目/型号/品牌" ng-model="keyword" ng-search="searchProduct()"></span>
             <span>价格:</span>
             <span><input type="text" class="form-control" ng-model="minPrice" min="0" ng-blur="checkPrice('MIN_PRICE')" ng-class="{'error-message': showMinPriceMessage}"></span>
             <span>-</span>
@@ -345,11 +349,11 @@ input[type="number"] {
                     </td>
                     <td class="v-top">
                         <div>
-                            <p style="text-align: left;" ng-bind="commodity.produceDate | date : 'yyyy.MM.dd'">2017.07.10</p>
+                            <span>封装:</span>
+                            <span ng-bind="commodity.packaging">GHGH</span>
                         </div>
                         <div>
-                            <span>封装:</span>
-                            <span>GHGH</span>
+                            <p ng-bind="commodity.produceDate | date : 'yyyy.MM.dd'" class="produceDate">2017.07.10</p>
                         </div>
                     </td>
                     <td>
@@ -416,11 +420,11 @@ input[type="number"] {
                     </td>
                     <td class="v-top">
                         <div>
-                            <p style="text-align: left;" ng-bind="goods.produceDate | date : 'yyyy.MM.dd'">2017.07.10</p>
+                            <span>封装:</span>
+                            <span ng-bind="goods.packaging">GHGH</span>
                         </div>
                         <div>
-                            <span>封装:</span>
-                            <span>GHGH</span>
+                            <p class="produceDate" ng-bind="goods.produceDate | date : 'yyyy.MM.dd'">2017.07.10</p>
                         </div>
                     </td>
                     <td>