feat(订单统计): 新增汇总运维管理页(两栏选公司 + 灌数/进度/对账)

This commit is contained in:
小蟑螂
2026-06-04 14:19:35 +08:00
parent b2a25a236f
commit 6d3d8c699b
7 changed files with 730 additions and 1 deletions
@@ -0,0 +1,27 @@
import type { OrderStatDTO, OrderStatVO } from './types';
import { requestClient } from '#/api/request';
/**
* 订单统计汇总表运维 API(/ec/admin/order-stat)
*/
/** 创建 rebuild 任务,返回 taskId */
export async function createOrderStatRebuildApi(data: OrderStatDTO.RebuildRequest) {
return requestClient.post<number>('/ec/admin/order-stat/rebuild', data);
}
/** 查询 rebuild 任务进度 */
export async function getOrderStatRebuildStatusApi(taskId: number) {
return requestClient.get<OrderStatVO.RebuildTask>(
`/ec/admin/order-stat/rebuild/${taskId}`,
);
}
/** 抽样对账:汇总表 vs 明细聚合 */
export async function reconcileOrderStatApi(data: OrderStatDTO.ReconcileRequest) {
return requestClient.post<OrderStatVO.ReconcileReport>(
'/ec/admin/order-stat/reconcile',
data,
);
}
@@ -0,0 +1,2 @@
export * from './apis';
export * from './types';
@@ -0,0 +1,2 @@
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,22 @@
/**
* 订单统计管理 — 请求 DTO(与后端 OrderStat*RequestDTO 对齐)
*/
export namespace OrderStatDTO {
/** 创建 rebuild 任务 */
export interface RebuildRequest {
companyId: number;
/** 空表示全公司下所有店铺 */
shopId?: number | null;
startDate: string;
endDate: string;
}
/** 抽样对账 */
export interface ReconcileRequest {
companyId: number;
startDate: string;
endDate: string;
/** 默认 100 */
sampleSize?: number;
}
}
@@ -0,0 +1,41 @@
/**
* 订单统计管理 — 响应 VO
*/
export namespace OrderStatVO {
/** rebuild 任务 */
export interface RebuildTask {
id: number;
companyId: number;
shopId?: number | null;
startDate: string;
endDate: string;
granularity: string;
status: 'done' | 'failed' | 'pending' | 'running' | string;
progressDate?: string | null;
errorMessage?: string | null;
createTime?: string;
updateTime?: string;
}
/** 对账明细行 */
export interface ReconcileItem {
shopId: number;
statDate: string;
statSales: number;
aggSales: number;
diff: number;
match: boolean;
}
/** 对账报告 */
export interface ReconcileReport {
companyId: number;
startDate: string;
endDate: string;
sampleCount: number;
mismatchCount: number;
passed: boolean;
message?: string | null;
items: ReconcileItem[];
}
}