feat(reports): 企业合规报表(后端聚合 + CSV 导出 + 前端页面)#82
Merged
Conversation
企业审计(SOC2/ISO27001 等)需要「按任务、可导出、可归档」的备份合规证据, 不同于 Dashboard 的实时聚合视图。 - ReportService.ComplianceReport:逐任务聚合统计窗口内的运行/成功/失败、成功率、 最近运行/最近成功、当前保护字节数、加密与保留策略,并按 SLA(RPO) 判定合规 (禁用=not_applicable,从未成功=at_risk,配置 RPO 则按时限判定)。汇总含 合规/风险任务数、加密任务数、整体成功率、受保护总字节数。 - API:GET /api/reports/compliance(JSON)+ /api/reports/compliance/export(CSV, 带 UTF-8 BOM 便于 Excel)。统计天数 1-365 校验。 - 接入 app.go 与 router(沿用 AuthMiddleware,所有已登录角色可查看,与 Dashboard 一致)。 - 新增 report_service_test:备份前 at_risk → 备份后 ok/成功率 1.0/受保护字节>0;范围校验。
- ReportsPage:统计周期筛选(7/30/90/180/365 天)、合规汇总卡片(受保护/合规/ 风险/加密任务、整体成功率、受保护数据总量)、按任务合规明细表、一键导出 CSV(带认证)。 - 新增 types/reports.ts 与 services/reports.ts;接入路由 /reports 与侧边栏「合规报表」入口。 - tsc + vite build 通过;端到端验证 API 路由已注册(401 鉴权)、/reports 由后端 SPA 托管。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
面向企业审计(SOC2 / ISO27001 等)新增合规报表:一份「按任务、可导出、可归档」的备份合规证据,补足 Dashboard 实时聚合视图所缺的时间点审计材料。覆盖 架构 + 功能 + 页面 三层。
后端
ReportService.ComplianceReport(days):逐任务聚合统计窗口内运行/成功/失败、成功率、最近运行/最近成功、当前受保护字节数、加密与保留策略;按 SLA(RPO) 判定合规(禁用=not_applicable,从未成功=at_risk,配置 RPO 则按时限判定)。汇总含合规/风险/加密任务数、整体成功率、受保护总量。GET /api/reports/compliance(JSON)、GET /api/reports/compliance/export(CSV,UTF-8 BOM 便于 Excel)。天数 1–365 校验。app.go+ router(沿用AuthMiddleware,与 Dashboard 一致,所有已登录角色可查看)。前端
/reports,侧边栏入口):周期筛选、合规汇总卡片、按任务明细表(状态/成功率/最近成功/保护量/加密/SLA)、一键导出 CSV(经带认证的 http 客户端下载)。types/reports.ts、services/reports.ts。测试 / 验证
report_service_test:备份前at_risk→ 备份后ok、成功率 1.0、受保护字节>0;天数范围校验。go build/go test ./...全绿。tsc --noEmit+vite build通过。/api/reports/compliance(+/export)返回 401(已注册+鉴权)、/reports由后端 SPA 托管返回 200。