wip: 数据导入

This commit is contained in:
ah--desktop
2025-11-04 23:16:24 +08:00
parent b0a4547e28
commit 5e0a085648
52 changed files with 1233 additions and 67 deletions
@@ -0,0 +1,70 @@
import type { ImportFieldDefDTO, ImportFieldDefVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 导入字段定义管理API
*/
/**
* 创建导入字段定义
*/
export async function createImportFieldDefApi(
data: ImportFieldDefDTO.CreateImportFieldDefDTO,
) {
return requestClient.post<ImportFieldDefVO.ImportFieldDefInfoVO>(
'/ec/import-field-def/create',
data,
);
}
/**
* 更新导入字段定义
*/
export async function updateImportFieldDefApi(
id: number,
data: ImportFieldDefDTO.UpdateImportFieldDefDTO,
) {
return requestClient.put<ImportFieldDefVO.ImportFieldDefInfoVO>(
`/ec/import-field-def/update/${id}`,
data,
);
}
/**
* 删除导入字段定义
*/
export async function deleteImportFieldDefApi(id: number) {
return requestClient.delete(`/ec/import-field-def/delete/${id}`);
}
/**
* 获取指定类型所有字段列表
*/
export async function getFieldDefsByTypeApi(type: string) {
return requestClient.get<ImportFieldDefVO.ImportFieldDefInfoVO[]>(
`/ec/import-field-def/list-by-type/all/${type}`,
);
}
/**
* 分页查询导入字段定义
*/
export async function getImportFieldDefPageApi(
params: PageQueryDTO<ImportFieldDefDTO.ImportFieldDefFilterDTO>,
) {
return requestClient.post<
PageResultVO<ImportFieldDefVO.ImportFieldDefInfoVO>
>('/ec/import-field-def/page', params);
}
/**
* 批量排序导入字段定义
*/
export async function batchSortImportFieldDefApi(
data: ImportFieldDefDTO.BatchSortImportFieldDefDTO,
) {
return requestClient.post('/ec/import-field-def/batch-sort', data);
}
@@ -0,0 +1,6 @@
/**
* 导入字段定义模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 导入字段定义模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,57 @@
/**
* 导入字段定义模块DTO类型定义
*/
export namespace ImportFieldDefDTO {
/** 创建导入字段定义参数 */
export interface CreateImportFieldDefDTO {
/** 导入类型(product-商品 order-订单) */
type: string;
/** 数据库字段名,如 name */
fieldName: string;
/** 中文字段名,如 商品名称 */
fieldLabel: string;
/** 是否必填 */
required: boolean;
/** 排序 */
sort?: number;
/** 数据类型(string, number, date等) */
dataType?: string;
}
/** 更新导入字段定义参数 */
export interface UpdateImportFieldDefDTO {
/** 中文字段名,如 商品名称 */
fieldLabel: string;
/** 是否必填 */
required: boolean;
/** 排序 */
sort?: number;
/** 数据类型(string, number, date等) */
dataType?: string;
}
/** 导入字段定义过滤条件 */
export interface ImportFieldDefFilterDTO {
/** 导入类型(product-商品 order-订单) */
type?: string;
/** 字段名(模糊查询) */
fieldName?: string;
/** 字段标签(模糊查询) */
fieldLabel?: string;
}
/** 批量导入字段定义排序参数 */
export interface BatchSortImportFieldDefDTO {
/** 排序项列表 */
sortItems: FieldDefSortItem[];
}
/** 字段定义排序项 */
export interface FieldDefSortItem {
/** 字段定义ID */
fieldDefId: number;
/** 排序值 */
sort: number;
}
}
@@ -0,0 +1,27 @@
/**
* 导入字段定义模块VO类型定义
*/
export namespace ImportFieldDefVO {
/** 导入字段定义信息 */
export interface ImportFieldDefInfoVO {
/** 字段定义ID */
id: number;
/** 导入类型(product-商品 order-订单) */
type: string;
/** 数据库字段名,如 name */
fieldName: string;
/** 中文字段名,如 商品名称 */
fieldLabel: string;
/** 是否必填 */
required: boolean;
/** 排序 */
sort?: number;
/** 数据类型(string, number, date等) */
dataType?: string;
/** 创建时间 */
createdAt: string;
/** 更新时间 */
updatedAt: string;
}
}
@@ -0,0 +1,53 @@
import type { ImportMappingDTO, ImportMappingVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 导入映射管理API
*/
/**
* 创建导入映射模板
*/
export async function createImportMappingApi(
data: ImportMappingDTO.CreateImportMappingDTO,
) {
return requestClient.post<ImportMappingVO.ImportMappingInfoVO>(
'/ec/import-mapping/create',
data,
);
}
/**
* 更新导入映射模板
*/
export async function updateImportMappingApi(
id: number,
data: ImportMappingDTO.UpdateImportMappingDTO,
) {
return requestClient.put<ImportMappingVO.ImportMappingInfoVO>(
`/ec/import-mapping/update/${id}`,
data,
);
}
/**
* 删除导入映射
*/
export async function deleteImportMappingApi(id: number) {
return requestClient.delete(`/ec/import-mapping/delete/${id}`);
}
/**
* 分页获取导入映射列表
*/
export async function getImportMappingPageApi(
params: PageQueryDTO<ImportMappingDTO.ImportMappingFilterDTO>,
) {
return requestClient.post<PageResultVO<ImportMappingVO.ImportMappingInfoVO>>(
'/ec/import-mapping/page',
params,
);
}
@@ -0,0 +1,6 @@
/**
* 导入映射模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 导入映射模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,25 @@
/**
* 导入映射模块DTO类型定义
*/
export namespace ImportMappingDTO {
/** 创建导入映射参数 */
export interface CreateImportMappingDTO {
/** 导入类型(product-商品 order-订单) */
type: string;
/** 字段映射(JSON格式) */
mapping: string;
}
/** 更新导入映射参数 */
export interface UpdateImportMappingDTO {
/** 字段映射(JSON格式) */
mapping: string;
}
/** 导入映射过滤条件 */
export interface ImportMappingFilterDTO {
/** 导入类型(product-商品 order-订单) */
type?: string;
}
}
@@ -0,0 +1,25 @@
/**
* 导入映射模块VO类型定义
*/
export namespace ImportMappingVO {
/** 导入映射信息 */
export interface ImportMappingInfoVO {
/** 映射ID */
id: number;
/** 所属公司ID */
companyId?: number;
/** 导入类型(product-商品 order-订单) */
type: string;
/** 字段映射(JSON格式) */
mapping: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -0,0 +1,33 @@
import type { ImportTaskDTO, ImportTaskVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 导入任务管理API
*/
/**
* 创建导入任务
*/
export async function createImportTaskApi(
data: ImportTaskDTO.CreateImportTaskDTO,
) {
return requestClient.post<ImportTaskVO.ImportTaskInfoVO>(
'/ec/import-task/create',
data,
);
}
/**
* 分页获取导入任务列表
*/
export async function getImportTaskPageApi(
params: PageQueryDTO<ImportTaskDTO.ImportTaskFilterDTO>,
) {
return requestClient.post<PageResultVO<ImportTaskVO.ImportTaskInfoVO>>(
'/ec/import-task/page',
params,
);
}
@@ -0,0 +1,6 @@
/**
* 导入任务模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 导入任务模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,27 @@
/**
* 导入任务模块DTO类型定义
*/
export namespace ImportTaskDTO {
/** 创建导入任务参数 */
export interface CreateImportTaskDTO {
/** 导入类型(product-商品 order-订单) */
type: string;
/** 原始文件名 */
fileName: string;
/** 存储路径 */
filePath: string;
/** 字段映射记录(JSON字符串) */
mapping?: string;
}
/** 导入任务过滤条件 */
export interface ImportTaskFilterDTO {
/** 导入类型(product-商品 order-订单) */
type?: string;
/** 任务状态 */
status?: string;
/** 文件名(模糊查询) */
fileName?: string;
}
}
@@ -0,0 +1,39 @@
/**
* 导入任务模块VO类型定义
*/
export namespace ImportTaskVO {
/** 导入任务信息 */
export interface ImportTaskInfoVO {
/** 主键ID */
id: number;
/** 所属公司ID */
companyId?: number;
/** 导入类型(product-商品 order-订单) */
type: string;
/** 原始文件名 */
fileName: string;
/** 存储路径 */
filePath: string;
/** 任务状态 */
status: string;
/** 总行数 */
totalCount?: number;
/** 成功行数 */
successCount?: number;
/** 失败行数 */
failCount?: number;
/** 字段映射记录(JSON字符串) */
mapping?: string;
/** 错误信息或备注 */
message?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -1,12 +0,0 @@
/**
* 电商模块API导出
*/
// 订单状态相关API
export * from './order-status.apis';
// 订单相关API
export * from './order.apis';
// 推广费类型相关API
export * from './promotion-fee-type.apis';
@@ -0,0 +1,6 @@
/**
* 订单状态管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 订单状态管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,6 @@
/**
* 订单管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 订单管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -51,3 +51,21 @@ export namespace OrderVO {
costTotal: number;
}
}
/**
* 批量导入结果相关VO类型定义
*/
export namespace BatchImportResultVO {
/** 批量导入结果 */
export interface Info {
/** 总数量 */
totalCount: number;
/** 成功数量 */
successCount: number;
/** 失败数量 */
failureCount: number;
/** 失败详情 */
failureDetails: string[];
}
}
@@ -0,0 +1,6 @@
/**
* 推广费类型管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 推广费类型管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -1,14 +0,0 @@
/**
* 电商模块类型定义导出
*/
// DTO类型导出
export * from './dto.order';
export * from './dto.order-status';
export * from './dto.promotion-fee-type';
export * from './vo.batch-import-result';
// VO类型导出
export * from './vo.order';
export * from './vo.order-status';
export * from './vo.promotion-fee-type';
@@ -1,17 +0,0 @@
/**
* 批量导入结果相关VO类型定义
*/
export namespace BatchImportResultVO {
/** 批量导入结果 */
export interface Info {
/** 总数量 */
totalCount: number;
/** 成功数量 */
successCount: number;
/** 失败数量 */
failureCount: number;
/** 失败详情 */
failureDetails: string[];
}
}