|
@@ -8,6 +8,7 @@ import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
import com.fs.app.vo.IndexVO;
|
|
import com.fs.app.vo.IndexVO;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
|
import com.fs.course.service.IFsCoursePlaySourceConfigService;
|
|
import com.fs.course.service.IFsCoursePlaySourceConfigService;
|
|
|
import com.fs.his.config.AgreementConfig;
|
|
import com.fs.his.config.AgreementConfig;
|
|
@@ -15,6 +16,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;
|
|
@@ -27,11 +30,13 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-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("首页接口")
|
|
@@ -64,6 +69,83 @@ public class IndexScrmController extends AppBaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
|
|
private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsStoreUserEndCategoryScrmService userEndCategoryScrmService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ILiveDataService liveDataService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页初始化核心数据(频道入口、分类标签、商品分类导航)
|
|
|
|
|
+ * channelList:金刚区用户端分类,按排序和创建时间取前8个
|
|
|
|
|
+ * categoryTags:瀑布流用户端分类,按排序和创建时间取前8个
|
|
|
|
|
+ */
|
|
|
|
|
+ @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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页推荐区块(直播中、上新推荐等,可延迟加载)
|
|
|
|
|
+ * 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());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页商品列表(支持用户端分类 id,id 为空查全部)
|
|
|
|
|
+ * 去重分页查商品ID → 查商品简表+标签 → 返回 productId、productName、image、price、otPrice、sales、tagList
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("首页商品列表")
|
|
|
|
|
+ @GetMapping("/home/goods")
|
|
|
|
|
+ public R homeGoods(@RequestParam(value = "id", required = false) Long id,
|
|
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
|
|
+ java.util.Map<String, Object> data = userEndCategoryScrmService.listProductsForApp(id, pageNum, pageSize);
|
|
|
|
|
+ return R.ok().put("data", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 首页推荐「更多」分页:绿色有机(green) / 上新推荐(hot),逻辑同 homeRecommend 的 green、hot 查询,支持分页,默认第1页10条
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation("首页推荐更多分页")
|
|
|
|
|
+ @GetMapping("/home/goods/recommend")
|
|
|
|
|
+ public R homeGoodsRecommend(HttpServletRequest request,
|
|
|
|
|
+ @RequestParam(value = "type") String type,
|
|
|
|
|
+ @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)
|
|
|
|
|
+ : productService.selectFsStoreProductHotQueryPage(pageNum, pageSize, appId);
|
|
|
|
|
+ PageInfo<FsStoreProductListQueryVO> pageInfo = new PageInfo<>(list);
|
|
|
|
|
+ return R.ok().put("data", pageInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation("获取首页数据")
|
|
@ApiOperation("获取首页数据")
|
|
|
@GetMapping("/getIndexData")
|
|
@GetMapping("/getIndexData")
|
|
|
public R getIndexData(HttpServletRequest request){
|
|
public R getIndexData(HttpServletRequest request){
|