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.

88 lines
2.7 KiB
Go

package model
import (
"cu-helper/cus-eng-con-sys/cryptokit"
"cu-helper/cus-eng-con-sys/util"
"github.com/mizuki1412/go-core-kit/service/logkit"
"reflect"
)
/*
http://10.202.2.108:8086/zjgd/frm/pdmProductionController/updatePdmProduction.action
*/
/*
用途
1、updatePdmProduction入参
*/
type UpdatePdmProduction struct {
RemandTouzi string `map:"remandTouzi"`
RemandId string `map:"remandId"`
BuildAttr string `map:"buildAttr"`
PdmServiceProviderId string `map:"pdmServiceProviderId"`
PdmProjReceiverId string `map:"pdmProjReceiverId"`
BuildModel string `map:"buildModel"`
GovEnterpId string `map:"govEnterpId"`
ResourceType string `map:"resourceType"`
IsNewNational string `map:"isNewNational"`
SupervisorProviderId string `map:"supervisorProviderId"`
SupervisorReceiverId string `map:"supervisorReceiverId"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewUpdatePdmProduction(remandId, html, taskTitle string) *UpdatePdmProduction {
updatePdmProduction := new(UpdatePdmProduction)
remandTouzi := util.RegexpFindFirst(html, `投资\s*(\d+(?:\.\d+)?)\s*元`)
updatePdmProduction.RemandTouzi = remandTouzi
updatePdmProduction.RemandId = remandId
updatePdmProduction.BuildAttr = "PT"
updatePdmProduction.PdmServiceProviderId = "1538321"
updatePdmProduction.PdmProjReceiverId = "3083564"
updatePdmProduction.BuildModel = "ZJ"
updatePdmProduction.GovEnterpId = ""
updatePdmProduction.ResourceType = "undefined"
updatePdmProduction.IsNewNational = "0"
updatePdmProduction.SupervisorProviderId = "309320681"
updatePdmProduction.SupervisorReceiverId = "3098707"
updatePdmProduction.Ranstr = cryptokit.RandomStr(true, 10, 32)
updatePdmProduction.Timestamp = cryptokit.GetTimeStamp()
logkit.Info(taskTitle + " 投资:" + remandTouzi + "元")
return updatePdmProduction
}
// GenReqParam 返回加密后的请求参数
func (th *UpdatePdmProduction) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *UpdatePdmProduction) 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 *UpdatePdmProduction) 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()))
}
}
}