refactor: 修改 seeder 数据以适配光束线场景

- DatabaseSeeder: 将分组改为十条光束线(BL02U1-BL16U1)
- 修改文档数据为光束线相关内容
- SopTemplateSeeder: 创建光束线操作相关的 SOP 模板
  - 光束线标准开机流程
  - 用户实验准备标准流程
  - 光束线日常维护流程(草稿)
- TerminalSeeder: 为每条光束线创建智慧屏终端
  - 每条光束线对应一个智慧屏终端
  - 配置光束线专用的 AI 助手提示词
  - 设置合理的在线/离线状态
This commit is contained in:
2026-03-12 17:54:51 +08:00
parent f89acbb2dc
commit 06cf30130d
3 changed files with 150 additions and 343 deletions

View File

@@ -67,37 +67,43 @@ class DatabaseSeeder extends Seeder
]);
$user4->assignRole('user');
// 3. 创建分组
$this->command->info('创建分组...');
$techGroup = Group::factory()->create([
'name' => '技术部',
'description' => '负责公司技术研发和系统维护工作',
]);
// 3. 创建分组(按照光束线)
$this->command->info('创建光束线分组...');
$beamlines = [
'BL02U1',
'BL07U',
'BL08U',
'BL13HB',
'BL13U',
'BL14B',
'BL14W',
'BL15U',
'BL16B',
'BL16U1',
];
$marketGroup = Group::factory()->create([
'name' => '市场部',
'description' => '负责市场推广和品牌建设工作',
]);
$hrGroup = Group::factory()->create([
'name' => '人力资源部',
'description' => '负责人力资源管理和员工关系维护',
]);
$groups = [];
foreach ($beamlines as $beamline) {
$groups[$beamline] = Group::factory()->create([
'name' => $beamline,
'description' => null,
]);
}
// 4. 建立用户和分组的关联关系
$this->command->info('建立用户和分组的关联关系...');
// 管理员属于所有分组
$admin->groups()->attach([$techGroup->id, $marketGroup->id, $hrGroup->id]);
// 管理员属于所有光束线分组
$admin->groups()->attach(array_column($groups, 'id'));
// 张三和李四属于技术部
$user1->groups()->attach($techGroup->id);
$user2->groups()->attach($techGroup->id);
// 张三和李四属于 BL02U1
$user1->groups()->attach($groups['BL02U1']->id);
$user2->groups()->attach($groups['BL02U1']->id);
// 王五属于市场部
$user3->groups()->attach($marketGroup->id);
// 王五属于 BL07U
$user3->groups()->attach($groups['BL07U']->id);
// 赵六属于人力资源部
$user4->groups()->attach($hrGroup->id);
// 赵六属于 BL08U
$user4->groups()->attach($groups['BL08U']->id);
// 5. 创建全局文档(仅元数据,不创建实际文件)
$this->command->info('创建全局文档...');
@@ -153,155 +159,64 @@ class DatabaseSeeder extends Seeder
'conversion_status' => 'pending',
]);
// 6. 创建技术部专用文档
$this->command->info('创建技术部专用文档...');
// 6. 创建 BL02U1 光束线专用文档
$this->command->info('创建 BL02U1 光束线专用文档...');
Document::create([
'title' => '系统架构设计文档',
'description' => '公司核心系统的架构设计和技术选型说明',
'title' => 'BL02U1 操作手册',
'description' => 'BL02U1 光束线设备操作规程和注意事项',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '系统架构设计.docx',
'file_name' => 'BL02U1_操作手册.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $techGroup->id,
'group_id' => $groups['BL02U1']->id,
'uploaded_by' => $user1->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '代码规范指南',
'description' => '团队代码编写规范和最佳实践',
'title' => 'BL02U1 维护记录',
'description' => 'BL02U1 光束线设备维护和检修记录',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '代码规范.docx',
'file_name' => 'BL02U1_维护记录.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $techGroup->id,
'uploaded_by' => $admin->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '数据库设计文档',
'description' => '数据库表结构设计和关系说明',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '数据库设计.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $techGroup->id,
'group_id' => $groups['BL02U1']->id,
'uploaded_by' => $user2->id,
'conversion_status' => 'pending',
]);
// 7. 创建 BL07U 光束线专用文档
$this->command->info('创建 BL07U 光束线专用文档...');
Document::create([
'title' => 'API 接口文档',
'description' => '系统对外提供的 API 接口说明和使用示例',
'title' => 'BL07U 操作手册',
'description' => 'BL07U 光束线设备操作规程和注意事项',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => 'API接口文档.docx',
'file_name' => 'BL07U_操作手册.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $techGroup->id,
'uploaded_by' => $user1->id,
'conversion_status' => 'pending',
]);
// 7. 创建市场部专用文档
$this->command->info('创建市场部专用文档...');
Document::create([
'title' => '市场推广方案',
'description' => '2025年第一季度市场推广计划和预算',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '市场推广方案_Q1.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $marketGroup->id,
'group_id' => $groups['BL07U']->id,
'uploaded_by' => $user3->id,
'conversion_status' => 'pending',
]);
// 8. 创建 BL08U 光束线专用文档
$this->command->info('创建 BL08U 光束线专用文档...');
Document::create([
'title' => '品牌宣传策略',
'description' => '品牌定位和宣传渠道策略',
'title' => 'BL08U 操作手册',
'description' => 'BL08U 光束线设备操作规程和注意事项',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '品牌宣传策略.docx',
'file_name' => 'BL08U_操作手册.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $marketGroup->id,
'uploaded_by' => $admin->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '客户调研报告',
'description' => '目标客户群体调研分析报告',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '客户调研报告.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $marketGroup->id,
'uploaded_by' => $user3->id,
'conversion_status' => 'pending',
]);
// 8. 创建人力资源部专用文档
$this->command->info('创建人力资源部专用文档...');
Document::create([
'title' => '招聘流程指南',
'description' => '公司招聘流程和面试评估标准',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '招聘流程指南.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $hrGroup->id,
'group_id' => $groups['BL08U']->id,
'uploaded_by' => $user4->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '员工培训计划',
'description' => '2025年员工培训计划和课程安排',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '员工培训计划_2025.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $hrGroup->id,
'uploaded_by' => $admin->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '薪酬福利制度',
'description' => '公司薪酬结构和福利政策说明',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '薪酬福利制度.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $hrGroup->id,
'uploaded_by' => $user4->id,
'conversion_status' => 'pending',
]);
Document::create([
'title' => '绩效考核标准',
'description' => '员工绩效考核指标和评估流程',
'file_path' => 'documents/' . date('Y/m/d') . '/' . fake()->uuid() . '.docx',
'file_name' => '绩效考核标准.docx',
'file_size' => fake()->numberBetween(100000, 500000),
'mime_type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'type' => 'dedicated',
'group_id' => $hrGroup->id,
'uploaded_by' => $admin->id,
'conversion_status' => 'pending',
]);
$this->command->info('演示数据生成完成!');
// 9. 创建终端数据
@@ -320,9 +235,9 @@ class DatabaseSeeder extends Seeder
$this->command->newLine();
$this->command->info('=== 测试账号信息 ===');
$this->command->info('超级管理员: admin@example.com / password (super-admin)');
$this->command->info('张三(技术部: zhangsan@example.com / password (user)');
$this->command->info('李四(技术部: lisi@example.com / password (user)');
$this->command->info('王五(市场部: wangwu@example.com / password (admin)');
$this->command->info('赵六(人力资源部: zhaoliu@example.com / password (user)');
$this->command->info('张三(BL02U1: zhangsan@example.com / password (user)');
$this->command->info('李四(BL02U1: lisi@example.com / password (user)');
$this->command->info('王五(BL07U: wangwu@example.com / password (admin)');
$this->command->info('赵六(BL08U: zhaoliu@example.com / password (user)');
}
}