feat: 初始化项目结构并添加核心功能模块

- 新增文档模板和导航结构
- 实现服务器基础API路由和控制器
- 添加扩展插件配置和前端框架
- 引入多租户和权限管理模块
- 集成日志和数据库配置
- 添加核心业务模型和类型定义
This commit is contained in:
2026-03-17 22:07:19 +08:00
parent c0870dce50
commit 136c2fa579
728 changed files with 107690 additions and 5614 deletions

View File

@@ -0,0 +1,65 @@
import { logger } from '../../utils/logger';
import { SupplyChainService } from '../../services/SupplyChainService';
import { InventoryForecastService } from '../../services/InventoryForecastService';
import { DynamicPricingService } from '../../services/DynamicPricingService';
/**
* [V31.3] Shadow Auditing Service
* @description AI-2 (Internal) 负责对 AI-1 和 AI-3 的核心功能进行影子测试(最小冒烟测试),确保逻辑闭环。
*/
export class ShadowAuditService {
/**
* 执行全量影子测试
*/
static async runAllAudits(tenantId: string) {
logger.info(`[ShadowAudit] Starting full audit for tenant: ${tenantId}`);
const results = {
routing: await this.auditRouting(tenantId),
forecast: await this.auditForecast(tenantId),
pricing: await this.auditPricing(tenantId)
};
logger.info(`[ShadowAudit] Audit complete: ${JSON.stringify(results)}`);
return results;
}
/**
* [AI-1] 供应路由测试 (BIZ_SUP_15)
*/
private static async auditRouting(tenantId: string) {
try {
// 验证寻源建议是否能正常生成且记录因果链
const result = await SupplyChainService.traceSourceFactory(tenantId, 'TEST-PROD-001', 'https://example.com/image.jpg');
return { status: 'PASSED', suggestionId: result.suggestionId };
} catch (err: any) {
return { status: 'FAILED', error: err.message };
}
}
/**
* [AI-3] 销量预测测试 (BIZ_INV_10)
*/
private static async auditForecast(tenantId: string) {
try {
// 验证补货建议是否能正常生成
const result = await InventoryForecastService.predictReplenishment(tenantId, 'TEST-PROD-001');
return { status: 'PASSED', replenishmentQty: result.suggestedQty };
} catch (err: any) {
return { status: 'FAILED', error: err.message };
}
}
/**
* [AI-1] 动态调价测试 (BIZ_MKT_30)
*/
private static async auditPricing(tenantId: string) {
try {
// 验证调价审计是否记录
const result = await DynamicPricingService.auditPrices(tenantId);
return { status: 'PASSED', count: result.length };
} catch (err: any) {
return { status: 'FAILED', error: err.message };
}
}
}