Skip to content

Commit

Permalink
#114 Add workflow execution association request
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiawei committed Oct 11, 2024
1 parent 3e7a53c commit 7f48556
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions taskman-server/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func init() {
&handlerFuncObj{Url: "/request-status/:requestId/:status", Method: "POST", HandlerFunc: request.UpdateRequestStatus},
&handlerFuncObj{Url: "/request-data/reference/query/:formItemTemplateId/:requestId/:attrName", Method: "POST", HandlerFunc: request.GetReferenceData},
&handlerFuncObj{Url: "/request-data/entity/expression/query/:formItemTemplateId/:rootDataId", Method: "GET", HandlerFunc: request.GetExpressionItemData},
&handlerFuncObj{Url: "/workflow/request", Method: "GET", HandlerFunc: request.GetWorkflowRequest},

&handlerFuncObj{Url: "/user/platform/count", Method: "POST", HandlerFunc: request.CountPlatform},
&handlerFuncObj{Url: "/user/platform/filter-item", Method: "POST", HandlerFunc: request.FilterItem},
Expand Down
16 changes: 16 additions & 0 deletions taskman-server/api/v1/request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,19 @@ func Association(c *gin.Context) {
}
middleware.ReturnPageData(c, pageInfo, rowsData)
}

// GetWorkflowRequest 查询编排关联请求
func GetWorkflowRequest(c *gin.Context) {
var result []*models.RequestTable
var err error
procInstanceId := c.Query("procInstanceId")
if strings.TrimSpace(procInstanceId) == "" {
middleware.ReturnSuccess(c)
return
}
if result, err = service.GetRequestService().GetWorkflowRequest(procInstanceId); err != nil {
middleware.ReturnError(c, err)
return
}
middleware.ReturnData(c, result)
}
10 changes: 9 additions & 1 deletion taskman-server/dao/request_dao.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package dao

import "xorm.io/xorm"
import (
"github.com/WeBankPartners/wecube-plugins-taskman/taskman-server/models"
"xorm.io/xorm"
)

type RequestDao struct {
DB *xorm.Engine
}

func (d *RequestDao) QueryRequestByProcInstanceId(procInstanceId string) (result []*models.RequestTable, err error) {
err = d.DB.SQL("select id,name,request_template from request where proc_instance_id = ?", procInstanceId).Find(&result)
return
}
4 changes: 4 additions & 0 deletions taskman-server/service/request_service_new.go
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,10 @@ func (s *RequestService) Association(param models.RequestAssociationParam) (page
return
}

func (s *RequestService) GetWorkflowRequest(procInstanceId string) (result []*models.RequestTable, err error) {
return s.requestDao.QueryRequestByProcInstanceId(procInstanceId)
}

// calcShowRequestRevokeButton 计算是否出请求撤回按钮
func calcShowRequestRevokeButton(requestId, requestStatus string) bool {
var taskList []*models.TaskTable
Expand Down
3 changes: 3 additions & 0 deletions wiki/db/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -616,3 +616,6 @@ alter table request add column preview_cache mediumtext default null comment '
#@v1.1.2-begin@;
alter table form_item_template add column formula varchar(255) default null comment '表达式计算';
#@v1.1.2-end@;
#@v1.2.4-begin@;
alter table request add index request_proc_instance_id(proc_instance_id);
#@v1.2.4-end@;

0 comments on commit 7f48556

Please sign in to comment.