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.

99 lines
2.9 KiB
Go

package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"cu-helper/cus-eng-con-sys/util"
"reflect"
)
/*
zjgd/frm/workflowrest/assignee/GkXjGzKrProcess/YSQR/84511812/1
*/
/*
用途
验收申请最后一步提交前获取验收申请的Assignee
*/
type GetAssignee struct {
BussCode string `map:"bussCode"`
Prov string `map:"prov"`
City string `map:"city"`
County string `map:"county"`
SpecCode string `map:"specCode"`
BuildModelId string `map:"buildModelId"`
ServiceType string `map:"serviceType"`
FlowKey string `map:"flowKey"`
ProcessInstId string `map:"processInstId"`
LinkCode string `map:"linkCode"`
GridId string `map:"gridId"`
IsCrossRemand string `map:"isCrossRemand"`
CustomerMangerId string `map:"customerMangerId"`
SplitFlag string `map:"splitFlag"`
RemandTouzi string `map:"remandTouzi"`
BenefitAssessZJ string `map:"benefitAssessZJ"`
CustType string `map:"custType"`
Roles string `map:"roles"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewGetAssignee(bussCode, html1, processDefinitionKey, ProcessInstId, taskDefinitionKey string) *GetAssignee {
getAssignee := new(GetAssignee)
getAssignee.BussCode = bussCode
getAssignee.Prov = util.RegexpFindFirst(html1, `"prov":"([^"]+)"`)
getAssignee.City = util.RegexpFindFirst(html1, `"city":"([^"]+)"`)
getAssignee.County = util.RegexpFindFirst(html1, `"county":"([^"]+)"`)
getAssignee.SpecCode = util.HTMLContentFindFirst(html1, "specC")
getAssignee.BuildModelId = util.RegexpFindFirst(html1, `"buildModel":"([^"]+)"`)
getAssignee.ServiceType = ""
getAssignee.FlowKey = processDefinitionKey
getAssignee.ProcessInstId = ProcessInstId
getAssignee.LinkCode = taskDefinitionKey
getAssignee.GridId = ""
getAssignee.IsCrossRemand = ""
getAssignee.CustomerMangerId = ""
getAssignee.SplitFlag = ""
getAssignee.RemandTouzi = ""
getAssignee.BenefitAssessZJ = ""
getAssignee.CustType = ""
getAssignee.Roles = ""
getAssignee.Ranstr = cryptokit.RandomStr(true, 10, 32)
getAssignee.Timestamp = cryptokit.GetTimeStamp()
return getAssignee
}
// GenReqParam 返回加密后的请求参数
func (th *GetAssignee) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *GetAssignee) 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 *GetAssignee) 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()))
}
}
}