ソースを参照

添加通过流程ID批量查询流程列表的接口

haolongfei 4 ヶ月 前
コミット
a1bd5353f9

+ 25 - 0
ng_cws_client/api.go

@@ -56,6 +56,7 @@ func getWorkTemplateInfoByBusinessTypeApi(businessType string, tenantId string)
 	return respInfo.Info.WorkTemplateId, nil
 }
 
+// 条件查询流程列表信息
 func getWorkflowListApi(reqParams *request.QueryMyWorkflowParams) (*response.InfosResponse[response.WorkflowInfo], error) {
 	queryParams := map[string]string{
 		"pageNo":             strconv.Itoa(reqParams.PageNo),
@@ -84,3 +85,27 @@ func getWorkflowListApi(reqParams *request.QueryMyWorkflowParams) (*response.Inf
 	}
 	return respInfo, nil
 }
+
+// 通过流程ID批量查询流程列表信息
+func getWorkflowListByWorkflowIdListApi(reqParams *request.QueryWorkflowByIDs) (*response.InfosResponse[response.WorkflowInfo], error) {
+	requestJson, err := json.Marshal(reqParams)
+	if err != nil {
+		return nil, err
+	}
+	postResponse, err := NGCwsClient.NewRequest(http_client.WithNewRequestTimeout(cwsTimeOut)).
+		Post(cwsUrl+service.GetWorkflowListByWorkflowIdList, requestJson)
+	if err != nil {
+		return nil, err
+	}
+
+	resp := new(response.InfosResponse[response.WorkflowInfo])
+	err = postResponse.Json(resp)
+	if err != nil {
+		return nil, err
+	}
+	if !resp.Success {
+		return nil, errors.New(resp.Msg)
+	}
+
+	return resp, nil
+}

+ 14 - 0
ng_cws_client/ng_cws_client.go

@@ -289,6 +289,20 @@ func GetWorkflowList(reqParams *request.QueryMyWorkflowParams) (*response.InfosR
 	return workflowList, nil
 }
 
+// 通过流程ID批量获取流程列表,租户ID必传
+func GetWorkflowListByWorkflowIdList(reqParams *request.QueryWorkflowByIDs) (*response.InfosResponse[response.WorkflowInfo], error) {
+	if utils.IsStringEmpty(cwsUrl) {
+		return nil, errors.New("未配置CWS地址")
+	}
+	//根据业务类型获取流程模型ID
+	workflowList, err := getWorkflowListByWorkflowIdListApi(reqParams)
+	if err != nil {
+		return nil, err
+	}
+
+	return workflowList, nil
+}
+
 // 通过业务类别获取流程列表,租户ID必传
 func GetWorkflowListByBusinessType(tenantID string, businessType string, reqParams *request.QueryMyWorkflowParams) (*response.InfosResponse[response.WorkflowInfo], error) {
 	if utils.IsStringEmpty(cwsUrl) {

+ 1 - 0
service/method_names.go

@@ -8,4 +8,5 @@ const (
 	StartWorkFlowTemplatePrepareMethodName = methodNamePrefix + "/workflow/template/launch/prepare"
 	StartWorkFlowTemplateMethodName        = methodNamePrefix + "/workflow/template/launch"
 	GetWorkflowList                        = methodNamePrefix + "/workflow/list"
+	GetWorkflowListByWorkflowIdList        = methodNamePrefix + "/workflow/list/ids"
 )

+ 7 - 0
service/request/workflow.go

@@ -64,3 +64,10 @@ type QueryMyWorkflowParams struct {
 	Matter         string `form:"matter"`
 	CatalogID      string `form:"catalogId"`
 }
+
+type QueryWorkflowByIDs struct {
+	TenantID string   `json:"tenantId" binding:"required" assign:"toField:TenantID"`
+	IDs      []string `json:"ids" `
+	PageNo   int      `json:"pageNo" assign:"-"`
+	PageSize int      `json:"pageSize" assign:"-"`
+}