Skip to content

fix(workflow): correct current step assignee logic and handle rejecte…#618

Merged
LordofAvernus merged 1 commit into
mainfrom
fix_data_export_assignee_users_ce
May 15, 2026
Merged

fix(workflow): correct current step assignee logic and handle rejecte…#618
LordofAvernus merged 1 commit into
mainfrom
fix_data_export_assignee_users_ce

Conversation

@iwanghc
Copy link
Copy Markdown
Collaborator

@iwanghc iwanghc commented May 15, 2026

User description

…d status

关联的 issue

https://github.com/actiontech/dms-ee/issues/830

描述你的变更

修复数据导出工单驳回和关闭后受让人显示不正确

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 使用新函数统一获取工单当前步骤受让人

  • 修正驳回、关闭后受让人显示错误

  • 优化数据库查询以支持驳回状态工单


Diagram Walkthrough

flowchart LR
  A["更新服务逻辑"]
  B["新增 dataExportWorkflowCurrentStepAssigneeUsers"]
  C["修改 SQL 查询,支持驳回"]
  A -- "调用辅助函数" --> B
  B -- "返回正确受让人数据" --> C
Loading

File Walkthrough

Relevant files
Enhancement
data_export_workflow.go
服务层受让人逻辑重构与函数新增                                                                                   

internal/dms/service/data_export_workflow.go

  • 替换原有受让人设置逻辑
  • 引入 dataExportWorkflowCurrentStepAssigneeUsers 函数
  • 新增 isDataExportWorkflowTerminalStatus 辅助函数判断终态
+31/-16 
workflow.go
数据导出工单查询逻辑优化                                                                                         

internal/dms/storage/workflow.go

  • 调整 SQL 查询,增加 UNION 查询驳回状态
  • 确保工单数据完整性
+6/-1     

@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
添加 nil 参数检查

建议在 dataExportWorkflowCurrentStepAssigneeUsers 函数开始处增加对 w 是否为 nil 的判断,防止在访问 w.Status
时发生空指针异常。这样修改后可以确保即使传入 nil 参数时,函数也能安全返回,不引发 panic。

internal/dms/service/data_export_workflow.go [375-390]

 func (d *DMSService) dataExportWorkflowCurrentStepAssigneeUsers(ctx context.Context, w *biz.Workflow) []dmsV1.UidWithName {
+	if w == nil {
+		return nil
+	}
 	if isDataExportWorkflowTerminalStatus(w.Status) {
 		return nil
 	}
 	if w.Status == string(dmsV1.DataExportWorkflowStatusWaitForExport) ||
 		w.Status == string(dmsV1.DataExportWorkflowStatusWaitForExporting) ||
 		w.Status == string(dmsV1.DataExportWorkflowStatusRejected) {
 		// wait_for_export/wait_for_exporting/rejected 状态下,待操作人为工单创建者
 		return convertBizUidWithName(d.UserUsecase.GetBizUserIncludeDeletedWithNameByUids(ctx, []string{w.CreateUserUID}))
 	}
 	if w.WorkflowRecord != nil && w.WorkflowRecord.CurrentWorkflowStepId > 0 &&
 		int(w.WorkflowRecord.CurrentWorkflowStepId-1) < len(w.WorkflowRecord.WorkflowSteps) {
 		return convertBizUidWithName(d.UserUsecase.GetBizUserIncludeDeletedWithNameByUids(ctx, w.WorkflowRecord.WorkflowSteps[w.WorkflowRecord.CurrentWorkflowStepId-1].Assignees))
 	}
 	return nil
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion enhances function safety by adding a nil check for w before accessing its fields, preventing potential panic. This defensive check improves robustness without altering the function’s core logic.

Medium

@LordofAvernus LordofAvernus merged commit c922690 into main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants