feat(svcitem): 事项库+办事大厅 R2 后端落地,并完成交付后独立审计修复
build / build-push (push) Successful in 2m26s

落地(依据《事项库与办事大厅详细设计 v1》)
- 事项域垂直包 com.yunhai.cms.svcitem.*(entity/enums/repository/service+impl/event/config/model dto+query+vo)
  与 controller/{api,oapi}/svcitem;两表 DDL 进 cms_init.sql(表 7/8)+ upgrade_svcitem_r2.sql
- SvcItemQuery 接缝:门户 8 方法 + 管理端 11 方法统一收口,控制器不再注入实现类
- 门户公开层:doServiceList/doGuide 双路由变体 + M0 可选模板整页回退
  (视图名/themeBase/buildUrl/资产主题段四处同源 effectiveTheme,缺模板整包退 default)
- oapi 跨服务快照:与平台 AppAuthFilter 同口径签名(canonical=method\npath?sortedQuery\ntimestamp,
  HmacSHA256/Base64, 5min 窗口)+ /oapi/* 强制验签过滤器
- default 皮肤 service.html/guide.html + main.css 服务中心/指南页样式段

审计修复(发现与处置全表见 docs/18-事项库审计与修复记录.md)
- D1 附件引用链:内容资产(封面+正文内嵌图)独立场景 svc_item_asset,保存时按内容派生全量同步归属
  (AttachmentService.localAssetUrls/localWebUrl/syncAssets:集合内标记、集合外解除)。
  修复根因:upload 带 scene 时只写 ref_type 不写 ref_id,而保存仅按前端提交 id 重绑,
  正文图与封面停在半绑定态 → 既不在孤儿口径内也不受 release 管辖,成永久无主行
- D5 归属校验:绑定前做可认领判定(无引用/半绑定/已属本事项方可绑),他事项引用与跨站附件跳过并告警
- D2 部门:组类型改配置 cms.svc.item.dept-group-type(默认 2=学校组,校内科室改 3);
  deptTree 返回嵌套组树;新增 SvcDeptSource 接缝使静态 getGroupTree 可替身(此前部门链零覆盖)
- D4 缓存:事件 scope 语义化,dict/dept 变更整体失效 cms:svcItem(展示名快照不再滞后 5min)
- 站点解析:findByCode 在 uk(parent_site_id,code) 下命中多条会抛异常变 500,
  4 处生产调用点改 findFirstByCodeOrderByIdAsc(确定性取最早站点)
- 加固:新增 idx_svc_item_portal(含 DESC 列)对症门户排序 filesort;升级脚本改 information_schema
  +PREPARE 幂等索引守卫块(表在缺索引可重跑修复);clear_cms_data.sql 补事项两表;
  view_count 改有界队列+拒绝丢弃告警;SEL_LIST_MAX 截断告警

测试
- 新增 SvcDeptChainIT 7、SvcItemServiceIT 16(含 D1/D5 回归锚点与全方法权限)、
  SvcItemOapiIT 9(时间戳超窗/未知 appKey/畸形头/siteCode 歧义)、SvcItemPortalIT 11
  (嵌套指南路由/关键词/canonical/浏览量异步)、SvcDictServiceIT 8(改名后缓存即时刷新)
- ThemeContractIT 补"缺可选模板主题资产段必退 default"断言并订正七路由表述
- 全量 mvn -o test:388 测试 0 失败;升级脚本 bsch_cms_test 两跑幂等(含缺索引自动补建)
This commit is contained in:
chenxing
2026-09-11 14:12:04 +08:00
parent 39454e4efb
commit 9e28092a8b
61 changed files with 5537 additions and 23 deletions
@@ -994,3 +994,253 @@ time, .item-meta { color: var(--text-muted); font-size: var(--fs-sm); }
.side-nav { display: none; }
.page-cols { display: block; }
}
/* ===== 服务中心 / 事项指南(事项库 L2,docs/10 §3.4 契约的消费端样式)===== */
.svc-page, .svc-guide { display: block; }
/* 筛选区:三组 chip(对象/类别/部门),active 态标记当前勾选,URL 由后端预生成 */
.svc-filters {
margin: var(--sp-4) 0 var(--sp-3);
padding: var(--sp-3) var(--sp-4);
background: var(--surface-variant);
border-radius: var(--r-md);
}
.svc-filter-group {
display: flex;
align-items: flex-start;
gap: var(--sp-3);
padding: var(--sp-2) 0;
}
.svc-filter-group + .svc-filter-group { border-top: 1px dashed var(--border-strong); }
.svc-filter-label {
flex: none;
width: 4.5em;
padding-top: var(--sp-1);
color: var(--text-light);
font-size: var(--fs-sm);
font-weight: 600;
}
.svc-filter-options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.svc-chip {
display: inline-flex;
align-items: center;
gap: var(--sp-1);
padding: 2px var(--sp-3);
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: 999px;
font-size: var(--fs-sm);
color: var(--text);
transition: border-color .15s ease, color .15s ease;
}
.svc-chip:hover { border-color: var(--primary); color: var(--primary); }
.svc-chip em { font-style: normal; color: var(--text-muted); font-size: var(--fs-xs); }
.svc-chip.active {
background: var(--primary);
border-color: var(--primary);
color: var(--on-dark);
}
.svc-chip.active em { color: var(--on-dark-muted); }
/* 工具条:关键词搜索 + 清除筛选 */
.svc-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-3);
margin-bottom: var(--sp-4);
}
.svc-search { display: flex; }
.svc-search input {
width: 260px;
padding: 7px var(--sp-3);
border: 1px solid var(--border-strong);
border-right: none;
border-radius: var(--r-sm) 0 0 var(--r-sm);
font-size: var(--fs-base);
font-family: inherit;
}
.svc-search input:focus { outline: none; border-color: var(--primary); }
.svc-search button {
padding: 7px var(--sp-4);
border: none;
border-radius: 0 var(--r-sm) var(--r-sm) 0;
background: var(--primary);
color: var(--on-dark);
cursor: pointer;
font-size: var(--fs-base);
}
.svc-search button:hover { background: var(--primary-dark); }
.svc-clear { font-size: var(--fs-sm); color: var(--text-muted); }
.svc-clear:hover { color: var(--primary); }
/* 事项列表:卡片行(有封面出图,无封面纯文字,与文章列表同哲学不造占位图) */
.svc-list { list-style: none; }
.svc-list li { border-bottom: 1px solid var(--border); }
.svc-list li:last-child { border-bottom: none; }
.svc-item {
display: flex;
gap: var(--sp-4);
padding: var(--sp-4) var(--sp-2);
}
.svc-list li:hover { background: var(--surface-variant); }
.svc-item-cover {
flex: none;
width: 96px;
height: 64px;
border-radius: var(--r-sm);
overflow: hidden;
border: 1px solid var(--border);
background: var(--surface-variant);
}
.svc-item-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.svc-item-body { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.svc-item-title { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.svc-item-name { font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.svc-item:hover .svc-item-name { color: var(--primary); }
.svc-tag {
flex: none;
padding: 1px var(--sp-2);
border-radius: var(--r-sm);
background: var(--surface-variant);
border: 1px solid var(--border);
color: var(--text-light);
font-size: var(--fs-xs);
line-height: 1.6;
}
.svc-tag.online {
background: var(--primary);
border-color: var(--primary);
color: var(--on-dark);
}
.svc-item-summary {
color: var(--text-light);
font-size: var(--fs-base);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.svc-item-meta { display: flex; gap: var(--sp-4); color: var(--text-muted); font-size: var(--fs-sm); }
/* 指南页 */
.svc-guide-body { display: block; }
.svc-apply {
display: flex;
align-items: center;
gap: var(--sp-3);
margin: var(--sp-4) 0;
}
.svc-apply-btn {
display: inline-block;
padding: var(--sp-2) var(--sp-8);
border-radius: var(--r-md);
background: var(--primary);
color: var(--on-dark);
font-size: var(--fs-lg);
font-weight: 600;
}
.svc-apply-btn:hover { background: var(--primary-dark); color: var(--on-dark); }
.svc-apply-hint { color: var(--text-muted); font-size: var(--fs-sm); }
.svc-summary {
padding: var(--sp-3) var(--sp-4);
background: var(--surface-variant);
border-left: 3px solid var(--primary);
border-radius: 0 var(--r-sm) var(--r-sm) 0;
color: var(--text-light);
}
.svc-info {
width: 100%;
margin: var(--sp-4) 0;
border-collapse: collapse;
font-size: var(--fs-base);
}
.svc-info th, .svc-info td {
border: 1px solid var(--border);
padding: var(--sp-2) var(--sp-4);
text-align: left;
vertical-align: top;
}
.svc-info th {
width: 7em;
background: var(--surface-variant);
color: var(--text-light);
font-weight: 600;
white-space: nowrap;
}
.svc-section { margin: var(--sp-6) 0; }
.svc-section h2 {
font-size: var(--fs-xl);
padding-bottom: var(--sp-2);
border-bottom: 2px solid var(--primary);
margin-bottom: var(--sp-3);
}
.svc-attachments ul { list-style: none; }
.svc-attachments li {
display: flex;
align-items: center;
gap: var(--sp-3);
padding: var(--sp-2) 0;
border-bottom: 1px dashed var(--border);
}
.svc-attachments li:last-child { border-bottom: none; }
.svc-attachments a { color: var(--primary); }
.svc-attachments a:hover { text-decoration: underline; }
.svc-att-size { color: var(--text-muted); font-size: var(--fs-sm); }
.svc-links {
display: flex;
gap: var(--sp-3);
margin: var(--sp-6) 0 0;
padding-top: var(--sp-4);
border-top: 1px dashed var(--border-strong);
}
.svc-links a {
padding: var(--sp-1) var(--sp-4);
border: 1px solid var(--border-strong);
border-radius: var(--r-sm);
font-size: var(--fs-sm);
color: var(--text-light);
}
.svc-links a:hover { border-color: var(--primary); color: var(--primary); }
/* 相关服务侧区 */
.svc-related { margin-top: var(--sp-8); }
.svc-related-list { list-style: none; margin-top: var(--sp-3); }
.svc-related-list li { border-bottom: 1px solid var(--border); }
.svc-related-list li:last-child { border-bottom: none; }
.svc-related-list a {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--sp-3);
padding: var(--sp-3) var(--sp-2);
}
.svc-related-list li:hover { background: var(--surface-variant); }
.svc-related-name {
font-size: var(--fs-md);
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.svc-related-list a:hover .svc-related-name { color: var(--primary); }
.svc-related-meta { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.svc-related-meta > span:not(.svc-tag) { color: var(--text-muted); font-size: var(--fs-sm); }
/* 窄屏适配(契约 §4.7) */
@media (max-width: 768px) {
.svc-toolbar { flex-direction: column; align-items: stretch; }
.svc-search input { width: auto; flex: 1; }
.svc-filter-group { flex-direction: column; gap: var(--sp-1); }
.svc-filter-label { width: auto; padding-top: 0; }
.svc-item { flex-direction: column; gap: var(--sp-2); }
.svc-item-cover { width: 100%; height: 120px; }
.svc-info th { width: 5.5em; }
.svc-related-list a { flex-direction: column; align-items: flex-start; }
}
/* 打印:按钮/筛选不参与打印 */
@media print {
.svc-apply, .svc-filters, .svc-toolbar, .svc-related { display: none; }
}
@@ -0,0 +1,126 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="~{${themeBase} + '/fragments/head' :: head}"></head>
<body>
<header th:replace="~{${themeBase} + '/fragments/header' :: header}"></header>
<!-- 事项指南页(事项库 §6.2 契约):item / attachments[] / relatedItems[] /
faqCategoryUrl·noticeCategoryUrl·ruleCategoryUrl(可空)/ applyUrl(可空,空则不渲染"我要办理")。
三个富文本字段已在保存期过 jsoup 白名单、渲染期补 URL 基准,此处允许 utext -->
<main class="detail-main container" id="main-content">
<div class="page-card svc-guide">
<nav class="breadcrumb" aria-label="面包屑">
<a th:href="${url.home()}">首页</a>
<span class="crumb-sep" aria-hidden="true">/</span>
<a th:href="${url.serviceList()}">服务中心</a>
<span class="crumb-sep" aria-hidden="true">/</span>
<span class="current" th:text="${item.title}">事项名称</span>
</nav>
<article class="svc-guide-body">
<h1 class="article-title" th:text="${item.title}">事项名称</h1>
<div class="article-meta">
<span th:if="${!#strings.isEmpty(item.deptName)}"
th:text="${'办理部门:' + item.deptName}">办理部门</span>
<span th:text="${item.handleMode == 1 ? '线上办理' : (item.handleMode == 2 ? '线下办理' : '线上线下均可办理')}">办理方式</span>
<time th:if="${item.publishTime != null}"
th:text="${'发布时间:' + #temporals.format(item.publishTime, 'yyyy-MM-dd')}">2026-01-01</time>
<span th:text="${'浏览量:' + item.viewCount}">浏览量</span>
</div>
<!-- 我要办理:三态(手填外链 > svc_hall_base 生成 > 不渲染),按钮外链新窗口打开 -->
<div class="svc-apply" th:if="${applyUrl != null}">
<a class="svc-apply-btn" th:href="${applyUrl}" target="_blank" rel="noopener">我要办理</a>
<span class="svc-apply-hint">进入服务大厅在线办理</span>
</div>
<p class="svc-summary" th:if="${!#strings.isEmpty(item.summary)}" th:text="${item.summary}">简介</p>
<table class="svc-info">
<caption class="skip-link">事项基本信息</caption>
<tbody>
<tr th:if="${!#strings.isEmpty(item.objectName)}">
<th scope="row">服务对象</th>
<td th:text="${item.objectName}">服务对象</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.categoryName)}">
<th scope="row">事项类别</th>
<td th:text="${item.categoryName}">事项类别</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.handlePlace)}">
<th scope="row">办理地点</th>
<td th:text="${item.handlePlace}">办理地点</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.handleTimeLimit)}">
<th scope="row">办理时限</th>
<td th:text="${item.handleTimeLimit}">办理时限</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.promiseTimeLimit)}">
<th scope="row">承诺时限</th>
<td th:text="${item.promiseTimeLimit}">承诺时限</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.contactPhone)}">
<th scope="row">咨询电话</th>
<td th:text="${item.contactPhone}">咨询电话</td>
</tr>
<tr th:if="${!#strings.isEmpty(item.supervisePhone)}">
<th scope="row">监督投诉</th>
<td th:text="${item.supervisePhone}">监督投诉电话</td>
</tr>
</tbody>
</table>
<section class="svc-section" th:if="${!#strings.isEmpty(item.processHtml)}">
<h2>办理流程</h2>
<div class="article-content" th:utext="${item.processHtml}">办理流程</div>
</section>
<section class="svc-section" th:if="${!#strings.isEmpty(item.materialHtml)}">
<h2>所需材料</h2>
<div class="article-content" th:utext="${item.materialHtml}">所需材料</div>
</section>
<section class="svc-section" th:if="${!#strings.isEmpty(item.noticeHtml)}">
<h2>注意事项</h2>
<div class="article-content" th:utext="${item.noticeHtml}">注意事项</div>
</section>
<section class="svc-section svc-attachments" th:if="${!#lists.isEmpty(attachments)}">
<h2>相关材料下载</h2>
<ul>
<li th:each="att : ${attachments}">
<a th:href="${url.upload(att.webUrl)}" th:download
th:text="${att.fileName}">材料文件</a>
<span class="svc-att-size" th:if="${att.fileSize != null}"
th:text="${#numbers.formatDecimal(att.fileSize / 1024.0, 1, 1) + ' KB'}">12.3 KB</span>
</li>
</ul>
</section>
<nav class="svc-links" th:if="${faqCategoryUrl != null or noticeCategoryUrl != null or ruleCategoryUrl != null}">
<a th:if="${faqCategoryUrl != null}" th:href="${faqCategoryUrl}">常见问题</a>
<a th:if="${noticeCategoryUrl != null}" th:href="${noticeCategoryUrl}">公告信息</a>
<a th:if="${ruleCategoryUrl != null}" th:href="${ruleCategoryUrl}">文件规定</a>
</nav>
</article>
<aside class="svc-related" th:if="${!#lists.isEmpty(relatedItems)}">
<h2 class="section-title">相关服务</h2>
<ul class="svc-related-list">
<li th:each="rel : ${relatedItems}">
<a th:href="${rel.url}">
<span class="svc-related-name" th:text="${rel.title}">相关事项</span>
<span class="svc-related-meta">
<span th:if="${!#strings.isEmpty(rel.deptName)}" th:text="${rel.deptName}">部门</span>
<span class="svc-tag"
th:text="${rel.handleMode == 1 ? '线上' : (rel.handleMode == 2 ? '线下' : '线上线下')}">方式</span>
</span>
</a>
</li>
</ul>
</aside>
</div>
</main>
<footer th:replace="~{${themeBase} + '/fragments/footer' :: footer}"></footer>
<script th:src="${url.asset('js/main.js')}"></script>
</body>
</html>
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head th:replace="~{${themeBase} + '/fragments/head' :: head}"></head>
<body>
<header th:replace="~{${themeBase} + '/fragments/header' :: header}"></header>
<!-- 服务中心(事项库 §6.1 契约):serviceList / serviceFilters / activeFilters / q;
筛选与分页 URL 全部后端预生成(facets[].url / pageUrls[].url),模板禁止手拼 query -->
<main class="list-main container" id="main-content">
<div class="page-card svc-page">
<nav class="breadcrumb" aria-label="面包屑">
<a th:href="${url.home()}">首页</a>
<span class="crumb-sep" aria-hidden="true">/</span>
<span class="current">服务中心</span>
</nav>
<h1 class="page-title">服务中心</h1>
<div class="svc-filters"
th:if="${!#lists.isEmpty(serviceFilters.objects) or !#lists.isEmpty(serviceFilters.categories) or !#lists.isEmpty(serviceFilters.depts)}">
<div class="svc-filter-group" th:if="${!#lists.isEmpty(serviceFilters.objects)}">
<span class="svc-filter-label">服务对象</span>
<div class="svc-filter-options">
<a class="svc-chip" th:each="opt : ${serviceFilters.objects}"
th:classappend="${opt.active} ? 'active'" th:href="${opt.url}">
<span th:text="${opt.name}">对象</span><em th:text="${opt.count}">0</em>
</a>
</div>
</div>
<div class="svc-filter-group" th:if="${!#lists.isEmpty(serviceFilters.categories)}">
<span class="svc-filter-label">事项类别</span>
<div class="svc-filter-options">
<a class="svc-chip" th:each="opt : ${serviceFilters.categories}"
th:classappend="${opt.active} ? 'active'" th:href="${opt.url}">
<span th:text="${opt.name}">类别</span><em th:text="${opt.count}">0</em>
</a>
</div>
</div>
<div class="svc-filter-group" th:if="${!#lists.isEmpty(serviceFilters.depts)}">
<span class="svc-filter-label">服务部门</span>
<div class="svc-filter-options">
<a class="svc-chip" th:each="opt : ${serviceFilters.depts}"
th:classappend="${opt.active} ? 'active'" th:href="${opt.url}">
<span th:text="${opt.name}">部门</span><em th:text="${opt.count}">0</em>
</a>
</div>
</div>
</div>
<div class="svc-toolbar">
<form class="svc-search" th:action="${url.serviceList()}" method="get" role="search">
<input type="search" name="q" th:value="${q}" placeholder="搜索事项名称 / 简介" maxlength="64">
<button type="submit">搜索</button>
</form>
<a class="svc-clear" th:if="${activeFilters.hasAny}" th:href="${activeFilters.clearUrl}">清除筛选</a>
</div>
<ul class="svc-list">
<li th:each="it : ${serviceList.items}">
<a class="svc-item" th:href="${url.serviceItem(it.id)}">
<span class="svc-item-cover" th:if="${it.coverImage != null}">
<img th:src="${url.upload(it.coverImage)}" th:alt="${it.title}">
</span>
<span class="svc-item-body">
<span class="svc-item-title">
<span class="svc-item-name" th:text="${it.title}">事项名称</span>
<span class="svc-tag online" th:if="${it.onlineFlag == 1}">可在线办理</span>
<span class="svc-tag"
th:text="${it.handleMode == 1 ? '线上办理' : (it.handleMode == 2 ? '线下办理' : '线上线下')}">办理方式</span>
</span>
<span class="svc-item-summary" th:if="${!#strings.isEmpty(it.summary)}"
th:text="${it.summary}">简介</span>
<span class="svc-item-meta">
<span th:if="${!#strings.isEmpty(it.deptName)}" th:text="${it.deptName}">部门</span>
<span th:if="${!#strings.isEmpty(it.categoryName)}" th:text="${it.categoryName}">类别</span>
<time th:if="${it.publishTime != null}"
th:text="${#temporals.format(it.publishTime, 'yyyy-MM-dd')}">2026-01-01</time>
</span>
</span>
</a>
</li>
</ul>
<div class="empty-state" th:if="${#lists.isEmpty(serviceList.items)}">
<p th:if="${activeFilters.hasAny}">未找到符合条件的服务事项</p>
<p th:if="${!activeFilters.hasAny}">服务中心暂未上架事项</p>
<p class="empty-hint" th:if="${activeFilters.hasAny}">换个筛选条件或关键词试试</p>
<p class="empty-hint" th:if="${!activeFilters.hasAny}">事项发布后将在此展示</p>
</div>
<!-- 分页:URL 由后端预生成(携带当前筛选,pageUrls[].active 标记当前页) -->
<nav class="pagination" th:if="${serviceList.totalPages > 1}" aria-label="分页">
<a th:each="p : ${serviceList.pageUrls}"
th:classappend="${p.active} ? 'active'"
th:href="${p.url}"
th:aria-label="${'第' + p.page + '页'}"
th:aria-current="${p.active} ? 'page'"
th:text="${p.page}">1</a>
</nav>
</div>
</main>
<footer th:replace="~{${themeBase} + '/fragments/footer' :: footer}"></footer>
<script th:src="${url.asset('js/main.js')}"></script>
</body>
</html>