|
|
@@ -1,13 +1,24 @@
|
|
|
package com.uas.platform.b2c.common.search.controller;
|
|
|
|
|
|
+import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.b2c.prod.commodity.service.GoodsService;
|
|
|
+import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
+import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
|
+import com.uas.platform.b2c.trade.presale.service.StoreFocusService;
|
|
|
+import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -15,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -36,6 +48,15 @@ public class SearcherController {
|
|
|
@Autowired
|
|
|
private SearcherService searcherService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StoreInService storeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StoreFocusService storeFocusService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GoodsService goodsService;
|
|
|
+
|
|
|
/**
|
|
|
* 作搜索展示跳转
|
|
|
*
|
|
|
@@ -278,4 +299,38 @@ public class SearcherController {
|
|
|
return searcherService.getSimilarBrands(keyword);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据店铺类型和关键字信息分页获取店铺信息
|
|
|
+ *
|
|
|
+ * @param params 分页参数信息
|
|
|
+ * @param types 店铺类型
|
|
|
+ * @param keyword 查询关键字
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/stores", method = RequestMethod.GET, params = "op=pageByType")
|
|
|
+ @ResponseBody
|
|
|
+ public List<Map<String, Object>> pageStoresByTypesAndKeyword(PageParams params, String types,HttpServletRequest request, @RequestParam(required = false) String keyword) {
|
|
|
+ User user = (User)request.getSession().getAttribute("user");
|
|
|
+ SystemSession.setUser(user);
|
|
|
+ PageInfo pageInfo = new PageInfo(params);
|
|
|
+ Page<StoreIn> stores = storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword);
|
|
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
|
+ Map<String, Object> a = new HashedMap();
|
|
|
+ a.put("stores",stores);
|
|
|
+ result.add(a);
|
|
|
+ Map<String, Object> b = new HashedMap();
|
|
|
+ ArrayList<String> flag = new ArrayList<>();
|
|
|
+ ArrayList<Object> flag2 = new ArrayList<>();
|
|
|
+ b.put("isFocus",flag);
|
|
|
+ b.put("image",flag2);
|
|
|
+ result.add(b);
|
|
|
+ for (StoreIn storeIn : stores){
|
|
|
+ flag.add(storeFocusService.storeIfFocus(storeIn.getId()));
|
|
|
+ PageInfo pageInfoCache = new PageInfo(1,4);
|
|
|
+ //暂时只显示有图片的产品信息
|
|
|
+ pageInfoCache.expression(PredicateUtils.isNotNull("img"));
|
|
|
+ flag2.add(goodsService.pageCommoditiesByEnInfos(storeIn.getUuid(),null,null,pageInfoCache));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|