Hermes CI Fix
242f3cf5ec
fix(fetch-caliber): 取数层排除半年/预测伪期间 + subjects 响应补 entity_id
...
R3 期间口径(仅 YYYY-MM)延伸到取数层:新增 alert_entity_scope.month_period_clause()(跨库可移植 SQL 等价式),应用到 15 个文件 26 处「按 period 倒序取最新值/最近N期」位点;dashboard 原 MySQL-only REGEXP 正则收口到同单一事实源。
GET /api/cma/subjects 响应增补 entity_id(NULL=全局标准准则科目 / N=账套私有明细),既有 10 字段语义与名称不变。
证据:pending-tasks/_reports/yanxue-20260924-cma-fetch-caliber-fixes-fullstack.md(改前/改后 A/B:F_NET_PROFIT 2026-H2/-55.0 → 2026-08/-10.46)。新增 7 例回归测试;全量 1 failed(预存在) 1473 passed,基线同项。
2026-09-26 02:42:04 +08:00
Hermes CI Fix
42ff836309
fix(cma): entity isolation batch5 (budget writes, kpi objectives scope, quality logs join, growth-quality db source, expenses scope)
ci/woodpecker/push/main Pipeline failed
2026-09-21 10:36:02 +08:00
fullstack-bot
b815b7f623
fix(security): close unauthenticated CMA user API surface + audit tool (cma-api-auth-surface-audit-20260914)
...
Root cause: main.py include_router had no global auth dependency; user routers
(products/cost/predict/...) relied on assert_entity_scope, which treats a
missing session token as the Bot service channel and lets the request through.
Result: 46 user endpoints returned data without any token on a public site.
Changes:
- auth_middleware.py: add require_auth_401 (missing Bearer -> 401, delegates to
require_auth otherwise); 401/403 semantics are explicit.
- router-level Depends(require_auth_401) on products, cost, predict,
notifications, permissions, tenant, alignment; endpoint-level on
/auth/roles and /admin/cache/clear.
- deps.py: document that get_entity_id/assert_entity_scope are NOT auth.
- frontend: add the missing Bearer header to 5 tokenless fetch/axios calls that
hit the newly protected endpoints (KPIAlignment x2, RolePermissions x2,
Dashboard x1).
- tests: new test_api_auth_surface_20260914.py (58 cases: no-token 401,
token 200, cross-entity 403, bot channel unchanged); adapt test_predict /
test_kpi_forecast to send session tokens like production.
- scripts/audit_api_auth_surface.py: reusable FastAPI dependency-graph audit
(423 endpoints; A bot / B gap / C public), exits 1 when a B-class gap exists.
2026-09-14 16:41:15 +08:00
Hermes CI Fix
e330545d59
feat(P1-3): 相关成本决策模块 — 官方25%权重'商业决策分析'核心
...
新增 /predict/relevant-decision API + 前端Tab(3场景):
1. 自制vs外购: 相关成本比较+无差别点(增量成本视角)
2. 特殊订单: 剩余产能下价格>变动成本即接受(增量利润)
3. 产品组合(约束理论): 单位约束资源边际贡献排序
验证: 自制850k vs 外购900k→自制; 特殊订单单位贡献25→接受;
产品组合B产品单位约束贡献50最高→优先
2026-08-26 22:38:37 +08:00
Hermes CI Fix
6b6043536a
feat: 预测性成本智能升级 — 历史回归弹性校准 + 预测偏差告警
...
升级1: 宏观敏感性弹性历史校准
- 内置宏观历史数据(oil/usd/cpi 2026-01~07月度)
- 变化率弹性: 同period匹配KPI历史vs因素历史算弹性
- 合理性校验: |弹性|超出[0.01,0.5]视为噪声回退规则(诚实标注)
升级2: 预测偏差告警闭环
- 新表 kpi_forecast_log(预测历史)+模型KpiForecastLog
- 预测时落库(同KPI同预测期覆盖)
- alert_rules 支持 rule_type=forecast_deviation(threshold_pct)
- POST /alert-rules/run-forecast-deviation: 预测vs实际偏差>阈值生成预警(去重, 超2倍阈值红色)
- 端到端验证: 模拟实际500vs预测399.55→偏差20.1%>5%→红色预警生成
回归: pytest 40 passed(predict+alerts)
2026-08-25 00:55:50 +08:00
Hermes CI Fix
8ec846c6df
feat: 预测性成本智能·宏观敏感性因素联动(IMA 2026.7完整版)
...
- 内置3宏观因素: 原油价格/美元汇率/CPI通胀率
- 敏感性引擎: 按KPI类别推断弹性(成本类油价0.15/利润类0.12/营收类0.08), 方向+因素涨KPI涨
- 负值KPI(亏损)方向反转修复: 油价涨→净利更亏
- API: GET /predict/kpi-forecast/sensitivity?pct=10 → KPI×因素矩阵(±pct调整后预测)
- 前端: 敏感性幅度选择(±5/10/20%) + 敏感性矩阵表(同向/反向+↑↓调整值)
- 诚实标注: 模型弹性(规则推断,非历史回归), 后续可用宏观历史数据回归校准
- 验证: Chrome实测页面+API矩阵, pytest 46 passed
2026-08-25 00:44:45 +08:00
Hermes CI Fix
13aa153875
feat: 预测性成本智能MVP — KPI趋势预测引擎(线性回归/移动平均)+API+前端Tab+pytest覆盖
2026-08-25 00:10:46 +08:00
Hermes CI Fix
d7e97978c6
fix: 写接口entity_id token优先(resolve_entity_for_request)+ 登录页用顶层entity_id
2026-08-11 11:32:30 +08:00
Hermes CI Fix
9986f38faa
feat: 账套模式全量接入 — 12个API entity_id统一走token解析链 + 前端登录选公司/切换器重签token
...
- 后端: kpis/bsc_layers/cash/predict/growth_quality/tax_compliance/data 的 entity_id 参数统一改为 Depends(get_entity_id)
- 前端: 拦截器删除自动附加X-Entity-Id/entity_id; 登录页公司选择器(按用户名授权过滤); 切换器改POST /auth/switch-entity重新签发token+整页刷新; ReportCenter同步改造
- 修复前后端不匹配: login-entities路由→/auth/entities; login响应entity_id取user.entity_id
2026-08-11 11:29:39 +08:00
Hermes CI Fix
c4e91f28ef
feat: AI事前预警 — 现金流预测+预警扩展+准确率+情景建议
2026-07-21 18:22:04 +08:00
Hermes CI Fix
0a2926047e
fix: 增长质量评分按实体ID查询数据(酣客1.4/博海3.8)
2026-07-19 10:52:50 +08:00
Hermes CI Fix
f85c3d2c4e
feat: 增长质量诊断模块 — 后端评分API+前端驾驶舱卡片+雷达图+明细下钻+双实体对比
...
- 新增 POST /api/cma/predict/growth-quality 评分API
- 五维度评分引擎(营收结构/利润结构/现金资产/增长驱动/组织效率)
- 自动诊断结论生成
- 明细指标+改善建议
- 双实体对比模式
- 前端 GrowthQuality.vue 组件
- 综合评分大字展示
- 五维度评分条 + 状态颜色
- ECharts雷达图
- 明细下钻弹窗(指标+建议)
- 双实体并列对比(VS模式)
- 集成到 Dashboard.vue CEO驾驶舱视图
- 酣客测试验证:综合1.4分(越增长越重)
- 博海对比验证:综合3.6分(增长质量中等)
2026-07-19 10:46:43 +08:00
Hermes CI Fix
afa060bbfd
feat: 实物期权计算器 — 后端BSM+二叉树API+前端交互页面
2026-07-18 17:44:21 +08:00
Hermes CI Fix
4b25f46124
feat: CMA P1+P2 Round1 — 成本法对比+杜邦分析+本量利
2026-07-16 16:39:24 +08:00
Hermes CI Fix
3dddd36866
init: 管理会计OS初始代码
...
包含前后端完整代码:
- 前端:Vue3+Vite+ElementPlus
- 后端:FastAPI+SQLAlchemy
- 模块:驾驶舱/KPI/战略地图/预警/预算/成本/预测/改善行动
- 当前版本:v1.0.0
2026-05-28 17:32:22 +08:00