You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
3.1 KiB
Go
73 lines
3.1 KiB
Go
package service
|
|
|
|
import (
|
|
"cu-helper/cus-eng-con-sys/config"
|
|
"cu-helper/cus-eng-con-sys/cryptokit"
|
|
"cu-helper/cus-eng-con-sys/model"
|
|
"github.com/mizuki1412/go-core-kit/class/exception"
|
|
"github.com/mizuki1412/go-core-kit/service/logkit"
|
|
"github.com/tidwall/gjson"
|
|
"strings"
|
|
)
|
|
|
|
// businessKey=remandId
|
|
func getRemandId(ctx *model.Ctx) string {
|
|
processInstanceId := ctx.Data.Get("processInstanceId").String()
|
|
id := ctx.Data.Get("id").String()
|
|
processDefinitionKey := ctx.Data.Get("processDefinitionKey").String()
|
|
taskDefinitionKey := ctx.Data.Get("taskDefinitionKey").String()
|
|
businessCode := findLinkBusinessCode(ctx)
|
|
client := ctx.RestyClient
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
header := h.GenReqParam()
|
|
f := model.NewCommonForm()
|
|
form := f.GenReqParam()
|
|
resp, err := client.R().
|
|
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflowrest/tasktodopath/" + processDefinitionKey + "/" + processInstanceId + "/" + taskDefinitionKey + "/" + id + "/" + businessCode)
|
|
if err != nil {
|
|
panic(exception.New(err.Error()))
|
|
}
|
|
data := strings.Trim(resp.String(), `"`)
|
|
decrypt := cryptokit.Decrypt(data)
|
|
dataRow := gjson.Get(decrypt, "dataRows").Array()
|
|
if len(dataRow) == 0 {
|
|
panic(exception.New("dataRow array len = 0"))
|
|
}
|
|
logkit.Debug("拿到了businessKey/remandId:" + dataRow[0].Get("businessKey").String())
|
|
return dataRow[0].Get("businessKey").String()
|
|
}
|
|
|
|
// businessKey=remandId,taskId=id
|
|
func projectStartComplete(ctx *model.Ctx, businessKey string) string {
|
|
processInstId := ctx.Data.Get("processInstanceId").String()
|
|
taskId := ctx.Data.Get("id").String()
|
|
taskDefinitionKey := ctx.Data.Get("taskDefinitionKey").String()
|
|
client := ctx.RestyClient
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
header := h.GenReqParam()
|
|
query := model.NewCommonFormGetHtml(businessKey, processInstId, taskDefinitionKey, taskId)
|
|
resp, err := client.R().
|
|
SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/actInfoController/projectStartComplete?businessKey=" + query.BusinessKey + "&processInstanceId=" + query.ProcessInstanceId + "&taskDefinitionKey=" + query.TaskDefinitionKey + "&taskId=" + query.TaskId + "&startLink=" + query.StartLink + "&endLink=" + query.EndLink + "&taskflag=" + query.TaskFlag + "&ranstr=" + query.Ranstr + "×tamp=" + query.Timestamp + "&_=" + query.TimestampPro)
|
|
if err != nil {
|
|
panic(exception.New(err.Error()))
|
|
}
|
|
return resp.String()
|
|
}
|
|
|
|
func findLinkBusinessCode(ctx *model.Ctx) string {
|
|
processInstanceId := ctx.Data.Get("processInstanceId").String()
|
|
encryptedProcessInsId := cryptokit.Encrypt(processInstanceId)
|
|
client := ctx.RestyClient
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
header := h.GenReqParam()
|
|
f := model.NewCommonForm()
|
|
form := f.GenReqParam()
|
|
resp, err := client.R().
|
|
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflow/findLinkBusscode?processInstanceId=" + encryptedProcessInsId)
|
|
if err != nil {
|
|
panic(exception.New(err.Error()))
|
|
}
|
|
data := strings.Trim(resp.String(), `"`)
|
|
return gjson.Get(cryptokit.Decrypt(data), "BUSS_CODE").String()
|
|
}
|