吸收数字员工管理端服务运营预览
This commit is contained in:
@@ -43,6 +43,8 @@ public class DigitalEmployeeAdminWorkbenchRowDto {
|
||||
private String reportId;
|
||||
@JsonProperty("route_decision_id")
|
||||
private String routeDecisionId;
|
||||
@JsonProperty("service_id")
|
||||
private String serviceId;
|
||||
@JsonProperty("occurred_at")
|
||||
private String occurredAt;
|
||||
@JsonProperty("synced_at")
|
||||
|
||||
@@ -979,6 +979,7 @@ public class DigitalEmployeeSyncApplicationServiceImpl implements DigitalEmploye
|
||||
.notificationId(firstString(businessView.get("notification_id"), payload.get("notification_id")))
|
||||
.reportId(firstString(businessView.get("report_id"), payload.get("report_id")))
|
||||
.routeDecisionId(firstString(businessView.get("route_decision_id"), payload.get("route_decision_id")))
|
||||
.serviceId(firstString(businessView.get("service_id"), businessView.get("serviceId"), payload.get("service_id"), payload.get("serviceId")))
|
||||
.occurredAt(businessRow.getOccurredAt())
|
||||
.syncedAt(record.getSyncedAt())
|
||||
.clientKeyMasked(maskClientKey(record.getClientKey()))
|
||||
@@ -997,6 +998,7 @@ public class DigitalEmployeeSyncApplicationServiceImpl implements DigitalEmploye
|
||||
return switch (view) {
|
||||
case "interventions" -> isInterventionRow(row);
|
||||
case "approval_governance" -> isApprovalGovernanceRow(row);
|
||||
case "service_operations" -> isServiceOperationsRow(row);
|
||||
case "artifact_lifecycle" -> isArtifactLifecycleRow(row);
|
||||
case "notifications" -> isNotificationRow(row);
|
||||
case "audits" -> isAuditRow(row);
|
||||
@@ -1037,6 +1039,20 @@ public class DigitalEmployeeSyncApplicationServiceImpl implements DigitalEmploye
|
||||
|| StringUtils.equals(row.getCategory(), "artifact_lifecycle");
|
||||
}
|
||||
|
||||
private boolean isServiceOperationsRow(DigitalEmployeeAdminWorkbenchRowDto row) {
|
||||
String kind = firstString(row.getKind());
|
||||
String category = firstString(row.getCategory());
|
||||
return StringUtils.equals(category, "managed_service")
|
||||
|| StringUtils.equals(category, "service_operation")
|
||||
|| StringUtils.equals(category, "service_health")
|
||||
|| contains(kind, "managed_service")
|
||||
|| contains(kind, "service_snapshot")
|
||||
|| contains(kind, "service_restart")
|
||||
|| contains(kind, "doctor_service")
|
||||
|| contains(kind, "doctor_issue")
|
||||
|| StringUtils.isNotBlank(row.getServiceId());
|
||||
}
|
||||
|
||||
private boolean isNotificationRow(DigitalEmployeeAdminWorkbenchRowDto row) {
|
||||
return StringUtils.equals(row.getCategory(), "notification")
|
||||
|| StringUtils.equals(row.getCategory(), "action_notification")
|
||||
|
||||
@@ -349,6 +349,60 @@ class DigitalEmployeeSyncApplicationServiceImplTest {
|
||||
assertThat(result.getRecords().get(3).getApprovalId()).isEqualTo("approval-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryAdminWorkbenchServiceOperationsReturnsServiceHealthAndRestartRowsOnly() {
|
||||
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-service-snapshot", "event", "event-service-1", 101L, new Date(10_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"category", "managed_service",
|
||||
"kind", "service_snapshot",
|
||||
"status", "degraded",
|
||||
"title", "File Server 异常",
|
||||
"service_id", "file-server",
|
||||
"level", "warn",
|
||||
"summary", "端口不可用"
|
||||
),
|
||||
Map.of("id", "event-service-1", "kind", "service_snapshot")),
|
||||
record("outbox-service-restart", "event", "event-service-2", 101L, new Date(11_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"category", "service_operation",
|
||||
"kind", "managed_service_restart",
|
||||
"status", "recorded",
|
||||
"title", "GUI Server 安全重启",
|
||||
"service_id", "gui-server"
|
||||
),
|
||||
Map.of("id", "event-service-2", "kind", "managed_service_restart")),
|
||||
record("outbox-doctor-service", "event", "event-service-3", 101L, new Date(12_000),
|
||||
Map.of(
|
||||
"entity_type", "event",
|
||||
"kind", "doctor_service_issue",
|
||||
"status", "failed",
|
||||
"title", "服务诊断失败",
|
||||
"service_id", "agent-server",
|
||||
"reason", "health_check_failed"
|
||||
),
|
||||
Map.of("id", "event-service-3", "kind", "doctor_service_issue")),
|
||||
record("outbox-approval", "approval", "approval-1", 101L, new Date(13_000),
|
||||
Map.of("entity_type", "approval", "title", "审批", "status", "pending"),
|
||||
Map.of("id", "approval-1", "status", "pending"))
|
||||
)));
|
||||
|
||||
DigitalEmployeeAdminWorkbenchPageDto result = service.queryAdminWorkbench(
|
||||
"service_operations", 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-service-1", "event-service-2", "event-service-3");
|
||||
assertThat(result.getRecords().get(0).getView()).isEqualTo("service_operations");
|
||||
assertThat(result.getRecords().get(0).getServiceId()).isEqualTo("file-server");
|
||||
assertThat(result.getRecords().get(1).getCategory()).isEqualTo("service_operation");
|
||||
assertThat(result.getRecords().get(2).getServiceId()).isEqualTo("agent-server");
|
||||
}
|
||||
|
||||
@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