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.
86 lines
2.5 KiB
Go
86 lines
2.5 KiB
Go
package model
|
|
|
|
import (
|
|
"cu-helper/cus-eng-con-sys/cryptokit"
|
|
"reflect"
|
|
)
|
|
|
|
/*
|
|
/zjgd/frm/pdmEntrustController/pushProcess.action
|
|
*/
|
|
|
|
/*
|
|
用途:设计委托
|
|
*/
|
|
|
|
type PDMPushProcess struct {
|
|
ProcessInstanceId string `map:"processInstanceId"`
|
|
TaskId string `map:"taskId"`
|
|
TaskDefinitionKey string `map:"taskDefinitionKey"`
|
|
Assignee string `map:"assignee"`
|
|
Comment string `map:"comment"`
|
|
Title string `map:"title"`
|
|
HandleType string `map:"handleType"`
|
|
Withdraw string `map:"withdraw"`
|
|
PdmServiceProviderId string `map:"pdmServiceProviderId"`
|
|
PdmProjReceiverId string `map:"pdmProjReceiverId"`
|
|
BuildModel string `map:"buildModel"`
|
|
SupervisorProviderId string `map:"supervisorProviderId"`
|
|
SupervisorReceiverId string `map:"supervisorReceiverId"`
|
|
Ranstr string `map:"ranstr"`
|
|
Timestamp string `map:"timestamp"`
|
|
}
|
|
|
|
func NewPDMPushProcess(processInsId, taskId, taskTitle string) *PDMPushProcess {
|
|
pdmPushProcess := new(PDMPushProcess)
|
|
pdmPushProcess.ProcessInstanceId = processInsId
|
|
pdmPushProcess.TaskId = taskId
|
|
pdmPushProcess.TaskDefinitionKey = "FABZ"
|
|
pdmPushProcess.Assignee = "3083564" //todo 每个人都是这个吗
|
|
pdmPushProcess.Comment = "请协助编制建设方案"
|
|
pdmPushProcess.Title = taskTitle
|
|
pdmPushProcess.HandleType = "1"
|
|
pdmPushProcess.Withdraw = "0"
|
|
pdmPushProcess.PdmServiceProviderId = "1538321"
|
|
pdmPushProcess.PdmProjReceiverId = "3083564"
|
|
pdmPushProcess.BuildModel = "ZJ"
|
|
pdmPushProcess.SupervisorProviderId = "309320681"
|
|
pdmPushProcess.SupervisorReceiverId = "3098707"
|
|
pdmPushProcess.Ranstr = cryptokit.RandomStr(true, 10, 32)
|
|
pdmPushProcess.Timestamp = cryptokit.GetTimeStamp()
|
|
return pdmPushProcess
|
|
}
|
|
|
|
// GenReqParam 返回加密后的请求参数
|
|
func (th *PDMPushProcess) GenReqParam() map[string]string {
|
|
th.encrypt()
|
|
return th.structToMap()
|
|
}
|
|
|
|
func (th *PDMPushProcess) 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 *PDMPushProcess) 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()))
|
|
}
|
|
}
|
|
}
|