|
@@ -25,6 +25,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -158,6 +159,52 @@ public class PageServiceImpl implements PageService {
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 首页基础数据(小程序)
|
|
|
+ * @param source 来源 : 1 网站 ; 2 小程序
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> getHomeInit(Integer source) {
|
|
|
+ Map<String, Object> map = new HashMap<>(4);
|
|
|
+ // 搜索热门关键字
|
|
|
+ List<String> searchHotWord = pageMapper.getSearchKeyword();
|
|
|
+ if (!CollectionUtils.isEmpty(searchHotWord) && searchHotWord.size() > 8) {
|
|
|
+ searchHotWord.parallelStream()
|
|
|
+ .filter(str -> !StringUtils.isEmpty(str)).limit(8)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ map.put("searchHotWord", searchHotWord);
|
|
|
+ // 头部菜单
|
|
|
+ List<TopMenuVo> menuList = pageMapper.getTopMenus(source);
|
|
|
+ menuList.forEach(item -> {
|
|
|
+ String link = item.getLink();
|
|
|
+ if (StringUtils.isNotBlank(link)) {
|
|
|
+ if (source == 1) {
|
|
|
+ if (link.contains("?")) {
|
|
|
+ link = link + "&name=" + item.getName();
|
|
|
+ } else {
|
|
|
+ link = link + "?name=" + item.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setLinkType(AppletsLinkUtil.getLinkType(link));
|
|
|
+ item.setLinkParam(AppletsLinkUtil.getLinkParam(item.getLinkType(), link));
|
|
|
+ item.setLink(link);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ map.put("topMenuList", menuList);
|
|
|
+ // 底部帮助页
|
|
|
+ List<BaseLinkVo> helpPages = pageMapper.getHelpPageTypes();
|
|
|
+ helpPages.forEach(item -> {
|
|
|
+ List<BaseLinkVo> pageList = pageMapper.getHelpPagesByType(item.getId());
|
|
|
+ item.setLinkList(pageList);
|
|
|
+ });
|
|
|
+ map.put("helpPages", helpPages);
|
|
|
+ // 友情链接
|
|
|
+ List<BaseLinkVo> friendLinks = pageMapper.getFriendLinks();
|
|
|
+ map.put("friendLinks", friendLinks);
|
|
|
+ return ResponseJson.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 活动专题楼层数据(美博会)
|
|
|
*
|