|
@@ -15,6 +15,8 @@ import com.fs.hisStore.domain.*;
|
|
|
import com.fs.hisStore.param.*;
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.hisStore.service.*;
|
|
import com.fs.hisStore.service.*;
|
|
|
import com.fs.hisStore.vo.*;
|
|
import com.fs.hisStore.vo.*;
|
|
|
|
|
+import com.fs.live.service.ILiveDataService;
|
|
|
|
|
+import com.fs.live.vo.LiveAppSimpleVO;
|
|
|
import com.fs.store.config.ConceptConfig;
|
|
import com.fs.store.config.ConceptConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -31,7 +33,10 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import springfox.documentation.annotations.Cacheable;
|
|
import springfox.documentation.annotations.Cacheable;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Api("首页接口")
|
|
@Api("首页接口")
|
|
@@ -63,6 +68,87 @@ public class IndexScrmController extends AppBaseController {
|
|
|
private ISysConfigService configService;
|
|
private ISysConfigService configService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
|
|
private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsStoreUserEndCategoryScrmService userEndCategoryScrmService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ILiveDataService liveDataService;
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation("首页初始化")
|
|
|
|
|
+ @GetMapping("/home/init")
|
|
|
|
|
+ public R homeInit(@RequestParam(value = "storeId", required = false) Long storeId) {
|
|
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
|
|
+ // 金刚区:前8条,排序 asc、创建时间 desc
|
|
|
|
|
+ List<FsStoreUserEndCategoryScrm> categoryTags = userEndCategoryScrmService.selectTop8ByPosition(storeId, 1);
|
|
|
|
|
+ // 瀑布流:前8条,排序 asc、创建时间 desc
|
|
|
|
|
+ List<FsStoreUserEndCategoryScrm> goodsNav = userEndCategoryScrmService.selectTop8ByPosition(storeId, 2);
|
|
|
|
|
+ data.put("channelList", Collections.emptyList());
|
|
|
|
|
+ data.put("categoryTags", categoryTags != null ? categoryTags : Collections.emptyList());
|
|
|
|
|
+ data.put("goodsNav", goodsNav != null ? goodsNav : Collections.emptyList());
|
|
|
|
|
+ return R.ok().put("data", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页商品列表(支持用户端分类 id、区域 position、关键字 keyword)
|
|
|
|
|
+ * id:用户端分类ID,为空时按 position 或查全部
|
|
|
|
|
+ * position:1=金刚区 2=瀑布区,传入时查询该区域下全部产品(支持 keyword)
|
|
|
|
|
+ * keyword:商品名称模糊搜索
|
|
|
|
|
+ * 去重分页查商品ID → 查商品简表+标签 → 返回 productId、productName、image、price、otPrice、sales、tagList
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("首页商品列表")
|
|
|
|
|
+ @GetMapping("/home/goods")
|
|
|
|
|
+ public R homeGoods(@RequestParam(value = "id", required = false) Long id,
|
|
|
|
|
+ @RequestParam(value = "keyword", required = false) String keyword,
|
|
|
|
|
+ @RequestParam(value = "storeId", required = false) Long storeId,
|
|
|
|
|
+ @RequestParam(value = "position", required = false) Integer position,
|
|
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
|
|
+ java.util.Map<String, Object> data = userEndCategoryScrmService.listProductsForApp(id, keyword, pageNum, pageSize, storeId, position);
|
|
|
|
|
+ return R.ok().put("data", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页推荐区块(直播中、上新推荐等,可延迟加载)
|
|
|
|
|
+ * live:正在直播的直播间(liveId、liveType、封面、标题;liveType=2 时 liveFlag 从 Redis 查)
|
|
|
|
|
+ * green:商品“新品首发”开启的 2 条
|
|
|
|
|
+ * hot:商品“是否热卖”开启的 2 条
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("首页推荐区块")
|
|
|
|
|
+ @GetMapping("/home/recommend")
|
|
|
|
|
+ public R homeRecommend(HttpServletRequest request) {
|
|
|
|
|
+ String appId = request.getParameter("appId");
|
|
|
|
|
+ List<LiveAppSimpleVO> liveList = liveDataService.listLivingLivesForApp();
|
|
|
|
|
+ List<FsStoreProductListQueryVO> greenProduct = productService.selectFsStoreProductNewQuery(2, appId);
|
|
|
|
|
+ List<FsStoreProductListQueryVO> hotProduct = productService.selectFsStoreProductHotQuery(2, appId);
|
|
|
|
|
+ return R.ok()
|
|
|
|
|
+ .put("live", liveList != null ? liveList : Collections.emptyList())
|
|
|
|
|
+ .put("green", greenProduct != null ? greenProduct : Collections.emptyList())
|
|
|
|
|
+ .put("hot", hotProduct != null ? hotProduct : Collections.emptyList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页推荐「更多」分页:绿色有机(green) / 上新推荐(hot),逻辑同 homeRecommend 的 green、hot 查询,支持分页,默认第1页10条
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("首页推荐更多分页")
|
|
|
|
|
+ @GetMapping("/home/goods/recommend")
|
|
|
|
|
+ public R homeGoodsRecommend(HttpServletRequest request,
|
|
|
|
|
+ @RequestParam(value = "type") String type,
|
|
|
|
|
+ @RequestParam(value = "keyword", required = false) String keyword,
|
|
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
|
|
+ String appId = request.getParameter("appId");
|
|
|
|
|
+ if (!"green".equalsIgnoreCase(type) && !"hot".equalsIgnoreCase(type)) {
|
|
|
|
|
+ return R.ok().put("data", new PageInfo<>(Collections.emptyList()));
|
|
|
|
|
+ }
|
|
|
|
|
+ List<FsStoreProductListQueryVO> list = "green".equalsIgnoreCase(type)
|
|
|
|
|
+ ? productService.selectFsStoreProductNewQueryPage(pageNum, pageSize, appId, keyword)
|
|
|
|
|
+ : productService.selectFsStoreProductHotQueryPage(pageNum, pageSize, appId, keyword);
|
|
|
|
|
+ PageInfo<FsStoreProductListQueryVO> pageInfo = new PageInfo<>(list);
|
|
|
|
|
+ return R.ok().put("data", pageInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@ApiOperation("获取首页数据")
|
|
@ApiOperation("获取首页数据")
|
|
|
@GetMapping("/getIndexData")
|
|
@GetMapping("/getIndexData")
|