|
@@ -113,7 +113,7 @@ public class FrontStoreController {
|
|
|
public JsonResult<PageVO<FrontStoreListVO>> getList(HttpServletRequest request, Integer categoryId,
|
|
|
@RequestParam(value = "keyword", required = false) String keyword,
|
|
|
@RequestParam(value = "sort", required = false, defaultValue = "2") Integer sort) {
|
|
|
-
|
|
|
+ String webSite = WebUtil.getWebSite(request);
|
|
|
Member member = UserUtil.getUser(request, Member.class);
|
|
|
PagerInfo pager = WebUtil.handlerPagerInfo(request);
|
|
|
List<FrontStoreListVO> vos = new ArrayList<>();
|
|
@@ -128,47 +128,26 @@ public class FrontStoreController {
|
|
|
// storeIdSet.forEach(storeId -> {
|
|
|
// storeIds.append(",").append(storeId);
|
|
|
// });
|
|
|
- StoreExample storeExample = new StoreExample();
|
|
|
- storeExample.setState(StoreConst.STORE_STATE_OPEN);
|
|
|
-// storeExample.setStoreIdIn(storeIds.substring(1));
|
|
|
- String webSite = WebUtil.getWebSite(request);
|
|
|
if (WebSiteConstant.MEMBER_OVERSEA.equals(webSite)) {
|
|
|
+ StoreExample storeExample = new StoreExample();
|
|
|
+ storeExample.setState(StoreConst.STORE_STATE_OPEN);
|
|
|
+// storeExample.setStoreIdIn(storeIds.substring(1));
|
|
|
+
|
|
|
+
|
|
|
storeExample.setStoreNameLike(keyword);
|
|
|
storeExample.setBusinessState(StoreConst.STORE_BUSINESS_STATE_OPEN);
|
|
|
- }
|
|
|
- if (sort == 2) {
|
|
|
- storeExample.setOrderBy("store_look_volume DESC");
|
|
|
- } else {
|
|
|
- storeExample.setOrderBy("store_sales_volume DESC");
|
|
|
- }
|
|
|
|
|
|
- List<Store> storeList = storeModel.getStoreList(storeExample, pager);
|
|
|
- List<StoreName> storeNameList = new ArrayList<>();
|
|
|
- List<StoreSiteInfo> storeSiteInfoList = new ArrayList<>();
|
|
|
- if (WebSiteConstant.MEMBER_DISTRIBUTOR.equals(webSite)) {
|
|
|
- StoreNameExample storeNameExample = new StoreNameExample();
|
|
|
- storeNameExample.setStoreNameLike(keyword);
|
|
|
- storeNameExample.setWebSite(webSite);
|
|
|
- storeNameList = storeNameModel.getStoreNameList(storeNameExample, null);
|
|
|
- if (CollectionUtils.isEmpty(storeNameList)) {
|
|
|
- //没有满足条件的店铺
|
|
|
- return SldResponse.success(new PageVO<>(vos, pager));
|
|
|
+ if (sort == 2) {
|
|
|
+ storeExample.setOrderBy("store_look_volume DESC");
|
|
|
+ } else {
|
|
|
+ storeExample.setOrderBy("store_sales_volume DESC");
|
|
|
}
|
|
|
- StoreSiteInfoExample storeSiteInfoExample = new StoreSiteInfoExample();
|
|
|
- storeSiteInfoExample.setStoreIdIn(storeNameList.stream().map(StoreName::getStoreId).collect(Collectors.toList()));
|
|
|
- storeSiteInfoExample.setWebSite(webSite);
|
|
|
- storeSiteInfoExample.setBusinessState(StoreConst.STORE_BUSINESS_STATE_OPEN);
|
|
|
- storeSiteInfoList = storeSiteInfoModel.getStoreSiteInfoList(storeSiteInfoExample, null);
|
|
|
- if (CollectionUtils.isEmpty(storeSiteInfoList)) {
|
|
|
+
|
|
|
+ List<Store> storeList = storeModel.getStoreList(storeExample, pager);
|
|
|
+ if (CollectionUtils.isEmpty(storeList)) {
|
|
|
//没有满足条件的店铺
|
|
|
return SldResponse.success(new PageVO<>(vos, pager));
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (CollectionUtils.isEmpty(storeList)) {
|
|
|
- //没有满足条件的店铺
|
|
|
- return SldResponse.success(new PageVO<>(vos, pager));
|
|
|
- }
|
|
|
|
|
|
// StringBuilder storeIdIn = new StringBuilder();
|
|
|
// storeList.forEach(store -> {
|
|
@@ -216,20 +195,20 @@ public class FrontStoreController {
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
- for (Store store : storeList) {
|
|
|
- //默认店铺logo
|
|
|
- if (StringUtils.isEmpty(store.getStoreLogo())) {
|
|
|
- store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
|
|
|
- }
|
|
|
- //默认店铺背景图片(取移动端横幅)
|
|
|
- if (StringUtils.isEmpty(store.getStoreBannerMobile())) {
|
|
|
- store.setStoreBannerMobile(stringRedisTemplate.opsForValue().get("default_image_store_backdrop"));
|
|
|
- }
|
|
|
- FrontStoreListVO vo = new FrontStoreListVO(store);
|
|
|
- //会员是否收藏
|
|
|
+ for (Store store : storeList) {
|
|
|
+ //默认店铺logo
|
|
|
+ if (StringUtils.isEmpty(store.getStoreLogo())) {
|
|
|
+ store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
|
|
|
+ }
|
|
|
+ //默认店铺背景图片(取移动端横幅)
|
|
|
+ if (StringUtils.isEmpty(store.getStoreBannerMobile())) {
|
|
|
+ store.setStoreBannerMobile(stringRedisTemplate.opsForValue().get("default_image_store_backdrop"));
|
|
|
+ }
|
|
|
+ FrontStoreListVO vo = new FrontStoreListVO(store);
|
|
|
+ //会员是否收藏
|
|
|
// vo.setIsFollow(memberFollowStoreSet.contains(store.getStoreId()) ? "true" : "false");
|
|
|
|
|
|
- //查询店铺内的热销商品
|
|
|
+ //查询店铺内的热销商品
|
|
|
// List<StoreGoodsVO> storeGoodsSaleList = storeGoodsSaleMap.getOrDefault(store.getStoreId(), new ArrayList<>());
|
|
|
// //按销量倒序
|
|
|
// storeGoodsSaleList.sort((o1, o2) -> Integer.compare(o2.getActualSales(), o1.getActualSales()));
|
|
@@ -238,35 +217,58 @@ public class FrontStoreController {
|
|
|
// //店铺热销商品列表
|
|
|
// vo.setGoodsListVOList(storeGoodsSaleList);
|
|
|
|
|
|
- //查询店铺内本月上新商品
|
|
|
+ //查询店铺内本月上新商品
|
|
|
// List<StoreGoodsVO> storeGoodsOnlineList = storeGoodsOnlineMap.getOrDefault(store.getStoreId(), new ArrayList<>());
|
|
|
- //按创建时间倒序
|
|
|
+ //按创建时间倒序
|
|
|
// storeGoodsOnlineList.sort((o1, o2) -> o1.getOnlineTime().equals(o2.getOnlineTime()) ? 0 : (o1.getOnlineTime().before(o2.getOnlineTime()) ? 1 : -1));
|
|
|
- //本月上新商品个数
|
|
|
+ //本月上新商品个数
|
|
|
// vo.setNewGoodsNumber(storeGoodsOnlineList.size());
|
|
|
- //本月上新商品列表
|
|
|
+ //本月上新商品列表
|
|
|
// vo.setNewGoodsListVOS(storeGoodsOnlineList);
|
|
|
- vos.add(vo);
|
|
|
- }
|
|
|
- for (StoreSiteInfo storeSiteInfo : storeSiteInfoList) {
|
|
|
- Store store = storeModel.getStoreByStoreId(storeSiteInfo.getStoreId());
|
|
|
- if (store != null) {
|
|
|
- store.setStoreName(storeNameList.stream()
|
|
|
- .filter(storeNameWebSite -> storeNameWebSite.getStoreId().equals(storeSiteInfo.getStoreId()))
|
|
|
- .findFirst()
|
|
|
- .map(StoreName::getStoreName)
|
|
|
- .orElse(""));
|
|
|
- store.setStoreLogo(storeSiteInfo.getStoreLogo());
|
|
|
- //默认店铺logo
|
|
|
- if (StringUtils.isEmpty(store.getStoreLogo())) {
|
|
|
- store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ List<StoreName> storeNameList = new ArrayList<>();
|
|
|
+ List<StoreSiteInfo> storeSiteInfoList = new ArrayList<>();
|
|
|
+ if (WebSiteConstant.MEMBER_DISTRIBUTOR.equals(webSite)) {
|
|
|
+ StoreNameExample storeNameExample = new StoreNameExample();
|
|
|
+ storeNameExample.setStoreNameLike(keyword);
|
|
|
+ storeNameExample.setWebSite(webSite);
|
|
|
+ storeNameList = storeNameModel.getStoreNameList(storeNameExample, pager);
|
|
|
+ if (CollectionUtils.isEmpty(storeNameList)) {
|
|
|
+ //没有满足条件的店铺
|
|
|
+ return SldResponse.success(new PageVO<>(vos, pager));
|
|
|
}
|
|
|
- //默认店铺背景图片(取移动端横幅)
|
|
|
- if (StringUtils.isEmpty(store.getStoreBannerMobile())) {
|
|
|
- store.setStoreBannerMobile(stringRedisTemplate.opsForValue().get("default_image_store_backdrop"));
|
|
|
+ StoreSiteInfoExample storeSiteInfoExample = new StoreSiteInfoExample();
|
|
|
+ storeSiteInfoExample.setStoreIdIn(storeNameList.stream().map(StoreName::getStoreId).collect(Collectors.toList()));
|
|
|
+ storeSiteInfoExample.setWebSite(webSite);
|
|
|
+ storeSiteInfoExample.setBusinessState(StoreConst.STORE_BUSINESS_STATE_OPEN);
|
|
|
+ storeSiteInfoList = storeSiteInfoModel.getStoreSiteInfoList(storeSiteInfoExample, null);
|
|
|
+ if (CollectionUtils.isEmpty(storeSiteInfoList)) {
|
|
|
+ //没有满足条件的店铺
|
|
|
+ return SldResponse.success(new PageVO<>(vos, pager));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (StoreSiteInfo storeSiteInfo : storeSiteInfoList) {
|
|
|
+ Store store = storeModel.getStoreByStoreId(storeSiteInfo.getStoreId());
|
|
|
+ if (store != null) {
|
|
|
+ store.setStoreName(storeNameList.stream()
|
|
|
+ .filter(storeNameWebSite -> storeNameWebSite.getStoreId().equals(storeSiteInfo.getStoreId()))
|
|
|
+ .findFirst()
|
|
|
+ .map(StoreName::getStoreName)
|
|
|
+ .orElse(""));
|
|
|
+ store.setStoreLogo(storeSiteInfo.getStoreLogo());
|
|
|
+ //默认店铺logo
|
|
|
+ if (StringUtils.isEmpty(store.getStoreLogo())) {
|
|
|
+ store.setStoreLogo(stringRedisTemplate.opsForValue().get("default_image_store_logo"));
|
|
|
+ }
|
|
|
+ //默认店铺背景图片(取移动端横幅)
|
|
|
+ if (StringUtils.isEmpty(store.getStoreBannerMobile())) {
|
|
|
+ store.setStoreBannerMobile(stringRedisTemplate.opsForValue().get("default_image_store_backdrop"));
|
|
|
+ }
|
|
|
+ FrontStoreListVO vo = new FrontStoreListVO(store);
|
|
|
+ vos.add(vo);
|
|
|
}
|
|
|
- FrontStoreListVO vo = new FrontStoreListVO(store);
|
|
|
- vos.add(vo);
|
|
|
}
|
|
|
}
|
|
|
|