|
|
@@ -10,6 +10,7 @@ import apps.pojo.Website;
|
|
|
import apps.pojo.WebsiteNavigation;
|
|
|
import space.apps.moudules.basic.util.SortOrderUtil;
|
|
|
import space.apps.moudules.website.template.common.WebsiteTmplateConstvars.NavTerminalType;
|
|
|
+import space.apps.moudules.website.template.common.WebsiteTmplateConstvars.navigationType;
|
|
|
import space.core.apps.util.GdbaQueryUtil;
|
|
|
import space.core.common.utils.StringUtil;
|
|
|
import space.core.db.jdbc.GeneralDBAccess;
|
|
|
@@ -227,9 +228,6 @@ public class WebsiteTemplateNavUtil {
|
|
|
if (StringUtil.isNull(name)) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (name.startsWith("首页子栏目")) {
|
|
|
- return false;
|
|
|
- }
|
|
|
return includeHome || !"首页".equals(name);
|
|
|
}
|
|
|
|
|
|
@@ -508,6 +506,59 @@ public class WebsiteTemplateNavUtil {
|
|
|
return navMapList;
|
|
|
}
|
|
|
|
|
|
+ private static List<Map<String, Object>> getHeaderNavigationList(GeneralDBAccess gdba, Website website,
|
|
|
+ String parentNavID, NavTerminalType navTerminalType) throws Exception {
|
|
|
+ List<Map<String, Object>> directNavList = getNavigationList(gdba, website, parentNavID, null, null, false);
|
|
|
+ if (directNavList == null || directNavList.size() == 0) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> headerNavList = new ArrayList<Map<String, Object>>();
|
|
|
+ for (Map<String, Object> navMap : directNavList) {
|
|
|
+ String navigationID = navMap.get("navigationid").toString();
|
|
|
+ Long wntCode = Long.valueOf(navMap.get("wntcode").toString());
|
|
|
+
|
|
|
+ if (navigationType.HIDE_CATALOG.getCode().equals(wntCode)) {
|
|
|
+ List<Map<String, Object>> promotedNavList = getHeaderNavigationList(gdba, website, navigationID,
|
|
|
+ navTerminalType);
|
|
|
+ if (promotedNavList != null) {
|
|
|
+ headerNavList.addAll(promotedNavList);
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isVisibleForTerminal(navMap.get("wnscode"), navTerminalType)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> childrenList = getHeaderNavigationList(gdba, website, navigationID,
|
|
|
+ navTerminalType);
|
|
|
+ if (childrenList != null) {
|
|
|
+ navMap.put("children", childrenList);
|
|
|
+ }
|
|
|
+ headerNavList.add(navMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ return headerNavList.size() == 0 ? null : headerNavList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static boolean isVisibleForTerminal(Object wnscode, NavTerminalType navTerminalType) {
|
|
|
+ if (wnscode == null || navTerminalType == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String terminalCode = wnscode.toString();
|
|
|
+ if (NavTerminalType.ALL.equals(navTerminalType)) {
|
|
|
+ return "10000".equals(terminalCode);
|
|
|
+ }
|
|
|
+ if (NavTerminalType.PC.equals(navTerminalType)) {
|
|
|
+ return "10000".equals(terminalCode) || "10010".equals(terminalCode);
|
|
|
+ }
|
|
|
+ if (NavTerminalType.MOBILE.equals(navTerminalType)) {
|
|
|
+ return "10000".equals(terminalCode) || "10020".equals(terminalCode);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取上级栏目链(包含自己)
|
|
|
*
|
|
|
@@ -590,7 +641,7 @@ public class WebsiteTemplateNavUtil {
|
|
|
*/
|
|
|
public static List<Map<String, Object>> getWebsiteAllTerminalNav(GeneralDBAccess gdba, Website website)
|
|
|
throws Exception {
|
|
|
- return getNavigationList(gdba, website, null, NavTerminalType.ALL, null, true);
|
|
|
+ return getHeaderNavigationList(gdba, website, null, NavTerminalType.ALL);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -605,7 +656,7 @@ public class WebsiteTemplateNavUtil {
|
|
|
*/
|
|
|
public static List<Map<String, Object>> getWebsiteMobileTerminalNav(GeneralDBAccess gdba, Website website)
|
|
|
throws Exception {
|
|
|
- return getNavigationList(gdba, website, null, NavTerminalType.MOBILE, null, true);
|
|
|
+ return getHeaderNavigationList(gdba, website, null, NavTerminalType.MOBILE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -620,7 +671,7 @@ public class WebsiteTemplateNavUtil {
|
|
|
*/
|
|
|
public static List<Map<String, Object>> getWebsitePCTerminalNav(GeneralDBAccess gdba, Website website)
|
|
|
throws Exception {
|
|
|
- return getNavigationList(gdba, website, null, NavTerminalType.PC, null, true);
|
|
|
+ return getHeaderNavigationList(gdba, website, null, NavTerminalType.PC);
|
|
|
}
|
|
|
|
|
|
/**
|