Skip to content

Commit

Permalink
#2469 执行编排,编排空节点查询
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiawei committed Nov 19, 2024
1 parent 8921479 commit c7c8159
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions platform-core/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func init() {
&handlerFuncObj{Url: "/process/definitions/collect/add", Method: "POST", HandlerFunc: process.AddProcDefCollect, ApiCode: "add-proc-collect"},
&handlerFuncObj{Url: "/process/definitions/collect/del", Method: "POST", HandlerFunc: process.DelProcDefCollect, ApiCode: "del-proc-collect"},
&handlerFuncObj{Url: "/process/definitions/sub/list", Method: "POST", HandlerFunc: process.SubProcDefList, ApiCode: "sub-proc-list"},
&handlerFuncObj{Url: "/process/definitions/nodes/empty-query", Method: "GET", HandlerFunc: process.QueryEmptyNodes, ApiCode: "query-empty-node"},
// process runtime
&handlerFuncObj{Url: "/process/definitions", Method: "GET", HandlerFunc: process.ProcDefList, ApiCode: "list-process-def"},

Expand Down
28 changes: 28 additions & 0 deletions platform-core/api/v1/process/manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1734,3 +1734,31 @@ func DelProcDefCollect(c *gin.Context) {
middleware.ReturnSuccess(c)
}
}

func QueryEmptyNodes(c *gin.Context) {
var nodeIds, result []string
var err error
var procDefNodes []*models.ProcDefNode
processSessionId := c.Query("processSessionId")
procDefId := c.Query("procDefId")
if strings.TrimSpace(processSessionId) == "" || strings.TrimSpace(procDefId) == "" {
middleware.ReturnError(c, exterror.Catch(exterror.New().RequestParamValidateError, fmt.Errorf("processSessionId or procDefId empty")))
return
}
if procDefNodes, err = database.GetProcDefNodeById(c, procDefId); err != nil {
middleware.ReturnError(c, err)
return
}
if nodeIds, err = database.GetProcDefNodeIdsBySessionId(c, processSessionId); err != nil {
middleware.ReturnError(c, err)
return
}
for _, node := range procDefNodes {
if node.NodeType == string(models.ProcDefNodeTypeAutomatic) || node.NodeType == string(models.ProcDefNodeSubProcess) || node.NodeType == string(models.ProcDefNodeTypeData) {
if !tools.Contains(nodeIds, node.Id) {
result = append(result, node.Name)
}
}
}
middleware.ReturnData(c, result)
}
10 changes: 10 additions & 0 deletions platform-core/common/tools/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,13 @@ func RSADecrypt(inputString, rsaPemContent string) (string, error) {
result = string(decodeBytes)
return result, nil
}

func Contains(ids []string, id string) bool {
var exist = false
for _, item := range ids {
if item == id {
exist = true
}
}
return exist
}
5 changes: 5 additions & 0 deletions platform-core/services/database/process-exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ func CreateProcPreview(ctx context.Context, previewRows []*models.ProcDataPrevie
return
}

func GetProcDefNodeIdsBySessionId(ctx context.Context, sessionId string) (result []string, err error) {
err = db.MysqlEngine.Context(ctx).SQL("select proc_def_node_id from proc_data_preview where proc_session_id=?", sessionId).Find(&result)
return
}

func ProcInsTaskNodeBindings(ctx context.Context, sessionId, taskNodeId string) (result []*models.TaskNodeBindingObj, err error) {
var previewRows []*models.ProcDataPreview
nodeBindDataMap := make(map[string][]*models.ProcDataBinding)
Expand Down
2 changes: 1 addition & 1 deletion wecube-portal/src/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
data() {
return {
username: '',
password: '',
***REMOVED***
encryptKey: '',
loading: false,
showRoleApply: false,
Expand Down

0 comments on commit c7c8159

Please sign in to comment.