Jelajahi Sumber

调整二级红色模板首页栏目顺序

将非繁二级网站模板-红色的首页动态栏目收口到后台真实栏目:顶部自定义栏目作为前置固定锚点,底部自定义栏目作为后置固定锚点,首页中间区域只渲染真实创建的 diy 栏目,并去掉旧的专业介绍/学院风采兜底固定块。

后台栏目新增、变动和排序时,对 ffkjcollegered1 首页子栏目自动规整排序:顶部自定义栏目保持最前,底部自定义栏目保持最后,中间栏目按栏目列表顺序排列。

Validation:

- javac -encoding UTF-8 -cp WebRoot/WEB-INF/classes:WebRoot/WEB-INF/lib/* -d WebRoot/WEB-INF/classes src/space/apps/moudules/website/services/NavigationService.java src/space/apps/moudules/website/template/ffkjcollegered1/WebSiteArticleService.java

- 浏览器刷新 http://ffkj-dept-red.localhost:4188/,确认首页中间动态栏目只显示真实栏目“教学动态”及其文章
非繁 5 bulan lalu
induk
melakukan
90aaae8be9

+ 67 - 95
WebRoot/web/upload/ffkj-template/college-red-index.jsp

@@ -161,104 +161,76 @@
 			</section>
 
 			<section class="department-life department-home-sections">
-				<c:choose>
-					<c:when test="${not empty collegeHomeSectionRows}">
-						<c:forEach items="${collegeHomeSectionRows}" var="homeSectionRow" varStatus="rowVs">
-							<div class="department-home-section-row department-home-section-row-${rowVs.index % 2 == 0 ? 'a' : 'b'}">
-								<div class="wrap department-life-grid department-home-section-grid">
-									<c:forEach items="${homeSectionRow}" var="homeSection">
-										<c:set var="sectionNav" value="${homeSection.navigationMap}"/>
-										<c:set var="sectionListStyleCode" value="${empty sectionNav.wnlscode ? 10000 : sectionNav.wnlscode}"/>
-										<c:set var="sectionIsTextList" value="${sectionListStyleCode == 10000}"/>
-										<c:set var="sectionIsGraphicList" value="${sectionListStyleCode == 10010}"/>
-										<c:set var="sectionIsCarouselList" value="${sectionListStyleCode == 10020}"/>
-										<c:set var="sectionIsMediaGrid" value="${sectionListStyleCode == 10030 or sectionListStyleCode == 10050}"/>
-										<c:set var="sectionHref" value="${empty sectionNav.href ? sectionNav.url : sectionNav.href}"/>
-										<article class="department-list-panel department-home-panel ${sectionIsGraphicList ? 'is-graphic-list' : ''} ${sectionIsCarouselList ? 'is-carousel-list' : ''} ${sectionIsMediaGrid ? 'is-media-grid' : ''}">
-											<div class="department-section-title"><h2>${sectionNav.name}</h2><a href="${sectionHref}" target="${sectionNav.target}">查看更多</a></div>
-											<c:choose>
-												<c:when test="${sectionIsCarouselList}">
-													<div class="department-section-carousel" aria-label="${sectionNav.name}轮播">
-														<c:choose>
-															<c:when test="${not empty homeSection.articleList}">
-																<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
-																	<c:if test="${vs.count le 5}">
-																		<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
-																		<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
-																		<a class="department-section-slide ${vs.first ? 'active' : ''}" href="${item.url}" target="${item.target}">
-																			<img src="${sectionImage}" alt="${item.title}">
-																			<span><strong>${item.title}</strong></span>
-																		</a>
-																	</c:if>
-																</c:forEach>
-															</c:when>
-															<c:otherwise>
-																<a class="department-section-slide active" href="${sectionHref}" target="${sectionNav.target}"><img src="${assetBase}/official/campus-2.jpg" alt="${sectionNav.name}"><span><strong>${sectionNav.name}</strong></span></a>
-															</c:otherwise>
-														</c:choose>
-														<button class="department-section-arrow prev" type="button" aria-label="上一条">‹</button>
-														<button class="department-section-arrow next" type="button" aria-label="下一条">›</button>
-														<div class="department-section-dots" aria-label="${sectionNav.name}轮播分页">
-															<c:choose>
-																<c:when test="${not empty homeSection.articleList}">
-																	<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs"><c:if test="${vs.count le 5}"><button type="button" class="${vs.first ? 'active' : ''}" aria-label="切换到第 ${vs.count} 条"></button></c:if></c:forEach>
-																</c:when>
-																<c:otherwise><button type="button" class="active" aria-label="切换到第 1 条"></button></c:otherwise>
-															</c:choose>
-														</div>
-													</div>
-												</c:when>
-												<c:when test="${sectionIsGraphicList}">
-													<ul class="department-section-graphic-list">
-														<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
-															<c:if test="${vs.count le 5}">
-																<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
-																<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
-																<li><a href="${item.url}" target="${item.target}"><span class="department-section-thumb"><img src="${sectionImage}" alt="${item.title}"></span><span class="department-section-copy"><b>${item.title}</b><time>${fn:substring(item.release_time, 0, 10)}</time></span></a></li>
-															</c:if>
-														</c:forEach>
-													</ul>
-												</c:when>
-												<c:when test="${sectionIsMediaGrid}">
-													<ul class="department-section-media-grid">
-														<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
-															<c:if test="${vs.count le 4}">
-																<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
-																<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
-																<li><a href="${item.url}" target="${item.target}"><span class="department-section-thumb"><img src="${sectionImage}" alt="${item.title}"></span><b>${item.title}</b></a></li>
-															</c:if>
-														</c:forEach>
-													</ul>
-												</c:when>
-												<c:otherwise>
-													<ul class="department-news-list department-plain-list">
-														<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
-															<c:if test="${vs.count le 5}"><li><a href="${item.url}" target="${item.target}"><span><strong>${fn:substring(item.release_time, 8, 10)}</strong><em>${fn:substring(item.release_time, 0, 7)}</em></span><div><b>${item.title}</b></div></a></li></c:if>
-														</c:forEach>
-													</ul>
-												</c:otherwise>
-											</c:choose>
-										</article>
-									</c:forEach>
-								</div>
-							</div>
-						</c:forEach>
-					</c:when>
-					<c:otherwise>
-						<div class="department-home-section-row department-home-section-row-a">
+				<c:if test="${not empty collegeHomeSectionRows}">
+					<c:forEach items="${collegeHomeSectionRows}" var="homeSectionRow" varStatus="rowVs">
+						<div class="department-home-section-row department-home-section-row-${rowVs.index % 2 == 0 ? 'a' : 'b'}">
 							<div class="wrap department-life-grid department-home-section-grid">
-								<article class="department-list-panel department-home-panel">
-									<div class="department-section-title"><h2>${empty collegeIntroNmv.navigationMap.name ? '专业介绍' : collegeIntroNmv.navigationMap.name}</h2><a href="${empty collegeIntroNmv.navigationMap.url ? collegeMajorNmv.navigationMap.url : collegeIntroNmv.navigationMap.url}">查看更多</a></div>
-									<ul class="department-news-list department-plain-list"><c:forEach items="${empty collegeIntroNmv.articleList ? collegeMajorNmv.articleList : collegeIntroNmv.articleList}" var="major" varStatus="vs"><c:if test="${vs.count le 5}"><li><a href="${major.url}" target="${major.target}"><span><strong>${fn:substring(major.release_time, 8, 10)}</strong><em>${fn:substring(major.release_time, 0, 7)}</em></span><div><b>${major.title}</b></div></a></li></c:if></c:forEach></ul>
-								</article>
-								<article class="department-list-panel department-home-panel">
-									<div class="department-section-title"><h2>${empty collegeFeatureNmv.navigationMap.name ? '学院风采' : collegeFeatureNmv.navigationMap.name}</h2><a href="${collegeFeatureNmv.navigationMap.url}">查看更多</a></div>
-									<ul class="department-news-list department-plain-list"><c:forEach items="${collegeFeatureNmv.articleList}" var="item" varStatus="vs"><c:if test="${vs.count le 5}"><li><a href="${item.url}" target="${item.target}"><span><strong>${fn:substring(item.release_time, 8, 10)}</strong><em>${fn:substring(item.release_time, 0, 7)}</em></span><div><b>${item.title}</b></div></a></li></c:if></c:forEach></ul>
-								</article>
+								<c:forEach items="${homeSectionRow}" var="homeSection">
+									<c:set var="sectionNav" value="${homeSection.navigationMap}"/>
+									<c:set var="sectionListStyleCode" value="${empty sectionNav.wnlscode ? 10000 : sectionNav.wnlscode}"/>
+									<c:set var="sectionIsTextList" value="${sectionListStyleCode == 10000}"/>
+									<c:set var="sectionIsGraphicList" value="${sectionListStyleCode == 10010}"/>
+									<c:set var="sectionIsCarouselList" value="${sectionListStyleCode == 10020}"/>
+									<c:set var="sectionIsMediaGrid" value="${sectionListStyleCode == 10030 or sectionListStyleCode == 10050}"/>
+									<c:set var="sectionHref" value="${empty sectionNav.href ? sectionNav.url : sectionNav.href}"/>
+									<article class="department-list-panel department-home-panel ${sectionIsGraphicList ? 'is-graphic-list' : ''} ${sectionIsCarouselList ? 'is-carousel-list' : ''} ${sectionIsMediaGrid ? 'is-media-grid' : ''}">
+										<div class="department-section-title"><h2>${sectionNav.name}</h2><a href="${sectionHref}" target="${sectionNav.target}">查看更多</a></div>
+										<c:choose>
+											<c:when test="${sectionIsCarouselList}">
+												<div class="department-section-carousel" aria-label="${sectionNav.name}轮播">
+													<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
+														<c:if test="${vs.count le 5}">
+															<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
+															<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
+															<a class="department-section-slide ${vs.first ? 'active' : ''}" href="${item.url}" target="${item.target}">
+																<img src="${sectionImage}" alt="${item.title}">
+																<span><strong>${item.title}</strong></span>
+															</a>
+														</c:if>
+													</c:forEach>
+													<button class="department-section-arrow prev" type="button" aria-label="上一条">‹</button>
+													<button class="department-section-arrow next" type="button" aria-label="下一条">›</button>
+													<div class="department-section-dots" aria-label="${sectionNav.name}轮播分页">
+														<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs"><c:if test="${vs.count le 5}"><button type="button" class="${vs.first ? 'active' : ''}" aria-label="切换到第 ${vs.count} 条"></button></c:if></c:forEach>
+													</div>
+												</div>
+											</c:when>
+											<c:when test="${sectionIsGraphicList}">
+												<ul class="department-section-graphic-list">
+													<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
+														<c:if test="${vs.count le 5}">
+															<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
+															<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
+															<li><a href="${item.url}" target="${item.target}"><span class="department-section-thumb"><img src="${sectionImage}" alt="${item.title}"></span><span class="department-section-copy"><b>${item.title}</b><time>${fn:substring(item.release_time, 0, 10)}</time></span></a></li>
+														</c:if>
+													</c:forEach>
+												</ul>
+											</c:when>
+											<c:when test="${sectionIsMediaGrid}">
+												<ul class="department-section-media-grid">
+													<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
+														<c:if test="${vs.count le 4}">
+															<c:set var="sectionImage" value="${assetBase}/official/campus-2.jpg"/>
+															<c:if test="${not empty item.thumbnail}"><c:set var="sectionImage" value="${item.thumbnail}"/></c:if>
+															<li><a href="${item.url}" target="${item.target}"><span class="department-section-thumb"><img src="${sectionImage}" alt="${item.title}"></span><b>${item.title}</b></a></li>
+														</c:if>
+													</c:forEach>
+												</ul>
+											</c:when>
+											<c:otherwise>
+												<ul class="department-news-list department-plain-list">
+													<c:forEach items="${homeSection.articleList}" var="item" varStatus="vs">
+														<c:if test="${vs.count le 5}"><li><a href="${item.url}" target="${item.target}"><span><strong>${fn:substring(item.release_time, 8, 10)}</strong><em>${fn:substring(item.release_time, 0, 7)}</em></span><div><b>${item.title}</b></div></a></li></c:if>
+													</c:forEach>
+												</ul>
+											</c:otherwise>
+										</c:choose>
+									</article>
+								</c:forEach>
 							</div>
 						</div>
-					</c:otherwise>
-				</c:choose>
+					</c:forEach>
+				</c:if>
 			</section>
 		</main>
 

+ 130 - 1
src/space/apps/moudules/website/services/NavigationService.java

@@ -1,7 +1,10 @@
 package space.apps.moudules.website.services;
 
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -31,6 +34,10 @@ import space.core.db.jdbc.SqlCommandImpl;
 public class NavigationService extends BaseTransaction {
 
 	private static final long serialVersionUID = 1L;
+	private static final String COLLEGE_RED_TEMPLATE_CONFIG = "ffkjcollegered1";
+	private static final String COLLEGE_HOME_GROUP_IDCARD = "FFKJ_COLLEGE_HOME_GROUP";
+	private static final String COLLEGE_TOP_CUSTOM_IDCARD = "FFKJ_COLLEGE_SCHOOL_HOME";
+	private static final String COLLEGE_BOTTOM_CUSTOM_IDCARD = "FFKJ_COLLEGE_FOOTER_LINKS";
 	
 	static Logger log = LogManager.getLogger(NavigationService.class);
 	
@@ -57,6 +64,7 @@ public class NavigationService extends BaseTransaction {
 		
 		gdba.insertByBean(wn);
 		inheritManageFromParent(gdba, wn);
+		normalizeCollegeRedHomeNavigationSort(gdba, wn.getWebsiteid(), wn.getParentNid(), null);
 		gdba.commit();
 		clearWebsiteFrontCache(wn);
 		
@@ -108,6 +116,9 @@ public class NavigationService extends BaseTransaction {
 		AppNavigationUtil.generateNavURI(gdba, wn);
 		
 		gdba.updateById(wn);
+		normalizeCollegeRedHomeNavigationSort(gdba, oldWn == null ? null : oldWn.getWebsiteid(),
+				oldWn == null ? null : oldWn.getParentNid(), null);
+		normalizeCollegeRedHomeNavigationSort(gdba, wn.getWebsiteid(), wn.getParentNid(), null);
 		gdba.commit();
 		clearWebsiteFrontCache(oldWn);
 		clearWebsiteFrontCache(wn);
@@ -424,7 +435,11 @@ public class NavigationService extends BaseTransaction {
 			gdba.selectById(sortedWn);
 		}
 		
-		CURDUtil.sortDataNumber(gdba, "website_navigation", dataIdAry, "navigationid", "sort_number", false);
+		boolean normalized = sortedWn != null && normalizeCollegeRedHomeNavigationSort(gdba, sortedWn.getWebsiteid(),
+				sortedWn.getParentNid(), dataIdAry);
+		if (!normalized) {
+			CURDUtil.sortDataNumber(gdba, "website_navigation", dataIdAry, "navigationid", "sort_number", false);
+		}
 		gdba.commit();
 		clearWebsiteFrontCache(sortedWn);
 		
@@ -501,4 +516,118 @@ public class NavigationService extends BaseTransaction {
 		write(getResponseSuccessDataPackage(wn).toJson());
 	}
 
+	private boolean normalizeCollegeRedHomeNavigationSort(GeneralDBAccess gdba, Long websiteid, Long parentNid,
+			String[] sortedIdAry) throws Exception {
+		if (!isCollegeRedHomeGroupChild(gdba, websiteid, parentNid)) {
+			return false;
+		}
+
+		List<Map<String, Object>> childList = getCollegeRedHomeChildNavigation(gdba, websiteid, parentNid);
+		if (childList == null || childList.size() == 0) {
+			return false;
+		}
+
+		Long topCustomId = null;
+		Long bottomCustomId = null;
+		Set<Long> childIdSet = new HashSet<Long>();
+		for (Map<String, Object> child : childList) {
+			Long navigationId = getLongValue(child.get("navigationid"));
+			if (navigationId == null) {
+				continue;
+			}
+			childIdSet.add(navigationId);
+			if (COLLEGE_TOP_CUSTOM_IDCARD.equals(getStringValue(child.get("idcard")))) {
+				topCustomId = navigationId;
+			} else if (COLLEGE_BOTTOM_CUSTOM_IDCARD.equals(getStringValue(child.get("idcard")))) {
+				bottomCustomId = navigationId;
+			}
+		}
+
+		List<Long> middleIdList = new ArrayList<Long>();
+		Set<Long> usedMiddleIdSet = new HashSet<Long>();
+		if (sortedIdAry != null) {
+			for (String sortedId : sortedIdAry) {
+				Long navigationId = getLongValue(sortedId);
+				if (navigationId == null || !childIdSet.contains(navigationId)
+						|| navigationId.equals(topCustomId) || navigationId.equals(bottomCustomId)) {
+					continue;
+				}
+				middleIdList.add(navigationId);
+				usedMiddleIdSet.add(navigationId);
+			}
+		}
+
+		for (Map<String, Object> child : childList) {
+			Long navigationId = getLongValue(child.get("navigationid"));
+			if (navigationId == null || navigationId.equals(topCustomId) || navigationId.equals(bottomCustomId)
+					|| usedMiddleIdSet.contains(navigationId)) {
+				continue;
+			}
+			middleIdList.add(navigationId);
+			usedMiddleIdSet.add(navigationId);
+		}
+
+		long sortNumber = 1L;
+		if (topCustomId != null) {
+			updateNavigationSortNumber(gdba, topCustomId, sortNumber++);
+		}
+		for (Long middleId : middleIdList) {
+			updateNavigationSortNumber(gdba, middleId, sortNumber++);
+		}
+		if (bottomCustomId != null) {
+			updateNavigationSortNumber(gdba, bottomCustomId, sortNumber);
+		}
+		return true;
+	}
+
+	private boolean isCollegeRedHomeGroupChild(GeneralDBAccess gdba, Long websiteid, Long parentNid) throws Exception {
+		if (websiteid == null || parentNid == null) {
+			return false;
+		}
+		String sql = "SELECT COUNT(*) AS count FROM website_navigation home "
+				+ "JOIN website w ON w.websiteid = home.websiteid "
+				+ "JOIN website_template wt ON wt.wtid = w.wtid "
+				+ "WHERE home.dcode <> 72 AND home.wnccode = 10000 "
+				+ "AND home.websiteid = :websiteid AND home.navigationid = :parentNid "
+				+ "AND home.idcard = :homeIdcard AND wt.config = :templateConfig";
+		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+		sqlCmd.setString("websiteid", websiteid).setString("parentNid", parentNid)
+				.setString("homeIdcard", COLLEGE_HOME_GROUP_IDCARD)
+				.setString("templateConfig", COLLEGE_RED_TEMPLATE_CONFIG);
+		Map<String, Object> result = gdba.selectAsMap(sqlCmd);
+		return result != null && getLongValue(result.get("count")) != null && getLongValue(result.get("count")) > 0;
+	}
+
+	private List<Map<String, Object>> getCollegeRedHomeChildNavigation(GeneralDBAccess gdba, Long websiteid,
+			Long parentNid) throws Exception {
+		String sql = "SELECT navigationid, idcard FROM website_navigation "
+				+ "WHERE dcode <> 72 AND wnccode = 10000 AND websiteid = :websiteid AND parent_nid = :parentNid "
+				+ "ORDER BY sort_number ASC, create_time ASC, navigationid ASC";
+		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+		sqlCmd.setString("websiteid", websiteid).setString("parentNid", parentNid);
+		return gdba.selectAsMapList(sqlCmd);
+	}
+
+	private void updateNavigationSortNumber(GeneralDBAccess gdba, Long navigationId, Long sortNumber) throws Exception {
+		String sql = "UPDATE website_navigation SET sort_number = :sortNumber WHERE navigationid = :navigationId";
+		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+		sqlCmd.setString("sortNumber", sortNumber).setString("navigationId", navigationId);
+		gdba.modify(sqlCmd);
+	}
+
+	private Long getLongValue(Object value) {
+		if (value == null) {
+			return null;
+		}
+		try {
+			return Long.valueOf(value.toString());
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	private String getStringValue(Object value) {
+		return value == null ? "" : value.toString();
+	}
+
 }

+ 30 - 19
src/space/apps/moudules/website/template/ffkjcollegered1/WebSiteArticleService.java

@@ -66,8 +66,6 @@ public class WebSiteArticleService extends BaseTransaction {
 		setNavView(gdba, website, "collegeNewsNmv", "FFKJ_COLLEGE_NEWS", 5, false);
 		setNavView(gdba, website, "collegeNoticeNmv", "FFKJ_COLLEGE_NOTICE", 4, false);
 		setNavView(gdba, website, "collegeMajorNmv", "FFKJ_COLLEGE_MAJOR", 4, true);
-		setNavView(gdba, website, "collegeIntroNmv", "FFKJ_COLLEGE_MAJOR_NAV", 5, false);
-		setNavView(gdba, website, "collegeFeatureNmv", "FFKJ_COLLEGE_FEATURE", 5, true);
 		setHomeSectionRows(gdba, website);
 
 		return DEFAULT_FORWARD;
@@ -227,17 +225,18 @@ public class WebSiteArticleService extends BaseTransaction {
 	private void setHomeSectionRows(GeneralDBAccess gdba, Website website) throws Exception {
 		List<NavigationMiniView> sectionList = new ArrayList<NavigationMiniView>();
 
-		addSectionByIDCard(gdba, website, sectionList, "FFKJ_COLLEGE_MAJOR_NAV");
-		addSectionByIDCard(gdba, website, sectionList, "FFKJ_COLLEGE_FEATURE");
-
 		List<Map<String, Object>> homeChildNavList = getHomeChildNavigation(gdba, website);
 		if (homeChildNavList != null) {
-			for (Map<String, Object> navMap : homeChildNavList) {
+			for (Map<String, Object> navMap : getHomeSectionNavigationList(homeChildNavList)) {
 				if (!isDynamicHomeSection(navMap)) {
 					continue;
 				}
 				try {
-					sectionList.add(buildNavigationMiniView(gdba, navMap, 5));
+					NavigationMiniView section = buildNavigationMiniView(gdba, navMap, 5);
+					if (section.getArticleList() == null || section.getArticleList().isEmpty()) {
+						continue;
+					}
+					sectionList.add(section);
 				} catch (Exception e) {
 					// 单个自定义栏目数据异常时跳过,避免影响首页其他栏目。
 				}
@@ -247,17 +246,31 @@ public class WebSiteArticleService extends BaseTransaction {
 		setRequestAttribute("collegeHomeSectionRows", groupSections(sectionList, 2));
 	}
 
-	private void addSectionByIDCard(GeneralDBAccess gdba, Website website, List<NavigationMiniView> sectionList,
-			String idcard) throws Exception {
-		try {
-			Map<String, Object> navMap = WebsiteTemplateNavUtil.getNavigationByIDCardAsMap(gdba, website, idcard);
-			if (navMap == null || navMap.get("navigationid") == null) {
-				return;
+	private List<Map<String, Object>> getHomeSectionNavigationList(List<Map<String, Object>> homeChildNavList) {
+		List<Map<String, Object>> sectionNavList = new ArrayList<Map<String, Object>>();
+		boolean topBoundaryFound = false;
+
+		for (Map<String, Object> navMap : homeChildNavList) {
+			if (hasIDCard(navMap, UTILITY_LINK_NAV_IDCARD)) {
+				topBoundaryFound = true;
+				continue;
 			}
-			sectionList.add(buildNavigationMiniView(gdba, navMap, 5));
-		} catch (Exception e) {
-			// 示例栏目缺失时跳过,避免影响后台自定义栏目继续展示。
+			if (hasIDCard(navMap, FOOTER_LINK_NAV_IDCARD)) {
+				continue;
+			}
+			if (topBoundaryFound) {
+				sectionNavList.add(navMap);
+			}
+		}
+
+		if (topBoundaryFound) {
+			return sectionNavList;
 		}
+		return homeChildNavList;
+	}
+
+	private boolean hasIDCard(Map<String, Object> navMap, String idcard) {
+		return navMap != null && navMap.get("idcard") != null && idcard.equals(navMap.get("idcard").toString());
 	}
 
 	private List<Map<String, Object>> getHomeChildNavigation(GeneralDBAccess gdba, Website website) throws Exception {
@@ -275,9 +288,7 @@ public class WebSiteArticleService extends BaseTransaction {
 			return false;
 		}
 		String idcard = navMap.get("idcard").toString();
-		if ("FFKJ_COLLEGE_HOME_HERO".equals(idcard) || "FFKJ_COLLEGE_NEWS".equals(idcard)
-				|| "FFKJ_COLLEGE_MAJOR".equals(idcard) || "FFKJ_COLLEGE_FEATURE".equals(idcard)
-				|| UTILITY_LINK_NAV_IDCARD.equals(idcard) || FOOTER_LINK_NAV_IDCARD.equals(idcard)) {
+		if (!idcard.startsWith("diy_")) {
 			return false;
 		}
 		return navigationType.LIST.getCode().toString().equals(navMap.get("wntcode").toString());