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.

171 lines
6.8 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/cryptokit"
"cu-helper/cus-eng-con-sys/util"
"reflect"
)
//remandName = 2025年中国联通浙江省杭州地区西湖区转塘街道枫桦路与梧桐路交叉口枫吟丽都三区宽带接入扩容工程16幢2单元21层新增1只1:4
//projectName = 2025年中国联通浙江杭州西湖公众宽带接入扩容第二期工程无条件受理专项
//projectCode = CMA25CD0000060.3301
//cityName = 杭州
//city = 3302
//replyInvestment = 40
//staffNames = 许霖卓
//mobilPhone = 156****5124
//remandStartDate = 2025-12-13 19:54:47
//buildAddress = 枫桦路与梧桐路交叉口枫吟丽都三区
//buildLimitedType = 1
//buildLimitedDays = 7
//actFinishDate =
//token = 27b97a73-40d4-4346-80a1-00fcc8fed333
//actId =
//remandId = a9ced8ce-f933-45a4-bd16-4d654cad9618
//remandCode = 20253301105373
//splitRemandId = a9ced8ce-f933-45a4-bd16-4d654cad9618
//isSplitedRemand = N
//saveOrUpdateType = 2
//prov = 3301
//procInsId = 83383669
//buildType1 =
//specC = 16A3
//buildModel = ZJ
//countys = 330106
//linkCode = GCKG
//busiId = a9ced8ce-f933-45a4-bd16-4d654cad9618
//taskIds = 83768504
//bussCode = ZH_KR
//actStartDate =
//taskDefinitionKeys = GCKG
//actStartOrgId =
//actOrgCode =
//specB = EC
//projectId = 8895163
//ifFiling = 1
//filingDateCondtion =
//ranstr = nAjPPMG4dvVIGzOr
//timestamp = 1766665658920
type SaveActInfo struct {
RemandName string `map:"remandName"`
ProjectName string `map:"projectName"`
ProjectCode string `map:"projectCode"`
CityName string `map:"cityName"`
City string `map:"city"`
ReplyInvestment string `map:"replyInvestment"`
StaffNames string `map:"staffNames"`
MobilPhone string `map:"mobilPhone"`
RemandStartDate string `map:"remandStartDate"`
BuildAddress string `map:"buildAddress"`
BuildLimitedType string `map:"buildLimitedType"`
BuildLimitedDays string `map:"buildLimitedDays"`
ActFinishDate string `map:"actFinishDate"`
Token string `map:"token"`
ActId string `map:"actId"`
RemandId string `map:"remandId"`
RemandCode string `map:"remandCode"`
SplitRemandId string `map:"splitRemandId"`
IsSplitedRemand string `map:"isSplitedRemand"`
SaveOrUpdateType string `map:"saveOrUpdateType"`
Prov string `map:"prov"`
ProcInsId string `map:"procInsId"`
BuildType1 string `map:"buildType1"`
SpecC string `map:"specC"`
BuildModel string `map:"buildModel"`
Countys string `map:"countys"`
LinkCode string `map:"linkCode"`
BusiId string `map:"busiId"`
TaskIds string `map:"taskIds"`
BussCode string `map:"bussCode"`
ActStartDate string `map:"actStartDate"`
TaskDefinitionKeys string `map:"taskDefinitionKeys"`
ActStartOrgId string `map:"actStartOrgId"`
ActOrgCode string `map:"actOrgCode"`
SpecB string `map:"specB"`
ProjectId string `map:"projectId"`
IfFiling string `map:"ifFiling"`
FilingDateCondtion string `map:"filingDateCondtion"`
Ranstr string `map:"ranstr"`
Timestamp string `map:"timestamp"`
}
func NewSaveActInfo(html string) *SaveActInfo {
saveActInfo := new(SaveActInfo)
saveActInfo.RemandName = util.HTMLContentFindFirst(html, "remandName")
saveActInfo.ProjectName = util.HTMLContentFindFirst(html, "projectName")
saveActInfo.ProjectCode = util.HTMLContentFindFirst(html, "projectCode")
saveActInfo.CityName = util.HTMLContentFindFirst(html, "cityName")
saveActInfo.City = util.HTMLContentFindFirst(html, "city")
saveActInfo.ReplyInvestment = util.HTMLContentFindFirst(html, "replyInvestment")
saveActInfo.StaffNames = util.HTMLContentFindFirst(html, "staffNames")
saveActInfo.MobilPhone = util.HTMLContentFindFirst(html, "mobilPhone")
saveActInfo.RemandStartDate = util.HTMLContentFindFirst(html, "remandStartDate")
saveActInfo.BuildAddress = util.RegexpFindFirst(html, `<textarea[^>]*id="buildAddress"[^>]*>(.*?)</textarea>`)
saveActInfo.BuildLimitedType = util.HTMLContentFindFirst(html, "buildLimitedType")
saveActInfo.BuildLimitedDays = "7"
saveActInfo.ActFinishDate = util.HTMLContentFindFirst(html, "actFinishDate")
saveActInfo.Token = util.HTMLContentFindFirst(html, "token")
saveActInfo.ActId = util.HTMLContentFindFirst(html, "actId")
saveActInfo.RemandId = util.HTMLContentFindFirst(html, "remandId")
saveActInfo.RemandCode = util.HTMLContentFindFirst(html, "remandCode")
saveActInfo.SplitRemandId = util.HTMLContentFindFirst(html, "remandId")
saveActInfo.IsSplitedRemand = util.HTMLContentFindFirst(html, "isSplitedRemand")
saveActInfo.SaveOrUpdateType = "2"
saveActInfo.Prov = util.HTMLContentFindFirst(html, "prov")
saveActInfo.ProcInsId = util.HTMLContentFindFirst(html, "procInsId")
saveActInfo.BuildType1 = util.HTMLContentFindFirst(html, "buildType1")
saveActInfo.SpecC = util.HTMLContentFindFirst(html, "specC")
saveActInfo.BuildModel = util.HTMLContentFindFirst(html, "buildModel")
saveActInfo.Countys = util.HTMLContentFindFirst(html, "countys")
saveActInfo.LinkCode = util.HTMLContentFindFirst(html, "linkCode")
saveActInfo.BusiId = util.HTMLContentFindFirst(html, "busiId")
saveActInfo.TaskIds = util.HTMLContentFindFirst(html, "taskIds")
saveActInfo.BussCode = util.HTMLContentFindFirst(html, "bussCode")
saveActInfo.ActStartDate = util.HTMLContentFindFirst(html, "actStartDate")
saveActInfo.TaskDefinitionKeys = util.HTMLContentFindFirst(html, "taskDefinitionKeys")
saveActInfo.ActStartOrgId = util.HTMLContentFindFirst(html, "actStartOrgId")
saveActInfo.ActOrgCode = util.HTMLContentFindFirst(html, "actOrgCode")
saveActInfo.SpecB = util.HTMLContentFindFirst(html, "specB")
saveActInfo.ProjectId = util.HTMLContentFindFirst(html, "projectId")
saveActInfo.IfFiling = util.HTMLContentFindFirst(html, "ifFiling")
saveActInfo.FilingDateCondtion = util.HTMLContentFindFirst(html, "filingDateCondtion")
saveActInfo.Ranstr = cryptokit.RandomStr(true, 10, 32)
saveActInfo.Timestamp = cryptokit.GetTimeStamp()
return saveActInfo
}
// GenReqParam 返回加密后的请求参数
func (th *SaveActInfo) GenReqParam() map[string]string {
th.encrypt()
return th.structToMap()
}
func (th *SaveActInfo) 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 *SaveActInfo) 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()))
}
}
}