|
@@ -30,14 +30,14 @@ func Destroy() {
|
|
|
http_client.Destroy(NGCwsClient)
|
|
|
}
|
|
|
|
|
|
-func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeRequest) error {
|
|
|
+func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeRequest) (string, error) {
|
|
|
|
|
|
workflowTemplateId, err := getWorkTemplateInfoByBusinessType(reqParams.BusinessType, reqParams.TenantID)
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
if utils.IsStringEmpty(workflowTemplateId) {
|
|
|
- return errors.New("该业务类型未配置流程")
|
|
|
+ return "", errors.New("该业务类型未配置流程")
|
|
|
}
|
|
|
|
|
|
|
|
@@ -47,7 +47,7 @@ func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeR
|
|
|
TenantID: reqParams.TenantID,
|
|
|
})
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
|
|
|
|
|
@@ -57,11 +57,11 @@ func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeR
|
|
|
}
|
|
|
jsonBytes, err := json.Marshal(businessObject)
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
businessObjectStr := string(jsonBytes)
|
|
|
|
|
|
- err = StartWorkflow(&request.StartWorkflowRequest{
|
|
|
+ workflowId, err := StartWorkflow(&request.StartWorkflowRequest{
|
|
|
WorkflowTemplateID: workflowTemplateId,
|
|
|
LaunchUserName: reqParams.LaunchUserName,
|
|
|
Matter: reqParams.Matter,
|
|
@@ -71,37 +71,37 @@ func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeR
|
|
|
TenantID: reqParams.TenantID,
|
|
|
})
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
|
|
|
- return nil
|
|
|
+ return workflowId, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
-func StartWorkflow(reqParams *request.StartWorkflowRequest) error {
|
|
|
+func StartWorkflow(reqParams *request.StartWorkflowRequest) (string, error) {
|
|
|
if utils.IsStringEmpty(cwsUrl) {
|
|
|
- return errors.New("未配置CWS地址")
|
|
|
+ return "", errors.New("未配置CWS地址")
|
|
|
}
|
|
|
requestJson, err := json.Marshal(reqParams)
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
postResponse, err := NGCwsClient.NewRequest(http_client.WithNewRequestTimeout(cwsTimeOut)).
|
|
|
Post(cwsUrl+service.StartWorkFlowMethodName, requestJson)
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
|
|
|
- resp := new(response.MsgResponse)
|
|
|
+ resp := new(response.InfoResponse[string])
|
|
|
err = postResponse.Json(resp)
|
|
|
if err != nil {
|
|
|
- return err
|
|
|
+ return "", err
|
|
|
}
|
|
|
if !resp.Success {
|
|
|
- return errors.New(resp.Msg)
|
|
|
+ return "", errors.New(resp.Msg)
|
|
|
}
|
|
|
|
|
|
- return nil
|
|
|
+ return resp.Info, nil
|
|
|
}
|
|
|
|
|
|
func getWorkTemplateInfoByBusinessType(businessType string, tenantId string) (string, error) {
|