修复获取下一审批节点

This commit is contained in:
xiangheng
2024-07-03 17:06:46 +08:00
parent 4eb8624410
commit 41ca306d17
5 changed files with 128 additions and 110 deletions

View File

@@ -140,8 +140,9 @@ func (hd FlowHistoryHandler) Del(c *gin.Context) {
} }
// 提交申请,通过审批 // 提交申请,通过审批
// @Tags flow_history-流程历史
// //
// @Router /api/admin/flow_apply/pass [post] // @Router /api/admin/flow/flow_apply/pass [post]
func (hd FlowHistoryHandler) Pass(c *gin.Context) { func (hd FlowHistoryHandler) Pass(c *gin.Context) {
var pass PassReq var pass PassReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &pass)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &pass)) {
@@ -153,7 +154,9 @@ func (hd FlowHistoryHandler) Pass(c *gin.Context) {
} }
// 拒绝审批 // 拒绝审批
// @Router /api/admin/flow_apply/back [post] // @Tags flow_history-流程历史
//
// @Router /api/admin/flow/flow_apply/back [post]
func (hd FlowHistoryHandler) Back(c *gin.Context) { func (hd FlowHistoryHandler) Back(c *gin.Context) {
var back BackReq var back BackReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &back)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &back)) {
@@ -192,7 +195,3 @@ func (hd FlowHistoryHandler) GetApprover(c *gin.Context) {
} }
response.OkWithData(c, res) response.OkWithData(c, res)
} }
// 同意审批(当前nodeId)
// 拒绝审批,驳回审批

View File

