From 991001c490648251bed03897b59d92688f2d5ec4 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Mon, 7 Apr 2025 08:48:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B6=88=E6=81=AF=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../taskmanagement/formcontrol.go | 23 ++- .../taskmanagement/runTaskFlow.go | 180 +++++++++--------- .../taskmanagement/runWorkFlow.go | 55 ++++-- api/version1/workWechat/sendMsg.go | 6 +- config/configApp/appConfig.yaml | 2 +- models/customerForm/runFlowTask.go | 1 + models/customerForm/taskAndFlow.go | 88 +++++++++ 7 files changed, 241 insertions(+), 114 deletions(-) create mode 100644 models/customerForm/taskAndFlow.go diff --git a/api/version1/taskplatform/taskmanagement/formcontrol.go b/api/version1/taskplatform/taskmanagement/formcontrol.go index 43c8fb5..585435b 100644 --- a/api/version1/taskplatform/taskmanagement/formcontrol.go +++ b/api/version1/taskplatform/taskmanagement/formcontrol.go @@ -977,7 +977,7 @@ func (a *ApiMethod) AddCustomerForm(c *gin.Context) { var sendMsgInfo SendMsgInfo sendMsgInfo = sendMsgInterface.SendMsg - msgid, _ := sendMsgInfo.SendMsg(userCont, taskCont.Title, uuid, cureeTime, masterField, masterUnitList) + msgid, _ := sendMsgInfo.SendMsg(userCont, taskCont.Title, uuid, cureeTime, masterField, masrWriteMap, masterUnitList) fmt.Printf("发送返回信息------------->%v\n\n\n", msgid) if msgid != "" { //设定redis Key名称 @@ -1024,7 +1024,7 @@ func (a *ApiMethod) AddCustomerForm(c *gin.Context) { # */ -func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, cureeTime int64, fieldVal map[string]interface{}, subUnit map[string]customerform.MasterStruct) (msgid string, err error) { +func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, cureeTime int64, fieldVal, masrWriteMap map[string]interface{}, subUnit map[string]customerform.MasterStruct) (msgid string, err error) { if s.Open { //开启发送信息 var sendMsg workWechat.SendMessage @@ -1149,23 +1149,23 @@ func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, switch s.Types { case "textcard": sendMsg.Msgtype = "textcard" - sendMsg.Textcard.Title = s.SendMsgInfo(s.Title, msgTitle, fieldVal, subUnit) - sendMsg.Textcard.Description = fmt.Sprintf("
%v
%v
请尽快阅读此信息
", publicmethod.UnixTimeToDay(time.Now().Unix(), 11), s.SendMsgInfo(s.Content, msgTitle, fieldVal, subUnit)) + sendMsg.Textcard.Title = s.SendMsgInfo(s.Title, msgTitle, fieldVal, masrWriteMap, subUnit) + sendMsg.Textcard.Description = fmt.Sprintf("
%v
%v
请尽快阅读此信息
", publicmethod.UnixTimeToDay(time.Now().Unix(), 11), s.SendMsgInfo(s.Content, msgTitle, fieldVal, masrWriteMap, subUnit)) sendMsg.Textcard.Url = fmt.Sprintf("%v/#/work_wechat?masters_key=%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, uuid) sendMsg.Textcard.Btntxt = "前往查看" case "news": sendMsg.Msgtype = "news" //图文内容 var imgMsgInfo workWechat.ArticlesList - imgMsgInfo.Title = s.SendMsgInfo(s.Title, msgTitle, fieldVal, subUnit) - imgMsgInfo.Description = s.SendMsgInfo(s.Content, msgTitle, fieldVal, subUnit) + imgMsgInfo.Title = s.SendMsgInfo(s.Title, msgTitle, fieldVal, masrWriteMap, subUnit) + imgMsgInfo.Description = s.SendMsgInfo(s.Content, msgTitle, fieldVal, masrWriteMap, subUnit) imgMsgInfo.Url = fmt.Sprintf("%v/#/work_wechat?masters_key=%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, uuid) imgMsgInfo.PicUrl = s.GainOneField(s.Icon, msgTitle, fieldVal, subUnit) sendMsg.NewsMsg.Articles = append(sendMsg.NewsMsg.Articles, imgMsgInfo) // sendMsg.NewsMsg.Articles = s.SendMsgInfo(s.Title, msgTitle, fieldVal, subUnit) default: sendMsg.Msgtype = "text" - sendMsg.TextMsg.Content = s.SendMsgInfo(s.Content, msgTitle, fieldVal, subUnit) + sendMsg.TextMsg.Content = s.SendMsgInfo(s.Content, msgTitle, fieldVal, masrWriteMap, subUnit) } sendInitInfouser, _ := json.Marshal(sendUserAll) @@ -1175,6 +1175,7 @@ func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, //判断当前人数是否曹组 if sendUserCount >= 1000 { + fmt.Printf("\n\n--1---》%v\n\n", string(sendInitInfouser)) var msgidAry []string var msgToUser []string for i, v := range sendUserAll { @@ -1196,6 +1197,7 @@ func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, if len(msgToUser) > 0 { sendMsg.Touser = strings.Join(msgToUser, "|") msgidSte, errStr := sendMsg.SendMsg("stzl", 1) + fmt.Printf("\n\n--3---》%v\n\n", string(sendInitInfouser)) msgToUser = []string{} msgidAry = append(msgidAry, msgidSte) if errStr != nil { @@ -1206,6 +1208,7 @@ func (s *SendMsgInfo) SendMsg(userCont modelshr.ManCont, msgTitle string, uuid, msgid = strings.Join(msgidAry, ",") } } else { + fmt.Printf("\n\n--2---》%v\n\n", string(sendInitInfouser)) msgid, err = sendMsg.SendMsg("stzl", 1) } } @@ -1329,7 +1332,7 @@ func (s *SendMsgInfo) GainOneField(fields string, msgTitle string, fieldVal map[ @ 时间: 2025-03-28 15:48:28 @ 功能: 获取发送标题 */ -func (s *SendMsgInfo) SendMsgInfo(fields []string, msgTitle string, fieldVal map[string]interface{}, subUnit map[string]customerform.MasterStruct) string { +func (s *SendMsgInfo) SendMsgInfo(fields []string, msgTitle string, fieldVal, masrWriteMap map[string]interface{}, subUnit map[string]customerform.MasterStruct) string { fmt.Printf("\n\n应获取的字段--->%v\n\n", fields) if len(fields) > 0 { biaotiYUneirong := "" @@ -1337,6 +1340,8 @@ func (s *SendMsgInfo) SendMsgInfo(fields []string, msgTitle string, fieldVal map var sendData interface{} if val, isOk := fieldVal[v]; isOk { sendData = val + } else if vals, isTrue := masrWriteMap[v]; isTrue { + sendData = vals } unitCont := GainFieldType(v, subUnit) fmt.Printf("\n\n应获取的字段--1->%v--->%v\n\n", unitCont.Type, sendData) @@ -1663,7 +1668,7 @@ func RegexpToMap(val string) (wechatMap []string) { } if len(userNumber) > 0 { var orgManList []modelshr.PersonArchives - overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`wechat`,`work_wechat`").Where("`emp_type` BETWEEN 1 AND 10").Where("`state` = 1 AND `admin_org` IN ?", userNumber).Find(&orgManList) + overall.CONSTANT_DB_HR.Model(&modelshr.PersonArchives{}).Select("`wechat`,`work_wechat`").Where("`emp_type` BETWEEN 1 AND 10").Where("`state` = 1 AND `number` IN ?", userNumber).Find(&orgManList) if len(orgManList) > 0 { for _, v := range orgManList { if v.Wechat != "" && !publicmethod.IsInTrue[string](v.Wechat, wechatMap) { diff --git a/api/version1/taskplatform/taskmanagement/runTaskFlow.go b/api/version1/taskplatform/taskmanagement/runTaskFlow.go index 7fb54d2..d940624 100644 --- a/api/version1/taskplatform/taskmanagement/runTaskFlow.go +++ b/api/version1/taskplatform/taskmanagement/runTaskFlow.go @@ -205,10 +205,10 @@ func (r *RunWorkFlow) RunNodeHandle(userKey int64, AgreeToRefuse int, Suggest st fmt.Printf("执行节点处理--->%v------>%v\n", r.Step, r.NextStep) //遍历流程判断当前要执行的步骤 for i := 0; i < r.TotalSteps; i++ { - if r.FlowList[i].Step == r.Step { //获取当前操作节点 + if r.FlowList[i].Step == r.NextStep { //获取当前操作节点 //Step1:判断当前节点是不是抄送节点 if r.FlowList[i].Types == 2 { - currentStep, nextStep := PaceStep(r.RunUid, r.Step, r.TotalSteps, r.FlowList[i]) + currentStep, nextStep := PaceStep(r.RunUid, r.NextStep, r.TotalSteps, r.FlowList[i]) for _, op := range r.FlowList[i].Operator { r.MakeCopy = append(r.MakeCopy, op.Id) userkIntId, _ := strconv.ParseInt(op.Id, 10, 64) @@ -227,91 +227,91 @@ func (r *RunWorkFlow) RunNodeHandle(userKey int64, AgreeToRefuse int, Suggest st } } } else { - r.IsRun, r.Msg = JudgeOperUser(userKey, r.RunUid, r.FlowList[i].Operator) //判断操作人是有操作权限或是否已经操作过 - if r.IsRun { - return - } else { - if AgreeToRefuse != 1 { //驳回操作 - r.FlowList[i].Status = 3 - operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 3, r.FlowList[i].Operator, Suggest) - r.FlowList[i].Operator = operatorAry - r.Participant = append(r.Participant, nodeUser...) - r.RejectNode(r.FlowList[i].GoBackNode) - r.SendWecharMsgTextCard(r.Step, "驳回", Suggest) - return - } else { - currentStep, nextStep := PaceStep(r.RunUid, r.Step, r.TotalSteps, r.FlowList[i]) - // fmt.Printf("同意操作---->%v---->%v---->%v\n", currentStep, nextStep, r.FlowList[i].Types) - r.FlowList[i].Status = 2 - operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator, Suggest) - r.FlowList[i].Operator = operatorAry - r.Participant = append(r.Participant, nodeUser...) - switch r.FlowList[i].Types { - case 0: - if r.Step != currentStep { - r.SendWecharMsgTopct(userKeyStr, currentStep) - } - r.Step = currentStep - r.NextStep = nextStep - FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, "发起流程", "") - // if JudgeRunNode(nextStep, r.FlowList) { - if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { - r.Step = nextStep - r.FlowStepRun(userKey, AgreeToRefuse, Suggest) - } - return - case 1: - if r.Step != currentStep { - r.SendWecharMsgTopct(userKeyStr, currentStep) - } - r.Step = currentStep - r.NextStep = nextStep - // fmt.Printf("判断是否继续执行---->%v\n", JudgeRunNode(nextStep, r.FlowList)) - FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") - if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { - // if JudgeRunNode(nextStep, r.FlowList) { - r.Step = nextStep - r.RunNodeHandle(userKey, AgreeToRefuse, Suggest) - } - return - case 2: - if currentStep+1 < r.TotalSteps { - r.Step = currentStep + 1 - if nextStep+1 <= r.TotalSteps { - r.NextStep = nextStep + 1 - } else { - r.NextStep = 0 - } - } else { - r.Step = r.TotalSteps - r.NextStep = 0 - } - for _, op := range r.FlowList[i].Operator { - r.MakeCopy = append(r.MakeCopy, op.Id) - userkIntId, _ := strconv.ParseInt(op.Id, 10, 64) - title := fmt.Sprintf("向%v发送抄送数据", op.Name) - FlowRunLog(r.Uuid, userkIntId, AgreeToRefuse, r.FlowList[i].NodeKey, title, "") - } - r.SendWecharMsgTopct(userKeyStr, r.Step) - return - case 3: - if r.Step != currentStep { - r.SendWecharMsgTopct(userKeyStr, currentStep) - } - r.Step = currentStep - r.NextStep = nextStep - FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") - if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { - // if JudgeRunNode(nextStep, r.FlowList) { - r.Step = nextStep - r.RunNodeHandle(userKey, AgreeToRefuse, Suggest) - } - return - default: - } - - } - } + // r.IsRun, r.Msg = JudgeOperUser(userKey, r.RunUid, r.FlowList[i].Operator) //判断操作人是有操作权限或是否已经操作过 + // if r.IsRun { + // return + // } else { + // if AgreeToRefuse != 1 { //驳回操作 + // r.FlowList[i].Status = 3 + // operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 3, r.FlowList[i].Operator, Suggest) + // r.FlowList[i].Operator = operatorAry + // r.Participant = append(r.Participant, nodeUser...) + // r.RejectNode(r.FlowList[i].GoBackNode) + // r.SendWecharMsgTextCard(r.Step, "驳回", Suggest) + // return + // } else { + // currentStep, nextStep := PaceStep(r.RunUid, r.NextStep, r.TotalSteps, r.FlowList[i]) + // // fmt.Printf("同意操作---->%v---->%v---->%v\n", currentStep, nextStep, r.FlowList[i].Types) + // r.FlowList[i].Status = 2 + // operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator, Suggest) + // r.FlowList[i].Operator = operatorAry + // r.Participant = append(r.Participant, nodeUser...) + // switch r.FlowList[i].Types { + // case 0: + // if r.Step != currentStep { + // r.SendWecharMsgTopct(userKeyStr, currentStep) + // } + // r.Step = currentStep + // r.NextStep = nextStep + // FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, "发起流程", "") + // // if JudgeRunNode(nextStep, r.FlowList) { + // if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { + // r.Step = nextStep + // r.FlowStepRun(userKey, AgreeToRefuse, Suggest) + // } + // return + // case 1: + // if r.Step != currentStep { + // r.SendWecharMsgTopct(userKeyStr, currentStep) + // } + // r.Step = currentStep + // r.NextStep = nextStep + // // fmt.Printf("判断是否继续执行---->%v\n", JudgeRunNode(nextStep, r.FlowList)) + // FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") + // if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { + // // if JudgeRunNode(nextStep, r.FlowList) { + // r.Step = nextStep + // r.RunNodeHandle(userKey, AgreeToRefuse, Suggest) + // } + // return + // case 2: + // if currentStep+1 < r.TotalSteps { + // r.Step = currentStep + 1 + // if nextStep+1 <= r.TotalSteps { + // r.NextStep = nextStep + 1 + // } else { + // r.NextStep = 0 + // } + // } else { + // r.Step = r.TotalSteps + // r.NextStep = 0 + // } + // for _, op := range r.FlowList[i].Operator { + // r.MakeCopy = append(r.MakeCopy, op.Id) + // userkIntId, _ := strconv.ParseInt(op.Id, 10, 64) + // title := fmt.Sprintf("向%v发送抄送数据", op.Name) + // FlowRunLog(r.Uuid, userkIntId, AgreeToRefuse, r.FlowList[i].NodeKey, title, "") + // } + // r.SendWecharMsgTopct(userKeyStr, r.Step) + // return + // case 3: + // if r.Step != currentStep { + // r.SendWecharMsgTopct(userKeyStr, currentStep) + // } + // r.Step = currentStep + // r.NextStep = nextStep + // FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") + // if r.ToNextNodeRunOrClose(userKeyStr, nextStep) { + // // if JudgeRunNode(nextStep, r.FlowList) { + // r.Step = nextStep + // r.RunNodeHandle(userKey, AgreeToRefuse, Suggest) + // } + // return + // default: + // } + + // } + // } } } @@ -339,17 +339,17 @@ func (a *ApiMethod) GainEditDataNewLog(c *gin.Context) { var requestData publicmethod.PublicId err := c.ShouldBindJSON(&requestData) if err != nil { - publicmethod.Result(100, err, c) + publicmethod.Result(200, err, c) return } if requestData.Id == "" { - publicmethod.Result(100, err, c) + publicmethod.Result(200, err, c) return } var tableEditLog []reviseform.EditFormDataLog err = overall.CONSTANT_DB_ReviseFormData.Model(&reviseform.EditFormDataLog{}).Where("`masters_key` = ?", requestData.Id).Order("`id` DESC").Find(&tableEditLog).Error if err != nil { - publicmethod.Result(107, err, c) + publicmethod.Result(200, err, c, "没有数据") return } sendData := publicmethod.MapOut[string]() diff --git a/api/version1/taskplatform/taskmanagement/runWorkFlow.go b/api/version1/taskplatform/taskmanagement/runWorkFlow.go index 973abdc..7254692 100644 --- a/api/version1/taskplatform/taskmanagement/runWorkFlow.go +++ b/api/version1/taskplatform/taskmanagement/runWorkFlow.go @@ -514,11 +514,16 @@ func PaceStep(runId int64, step, totalSteps int, nodeInfo RunFlow) (currentStep, allUser := len(nodeInfo.Operator) jiBuQi := 1 for _, v := range nodeInfo.Operator { - for _, m := range v.LogList { - if m.UID == runIdStr { - jiBuQi++ + if len(v.LogList) > 0 { + for _, m := range v.LogList { + if m.UID == runIdStr { + jiBuQi++ + } } + } else { + jiBuQi++ } + } if allUser <= jiBuQi { //全部审批完毕 if step >= totalSteps { @@ -526,7 +531,7 @@ func PaceStep(runId int64, step, totalSteps int, nodeInfo RunFlow) (currentStep, nextStep = 0 return } - currentStep = step + 1 + currentStep = step if currentStep >= totalSteps { currentStep = totalSteps nextStep = 0 @@ -676,18 +681,18 @@ func (a *ApiMethod) GainRunTaskWorkflow(c *gin.Context) { var requestData publicmethod.PublicId err := c.ShouldBindJSON(&requestData) if err != nil { - publicmethod.Result(100, err, c) + publicmethod.Result(200, err, c) return } if requestData.Id == "" { - publicmethod.Result(100, err, c) + publicmethod.Result(200, err, c) return } var runFlowInfo customerForm.RunWorkflow // err = runFlowInfo.GetCont(map[string]interface{}{"`flow_key`": requestData.Id}) err = runFlowInfo.GetCont(map[string]interface{}{"`id`": requestData.Id}) if err != nil || runFlowInfo.FlowCont == "" { - publicmethod.Result(107, err, c) + publicmethod.Result(200, err, c) return } context, _ := c.Get(overall.MyContJwt) @@ -696,7 +701,7 @@ func (a *ApiMethod) GainRunTaskWorkflow(c *gin.Context) { var flowList []RunFlow err = json.Unmarshal([]byte(runFlowInfo.FlowCont), &flowList) if err != nil { - publicmethod.Result(107, err, c) + publicmethod.Result(200, err, c) return } //判断是否需要回写流程记录 @@ -1264,6 +1269,7 @@ func (a *ApiMethod) AuthorizeWorkflow(c *gin.Context) { publicmethod.Result(1, err, c, "此流程再不可审批状态!您的提交无效") return } + if len(requestData.FlowList) < 1 { if flowInfo.FlowCont != "" { err = json.Unmarshal([]byte(flowInfo.FlowCont), &requestData.FlowList) @@ -1296,6 +1302,9 @@ func (a *ApiMethod) AuthorizeWorkflow(c *gin.Context) { publicmethod.Result(1, err, c, runFlow.Msg) return } + flowJsonContdfg, _ := json.Marshal(runFlow) //将步进流转化成json流 + fmt.Printf("\n\n\n最终数据写入------------->%v\n\n\n", string(flowJsonContdfg)) + flowJsonCont, _ := json.Marshal(runFlow.FlowList) //将步进流转化成json流 saveFlowInfo := publicmethod.MapOut[string]() saveTaskInfo := publicmethod.MapOut[string]() @@ -1518,12 +1527,18 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri if len(r.FlowList) < 1 { return } + rJson, _ := json.Marshal(r) + fmt.Printf("\n\n流程处理----1------>rJson:%v\n\n----------%v---------->%v----------%v\n\n\n", string(rJson), userKey, AgreeToRefuse, Suggest) + userKeyStr := strconv.FormatInt(userKey, 10) for i := 0; i < r.TotalSteps; i++ { if r.FlowList[i].Step == r.Step { //判断操作人是有操作权限或是否已经操作过 - r.IsRun, r.Msg = JudgeOperUser(userKey, r.RunUid, r.FlowList[i].Operator) - if r.IsRun { + isRun, msgInfo := JudgeOperUser(userKey, r.RunUid, r.FlowList[i].Operator) + r.IsRun = isRun + r.Msg = msgInfo + fmt.Printf("判断操作人是有操作权限或是否已经操作过---------->isRun:%v----------msgInfo:%v---------->r.IsRun:%v----------r.Msg:%v\n\n\n", isRun, msgInfo, r.IsRun, r.Msg) + if isRun { return } else { if AgreeToRefuse != 1 { //驳回操作 @@ -1542,6 +1557,9 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri operatorAry, nodeUser := FindOperator(userKeyStr, r.RunUid, 2, r.FlowList[i].Operator, Suggest) r.FlowList[i].Operator = operatorAry r.Participant = append(r.Participant, nodeUser...) + + fmt.Printf("要执行得动作---->%v---->%v---->%v\n", r.FlowList[i].Types) + switch r.FlowList[i].Types { case 0: r.Step = currentStep @@ -1555,6 +1573,10 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri r.Step = currentStep r.NextStep = nextStep FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") + if nextStep != 0 { + r.RunNodeHandle(userKey, AgreeToRefuse, Suggest) + } + return case 2: r.Step = currentStep r.NextStep = nextStep @@ -1573,6 +1595,7 @@ func (r *RunWorkFlow) FlowStepRun(userKey int64, AgreeToRefuse int, Suggest stri r.Step = currentStep r.NextStep = nextStep FlowRunLog(r.Uuid, userKey, 2, r.FlowList[i].NodeKey, Suggest, "") + return default: } } @@ -1648,7 +1671,7 @@ func (r *RunWorkFlow) RejectNode(nodeKey string) (isNew bool) { */ func JudgeOperUser(userKey, runId int64, Operator []OperatorList) (bool, string) { if len(Operator) < 1 { - return true, "您不是此节点操作人!请不要提交!" + return true, "您不是此节点操作人!请不要提交!450" } caoZuoQuanXian := true for _, v := range Operator { @@ -1656,14 +1679,16 @@ func JudgeOperUser(userKey, runId int64, Operator []OperatorList) (bool, string) if v.Id == strconv.FormatInt(userKey, 10) { js, _ := json.Marshal(v) fmt.Printf("判断操作人是否已经操作过\n userKey:%v====runId:%v=========v.Id=>%v\n\n\n%v\n\n\n", userKey, runId, v.Id, string(js)) - caoZuoQuanXian = false + // caoZuoQuanXian = false if len(v.LogList) > 0 { for _, m := range v.LogList { if m.UID == strconv.FormatInt(runId, 10) { fmt.Printf("判断操作人\n\n\n userKey:%v====runId:%v=========v.Id=>%v\n\n\n%v\n\n\n", userKey, runId, m.UID, m) + caoZuoQuanXian = true return true, "您已经操作过此节点!请不要重复提交!" } } + caoZuoQuanXian = false } else { caoZuoQuanXian = false } @@ -1671,9 +1696,13 @@ func JudgeOperUser(userKey, runId int64, Operator []OperatorList) (bool, string) fmt.Printf("是否已经操作过\n userKey:%v====runId:%v=========caoZuoQuanXian=>%v\n\n\n%v\n\n\n", userKey, runId, caoZuoQuanXian, string(jsLog)) } } + + fmt.Printf("是否已经操作过===========================>%v\n\n\n", caoZuoQuanXian) + if caoZuoQuanXian { - return true, "您不是此节点操作人!请不要提交!" + return true, "您不是此节点操作人!请不要提交!123" } + fmt.Printf("是否已经操作过===========234234325================>%v\n\n\n", caoZuoQuanXian) return false, "" } diff --git a/api/version1/workWechat/sendMsg.go b/api/version1/workWechat/sendMsg.go index 4b244f1..85f4b40 100644 --- a/api/version1/workWechat/sendMsg.go +++ b/api/version1/workWechat/sendMsg.go @@ -206,6 +206,7 @@ func (s *SendMessage) MsgInit() { func (s *SendMessage) SendMsg(systemApp string, class int) (msgid string, err error) { s.MsgInit() topMapAry, err := s.MsgCommon.MsgCommon() + fmt.Printf("\n\n-A-3---》%v---》%v\n\n", s.Msgtype, err) if err != nil { return } @@ -249,6 +250,7 @@ func (s *SendMessage) SendMsg(systemApp string, class int) (msgid string, err er } case "news": //图文消息 mapAry.Send["news"], err = s.NewsMethod() + fmt.Printf("\n\n-A-5---》%v\n\n", err, mapAry) if err != nil { return } @@ -276,9 +278,11 @@ func (s *SendMessage) SendMsg(systemApp string, class int) (msgid string, err er err = errors.New("没有消息类型!不可发送信息") return } - + fmt.Printf("\n\n-A-4---》%v\n\n", mapAry) // mapAry.Send["template_card"] = templateCard msgid, err = mapAry.SendMsg(systemApp, class) + + fmt.Printf("\n\n通用发送消息-----》%v\n\n", msgid, err) return } diff --git a/config/configApp/appConfig.yaml b/config/configApp/appConfig.yaml index 6466b9e..0f863c1 100644 --- a/config/configApp/appConfig.yaml +++ b/config/configApp/appConfig.yaml @@ -9,7 +9,7 @@ appsetup: prefix: 'HXJT' #系统字段前缀 weburl: 'http://kpi.hxgk.group' #web访问地址 pcurl: 'http://ginadmin.hxgk.group' #PC访问地址 - webKpiUrl: 'http://web.hxgk.group' #web访问地址 + webKpiUrl: 'https://wab.hxgk.group' #web访问地址 defaultIP: '127.0.0.1' # logconfig: path: 'log' #日志保存地址 diff --git a/models/customerForm/runFlowTask.go b/models/customerForm/runFlowTask.go index e959312..6aa4d25 100644 --- a/models/customerForm/runFlowTask.go +++ b/models/customerForm/runFlowTask.go @@ -43,6 +43,7 @@ type RunFlowTask struct { AppKey int64 `json:"appKey" gorm:"column:appKey;type:bigint(20) unsigned;default:0;not null;comment:归属App(0:非app表单)"` MakeCopy string `json:"makeCopy" gorm:"column:makeCopy;type:mediumtext;comment:抄送人"` MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表识别符"` + MsgId int64 `json:"msgId" gorm:"column:msgId;type:bigint(20) unsigned;default:0;not null;comment:发送消息得任务ID"` } func (RunFlowTask *RunFlowTask) TableName() string { diff --git a/models/customerForm/taskAndFlow.go b/models/customerForm/taskAndFlow.go new file mode 100644 index 0000000..11c0c14 --- /dev/null +++ b/models/customerForm/taskAndFlow.go @@ -0,0 +1,88 @@ +package customerForm + +import ( + "appPlatform/overall" + "strings" +) + +// 自定义表单任务表 +type TaskAndFlow struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"` + Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` + CreaterTime int64 `json:"creater_time" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + Types int `json:"types" gorm:"column:types;type:int(1) unsigned;default:1;not null;comment:类型(1:普通表单;2:流程表单)"` + VersionId int64 `json:"version_id" gorm:"column:version_id;type:bigint(20) unsigned;default:0;not null;comment:来源于哪个表单"` + MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` + FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` + FlowRunSing int64 `json:"flowRunSing" gorm:"column:flow_run_sing;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` + MastesForm string `json:"mastesform" gorm:"column:mastesform;type:longtext;default:'';comment:表单结构"` + MastesFormJson string `json:"mastesformjson" gorm:"column:mastesformjson;type:longtext;default:'';comment:表单结构json"` + Visibility int `json:"visibility" gorm:"column:visibility;type:int(1) unsigned;default:1;not null;comment:1、所有人;2、自定义"` + AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;comment:授权角色"` + AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;comment:授权人员"` + AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;comment:授权行政组织"` + AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;comment:授权职务"` + Participant string `json:"participant" gorm:"column:participant;type:longtext;default:'';comment:表单结构json"` + TableKey int64 `json:"tableKey" gorm:"column:tableKey;type:bigint(20) unsigned;default:0;not null;comment:归属自定义表"` + AppKey int64 `json:"appKey" gorm:"column:appKey;type:bigint(20) unsigned;default:0;not null;comment:归属App(0:非app表单)"` + RunFlowId int64 `json:"runFlowId" gorm:"column:runFlowId;type:bigint(20) unsigned;default:0;not null;comment:正在执行得流程"` + MsgId int64 `json:"msgId" gorm:"column:msgId;type:bigint(20) unsigned;default:0;not null;comment:发送消息得任务ID"` + Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` + Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` + FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:流程执行体"` + Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` + CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(4) unsigned;default:1;not null;comment:当前节点"` + NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` + NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` + Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` + StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` + VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"` + RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"` + MakeCopy string `json:"makeCopy" gorm:"column:makeCopy;type:mediumtext;comment:抄送人"` +} + +func (TaskAndFlow *TaskAndFlow) TableName() string { + return "taskAndFlow" +} + +// 编辑内容 +func (cont *TaskAndFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { + err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error + return +} + +// 获取内容 +func (cont *TaskAndFlow) GetCont(whereMap interface{}, field ...string) (err error) { + gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + gormDb = gormDb.Where(whereMap) + err = gormDb.First(&cont).Error + return +} + +// 根据条件获取总数 +func (cont *TaskAndFlow) CountCont(whereMap interface{}) (countId int64) { + overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) + return +} + +// 读取全部信息 +func (cont *TaskAndFlow) ContMap(whereMap interface{}, field ...string) (countAry []TaskAndFlow, err error) { + gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) + if len(field) > 0 { + fieldStr := strings.Join(field, ",") + gormDb = gormDb.Select(fieldStr) + } + err = gormDb.Where(whereMap).Find(&countAry).Error + return +} + +// 删除内容 +func (cont *TaskAndFlow) DelCont(whereMap interface{}) (err error) { + err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error + return +}