|
|
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"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
// PdmEntrust 设计委托请求
|
|
|
/*
|
|
|
设计委托分三个步骤进行
|
|
|
1、判断是否change监理(先省略,看看有没有问题)
|
|
|
2、(先获取信息)再更新表单信息(新建可以省略,零星不建议走)
|
|
|
3、提交设计委托
|
|
|
*/
|
|
|
|
|
|
func ReqPdmEntrust(ctx *model.Ctx) {
|
|
|
if ctx.Data.Get("processDefinitionName").String() == "公众客户宽带扩容" {
|
|
|
//扩容单
|
|
|
updatePdmProduction(ctx)
|
|
|
}
|
|
|
|
|
|
pdmPushProcess(ctx)
|
|
|
}
|
|
|
|
|
|
func updatePdmProduction(ctx *model.Ctx) {
|
|
|
touzi := ctx.Data.Get("touzi").String()
|
|
|
taskTitle := ctx.Data.Get("tasktitle").String()
|
|
|
remandId := getRemandId(ctx)
|
|
|
html := goPdmEntrustEdit(ctx, remandId)
|
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
|
header := h.GenReqParam()
|
|
|
f := model.NewUpdatePdmProduction(touzi, remandId, html, taskTitle)
|
|
|
form := f.GenReqParam()
|
|
|
client := ctx.RestyClient
|
|
|
resp, err := client.R().
|
|
|
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/pdmProductionController/updatePdmProduction.action")
|
|
|
if err != nil {
|
|
|
panic(exception.New(err.Error()))
|
|
|
}
|
|
|
data := strings.Trim(resp.String(), `"`)
|
|
|
logkit.Info("updatePdmProduction:" + cryptokit.Decrypt(data))
|
|
|
}
|
|
|
func pdmPushProcess(ctx *model.Ctx) {
|
|
|
processInstanceId := ctx.Data.Get("processInstanceId").String()
|
|
|
taskId := ctx.Data.Get("id").String()
|
|
|
taskTitle := ctx.Data.Get("tasktitle").String()
|
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
|
header := h.GenReqParam()
|
|
|
f := model.NewPDMPushProcess(processInstanceId, taskId, taskTitle)
|
|
|
form := f.GenReqParam()
|
|
|
client := ctx.RestyClient
|
|
|
resp, err := client.R().
|
|
|
SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/pdmEntrustController/pushProcess.action")
|
|
|
if err != nil {
|
|
|
panic(exception.New(err.Error()))
|
|
|
}
|
|
|
data := strings.Trim(resp.String(), `"`)
|
|
|
logkit.Info("pdmPushProcess:" + cryptokit.Decrypt(data))
|
|
|
}
|
|
|
|
|
|
// businessKey=remandId,taskId=id
|
|
|
func goPdmEntrustEdit(ctx *model.Ctx, businessKey string) string {
|
|
|
processInstId := ctx.Data.Get("processInstanceId").String()
|
|
|
taskId := ctx.Data.Get("id").String()
|
|
|
client := ctx.RestyClient
|
|
|
h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8")
|
|
|
header := h.GenReqParam()
|
|
|
query := model.NewGoPdmEntrustEdit(businessKey, processInstId, taskId)
|
|
|
resp, err := client.R().
|
|
|
SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/pdmEntrustController/goPdmEntrustEdit?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()
|
|
|
}
|