@@ -520,22 +520,22 @@ func (service flowHistoryService) GetNextNode(ApplyId int) (res []FlowTree, appl
} }
} }
} }
var nextNodes []FlowTree res = DeepNextNode(&next, formValue)
res = DeepNextNode(nextNodes, &next, formValue)
return res, applyDetail, LastHistory, e return res, applyDetail, LastHistory, e
} }
// 返回节点数组,最后一个节点为用户或结束节点 // 返回节点数组,最后一个节点为用户或结束节点
func DeepNextNode(nextNodes []FlowTree, flowTree *[]FlowTree, formValue map[string]interface{}) []FlowTree { func DeepNextNode(flowTree *[]FlowTree, formValue map[string]interface{}) []FlowTree {
var nextNodes []FlowTree
for _, v := range *flowTree { for _, v := range *flowTree {
if v.Type == "bpmn:startEvent" { if v.Type == "bpmn:startEvent" {
// nextNodes = append(nextNodes, v) nextNodes = append(nextNodes, v)
// 开始节点 // 开始节点
if v.Children == nil { if v.Children == nil {
break break
} }
child := DeepNextNode(nextNodes, v.Children, formValue) child := DeepNextNode(v.Children, formValue)
nextNodes = append(nextNodes, child...) nextNodes = append(nextNodes, child...)
break break
} else if v.Type == "bpmn:exclusiveGateway" { } else if v.Type == "bpmn:exclusiveGateway" {
@@ -600,7 +600,7 @@ func DeepNextNode(nextNodes []FlowTree, flowTree *[]FlowTree, formValue map[stri
break break
} }
// 判断formValue值决定是不是递归这个网关 // 判断formValue值决定是不是递归这个网关
child := DeepNextNode(nextNodes, v.Children, formValue) child := DeepNextNode(v.Children, formValue)
nextNodes = append(nextNodes, child...) nextNodes = append(nextNodes, child...)
break break
} }
@@ -610,7 +610,7 @@ func DeepNextNode(nextNodes []FlowTree, flowTree *[]FlowTree, formValue map[stri
break break
} }
// 系统服务 // 系统服务
child := DeepNextNode(nextNodes, v.Children, formValue) child := DeepNextNode(v.Children, formValue)
nextNodes = append(nextNodes, child...) nextNodes = append(nextNodes, child...)
} else if v.Type == "bpmn:userTask" { } else if v.Type == "bpmn:userTask" {
//用户节点 //用户节点

View File

@@ -124,6 +124,14 @@ const docTemplate = `{
} }
} }
}, },
"/api/admin/flow/flow_apply/back": {
"post": {
"tags": [
"flow_history-流程历史"
],
"responses": {}
}
},
"/api/admin/flow/flow_apply/del": { "/api/admin/flow/flow_apply/del": {
"post": { "post": {
"produces": [ "produces": [
@@ -437,6 +445,14 @@ const docTemplate = `{
} }
} }
}, },
"/api/admin/flow/flow_apply/pass": {
"post": {
"tags": [
"flow_history-流程历史"
],
"responses": {}
}
},
"/api/admin/flow/flow_history/add": { "/api/admin/flow/flow_history/add": {
"post": { "post": {
"produces": [ "produces": [
@@ -593,6 +609,7 @@ const docTemplate = `{
"parameters": [ "parameters": [
{ {
"type": "string", "type": "string",
"default": "{{Token}}",
"description": "token", "description": "token",
"name": "Token", "name": "Token",
"in": "header", "in": "header",
@@ -1225,16 +1242,6 @@ const docTemplate = `{
"responses": {} "responses": {}
} }
}, },
"/api/admin/flow_apply/back": {
"post": {
"responses": {}
}
},
"/api/admin/flow_apply/pass": {
"post": {
"responses": {}
}
},
"/api/admin/monitor_client/ExportFile": { "/api/admin/monitor_client/ExportFile": {
"get": { "get": {
"produces": [ "produces": [

View File

@@ -118,6 +118,14 @@
} }
} }
}, },
"/api/admin/flow/flow_apply/back": {
"post": {
"tags": [
"flow_history-流程历史"
],
"responses": {}
}
},
"/api/admin/flow/flow_apply/del": { "/api/admin/flow/flow_apply/del": {
"post": { "post": {
"produces": [ "produces": [
@@ -431,6 +439,14 @@
} }
} }
}, },
"/api/admin/flow/flow_apply/pass": {
"post": {
"tags": [
"flow_history-流程历史"
],
"responses": {}
}
},
"/api/admin/flow/flow_history/add": { "/api/admin/flow/flow_history/add": {
"post": { "post": {
"produces": [ "produces": [
@@ -587,6 +603,7 @@
"parameters": [ "parameters": [
{ {
"type": "string", "type": "string",
"default": "{{Token}}",
"description": "token", "description": "token",
"name": "Token", "name": "Token",
"in": "header", "in": "header",
@@ -1219,16 +1236,6 @@
"responses": {} "responses": {}
} }
}, },
"/api/admin/flow_apply/back": {
"post": {
"responses": {}
}
},
"/api/admin/flow_apply/pass": {
"post": {
"responses": {}
}
},
"/api/admin/monitor_client/ExportFile": { "/api/admin/monitor_client/ExportFile": {
"get": { "get": {
"produces": [ "produces": [

View File

@@ -307,6 +307,11 @@ paths:
summary: 申请流程新增 summary: 申请流程新增
tags: tags:
- flow_apply-申请流程 - flow_apply-申请流程
/api/admin/flow/flow_apply/back:
post:
responses: {}
tags:
- flow_history-流程历史
/api/admin/flow/flow_apply/del: /api/admin/flow/flow_apply/del:
post: post:
parameters: parameters:
@@ -501,6 +506,11 @@ paths:
summary: 申请流程列表 summary: 申请流程列表
tags: tags:
- flow_apply-申请流程 - flow_apply-申请流程
/api/admin/flow/flow_apply/pass:
post:
responses: {}
tags:
- flow_history-流程历史
/api/admin/flow/flow_history/add: /api/admin/flow/flow_history/add:
post: post:
parameters: parameters:
@@ -595,7 +605,8 @@ paths:
/api/admin/flow/flow_history/detail: /api/admin/flow/flow_history/detail:
get: get:
parameters: parameters:
- description: token - default: '{{Token}}'
description: token
in: header in: header
name: Token name: Token
required: true required: true
@@ -991,12 +1002,6 @@ paths:
summary: 流程模板列表-所有 summary: 流程模板列表-所有
tags: tags:
- flow_template-流程模板 - flow_template-流程模板
/api/admin/flow_apply/back:
post:
responses: {}
/api/admin/flow_apply/pass:
post:
responses: {}
/api/admin/monitor_client/ExportFile: /api/admin/monitor_client/ExportFile:
get: get:
parameters: parameters: