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.

74 lines
2.0 KiB
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package model
import (
"cu-helper/cus-eng-con-sys/config"
"cu-helper/cus-eng-con-sys/cryptokit"
"reflect"
)
/*
/zjgd/frm/actInfoController/updateActInfoOrgAndStaff
*/
/*
用途工程开工第二步updateActInfoOrgAndStaff
*/
type UpdateActInfoOrgAndStaff struct {
ActStartOrgId string `map:"actStartOrgId"`
ActOrgCode string `map:"actOrgCode"`
ActId string `map:"actId"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewUpdateActInfoOrgAndStaff(actId, processDefinitionKey string) *UpdateActInfoOrgAndStaff {
updateActInfoOrgAndStaff := new(UpdateActInfoOrgAndStaff)
switch processDefinitionKey {
case config.ProcessHouse: //小区(包括扩容)
updateActInfoOrgAndStaff.ActStartOrgId = "3104398" //余秉 写死
updateActInfoOrgAndStaff.ActOrgCode = "1538688" //余秉 写死
case config.ProcessLX:
updateActInfoOrgAndStaff.ActStartOrgId = "3109710" //周秋伟 写死
updateActInfoOrgAndStaff.ActOrgCode = "1538443" //周秋伟 写死
}
updateActInfoOrgAndStaff.ActId = actId
updateActInfoOrgAndStaff.Ranstr = cryptokit.RandomStr(true, 10, 32)
updateActInfoOrgAndStaff.Timestamp = cryptokit.GetTimeStamp()
return updateActInfoOrgAndStaff
}
// GenReqParam 返回加密后的请求参数
func (th *UpdateActInfoOrgAndStaff) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *UpdateActInfoOrgAndStaff) 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 *UpdateActInfoOrgAndStaff) 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()))
}
}
}