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

@@ -193,6 +193,7 @@ impl PluginService {
// 更新状态
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.status = Set("installed".to_string());
active.installed_at = Set(Some(now));
active.updated_at = Set(now);
@@ -246,6 +247,7 @@ impl PluginService {
let now = Utc::now();
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.status = Set("running".to_string());
active.enabled_at = Set(Some(now));
active.updated_at = Set(now);
@@ -276,6 +278,7 @@ impl PluginService {
let now = Utc::now();
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.status = Set("disabled".to_string());
active.updated_at = Set(now);
active.updated_by = Set(Some(operator_id));
@@ -313,6 +316,7 @@ impl PluginService {
for entity in &tenant_entities {
let mut active: plugin_entity::ActiveModel = entity.clone().into();
active.version = Set(bump_version(&active.version));
active.deleted_at = Set(Some(now));
active.updated_at = Set(now);
active.updated_by = Set(Some(operator_id));
@@ -346,6 +350,7 @@ impl PluginService {
unregister_plugin_permissions(db, tenant_id, &manifest.metadata.id).await?;
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.status = Set("uninstalled".to_string());
active.updated_at = Set(now);
active.updated_by = Set(Some(operator_id));
@@ -459,6 +464,7 @@ impl PluginService {
let now = Utc::now();
let manifest_id = manifest.metadata.id.clone();
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.config_json = Set(config);
active.updated_at = Set(now);
active.updated_by = Set(Some(operator_id));
@@ -563,6 +569,7 @@ impl PluginService {
validate_status_any(&model.status, &["uninstalled", "uploaded"])?;
let now = Utc::now();
let mut active: plugin::ActiveModel = model.into();
active.version = Set(bump_version(&active.version));
active.deleted_at = Set(Some(now));
active.updated_at = Set(now);
active.updated_by = Set(Some(operator_id));
@@ -693,6 +700,7 @@ impl PluginService {
if let Some(em) = entity_model {
let mut active: plugin_entity::ActiveModel = em.into();
active.version = Set(bump_version(&active.version));
active.schema_json = Set(serde_json::to_value(entity)
.map_err(|e| PluginError::InvalidManifest(e.to_string()))?);
active.updated_at = Set(now);