吸收数字员工管理端日报运营预览

This commit is contained in:
baiyanyun
2026-06-13 14:00:53 +08:00
parent d86f82a4c5
commit d5025c0ebc
3 changed files with 155 additions and 1 deletions

View File

@@ -735,6 +735,74 @@ class DigitalEmployeeSyncApplicationServiceImplTest {
assertThat(row.getPayload()).containsEntry("tool_name", "shell");
}
@Test
void queryAdminWorkbenchDailyReportsReturnsDailyReportRowsOnly() {
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-daily-report", "daily_report", "report-1", 101L, new Date(10_000),
Map.of(
"entity_type", "daily_report",
"category", "daily_report",
"kind", "daily_report_generated",
"status", "generated",
"title", "6 13 日日报",
"report_id", "report-1",
"summary", "日报已生成",
"artifact_id", "artifact-report-1"
),
Map.of("id", "report-1", "kind", "daily_report_generated")),
record("outbox-daily-report-delivered", "event", "event-daily-report-1", 101L, new Date(11_000),
Map.of(
"entity_type", "event",
"category", "daily_report",
"kind", "daily_report_send_recorded",
"status", "delivered",
"title", "日报发送已记录",
"report_id", "report-2",
"delivery_status", "delivered"
),
Map.of("id", "event-daily-report-1", "kind", "daily_report_send_recorded")),
record("outbox-daily-report-confirmed", "event", "event-daily-report-2", 101L, new Date(12_000),
Map.of(
"entity_type", "event",
"kind", "daily_report_confirmed",
"status", "confirmed",
"title", "日报确认回执",
"report_id", "report-3",
"confirmed_at", "2026-06-13T10:00:00+08:00"
),
Map.of("id", "event-daily-report-2", "kind", "daily_report_confirmed")),
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-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(
"daily_reports", 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("report-1", "event-daily-report-1", "event-daily-report-2");
assertThat(result.getRecords().get(0).getView()).isEqualTo("daily_reports");
assertThat(result.getRecords().get(0).getReportId()).isEqualTo("report-1");
assertThat(result.getRecords().get(0).getCategory()).isEqualTo("daily_report");
assertThat(result.getRecords().get(0).getStatus()).isEqualTo("generated");
assertThat(result.getRecords().get(0).getSummary()).isEqualTo("日报已生成");
assertThat(result.getRecords().get(1).getReportId()).isEqualTo("report-2");
assertThat(result.getRecords().get(1).getBusinessView()).containsEntry("delivery_status", "delivered");
assertThat(result.getRecords().get(2).getBusinessView()).containsEntry("confirmed_at", "2026-06-13T10:00:00+08:00");
}
@Test
void createAdminActionRecordsLowRiskActionAsPending() {
DigitalEmployeeAdminActionRequestDto request = adminActionRequest("approval", "approval-1", "keep_local");