吸收数字员工管理端通知运营预览

This commit is contained in:
baiyanyun
2026-06-13 00:03:42 +08:00
parent 479e2e209d
commit 1daf58a94c
3 changed files with 151 additions and 2 deletions

View File

@@ -468,6 +468,70 @@ class DigitalEmployeeSyncApplicationServiceImplTest {
assertThat(result.getRecords().get(2).getRouteDecisionId()).isEqualTo("route-3");
}
@Test
void queryAdminWorkbenchNotificationsReturnsNotificationRowsOnly() {
when(repository.queryBusinessRecords(eq(101L), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null), eq(1L), eq(20L)))
.thenReturn(page(List.of(
record("outbox-notification", "notification", "notification-1", 101L, new Date(10_000),
Map.of(
"entity_type", "notification",
"category", "notification",
"kind", "notification_received",
"status", "unread",
"title", "通知未读",
"notification_id", "notification-1",
"summary", "等待处理"
),
Map.of("id", "notification-1", "kind", "notification_received")),
record("outbox-action-notification", "event", "event-notification-1", 101L, new Date(11_000),
Map.of(
"entity_type", "event",
"category", "action_notification",
"kind", "digital_workday_notification_reply",
"status", "recorded",
"title", "通知回复已记录",
"notification_id", "notification-2"
),
Map.of("id", "event-notification-1", "kind", "digital_workday_notification_reply")),
record("outbox-preference", "event", "event-notification-2", 101L, new Date(12_000),
Map.of(
"entity_type", "event",
"kind", "notification_preference_updated",
"status", "recorded",
"title", "通知订阅偏好更新",
"notification_id", "notification-preference"
),
Map.of("id", "event-notification-2", "kind", "notification_preference_updated")),
record("outbox-task", "task", "task-1", 101L, new Date(13_000),
Map.of("entity_type", "task", "title", "普通任务", "status", "running"),
Map.of("id", "task-1", "status", "running")),
record("outbox-approval", "approval", "approval-1", 101L, new Date(14_000),
Map.of("entity_type", "approval", "title", "普通审批", "status", "pending"),
Map.of("id", "approval-1", "status", "pending")),
record("outbox-route", "event", "event-route-1", 101L, new Date(15_000),
Map.of("entity_type", "event", "category", "route_governance", "title", "路由", "status", "blocked"),
Map.of("id", "event-route-1", "status", "blocked")),
record("outbox-audit", "event", "event-audit-1", 101L, new Date(16_000),
Map.of("entity_type", "event", "category", "tool_call_audit", "title", "审计", "status", "warn"),
Map.of("id", "event-audit-1", "status", "warn"))
)));
DigitalEmployeeAdminWorkbenchPageDto result = service.queryAdminWorkbench(
"notifications", null, null, null, null, null, null, null, null, null, null, null, 1L, 20L
);
assertThat(result.getTotal()).isEqualTo(3);
assertThat(result.getRecords()).extracting(DigitalEmployeeAdminWorkbenchRowDto::getEntityId)
.containsExactly("notification-1", "event-notification-1", "event-notification-2");
assertThat(result.getRecords().get(0).getView()).isEqualTo("notifications");
assertThat(result.getRecords().get(0).getNotificationId()).isEqualTo("notification-1");
assertThat(result.getRecords().get(0).getCategory()).isEqualTo("notification");
assertThat(result.getRecords().get(0).getStatus()).isEqualTo("unread");
assertThat(result.getRecords().get(0).getSummary()).isEqualTo("等待处理");
assertThat(result.getRecords().get(1).getCategory()).isEqualTo("action_notification");
assertThat(result.getRecords().get(2).getNotificationId()).isEqualTo("notification-preference");
}
@Test
void queryAdminWorkbenchAuditsRedactsSensitivePayloadFields() {
when(repository.queryBusinessRecords(eq(101L), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null), eq(null), eq(1L), eq(20L)))