diff --git a/cmd/cus_eng_con_sys.go b/cmd/cus_eng_con_sys.go index ec31667..6841331 100644 --- a/cmd/cus_eng_con_sys.go +++ b/cmd/cus_eng_con_sys.go @@ -34,25 +34,26 @@ var engSysCmd = &cobra.Command{ pro := configkit.Get(config.EngProcess, "") if pro == "" { run() + } else { + client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewTaskTodo(cast.ToString(pro)) + form := f.GenReqParam() + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflow/taskToDo.action") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + _ = filekit.WriteFile("todo.json", []byte(data)) } - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) - h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") - header := h.GenReqParam() - f := model.NewTaskTodo(cast.ToString(pro)) - form := f.GenReqParam() - resp, err := client.R(). - SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflow/taskToDo.action") - if err != nil { - panic(exception.New(err.Error())) - } - dataOri := strings.Trim(resp.String(), `"`) - data := cryptokit.Decrypt(dataOri) - _ = filekit.WriteFile("kr.json", []byte(data)) }, } func run() { - j, _ := filekit.ReadString("kr.json") + j, _ := filekit.ReadString("todo.json") data := gjson.Get(j, "data").Array() client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) ctx := new(model.Ctx) @@ -63,16 +64,19 @@ func run() { _ = commonkit.RecoverFuncWrapper(func() { var handlers = map[config.Status]func(){ //小区新建、扩容 - {Step: "设计委托", Process: config.ProcessHouse}: func() { service.ReqPdmEntrust(ctx) }, - {Step: "方案确认", Process: config.ProcessHouse}: func() { service.ReqDesignScheme(ctx) }, - {Step: "工程开工", Process: config.ProcessHouse}: func() { service.ReqStartAct(ctx) }, - //{Step: "完工确认", Process: config.ProcessHouse}: func() {}, + {Step: "设计委托", Process: config.ProcessHouse}: func() { service.ReqPdmEntrust(ctx) }, + {Step: "方案确认", Process: config.ProcessHouse}: func() { service.ReqDesignScheme(ctx) }, + {Step: "工程开工", Process: config.ProcessHouse}: func() { service.ReqStartAct(ctx) }, + {Step: "完工确认", Process: config.ProcessHouse}: func() { service.ReqFinishAct(ctx) }, + {Step: "验收申请", Process: config.ProcessHouse}: func() { service.ReqAccApply(ctx) }, //施工单位 {Step: "验收确认", Process: config.ProcessHouse}: func() { service.ReqAccConfirm(ctx) }, {Step: "验收交付申请", Process: config.ProcessYSJF}: func() { service.ReqAccDelivery(ctx) }, //零星 //{Step: "项目方案制作", Process: config.ProcessLX}: func() {}, {Step: "方案确认", Process: config.ProcessLX}: func() { service.ReqDesignScheme(ctx) }, - //{Step: "完工确认", Process: config.ProcessLX}: func() {}, + {Step: "工程开工", Process: config.ProcessLX}: func() { service.ReqStartAct(ctx) }, + {Step: "完工确认", Process: config.ProcessLX}: func() { service.ReqFinishAct(ctx) }, + {Step: "验收申请", Process: config.ProcessLX}: func() { service.ReqAccApply(ctx) }, //施工单位 //{Step: "验收确认", Process: config.ProcessLX}: func() {}, //{Step: "验收交付申请", Process: config.ProcessYSJF}: func() {}, //楼宇 diff --git a/cmd/gen_con_order.go b/cmd/gen_con_order.go index 7a9e7f6..d4c3587 100644 --- a/cmd/gen_con_order.go +++ b/cmd/gen_con_order.go @@ -42,7 +42,8 @@ func defFlagsGco(cmd *cobra.Command) { func handleGcoLx() { templatePath := configkit.GetString("gco.template", "/Users/leo/Desktop/归档/集客零星/模板.xlsx") filePath := configkit.GetString("gco.file", "/Users/leo/Desktop/归档/集客零星/集客零星资源归档.xlsx") - + //templatePath := configkit.GetString("gco.template", "D:\\backup\\desktop\\lx\\模板.xlsx") + //filePath := configkit.GetString("gco.file", "D:\\backup\\desktop\\lx\\集客零星资源归档.xlsx") src, err := excelize.OpenFile(filePath) if err != nil { panic(exception.New(err.Error())) @@ -127,6 +128,8 @@ func handleGcoLx() { func handleGcoKr() { templatePath := configkit.GetString("gco.template", "/Users/leo/Desktop/归档/公众扩容/施工单模板.xlsx") filePath := configkit.GetString("gco.file", "/Users/leo/Downloads/扩容需求表.xlsx") + //templatePath := configkit.GetString("gco.template", "D:\\backup\\desktop\\kr\\施工单模板.xlsx") + //filePath := configkit.GetString("gco.file", "D:\\backup\\desktop\\kr\\扩容需求表.xlsx") src, err := excelize.OpenFile(filePath) if err != nil { panic(exception.New(err.Error())) diff --git a/cmd/test.go b/cmd/test.go index 24be816..e16fb61 100644 --- a/cmd/test.go +++ b/cmd/test.go @@ -1,10 +1,6 @@ package cmd import ( - "crypto/md5" - "encoding/base64" - "encoding/hex" - "encoding/json" "fmt" "log" "strconv" @@ -26,39 +22,8 @@ var testCmd = &cobra.Command{ Use: "test", Short: "Only for test", Run: func(cmd *cobra.Command, args []string) { - fff() - }, -} - -func md5str(s string) string { - h := md5.Sum([]byte(s)) - return hex.EncodeToString(h[:]) -} - -func getToken(timestamp, systemCode string) string { - return md5str(timestamp + systemCode) -} - -func getPostKey(data interface{}) string { - b, _ := json.Marshal(data) - return base64.StdEncoding.EncodeToString(b) -} - -func fff() { - systemCode := "3axgoA2bKgTjANbCPaeKMkeGe/8uTzyv17kjLC0CWV7fyM3keJwlg0WWyeYsXCWrm40/i7cL1TMsY4zThYj3dkKEnmCqRhMiRYJ7n/0l0dMLsKeFHDStUL1HSfQ/WjFQ9cWnR5Jm/MUD/F2w9SkmOTwU5jT6zZ7gG2SV3AzCh/IFo+BE7KWY1tkrH+xCPRWGRDCOHOGAI8JbDHSBMpbvU2eWTUfZyjMTzzvTu++3CN6OWMqigMP3O07NkcKXhhn9L4CJtigxPdTBN3ubKLRGcId+7JmJGvI4sCJBMEky913nDtqyr/8iORDZI7xT/QUUQYBwSs2ys5HsbJv7C7jAURUt5UhTS0CRqTxVlkUKm6iS0/e6MxODvcIYb6eUopOTzUhQu7KSj4CELD9v3oxJXARN+kXLFZ3LukRTe8Oo+PgTxZS2jgc5hMLpT4G9eBkHXoIPrx8ddGwik2q1xhSX1VviJSU5JtM6HtM1m5BfBV0" // 👈 从前端拿到 - timestamp := "20260415123456000" // 按页面格式生成 - token := getToken(timestamp, systemCode) - - data := map[string]interface{}{ - "evtTime": timestamp, - "token": token, - } - - postKey := getPostKey(data) - - fmt.Println("token:", token) - fmt.Println("postKey:", postKey) + }, } func extractColumnsLoss() { diff --git a/config.json b/config.json index 4aefcd7..e1b330a 100644 --- a/config.json +++ b/config.json @@ -3,10 +3,10 @@ "dir": "/Users/leo/go/src/leo/project/cu-helper" }, "eng": { - "sid": "a18e5e46-8097-4bb9-90c1-725de26ed0c6", + "sid": "fe61ddaf-b7f3-426a-b752-697c59a222bd", "pro": "", "projLX": "CNA25AC0000277.3301", - "projKR": "CMA26CE0000006.3301", + "projKR": "CMA26CD0000013.3301", "projXQ": "", "projLY": "" }, diff --git a/cus-eng-con-sys/config/config_constant.go b/cus-eng-con-sys/config/config_constant.go index 7ba725d..d81de19 100644 --- a/cus-eng-con-sys/config/config_constant.go +++ b/cus-eng-con-sys/config/config_constant.go @@ -14,8 +14,19 @@ const ( ProcessLX = "ZQKHProcess" //政企零星 ProcessYSJF = "YSJFProcess" ) +const ( + ProcessNameKR = "公众客户宽带扩容" + ProcessNameXQXJ = "公众客户宽带新建市场" +) const ( EngProcess = "eng.pro" ) + const UrlPrefix = "http://10.202.2.108:8086" + +const ( + DocUploadWGQRDocTypeId = "9a3838a7-86be-4596-8115-615aca848765" //完工报告 + DocUploadWGQRFilePath = "/Users/leo/Desktop/归档/小区/常用/完工报告.doc" + DocUploadYSQRDocTypeId = "a677580c-234d-4039-a979-75b98a5d1c3e" //验收报告 +) diff --git a/cus-eng-con-sys/cryptokit/crypto_doc.go b/cus-eng-con-sys/cryptokit/crypto_doc.go new file mode 100644 index 0000000..8085643 --- /dev/null +++ b/cus-eng-con-sys/cryptokit/crypto_doc.go @@ -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[:]) +} diff --git a/cus-eng-con-sys/model/acc_apply_push_process.go b/cus-eng-con-sys/model/acc_apply_push_process.go new file mode 100644 index 0000000..f961c97 --- /dev/null +++ b/cus-eng-con-sys/model/acc_apply_push_process.go @@ -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())) + } + } +} diff --git a/cus-eng-con-sys/model/acc_confirm_push_process.go b/cus-eng-con-sys/model/acc_confirm_push_process.go index 5523d62..00fb72c 100644 --- a/cus-eng-con-sys/model/acc_confirm_push_process.go +++ b/cus-eng-con-sys/model/acc_confirm_push_process.go @@ -3,9 +3,10 @@ package model import ( "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/util" + "reflect" + "github.com/mizuki1412/go-core-kit/library/mathkit" "github.com/spf13/cast" - "reflect" ) /* @@ -19,7 +20,7 @@ import ( //tip 工建能写出这么多form参数的的程序员,也是个人才,不能用json吗?我真服了你! -type PushProcess struct { +type ACCConfirmPushProcess struct { AccId string `map:"accId"` Token string `map:"token"` RemandId string `map:"remandId"` @@ -108,8 +109,8 @@ type PushProcess struct { } // NewPushProcess remandId=businessKey -func NewPushProcess(taskId, token, remandId, html1, html2 string) *PushProcess { - pushProcess := new(PushProcess) +func NewPushProcess(taskId, token, remandId, html1, html2 string) *ACCConfirmPushProcess { + pushProcess := new(ACCConfirmPushProcess) pushProcess.AccId = util.RegexpFindFirst(html1, `"accId":"([^"]+)"`) pushProcess.Token = token pushProcess.RemandId = remandId @@ -197,12 +198,12 @@ func NewPushProcess(taskId, token, remandId, html1, html2 string) *PushProcess { } // GenReqParam 返回加密后的请求参数 -func (th *PushProcess) GenReqParam() map[string]string { +func (th *ACCConfirmPushProcess) GenReqParam() map[string]string { th.encrypt() return th.structToMap() } -func (th *PushProcess) structToMap() map[string]string { +func (th *ACCConfirmPushProcess) structToMap() map[string]string { result := make(map[string]string) t := reflect.TypeOf(*th) v := reflect.ValueOf(*th) @@ -220,7 +221,7 @@ func (th *PushProcess) structToMap() map[string]string { return result } -func (th *PushProcess) encrypt() { +func (th *ACCConfirmPushProcess) encrypt() { v := reflect.ValueOf(th).Elem() for i := 0; i < v.NumField(); i++ { field := v.Field(i) diff --git a/cus-eng-con-sys/model/design_scheme_passflow.go b/cus-eng-con-sys/model/design_scheme_passflow.go index 05642fa..8704b6c 100644 --- a/cus-eng-con-sys/model/design_scheme_passflow.go +++ b/cus-eng-con-sys/model/design_scheme_passflow.go @@ -42,17 +42,17 @@ func NewDesignSchemePassflow(proInsId, taskId, processDefKey string) *DesignSche designSchemePassflow := new(DesignSchemePassflow) designSchemePassflow.ProcessInstanceId = proInsId designSchemePassflow.TaskId = taskId - if processDefKey == config.ProcessLX { - designSchemePassflow.TaskDefinitionKey = "GCKG" - designSchemePassflow.Assignee = "3102427" //可修改,许霖卓 - designSchemePassflow.Comment = "请开工" - designSchemePassflow.Withdraw = "0" - } - if processDefKey == config.ProcessHouse { + switch processDefKey { + case config.ProcessHouse: designSchemePassflow.TaskDefinitionKey = "XQJC" designSchemePassflow.Assignee = "3080921" //可修改,余逸洲 designSchemePassflow.Comment = "请进行需求决策" designSchemePassflow.Withdraw = "1" + case config.ProcessLX: + designSchemePassflow.TaskDefinitionKey = "GCKG" + designSchemePassflow.Assignee = "3102427" //可修改,许霖卓 + designSchemePassflow.Comment = "请开工" + designSchemePassflow.Withdraw = "0" } designSchemePassflow.HandleType = "1" designSchemePassflow.Csassignees = "undefined" diff --git a/cus-eng-con-sys/model/doc_upload.go b/cus-eng-con-sys/model/doc_upload.go new file mode 100644 index 0000000..ab4a466 --- /dev/null +++ b/cus-eng-con-sys/model/doc_upload.go @@ -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 +} diff --git a/cus-eng-con-sys/model/finish_act_process.go b/cus-eng-con-sys/model/finish_act_process.go new file mode 100644 index 0000000..ecaf705 --- /dev/null +++ b/cus-eng-con-sys/model/finish_act_process.go @@ -0,0 +1,82 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/actInfoController/startActFinishProcess +*/ + +/* +用途:完工确认 +*/ + +type FinishActProcess struct { + ProcessInstanceId string `map:"processInstanceId"` + TaskId string `map:"taskId"` + TaskDefinitionKey string `map:"taskDefinitionKey"` + Assignee string `map:"assignee"` + Comment string `map:"comment"` + HandleType string `map:"handleType"` + Withdraw string `map:"withdraw"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewFinishActProcess(proInsId, taskId, assigneeId, processDefinitionKey string) *FinishActProcess { + finishActProcess := new(FinishActProcess) + finishActProcess.ProcessInstanceId = proInsId + finishActProcess.TaskId = taskId + switch processDefinitionKey { + case config.ProcessHouse: + finishActProcess.TaskDefinitionKey = "ZYLR" + finishActProcess.Assignee = "3106207" //todo 张滋豪 写死 + finishActProcess.Comment = "请进行资源录入" + case config.ProcessLX: + finishActProcess.TaskDefinitionKey = "YSSQ" + finishActProcess.Assignee = assigneeId + finishActProcess.Comment = "请发起验收申请" + } + finishActProcess.HandleType = "1" + finishActProcess.Withdraw = "0" + finishActProcess.Ranstr = cryptokit.RandomStr(true, 10, 32) + finishActProcess.Timestamp = cryptokit.GetTimeStamp() + return finishActProcess +} + +// GenReqParam 返回加密后的请求参数 +func (th *FinishActProcess) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *FinishActProcess) 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 *FinishActProcess) 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())) + } + } +} diff --git a/cus-eng-con-sys/model/get_assignee.go b/cus-eng-con-sys/model/get_assignee.go new file mode 100644 index 0000000..d346052 --- /dev/null +++ b/cus-eng-con-sys/model/get_assignee.go @@ -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())) + } + } +} diff --git a/cus-eng-con-sys/model/mod_design_log_info.go b/cus-eng-con-sys/model/mod_design_log_info.go new file mode 100644 index 0000000..b8a2ff4 --- /dev/null +++ b/cus-eng-con-sys/model/mod_design_log_info.go @@ -0,0 +1,146 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/util" + "reflect" +) + +/* +/zjgd/frm/designSchemeController/modifyDesignSchemeLogInfo?stepCode=x4VBE4FymufyJwjbSSE3yA==&processDefinitionKey=36N3BIABJT+GrtB98lHgMw== +*/ + +/* +用途 +方案确认(目前只适用于政企零星,也只有政企零星需要在最后方案确认提交前调用这个接口,因为政企零星方案确认之后直接就工程开工了) +*/ + +type ModifyDesignSchemeLogInfo struct { + RemandName string `map:"remandName"` + RemandCode string `map:"remandCode"` + CreatedName string `map:"createdName"` + CreateDate string `map:"createDate"` + DelegateDate string `map:"delegateDate"` + BuildAttr string `map:"buildAttr"` + RemandTouzi string `map:"remandTouzi"` + BuildAddress string `map:"buildAddress"` + BuildScale string `map:"buildScale"` + BuildScheme string `map:"buildScheme"` + EponNum string `map:"eponNum"` + GponNum string `map:"gponNum"` + Epon10Num string `map:"epon10Num"` + Gpon10gNum string `map:"gpon10gNum"` + BuildPonNum string `map:"buildPonNum"` + OltTypes string `map:"oltTypes"` + OltPortNum string `map:"oltPortNum"` + BuildSwithNum string `map:"buildSwithNum"` + OltInvestment string `map:"oltInvestment"` + SwithInvestment string `map:"swithInvestment"` + PonPrice string `map:"ponPrice"` + ScpectPort string `map:"scpectPort"` + EquipCost string `map:"equipCost"` + EnginCost string `map:"enginCost"` + SafetyProdCost string `map:"safetyProdCost"` + SurveyCost string `map:"surveyCost"` + SupervisionCost string `map:"supervisionCost"` + OtherCost string `map:"otherCost"` + ReplyInvestment string `map:"replyInvestment"` + ContractFirInvestment string `map:"contractFirInvestment"` + ContractSecInvestment string `map:"contractSecInvestment"` + ContractThrInvestment string `map:"contractThrInvestment"` + ContractFouInvestment string `map:"contractFouInvestment"` + ContractFivInvestment string `map:"contractFivInvestment"` + PdmContent string `map:"pdmContent"` + SpecC string `map:"specC"` + RemandId string `map:"remandId"` + SkipFlag string `map:"skipFlag"` + CustTypeXr string `map:"custTypeXr"` + StoreState string `map:"storeState"` + IsGKOrder string `map:"isGKOrder"` + Token string `map:"token"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewModifyDesignSchemeLogInfo(token, html1 string) *ModifyDesignSchemeLogInfo { + modifyDesignSchemeLogInfo := new(ModifyDesignSchemeLogInfo) + modifyDesignSchemeLogInfo.RemandName = util.HTMLContentFindFirst(html1, "remandName") + modifyDesignSchemeLogInfo.RemandCode = util.HTMLContentFindFirst(html1, "remandCode") + modifyDesignSchemeLogInfo.CreatedName = util.HTMLContentFindFirst(html1, "createdName") + modifyDesignSchemeLogInfo.CreateDate = util.HTMLContentFindFirst(html1, "createDate") + modifyDesignSchemeLogInfo.DelegateDate = util.HTMLContentFindFirst(html1, "delegateDate") + modifyDesignSchemeLogInfo.BuildAttr = util.HTMLContentFindFirst(html1, "buildAttr") + modifyDesignSchemeLogInfo.RemandTouzi = util.HTMLContentFindFirst(html1, "remandTouzi") + modifyDesignSchemeLogInfo.BuildAddress = util.HTMLContentFindFirst(html1, "buildAddress") + modifyDesignSchemeLogInfo.BuildScale = util.HTMLContentFindFirst(html1, "buildScale") + modifyDesignSchemeLogInfo.BuildScheme = util.HTMLContentFindFirst(html1, "buildScheme") + modifyDesignSchemeLogInfo.EponNum = util.HTMLContentFindFirst(html1, "eponNum") + modifyDesignSchemeLogInfo.GponNum = util.HTMLContentFindFirst(html1, "gponNum") + modifyDesignSchemeLogInfo.Epon10Num = util.HTMLContentFindFirst(html1, "epon10Num") + modifyDesignSchemeLogInfo.Gpon10gNum = util.HTMLContentFindFirst(html1, "gpon10gNum") + modifyDesignSchemeLogInfo.BuildPonNum = util.HTMLContentFindFirst(html1, "buildPonNum") + modifyDesignSchemeLogInfo.OltTypes = util.HTMLContentFindFirst(html1, "oltTypes") + modifyDesignSchemeLogInfo.OltPortNum = util.HTMLContentFindFirst(html1, "oltPortNum") + modifyDesignSchemeLogInfo.BuildSwithNum = util.HTMLContentFindFirst(html1, "buildSwithNum") + modifyDesignSchemeLogInfo.OltInvestment = util.HTMLContentFindFirst(html1, "oltInvestment") + modifyDesignSchemeLogInfo.SwithInvestment = util.HTMLContentFindFirst(html1, "swithInvestment") + modifyDesignSchemeLogInfo.PonPrice = util.HTMLContentFindFirst(html1, "ponPrice") + modifyDesignSchemeLogInfo.ScpectPort = util.HTMLContentFindFirst(html1, "scpectPort") + modifyDesignSchemeLogInfo.EquipCost = util.HTMLContentFindFirst(html1, "equipCost") + modifyDesignSchemeLogInfo.EnginCost = util.HTMLContentFindFirst(html1, "enginCost") + modifyDesignSchemeLogInfo.SafetyProdCost = util.HTMLContentFindFirst(html1, "safetyProdCost") + modifyDesignSchemeLogInfo.SurveyCost = util.HTMLContentFindFirst(html1, "surveyCost") + modifyDesignSchemeLogInfo.SupervisionCost = util.HTMLContentFindFirst(html1, "supervisionCost") + modifyDesignSchemeLogInfo.OtherCost = util.HTMLContentFindFirst(html1, "otherCost") + modifyDesignSchemeLogInfo.ReplyInvestment = util.HTMLContentFindFirst(html1, "replyInvestment") + modifyDesignSchemeLogInfo.ContractFirInvestment = util.HTMLContentFindFirst(html1, "contractFirInvestment") + modifyDesignSchemeLogInfo.ContractSecInvestment = util.HTMLContentFindFirst(html1, "contractSecInvestment") + modifyDesignSchemeLogInfo.ContractThrInvestment = util.HTMLContentFindFirst(html1, "contractThrInvestment") + modifyDesignSchemeLogInfo.ContractFouInvestment = util.HTMLContentFindFirst(html1, "contractFouInvestment") + modifyDesignSchemeLogInfo.ContractFivInvestment = util.HTMLContentFindFirst(html1, "contractFivInvestment") + modifyDesignSchemeLogInfo.PdmContent = util.HTMLContentFindFirst(html1, "pdmContent") + modifyDesignSchemeLogInfo.SpecC = util.HTMLContentFindFirst(html1, "specC") + modifyDesignSchemeLogInfo.RemandId = util.HTMLContentFindFirst(html1, "remandId") + modifyDesignSchemeLogInfo.SkipFlag = util.HTMLContentFindFirst(html1, "skipFlag") + modifyDesignSchemeLogInfo.CustTypeXr = util.HTMLContentFindFirst(html1, "custTypeXr") + modifyDesignSchemeLogInfo.StoreState = util.HTMLContentFindFirst(html1, "storeState") + modifyDesignSchemeLogInfo.IsGKOrder = util.HTMLContentFindFirst(html1, "isGKOrder") + modifyDesignSchemeLogInfo.Token = token + modifyDesignSchemeLogInfo.Ranstr = cryptokit.RandomStr(true, 10, 32) + modifyDesignSchemeLogInfo.Timestamp = cryptokit.GetTimeStamp() + return modifyDesignSchemeLogInfo +} + +// GenReqParam 返回加密后的请求参数 +func (th *ModifyDesignSchemeLogInfo) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *ModifyDesignSchemeLogInfo) 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 *ModifyDesignSchemeLogInfo) 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())) + } + } +} diff --git a/cus-eng-con-sys/model/save_pro_and_start.go b/cus-eng-con-sys/model/save_pro_and_start.go index 05fff22..a90157e 100644 --- a/cus-eng-con-sys/model/save_pro_and_start.go +++ b/cus-eng-con-sys/model/save_pro_and_start.go @@ -3,6 +3,8 @@ package model import ( "cu-helper/cus-eng-con-sys/cryptokit" "reflect" + + "github.com/mizuki1412/go-core-kit/class/exception" ) /* @@ -25,14 +27,29 @@ type SaveProAndStart struct { Timestamp string `map:"timestamp"` } -func NewSaveProAndStart(parentProcInsId string) *SaveProAndStart { +func NewSaveProAndStart(parentProcInsId, actOrgName string) *SaveProAndStart { accConfirm := new(SaveProAndStart) accConfirm.ProcessDefinitionKey = "YSJFProcess" - accConfirm.Assignee = "3083195,3098707,3105305,3083564,3106207,3096322" //TODO 暂时写死 + //accConfirm.Assignee = "3083195,3098707,3105305,3083564,3106207,3096322" //TODO 暂时写死 + switch actOrgName { + case "中憬科技集团有限公司": + accConfirm.Assignee = "3080148,3102931,3105305,3083564,3106207,3083195" + accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"史湧军","splitBy":"3080148"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"项林杰","splitBy":"3102931"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张子杰","splitBy":"3105305"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"}]` + case "中金汇通信技术有限公司": + accConfirm.Assignee = "3080148,3102931,3104398,3083564,3106207,3083195" + accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"史湧军","splitBy":"3080148"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"项林杰","splitBy":"3102931"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"余秉","splitBy":"3104398"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"}]` + case "西安汇诚电信有限责任公司": + accConfirm.Assignee = "3080148,3102931,3083335,3083564,3106207,3083195" + accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"史湧军","splitBy":"3080148"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"项林杰","splitBy":"3102931"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张瑶","splitBy":"3083335"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"}]` + case "中通国脉通信股份有限公司": + accConfirm.Assignee = "3080148,3102931,3083335,3083564,3106207,3083195" + accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"史湧军","splitBy":"3080148"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"项林杰","splitBy":"3102931"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张瑶","splitBy":"3083335"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"}]` + default: + panic(exception.New("请设置施工单位交付人!")) + } accConfirm.TaskDefinitionKey = "JFSQ" accConfirm.ParentProcInsId = parentProcInsId - accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"王志华","splitBy":"3098707"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张子杰","splitBy":"3105305"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"王一鸣","splitBy":"3096322"}]` - //TODO 暂时写死 + //accConfirm.List = `[{"companyCode":"JS","siteAcc":"0","isRequired":"1","companyName":"建设单位","companySiteAcc":"4","LAY_TABLE_INDEX":0,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"周一彬","splitBy":"3083195"},{"companyCode":"JL","siteAcc":"0","isRequired":"1","companyName":"监理单位","companySiteAcc":"4","LAY_TABLE_INDEX":1,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"王志华","splitBy":"3098707"},{"companyCode":"SG","siteAcc":"0","isRequired":"1","companyName":"施工单位","companySiteAcc":"4","LAY_TABLE_INDEX":2,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张子杰","splitBy":"3105305"},{"companyCode":"SJ","siteAcc":"0","isRequired":"1","companyName":"设计单位","companySiteAcc":"4","LAY_TABLE_INDEX":3,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张超群","splitBy":"3083564"},{"companyCode":"ZY","siteAcc":"0","isRequired":"1","companyName":"资源管理部门","companySiteAcc":"4","LAY_TABLE_INDEX":4,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"张滋豪","splitBy":"3106207"},{"companyCode":"WH","siteAcc":"0","isRequired":"0","companyName":"接收单位(维护部门)","companySiteAcc":"4","LAY_TABLE_INDEX":5,"deliveryStatusName":"待交付","deliveryCommentsName":"","splitName":"王一鸣","splitBy":"3096322"}]` accConfirm.Ranstr = cryptokit.RandomStr(true, 10, 32) accConfirm.Timestamp = cryptokit.GetTimeStamp() return accConfirm diff --git a/cus-eng-con-sys/model/start_act_process.go b/cus-eng-con-sys/model/start_act_process.go index 43e1f6d..d84c399 100644 --- a/cus-eng-con-sys/model/start_act_process.go +++ b/cus-eng-con-sys/model/start_act_process.go @@ -1,6 +1,7 @@ package model import ( + "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "reflect" ) @@ -39,12 +40,17 @@ type StartActProcess struct { Timestamp string `map:"timestamp"` } -func NewStartActProcess(proInsId, taskId string) *StartActProcess { +func NewStartActProcess(proInsId, taskId, processDefinitionKey string) *StartActProcess { startActProcess := new(StartActProcess) startActProcess.ProcessInstanceId = proInsId startActProcess.TaskId = taskId startActProcess.TaskDefinitionKey = "GCSG" - startActProcess.Assignee = "3104398" //可修改,张子杰 //todo 零星不一样 + switch processDefinitionKey { + case config.ProcessHouse: + startActProcess.Assignee = "3104398" //可修改,余秉 + case config.ProcessLX: + startActProcess.Assignee = "3109710" //可修改,周秋伟 + } startActProcess.Comment = "请施工" startActProcess.HandleType = "1" startActProcess.Withdraw = "1" diff --git a/cus-eng-con-sys/model/udpate_accInfo.go b/cus-eng-con-sys/model/udpate_acc_info.go similarity index 89% rename from cus-eng-con-sys/model/udpate_accInfo.go rename to cus-eng-con-sys/model/udpate_acc_info.go index a4591f7..03720d0 100644 --- a/cus-eng-con-sys/model/udpate_accInfo.go +++ b/cus-eng-con-sys/model/udpate_acc_info.go @@ -1,11 +1,13 @@ 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" + "github.com/mizuki1412/go-core-kit/library/mathkit" "github.com/spf13/cast" - "reflect" ) /* @@ -97,7 +99,7 @@ type UpdateAccInfo struct { } // NewUpdateAccInfo remandId=businessKey -func NewUpdateAccInfo(token, remandId, html1, html2 string) *UpdateAccInfo { +func NewUpdateAccInfo(token, remandId, html1, html2, processDefinitionName, processDefinitionKey string) *UpdateAccInfo { updateAccInfo := new(UpdateAccInfo) updateAccInfo.AccId = util.RegexpFindFirst(html1, `"accId":"([^"]+)"`) updateAccInfo.Token = token @@ -142,22 +144,30 @@ func NewUpdateAccInfo(token, remandId, html1, html2 string) *UpdateAccInfo { updateAccInfo.SupervisionCost = util.RegexpFindFirst(html1, `"supervisionCost":(\d+(\.\d+)?)`) updateAccInfo.OtherCost = util.RegexpFindFirst(html1, `"otherCost":(\d+(\.\d+)?)`) updateAccInfo.AccInvestment = cast.ToString(mathkit.FloatRound(cast.ToFloat64(updateAccInfo.EquipCost)+cast.ToFloat64(updateAccInfo.EnginCost)+cast.ToFloat64(updateAccInfo.SafetyProdCost)+cast.ToFloat64(updateAccInfo.SurveyCost)+cast.ToFloat64(updateAccInfo.SupervisionCost)+cast.ToFloat64(updateAccInfo.OtherCost), 2)) - updateAccInfo.IsInstall = "ALL" - updateAccInfo.PasteCode = "1" - updateAccInfo.OnuLightWane = "DOWN" - updateAccInfo.WorkAcc = "1" - updateAccInfo.MaterialAcc = "1" - updateAccInfo.IsTestSpeed = "1" - updateAccInfo.UserRate = "1000" - updateAccInfo.TestSpeedAcc = "1" - updateAccInfo.BuildingNum = util.RegexpFindFirst(html1, `"buildingNum":(\d+(\.\d+)?)`) - updateAccInfo.PortNum = util.RegexpFindFirst(html1, `"portNum":(\d+(\.\d+)?)`) - updateAccInfo.InstallNum = util.RegexpFindFirst(html1, `"installNum":(\d+(\.\d+)?)`) - updateAccInfo.UnconditionalInstall = "ALL" - updateAccInfo.IsRecordAll = "1" - updateAccInfo.ResourcesAcc = "1" - updateAccInfo.BeamasPlitter = "1" - updateAccInfo.OtherNetworkResource = "" + switch processDefinitionKey { + case config.ProcessHouse: + switch processDefinitionName { + case config.ProcessNameXQXJ: + updateAccInfo.IsInstall = "ALL" + updateAccInfo.PasteCode = "1" + updateAccInfo.OnuLightWane = "DOWN" + updateAccInfo.WorkAcc = "1" + updateAccInfo.MaterialAcc = "1" + updateAccInfo.IsTestSpeed = "1" + updateAccInfo.UserRate = "1000" + updateAccInfo.TestSpeedAcc = "1" + updateAccInfo.BuildingNum = util.RegexpFindFirst(html1, `"buildingNum":(\d+(\.\d+)?)`) + updateAccInfo.PortNum = util.RegexpFindFirst(html1, `"portNum":(\d+(\.\d+)?)`) + updateAccInfo.InstallNum = util.RegexpFindFirst(html1, `"installNum":(\d+(\.\d+)?)`) + updateAccInfo.UnconditionalInstall = "ALL" + updateAccInfo.IsRecordAll = "1" + updateAccInfo.ResourcesAcc = "1" + updateAccInfo.BeamasPlitter = "1" + updateAccInfo.OtherNetworkResource = "" + case config.ProcessNameKR: + //没有以上参数 + } + } //updateAccInfo.DoubleExcellent = "0" //是否双优 updateAccInfo.IsSupClock = "0" updateAccInfo.NotClockName = "无需" diff --git a/cus-eng-con-sys/model/update_act_info.go b/cus-eng-con-sys/model/update_act_info.go new file mode 100644 index 0000000..8883d5b --- /dev/null +++ b/cus-eng-con-sys/model/update_act_info.go @@ -0,0 +1,258 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/util" + "reflect" + "time" +) + +/* +/zjgd/frm/actInfoController/updateActInfo +*/ + +/* +用途 +完工确认(扩容需要填写完工时间,需要调用这个接口) +*/ + +type UpdateActInfo struct { + RemandName string `map:"remandName"` + RemandCode string `map:"remandCode"` + ProjectName string `map:"projectName"` + ProjectCode string `map:"projectCode"` + CityName string `map:"cityName"` + City string `map:"city"` + ReplyInvestment string `map:"replyInvestment"` + StaffName string `map:"staffName"` + MobilPhone string `map:"mobilPhone"` + RemandStartDate string `map:"remandStartDate"` + BuildAddress string `map:"buildAddress"` + ActualFinishDate string `map:"actualFinishDate"` + EponNum string `map:"eponNum"` + GponNum string `map:"gponNum"` + Epon10Num string `map:"epon10Num"` + Gpon10gNum string `map:"gpon10gNum"` + BuildPonNum string `map:"buildPonNum"` + OltTypess string `map:"oltTypess"` + OltPortNum string `map:"oltPortNum"` + BuildSwithNum string `map:"buildSwithNum"` + OltInvestment string `map:"oltInvestment"` + SwithInvestment string `map:"swithInvestment"` + PonPrice string `map:"ponPrice"` + CoverTypeToRemind string `map:"coverTypeToRemind"` + FenceAddressType string `map:"fenceAddressType"` + UpPonType string `map:"upPonType"` + AccessWay string `map:"accessWay"` + ODNCoverReason string `map:"ODNCoverReason"` + BroadbandPortNum string `map:"broadbandPortNum"` + TipPortNum string `map:"tipPortNum"` + CascadePort string `map:"cascadePort"` + FtthPortNum string `map:"ftthPortNum"` + PonLan10gNum string `map:"ponLan10gNum"` + FiberBoxNum string `map:"fiberBoxNum"` + BuildTotalNum string `map:"buildTotalNum"` + CoverBuildTotalNum string `map:"coverBuildTotalNum"` + CoverBuildNum string `map:"coverBuildNum"` + ResiTotalNum string `map:"resiTotalNum"` + CoverResiTotalNum string `map:"coverResiTotalNum"` + CoverAddrNum string `map:"coverAddrNum"` + EntryLineDesc string `map:"entryLineDesc"` + PermeabilityRate string `map:"permeabilityRate"` + PonIdList string `map:"ponIdList"` + UpOltPoint string `map:"upOltPoint"` + OltIps string `map:"oltIps"` + OccupyPonNum string `map:"occupyPonNum"` + OccupyPonName string `map:"occupyPonName"` + UnselectedPonReason string `map:"unselectedPonReason"` + ActCoverBussCode string `map:"actCoverBussCode"` + CablePostion string `map:"cablePostion"` + IsPerpendLine string `map:"isPerpendLine"` + AccessEquipment string `map:"accessEquipment"` + ScpectPorg string `map:"scpectPorg"` + ActStartOrgId string `map:"actStartOrgId"` + ActStartOrgName string `map:"actStartOrgName"` + ActOrgCode string `map:"actOrgCode"` + OrgName string `map:"orgName"` + Phone string `map:"phone"` + BuildLimitedType string `map:"buildLimitedType"` + ActLimitType string `map:"actLimitType"` + BuildLimitedDays string `map:"buildLimitedDays"` + ActFinishDate string `map:"actFinishDate"` + ActStartDesc string `map:"actStartDesc"` + ActFinishDesc string `map:"actFinishDesc"` + Token string `map:"token"` + ActId string `map:"actId"` + RemandId string `map:"remandId"` + SplitRemandId string `map:"splitRemandId"` + IsSplitedRemand string `map:"isSplitedRemand"` + SaveOrUpdateType string `map:"saveOrUpdateType"` + Prov string `map:"prov"` + BussCode string `map:"bussCode"` + ProcInsId string `map:"procInsId"` + BuildType1 string `map:"buildType1"` + SpecCC string `map:"specCC"` + SpecB string `map:"specB"` + BuildModel string `map:"buildModel"` + Countys string `map:"countys"` + LinkCode string `map:"linkCode"` + BusiId string `map:"busiId'"` //todo 这是工建的bug + TaskIds string `map:"taskIds"` + SpecC string `map:"specC"` + Pass string `map:"pass"` + ActStartDate string `map:"actStartDate"` + TaskDefinitionKeys string `map:"taskDefinitionKeys"` + AttachCountyCode string `map:"attachCountyCode"` + IsCross string `map:"isCross"` + InvestmentConfigId string `map:"investmentConfigId"` + IsGrid string `map:"isGrid"` + AttactGrid string `map:"attactGrid"` + ResourceGridOrg string `map:"resourceGridOrg"` + GridId string `map:"gridId"` + IsExist string `map:"isExist"` + IsNewNational string `map:"isNewNational"` + VoicePortNum string `map:"voicePortNum"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewUpdateActInfo(html string) *UpdateActInfo { + updateActInfo := new(UpdateActInfo) + updateActInfo.RemandName = util.HTMLContentFindFirst(html, "remandName") + updateActInfo.RemandCode = util.HTMLContentFindFirst(html, "remandCode") + updateActInfo.ProjectName = util.HTMLContentFindFirst(html, "projectName") + updateActInfo.ProjectCode = util.HTMLContentFindFirst(html, "projectCode") + updateActInfo.CityName = util.HTMLContentFindFirst(html, "cityName") + updateActInfo.City = util.HTMLContentFindFirst(html, "city") + updateActInfo.ReplyInvestment = util.HTMLContentFindFirst(html, "replyInvestment") + updateActInfo.StaffName = util.HTMLContentFindFirst(html, "staffName") + updateActInfo.MobilPhone = util.HTMLContentFindFirst(html, "mobilPhone") + updateActInfo.RemandStartDate = util.HTMLContentFindFirst(html, "remandStartDate") + updateActInfo.BuildAddress = util.HTMLContentFindFirst(html, "buildAddress") + updateActInfo.ActualFinishDate = util.HTMLContentFindFirst(html, "actualFinishDate") + t, _ := time.Parse("2006-01-02 15:04:05", util.HTMLContentFindFirst(html, "actStartDate")) + if t.String() == "0001-01-01 00:00:00 +0000 UTC" { + updateActInfo.ActualFinishDate = "" + } else { + newDate := t.Add(48 * time.Hour).Format("2006-01-02") + updateActInfo.ActualFinishDate = newDate + } + updateActInfo.EponNum = util.HTMLContentFindFirst(html, "eponNum") + updateActInfo.GponNum = util.HTMLContentFindFirst(html, "gponNum") + updateActInfo.Epon10Num = util.HTMLContentFindFirst(html, "epon10Num") + updateActInfo.Gpon10gNum = util.HTMLContentFindFirst(html, "gpon10gNum") + updateActInfo.BuildPonNum = util.HTMLContentFindFirst(html, "buildPonNum") + updateActInfo.OltTypess = util.HTMLContentFindFirst(html, "oltTypess") + updateActInfo.OltPortNum = util.HTMLContentFindFirst(html, "oltPortNum") + updateActInfo.BuildSwithNum = util.HTMLContentFindFirst(html, "buildSwithNum") + updateActInfo.OltInvestment = util.HTMLContentFindFirst(html, "oltInvestment") + updateActInfo.SwithInvestment = util.HTMLContentFindFirst(html, "swithInvestment") + updateActInfo.PonPrice = util.HTMLContentFindFirst(html, "ponPrice") + updateActInfo.CoverTypeToRemind = util.HTMLContentFindFirst(html, "coverTypeToRemind") + updateActInfo.FenceAddressType = util.HTMLContentFindFirst(html, "fenceAddressType") + updateActInfo.UpPonType = util.HTMLContentFindFirst(html, "upPonType") + updateActInfo.AccessWay = util.HTMLContentFindFirst(html, "accessWay") + updateActInfo.ODNCoverReason = util.HTMLContentFindFirst(html, "ODNCoverReason") + updateActInfo.BroadbandPortNum = util.HTMLContentFindFirst(html, "broadbandPortNum") + updateActInfo.TipPortNum = util.HTMLContentFindFirst(html, "tipPortNum") + updateActInfo.CascadePort = util.HTMLContentFindFirst(html, "cascadePort") + updateActInfo.FtthPortNum = util.HTMLContentFindFirst(html, "ftthPortNum") + updateActInfo.PonLan10gNum = util.HTMLContentFindFirst(html, "ponLan10gNum") + updateActInfo.FiberBoxNum = util.HTMLContentFindFirst(html, "fiberBoxNum") + updateActInfo.BuildTotalNum = util.HTMLContentFindFirst(html, "buildTotalNum") + updateActInfo.CoverBuildTotalNum = util.HTMLContentFindFirst(html, "coverBuildTotalNum") + updateActInfo.CoverBuildNum = util.HTMLContentFindFirst(html, "coverBuildNum") + updateActInfo.ResiTotalNum = util.HTMLContentFindFirst(html, "resiTotalNum") + updateActInfo.CoverResiTotalNum = util.HTMLContentFindFirst(html, "coverResiTotalNum") + updateActInfo.CoverAddrNum = util.HTMLContentFindFirst(html, "coverAddrNum") + updateActInfo.EntryLineDesc = util.HTMLContentFindFirst(html, "entryLineDesc") + updateActInfo.PermeabilityRate = util.HTMLContentFindFirst(html, "permeabilityRate") + updateActInfo.PonIdList = util.HTMLContentFindFirst(html, "ponIdList") + updateActInfo.UpOltPoint = util.HTMLContentFindFirst(html, "upOltPoint") + updateActInfo.OltIps = util.HTMLContentFindFirst(html, "oltIps") + updateActInfo.OccupyPonNum = util.HTMLContentFindFirst(html, "occupyPonNum") + updateActInfo.OccupyPonName = util.HTMLContentFindFirst(html, "occupyPonName") + updateActInfo.UnselectedPonReason = util.HTMLContentFindFirst(html, "unselectedPonReason") + updateActInfo.ActCoverBussCode = util.HTMLContentFindFirst(html, "actCoverBussCode") + updateActInfo.CablePostion = util.HTMLContentFindFirst(html, "cablePostion") + updateActInfo.IsPerpendLine = util.HTMLContentFindFirst(html, "isPerpendLine") + updateActInfo.AccessEquipment = util.HTMLContentFindFirst(html, "accessEquipment") + updateActInfo.ScpectPorg = util.HTMLContentFindFirst(html, "scpectPorg") + updateActInfo.ActStartOrgId = util.HTMLContentFindFirst(html, "actStartOrgId") + updateActInfo.ActStartOrgName = util.HTMLContentFindFirst(html, "actStartOrgName") + updateActInfo.ActOrgCode = util.HTMLContentFindFirst(html, "actOrgCode") + updateActInfo.OrgName = util.HTMLContentFindFirst(html, "orgName") + updateActInfo.Phone = util.HTMLContentFindFirst(html, "phone") + updateActInfo.BuildLimitedType = util.HTMLContentFindFirst(html, "buildLimitedType") + updateActInfo.ActLimitType = util.HTMLContentFindFirst(html, "actLimitType") + updateActInfo.BuildLimitedDays = util.HTMLContentFindFirst(html, "buildLimitedDays") + updateActInfo.ActFinishDate = util.HTMLContentFindFirst(html, "actFinishDate") + updateActInfo.ActStartDesc = util.HTMLContentFindFirst(html, "actStartDesc") + updateActInfo.ActFinishDesc = util.HTMLContentFindFirst(html, "actFinishDesc") + updateActInfo.Token = util.HTMLContentFindFirst(html, "token") + updateActInfo.ActId = util.HTMLContentFindFirst(html, "actId") + updateActInfo.RemandId = util.HTMLContentFindFirst(html, "remandId") + updateActInfo.SplitRemandId = util.HTMLContentFindFirst(html, "splitRemandId") + updateActInfo.IsSplitedRemand = util.HTMLContentFindFirst(html, "isSplitedRemand") + updateActInfo.SaveOrUpdateType = "2" // todo 确认下 + updateActInfo.Prov = util.HTMLContentFindFirst(html, "prov") + updateActInfo.BussCode = util.HTMLContentFindFirst(html, "bussCode") + updateActInfo.ProcInsId = util.HTMLContentFindFirst(html, "procInsId") + updateActInfo.BuildType1 = util.HTMLContentFindFirst(html, "buildType1") + updateActInfo.SpecCC = util.HTMLContentFindFirst(html, "specCC") + updateActInfo.SpecB = util.HTMLContentFindFirst(html, "specB") + updateActInfo.BuildModel = util.HTMLContentFindFirst(html, "buildModel") + updateActInfo.Countys = util.HTMLContentFindFirst(html, "countys") + updateActInfo.LinkCode = util.HTMLContentFindFirst(html, "linkCode") + updateActInfo.BusiId = util.HTMLContentFindFirst(html, "busiId") // 你标记的BUG + updateActInfo.TaskIds = util.HTMLContentFindFirst(html, "taskIds") + updateActInfo.SpecC = util.HTMLContentFindFirst(html, "specC") + updateActInfo.Pass = util.HTMLContentFindFirst(html, "pass") + updateActInfo.ActStartDate = util.HTMLContentFindFirst(html, "actStartDate") + updateActInfo.TaskDefinitionKeys = util.HTMLContentFindFirst(html, "taskDefinitionKeys") + updateActInfo.AttachCountyCode = util.HTMLContentFindFirst(html, "attachCountyCode") + updateActInfo.IsCross = util.HTMLContentFindFirst(html, "isCross") + updateActInfo.InvestmentConfigId = util.HTMLContentFindFirst(html, "investmentConfigId") + updateActInfo.IsGrid = util.HTMLContentFindFirst(html, "isGrid") + updateActInfo.AttactGrid = util.HTMLContentFindFirst(html, "attactGrid") + updateActInfo.ResourceGridOrg = util.HTMLContentFindFirst(html, "resourceGridOrg") + updateActInfo.GridId = util.HTMLContentFindFirst(html, "gridId") + updateActInfo.IsExist = util.HTMLContentFindFirst(html, "isExist") + updateActInfo.IsNewNational = util.HTMLContentFindFirst(html, "isNewNational") + updateActInfo.VoicePortNum = "0" //写死 + return updateActInfo +} + +// GenReqParam 返回加密后的请求参数 +func (th *UpdateActInfo) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *UpdateActInfo) 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 *UpdateActInfo) 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())) + } + } +} diff --git a/cus-eng-con-sys/model/update_act_info_org_staff.go b/cus-eng-con-sys/model/update_act_info_org_staff.go index 15fd4ad..40e85cd 100644 --- a/cus-eng-con-sys/model/update_act_info_org_staff.go +++ b/cus-eng-con-sys/model/update_act_info_org_staff.go @@ -1,6 +1,7 @@ package model import ( + "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "reflect" ) @@ -21,10 +22,16 @@ type UpdateActInfoOrgAndStaff struct { Timestamp string `map:"timestamp"` } -func NewUpdateActInfoOrgAndStaff(actId string) *UpdateActInfoOrgAndStaff { +func NewUpdateActInfoOrgAndStaff(actId, processDefinitionKey string) *UpdateActInfoOrgAndStaff { updateActInfoOrgAndStaff := new(UpdateActInfoOrgAndStaff) - updateActInfoOrgAndStaff.ActStartOrgId = "3104398" //todo 鱼饼 零星需改 - updateActInfoOrgAndStaff.ActOrgCode = "1538688" //todo 余秉 零星需改 + switch processDefinitionKey { + case config.ProcessHouse: //小区(包括扩容) + updateActInfoOrgAndStaff.ActStartOrgId = "3104398" //todo 余秉 + updateActInfoOrgAndStaff.ActOrgCode = "1538688" //todo 余秉 + case config.ProcessLX: + updateActInfoOrgAndStaff.ActStartOrgId = "3109710" //todo 周秋伟 + updateActInfoOrgAndStaff.ActOrgCode = "1538443" //todo 周秋伟 + } updateActInfoOrgAndStaff.ActId = actId updateActInfoOrgAndStaff.Ranstr = cryptokit.RandomStr(true, 10, 32) updateActInfoOrgAndStaff.Timestamp = cryptokit.GetTimeStamp() diff --git a/cus-eng-con-sys/service/acceptance_apply.go b/cus-eng-con-sys/service/acceptance_apply.go new file mode 100644 index 0000000..a7b4086 --- /dev/null +++ b/cus-eng-con-sys/service/acceptance_apply.go @@ -0,0 +1,46 @@ +package service + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/model" + "strings" + + "github.com/mizuki1412/go-core-kit/class/exception" + "github.com/mizuki1412/go-core-kit/service/logkit" +) + +// ReqAccApply 验收申请请求 +/* +验收申请分2个步骤进行 +1、获取下一步办理人员Assignee +2、提交验收申请请求 +*/ + +func ReqAccApply(ctx *model.Ctx) { + //这里YSQR指的是下一个步骤,获取下一个步骤办理人员 + id := getAssigneeId(ctx, "YSQR") + reqAccApplyPushProcess(ctx, id) +} + +func reqAccApplyPushProcess(ctx *model.Ctx, assigneeId string) { + remandId := getRemandId(ctx) + token := getToken(ctx.RestyClient) + processInstanceId := ctx.Data.Get("processInstanceId").String() + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() + taskId := ctx.Data.Get("id").String() + html1 := toAcceptanceConfirm2(ctx, remandId) + html2 := toRemandShowCommon(ctx.RestyClient, remandId) + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewAccApplyPushProcess(token, remandId, processInstanceId, taskId, html1, html2, assigneeId, processDefinitionKey) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceController/pushProcess.action") + if err != nil { + panic(exception.New(err.Error())) + } + data := strings.Trim(resp.String(), `"`) + logkit.Info("accApplyPushProcess:" + cryptokit.Decrypt(data)) +} diff --git a/cus-eng-con-sys/service/acceptance_confirm.go b/cus-eng-con-sys/service/acceptance_confirm.go index 38fd2df..ae9ffc6 100644 --- a/cus-eng-con-sys/service/acceptance_confirm.go +++ b/cus-eng-con-sys/service/acceptance_confirm.go @@ -4,36 +4,86 @@ import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" + "cu-helper/cus-eng-con-sys/util" + "strings" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/logkit" + "github.com/spf13/cast" "github.com/tidwall/gjson" - "strings" ) // ReqAccConfirm 验收确认请求 /* -验收确认分两个步骤进行 -1、更新ACC信息 -2、提交验收确认 +验收确认分3个步骤进行 +1、判断五达标 +2、更新ACC信息 +3、提交验收确认 */ // ReqAccConfirm parenProcInsId=processInstanceId func ReqAccConfirm(ctx *model.Ctx) { + //判断五达标是否有已废弃 + parenProcInsId := ctx.Data.Get("processInstanceId").String() + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewSearchAccSendList(parenProcInsId) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/searchAccSendList") + if err != nil { + panic(exception.New(err.Error())) + } + data := strings.Trim(resp.String(), `"`) + decrypt := cryptokit.Decrypt(data) + ok := gjson.Get(decrypt, "data").Array() + // ===================== 核心逻辑开始 ===================== + // 只要有一个状态 不是空 也不是 ABANDON → 直接退出整个函数,不往下走 + hasInvalid := false + for _, v := range ok { + deliveryStatus := gjson.Get(v.String(), "deliveryStatus").String() + if deliveryStatus != "" && deliveryStatus != "ABANDON" { + hasInvalid = true + break + } + } + + // 有无效状态 → 直接结束函数,后面两个方法不调用 + if hasInvalid { + logkit.Info("已分发五达标,无需再分发五达标") + return + } + // ===================== 核心逻辑结束 ===================== + + // ↓↓↓↓ 只有 全空 / 全ABANDON / 混合(空,ABANDON) 才会走到这里 ↓↓↓↓ //更新ACC信息 - updateAccInfo(ctx) - //提交验收确认 - saveProAndStart(ctx) + actOrgName, accInvestment := updateAccInfo(ctx) + processDefinitionName := ctx.Data.Get("processDefinitionName").String() + switch processDefinitionName { + case config.ProcessNameXQXJ: + //如果是小区新建,一定要进行五达标 + saveProAndStart(ctx, actOrgName) + case config.ProcessNameKR: + if cast.ToInt64(accInvestment) >= 3000 { + //大于等于3000才进行五达标 + logkit.Info("accInvestment=" + accInvestment + " 需要进行五达标!") + saveProAndStart(ctx, actOrgName) + } + } } -func updateAccInfo(ctx *model.Ctx) { +func updateAccInfo(ctx *model.Ctx) (string, string) { + processDefinitionName := ctx.Data.Get("processDefinitionName").String() + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() remandId := getRemandId(ctx) html1 := toAcceptanceConfirm(ctx, remandId) token := getToken(ctx.RestyClient) html2 := toRemandShowCommon(ctx.RestyClient, remandId) h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewUpdateAccInfo(token, remandId, html1, html2) + f := model.NewUpdateAccInfo(token, remandId, html1, html2, processDefinitionName, processDefinitionKey) form := f.GenReqParam() client := ctx.RestyClient resp, err := client.R(). @@ -43,14 +93,15 @@ func updateAccInfo(ctx *model.Ctx) { } data := strings.Trim(resp.String(), `"`) logkit.Info("updateAccInfo:" + cryptokit.Decrypt(data)) + return util.HTMLContentFindFirst(html2, "actOrgName"), cryptokit.Decrypt(f.AccInvestment) } -func saveProAndStart(ctx *model.Ctx) { +func saveProAndStart(ctx *model.Ctx, actOrgName string) { parenProcInsId := ctx.Data.Get("processInstanceId").String() client := ctx.RestyClient h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewSaveProAndStart(parenProcInsId) + f := model.NewSaveProAndStart(parenProcInsId, actOrgName) form := f.GenReqParam() resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/saveProAndStart") @@ -82,11 +133,11 @@ func getToken(client *resty.Client) string { func toAcceptanceConfirm(ctx *model.Ctx, businessKey string) string { processInstId := ctx.Data.Get("processInstanceId").String() taskId := ctx.Data.Get("id").String() - taskdefinitionKey := ctx.Data.Get("taskdefinitionKey").String() + taskDefinitionKey := ctx.Data.Get("taskdefinitionKey").String() client := ctx.RestyClient h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - query := model.NewCommonFormGetHtml(businessKey, processInstId, taskdefinitionKey, taskId) + query := model.NewCommonFormGetHtml(businessKey, processInstId, taskDefinitionKey, taskId) resp, err := client.R(). SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/toAcceptanceComfirm?businessKey=" + query.BusinessKey + "&processInstanceId=" + query.ProcessInstanceId + "&taskId=" + query.TaskId + "&startLink=" + query.StartLink + "&endLink=" + query.EndLink + "&taskflag=" + query.TaskFlag + "&ranstr=" + query.Ranstr + "×tamp=" + query.Timestamp + "&_=" + query.TimestampPro) if err != nil { diff --git a/cus-eng-con-sys/service/common.go b/cus-eng-con-sys/service/common.go index 832340a..a6ee873 100644 --- a/cus-eng-con-sys/service/common.go +++ b/cus-eng-con-sys/service/common.go @@ -4,10 +4,11 @@ import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" + "strings" + "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/logkit" "github.com/tidwall/gjson" - "strings" ) // businessKey=remandId @@ -70,3 +71,46 @@ func findLinkBusinessCode(ctx *model.Ctx) string { data := strings.Trim(resp.String(), `"`) return gjson.Get(cryptokit.Decrypt(data), "BUSS_CODE").String() } + +// businessKey=remandId,taskId=id +func toAcceptanceConfirm2(ctx *model.Ctx, businessKey string) string { + processInstId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + taskDefinitionKey := ctx.Data.Get("taskDefinitionKey").String() + client := ctx.RestyClient + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + query := model.NewCommonFormGetHtml(businessKey, processInstId, taskDefinitionKey, taskId) + resp, err := client.R(). + SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/acceptanceController/toAcceptance?businessKey=" + query.BusinessKey + "&processInstanceId=" + query.ProcessInstanceId + "&taskDefinitionKey=" + query.TaskDefinitionKey + "&taskId=" + query.TaskId + "&startLink=" + query.StartLink + "&endLink=" + query.EndLink + "&taskflag=" + query.TaskFlag + "&ranstr=" + query.Ranstr + "×tamp=" + query.Timestamp + "&_=" + query.TimestampPro) + if err != nil { + panic(exception.New(err.Error())) + } + return resp.String() +} + +func getAssigneeId(ctx *model.Ctx, taskDefinitionKey string) string { + processInstanceId := ctx.Data.Get("processInstanceId").String() + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() + businessCode := findLinkBusinessCode(ctx) + remandId := getRemandId(ctx) + html1 := toAcceptanceConfirm2(ctx, remandId) //todo 这里实际上只适配验收申请,完工确认其实不应该调用这个,但是也能用 + client := ctx.RestyClient + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewGetAssignee(businessCode, html1, processDefinitionKey, processInstanceId, taskDefinitionKey) + form := f.GenReqParam() + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflowrest/assignee/" + processDefinitionKey + "/" + taskDefinitionKey + "/" + processInstanceId + "/" + "1") + if err != nil { + panic(exception.New(err.Error())) + } + data := strings.Trim(resp.String(), `"`) + decrypt := cryptokit.Decrypt(data) + dataRow := gjson.Get(decrypt, "dataRows").Array() + if len(dataRow) == 0 { + panic(exception.New("dataRow array len = 0")) + } + logkit.Info("getAssignee:" + dataRow[0].String()) + return dataRow[0].Get("value").String() +} diff --git a/cus-eng-con-sys/service/design_scheme.go b/cus-eng-con-sys/service/design_scheme.go index d4661ad..1526234 100644 --- a/cus-eng-con-sys/service/design_scheme.go +++ b/cus-eng-con-sys/service/design_scheme.go @@ -4,26 +4,31 @@ import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" + "strings" + "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/configkit" "github.com/mizuki1412/go-core-kit/service/logkit" "github.com/tidwall/gjson" - "strings" ) // ReqDesignScheme 方案确认请求 /* -验收确认分两个步骤进行 +验收确认分五个步骤进行 1、通过项目编号找到projectId 2、查项目剩余投资是否符合 3、绑定需求至项目 -4、提交方案确认 +4、如果是政企零星还要此步骤,因为政企零星直接就工程开工了,需要从goDesignSchemeConfirm获取html信息,再modifyDesignSchemeLogInfo才能提交,不然会报错 +5、提交方案确认 */ func ReqDesignScheme(ctx *model.Ctx) { projId := getProjectId(ctx) touzi := checkProjInvest(ctx, projId) modifyProject(ctx, projId, touzi) + if ctx.Data.Get("processDefinitionKey").String() == config.ProcessLX { + modDesignLogInfo(ctx) + } passflow(ctx) } @@ -117,6 +122,27 @@ func modifyProject(ctx *model.Ctx, projId, touzi string) { logkit.Info("modifyProject:" + data) } +func modDesignLogInfo(ctx *model.Ctx) { + token := getToken(ctx.RestyClient) + remandId := getRemandId(ctx) + html := goDesignSchemeConfirm(ctx, remandId) + stepCode := cryptokit.Encrypt("JSTZ") //todo 零星需要这个 其他还未知 + processDefinitionKey := cryptokit.Encrypt(ctx.Data.Get("processDefinitionKey").String()) + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewModifyDesignSchemeLogInfo(token, html) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/designSchemeController/modifyDesignSchemeLogInfo?stepCode=" + stepCode + "&processDefinitionKey=" + processDefinitionKey) + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("modDesignLogInfo:" + data) +} + func passflow(ctx *model.Ctx) { processInsId := ctx.Data.Get("processInstanceId").String() taskId := ctx.Data.Get("id").String() @@ -135,3 +161,20 @@ func passflow(ctx *model.Ctx) { data := cryptokit.Decrypt(dataOri) logkit.Info("degisnSchemePassflow:" + data) } + +// businessKey=remandId,taskId=id +func goDesignSchemeConfirm(ctx *model.Ctx, businessKey string) string { + processInstId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + taskDefinitionKey := ctx.Data.Get("taskdefinitionKey").String() + client := ctx.RestyClient + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + query := model.NewCommonFormGetHtml(businessKey, processInstId, taskDefinitionKey, taskId) + resp, err := client.R(). + SetHeaders(header).Get(config.UrlPrefix + "/zjgd/frm/designSchemeController/goDesignSchemeConfirm?businessKey=" + query.BusinessKey + "&processInstanceId=" + query.ProcessInstanceId + "&taskDefinitionKey=" + query.TaskDefinitionKey + "&taskId=" + query.TaskId + "&startLink=" + query.StartLink + "&endLink=" + query.EndLink + "&taskflag=" + query.TaskFlag + "&ranstr=" + query.Ranstr + "×tamp=" + query.Timestamp + "&_=" + query.TimestampPro) + if err != nil { + panic(exception.New(err.Error())) + } + return resp.String() +} diff --git a/cus-eng-con-sys/service/finish_act.go b/cus-eng-con-sys/service/finish_act.go new file mode 100644 index 0000000..d66c37f --- /dev/null +++ b/cus-eng-con-sys/service/finish_act.go @@ -0,0 +1,74 @@ +package service + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/model" + "strings" + + "github.com/mizuki1412/go-core-kit/class/exception" + "github.com/mizuki1412/go-core-kit/service/logkit" +) + +// ReqFinishAct 完工确认请求 +/* +完工确认分3个步骤进行 +1、获取下一步办理人员Assignee(零星,扩容是资源录入需要手动指定) +2、上传完工报告 +3、提交完工确认请求 +*/ + +func ReqFinishAct(ctx *model.Ctx) { + //这里YSSQ指的是下一个步骤,获取下一个步骤办理人员 + //todo 目前只能用于零星,小区的下一步是资源录入 + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() + docUploadWGQR(ctx) + switch processDefinitionKey { + case config.ProcessHouse: + //小区要先资源录入 + reqFinishActProcess(ctx, "") + case config.ProcessLX: + //零星直接验收申请 + id := getAssigneeId(ctx, "YSSQ") + reqFinishActProcess(ctx, id) + } +} + +func docUploadWGQR(ctx *model.Ctx) { + businessKey := getRemandId(ctx) + taskId := ctx.Data.Get("id").String() + h := model.NewHeader("multipart/form-data") + header := h.GenReqParam() + f := model.NewDocUpload(businessKey, "WGQR", "ACT", taskId) + form := f.GenReqParam() + crypt := cryptokit.NewDocEncrypt() + params := crypt.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).SetQueryParams(params).SetFile("myfile", config.DocUploadWGQRFilePath).Post(config.UrlPrefix + "/zjgd/frm/docInfoController/goUpload.action") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("docUploadWGQR:" + data) +} + +func reqFinishActProcess(ctx *model.Ctx, assigneeId string) { + processInsId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewFinishActProcess(processInsId, taskId, assigneeId, processDefinitionKey) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/actInfoController/startActFinishProcess") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("finishActProcess:" + data) +} diff --git a/cus-eng-con-sys/service/start_act.go b/cus-eng-con-sys/service/start_act.go index a7e1c4c..369059e 100644 --- a/cus-eng-con-sys/service/start_act.go +++ b/cus-eng-con-sys/service/start_act.go @@ -4,10 +4,11 @@ import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" + "strings" + "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/logkit" "github.com/tidwall/gjson" - "strings" ) // ReqStartAct 工程开工请求 @@ -45,9 +46,10 @@ func saveActInfo(ctx *model.Ctx) string { } func updateActInfoOrgAndStaff(ctx *model.Ctx, actId string) { + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewUpdateActInfoOrgAndStaff(actId) + f := model.NewUpdateActInfoOrgAndStaff(actId, processDefinitionKey) form := f.GenReqParam() client := ctx.RestyClient resp, err := client.R(). @@ -60,11 +62,12 @@ func updateActInfoOrgAndStaff(ctx *model.Ctx, actId string) { } func startActProcess(ctx *model.Ctx) { + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() processInsId := ctx.Data.Get("processInstanceId").String() taskId := ctx.Data.Get("id").String() h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewStartActProcess(processInsId, taskId) + f := model.NewStartActProcess(processInsId, taskId, processDefinitionKey) form := f.GenReqParam() client := ctx.RestyClient resp, err := client.R(). diff --git a/cus-eng-con-sys/util/find.go b/cus-eng-con-sys/util/find.go index 9bee96c..befac9a 100644 --- a/cus-eng-con-sys/util/find.go +++ b/cus-eng-con-sys/util/find.go @@ -1,10 +1,11 @@ package util import ( - "github.com/mizuki1412/go-core-kit/class/exception" - "golang.org/x/net/html" "regexp" "strings" + + "github.com/mizuki1412/go-core-kit/class/exception" + "golang.org/x/net/html" ) func RegexpFindFirst(content, regexpExpress string) string { @@ -23,34 +24,47 @@ func RegexpFindFirst(content, regexpExpress string) string { } func HTMLContentFindFirst(content, attrVal string) string { - // 使用 html.Parse 解析 HTML 内容 + // 解析 HTML doc, err := html.Parse(strings.NewReader(content)) if err != nil { panic(exception.New(err.Error())) } - // 递归函数来查找节点 + var res string - var findProjectName func(*html.Node) - findProjectName = func(n *html.Node) { - // 查找标签为 input 的节点 - if n.Type == html.ElementNode && n.Data == "input" { - for _, attr := range n.Attr { - if attr.Key == "name" && attr.Val == attrVal { - // 获取 value 属性的值作为 res - for _, attr := range n.Attr { - if attr.Key == "value" { - res = attr.Val + var find func(*html.Node) + + find = func(n *html.Node) { + if n.Type == html.ElementNode { + // 同时支持 input 和 textarea + if n.Data == "input" || n.Data == "textarea" { + // 匹配 name 属性 + for _, attr := range n.Attr { + if attr.Key == "name" && attr.Val == attrVal { + // 如果是 input,取 value + if n.Data == "input" { + for _, a := range n.Attr { + if a.Key == "value" { + res = a.Val + return + } + } + } + // 如果是 textarea,取内部文本(最关键!你之前没写) + if n.Data == "textarea" && n.FirstChild != nil { + res = n.FirstChild.Data return } } } } } - // 递归处理子节点 + + // 递归子节点 for c := n.FirstChild; c != nil; c = c.NextSibling { - findProjectName(c) + find(c) } } - findProjectName(doc) - return res + + find(doc) + return strings.TrimSpace(res) // 自动去空格换行 }