From eb97fb305d949f7e1605ac08f8c5a2f5b9b094c9 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 13 Jan 2026 15:16:17 +0800 Subject: [PATCH] update: con-eng-con-sys --- cmd/cus_eng_con_sys.go | 58 ++++-- cus-eng-con-sys/config/config.go | 43 +---- cus-eng-con-sys/config/config_constant.go | 37 +--- ...process.go => acc_confirm_push_process.go} | 2 +- .../{get_business_key.go => common_form.go} | 19 +- ...nce_confirm.go => common_form_get_html.go} | 14 +- cus-eng-con-sys/model/context.go | 11 ++ .../model/design_scheme_passflow.go | 96 ++++++++++ cus-eng-con-sys/model/get_proj_invest.go | 101 +++++++++++ cus-eng-con-sys/model/modify_remand_proj.go | 72 ++++++++ cus-eng-con-sys/model/pdm_push_process.go | 4 +- cus-eng-con-sys/model/save_act_info.go | 170 ++++++++++++++++++ cus-eng-con-sys/model/save_pro_and_start.go | 5 - cus-eng-con-sys/model/search_project_list.go | 64 +++++++ cus-eng-con-sys/model/start_act_process.go | 90 ++++++++++ .../model/update_act_info_org_staff.go | 66 +++++++ .../model/update_pdm_production.go | 18 +- cus-eng-con-sys/service/acceptance_confirm.go | 61 +++---- .../service/acceptance_delivery.go | 25 +-- cus-eng-con-sys/service/common.go | 72 ++++++++ cus-eng-con-sys/service/design_scheme.go | 137 ++++++++++++++ cus-eng-con-sys/service/pdm_entrust.go | 67 +++---- cus-eng-con-sys/service/start_act.go | 78 ++++++++ cus-eng-con-sys/service/withdraw_assign.go | 24 +-- 24 files changed, 1117 insertions(+), 217 deletions(-) rename cus-eng-con-sys/model/{push_process.go => acc_confirm_push_process.go} (99%) rename cus-eng-con-sys/model/{get_business_key.go => common_form.go} (67%) rename cus-eng-con-sys/model/{to_acceptance_confirm.go => common_form_get_html.go} (51%) create mode 100644 cus-eng-con-sys/model/context.go create mode 100644 cus-eng-con-sys/model/design_scheme_passflow.go create mode 100644 cus-eng-con-sys/model/get_proj_invest.go create mode 100644 cus-eng-con-sys/model/modify_remand_proj.go create mode 100644 cus-eng-con-sys/model/save_act_info.go create mode 100644 cus-eng-con-sys/model/search_project_list.go create mode 100644 cus-eng-con-sys/model/start_act_process.go create mode 100644 cus-eng-con-sys/model/update_act_info_org_staff.go create mode 100644 cus-eng-con-sys/service/common.go create mode 100644 cus-eng-con-sys/service/design_scheme.go create mode 100644 cus-eng-con-sys/service/start_act.go diff --git a/cmd/cus_eng_con_sys.go b/cmd/cus_eng_con_sys.go index f57efcf..4c33458 100644 --- a/cmd/cus_eng_con_sys.go +++ b/cmd/cus_eng_con_sys.go @@ -2,7 +2,9 @@ package cmd import ( "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/model" "cu-helper/cus-eng-con-sys/service" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/init/initkit" "github.com/mizuki1412/go-core-kit/library/commonkit" "github.com/mizuki1412/go-core-kit/library/filekit" @@ -23,32 +25,54 @@ var engSysCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { initkit.BindFlags(cmd) config.Init() - run(config.Conf) + run() }, } -func run(c *config.Config) { +func run() { j, _ := filekit.ReadString("kr.json") data := gjson.Get(j, "data").Array() + client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) + ctx := new(model.Ctx) + ctx.RestyClient = client for _, v := range data { - name := v.Get("name").String() - process := v.Get("processDefinitionKey").String() - if name == c.Step && process == c.Process { - logkit.Info("***现在开始处理***:" + gjson.Get(v.String(), "tasktitle").String()) - _ = commonkit.RecoverFuncWrapper(func() { - //service.ReqAccConfirm(v.Get("processInstanceId").String(), v.Get("id").String()) - //service.ReqWithdrawAssign(v.Get("processInstanceId").String()) - //service.ReqAccDelivery(v.Get("processInstanceId").String(), v.Get("id").String()) - service.ReqPdmEntrust(v.Get("processInstanceId").String(), v.Get("id").String(), gjson.Get(v.String(), "tasktitle").String()) - }) - time.Sleep(1 * time.Second) - } + ctx.Data = &v + logkit.Info("***现在开始处理***:" + v.Get("tasktitle").String()) + _ = 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.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() {}, + //{Step: "验收交付申请", Process: config.ProcessYSJF}: func() {}, + //楼宇 + //{Step: "设计委托", Process: config.ProcessBuilding}: func() {}, + //{Step: "方案确认", Process: config.ProcessBuilding}: func() {}, + //{Step: "完工确认", Process: config.ProcessBuilding}: func() {}, + //{Step: "验收确认", Process: config.ProcessBuilding}: func() {}, + //{Step: "验收交付申请", Process: config.ProcessYSJF}: func() {}, + //todo 工程评价 + } + status := config.Status{ + Step: v.Get("name").String(), + Process: v.Get("processDefinitionKey").String(), + } + if h, ok := handlers[status]; ok { + h() + } + }) + time.Sleep(1 * time.Second) } } func defFlagsEng(cmd *cobra.Command) { - cmd.Flags().String(config.EngSysProcess, "", "Specify the process to be processed, supporting: XQXJ,ZQLX,LYXJ,YSJF") - cmd.Flags().String(config.EngSysStep, "", "Specify the steps to be processed, supporting: SJWT,YSQR,JFSQ") cmd.Flags().String(config.EngSysSid, "", "Specify the sid") - //TODO 验收确认阶段,还需要指定交付的人,暂时写死在代码里,目前只适用于周一彬,如果需要调整,则暂时先在代码里调整 } diff --git a/cus-eng-con-sys/config/config.go b/cus-eng-con-sys/config/config.go index ce44b16..d653906 100644 --- a/cus-eng-con-sys/config/config.go +++ b/cus-eng-con-sys/config/config.go @@ -5,52 +5,21 @@ import ( "github.com/mizuki1412/go-core-kit/service/logkit" ) +type Status struct { + Step string //当前步骤 + Process string //区分是小区、楼宇、零星流程 +} + type Config struct { - Step string - Sid string - Process string + Sid string } var Conf = new(Config) func Init() { - step := configkit.GetString(EngSysStep, "") - if step == "" { - logkit.Fatal("EngSysStep Empty!") - } - //判断是否支持此步骤 - switch step { - case EngSysStepYSQR: - configkit.Set(EngSysStep, StepYSQR) - case EngSysStepJFSQ: - configkit.Set(EngSysStep, StepJFSQ) - case EngSysStepSJWT: - configkit.Set(EngSysStep, StepSJWT) - default: - logkit.Fatal("EngSysStep Not Support!") - } - process := configkit.GetString(EngSysProcess, "") - if process == "" { - logkit.Fatal("EngSysProcess Empty!") - } - //判断是否支持此流程,并进行替换,替换的目的是能让直接被程序使用,程序所用的太难懂,直接放到config里容易搞错 - switch process { - case EngSysProcessXQXJ: - configkit.Set(EngSysProcess, ProcessNewHouse) - case EngSysProcessLYXJ: - configkit.Set(EngSysProcess, ProcessNewBuilding) - case EngSysProcessZQLX: - configkit.Set(EngSysProcess, ProcessNewLX) - case EngSysProcessYSJF: - configkit.Set(EngSysProcess, ProcessYSJF) - default: - logkit.Fatal("EngSysStep Not Support!") - } sid := configkit.GetString(EngSysSid, "") if sid == "" { logkit.Fatal("EngSysSid Empty!") } - Conf.Step = configkit.GetString(EngSysStep, "") - Conf.Process = configkit.GetString(EngSysProcess, "") Conf.Sid = sid } diff --git a/cus-eng-con-sys/config/config_constant.go b/cus-eng-con-sys/config/config_constant.go index f35c74a..97536a3 100644 --- a/cus-eng-con-sys/config/config_constant.go +++ b/cus-eng-con-sys/config/config_constant.go @@ -1,37 +1,18 @@ package config const ( - EngSysStep = "eng.step" - EngSysSid = "eng.sid" - EngSysProcess = "eng.pro" + EngSysSid = "eng.sid" + EngDefaultProjLXCode = "eng.projLX" + EngDefaultProjKRCode = "eng.projKR" + EngDefaultProjXQCode = "eng.projXQ" + EngDefaultProjLYCode = "eng.projLY" ) const ( - EngSysStepYSQR = "YSQR" - EngSysStepJFSQ = "JFSQ" - EngSysStepSJWT = "SJWT" -) - -const ( - StepYSQR = "验收确认" - StepJFSQ = "验收交付申请" - StepSJWT = "设计委托" -) - -// config里入参 -const ( - EngSysProcessXQXJ = "XQXJ" - EngSysProcessZQLX = "ZQLX" //TODO 这个还不确定是不是就是零星 - EngSysProcessLYXJ = "LYXJ" - EngSysProcessYSJF = "YSJF" -) - -// 替换成系统能识别的参数 -const ( - ProcessNewBuilding = "JkDkhfgProcess" //楼宇新建 - ProcessNewHouse = "GkXjGzKrProcess" //小区新建 - ProcessNewLX = "ZQKHProcess" //政企零星 //TODO 这个还不确定 - ProcessYSJF = "YSJFProcess" + ProcessBuilding = "JkDkhfgProcess" //楼宇 + ProcessHouse = "GkXjGzKrProcess" //小区(包括扩容) + ProcessLX = "ZQKHProcess" //政企零星 + ProcessYSJF = "YSJFProcess" ) const UrlPrefix = "http://10.202.2.108:8086" diff --git a/cus-eng-con-sys/model/push_process.go b/cus-eng-con-sys/model/acc_confirm_push_process.go similarity index 99% rename from cus-eng-con-sys/model/push_process.go rename to cus-eng-con-sys/model/acc_confirm_push_process.go index cd4e986..5523d62 100644 --- a/cus-eng-con-sys/model/push_process.go +++ b/cus-eng-con-sys/model/acc_confirm_push_process.go @@ -14,7 +14,7 @@ import ( /* 用途 -PushProcess +验收确认最后一步流程推送 */ //tip 工建能写出这么多form参数的的程序员,也是个人才,不能用json吗?我真服了你! diff --git a/cus-eng-con-sys/model/get_business_key.go b/cus-eng-con-sys/model/common_form.go similarity index 67% rename from cus-eng-con-sys/model/get_business_key.go rename to cus-eng-con-sys/model/common_form.go index 4fdaab4..8a57d5f 100644 --- a/cus-eng-con-sys/model/get_business_key.go +++ b/cus-eng-con-sys/model/common_form.go @@ -6,34 +6,35 @@ import ( ) /* +/zjgd/frm/workflow/findLinkBusscode?processInstanceId=Z9Y5/rPRqUYOsKXGXm/vwA== /zjgd/frm/workflowrest/tasktodopath/GkXjGzKrProcess/62397218/YSQR/65234585/ZH_XZ */ /* -用途 -1、/zjgd/frm/acceptanceController/udpateAccInfo.action时入参使用 +不带其他参数通用的form +用途(目前是findLinkBusscode和getBusinessKey=remandId使用) */ -// GetBusinessKeyReq 获取RemandId,RemandId=BusinessKey -type GetBusinessKeyReq struct { +// CommonFormReq 获取RemandId,RemandId=BusinessKey +type CommonFormReq struct { Ranstr string `map:"ranstr"` Timestamp string `map:"timestamp"` } -func NewGetBusinessKey() *GetBusinessKeyReq { - getBusinessKey := new(GetBusinessKeyReq) +func NewCommonForm() *CommonFormReq { + getBusinessKey := new(CommonFormReq) getBusinessKey.Ranstr = cryptokit.RandomStr(true, 10, 32) getBusinessKey.Timestamp = cryptokit.GetTimeStamp() return getBusinessKey } // GenReqParam 返回加密后的请求参数 -func (th *GetBusinessKeyReq) GenReqParam() map[string]string { +func (th *CommonFormReq) GenReqParam() map[string]string { th.encrypt() return th.structToMap() } -func (th *GetBusinessKeyReq) structToMap() map[string]string { +func (th *CommonFormReq) structToMap() map[string]string { result := make(map[string]string) t := reflect.TypeOf(*th) v := reflect.ValueOf(*th) @@ -50,7 +51,7 @@ func (th *GetBusinessKeyReq) structToMap() map[string]string { return result } -func (th *GetBusinessKeyReq) encrypt() { +func (th *CommonFormReq) 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/to_acceptance_confirm.go b/cus-eng-con-sys/model/common_form_get_html.go similarity index 51% rename from cus-eng-con-sys/model/to_acceptance_confirm.go rename to cus-eng-con-sys/model/common_form_get_html.go index 58eb1b4..bca808d 100644 --- a/cus-eng-con-sys/model/to_acceptance_confirm.go +++ b/cus-eng-con-sys/model/common_form_get_html.go @@ -6,15 +6,17 @@ import ( ) /* -http://10.202.2.108:8086/zjgd/frm/acceptanceComfirmController/toAcceptanceComfirm?businessKey=ig0+wuJz1ydtzu4VbmlXigelzjrHpK2M95FWj1QqFZhIXAPC/wQsSLtbQzJMombk&processInstanceId=hOVgJWbcGMSpwlAyOahXOQ==&taskDefinitionKey=TbtfJ6chgqzgSldk3ONCqQ==&taskId=RjahQdQO070+0msrB5z0rQ==&startLink=Jy0nsEWMSdJA3lqME93vgA==&endLink=Jy0nsEWMSdJA3lqME93vgA==&taskflag=facpUhYPtTztlU3uwUpNpA==&ranstr=4rUNDFPWHZwTW36OfKVg1jT7bnoF1dg4/dR2wgtzWnQ=×tamp=1RhySb/bDJGzULZTDF2g4Q==&_=1720262226902 +1、/zjgd/frm/acceptanceComfirmController/toAcceptanceComfirm?businessKey=ig0+wuJz1ydtzu4VbmlXigelzjrHpK2M95FWj1QqFZhIXAPC/wQsSLtbQzJMombk&processInstanceId=hOVgJWbcGMSpwlAyOahXOQ==&taskDefinitionKey=TbtfJ6chgqzgSldk3ONCqQ==&taskId=RjahQdQO070+0msrB5z0rQ==&startLink=Jy0nsEWMSdJA3lqME93vgA==&endLink=Jy0nsEWMSdJA3lqME93vgA==&taskflag=facpUhYPtTztlU3uwUpNpA==&ranstr=4rUNDFPWHZwTW36OfKVg1jT7bnoF1dg4/dR2wgtzWnQ=×tamp=1RhySb/bDJGzULZTDF2g4Q==&_=1720262226902 +2、/zjgd/frm/actInfoController/projectStartComplete?businessKey=DoLO5Y/F9pkgmALbPSU8rlHfaNzXpiRWdT98hrInpaRO+8vaRxr/2ddXfbeiQqqd&processInstanceId=/CtSSHICrOyDQ5MYbA7O4Q==&taskDefinitionKey=0fWv7DH6DyHIngAE9h1dVg==&taskId=ipKsfqbJ75WL3G9WtXfA4A==&startLink=HVQiIQoJG8cDVmk6wqprNQ==&endLink=HVQiIQoJG8cDVmk6wqprNQ==&taskflag=ubYYOtYEotcKeG8V/cZ0GQ==&ranstr=uhLtA3EL1Bguyo/w+S3ntt4YY+mjjw+ZiVz91XtG9IU=×tamp=dLnP+fNg/EQ11o3Kyf2qVA==&_=1766632541443 */ /* 用途 1、/zjgd/frm/acceptanceController/udpateAccInfo.action时入参使用 +2、/zjgd/frm/actInfoController/saveActInfo时入参使用 */ -type ToAcceptanceConfirm struct { +type CommonFormGetHtml struct { BusinessKey string `map:"businessKey"` ProcessInstanceId string `map:"processInstanceId"` TaskDefinitionKey string `map:"taskDefinitionKey"` @@ -27,11 +29,11 @@ type ToAcceptanceConfirm struct { TimestampPro string `map:"_"` //工建原始请求key就这样 } -func NewToAcceptanceConfirm(businessKey, processInstId, taskId string) *ToAcceptanceConfirm { - toAcceptanceConfirm := new(ToAcceptanceConfirm) +func NewCommonFormGetHtml(businessKey, processInstId, taskDefinitionKey, taskId string) *CommonFormGetHtml { + toAcceptanceConfirm := new(CommonFormGetHtml) toAcceptanceConfirm.BusinessKey = businessKey toAcceptanceConfirm.ProcessInstanceId = processInstId - toAcceptanceConfirm.TaskDefinitionKey = "YSQR" + toAcceptanceConfirm.TaskDefinitionKey = taskDefinitionKey toAcceptanceConfirm.TaskId = taskId //等于id toAcceptanceConfirm.StartLink = "false" toAcceptanceConfirm.EndLink = "false" @@ -44,7 +46,7 @@ func NewToAcceptanceConfirm(businessKey, processInstId, taskId string) *ToAccept return toAcceptanceConfirm } -func (th *ToAcceptanceConfirm) encrypt() { +func (th *CommonFormGetHtml) 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/context.go b/cus-eng-con-sys/model/context.go new file mode 100644 index 0000000..ce86339 --- /dev/null +++ b/cus-eng-con-sys/model/context.go @@ -0,0 +1,11 @@ +package model + +import ( + "github.com/go-resty/resty/v2" + "github.com/tidwall/gjson" +) + +type Ctx struct { + Data *gjson.Result + RestyClient *resty.Client +} diff --git a/cus-eng-con-sys/model/design_scheme_passflow.go b/cus-eng-con-sys/model/design_scheme_passflow.go new file mode 100644 index 0000000..05642fa --- /dev/null +++ b/cus-eng-con-sys/model/design_scheme_passflow.go @@ -0,0 +1,96 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/designSchemeController/passFlow.action +*/ + +/* +用途:方案确认最后一步流程推送 +*/ + +//processInstanceId = 83615942 +//taskId = 83629304 +//taskDefinitionKey = XQJC +//assignee = 3080921 +//comment = 请进行需求决策 +//handleType = 1 +//withdraw = 1 +//csassignees = undefined +//ranstr = U6dQtXjHuofUto9i3M3d4o4wJILYBOQI +//timestamp = 1766387597296 + +type DesignSchemePassflow 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"` + Csassignees string `map:"csassignees"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewDesignSchemePassflow(proInsId, taskId, processDefKey string) *DesignSchemePassflow { + 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 { + designSchemePassflow.TaskDefinitionKey = "XQJC" + designSchemePassflow.Assignee = "3080921" //可修改,余逸洲 + designSchemePassflow.Comment = "请进行需求决策" + designSchemePassflow.Withdraw = "1" + } + designSchemePassflow.HandleType = "1" + designSchemePassflow.Csassignees = "undefined" + designSchemePassflow.Ranstr = cryptokit.RandomStr(true, 10, 32) + designSchemePassflow.Timestamp = cryptokit.GetTimeStamp() + return designSchemePassflow +} + +// GenReqParam 返回加密后的请求参数 +func (th *DesignSchemePassflow) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *DesignSchemePassflow) 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 *DesignSchemePassflow) 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_proj_invest.go b/cus-eng-con-sys/model/get_proj_invest.go new file mode 100644 index 0000000..caa87fe --- /dev/null +++ b/cus-eng-con-sys/model/get_proj_invest.go @@ -0,0 +1,101 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/projectServiceResultController/getProjectSurplseInvestmentByProjectId.action +*/ + +/* +用途:方案确认中判断子项投资是否够 +*/ +//projectId = 8895163 +//remandId = ba2cdfe2-d4b3-43ed-8462-bdf9626e374c +//attr1 = CMA25CD0000060.3301 +//attr3 = 0 +//prov = 3301 +//city = 3302 +//isEpc = 0 +//isService = 0 +//buildMode = 1 +//specC = MAC +//buildAttr = PT +//ranstr = tN9CXTDIX5mi6Af9lutJdDwBUbcRod +//timestamp = 1766383093673 + +type GetProjInvest struct { + ProjectId string `map:"projectId"` + RemandId string `map:"remandId"` + Attr1 string `map:"attr1"` + Attr3 string `map:"attr3"` + Prov string `map:"prov"` + City string `map:"city"` + IsEpc string `map:"isEpc"` + IsService string `map:"isService"` + BuildMode string `map:"buildMode"` + SpecC string `map:"specC"` + BuildAttr string `map:"buildAttr"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewGetProjInvest(projId, remandId, processDefKey, projCode string) *GetProjInvest { + getProjInvest := new(GetProjInvest) + getProjInvest.ProjectId = projId + getProjInvest.RemandId = remandId + getProjInvest.Attr1 = projCode + getProjInvest.Attr3 = "0" + getProjInvest.Prov = "3301" + getProjInvest.City = "3302" + getProjInvest.IsEpc = "0" + getProjInvest.IsService = "0" + getProjInvest.BuildMode = "1" + if processDefKey == config.ProcessLX { + getProjInvest.SpecC = "NAA" + } + if processDefKey == config.ProcessHouse { + getProjInvest.SpecC = "MAC" + } + getProjInvest.BuildAttr = "PT" + getProjInvest.Ranstr = cryptokit.RandomStr(true, 10, 32) + getProjInvest.Timestamp = cryptokit.GetTimeStamp() + return getProjInvest +} + +// GenReqParam 返回加密后的请求参数 +func (th *GetProjInvest) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *GetProjInvest) 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 *GetProjInvest) 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/modify_remand_proj.go b/cus-eng-con-sys/model/modify_remand_proj.go new file mode 100644 index 0000000..c930d75 --- /dev/null +++ b/cus-eng-con-sys/model/modify_remand_proj.go @@ -0,0 +1,72 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/projectServiceResultController/modifyRemandProjectIdByRemandId.action +*/ + +/* +用途:方案确认中绑定需求至项目 +*/ + +//remandId = ba2cdfe2-d4b3-43ed-8462-bdf9626e374c +//projectId = 8895163 +//repleyInvestment = 2200 +//ranstr = 7L598nbqEF +//timestamp = 1766385977423 + +type ModifyRemandProj struct { + RemandId string `map:"remandId"` + ProjectId string `map:"projectId"` + RepleyInvestment string `map:"repleyInvestment"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewModifyRemandProj(remandId, projectId, repleyInvestment string) *ModifyRemandProj { + modifyRemandProj := new(ModifyRemandProj) + modifyRemandProj.RemandId = remandId + modifyRemandProj.ProjectId = projectId + modifyRemandProj.RepleyInvestment = repleyInvestment + modifyRemandProj.Ranstr = cryptokit.RandomStr(true, 10, 32) + modifyRemandProj.Timestamp = cryptokit.GetTimeStamp() + return modifyRemandProj +} + +// GenReqParam 返回加密后的请求参数 +func (th *ModifyRemandProj) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *ModifyRemandProj) 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 *ModifyRemandProj) 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/pdm_push_process.go b/cus-eng-con-sys/model/pdm_push_process.go index 80031be..80c063d 100644 --- a/cus-eng-con-sys/model/pdm_push_process.go +++ b/cus-eng-con-sys/model/pdm_push_process.go @@ -10,7 +10,7 @@ import ( */ /* -用途:设计委托 +用途:设计委托最后一步流程推送 */ type PDMPushProcess struct { @@ -36,7 +36,7 @@ func NewPDMPushProcess(processInsId, taskId, taskTitle string) *PDMPushProcess { pdmPushProcess.ProcessInstanceId = processInsId pdmPushProcess.TaskId = taskId pdmPushProcess.TaskDefinitionKey = "FABZ" - pdmPushProcess.Assignee = "3083564" //todo 每个人都是这个吗 + pdmPushProcess.Assignee = "3083564" //设计 pdmPushProcess.Comment = "请协助编制建设方案" pdmPushProcess.Title = taskTitle pdmPushProcess.HandleType = "1" diff --git a/cus-eng-con-sys/model/save_act_info.go b/cus-eng-con-sys/model/save_act_info.go new file mode 100644 index 0000000..d5816bd --- /dev/null +++ b/cus-eng-con-sys/model/save_act_info.go @@ -0,0 +1,170 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/util" + "reflect" +) + +//remandName = 2025年中国联通浙江省杭州地区西湖区转塘街道枫桦路与梧桐路交叉口枫吟丽都三区宽带接入扩容工程16幢2单元21层新增1只1:4 +//projectName = 2025年中国联通浙江杭州西湖公众宽带接入扩容(第二期)工程(无条件受理专项) +//projectCode = CMA25CD0000060.3301 +//cityName = 杭州 +//city = 3302 +//replyInvestment = 40 +//staffNames = 许霖卓 +//mobilPhone = 156****5124 +//remandStartDate = 2025-12-13 19:54:47 +//buildAddress = 枫桦路与梧桐路交叉口枫吟丽都三区 +//buildLimitedType = 1 +//buildLimitedDays = 7 +//actFinishDate = +//token = 27b97a73-40d4-4346-80a1-00fcc8fed333 +//actId = +//remandId = a9ced8ce-f933-45a4-bd16-4d654cad9618 +//remandCode = 20253301105373 +//splitRemandId = a9ced8ce-f933-45a4-bd16-4d654cad9618 +//isSplitedRemand = N +//saveOrUpdateType = 2 +//prov = 3301 +//procInsId = 83383669 +//buildType1 = +//specC = 16A3 +//buildModel = ZJ +//countys = 330106 +//linkCode = GCKG +//busiId = a9ced8ce-f933-45a4-bd16-4d654cad9618 +//taskIds = 83768504 +//bussCode = ZH_KR +//actStartDate = +//taskDefinitionKeys = GCKG +//actStartOrgId = +//actOrgCode = +//specB = EC +//projectId = 8895163 +//ifFiling = 1 +//filingDateCondtion = +//ranstr = nAjPPMG4dvVIGzOr +//timestamp = 1766665658920 + +type SaveActInfo struct { + RemandName string `map:"remandName"` + ProjectName string `map:"projectName"` + ProjectCode string `map:"projectCode"` + CityName string `map:"cityName"` + City string `map:"city"` + ReplyInvestment string `map:"replyInvestment"` + StaffNames string `map:"staffNames"` + MobilPhone string `map:"mobilPhone"` + RemandStartDate string `map:"remandStartDate"` + BuildAddress string `map:"buildAddress"` + BuildLimitedType string `map:"buildLimitedType"` + BuildLimitedDays string `map:"buildLimitedDays"` + ActFinishDate string `map:"actFinishDate"` + Token string `map:"token"` + ActId string `map:"actId"` + RemandId string `map:"remandId"` + RemandCode string `map:"remandCode"` + SplitRemandId string `map:"splitRemandId"` + IsSplitedRemand string `map:"isSplitedRemand"` + SaveOrUpdateType string `map:"saveOrUpdateType"` + Prov string `map:"prov"` + ProcInsId string `map:"procInsId"` + BuildType1 string `map:"buildType1"` + SpecC string `map:"specC"` + BuildModel string `map:"buildModel"` + Countys string `map:"countys"` + LinkCode string `map:"linkCode"` + BusiId string `map:"busiId"` + TaskIds string `map:"taskIds"` + BussCode string `map:"bussCode"` + ActStartDate string `map:"actStartDate"` + TaskDefinitionKeys string `map:"taskDefinitionKeys"` + ActStartOrgId string `map:"actStartOrgId"` + ActOrgCode string `map:"actOrgCode"` + SpecB string `map:"specB"` + ProjectId string `map:"projectId"` + IfFiling string `map:"ifFiling"` + FilingDateCondtion string `map:"filingDateCondtion"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewSaveActInfo(html string) *SaveActInfo { + saveActInfo := new(SaveActInfo) + saveActInfo.RemandName = util.HTMLContentFindFirst(html, "remandName") + saveActInfo.ProjectName = util.HTMLContentFindFirst(html, "projectName") + saveActInfo.ProjectCode = util.HTMLContentFindFirst(html, "projectCode") + saveActInfo.CityName = util.HTMLContentFindFirst(html, "cityName") + saveActInfo.City = util.HTMLContentFindFirst(html, "city") + saveActInfo.ReplyInvestment = util.HTMLContentFindFirst(html, "replyInvestment") + saveActInfo.StaffNames = util.HTMLContentFindFirst(html, "staffNames") + saveActInfo.MobilPhone = util.HTMLContentFindFirst(html, "mobilPhone") + saveActInfo.RemandStartDate = util.HTMLContentFindFirst(html, "remandStartDate") + saveActInfo.BuildAddress = util.RegexpFindFirst(html, `]*id="buildAddress"[^>]*>(.*?)`) + saveActInfo.BuildLimitedType = util.HTMLContentFindFirst(html, "buildLimitedType") + saveActInfo.BuildLimitedDays = "7" + saveActInfo.ActFinishDate = util.HTMLContentFindFirst(html, "actFinishDate") + saveActInfo.Token = util.HTMLContentFindFirst(html, "token") + saveActInfo.ActId = util.HTMLContentFindFirst(html, "actId") + saveActInfo.RemandId = util.HTMLContentFindFirst(html, "remandId") + saveActInfo.RemandCode = util.HTMLContentFindFirst(html, "remandCode") + saveActInfo.SplitRemandId = util.HTMLContentFindFirst(html, "remandId") + saveActInfo.IsSplitedRemand = util.HTMLContentFindFirst(html, "isSplitedRemand") + saveActInfo.SaveOrUpdateType = "2" + saveActInfo.Prov = util.HTMLContentFindFirst(html, "prov") + saveActInfo.ProcInsId = util.HTMLContentFindFirst(html, "procInsId") + saveActInfo.BuildType1 = util.HTMLContentFindFirst(html, "buildType1") + saveActInfo.SpecC = util.HTMLContentFindFirst(html, "specC") + saveActInfo.BuildModel = util.HTMLContentFindFirst(html, "buildModel") + saveActInfo.Countys = util.HTMLContentFindFirst(html, "countys") + saveActInfo.LinkCode = util.HTMLContentFindFirst(html, "linkCode") + saveActInfo.BusiId = util.HTMLContentFindFirst(html, "busiId") + saveActInfo.TaskIds = util.HTMLContentFindFirst(html, "taskIds") + saveActInfo.BussCode = util.HTMLContentFindFirst(html, "bussCode") + saveActInfo.ActStartDate = util.HTMLContentFindFirst(html, "actStartDate") + saveActInfo.TaskDefinitionKeys = util.HTMLContentFindFirst(html, "taskDefinitionKeys") + saveActInfo.ActStartOrgId = util.HTMLContentFindFirst(html, "actStartOrgId") + saveActInfo.ActOrgCode = util.HTMLContentFindFirst(html, "actOrgCode") + saveActInfo.SpecB = util.HTMLContentFindFirst(html, "specB") + saveActInfo.ProjectId = util.HTMLContentFindFirst(html, "projectId") + saveActInfo.IfFiling = util.HTMLContentFindFirst(html, "ifFiling") + saveActInfo.FilingDateCondtion = util.HTMLContentFindFirst(html, "filingDateCondtion") + saveActInfo.Ranstr = cryptokit.RandomStr(true, 10, 32) + saveActInfo.Timestamp = cryptokit.GetTimeStamp() + return saveActInfo +} + +// GenReqParam 返回加密后的请求参数 +func (th *SaveActInfo) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *SaveActInfo) structToMap() map[string]string { + result := make(map[string]string) + t := reflect.TypeOf(*th) + v := reflect.ValueOf(*th) + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + value := v.Field(i) + // Use the tag value as the key in the map, if it exists; otherwise, use the field name. + tag := field.Tag.Get("map") + if tag == "" { + tag = field.Name + } + + result[tag] = value.String() + } + return result +} + +func (th *SaveActInfo) encrypt() { + v := reflect.ValueOf(th).Elem() + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.CanSet() { + field.SetString(cryptokit.Encrypt(field.String())) + } + } +} 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 3340f82..05fff22 100644 --- a/cus-eng-con-sys/model/save_pro_and_start.go +++ b/cus-eng-con-sys/model/save_pro_and_start.go @@ -5,11 +5,6 @@ import ( "reflect" ) -type AcceptanceConfirm struct { - ProcessInstanceId string - Id string -} - /* /zjgd/frm/acceptanceComfirmController/saveProAndStart */ diff --git a/cus-eng-con-sys/model/search_project_list.go b/cus-eng-con-sys/model/search_project_list.go new file mode 100644 index 0000000..6c5dda9 --- /dev/null +++ b/cus-eng-con-sys/model/search_project_list.go @@ -0,0 +1,64 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/projectServiceResultController/searchProjectList +*/ + +/* +用途 +1、方案确认之前通过项目编码查找projectId +*/ + +type SearchProjectList struct { + StaffOrgId string `map:"staffOrgId"` + ProjectCode string `map:"projectCode"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewSearchProjectList(projectCode string) *SearchProjectList { + searchProjectList := new(SearchProjectList) + searchProjectList.StaffOrgId = "3102427" + searchProjectList.ProjectCode = projectCode + searchProjectList.Ranstr = cryptokit.RandomStr(true, 10, 32) + searchProjectList.Timestamp = cryptokit.GetTimeStamp() + return searchProjectList +} + +// GenReqParam 返回加密后的请求参数 +func (th *SearchProjectList) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *SearchProjectList) 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 *SearchProjectList) 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/start_act_process.go b/cus-eng-con-sys/model/start_act_process.go new file mode 100644 index 0000000..572801e --- /dev/null +++ b/cus-eng-con-sys/model/start_act_process.go @@ -0,0 +1,90 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/actInfoController/startActProcess +*/ + +/* +用途:工程开工 +*/ + +//processInstanceId = 83615942 +//taskId = 83651057 +//taskDefinitionKey = GCSG +//assignee = 3105305 +//comment = 请施工 +//handleType = 1 +//withdraw = 1 +//filingDate = undefined +//filingDateCondtion = +//ranstr = T2L3h7kTULX8R +//timestamp = 1766395288123 + +type StartActProcess 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"` + FilingDate string `map:"filingDate"` + FilingDateCondtion string `map:"filingDateCondtion"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewStartActProcess(proInsId, taskId string) *StartActProcess { + startActProcess := new(StartActProcess) + startActProcess.ProcessInstanceId = proInsId + startActProcess.TaskId = taskId + startActProcess.TaskDefinitionKey = "GCSG" + startActProcess.Assignee = "3105305" //可修改,张子杰 //todo 零星不一样 + startActProcess.Comment = "请施工" + startActProcess.HandleType = "1" + startActProcess.Withdraw = "1" + startActProcess.FilingDate = "undefined" + startActProcess.FilingDateCondtion = "" + startActProcess.Ranstr = cryptokit.RandomStr(true, 10, 32) + startActProcess.Timestamp = cryptokit.GetTimeStamp() + return startActProcess +} + +// GenReqParam 返回加密后的请求参数 +func (th *StartActProcess) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *StartActProcess) 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 *StartActProcess) 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 new file mode 100644 index 0000000..3b83a20 --- /dev/null +++ b/cus-eng-con-sys/model/update_act_info_org_staff.go @@ -0,0 +1,66 @@ +package model + +import ( + "cu-helper/cus-eng-con-sys/cryptokit" + "reflect" +) + +/* +/zjgd/frm/actInfoController/updateActInfoOrgAndStaff +*/ + +/* +用途:工程开工第二步updateActInfoOrgAndStaff +*/ + +type UpdateActInfoOrgAndStaff struct { + ActStartOrgId string `map:"actStartOrgId"` + ActOrgCode string `map:"actOrgCode"` + ActId string `map:"actId"` + Ranstr string `map:"ranstr"` + Timestamp string `map:"timestamp"` +} + +func NewUpdateActInfoOrgAndStaff(actId string) *UpdateActInfoOrgAndStaff { + updateActInfoOrgAndStaff := new(UpdateActInfoOrgAndStaff) + updateActInfoOrgAndStaff.ActStartOrgId = "3105305" //todo 张子杰 零星需改 + updateActInfoOrgAndStaff.ActOrgCode = "309320240" //todo 张子杰 零星需改 + updateActInfoOrgAndStaff.ActId = actId + updateActInfoOrgAndStaff.Ranstr = cryptokit.RandomStr(true, 10, 32) + updateActInfoOrgAndStaff.Timestamp = cryptokit.GetTimeStamp() + return updateActInfoOrgAndStaff +} + +// GenReqParam 返回加密后的请求参数 +func (th *UpdateActInfoOrgAndStaff) GenReqParam() map[string]string { + th.encrypt() + return th.structToMap() +} + +func (th *UpdateActInfoOrgAndStaff) structToMap() map[string]string { + result := make(map[string]string) + t := reflect.TypeOf(*th) + v := reflect.ValueOf(*th) + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + value := v.Field(i) + // Use the tag value as the key in the map, if it exists; otherwise, use the field name. + tag := field.Tag.Get("map") + if tag == "" { + tag = field.Name + } + + result[tag] = value.String() + } + return result +} + +func (th *UpdateActInfoOrgAndStaff) encrypt() { + v := reflect.ValueOf(th).Elem() + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.CanSet() { + field.SetString(cryptokit.Encrypt(field.String())) + } + } +} diff --git a/cus-eng-con-sys/model/update_pdm_production.go b/cus-eng-con-sys/model/update_pdm_production.go index 0cc10f1..d03d6f4 100644 --- a/cus-eng-con-sys/model/update_pdm_production.go +++ b/cus-eng-con-sys/model/update_pdm_production.go @@ -32,20 +32,26 @@ type UpdatePdmProduction struct { Timestamp string `map:"timestamp"` } -func NewUpdatePdmProduction(remandId, html, taskTitle string) *UpdatePdmProduction { +func NewUpdatePdmProduction(touzi, remandId, html, taskTitle string) *UpdatePdmProduction { updatePdmProduction := new(UpdatePdmProduction) - remandTouzi := util.RegexpFindFirst(html, `投资\s*(\d+(?:\.\d+)?)\s*元`) + remandTouzi := "" + //json里没有投资数据,说明是主动发起的扩容,需要去正则匹配 + if touzi == "" { + remandTouzi = util.RegexpFindFirst(html, `(?:投资|约|大约)\s*(\d+(?:\.\d+)?)\s*元`) + } else { + remandTouzi = touzi + } updatePdmProduction.RemandTouzi = remandTouzi updatePdmProduction.RemandId = remandId updatePdmProduction.BuildAttr = "PT" - updatePdmProduction.PdmServiceProviderId = "1538321" - updatePdmProduction.PdmProjReceiverId = "3083564" + updatePdmProduction.PdmServiceProviderId = "1538321" //设计(可修改) + updatePdmProduction.PdmProjReceiverId = "3083564" //设计(可修改) updatePdmProduction.BuildModel = "ZJ" updatePdmProduction.GovEnterpId = "" updatePdmProduction.ResourceType = "undefined" updatePdmProduction.IsNewNational = "0" - updatePdmProduction.SupervisorProviderId = "309320681" - updatePdmProduction.SupervisorReceiverId = "3098707" + updatePdmProduction.SupervisorProviderId = "309320681" //监理(可修改) + updatePdmProduction.SupervisorReceiverId = "3098707" //监理(可修改) updatePdmProduction.Ranstr = cryptokit.RandomStr(true, 10, 32) updatePdmProduction.Timestamp = cryptokit.GetTimeStamp() logkit.Info(taskTitle + " 投资:" + remandTouzi + "元") diff --git a/cus-eng-con-sys/service/acceptance_confirm.go b/cus-eng-con-sys/service/acceptance_confirm.go index 80d268c..38fd2df 100644 --- a/cus-eng-con-sys/service/acceptance_confirm.go +++ b/cus-eng-con-sys/service/acceptance_confirm.go @@ -9,7 +9,6 @@ import ( "github.com/mizuki1412/go-core-kit/service/logkit" "github.com/tidwall/gjson" "strings" - "time" ) // ReqAccConfirm 验收确认请求 @@ -20,23 +19,23 @@ import ( */ // ReqAccConfirm parenProcInsId=processInstanceId -func ReqAccConfirm(parenProcInsId, id string) { +func ReqAccConfirm(ctx *model.Ctx) { //更新ACC信息 - updateAccInfo(parenProcInsId, id) + updateAccInfo(ctx) //提交验收确认 - saveProAndStart(parenProcInsId) + saveProAndStart(ctx) } -func updateAccInfo(processInstanceId, id string) { - remandId := getRemandId(processInstanceId, id) - html1 := toAcceptanceConfirm(remandId, processInstanceId, id) - token := getToken() - html2 := toRemandShowCommon(remandId) +func updateAccInfo(ctx *model.Ctx) { + 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) form := f.GenReqParam() - client := resty.New().SetRetryCount(5).SetRetryWaitTime(20 * time.Second) + client := ctx.RestyClient resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceController/udpateAccInfo.action") if err != nil { @@ -46,8 +45,9 @@ func updateAccInfo(processInstanceId, id string) { logkit.Info("updateAccInfo:" + cryptokit.Decrypt(data)) } -func saveProAndStart(parenProcInsId string) { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(60 * time.Second) +func saveProAndStart(ctx *model.Ctx) { + 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) @@ -61,8 +61,7 @@ func saveProAndStart(parenProcInsId string) { logkit.Info("saveProAndStart:" + cryptokit.Decrypt(data)) } -func getToken() string { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func getToken(client *resty.Client) string { h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() f := model.NewGetToken() @@ -79,34 +78,15 @@ func getToken() string { return token } -// businessKey=remandId -func getRemandId(processInstanceId, id string) string { - 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.NewGetBusinessKey() - form := f.GenReqParam() - resp, err := client.R(). - SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflowrest/tasktodopath/GkXjGzKrProcess/" + processInstanceId + "/YSQR/" + id + "/ZH_XZ") //ZH_XZ在杭州应该不变化 扩容不一样 - 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.Debug("拿到了businessKey/remandId:" + dataRow[0].Get("businessKey").String()) - return dataRow[0].Get("businessKey").String() -} - // businessKey=remandId,taskId=id -func toAcceptanceConfirm(businessKey, processInstId, taskId string) string { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +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() + client := ctx.RestyClient h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - query := model.NewToAcceptanceConfirm(businessKey, processInstId, 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 { @@ -115,8 +95,7 @@ func toAcceptanceConfirm(businessKey, processInstId, taskId string) string { return resp.String() } -func toRemandShowCommon(remandId string) string { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func toRemandShowCommon(client *resty.Client, remandId string) string { h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() query := model.NewToRemandShowCommon(remandId) diff --git a/cus-eng-con-sys/service/acceptance_delivery.go b/cus-eng-con-sys/service/acceptance_delivery.go index 2a4a193..896edae 100644 --- a/cus-eng-con-sys/service/acceptance_delivery.go +++ b/cus-eng-con-sys/service/acceptance_delivery.go @@ -5,33 +5,32 @@ import ( "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" "cu-helper/cus-eng-con-sys/util" - "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/logkit" "strings" - "time" ) -// ReqAccDelivery 验收确认请求 +// ReqAccDelivery 验收申请请求 /* 验收确认分一个步骤进行 1、先获取指定人的deliveryId 2、获取businessKey 3、提交验收确认 */ - -func ReqAccDelivery(processInsId, taskId string) { - businessKey := getRemandId(processInsId, taskId) - deliveryId := getDeliveryId(processInsId, taskId, businessKey) - jfPushProcess(processInsId, taskId, deliveryId, businessKey) +func ReqAccDelivery(ctx *model.Ctx) { + businessKey := getRemandId(ctx) + deliveryId := getDeliveryId(ctx, businessKey) + jfPushProcess(ctx, deliveryId, businessKey) } -func jfPushProcess(processInsId, taskId, deliveryId, businessKey string) { +func jfPushProcess(ctx *model.Ctx, deliveryId, businessKey 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.NewJFPushProcess(processInsId, taskId, deliveryId, businessKey) form := f.GenReqParam() - client := resty.New().SetRetryCount(5).SetRetryWaitTime(18 * time.Second) + client := ctx.RestyClient resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/jfPushProcess") if err != nil { @@ -41,8 +40,10 @@ func jfPushProcess(processInsId, taskId, deliveryId, businessKey string) { logkit.Info("jfPushProcess:" + cryptokit.Decrypt(data)) } -func getDeliveryId(processInsId, taskId, businessKey string) string { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func getDeliveryId(ctx *model.Ctx, businessKey string) string { + processInsId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + client := ctx.RestyClient h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() query := model.NewGoAccDeliveryEdit(businessKey, processInsId, taskId) diff --git a/cus-eng-con-sys/service/common.go b/cus-eng-con-sys/service/common.go new file mode 100644 index 0000000..832340a --- /dev/null +++ b/cus-eng-con-sys/service/common.go @@ -0,0 +1,72 @@ +package service + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/model" + "github.com/mizuki1412/go-core-kit/class/exception" + "github.com/mizuki1412/go-core-kit/service/logkit" + "github.com/tidwall/gjson" + "strings" +) + +// businessKey=remandId +func getRemandId(ctx *model.Ctx) string { + processInstanceId := ctx.Data.Get("processInstanceId").String() + id := ctx.Data.Get("id").String() + processDefinitionKey := ctx.Data.Get("processDefinitionKey").String() + taskDefinitionKey := ctx.Data.Get("taskDefinitionKey").String() + businessCode := findLinkBusinessCode(ctx) + client := ctx.RestyClient + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewCommonForm() + form := f.GenReqParam() + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflowrest/tasktodopath/" + processDefinitionKey + "/" + processInstanceId + "/" + taskDefinitionKey + "/" + id + "/" + businessCode) + 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.Debug("拿到了businessKey/remandId:" + dataRow[0].Get("businessKey").String()) + return dataRow[0].Get("businessKey").String() +} + +// businessKey=remandId,taskId=id +func projectStartComplete(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/actInfoController/projectStartComplete?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 findLinkBusinessCode(ctx *model.Ctx) string { + processInstanceId := ctx.Data.Get("processInstanceId").String() + encryptedProcessInsId := cryptokit.Encrypt(processInstanceId) + client := ctx.RestyClient + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewCommonForm() + form := f.GenReqParam() + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflow/findLinkBusscode?processInstanceId=" + encryptedProcessInsId) + if err != nil { + panic(exception.New(err.Error())) + } + data := strings.Trim(resp.String(), `"`) + return gjson.Get(cryptokit.Decrypt(data), "BUSS_CODE").String() +} diff --git a/cus-eng-con-sys/service/design_scheme.go b/cus-eng-con-sys/service/design_scheme.go new file mode 100644 index 0000000..d4661ad --- /dev/null +++ b/cus-eng-con-sys/service/design_scheme.go @@ -0,0 +1,137 @@ +package service + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/model" + "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、提交方案确认 +*/ + +func ReqDesignScheme(ctx *model.Ctx) { + projId := getProjectId(ctx) + touzi := checkProjInvest(ctx, projId) + modifyProject(ctx, projId, touzi) + passflow(ctx) +} + +func getProjectId(ctx *model.Ctx) string { + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewSearchProjectList(getDefaultProjCode(ctx)) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/projectServiceResultController/searchProjectList") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := gjson.Get(cryptokit.Decrypt(dataOri), "data").Array() + if len(data) == 0 { + panic(exception.New("无该项目信息")) + } + return data[0].Get("projectId").String() +} + +func getDefaultProjCode(ctx *model.Ctx) string { + processDefinitionName := ctx.Data.Get("processDefinitionName").String() + switch processDefinitionName { + case "公众客户宽带扩容": + if code := configkit.GetString(config.EngDefaultProjKRCode, ""); code != "" { + return code + } + panic(exception.New("公众客户宽带扩容项目编号未设置")) + case "公众客户宽带新建市场": + if code := configkit.GetString(config.EngDefaultProjXQCode, ""); code != "" { + return code + } + panic(exception.New("公众客户宽带新建市场(小区新建)项目编号未设置")) + case "政企客户接入(本地、省际跨域)": + if code := configkit.GetString(config.EngDefaultProjLXCode, ""); code != "" { + return code + } + panic(exception.New("政企客户接入(本地、省际跨域)(零星)项目编号未设置")) + case "政企客户覆盖": + if code := configkit.GetString(config.EngDefaultProjLYCode, ""); code != "" { + return code + } + panic(exception.New("政企客户覆盖(楼宇新建)项目编号未设置")) + default: + panic(exception.New("未设置相应专业默认项目编码,无法关联项目!")) + } +} + +func checkProjInvest(ctx *model.Ctx, projId string) string { + remandId := getRemandId(ctx) + processDefKey := ctx.Data.Get("processDefinitionKey").String() + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewGetProjInvest(projId, remandId, processDefKey, getDefaultProjCode(ctx)) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/projectServiceResultController/getProjectSurplseInvestmentByProjectId.action") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + if !gjson.Get(data, "success").Bool() { + panic(exception.New("需求投资可能大于项目剩余金额!")) + } + touzi := gjson.Get(data, "attributes.remandTouzi").String() + logkit.Info("checkProjInvest:" + data) + return touzi +} + +func modifyProject(ctx *model.Ctx, projId, touzi string) { + remandId := getRemandId(ctx) + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewModifyRemandProj(remandId, projId, touzi) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/projectServiceResultController/modifyRemandProjectIdByRemandId.action") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + if !gjson.Get(data, "success").Bool() { + panic(exception.New("项目关联失败!")) + } + logkit.Info("modifyProject:" + data) +} + +func passflow(ctx *model.Ctx) { + processInsId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + processDefKey := ctx.Data.Get("processDefinitionKey").String() + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewDesignSchemePassflow(processInsId, taskId, processDefKey) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/designSchemeController/passFlow.action") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("degisnSchemePassflow:" + data) +} diff --git a/cus-eng-con-sys/service/pdm_entrust.go b/cus-eng-con-sys/service/pdm_entrust.go index dc5595f..6b643cf 100644 --- a/cus-eng-con-sys/service/pdm_entrust.go +++ b/cus-eng-con-sys/service/pdm_entrust.go @@ -4,35 +4,38 @@ import ( "cu-helper/cus-eng-con-sys/config" "cu-helper/cus-eng-con-sys/cryptokit" "cu-helper/cus-eng-con-sys/model" - "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/service/logkit" - "github.com/tidwall/gjson" "strings" - "time" ) -// PdmEntrust 设计委托 +// PdmEntrust 设计委托请求 /* 设计委托分三个步骤进行 1、判断是否change监理(先省略,看看有没有问题) -2、(先获取信息)再更新表单信息 +2、(先获取信息)再更新表单信息(新建可以省略,零星不建议走) 3、提交设计委托 */ -func ReqPdmEntrust(processInsId, taskId, taskTitle string) { - updatePdmProduction(processInsId, taskId, taskTitle) - pdmPushProcess(processInsId, taskId, taskTitle) +func ReqPdmEntrust(ctx *model.Ctx) { + if ctx.Data.Get("processDefinitionName").String() == "公众客户宽带扩容" { + //扩容单 + updatePdmProduction(ctx) + } + + pdmPushProcess(ctx) } -func updatePdmProduction(processInsId, taskId, taskTitle string) { - remandId := getRemandIdSJKR(processInsId, taskId) - html := goPdmEntrustEdit(remandId, processInsId, taskId) +func updatePdmProduction(ctx *model.Ctx) { + touzi := ctx.Data.Get("touzi").String() + taskTitle := ctx.Data.Get("tasktitle").String() + remandId := getRemandId(ctx) + html := goPdmEntrustEdit(ctx, remandId) h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewUpdatePdmProduction(remandId, html, taskTitle) + f := model.NewUpdatePdmProduction(touzi, remandId, html, taskTitle) form := f.GenReqParam() - client := resty.New().SetRetryCount(5).SetRetryWaitTime(20 * time.Second) + client := ctx.RestyClient resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/pdmProductionController/updatePdmProduction.action") if err != nil { @@ -41,13 +44,15 @@ func updatePdmProduction(processInsId, taskId, taskTitle string) { data := strings.Trim(resp.String(), `"`) logkit.Info("updatePdmProduction:" + cryptokit.Decrypt(data)) } - -func pdmPushProcess(processInsId, taskId, taskTitle string) { +func pdmPushProcess(ctx *model.Ctx) { + processInstanceId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + taskTitle := ctx.Data.Get("tasktitle").String() h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() - f := model.NewPDMPushProcess(processInsId, taskId, taskTitle) + f := model.NewPDMPushProcess(processInstanceId, taskId, taskTitle) form := f.GenReqParam() - client := resty.New().SetRetryCount(5).SetRetryWaitTime(18 * time.Second) + client := ctx.RestyClient resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/pdmEntrustController/pushProcess.action") if err != nil { @@ -58,8 +63,10 @@ func pdmPushProcess(processInsId, taskId, taskTitle string) { } // businessKey=remandId,taskId=id -func goPdmEntrustEdit(businessKey, processInstId, taskId string) string { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func goPdmEntrustEdit(ctx *model.Ctx, businessKey string) string { + processInstId := ctx.Data.Get("processInstanceId").String() + taskId := ctx.Data.Get("id").String() + client := ctx.RestyClient h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() query := model.NewGoPdmEntrustEdit(businessKey, processInstId, taskId) @@ -70,25 +77,3 @@ func goPdmEntrustEdit(businessKey, processInstId, taskId string) string { } return resp.String() } - -// businessKey=remandId -func getRemandIdSJKR(processInstanceId, id string) string { - 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.NewGetBusinessKey() - form := f.GenReqParam() - resp, err := client.R(). - SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/workflowrest/tasktodopath/GkXjGzKrProcess/" + processInstanceId + "/JSFAWT/" + id + "/ZH_KR") //ZH_XZ在杭州应该不变化 扩容不一样 - 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.Debug("拿到了businessKey/remandId:" + dataRow[0].Get("businessKey").String()) - return dataRow[0].Get("businessKey").String() -} diff --git a/cus-eng-con-sys/service/start_act.go b/cus-eng-con-sys/service/start_act.go new file mode 100644 index 0000000..a7e1c4c --- /dev/null +++ b/cus-eng-con-sys/service/start_act.go @@ -0,0 +1,78 @@ +package service + +import ( + "cu-helper/cus-eng-con-sys/config" + "cu-helper/cus-eng-con-sys/cryptokit" + "cu-helper/cus-eng-con-sys/model" + "github.com/mizuki1412/go-core-kit/class/exception" + "github.com/mizuki1412/go-core-kit/service/logkit" + "github.com/tidwall/gjson" + "strings" +) + +// ReqStartAct 工程开工请求 +/* +工程开工分两个步骤进行 +1、saveActInfo +2、updateActInfoOrgAndStaff +3、startActProcess +*/ + +func ReqStartAct(ctx *model.Ctx) { + actId := saveActInfo(ctx) + updateActInfoOrgAndStaff(ctx, actId) + startActProcess(ctx) +} + +func saveActInfo(ctx *model.Ctx) string { + businessKey := getRemandId(ctx) + html := projectStartComplete(ctx, businessKey) + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewSaveActInfo(html) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/actInfoController/saveActInfo") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("saveActInfo:" + data) + actId := gjson.Get(data, "ans").String() + return actId +} + +func updateActInfoOrgAndStaff(ctx *model.Ctx, actId string) { + h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") + header := h.GenReqParam() + f := model.NewUpdateActInfoOrgAndStaff(actId) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/actInfoController/updateActInfoOrgAndStaff") + if err != nil { + panic(exception.New(err.Error())) + } + data := strings.Trim(resp.String(), `"`) + logkit.Info("updateActInfoOrgAndStaff:" + cryptokit.Decrypt(data)) +} + +func startActProcess(ctx *model.Ctx) { + 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) + form := f.GenReqParam() + client := ctx.RestyClient + resp, err := client.R(). + SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/actInfoController/startActProcess") + if err != nil { + panic(exception.New(err.Error())) + } + dataOri := strings.Trim(resp.String(), `"`) + data := cryptokit.Decrypt(dataOri) + logkit.Info("startActProcess:" + data) +} diff --git a/cus-eng-con-sys/service/withdraw_assign.go b/cus-eng-con-sys/service/withdraw_assign.go index 3dea9ab..43f35c9 100644 --- a/cus-eng-con-sys/service/withdraw_assign.go +++ b/cus-eng-con-sys/service/withdraw_assign.go @@ -9,7 +9,6 @@ import ( "github.com/mizuki1412/go-core-kit/service/logkit" "github.com/tidwall/gjson" "strings" - "time" ) // AssignScrap 取消交付 @@ -21,19 +20,21 @@ import ( 3、assignScrap */ -func ReqWithdrawAssign(parenProcInsId string) { - list := searchAccSendList(parenProcInsId) +// ReqWithdrawAssign processInstanceId=parenProcInsId +func ReqWithdrawAssign(ctx *model.Ctx) { + parenProcInsId := ctx.Data.Get("processInstanceId").String() + list := searchAccSendList(ctx) for _, v := range list { if v.DeliveryId == "" { continue } if v.DeliveryStatus == "COMPLETE" { //先撤回,再废除 - backFlow(v.Name, v.DeliveryId, parenProcInsId) - assignScrap(v.Name, v.DeliveryId, parenProcInsId) + backFlow(v.Name, v.DeliveryId, parenProcInsId, ctx.RestyClient) + assignScrap(v.Name, v.DeliveryId, parenProcInsId, ctx.RestyClient) } else { //未完成的直接废除 - assignScrap(v.Name, v.DeliveryId, parenProcInsId) + assignScrap(v.Name, v.DeliveryId, parenProcInsId, ctx.RestyClient) } } } @@ -44,12 +45,13 @@ type RemovalInfo struct { DeliveryStatus string } -func searchAccSendList(parenProcInsId string) []RemovalInfo { +func searchAccSendList(ctx *model.Ctx) []RemovalInfo { + 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 := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) + client := ctx.RestyClient resp, err := client.R(). SetHeaders(header).SetFormData(form).Post(config.UrlPrefix + "/zjgd/frm/acceptanceComfirmController/searchAccSendList") if err != nil { @@ -97,8 +99,7 @@ func searchAccSendList(parenProcInsId string) []RemovalInfo { return removalList } -func backFlow(name, deliveryId, parenProcInsId string) { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func backFlow(name, deliveryId, parenProcInsId string, client *resty.Client) { h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() f := model.NewBackFlow(deliveryId, parenProcInsId) @@ -113,8 +114,7 @@ func backFlow(name, deliveryId, parenProcInsId string) { } -func assignScrap(name, deliveryId, parenProcInsId string) { - client := resty.New().SetRetryCount(5).SetRetryWaitTime(15 * time.Second) +func assignScrap(name, deliveryId, parenProcInsId string, client *resty.Client) { h := model.NewHeader("application/x-www-form-urlencoded; charset=UTF-8") header := h.GenReqParam() f := model.NewAssignScrap(deliveryId, parenProcInsId)