From 86d78160fd04aa672c677162a95abb7183c596f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Wed, 21 Oct 2026 13:33:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=80=9A=E7=9F=A5):=20=E5=9B=9B=E7=BA=A7?= =?UTF-8?q?=E4=B8=A5=E9=87=8D=E5=BA=A6=E4=B8=8E=E4=B8=A5=E9=87=8D=E5=BA=A6?= =?UTF-8?q?/=E6=97=B6=E9=97=B4=E5=8F=8C=E6=8E=92=E5=BA=8F=EF=BC=8C?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B8=8E=E5=90=8E=E5=8F=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通知表新增 severity(紧急/高危/中危/低危,V161),由 scene + level 推导且 不回改 level:老客户端配色不受影响,secret_balance 的余量偏低与欠费也能分档。 列表与聚合接口默认按严重度倒序(同档按时间倒序),sort=time 切纯时间排序; 聚合组取组内最高严重度。两端铃铛加彩色等级标签与排序切换,展开明细沿用 同一排序,严重度排序下隐藏会跨天误导的日期头。 --- admin-frontend-vue/src/api/notifications.ts | 20 +++ .../src/components/NotificationBell.vue | 99 ++++++++++++- .../src/layout/notification-bell-panel.ts | 43 +++++- .../notification-bell-failure.mount.test.ts | 44 ++++++ .../pure/notification-bell-panel.test.ts | 19 +++ .../AdminNotificationController.java | 21 ++- .../controller/NotificationController.java | 21 ++- .../model/dto/NotificationPageQuery.java | 2 + .../model/entity/UserNotificationEntity.java | 2 + .../model/vo/NotificationGroupVo.java | 2 + .../model/vo/NotificationItemVo.java | 4 +- .../service/NotificationService.java | 139 +++++++++++++++--- .../db/V161__notification_severity.sql | 68 +++++++++ .../AdminNotificationControllerTest.java | 8 +- .../NotificationControllerTest.java | 3 +- .../service/NotificationGroupTest.java | 27 ++++ .../service/NotificationServiceTest.java | 91 ++++++++++++ .../shared/api/types/modules/notification.ts | 26 ++++ .../shared/components/NotificationBell.vue | 94 +++++++++++- .../composables/useNotificationBellPanel.ts | 42 +++++- .../notification-bell-failure.mount.test.ts | 44 ++++++ frontend-vue/tests/notification-bell.test.ts | 6 + .../pure/notification-bell-panel.test.ts | 19 +++ 23 files changed, 804 insertions(+), 40 deletions(-) create mode 100644 backend-java/src/main/resources/db/V161__notification_severity.sql diff --git a/admin-frontend-vue/src/api/notifications.ts b/admin-frontend-vue/src/api/notifications.ts index fe00b1d0d..6b52333ba 100644 --- a/admin-frontend-vue/src/api/notifications.ts +++ b/admin-frontend-vue/src/api/notifications.ts @@ -1,11 +1,25 @@ import { http } from './http' import { unwrap } from './envelope' +/** 业务严重度:紧急 / 高危 / 中危 / 低危(后端按 scene + level 推导)。 */ +export type AdminNotificationSeverity = 'urgent' | 'high' | 'medium' | 'low' + +export type AdminNotificationSortMode = 'severity' | 'time' + +export const ADMIN_NOTIFICATION_SEVERITY_LABELS: Readonly> = { + urgent: '紧急', + high: '高危', + medium: '中危', + low: '低危', +} + /** 单条通知(后台铃铛)。 */ export interface AdminNotificationItem { id: number scene: string level: string + /** 业务严重度;旧后端不返回时前端按 level 兜底。 */ + severity?: string title: string content: string read: boolean @@ -38,6 +52,8 @@ export interface AdminNotificationGroup { rowCount: number unreadCount: number level: string + /** 组内最高严重度。 */ + severity?: string title: string content: string createdAt: string | null @@ -69,6 +85,8 @@ export interface AdminNotificationListParams { keyword?: string startDate?: string endDate?: string + /** 排序:severity(默认)或 time;默认值不下发。 */ + sort?: AdminNotificationSortMode /** 展开聚合组:三个条件取自该组自己返回的值,原样回传。 */ scene?: string day?: string @@ -90,6 +108,7 @@ export async function fetchNotificationGroups( keyword: keyword || undefined, startDate: params.startDate || undefined, endDate: params.endDate || undefined, + sort: params.sort === 'time' ? 'time' : undefined, }, }) return unwrap(data) @@ -107,6 +126,7 @@ export async function fetchNotificationList( keyword: keyword || undefined, startDate: params.startDate || undefined, endDate: params.endDate || undefined, + sort: params.sort === 'time' ? 'time' : undefined, scene: params.scene || undefined, day: params.day || undefined, subjectUserId: params.subjectUserId ?? undefined, diff --git a/admin-frontend-vue/src/components/NotificationBell.vue b/admin-frontend-vue/src/components/NotificationBell.vue index 81ff636da..b9f9ac1e9 100644 --- a/admin-frontend-vue/src/components/NotificationBell.vue +++ b/admin-frontend-vue/src/components/NotificationBell.vue @@ -75,6 +75,25 @@ 重置 +
+ 排序 + + +
正在加载...
@@ -82,13 +101,17 @@
{{ hasFilter ? '没有符合条件的通知' : '暂无通知' }}