package callback import ( "fmt" "strconv" "strings" "time" evals "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" "github.com/flipped-aurora/gin-vue-admin/server/api/wechatapp/sendmessage" "github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" ) func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnter string) { buttonClickNAme := "已批准" // buttonClickNAmeOther := "其他人已批准" if clickEnter == "1" { t.UpdateButton(t.FromUsername, buttonClickNAme) } else { buttonClickNAme = "已驳回" // buttonClickNAmeOther = "其他人已驳回" t.UpdateButton(t.FromUsername, buttonClickNAme) } //获取点击人信息 _, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername) var scoreFlowInfo assessmentmodel.FlowLog judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", orderId).First(&scoreFlowInfo).Error if judegFlowErr != nil { _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科) userCallAry := strings.Split(butCallBackUser, "|") t.OtherClickButton(userCallAry, buttonClickNAme) return } if clickEnter == "1" { evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2) saveData := commonus.MapOut() saveData["fl_reply"] = 2 saveData["fl_eite_time"] = time.Now().Unix() EiteDutiesInfoes(scoreFlowInfo.Key, saveData) //获取信息接收人 sendUserList := "" userFileStr := "wm_number,qywx_key,wx_key" //操作人条件 userWherAry := commonus.MapOut() // userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3" userWherAry["wm_key"] = scoreFlowInfo.EvaluationUser userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) if userIsTrue == true { if userConting.WechatId != "" { sendUserList = userConting.WechatId } if userConting.WorkWechatId != "" { sendUserList = userConting.WorkWechatId } } taskId := commonus.GetFileNumberEs() // targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _ := commonus.GetDutyAssociatedItems(orderId) title := fmt.Sprintf("%v-%v数据表", scoreFlowInfo.Year, scoreFlowInfo.Month) desc := "" quoteAreaTitle := "数据详情" var quoteAreaContent string var flowLogDataList []assessmentmodel.FlowLogData dlgContErr := global.GVA_DB_Performanceappraisal.Where("fld_flow_log = ?", orderId).Find(&flowLogDataList).Error if dlgContErr == nil { for ii, vv := range flowLogDataList { targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(vv.EvaluationPlan, 10)) tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if ii == 0 { if targetInfoErr == true { quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) } } else { if targetInfoErr == true { quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) } } } } twoLevelTitle := "考核上报部门" var twoLevelKeyName, twoLevelKeyValue string userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername) if userWechatErr == true { twoLevelKeyName = userWechat.DepartmentName twoLevelKeyValue = userWechat.Name } twoLevelUserId := t.FromUsername jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) jumpUrlTitle := "查看详情" sourceDesc := "通过" var sendTextMsg sendmessage.TextNoticeTemplateMedium callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) fmt.Printf("更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) } else { evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2) saveData := commonus.MapOut() saveData["fl_reply"] = 2 saveData["fl_eite_time"] = time.Now().Unix() EiteDutiesInfoes(scoreFlowInfo.Key, saveData) //获取信息接收人 sendUserList := "" userFileStr := "wm_number,qywx_key,wx_key" //操作人条件 userWherAry := commonus.MapOut() // userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3" userWherAry["wm_key"] = scoreFlowInfo.EvaluationUser userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) if userIsTrue == true { if userConting.WechatId != "" { sendUserList = userConting.WechatId } if userConting.WorkWechatId != "" { sendUserList = userConting.WorkWechatId } } taskId := commonus.GetFileNumberEs() // targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _ := commonus.GetDutyAssociatedItems(orderId) title := fmt.Sprintf("%v-%v数据表", scoreFlowInfo.Year, scoreFlowInfo.Month) desc := "" quoteAreaTitle := "数据详情" var quoteAreaContent string var flowLogDataList []assessmentmodel.FlowLogData dlgContErr := global.GVA_DB_Performanceappraisal.Where("fld_flow_log = ?", orderId).Find(&flowLogDataList).Error if dlgContErr == nil { for ii, vv := range flowLogDataList { targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(vv.EvaluationPlan, 10)) tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if ii == 0 { if targetInfoErr == true { quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) } } else { if targetInfoErr == true { quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) } } } } twoLevelTitle := "考核上报部门" var twoLevelKeyName, twoLevelKeyValue string userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername) if userWechatErr == true { twoLevelKeyName = userWechat.DepartmentName twoLevelKeyValue = userWechat.Name } twoLevelUserId := t.FromUsername jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) jumpUrlTitle := "请前往重新提报!" sourceDesc := "驳回" var sendTextMsg sendmessage.TextNoticeTemplateMedium callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) fmt.Printf("更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) } } //编辑流程步进器 func EiteDutiesInfoes(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { isTrue = false infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Where("`fl_key` = ?", saveId).Updates(saveData).Error if infoErr != nil { return } isTrue = true return }