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.

91 lines
2.4 KiB
Go

package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"reflect"
)
/*
/zjgd/frm/actInfoController/startActProcess
*/
/*
用途:工程开工
*/
//processInstanceId = 83615942
//taskId = 83651057
//taskDefinitionKey = GCSG
//assignee = 3105305
//comment = 请施工
//handleType = 1
//withdraw = 1
//filingDate = undefined
//filingDateCondtion =
//ranstr = T2L3h7kTULX8R
//timestamp = 1766395288123
type StartActProcess struct {
ProcessInstanceId string `map:"processInstanceId"`
TaskId string `map:"taskId"`
TaskDefinitionKey string `map:"taskDefinitionKey"`
Assignee string `map:"assignee"`
Comment string `map:"comment"`
HandleType string `map:"handleType"`
Withdraw string `map:"withdraw"`
FilingDate string `map:"filingDate"`
FilingDateCondtion string `map:"filingDateCondtion"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewStartActProcess(proInsId, taskId string) *StartActProcess {
startActProcess := new(StartActProcess)
startActProcess.ProcessInstanceId = proInsId
startActProcess.TaskId = taskId
startActProcess.TaskDefinitionKey = "GCSG"
startActProcess.Assignee = "3105305" //可修改,张子杰 //todo 零星不一样
startActProcess.Comment = "请施工"
startActProcess.HandleType = "1"
startActProcess.Withdraw = "1"
startActProcess.FilingDate = "undefined"
startActProcess.FilingDateCondtion = ""
startActProcess.Ranstr = cryptokit.RandomStr(true, 10, 32)
startActProcess.Timestamp = cryptokit.GetTimeStamp()
return startActProcess
}
// GenReqParam 返回加密后的请求参数
func (th *StartActProcess) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *StartActProcess) structToMap() map[string]string {
result := make(map[string]string)
t := reflect.TypeOf(*th)
v := reflect.ValueOf(*th)
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
value := v.Field(i)
// Use the tag value as the key in the map, if it exists; otherwise, use the field name.
tag := field.Tag.Get("map")
if tag == "" {
tag = field.Name
}
result[tag] = value.String()
}
return result
}
func (th *StartActProcess) encrypt() {
v := reflect.ValueOf(th).Elem()
for i := 0; i < v.NumField(); i++ {
field := v.Field(i)
if field.CanSet() {
field.SetString(cryptokit.Encrypt(field.String()))
}
}
}