feat(health,ai): 后端服务优化 + 媒体文件处理

- erp-health: article/banner/consultation/media 服务层优化
- erp-ai: analysis/insight/prompt 服务增强
- erp-auth: auth/role/token 服务改进
- erp-workflow: executor 执行引擎修复
- erp-plugin: 服务层改进
- 新增媒体上传文件样例
This commit is contained in:
iven
2026-05-13 23:28:57 +08:00
parent e4e5ef04d4
commit 212c08b7ae
30 changed files with 320 additions and 3 deletions

View File

@@ -170,6 +170,7 @@ impl AnalysisService {
active.result_content = Set(Some(content));
active.result_metadata = Set(Some(metadata));
active.updated_at = Set(chrono::Utc::now());
active.version_lock = Set(active.version_lock.unwrap() + 1);
active.update(&self.db).await?;
Ok(())
}
@@ -185,6 +186,7 @@ impl AnalysisService {
active.status = Set("failed".into());
active.error_message = Set(Some(error));
active.updated_at = Set(chrono::Utc::now());
active.version_lock = Set(active.version_lock.unwrap() + 1);
active.update(&self.db).await?;
Ok(())
}

View File

@@ -123,6 +123,7 @@ impl InsightService {
let mut active: copilot_insights::ActiveModel = model.into();
active.deleted_at = Set(Some(now));
active.updated_at = Set(now);
active.version_lock = Set(active.version_lock.unwrap() + 1);
active.update(db).await?;
}
Ok(count)

View File

@@ -161,6 +161,7 @@ impl PromptService {
.filter(ai_prompt::Column::Category.eq(&entity.category))
.filter(ai_prompt::Column::IsActive.eq(true))
.filter(ai_prompt::Column::DeletedAt.is_null())
.filter(ai_prompt::Column::Id.ne(id))
.all(&self.db)
.await?;
@@ -168,6 +169,7 @@ impl PromptService {
let mut active: ai_prompt::ActiveModel = sibling.into();
active.is_active = Set(false);
active.updated_at = Set(chrono::Utc::now());
active.version_lock = Set(active.version_lock.unwrap() + 1);
active.update(&self.db).await?;
}
@@ -175,6 +177,7 @@ impl PromptService {
let mut active: ai_prompt::ActiveModel = entity.into();
active.is_active = Set(true);
active.updated_at = Set(chrono::Utc::now());
active.version_lock = Set(active.version_lock.unwrap() + 1);
Ok(active.update(&self.db).await?)
}