|
|
@@ -6,11 +6,12 @@ import (
|
|
|
"encoding/xml"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
|
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
|
"net/http"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+
|
|
|
+ "git.qianqiusoft.com/qianqiusoft/light-apiengine/entitys"
|
|
|
+ "git.qianqiusoft.com/qianqiusoft/light-apiengine/utils"
|
|
|
)
|
|
|
|
|
|
type Filter struct {
|
|
|
@@ -493,3 +494,42 @@ func (w *WFClient) Recall(definedId string) ([]byte, error) {
|
|
|
|
|
|
return HttpClientInstance().post(url, params, nil)
|
|
|
}
|
|
|
+
|
|
|
+//终止
|
|
|
+func (w *WFClient) Interrupt(definedId string, formData map[string]interface{}, c *entitys.CtrlContext) ([]byte, error) {
|
|
|
+ url := w.getFullUrl("/api/wf_instance/interrupt")
|
|
|
+ params := make(map[string]string)
|
|
|
+ params["instance_id"] = definedId
|
|
|
+ var RunRespInfo struct {
|
|
|
+ DefineId string `json:"define_id"`
|
|
|
+ InstanceId string `json:"instance_id"`
|
|
|
+ DefineName string `json:"define_name"`
|
|
|
+ InstanceName string `json:"instance_name"`
|
|
|
+ Choices []*Choice `json:"choices"`
|
|
|
+ Transition *Transition `json:"transition"`
|
|
|
+ StepType string `json:"step_type"`
|
|
|
+ FormData string `json:"form_data"`
|
|
|
+ StepName string `json:"step_name"`
|
|
|
+ ActorType string `json:"actor_type"`
|
|
|
+ Executor string `json:"executor"`
|
|
|
+ StartCallback string `json:"start_callback"`
|
|
|
+ }
|
|
|
+ bytess, err := HttpClientInstance().post(url, params, nil)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ callback, ok := w.callbackMap["interrupt"]
|
|
|
+ if ok {
|
|
|
+ callback(CallbackArg{
|
|
|
+ DefineId: RunRespInfo.DefineId,
|
|
|
+ InstanceId: definedId,
|
|
|
+ DefineName: RunRespInfo.DefineName,
|
|
|
+ InstanceName: RunRespInfo.InstanceName,
|
|
|
+ FormData: formData["form_data"].(string),
|
|
|
+ Executor: RunRespInfo.Executor,
|
|
|
+ UserId: w.userId,
|
|
|
+ Context: c,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return bytess, err
|
|
|
+}
|