feat: 完成sys模块迁移,对齐PHP/Java框架
- 重构sys模块架构,严格按admin/api/core分层 - 对齐所有sys实体与数据库表结构 - 实现完整的adminapi控制器,匹配PHP/Java契约 - 修复依赖注入问题,确保服务正确注册 - 添加自动迁移工具和契约验证 - 完善多租户支持和审计功能 - 统一命名规范,与PHP业务逻辑保持一致
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { JobsService } from '../src/common/jobs/jobs.service';
|
||||
import { EventBusService } from '../src/common/event-bus/event-bus.service';
|
||||
import { UnifiedQueueService } from '@wwjCore/queue/unifiedQueueService';
|
||||
|
||||
@Injectable()
|
||||
export class TestService {
|
||||
constructor(
|
||||
private readonly jobsService: JobsService,
|
||||
private readonly eventBusService: EventBusService,
|
||||
) {}
|
||||
constructor(private readonly unifiedQueueService: UnifiedQueueService) {}
|
||||
|
||||
async publishKafkaEvent(
|
||||
topic: string,
|
||||
data: Record<string, any>,
|
||||
): Promise<void> {
|
||||
await this.eventBusService.publish(topic, {
|
||||
event: 'test-event',
|
||||
data,
|
||||
await this.unifiedQueueService.publishEvent({
|
||||
eventType: topic,
|
||||
aggregateId: 'test-aggregate',
|
||||
aggregateType: 'Test',
|
||||
version: '1.0',
|
||||
occurredAt: new Date().toISOString(),
|
||||
tenantId: '0',
|
||||
idempotencyKey: `key_${Date.now()}`,
|
||||
traceId: `trace_${Date.now()}`,
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,14 +26,14 @@ export class TestService {
|
||||
type: string,
|
||||
payload: Record<string, any>,
|
||||
): Promise<string> {
|
||||
await this.jobsService.enqueue('test-queue', type, payload, {
|
||||
await this.unifiedQueueService.addTask('test-queue', type, payload, {
|
||||
attempts: 3,
|
||||
backoffMs: 1000,
|
||||
backoff: { type: 'fixed', delay: 1000 },
|
||||
removeOnComplete: true,
|
||||
removeOnFail: false,
|
||||
});
|
||||
|
||||
// 生成一个模拟的 job ID
|
||||
// 生成一个模拟的 job ID(测试用)
|
||||
return `job_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user