吸收数字员工管理端路由治理预览
This commit is contained in:
@@ -1084,7 +1084,8 @@ public class DigitalEmployeeSyncApplicationServiceImpl implements DigitalEmploye
|
||||
if (booleanValue(businessView.get("approval_conflict_active"))) return "approval_conflict";
|
||||
String kind = firstString(row.getKind(), businessView.get("kind"), payload.get("kind"));
|
||||
if (contains(kind, "route_decision_blocked") || contains(kind, "route_decision_approval_required")
|
||||
|| contains(kind, "route_action_missing_context") || contains(kind, "route_action_not_mapped")) {
|
||||
|| contains(kind, "route_action_policy_blocked") || contains(kind, "route_action_missing_context")
|
||||
|| contains(kind, "route_action_not_mapped")) {
|
||||
return "route_intervention";
|
||||
}
|
||||
String category = firstString(businessView.get("category"), payload.get("category"));
|
||||
|
||||
@@ -403,6 +403,71 @@ class DigitalEmployeeSyncApplicationServiceImplTest {
|
||||
assertThat(result.getRecords().get(2).getServiceId()).isEqualTo("agent-server");
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryAdminWorkbenchRouteGovernanceReturnsRouteAndGovernanceRowsOnly() {
|
||||
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-route-blocked", "event", "event-route-1", 101L, new Date(10_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"category", "route_governance",
|
||||
"kind", "route_decision_blocked",
|
||||
"status", "blocked",
|
||||
"title", "路由策略阻断",
|
||||
"route_decision_id", "route-1",
|
||||
"reason", "route_action_policy_blocked",
|
||||
"summary", "控制动作被策略阻断"
|
||||
),
|
||||
Map.of("id", "event-route-1", "kind", "route_decision_blocked")),
|
||||
record("outbox-route-intervention", "event", "event-route-2", 101L, new Date(11_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"category", "route_intervention",
|
||||
"kind", "route_action_missing_context",
|
||||
"status", "pending",
|
||||
"title", "路由缺少上下文",
|
||||
"route_decision_id", "route-2",
|
||||
"reason", "route_action_missing_context"
|
||||
),
|
||||
Map.of("id", "event-route-2", "kind", "route_action_missing_context")),
|
||||
record("outbox-governance", "event", "event-route-3", 101L, new Date(12_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"category", "governance",
|
||||
"kind", "governance_retry_task",
|
||||
"status", "recorded",
|
||||
"title", "治理命令已映射",
|
||||
"route_decision_id", "route-3",
|
||||
"command_id", "command-1"
|
||||
),
|
||||
Map.of("id", "event-route-3", "kind", "governance_retry_task")),
|
||||
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"))
|
||||
)));
|
||||
|
||||
DigitalEmployeeAdminWorkbenchPageDto result = service.queryAdminWorkbench(
|
||||
"route_governance", 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("event-route-1", "event-route-2", "event-route-3");
|
||||
assertThat(result.getRecords().get(0).getView()).isEqualTo("route_governance");
|
||||
assertThat(result.getRecords().get(0).getRouteDecisionId()).isEqualTo("route-1");
|
||||
assertThat(result.getRecords().get(0).getCategory()).isEqualTo("route_governance");
|
||||
assertThat(result.getRecords().get(0).getStatus()).isEqualTo("blocked");
|
||||
assertThat(result.getRecords().get(0).getSummary()).isEqualTo("控制动作被策略阻断");
|
||||
assertThat(result.getRecords().get(1).getCategory()).isEqualTo("route_intervention");
|
||||
assertThat(result.getRecords().get(2).getRouteDecisionId()).isEqualTo("route-3");
|
||||
}
|
||||
|
||||
@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)))
|
||||
|
||||
Reference in New Issue
Block a user