update: all
parent
df44c079a5
commit
ec1b0521b2
@ -0,0 +1,49 @@
|
||||
package cryptokit
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
type DocEncrypt struct {
|
||||
RandStr string `map:"ranstr"`
|
||||
TimeStamp string `map:"timestamp"`
|
||||
SignId string `map:"signid"`
|
||||
}
|
||||
|
||||
func NewDocEncrypt() *DocEncrypt {
|
||||
docEncrypt := new(DocEncrypt)
|
||||
docEncrypt.RandStr = RandomStr(true, 10, 32)
|
||||
docEncrypt.TimeStamp = GetTimeStamp()
|
||||
firstMD5 := md5Sum(docEncrypt.RandStr + docEncrypt.TimeStamp)
|
||||
calculatedSign := md5Sum(firstMD5 + docEncrypt.RandStr)
|
||||
docEncrypt.SignId = calculatedSign
|
||||
return docEncrypt
|
||||
}
|
||||
|
||||
func (th *DocEncrypt) GenReqParam() map[string]string {
|
||||
return th.structToMap()
|
||||
}
|
||||
|
||||
func (th *DocEncrypt) 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 md5Sum(data string) string {
|
||||
hash := md5.Sum([]byte(data))
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
@ -0,0 +1,139 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"cu-helper/cus-eng-con-sys/config"
|
||||
"cu-helper/cus-eng-con-sys/cryptokit"
|
||||
"cu-helper/cus-eng-con-sys/util"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
/*
|
||||
/zjgd/frm/acceptanceController/pushProcess.action
|
||||
*/
|
||||
|
||||
/*
|
||||
用途
|
||||
验收申请流程推送
|
||||
*/
|
||||
|
||||
//tip 工建能写出这么多form参数的的程序员,也是个人才,不能用json吗?我真服了你!
|
||||
|
||||
type AccApplyPushProcess struct {
|
||||
AccId string `map:"accId"`
|
||||
Token string `map:"token"`
|
||||
RemandId string `map:"remandId"`
|
||||
IsSplitedRemand string `map:"isSplitedRemand"`
|
||||
AccRecordId string `map:"accRecordId"`
|
||||
BuildModel string `map:"buildModel"`
|
||||
DisType string `map:"disType"`
|
||||
SpecC string `map:"specC"`
|
||||
IsBd string `map:"isBd"`
|
||||
IsGKOrder string `map:"isGKOrder"`
|
||||
RemandName string `map:"remandName"`
|
||||
ProjectName string `map:"projectName"`
|
||||
ProjectCode string `map:"projectCode"`
|
||||
RemandCreateName string `map:"remandCreateName"`
|
||||
RemandTouzi string `map:"remandTouzi"`
|
||||
ProjectManagerName string `map:"projectManagerName"`
|
||||
RemandCreatedDate string `map:"remandCreatedDate"`
|
||||
PdmCreatedName string `map:"pdmCreatedName"`
|
||||
PdmCreatedDate string `map:"pdmCreatedDate"`
|
||||
ReplyDate string `map:"replyDate"`
|
||||
ReplyInvestment string `map:"replyInvestment"`
|
||||
ActStartDate string `map:"actStartDate"`
|
||||
ActOrgName string `map:"actOrgName"`
|
||||
ActFinishDate string `map:"actFinishDate"`
|
||||
AccApplyDesc string `map:"accApplyDesc"`
|
||||
TaskDefinitionKey string `map:"taskDefinitionKey"`
|
||||
BusinessKey string `map:"businessKey"`
|
||||
Comment string `map:"comment"`
|
||||
Assignee string `map:"assignee"`
|
||||
ProcessInstanceId string `map:"processInstanceId"`
|
||||
TaskId string `map:"taskId"`
|
||||
HandleType string `map:"handleType"`
|
||||
Withdraw string `map:"withdraw"`
|
||||
Back string `map:"back"`
|
||||
Ranstr string `map:"ranstr"`
|
||||
Timestamp string `map:"timestamp"`
|
||||
}
|
||||
|
||||
// NewAccApplyPushProcess remandId=businessKey
|
||||
func NewAccApplyPushProcess(token, remandId, processInstanceId, taskId, html1, html2, assignee, processDefinitionKey string) *AccApplyPushProcess {
|
||||
accApplyPushProcess := new(AccApplyPushProcess)
|
||||
accApplyPushProcess.AccId = util.RegexpFindFirst(html1, `"accId":"([^"]+)"`)
|
||||
accApplyPushProcess.Token = token
|
||||
accApplyPushProcess.RemandId = remandId
|
||||
accApplyPushProcess.IsSplitedRemand = util.RegexpFindFirst(html1, `"isSplitedRemand":"([^"]+)"`)
|
||||
accApplyPushProcess.AccRecordId = util.HTMLContentFindFirst(html1, "accRecordId")
|
||||
accApplyPushProcess.BuildModel = util.RegexpFindFirst(html1, `"buildModel":"([^"]+)"`)
|
||||
accApplyPushProcess.DisType = util.RegexpFindFirst(html1, `"disType":"([^"]+)"`)
|
||||
accApplyPushProcess.SpecC = util.HTMLContentFindFirst(html1, "specC")
|
||||
accApplyPushProcess.IsBd = util.HTMLContentFindFirst(html1, "isBd")
|
||||
switch processDefinitionKey {
|
||||
case config.ProcessHouse:
|
||||
accApplyPushProcess.IsGKOrder = util.HTMLContentFindFirst(html1, "isGKOrder")
|
||||
case config.ProcessLX:
|
||||
//零星没有这个参数
|
||||
}
|
||||
accApplyPushProcess.RemandName = util.RegexpFindFirst(html1, `"remandName":"([^"]+)"`)
|
||||
accApplyPushProcess.ProjectName = util.HTMLContentFindFirst(html2, "projectName")
|
||||
accApplyPushProcess.ProjectCode = util.HTMLContentFindFirst(html2, "projectCode")
|
||||
accApplyPushProcess.RemandCreateName = util.HTMLContentFindFirst(html2, "remandCreateName")
|
||||
accApplyPushProcess.RemandTouzi = util.HTMLContentFindFirst(html2, "remandTouzi")
|
||||
accApplyPushProcess.ProjectManagerName = util.HTMLContentFindFirst(html2, "projectManagerName")
|
||||
accApplyPushProcess.RemandCreatedDate = util.HTMLContentFindFirst(html2, "remandCreatedDate")
|
||||
accApplyPushProcess.PdmCreatedName = util.HTMLContentFindFirst(html2, "pdmCreatedName")
|
||||
accApplyPushProcess.PdmCreatedDate = util.HTMLContentFindFirst(html2, "pdmCreatedDate")
|
||||
accApplyPushProcess.ReplyDate = util.HTMLContentFindFirst(html2, "replyDate")
|
||||
accApplyPushProcess.ReplyInvestment = util.HTMLContentFindFirst(html2, "replyInvestment")
|
||||
accApplyPushProcess.ActStartDate = util.HTMLContentFindFirst(html2, "actStartDate")
|
||||
accApplyPushProcess.ActOrgName = util.HTMLContentFindFirst(html2, "actOrgName")
|
||||
accApplyPushProcess.ActFinishDate = util.HTMLContentFindFirst(html2, "actFinishDate")
|
||||
accApplyPushProcess.AccApplyDesc = util.HTMLContentFindFirst(html1, "accApplyDesc")
|
||||
accApplyPushProcess.TaskDefinitionKey = "YSQR"
|
||||
accApplyPushProcess.BusinessKey = accApplyPushProcess.AccId
|
||||
accApplyPushProcess.Comment = "请确认"
|
||||
accApplyPushProcess.Assignee = assignee
|
||||
accApplyPushProcess.ProcessInstanceId = processInstanceId
|
||||
accApplyPushProcess.TaskId = taskId
|
||||
accApplyPushProcess.HandleType = "1"
|
||||
accApplyPushProcess.Withdraw = "1"
|
||||
accApplyPushProcess.Back = "0"
|
||||
accApplyPushProcess.Ranstr = cryptokit.RandomStr(true, 10, 32)
|
||||
accApplyPushProcess.Timestamp = cryptokit.GetTimeStamp()
|
||||
return accApplyPushProcess
|
||||
}
|
||||
|
||||
// GenReqParam 返回加密后的请求参数
|
||||
func (th *AccApplyPushProcess) GenReqParam() map[string]string {
|
||||
th.encrypt()
|
||||
return th.structToMap()
|
||||
}
|
||||
|
||||
func (th *AccApplyPushProcess) 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 *AccApplyPushProcess) 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()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"cu-helper/cus-eng-con-sys/config"
|
||||
"reflect"
|
||||
|
||||
"github.com/mizuki1412/go-core-kit/class/exception"
|
||||
)
|
||||
|
||||
/*
|
||||
/zjgd/frm/docInfoController/goUpload.action
|
||||
*/
|
||||
|
||||
/*
|
||||
用途
|
||||
完工确认、验收确认等一系列文件上传
|
||||
*/
|
||||
|
||||
type DocUpload struct {
|
||||
DocTypeId string `map:"docTypeId"`
|
||||
BusiId string `map:"busiId"`
|
||||
ModuleCode string `map:"moduleCode"`
|
||||
LinkCode string `map:"linkCode"`
|
||||
StageCode string `map:"stageCode"`
|
||||
TaskID string `map:"taskID"`
|
||||
PdmChangeId string `map:"pdmChangeId"`
|
||||
PdmOrAbandonStageCode string `map:"pdmOrAbandonStageCode"`
|
||||
}
|
||||
|
||||
func NewDocUpload(businessKey, linkCode, stageCode, taskId string) *DocUpload {
|
||||
docUpload := new(DocUpload)
|
||||
if linkCode == "WGQR" {
|
||||
docUpload.DocTypeId = config.DocUploadWGQRDocTypeId
|
||||
} else if linkCode == "YSQR" {
|
||||
docUpload.DocTypeId = config.DocUploadYSQRDocTypeId
|
||||
} else {
|
||||
panic(exception.New("linkCode Err"))
|
||||
}
|
||||
docUpload.BusiId = businessKey
|
||||
docUpload.ModuleCode = "XQMODE"
|
||||
docUpload.LinkCode = linkCode //WGQR YSQR
|
||||
docUpload.StageCode = stageCode //ACT ACC
|
||||
docUpload.TaskID = taskId
|
||||
docUpload.PdmChangeId = ""
|
||||
docUpload.PdmOrAbandonStageCode = ""
|
||||
return docUpload
|
||||
}
|
||||
|
||||
// GenReqParam 返回加密后的请求参数
|
||||
func (th *DocUpload) GenReqParam() map[string]string {
|
||||
return th.structToMap()
|
||||
}
|
||||
|
||||
func (th *DocUpload) 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
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
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()))
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue