|
|
@@ -1,10 +1,13 @@
|
|
|
package com.uas.platform.b2c.common.search.controller;
|
|
|
|
|
|
import com.uas.platform.b2c.common.search.service.SearcherService;
|
|
|
+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 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;
|
|
|
@@ -20,6 +23,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;
|
|
|
|
|
|
@@ -44,6 +48,12 @@ public class SearcherController {
|
|
|
@Autowired
|
|
|
private StoreInService storeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StoreFocusService storeFocusService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GoodsService goodsService;
|
|
|
+
|
|
|
/**
|
|
|
* 作搜索展示跳转
|
|
|
*
|
|
|
@@ -294,9 +304,33 @@ public class SearcherController {
|
|
|
* @param keyword 查询关键字
|
|
|
*/
|
|
|
@RequestMapping(value = "/stores", method = RequestMethod.GET, params = "op=pageByType")
|
|
|
- public Page<StoreIn> pageStoresByTypesAndKeyword(PageParams params, String types, @RequestParam(required = false) String keyword) {
|
|
|
+ @ResponseBody
|
|
|
+ public List<Map<String, Object>> pageStoresByTypesAndKeyword(PageParams params, String types, @RequestParam(required = false) String keyword) {
|
|
|
PageInfo pageInfo = new PageInfo(params);
|
|
|
- return storeService.pageStoresByTypesAndKeyword(pageInfo, types, keyword);
|
|
|
+ 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();
|
|
|
+ Map<String, Object> c = 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){
|
|
|
+ if ("true".equals(storeFocusService.storeIfFocus(storeIn.getId()))){
|
|
|
+ flag.add("true");
|
|
|
+ }else{
|
|
|
+ flag.add("false");
|
|
|
+ }
|
|
|
+ flag2.add(goodsService.pageCommoditiesByEnInfos(storeIn.getUuid(),null,null,new PageInfo(1,4)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
}
|