diff --git a/middleware/flow/src/dto/flow_inst_dto.rs b/middleware/flow/src/dto/flow_inst_dto.rs index f8f240fa2..ba588c792 100644 --- a/middleware/flow/src/dto/flow_inst_dto.rs +++ b/middleware/flow/src/dto/flow_inst_dto.rs @@ -87,6 +87,8 @@ pub struct FlowInstDetailResp { pub current_state_id: String, pub current_state_name: Option, pub current_state_color: Option, + pub current_state_kind: Option, + pub current_state_ext: Option, pub current_assigned: Option, pub current_vars: Option>, diff --git a/middleware/flow/src/serv/flow_inst_serv.rs b/middleware/flow/src/serv/flow_inst_serv.rs index 8bdeb170d..f849eff40 100644 --- a/middleware/flow/src/serv/flow_inst_serv.rs +++ b/middleware/flow/src/serv/flow_inst_serv.rs @@ -308,6 +308,8 @@ impl FlowInstServ { pub current_state_id: String, pub current_state_name: Option, pub current_state_color: Option, + pub current_state_kind: Option, + pub current_state_ext: Option, pub current_assigned: Option, pub current_vars: Option, @@ -330,6 +332,7 @@ impl FlowInstServ { let rel_state_table = Alias::new("rel_state"); let flow_state_table = Alias::new("flow_state"); let rel_model_table = Alias::new("rel_model"); + let rbum_rel_table = Alias::new("rbum_rel"); let mut query = Query::select(); query .columns([ @@ -351,6 +354,8 @@ impl FlowInstServ { ]) .expr_as(Expr::col((rel_state_table.clone(), NAME_FIELD.clone())).if_null(""), Alias::new("current_state_name")) .expr_as(Expr::col((flow_state_table.clone(), Alias::new("color"))).if_null(""), Alias::new("current_state_color")) + .expr_as(Expr::col((flow_state_table.clone(), Alias::new("sys_state"))).if_null(""), Alias::new("current_state_kind")) + .expr_as(Expr::col((rbum_rel_table.clone(), Alias::new("ext"))).if_null(""), Alias::new("current_state_ext")) .expr_as(Expr::col((rel_model_table.clone(), NAME_FIELD.clone())).if_null(""), Alias::new("rel_flow_model_name")) .from(flow_inst::Entity) .join_as( @@ -377,6 +382,15 @@ impl FlowInstServ { .add(Expr::col((rel_model_table.clone(), REL_KIND_ID_FIELD.clone())).eq(FlowModelServ::get_rbum_kind_id().unwrap())) .add(Expr::col((rel_model_table.clone(), REL_DOMAIN_ID_FIELD.clone())).eq(FlowModelServ::get_rbum_domain_id().unwrap())), ) + .join_as( + JoinType::LeftJoin, + rbum_rel_table.clone(), + rbum_rel_table.clone(), + Cond::all() + .add(Expr::col((rbum_rel_table.clone(), Alias::new("to_rbum_item_id"))).equals((flow_inst::Entity, flow_inst::Column::CurrentStateId))) + .add(Expr::col((rbum_rel_table.clone(), Alias::new("from_rbum_id"))).equals((flow_inst::Entity, flow_inst::Column::RelFlowModelId))) + .add(Expr::col((rbum_rel_table.clone(), Alias::new("tag"))).eq("FlowModelState".to_string())), + ) .and_where(Expr::col((flow_inst::Entity, flow_inst::Column::Id)).is_in(flow_inst_ids)) .and_where(Expr::col((flow_inst::Entity, flow_inst::Column::OwnPaths)).like(format!("{}%", ctx.own_paths))); @@ -399,6 +413,8 @@ impl FlowInstServ { current_state_id: inst.current_state_id, current_state_name: inst.current_state_name, current_state_color: inst.current_state_color, + current_state_kind: inst.current_state_kind, + current_state_ext: inst.current_state_ext, current_assigned: inst.current_assigned, current_vars: inst.current_vars.map(|current_vars| TardisFuns::json.json_to_obj(current_vars).unwrap()), rel_business_obj_id: inst.rel_business_obj_id, @@ -1107,7 +1123,7 @@ impl FlowInstServ { spec_flow_transition_id: Option, req_vars: &Option>, skip_filter: bool, - funs: &TardisFunsInst, + _funs: &TardisFunsInst, ctx: &TardisContext, ) -> TardisResult { let flow_model_transitions = flow_model.transitions(); @@ -1188,36 +1204,14 @@ impl FlowInstServ { double_check: model_transition.double_check(), }) .collect_vec(); - let current_flow_state = FlowStateServ::find_one_item( - &FlowStateFilterReq { - basic: RbumBasicFilterReq { - ids: Some(vec![flow_inst.current_state_id.to_string()]), - with_sub_own_paths: true, - own_paths: Some("".to_string()), - ..Default::default() - }, - ..Default::default() - }, - funs, - ctx, - ) - .await? - .ok_or_else(|| funs.err().not_found("flow_inst", "do_find_next_transitions", "flow state is not found", "404-flow-state-not-found"))?; let state_and_next_transitions = FlowInstFindStateAndTransitionsResp { flow_inst_id: flow_inst.id.to_string(), finish_time: flow_inst.finish_time, current_flow_state_name: flow_inst.current_state_name.as_ref().unwrap_or(&"".to_string()).to_string(), - current_flow_state_kind: current_flow_state.sys_state.clone(), - current_flow_state_color: current_flow_state.color.clone(), - current_flow_state_ext: TardisFuns::json.str_to_obj::( - &FlowRelServ::find_from_simple_rels(&FlowRelKind::FlowModelState, &flow_inst.rel_flow_model_id, None, None, funs, ctx) - .await? - .into_iter() - .find(|rel| current_flow_state.id == rel.rel_id) - .ok_or_else(|| funs.err().not_found("flow_inst", "do_find_next_transitions", "flow state is not found", "404-flow-state-not-found"))? - .ext, - )?, + current_flow_state_color: flow_inst.current_state_color.as_ref().unwrap_or(&"".to_string()).to_string(), + current_flow_state_kind: flow_inst.current_state_kind.as_ref().unwrap_or(&FlowSysStateKind::Start).clone(), + current_flow_state_ext: TardisFuns::json.str_to_obj::(&flow_inst.current_state_ext.clone().unwrap_or_default())?, next_flow_transitions: next_transitions, }; Ok(state_and_next_transitions) diff --git a/services/bios-all/config/locale/zh-cn.basic b/services/bios-all/config/locale/zh-cn.basic index b6bbd395a..d5c182c83 100644 --- a/services/bios-all/config/locale/zh-cn.basic +++ b/services/bios-all/config/locale/zh-cn.basic @@ -36,6 +36,7 @@ 400-rbum-cert-sk-vcode-only-one 凭证密钥与动态码只能二选一 400-rbum-cert-reset-sk-duplicate 重置密钥不能重复 400-rbum-cert-sk-contains-ak 密码不能包含用户名 +400-rbum-cert-lock 账号已锁定 401-rbum-cert-lock 账号已锁定 409-rbum-cert-sk-expire 凭证密钥已过期 404-rbum-cert-conf-not-exist 找不到对应的凭证配置 diff --git a/spi/spi-conf/src/conf_config.rs b/spi/spi-conf/src/conf_config.rs index 39b27ebcb..fedc15b8a 100644 --- a/spi/spi-conf/src/conf_config.rs +++ b/spi/spi-conf/src/conf_config.rs @@ -1,7 +1,7 @@ -use std::net::IpAddr; -use ipnet::IpNet; use bios_basic::rbum::rbum_config::RbumConfig; +use ipnet::IpNet; use serde::{Deserialize, Serialize}; +use std::net::IpAddr; use tardis::consts::{IP_LOCALHOST, IP_UNSPECIFIED}; use crate::dto::conf_auth_dto::RegisterRequest; diff --git a/support/iam/src/console_tenant/api/iam_ct_role_api.rs b/support/iam/src/console_tenant/api/iam_ct_role_api.rs index 8ee6cbfbf..c9688dc00 100644 --- a/support/iam/src/console_tenant/api/iam_ct_role_api.rs +++ b/support/iam/src/console_tenant/api/iam_ct_role_api.rs @@ -119,7 +119,6 @@ impl IamCtRoleApi { TardisResp::ok(result) } - /// 聚合查询租户及基础项目角色 Find Roles base app #[oai(path = "/base_app", method = "get")] async fn find_role_base_app( @@ -133,9 +132,7 @@ impl IamCtRoleApi { let funs = iam_constants::get_tardis_inst(); let app_result = IamRoleServ::find_items( &IamRoleFilterReq { - basic: RbumBasicFilterReq { - ..Default::default() - }, + basic: RbumBasicFilterReq { ..Default::default() }, kind: Some(IamRoleKind::App), in_base: Some(true), ..Default::default() @@ -145,12 +142,10 @@ impl IamCtRoleApi { &funs, &ctx.0, ) - .await?; + .await?; let tenant_result = IamRoleServ::find_items( &IamRoleFilterReq { - basic: RbumBasicFilterReq { - ..Default::default() - }, + basic: RbumBasicFilterReq { ..Default::default() }, // kind: Some(IamRoleKind::Tenant), in_base: Some(false), ..Default::default() @@ -160,7 +155,7 @@ impl IamCtRoleApi { &funs, &ctx.0, ) - .await?; + .await?; ctx.0.execute_task().await?; let mut result = vec![]; result.extend(tenant_result);