|
|
@@ -1,8 +1,184 @@
|
|
|
-import type { InferResponseType, InferRequestType } from 'hono/client';
|
|
|
-import { enterpriseOrderClient } from '../api/enterpriseOrderClient';
|
|
|
+/**
|
|
|
+ * 订单相关类型定义
|
|
|
+ *
|
|
|
+ * 由于 rpcClient 返回 any 类型导致类型推导失败,
|
|
|
+ * 这里直接定义需要的类型,避免类型推导问题
|
|
|
+ */
|
|
|
|
|
|
-// 订单列表查询参数类型(企业专用)
|
|
|
-export type CompanyOrdersQueryParams = InferRequestType<typeof enterpriseOrderClient['company-orders']['$get']>['query'];
|
|
|
+import type { OrderStatus, WorkStatus } from '@d8d/allin-enums';
|
|
|
+
|
|
|
+// ===== 基础实体类型 =====
|
|
|
+
|
|
|
+// 订单实体类型
|
|
|
+export interface EmploymentOrder {
|
|
|
+ id: number;
|
|
|
+ orderName: string | null;
|
|
|
+ platformId: number;
|
|
|
+ companyId: number;
|
|
|
+ channelId: number | null;
|
|
|
+ expectedStartDate: Date | null;
|
|
|
+ actualStartDate: Date | null;
|
|
|
+ actualEndDate: Date | null;
|
|
|
+ orderStatus: OrderStatus;
|
|
|
+ createTime: Date;
|
|
|
+ updateTime: Date;
|
|
|
+ company?: {
|
|
|
+ id: number;
|
|
|
+ companyName: string;
|
|
|
+ } | null;
|
|
|
+ platform?: {
|
|
|
+ id: number;
|
|
|
+ platformName: string;
|
|
|
+ } | null;
|
|
|
+ channel?: {
|
|
|
+ id: number;
|
|
|
+ channelName: string;
|
|
|
+ } | null;
|
|
|
+ orderPersons?: OrderPerson[];
|
|
|
+}
|
|
|
+
|
|
|
+// 订单人员类型
|
|
|
+export interface OrderPerson {
|
|
|
+ id: number;
|
|
|
+ orderId: number;
|
|
|
+ personId: number;
|
|
|
+ joinDate: Date;
|
|
|
+ actualStartDate: Date | null;
|
|
|
+ leaveDate: Date | null;
|
|
|
+ workStatus: WorkStatus;
|
|
|
+ salaryDetail: number | string | null;
|
|
|
+ person?: {
|
|
|
+ id: number;
|
|
|
+ name: string;
|
|
|
+ gender: string;
|
|
|
+ disabilityType: string;
|
|
|
+ phone: string | null;
|
|
|
+ disabilityId: string | null;
|
|
|
+ } | null;
|
|
|
+}
|
|
|
+
|
|
|
+// 订单人员资产类型
|
|
|
+export interface OrderPersonAsset {
|
|
|
+ id: number;
|
|
|
+ orderId: number;
|
|
|
+ personId: number;
|
|
|
+ assetType: string;
|
|
|
+ assetFileType: string;
|
|
|
+ status?: string;
|
|
|
+ fileId: number;
|
|
|
+ relatedTime: Date;
|
|
|
+ updateTime: Date;
|
|
|
+}
|
|
|
+
|
|
|
+// ===== 查询参数类型 =====
|
|
|
+
|
|
|
+// 订单列表查询参数
|
|
|
+export interface CompanyOrdersQuery {
|
|
|
+ companyId?: number;
|
|
|
+ orderName?: string;
|
|
|
+ orderStatus?: OrderStatus;
|
|
|
+ startDate?: string;
|
|
|
+ endDate?: string;
|
|
|
+ page?: number;
|
|
|
+ pageSize?: number;
|
|
|
+ sortBy?: 'createTime' | 'updateTime' | 'orderName';
|
|
|
+ sortOrder?: 'ASC' | 'DESC';
|
|
|
+}
|
|
|
+
|
|
|
+// 视频列表查询参数
|
|
|
+export interface CompanyVideosQuery {
|
|
|
+ companyId?: number;
|
|
|
+ assetType?: string;
|
|
|
+ page?: number;
|
|
|
+ pageSize?: number;
|
|
|
+ sortBy?: 'relatedTime' | 'createTime' | 'updateTime';
|
|
|
+ sortOrder?: 'ASC' | 'DESC';
|
|
|
+}
|
|
|
+
|
|
|
+// ===== 响应类型 =====
|
|
|
+
|
|
|
+// 打卡统计响应
|
|
|
+export interface CheckinStatisticsResponse {
|
|
|
+ companyId: number;
|
|
|
+ checkinVideoCount: number;
|
|
|
+ totalVideos: number;
|
|
|
+}
|
|
|
+
|
|
|
+// 视频统计响应
|
|
|
+export interface VideoStatisticsResponse {
|
|
|
+ companyId: number;
|
|
|
+ stats: Array<{
|
|
|
+ assetType: string;
|
|
|
+ count: number;
|
|
|
+ percentage: number;
|
|
|
+ }>;
|
|
|
+ total: number;
|
|
|
+}
|
|
|
+
|
|
|
+// 订单统计响应
|
|
|
+export interface OrderStatsResponse {
|
|
|
+ orderId: number;
|
|
|
+ actualPeople: number;
|
|
|
+ checkinStats: {
|
|
|
+ current: number;
|
|
|
+ total: number;
|
|
|
+ percentage: number;
|
|
|
+ };
|
|
|
+ salaryVideoStats: {
|
|
|
+ current: number;
|
|
|
+ total: number;
|
|
|
+ percentage: number;
|
|
|
+ };
|
|
|
+ taxVideoStats: {
|
|
|
+ current: number;
|
|
|
+ total: number;
|
|
|
+ percentage: number;
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+// 企业视频列表响应
|
|
|
+export interface CompanyVideosResponse {
|
|
|
+ data: Array<{
|
|
|
+ id: number;
|
|
|
+ orderId: number;
|
|
|
+ personId: number;
|
|
|
+ assetType: string;
|
|
|
+ assetFileType: string;
|
|
|
+ fileId: number;
|
|
|
+ file?: {
|
|
|
+ id: number;
|
|
|
+ name: string;
|
|
|
+ type: string | null;
|
|
|
+ size: number | null;
|
|
|
+ path: string;
|
|
|
+ fullUrl?: string;
|
|
|
+ description: string | null;
|
|
|
+ uploadTime: Date;
|
|
|
+ } | null;
|
|
|
+ relatedTime: Date;
|
|
|
+ createTime: Date;
|
|
|
+ updateTime: Date;
|
|
|
+ }>;
|
|
|
+ total: number;
|
|
|
+}
|
|
|
+
|
|
|
+// ===== 请求类型 =====
|
|
|
+
|
|
|
+// 批量下载请求
|
|
|
+export interface BatchDownloadRequest {
|
|
|
+ downloadScope: 'company' | 'person';
|
|
|
+ companyId?: number;
|
|
|
+ personId?: number;
|
|
|
+ assetTypes?: string[];
|
|
|
+ fileIds?: number[];
|
|
|
+}
|
|
|
+
|
|
|
+// 更新视频状态请求
|
|
|
+export interface UpdateVideoStatusRequest {
|
|
|
+ status: 'pending' | 'verified' | 'rejected';
|
|
|
+}
|
|
|
+
|
|
|
+// ===== 通用类型 =====
|
|
|
|
|
|
// 分页响应类型
|
|
|
export type PaginatedResponse<T> = {
|
|
|
@@ -10,23 +186,19 @@ export type PaginatedResponse<T> = {
|
|
|
total: number;
|
|
|
};
|
|
|
|
|
|
-// 使用Hono类型推导
|
|
|
-export type OrderDetailResponse = InferResponseType<typeof enterpriseOrderClient.detail[':id']['$get'], 200>;
|
|
|
-export type OrderListResponse = InferResponseType<typeof enterpriseOrderClient['company-orders']['$get'], 200>;
|
|
|
-export type OrderData = InferResponseType<typeof enterpriseOrderClient['company-orders']['$get'], 200>['data'][0];
|
|
|
-
|
|
|
-
|
|
|
-// 企业专用扩展API
|
|
|
-export type CheckinStatisticsResponse = InferResponseType<typeof enterpriseOrderClient['checkin-statistics']['$get'], 200>;
|
|
|
-export type VideoStatisticsResponse = InferResponseType<typeof enterpriseOrderClient['video-statistics']['$get'], 200>;
|
|
|
-// 订单统计API路径: /company-orders/:id/stats -> client key: 'company-orders' -> ':id' -> 'stats'
|
|
|
-export type OrderStatsResponse = InferResponseType<typeof enterpriseOrderClient['company-orders'][':id']['stats']['$get'], 200>;
|
|
|
-export type CompanyVideosResponse = InferResponseType<typeof enterpriseOrderClient['company-videos']['$get'], 200>;
|
|
|
-export type BatchDownloadRequest = InferRequestType<typeof enterpriseOrderClient['batch-download']['$post']>['json'];
|
|
|
-export type UpdateVideoStatusRequest = InferRequestType<typeof enterpriseOrderClient.videos[':id']['status']['$put']>['json'];
|
|
|
-
|
|
|
-// 查询参数类型
|
|
|
-export type CheckinStatisticsParams = InferRequestType<typeof enterpriseOrderClient['checkin-statistics']['$get']>['query'];
|
|
|
-export type VideoStatisticsParams = InferRequestType<typeof enterpriseOrderClient['video-statistics']['$get']>['query'];
|
|
|
-export type CompanyVideosParams = InferRequestType<typeof enterpriseOrderClient['company-videos']['$get']>['query'];
|
|
|
-export type BatchDownloadParams = InferRequestType<typeof enterpriseOrderClient['batch-download']['$post']>['json'];
|
|
|
+// ===== 类型别名 =====
|
|
|
+
|
|
|
+export type CompanyOrdersQueryParams = CompanyOrdersQuery;
|
|
|
+export type CheckinStatisticsParams = Record<string, never>;
|
|
|
+export type VideoStatisticsParams = { assetType?: string };
|
|
|
+export type CompanyVideosParams = CompanyVideosQuery;
|
|
|
+export type BatchDownloadParams = BatchDownloadRequest;
|
|
|
+
|
|
|
+// 订单详情响应类型
|
|
|
+export type OrderDetailResponse = EmploymentOrder;
|
|
|
+
|
|
|
+// 订单列表响应类型
|
|
|
+export type OrderListResponse = PaginatedResponse<EmploymentOrder>;
|
|
|
+
|
|
|
+// 订单数据类型
|
|
|
+export type OrderData = EmploymentOrder;
|