吸收数字员工管理端产物生命周期预览

This commit is contained in:
baiyanyun
2026-06-13 13:42:50 +08:00
parent 1daf58a94c
commit b0f0b95c2a
3 changed files with 158 additions and 1 deletions

View File

@@ -532,6 +532,78 @@ class DigitalEmployeeSyncApplicationServiceImplTest {
assertThat(result.getRecords().get(2).getNotificationId()).isEqualTo("notification-preference");
}
@Test
void queryAdminWorkbenchArtifactLifecycleReturnsArtifactRowsOnly() {
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-artifact", "artifact", "artifact-1", 101L, new Date(10_000),
Map.of(
"entity_type", "artifact",
"title", "日报 PDF",
"status", "available",
"artifact_id", "artifact-1",
"retention_status", "expired",
"cleanup_status", "pending",
"summary", "等待清理"
),
Map.of("id", "artifact-1", "status", "available")),
record("outbox-artifact-retention", "event", "event-artifact-1", 101L, new Date(11_000),
Map.of(
"entity_type", "event",
"category", "artifact_lifecycle",
"kind", "artifact_retention_marked",
"status", "recorded",
"title", "产物标记到期",
"artifact_id", "artifact-2",
"retention_status", "expired"
),
Map.of("id", "event-artifact-1", "kind", "artifact_retention_marked")),
record("outbox-artifact-cleanup", "event", "event-artifact-2", 101L, new Date(12_000),
Map.of(
"entity_type", "event",
"kind", "artifact_cleanup_executed",
"status", "deleted",
"title", "产物文件已清理",
"artifact_id", "artifact-3",
"cleanup_status", "deleted",
"deleted_at", "2026-06-13T00:00:00+08:00"
),
Map.of("id", "event-artifact-2", "kind", "artifact_cleanup_executed")),
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-notification", "notification", "notification-1", 101L, new Date(15_000),
Map.of("entity_type", "notification", "title", "普通通知", "status", "unread"),
Map.of("id", "notification-1", "status", "unread")),
record("outbox-route", "event", "event-route-1", 101L, new Date(16_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(17_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(
"artifact_lifecycle", 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("artifact-1", "event-artifact-1", "event-artifact-2");
assertThat(result.getRecords().get(0).getView()).isEqualTo("artifact_lifecycle");
assertThat(result.getRecords().get(0).getArtifactId()).isEqualTo("artifact-1");
assertThat(result.getRecords().get(0).getCategory()).isEqualTo("artifact_lifecycle");
assertThat(result.getRecords().get(0).getStatus()).isEqualTo("available");
assertThat(result.getRecords().get(0).getSummary()).isEqualTo("等待清理");
assertThat(result.getRecords().get(0).getBusinessView()).containsEntry("retention_status", "expired");
assertThat(result.getRecords().get(1).getArtifactId()).isEqualTo("artifact-2");
assertThat(result.getRecords().get(2).getBusinessView()).containsEntry("cleanup_status", "deleted");
assertThat(result.getRecords().get(2).getBusinessView()).containsEntry("deleted_at", "2026-06-13T00:00:00+08:00");
}
@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)))