Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flow: improve log #881

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions backend/middlewares/flow/src/api/cc/flow_cc_inst_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ impl FlowCcInstApi {
TardisResp::ok(result)
}

/// Start Instance(Return Instance)
///
/// 启动实例(返回实例)
#[oai(path = "/start_and_get", method = "post")]
async fn start_and_get(&self, add_req: Json<FlowInstStartReq>, ctx: TardisContextExtractor, _request: &Request) -> TardisApiResult<FlowInstDetailResp> {
let mut funs = flow_constants::get_tardis_inst();
funs.begin().await?;
let inst_id = FlowInstServ::start(&add_req.0, None, &funs, &ctx.0).await?;
let result = FlowInstServ::get(&inst_id, &funs, &ctx.0).await?;
funs.commit().await?;
ctx.0.execute_task().await?;
TardisResp::ok(result)
}

/// Abort Instance
///
/// 终止实例
Expand Down Expand Up @@ -261,14 +275,14 @@ impl FlowCcInstApi {
///
/// 添加评论
#[oai(path = "/:flow_inst_id/add_comment", method = "post")]
async fn add_comment(&self, flow_inst_id: Path<String>, comment_req: Json<FlowInstCommentReq>, ctx: TardisContextExtractor, _request: &Request) -> TardisApiResult<Void> {
async fn add_comment(&self, flow_inst_id: Path<String>, comment_req: Json<FlowInstCommentReq>, ctx: TardisContextExtractor, _request: &Request) -> TardisApiResult<String> {
let mut funs = flow_constants::get_tardis_inst();
let inst = FlowInstServ::get(&flow_inst_id.0, &funs, &ctx.0).await?;
funs.begin().await?;
FlowInstServ::add_comment(&inst, &comment_req.0, &funs, &ctx.0).await?;
let result = FlowInstServ::add_comment(&inst, &comment_req.0, &funs, &ctx.0).await?;
funs.commit().await?;
ctx.0.execute_task().await?;
TardisResp::ok(Void {})
TardisResp::ok(result)
}

/// Search Items
Expand Down
31 changes: 17 additions & 14 deletions backend/middlewares/flow/src/dto/flow_inst_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub struct FlowInstSummaryResp {
pub rel_business_obj_id: String,
/// 当前状态ID
pub current_state_id: String,
/// 当前状态名
pub current_state_name: String,
/// 创建上下文信息
pub create_ctx: FlowOperationContext,
/// 创建时间
Expand Down Expand Up @@ -225,26 +227,24 @@ pub struct FlowInstArtifacts {
pub approval_total: Option<HashMap<String, usize>>, // 审批总数
pub form_state_map: HashMap<String, HashMap<String, Value>>, // 录入节点映射 key为节点ID,对应的value为节点中的录入的参数
pub curr_vars: Option<HashMap<String, Value>>, // 当前参数列表
pub prev_non_auto_state_id: Option<String>, // 上一个非自动节点ID
pub prev_non_auto_state_id: Option<Vec<String>>, // 上一个非自动节点ID列表
pub prev_non_auto_account_id: Option<String>, // 上一个节点操作人ID
}

// 流程实例中数据存储更新
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug, Default, sea_orm::FromJsonQueryResult)]
pub struct FlowInstArtifactsModifyReq {
pub guard_conf: Option<FlowGuardConf>, // 当前操作人权限
pub add_prohibit_guard_conf_account_id: Option<String>, // 增加禁止操作人ID
pub delete_prohibit_guard_conf_account_id: Option<String>, // 删除禁止操作人ID
pub add_guard_conf_account_id: Option<String>, // 增加操作人ID
pub delete_guard_conf_account_id: Option<String>, // 删除操作人ID
pub add_approval_result: Option<(String, FlowApprovalResultKind)>, // 增加审批结果
pub form_state_map: Option<HashMap<String, Value>>, // 录入节点映射 key为节点ID,对应的value为节点中的录入的参数
pub clear_form_result: Option<String>, // 清除节点录入信息
pub clear_approval_result: Option<String>, // 清除节点审批信息
pub prev_non_auto_state_id: Option<String>, // 上一个非自动节点ID
pub prev_non_auto_account_id: Option<String>, // 上一个节点操作人ID
pub curr_approval_total: Option<usize>, // 当前审批总数
pub curr_vars: Option<HashMap<String, Value>>, // 当前参数列表
pub guard_conf: Option<FlowGuardConf>, // 当前操作人权限
pub prohibit_guard_conf_account_ids: Option<Vec<String>>, // 禁止操作人ID列表
pub guard_conf_account_ids: Option<Vec<String>>, // 更新操作人列表
pub add_approval_result: Option<(String, FlowApprovalResultKind)>, // 增加审批结果
pub form_state_map: Option<HashMap<String, Value>>, // 录入节点映射 key为节点ID,对应的value为节点中的录入的参数
pub clear_form_result: Option<String>, // 清除节点录入信息
pub clear_approval_result: Option<String>, // 清除节点录入信息
pub prev_non_auto_state_id: Option<Vec<String>>, // 上一个非自动节点ID
pub prev_non_auto_account_id: Option<String>, // 上一个节点操作人ID
pub curr_approval_total: Option<usize>, // 当前审批总数
pub curr_vars: Option<HashMap<String, Value>>, // 当前参数列表
}

/// 审批结果类型
Expand Down Expand Up @@ -474,6 +474,7 @@ pub struct FlowInstOperateReq {
#[serde(default)]
pub struct FlowInstFilterReq {
pub ids: Option<Vec<String>>,
pub code: Option<String>,
/// 关联模型ID
pub flow_version_id: Option<String>,
/// 业务ID
Expand Down Expand Up @@ -501,6 +502,7 @@ pub struct FlowInstSummaryResult {

pub current_vars: Option<Value>,
pub current_state_id: String,
pub current_state_name: String,
pub rel_business_obj_id: String,

pub create_ctx: Value,
Expand All @@ -521,6 +523,7 @@ pub struct FlowInstSummaryResult {
/// 实例的评论信息
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, poem_openapi::Object, sea_orm::FromJsonQueryResult)]
pub struct FlowInstCommentInfo {
pub id: Option<String>,
/// 输出信息
pub output_message: String,
/// 评价人上下文
Expand Down
2 changes: 0 additions & 2 deletions backend/middlewares/flow/src/dto/flow_state_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ pub struct FlowStateCountersignConf {
pub kind: FlowStateCountersignKind,
/// 多数人通过比例
pub most_percent: Option<usize>,
/// 审批人权限配置
pub guard_custom_conf: Option<FlowGuardConf>,
/// 指定人通过即通过
pub specified_pass_guard: Option<bool>,
pub specified_pass_guard_conf: Option<FlowGuardConf>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl FlowLogClient {
("CTS", "idp_test_cts"),
("TP", "idp_test_plan"),
("TS", "idp_test_stage"),
("FLOW", "flow_approval_edit"),
]);
flow_tag_map.get(tag).map_or("".to_string(), |val| val.to_string())
}
Expand Down
Loading
Loading