feat: 完成 NestJS 后端核心底座开发 (M1-M6) 和 Ant Design Vue 前端迁移
主要更新: 1. 后端核心底座完成 (M1-M6): - 健康检查、指标监控、分布式锁 - 事件总线、队列系统、事务管理 - 安全守卫、多租户隔离、存储适配器 - 审计日志、配置管理、多语言支持 2. 前端迁移到 Ant Design Vue: - 从 Element Plus 迁移到 Ant Design Vue - 完善 system 模块 (role/menu/dept) - 修复依赖和配置问题 3. 文档完善: - AI 开发工作流文档 - 架构约束和开发规范 - 项目进度跟踪 4. 其他改进: - 修复编译错误和类型问题 - 完善测试用例 - 优化项目结构
This commit is contained in:
65
wwjcloud/src/common/schedule/entities/Schedule.ts
Normal file
65
wwjcloud/src/common/schedule/entities/Schedule.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { BaseEntity } from '@wwjCore/base/BaseEntity';
|
||||
import { ScheduleStatus } from '../enums/schedule-status.enum';
|
||||
|
||||
/**
|
||||
* 定时任务实体
|
||||
* 对应数据库表: sys_schedule
|
||||
*/
|
||||
@Entity('sys_schedule')
|
||||
export class Schedule extends BaseEntity {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'addon', type: 'varchar', length: 255, default: '' })
|
||||
addon: string;
|
||||
|
||||
@Column({ name: 'key', type: 'varchar', length: 255, default: '' })
|
||||
key: string;
|
||||
|
||||
@Column({ name: 'status', type: 'int', default: 1 })
|
||||
status: ScheduleStatus;
|
||||
|
||||
@Column({ name: 'time', type: 'varchar', length: 500, default: '' })
|
||||
time: string;
|
||||
|
||||
@Column({ name: 'count', type: 'int', default: 0 })
|
||||
count: number;
|
||||
|
||||
@Column({ name: 'last_time', type: 'int', default: 0 })
|
||||
last_time: number;
|
||||
|
||||
@Column({ name: 'next_time', type: 'int', default: 0 })
|
||||
next_time: number;
|
||||
|
||||
@Column({ name: 'sort', type: 'int', default: 0 })
|
||||
sort: number;
|
||||
|
||||
/**
|
||||
* 获取状态文本
|
||||
*/
|
||||
getStatusText(): string {
|
||||
const statusMap = {
|
||||
[ScheduleStatus.DISABLED]: '禁用',
|
||||
[ScheduleStatus.ENABLED]: '启用',
|
||||
[ScheduleStatus.RUNNING]: '执行中',
|
||||
[ScheduleStatus.ERROR]: '错误',
|
||||
[ScheduleStatus.PAUSED]: '暂停',
|
||||
};
|
||||
return statusMap[this.status] || '未知';
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查任务是否启用
|
||||
*/
|
||||
isEnabled(): boolean {
|
||||
return this.status === ScheduleStatus.ENABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查任务是否正在执行
|
||||
*/
|
||||
isRunning(): boolean {
|
||||
return this.status === ScheduleStatus.RUNNING;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user