package model import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "reflect" ) /* /zjgd/frm/designSchemeController/passFlow.action */ /* 用途:方案确认最后一步流程推送 */ //processInstanceId = 83615942 //taskId = 83629304 //taskDefinitionKey = XQJC //assignee = 3080921 //comment = 请进行需求决策 //handleType = 1 //withdraw = 1 //csassignees = undefined //ranstr = U6dQtXjHuofUto9i3M3d4o4wJILYBOQI //timestamp = 1766387597296 type DesignSchemePassflow 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"` Csassignees string `map:"csassignees"` Ranstr string `map:"ranstr"` Timestamp string `map:"timestamp"` } func NewDesignSchemePassflow(proInsId, taskId, processDefKey string) *DesignSchemePassflow { designSchemePassflow := new(DesignSchemePassflow) designSchemePassflow.ProcessInstanceId = proInsId designSchemePassflow.TaskId = taskId if processDefKey == config.ProcessLX { designSchemePassflow.TaskDefinitionKey = "GCKG" designSchemePassflow.Assignee = "3102427" //可修改,许霖卓 designSchemePassflow.Comment = "请开工" designSchemePassflow.Withdraw = "0" } if processDefKey == config.ProcessHouse { designSchemePassflow.TaskDefinitionKey = "XQJC" designSchemePassflow.Assignee = "3080921" //可修改,余逸洲 designSchemePassflow.Comment = "请进行需求决策" designSchemePassflow.Withdraw = "1" } designSchemePassflow.HandleType = "1" designSchemePassflow.Csassignees = "undefined" designSchemePassflow.Ranstr = cryptokit.RandomStr(true, 10, 32) designSchemePassflow.Timestamp = cryptokit.GetTimeStamp() return designSchemePassflow } // GenReqParam 返回加密后的请求参数 func (th *DesignSchemePassflow) GenReqParam() map[string]string { th.encrypt() return th.structToMap() } func (th *DesignSchemePassflow) 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 *DesignSchemePassflow) 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())) } } }