dddd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
8.2 KiB

4 years ago
package callback
import (
"fmt"
"strconv"
"strings"
"time"
"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 := "其他人已批准"
4 years ago
//获取点击人信息
_, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
//更新同级别其他人按钮
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
4 years ago
if clickEnter == "1" {
4 years ago
// t.UpdateButton(t.FromUsername, buttonClickNAme)
// t.UpdateButtonIng(butCallBackUser, buttonClickNAme)
4 years ago
} else {
buttonClickNAme = "已驳回"
// buttonClickNAmeOther = "其他人已驳回"
4 years ago
// t.UpdateButton(t.FromUsername, buttonClickNAme)
4 years ago
}
4 years ago
// //获取点击人信息
// _, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
// //更新同级别其他人按钮
// _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
userCallAry := strings.Split(butCallBackUser, "|")
t.OtherClickButton(userCallAry, buttonClickNAme)
fmt.Printf("OtherContent--------------------->%v------->%v------->%v\n", userContInfo, butCallBackUser, userCallAry)
4 years ago
var scoreFlowInfo assessmentmodel.FlowLog
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", orderId).First(&scoreFlowInfo).Error
if judegFlowErr != nil {
4 years ago
// _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
// userCallAry := strings.Split(butCallBackUser, "|")
// t.OtherClickButton(userCallAry, buttonClickNAme)
4 years ago
return
}
if clickEnter == "1" {
4 years ago
userKeyStr := strconv.FormatInt(userContInfo.Key, 10)
// evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr)
commonus.StepAddData(scoreFlowInfo.Key, 16182159043990656, 3, 7, 2, 2, 2, userKeyStr)
4 years ago
saveData := commonus.MapOut()
saveData["fl_reply"] = 3
4 years ago
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
4 years ago
// jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", orderId)
4 years ago
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)
4 years ago
fmt.Printf("2、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
4 years ago
} else {
4 years ago
userKeyStr := strconv.FormatInt(userContInfo.Key, 10)
// evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr)
commonus.StepAddData(scoreFlowInfo.Key, 16182159043990656, 1, 7, 2, 3, 2, userKeyStr)
4 years ago
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
4 years ago
// jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", orderId)
4 years ago
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)
4 years ago
fmt.Printf("3、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
4 years ago
}
}
//编辑流程步进器
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
}