package taskmanagement import ( "appPlatform/api/version1/customerform" "appPlatform/api/version1/workWechat" "appPlatform/models/modelAppPlatform" "appPlatform/models/modelshr" "appPlatform/overall" "appPlatform/overall/publicmethod" "encoding/json" "fmt" "strconv" "strings" "time" ) /* * @ 作者: 秦东 @ 时间: 2024-12-13 13:38:52 @ 功能: 向下一个节点人员发送消息 @ 参数 # @ 返回值 # @ 方法原型 # */ func (r *RunWorkFlow) SendWecharMsgTopct(userKey string, nextStep int) { if nextStep > 0 { var sendUserAry []string nodeTitle := "" for _, v := range r.FlowList { if nextStep == v.Step { nodeTitle = v.NodeName if v.ExamineMode != 1 { for _, ov := range v.Operator { if userKey != "" { if ov.Id != userKey && ov.Wechat != "" { sendUserAry = append(sendUserAry, ov.Wechat) } } else { if ov.Wechat != "" { sendUserAry = append(sendUserAry, ov.Wechat) } } } } else { uuidStr := strconv.FormatInt(r.Uuid, 10) for _, ov := range v.Operator { for _, lv := range ov.LogList { if lv.UID != uuidStr { if userKey != "" { if ov.Id != userKey && ov.Wechat != "" { sendUserAry = append(sendUserAry, ov.Wechat) } } else { if ov.Wechat != "" { sendUserAry = append(sendUserAry, ov.Wechat) } } } } } } } } if len(sendUserAry) > 0 { taskId := publicmethod.GetUUid(1) tableName, qouteTitle, contList := r.GainTitleAndCreate() var sendMsg workWechat.SendMessage sendMsg.Touser = strings.Join(sendUserAry, "|") sendMsg.TemplateCard.Source.Desc = nodeTitle sendMsg.TemplateCard.MainTitle.Title = tableName sendMsg.TemplateCard.TaskId = strconv.FormatInt(taskId, 10) sendMsg.TemplateCard.QuoteArea.Quote_text = qouteTitle sendMsg.TemplateCard.HorizontalContentList = append(sendMsg.TemplateCard.HorizontalContentList, contList...) var jumpInfo workWechat.Jump_list jumpInfo.Title = "前往处理" jumpInfo.Url = "wap.gyhlw.group" jumpInfo.Type = 1 sendMsg.TemplateCard.JumpList = append(sendMsg.TemplateCard.JumpList, jumpInfo) sendMsg.TemplateCard.CardAction.Type = 1 sendMsg.TemplateCard.CardAction.Url = "wap.gyhlw.group" sendMsg.SendMsg("stzl", 1) } } } /* * @ 作者: 秦东 @ 时间: 2024-12-17 15:53:24 @ 功能: 发送文本卡片消息 @ 参数 #userKey 接收人 @ 返回值 # @ 方法原型 # */ func (r *RunWorkFlow) SendWecharMsgTextCard(runStep int, nodeTitle, content string) { if runStep == 0 { runStep = 1 } if runStep > len(r.FlowList) { runStep = len(r.FlowList) } var sendUser []string for _, v := range r.FlowList { if v.Step == runStep { for _, lv := range v.Operator { if lv.Wechat != "" && !publicmethod.IsInTrue[string](lv.Wechat, sendUser) { sendUser = append(sendUser, lv.Wechat) } } } } // fmt.Printf("驳回数据接收人:%v", sendUser) if len(sendUser) > 0 { tableName, qouteTitle, _ := r.GainTitleAndCreate() var sendMsg workWechat.SendMessage sendMsg.Touser = strings.Join(sendUser, "|") sendMsg.Msgtype = "textcard" sendMsg.Textcard.Title = nodeTitle sendMsg.Textcard.Description = fmt.Sprintf("
%v
%v
%v
驳回原因:%v
", publicmethod.UnixTimeToDay(time.Now().Unix(), 11), tableName, qouteTitle, content) sendMsg.Textcard.Url = fmt.Sprintf("%v/#/work_wechat?masters_key=%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, r.SendWecharMsg.MastersKey) sendMsg.Textcard.Btntxt = "前往查看" fmt.Printf("驳回数据接收人2:%v", sendMsg) sendMsg.SendMsg("stzl", 1) } } /* * @ 作者: 秦东 @ 时间: 2024-12-13 15:38:55 @ 功能: 获取指定标题和申请人相关信息 #tableName 一级标题 #qouteTitle 引用文件 #peopleInfoAry 发起人 */ func (r *RunWorkFlow) GainTitleAndCreate() (tableName, qouteTitle string, peopleInfoAry []workWechat.Horizontal_content_list) { var tableInFor modelAppPlatform.CustomerForm tableInFor.GetCont(map[string]interface{}{"`signCode`": r.SendWecharMsg.TableKey}, "`name`", "`tablename`", "`listjson`") tableName = tableInFor.Name qouteTitle = tableInFor.Name var ceraterInfo modelshr.PersonArchives ceraterInfo.GetCont(map[string]interface{}{"`key`": r.SendWecharMsg.Creater}, "`name`", "`number`", "`wechat`", "`work_wechat`") var peopleInfo workWechat.Horizontal_content_list peopleInfo.Keyname = "申请人" peopleInfo.Value = fmt.Sprintf("%v(%v)", ceraterInfo.Name, ceraterInfo.Number) if ceraterInfo.WorkWechat != "" { peopleInfo.Type = 3 peopleInfo.UserId = ceraterInfo.WorkWechat } else if ceraterInfo.Wechat != "" { peopleInfo.Type = 3 peopleInfo.UserId = ceraterInfo.Wechat } peopleInfoAry = append(peopleInfoAry, peopleInfo) if tableInFor.ListJson != "" { var listInfo customerform.ListPageFields json.Unmarshal([]byte(tableInFor.ListJson), &listInfo) if listView, isOk := listInfo.View["list"]; isOk { if len(listView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("list表单:%v\n\n\n%v\n\n\n", listView.Form.Title, tableForm) for _, v := range listView.Form.Title { if formVal, isOk := tableForm[v]; isOk { // fmt.Printf("list表单-----v----->:%v\n\n\n%v\n\n\n", formVal, publicmethod.TypeToInterface(formVal)) qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } else if dateView, isOk := listInfo.View["date"]; isOk { if len(dateView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("date表单:%v\n\n\n%v\n\n\n", dateView.Form.Title, tableForm) for _, v := range dateView.Form.Title { if formVal, isOk := tableForm[v]; isOk { qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } else if timeView, isOk := listInfo.View["time"]; isOk { if len(timeView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("time表单:%v\n\n\n%v\n\n\n", timeView.Form.Title, tableForm) for _, v := range timeView.Form.Title { if formVal, isOk := tableForm[v]; isOk { qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } else if ganttView, isOk := listInfo.View["gantt"]; isOk { if len(ganttView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("gantt表单:%v\n\n\n%v\n\n\n", ganttView.Form.Title, tableForm) for _, v := range ganttView.Form.Title { if formVal, isOk := tableForm[v]; isOk { qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } else if mapView, isOk := listInfo.View["map"]; isOk { if len(mapView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("map表单:%v\n\n\n%v\n\n\n", mapView.Form.Title, tableForm) for _, v := range mapView.Form.Title { if formVal, isOk := tableForm[v]; isOk { qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } else if cardView, isOk := listInfo.View["card"]; isOk { if len(cardView.Form.Title) > 0 { tableForm := publicmethod.MapOut[string]() overall.CONSTANT_DB_CustomerForm.Table(tableInFor.TableNames).Where("`masters_key` = ?", r.SendWecharMsg.MastersKey).Find(&tableForm) var qouteTitleAry []string // fmt.Printf("card表单:%v\n\n\n%v\n\n\n", cardView.Form.Title, tableForm) for _, v := range cardView.Form.Title { if formVal, isOk := tableForm[v]; isOk { qouteTitleAry = append(qouteTitleAry, publicmethod.TypeToInterface(formVal)) } } if len(qouteTitleAry) > 0 { qouteTitle = strings.Join(qouteTitleAry, "-") } } } } // fmt.Printf("qouteTitle表单:%v\n\n\n", qouteTitle) return }