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.
1859 lines
79 KiB
1859 lines
79 KiB
package callback
|
|
|
|
import (
|
|
"encoding/json"
|
|
"encoding/xml"
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
|
|
// evals "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation"
|
|
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 templateEventPush(eventMsg []byte) {
|
|
var msgContent TemplateCardPush
|
|
err := xml.Unmarshal(eventMsg, &msgContent)
|
|
if nil != err {
|
|
fmt.Println("***********Unmarshal fail")
|
|
}
|
|
fmt.Printf("button======>%v\n", msgContent.EventKey)
|
|
|
|
buttonClick := strings.Split(msgContent.EventKey, "_")
|
|
buttonLen := len(buttonClick)
|
|
fmt.Printf("Step------ButtionAry------->%v=====>%v\n", buttonClick, buttonLen)
|
|
if buttonLen >= 3 {
|
|
for i, v := range buttonClick {
|
|
|
|
fmt.Printf("%v====================>%v==================>%v\n", i, v, buttonClick[1])
|
|
}
|
|
switch buttonClick[0] {
|
|
case "duty": //数据考核审批工作
|
|
fmt.Printf("@@@@\n")
|
|
// msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2])
|
|
msgContent.ButtonTemplateCallBackHandleBackups(buttonClick[1], buttonClick[2])
|
|
case "ration":
|
|
msgContent.ButtonTemplateCallBackHandleRation(buttonClick[1], buttonClick[2])
|
|
default:
|
|
}
|
|
} else {
|
|
fmt.Printf("Step------Buttion------->%v\n", buttonClick)
|
|
}
|
|
|
|
jsonStr, _ := json.Marshal(msgContent)
|
|
fmt.Printf("jsonStr======>%v\n", string(jsonStr))
|
|
// defer synergeticProcess.Done()
|
|
// var updateButtonNotClickable commonus.UpdateButtonNotClickable
|
|
// updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo")
|
|
// updateButtonNotClickable.Atall = 0
|
|
// updateButtonNotClickable.Agentid = msgContent.Agentid
|
|
// updateButtonNotClickable.ResponseCode = msgContent.ResponseCode
|
|
// updateButtonNotClickable.Button.ReplaceName = "已提交更新"
|
|
// callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage()
|
|
// fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
}
|
|
|
|
//发送错误信息
|
|
func sendErrMsg(userKey, orderId, title, cont, DepartmentName, Name, cardJumpUrl, jumpUrl string) {
|
|
desc := ""
|
|
reason := commonus.TimeStampToDate(time.Now().Unix(), 14)
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "信息提示"
|
|
sendTextMsg.SendMsgTextShare(userKey, orderId, title, desc, cont, reason, "提交人", DepartmentName, Name, userKey, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
}
|
|
|
|
/*
|
|
按钮模板回调处理
|
|
@orderId 流程Key
|
|
@clickEnter 1:同意;2:驳回
|
|
*/
|
|
func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnter string) {
|
|
fmt.Printf("Step------Begin------->\n")
|
|
//1、获取点击人信息
|
|
userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
if userContInfoIstrue != true {
|
|
fmt.Printf("Step------1------->\n")
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!1", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
//2、获取审批单信息
|
|
var scoreFlowInfo assessmentmodel.ScoreFlow
|
|
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error
|
|
if judegFlowErr != nil {
|
|
fmt.Printf("Step------2------->%v------>%v\n", orderId, judegFlowErr)
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!2", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
//3、获取审批流程
|
|
var evalProc assessmentmodel.EvaluationProcess
|
|
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProc).Error
|
|
if judgeErr != nil {
|
|
fmt.Printf("Step------3------->\n")
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!3", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
fmt.Printf("Step------3----1--->\n")
|
|
//解析审批流
|
|
var flowLog []evals.FlowStep
|
|
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog)
|
|
setpLen := len(flowLog)
|
|
if jsonFlowErr != nil || setpLen < 1 {
|
|
fmt.Printf("Step------4------->\n")
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!4", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
|
|
//得到当前步进值
|
|
currentSetp := setpLen - 1
|
|
if currentSetp < 0 {
|
|
currentSetp = 0
|
|
}
|
|
fmt.Printf("Step------4---1---->%v\n", flowLog[currentSetp].NextStep)
|
|
//判断通过还是驳回
|
|
if clickEnter == "1" {
|
|
//同意
|
|
//1:创建;2:创建人部门负责人审批:3:责任划分(内勤);4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
|
|
switch flowLog[currentSetp].NextStep {
|
|
case 1:
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64)
|
|
commonus.StepAddData(orderIdInt, 0, 1, 1, 1, 2, 1, strconv.FormatInt(userContInfo.Key, 10))
|
|
//发起人
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
evaluationPlanStr := strconv.FormatInt(scoreFlowInfo.EvaluationPlan, 10)
|
|
var executeReason string = ""
|
|
sendScore := scoreFlowInfo.Score * int64(scoreFlowInfo.Count)
|
|
if scoreFlowInfo.PlusReduceScore == 1 {
|
|
executeReason = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
executeReason = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
SendUpdateCallBackMsg(t.FromUsername, orderId, taskId, evaluationPlanStr, executeReason, "考核部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername)
|
|
flowSaveData := commonus.MapOut()
|
|
flowSaveData["sf_reply"] = 2
|
|
flowSaveData["sf_eite_time"] = time.Now().Unix()
|
|
commonus.EiteScoreFlow(orderIdInt, flowSaveData)
|
|
case 2:
|
|
//发起人部门负责人
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64)
|
|
|
|
//获取发起人部门负责人
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendUserIsTrue == true {
|
|
var otherUser []string
|
|
for _, u_v := range sendUserList {
|
|
if u_v != t.FromUsername {
|
|
otherUser = append(otherUser, u_v)
|
|
}
|
|
}
|
|
if len(otherUser) > 0 {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
|
|
t.UpdateButtonIng(otherUser, buttonClickNAmeOtherEs)
|
|
}
|
|
}
|
|
|
|
if scoreFlowInfo.PlusReduceScore == 1 {
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 2, 2, strconv.FormatInt(userContInfo.Key, 10))
|
|
flowSaveData := commonus.MapOut()
|
|
flowSaveData["sf_reply"] = 3
|
|
flowSaveData["sf_eite_time"] = time.Now().Unix()
|
|
commonus.EiteScoreFlow(orderIdInt, flowSaveData)
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
evalProcSaveData["ep_state"] = 2
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
// var evalProc assessmentmodel.EvaluationProcess
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderId).Updates(&evalProcSaveData)
|
|
|
|
} else {
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, strconv.FormatInt(userContInfo.Key, 10))
|
|
|
|
//向相关部门内勤发送确认责任人信息
|
|
//1、获取责任部门内勤信息
|
|
officWorkUserIsTrue, officWorkUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
if officWorkUserIsTrue != true {
|
|
fmt.Printf("Step------5------->\n")
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
fmt.Printf("Step------6------->\n")
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
|
|
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
|
|
return
|
|
}
|
|
//确定标题
|
|
var title string = ""
|
|
//一级标题副本内容
|
|
var desc string = ""
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则
|
|
if detailedTargetErr == true {
|
|
tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息
|
|
if tarErr == true {
|
|
title = tarInf.Title //一级标题,建议不超过36个字
|
|
desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字
|
|
} else {
|
|
title = detailedTargetCont.Title //一级标题,建议不超过36个字
|
|
}
|
|
} else {
|
|
tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息
|
|
if tarErr == true {
|
|
title = tarInf.Title //一级标题,建议不超过36个字
|
|
} else {
|
|
title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字
|
|
}
|
|
}
|
|
var quoteAreaTitle string = ""
|
|
sendScore := scoreFlowInfo.Score * int64(scoreFlowInfo.Count)
|
|
if scoreFlowInfo.PlusReduceScore == 1 {
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if scoreFlowInfo.PlusReduceScore == 1 {
|
|
// quoteAreaTitle = fmt.Sprintf("加:%v%v\n", scoreFlowInfo.Score, programme.Unit)
|
|
// } else {
|
|
// quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", scoreFlowInfo.Score, programme.Unit)
|
|
// }
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "责任划分"
|
|
// quoteAreaContent := programme
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(officWorkUserList, taskId, title, desc, quoteAreaTitle, scoreFlowInfo.Reason, "考核上报部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
flowSaveData := commonus.MapOut()
|
|
flowSaveData["sf_reply"] = 2
|
|
flowSaveData["sf_eite_time"] = time.Now().Unix()
|
|
commonus.EiteScoreFlow(orderIdInt, flowSaveData)
|
|
}
|
|
|
|
case 3:
|
|
//责任划分(相关部门内勤)
|
|
case 4:
|
|
//责任部门审批(部门负责人)
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
|
|
|
|
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendButtonIsTrue == true {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
|
|
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
|
|
}
|
|
|
|
//是否需要整改
|
|
if scoreFlowInfo.Rectification == 1 {
|
|
//需要整改
|
|
|
|
//获取主要责任人
|
|
var personLiable []string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
|
|
if teamErr == nil {
|
|
for _, tm_v := range teamBility {
|
|
if tm_v["type"] == 1 {
|
|
personLiable = append(personLiable, tm_v["wechatid"].(string))
|
|
}
|
|
}
|
|
}
|
|
if len(personLiable) < 1 {
|
|
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
|
|
}
|
|
sendUserList := strings.Join(personLiable, "|")
|
|
|
|
fmt.Printf("Setp-------6----------->%v----------->%v\n", sendUserList, personLiable)
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
var quoteAreaTitle string = ""
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// quoteAreaTitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
|
|
// } else {
|
|
// quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
|
|
// }
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
quoteAreaContent := flowContent.Reason
|
|
twoLevelTitle := "部门负责人"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "填写整改方案==============>GOTO"
|
|
sourceDesc := "整改通知"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10))
|
|
} else {
|
|
//不需要整改
|
|
|
|
//获取发起人信息
|
|
var sendUser string = ""
|
|
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
|
|
if faQiRen.Wechat != "" {
|
|
sendUser = faQiRen.Wechat
|
|
}
|
|
if faQiRen.WorkWechat != "" {
|
|
sendUser = faQiRen.WorkWechat
|
|
}
|
|
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
var subtitle string = ""
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
subtitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
subtitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
|
|
// } else {
|
|
// subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
|
|
// }
|
|
//获取责任划分
|
|
var reason string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if teamErr == nil {
|
|
for _, team_v := range teamBility {
|
|
if team_v["type"] != 3 {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
|
|
} else {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
|
|
}
|
|
}
|
|
}
|
|
twoLevelTitle := "部门负责人"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
// 按钮
|
|
var buttonMap []sendmessage.ButtonListtype
|
|
var buttonCont sendmessage.ButtonListtype
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "批准"
|
|
buttonCont.Style = 1
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderId, 0)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "驳回"
|
|
buttonCont.Style = 3
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, 0)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
|
|
sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap)
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10))
|
|
}
|
|
case 5:
|
|
//主要责任人整改
|
|
case 6:
|
|
//责任部门审批(部门负责人)
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 6, strconv.FormatInt(userContInfo.Key, 10))
|
|
|
|
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendButtonIsTrue == true {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
|
|
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
|
|
}
|
|
//获取发起人信息
|
|
var sendUser string = ""
|
|
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
|
|
if faQiRen.Wechat != "" {
|
|
sendUser = faQiRen.Wechat
|
|
}
|
|
if faQiRen.WorkWechat != "" {
|
|
sendUser = faQiRen.WorkWechat
|
|
}
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v\n", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
|
|
//获取执行结果
|
|
var mainTitleDesc string
|
|
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
mainTitleDesc = fmt.Sprintf("%v考核加分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
} else {
|
|
mainTitleDesc = fmt.Sprintf("%v考核减分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// } else {
|
|
// mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// }
|
|
var reason string
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) > 4 {
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
|
|
}
|
|
}
|
|
twoLevelTitle := "部门负责人"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
// 按钮
|
|
var buttonMap []sendmessage.ButtonListtype
|
|
var buttonCont sendmessage.ButtonListtype
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "批准"
|
|
buttonCont.Style = 1
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderId, buttonClickAry[3])
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "驳回"
|
|
buttonCont.Style = 3
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, buttonClickAry[3])
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
|
|
//向考核发起人发起验收通知
|
|
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
|
|
sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap)
|
|
|
|
case 7:
|
|
//发起人验收
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
commonus.StepAddData(orderIdInt, 0, 0, 1, 1, 2, 7, strconv.FormatInt(userContInfo.Key, 10))
|
|
fmt.Printf("执行第七步操作--------------->%v\n", userContInfo.Key)
|
|
//1、修改审批流
|
|
scoreFlowMap := commonus.MapOut()
|
|
scoreFlowMap["sf_reply"] = 3
|
|
scoreFlowMap["sf_eite_time"] = time.Now().Unix()
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_id` = ?", scoreFlowInfo.Id).Updates(scoreFlowMap)
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
evalProcSaveData["ep_state"] = 2
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
// var evalProc assessmentmodel.EvaluationProcess
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderId).Updates(&evalProcSaveData)
|
|
|
|
//2、获取要抄送人员名单
|
|
var sendUserAry []string
|
|
//2.1 获取发起人部门负责人
|
|
launchUserIsTrue, launchUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.EvaluationDepartment) //获取发起人部门负责人
|
|
if launchUserIsTrue == true {
|
|
for _, lau_v := range launchUserList {
|
|
sendUserAry = append(sendUserAry, lau_v)
|
|
}
|
|
}
|
|
//2.2、获取职责部门负责人
|
|
dutyUserIsTrue, dutyUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.DutyDepartment) //获取职责部门负责人
|
|
if dutyUserIsTrue == true {
|
|
for _, duty_v := range dutyUserList {
|
|
sendUserAry = append(sendUserAry, duty_v)
|
|
}
|
|
}
|
|
//2.3、获取职责部门内勤
|
|
dutyOffUserIsTrue, dutyOffUserList := commonus.GetSendMsgUserAry(16118387069540343, scoreFlowInfo.DutyDepartment) //获取职责部门内勤
|
|
if dutyOffUserIsTrue == true {
|
|
for _, dutyOff_v := range dutyOffUserList {
|
|
sendUserAry = append(sendUserAry, dutyOff_v)
|
|
}
|
|
}
|
|
|
|
//步骤内容写入
|
|
|
|
sendMsgToUserList := strings.Join(sendUserAry, "|")
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v\n", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
|
|
//获取执行结果
|
|
var mainTitleDesc string
|
|
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
mainTitleDesc = fmt.Sprintf("%v考核加分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
} else {
|
|
mainTitleDesc = fmt.Sprintf("%v考核减分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// } else {
|
|
// mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// }
|
|
var reason string
|
|
commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if flowContent.Rectification == 1 {
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) > 4 {
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
|
|
}
|
|
}
|
|
}
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrlTitle := "查看详情==============>LOOK"
|
|
sourceDesc := "验收通过"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendMsgToUserList, taskId, title, desc, mainTitleDesc, reason, "验收", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
default:
|
|
fmt.Printf("未知操作!\n")
|
|
}
|
|
} else {
|
|
//驳回
|
|
//1:创建;2:创建人部门负责人审批:3:责任划分(内勤);4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
|
|
switch flowLog[currentSetp].NextStep {
|
|
case 1:
|
|
//发起人
|
|
case 2:
|
|
//发起人部门负责人
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 3, 2, strconv.FormatInt(userContInfo.Key, 10))
|
|
|
|
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendButtonIsTrue == true {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
|
|
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
|
|
}
|
|
//1、退回到发起人重新发起审批
|
|
//获取发起人信息
|
|
var sendUser string = ""
|
|
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
|
|
if faQiRen.Wechat != "" {
|
|
sendUser = faQiRen.Wechat
|
|
}
|
|
if faQiRen.WorkWechat != "" {
|
|
sendUser = faQiRen.WorkWechat
|
|
}
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
var quoteAreaTitle string = ""
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// quoteAreaTitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
|
|
// } else {
|
|
// quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
|
|
// }
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
quoteAreaContent := flowContent.Reason
|
|
twoLevelTitle := "部门负责人"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/qualitative?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "填写考核数据==============>GOTO"
|
|
sourceDesc := "驳回"
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendUser, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
case 3:
|
|
//责任划分(相关部门内勤)
|
|
case 4:
|
|
//责任部门审批(部门负责人)
|
|
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendButtonIsTrue == true {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
|
|
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
|
|
}
|
|
//退回到本部门内勤
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 7, 1, 3, 4, strconv.FormatInt(userContInfo.Key, 10))
|
|
//1、获取本部门内勤
|
|
_, butCallBackUser := commonus.GetSendMsgUser(16118387069540343, userContInfo.DepartmentId) //获取对应部门内勤(高科)
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
var subtitle string = ""
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
subtitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
subtitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
|
|
// } else {
|
|
// subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
|
|
// }
|
|
//获取责任划分
|
|
subtitle = fmt.Sprintf("%v责任划分\n", subtitle)
|
|
var reason string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if teamErr == nil {
|
|
for _, team_v := range teamBility {
|
|
if team_v["type"] != 3 {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
|
|
} else {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
|
|
}
|
|
}
|
|
}
|
|
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理============>GOTO"
|
|
sourceDesc := "驳回"
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(butCallBackUser, taskId, title, desc, subtitle, reason, "部门负责人", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
case 5:
|
|
//主要责任人整改
|
|
case 6:
|
|
//责任部门审批(部门负责人)
|
|
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
|
|
if sendButtonIsTrue == true {
|
|
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
|
|
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
|
|
}
|
|
//退回到主要责任人
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 3, 6, strconv.FormatInt(userContInfo.Key, 10))
|
|
//获取主要责任人
|
|
var personLiable []string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
|
|
if teamErr == nil {
|
|
for _, tm_v := range teamBility {
|
|
if tm_v["type"] == 1 {
|
|
personLiable = append(personLiable, tm_v["wechatid"].(string))
|
|
}
|
|
}
|
|
}
|
|
if len(personLiable) < 1 {
|
|
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
|
|
}
|
|
sendUserList := strings.Join(personLiable, "|")
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v\n", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
|
|
//获取执行结果
|
|
var mainTitleDesc string
|
|
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
mainTitleDesc = fmt.Sprintf("%v考核加分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
} else {
|
|
mainTitleDesc = fmt.Sprintf("%v考核减分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// } else {
|
|
// mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// }
|
|
var reason string
|
|
commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if flowContent.Rectification == 1 {
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) > 4 {
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
|
|
}
|
|
}
|
|
}
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
// quoteAreaContent := flowContent.Reason
|
|
twoLevelTitle := "部门负责人"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "重新填写整改方案==============>GOTO"
|
|
sourceDesc := "驳回"
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
case 7:
|
|
//发起人验收
|
|
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
|
|
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
|
|
//是否需要整改
|
|
if scoreFlowInfo.Rectification == 1 {
|
|
//存在整改
|
|
commonus.StepAddData(orderIdInt, 0, 5, 5, 1, 3, 7, strconv.FormatInt(userContInfo.Key, 10))
|
|
//获取主要责任人
|
|
var personLiable []string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
|
|
if teamErr == nil {
|
|
for _, tm_v := range teamBility {
|
|
if tm_v["type"] == 1 {
|
|
personLiable = append(personLiable, tm_v["wechatid"].(string))
|
|
}
|
|
}
|
|
}
|
|
if len(personLiable) < 1 {
|
|
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
|
|
}
|
|
sendUserList := strings.Join(personLiable, "|")
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
|
|
//获取执行结果
|
|
var mainTitleDesc string
|
|
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
mainTitleDesc = fmt.Sprintf("%v考核加分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
} else {
|
|
mainTitleDesc = fmt.Sprintf("%v考核减分:%v\n", mainTitleDesc, float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// } else {
|
|
// mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
|
|
// }
|
|
var reason string
|
|
commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if flowContent.Rectification == 1 {
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) > 4 {
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
|
|
}
|
|
}
|
|
}
|
|
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
// quoteAreaContent := flowContent.Reason
|
|
twoLevelTitle := "验收部门"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderId, registerNumber)
|
|
jumpUrlTitle := "重新填写整改方案==============>GOTO"
|
|
sourceDesc := "驳回"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
} else {
|
|
//不需要整改
|
|
commonus.StepAddData(orderIdInt, 0, 3, 5, 1, 3, 7, strconv.FormatInt(userContInfo.Key, 10))
|
|
//2.3、获取职责部门内勤
|
|
_, dutyOffUserList := commonus.GetSendMsgUserAry(16118387069540343, scoreFlowInfo.DutyDepartment) //获取职责部门内勤
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _, _ := commonus.GetDutyAssociatedItems(orderId)
|
|
fmt.Printf("%v", unit)
|
|
//一级文本处理
|
|
var title, desc string
|
|
if detailedRulesTitle != "" {
|
|
if targettitle != "" {
|
|
title = targettitle
|
|
desc = detailedRulesTitle
|
|
} else {
|
|
title = detailedRulesTitle
|
|
desc = detailedRulesInfo
|
|
}
|
|
} else if targettitle != "" {
|
|
title = targettitle
|
|
}
|
|
var subtitle string = ""
|
|
sendScore := flowContent.Score * int64(flowContent.Count)
|
|
if flowContent.PlusReduceScore == 1 {
|
|
subtitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100)
|
|
} else {
|
|
subtitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100)
|
|
}
|
|
// if flowContent.PlusReduceScore == 1 {
|
|
// subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
|
|
// } else {
|
|
// subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
|
|
// }
|
|
//获取责任划分
|
|
subtitle = fmt.Sprintf("%v责任划分\n", subtitle)
|
|
var reason string
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
|
|
if teamErr == nil {
|
|
for _, team_v := range teamBility {
|
|
if team_v["type"] != 3 {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
|
|
} else {
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
|
|
}
|
|
}
|
|
}
|
|
|
|
//生成唯一编号
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
var registerCont assessmentmodel.Register
|
|
registerCont.Number = registerNumber
|
|
registerCont.State = 1
|
|
registerCont.Time = time.Now().Unix()
|
|
registerCont.AddCont()
|
|
|
|
twoLevelTitle := "验收部门"
|
|
twoLevelKeyName := userContInfo.DepartmentName
|
|
twoLevelKeyValue := userContInfo.Name
|
|
twoLevelUserId := t.FromUsername
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderId, registerNumber)
|
|
jumpUrlTitle := "重新填写整改方案==============>GOTO"
|
|
sourceDesc := "驳回"
|
|
sendUserSet := strings.Join(dutyOffUserList, "|")
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
sendTextMsg.SendMsgTextShare(sendUserSet, taskId, title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
}
|
|
default:
|
|
fmt.Printf("未知操作!\n")
|
|
}
|
|
}
|
|
}
|
|
|
|
//按钮模板回调处理
|
|
func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter string) {
|
|
buttonClickNAme := "已批准"
|
|
buttonClickNAmeOther := "其他人已批准"
|
|
// if clickEnter == "1" {
|
|
// t.UpdateButton(t.FromUsername, buttonClickNAme)
|
|
// } else {
|
|
// buttonClickNAme = "已驳回"
|
|
// buttonClickNAmeOther = "其他人已驳回"
|
|
// t.UpdateButton(t.FromUsername, buttonClickNAme)
|
|
// }UpdateButtonIng
|
|
//获取点击人信息
|
|
userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
//更新同级别其他人按钮
|
|
// _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
|
|
// userCallAry := strings.Split(butCallBackUser, "|")
|
|
// t.OtherClickButton(userCallAry, buttonClickNAme)
|
|
|
|
var scoreFlowInfo assessmentmodel.ScoreFlow
|
|
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", scoreFlowKey).First(&scoreFlowInfo).Error
|
|
fmt.Printf("1@@@@%v\n", scoreFlowInfo)
|
|
if judegFlowErr == nil {
|
|
// _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
|
|
// userCallAry := strings.Split(butCallBackUser, "|")
|
|
// t.OtherClickButton(userCallAry, buttonClickNAme)
|
|
// return
|
|
}
|
|
fmt.Printf("scoreFlowKey ----------------------------------> %v\n", scoreFlowKey)
|
|
//获取审批流程
|
|
// evaluation.FlowStep
|
|
var flowLog []evals.FlowStep
|
|
var evalProc assessmentmodel.EvaluationProcess
|
|
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", scoreFlowKey).First(&evalProc).Error
|
|
if judgeErr != nil {
|
|
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
|
|
userCallAry := strings.Split(butCallBackUser, "|")
|
|
t.OtherClickButton(userCallAry, buttonClickNAme)
|
|
return
|
|
}
|
|
fmt.Printf("scoreFlowKey -----------------%v-----------------> %v\n", scoreFlowKey, evalProc.Content)
|
|
|
|
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog)
|
|
if jsonFlowErr != nil || len(flowLog) < 1 {
|
|
// _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
|
|
// userCallAry := strings.Split(butCallBackUser, "|")
|
|
// t.OtherClickButton(userCallAry, buttonClickNAme)
|
|
// return
|
|
}
|
|
|
|
if userContInfoIstrue == true {
|
|
|
|
if flowLog[len(flowLog)-1].Step == 1 {
|
|
_, butCallBackUser := commonus.GetSendMsgUser(16118387069540343, userContInfo.DepartmentId) //获取对应部门内勤(高科)
|
|
userCallAry := strings.Split(butCallBackUser, "|")
|
|
t.OtherClickButton(userCallAry, buttonClickNAmeOther)
|
|
}
|
|
|
|
if flowLog[len(flowLog)-1].Step == 2 || flowLog[len(flowLog)-1].Step == 4 {
|
|
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
|
|
userCallAry := strings.Split(butCallBackUser, "|")
|
|
t.OtherClickButton(userCallAry, buttonClickNAmeOther)
|
|
}
|
|
}
|
|
|
|
fmt.Printf("3@@@@%v\n", scoreFlowInfo)
|
|
if len(flowLog) < 1 {
|
|
return
|
|
}
|
|
userKeyStr := strconv.FormatInt(userContInfo.Key, 10)
|
|
sendUserList, _ := GetCaoZuoRen(flowLog[len(flowLog)-1].Step, scoreFlowInfo)
|
|
// fmt.Printf("1ssss@@@@%v\n", scoreFlowInfo)
|
|
fmt.Printf("45@@@@%v\n", flowLog[len(flowLog)-1].Step)
|
|
if clickEnter == "1" {
|
|
//1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人
|
|
switch flowLog[len(flowLog)-1].NextStep {
|
|
case 1:
|
|
case 2:
|
|
//是否需要整改
|
|
if scoreFlowInfo.Rectification == 1 {
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
|
|
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, keyNumber, 3, userKeyStr)
|
|
_, sendUserList = commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科)
|
|
userAry := strings.Split(sendUserList, "|")
|
|
var userKeyInt int64 = 0
|
|
if len(userAry) > 0 {
|
|
_, userConts := commonus.GetUesrContForWechatID(userAry[0])
|
|
userKeyInt = userConts.Key
|
|
}
|
|
//获取接收人是谁 第一责任人
|
|
var divisResponInfo assessmentmodel.DivisionResponsibilities
|
|
judegdivisErr := global.GVA_DB_Performanceappraisal.Where("`df_type` = 1 AND `df_sf_id` = ?", scoreFlowKey).First(&divisResponInfo).Error
|
|
if judegdivisErr == nil {
|
|
userKeyInt = divisResponInfo.UserKey
|
|
}
|
|
callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, keyNumber, scoreFlowInfo.PlusReduceScore)
|
|
fmt.Printf("更新销售发送1信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg)
|
|
} else {
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) < 4 {
|
|
return
|
|
}
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, keyNumber, 5, userKeyStr)
|
|
_, sendUserListing := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科)
|
|
userAry := strings.Split(sendUserListing, "|")
|
|
var userKeyInt int64 = 0
|
|
if len(userAry) > 0 {
|
|
_, userConts := commonus.GetUesrContForWechatID(userAry[0])
|
|
userKeyInt = userConts.Key
|
|
}
|
|
|
|
//获取信息接收人
|
|
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.Wechat != "" {
|
|
sendUserList = userConting.Wechat
|
|
}
|
|
if userConting.WorkWechat != "" {
|
|
sendUserList = userConting.WorkWechat
|
|
}
|
|
}
|
|
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
return
|
|
}
|
|
var mainTitle string = ""
|
|
if programme.DetailedTarget != 0 {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
} else {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetTargetInfo(programme.Target)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
}
|
|
|
|
// var recMeasCont assessmentmodel.RectificationMeasures
|
|
// judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
// if judgeRecMeas != nil {
|
|
// // return
|
|
// }
|
|
mainTitleDesc := programme.Content
|
|
subtitle := "整改内容:"
|
|
reason := ""
|
|
// reason := recMeasCont.Content
|
|
//获取当前执行人信息
|
|
commonus.GetUesrContForWechatID(t.ToUsername)
|
|
|
|
// SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKeyInt, keyNumber, scoreFlowInfo.Key, recMeasCont.Id)
|
|
SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKeyInt, keyNumber, scoreFlowInfo.Key, 0)
|
|
}
|
|
case 3:
|
|
case 4:
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) < 4 {
|
|
return
|
|
}
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, keyNumber, 5, userKeyStr)
|
|
_, sendUserListing := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科)
|
|
userAry := strings.Split(sendUserListing, "|")
|
|
var userKeyInt int64 = 0
|
|
if len(userAry) > 0 {
|
|
_, userConts := commonus.GetUesrContForWechatID(userAry[0])
|
|
userKeyInt = userConts.Key
|
|
}
|
|
|
|
//获取信息接收人
|
|
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.Wechat != "" {
|
|
sendUserList = userConting.Wechat
|
|
}
|
|
if userConting.WorkWechat != "" {
|
|
sendUserList = userConting.WorkWechat
|
|
}
|
|
}
|
|
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
return
|
|
}
|
|
var mainTitle string = ""
|
|
if programme.DetailedTarget != 0 {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
} else {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetTargetInfo(programme.Target)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
}
|
|
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas != nil {
|
|
return
|
|
}
|
|
mainTitleDesc := programme.Content
|
|
subtitle := "整改内容:"
|
|
reason := recMeasCont.Content
|
|
//获取当前执行人信息
|
|
commonus.GetUesrContForWechatID(t.ToUsername)
|
|
|
|
// keyNumber := commonus.GetFileNumberEs()
|
|
SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKeyInt, keyNumber, scoreFlowInfo.Key, recMeasCont.Id)
|
|
case 5:
|
|
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 1, userKeyStr)
|
|
flowSaveData := commonus.MapOut()
|
|
flowSaveData["sf_reply"] = 3
|
|
flowSaveData["sf_eite_time"] = time.Now().Unix()
|
|
evals.EiteScoreFlow(scoreFlowInfo.Key, flowSaveData)
|
|
fmt.Printf("=========================>\n")
|
|
//发送消息
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
// return
|
|
}
|
|
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
return
|
|
}
|
|
var mainTitle string = ""
|
|
if programme.DetailedTarget != 0 {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
} else {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetTargetInfo(programme.Target)
|
|
if detailedTargetErr == true {
|
|
mainTitle = detailedTargetCont.Title
|
|
}
|
|
}
|
|
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", scoreFlowInfo.Key).Find(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
// return
|
|
}
|
|
mainTitleDesc := programme.Content
|
|
subtitle := "整改内容:"
|
|
|
|
scoreReason := recMeasCont.Content
|
|
subTitleText := "考核部门"
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
//发送整改通知
|
|
handleUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", scoreFlowInfo.Key)
|
|
callbakcMsg, isTrueCall, callBackCont, sendTextMsg := sendmessage.SendMsgTxtPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, subtitle, handleUrl, scoreReason, subTitleText, scoreFlowInfo.PlusReduceScore, scoreFlowInfo.EvaluationDepartment, scoreFlowInfo.EvaluationUser, scoreFlowInfo.Score, keyNumber, "查看整改详情!")
|
|
fmt.Printf("流程结束:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg)
|
|
default:
|
|
}
|
|
|
|
} else {
|
|
fmt.Printf("close==========3===============>%v\n", flowLog[len(flowLog)-1].Step)
|
|
//1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人
|
|
switch flowLog[len(flowLog)-1].NextStep {
|
|
case 1:
|
|
|
|
case 2:
|
|
fmt.Printf("close==========2===============>\n")
|
|
evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 16118387069540343, 0, 1, userKeyStr)
|
|
//发送消息
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
// return
|
|
}
|
|
taskId := commonus.GetFileNumberEs()
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _, _ := commonus.GetDutyAssociatedItems(scoreFlowKey)
|
|
title := flowContent.Reason
|
|
if title == "" {
|
|
if detailedRulesInfo != "" {
|
|
title = detailedRulesInfo
|
|
} else if detailedRulesTitle != "" {
|
|
title = detailedRulesInfo
|
|
} else {
|
|
title = targettitle
|
|
}
|
|
|
|
}
|
|
var desc string
|
|
if flowContent.PlusReduceScore == 1 {
|
|
desc = fmt.Sprintf("增加:%v%v", flowContent.Score, unitStr)
|
|
} else {
|
|
desc = fmt.Sprintf("扣除:%v%v", flowContent.Score, unitStr)
|
|
}
|
|
quoteAreaTitle := "责任划分"
|
|
var divisionResponsibilities []assessmentmodel.DivisionResponsibilities
|
|
dRBerr := global.GVA_DB_Performanceappraisal.Where("df_sf_id = ?", scoreFlowKey).Find(&divisionResponsibilities).Error
|
|
var quoteAreaContent string
|
|
if dRBerr == nil {
|
|
for _, drb_val := range divisionResponsibilities {
|
|
var zeren string
|
|
switch drb_val.Type {
|
|
case 1:
|
|
zeren = "主要责任人"
|
|
case 2:
|
|
zeren = "互保责任人"
|
|
case 3:
|
|
zeren = "责任班组"
|
|
case 4:
|
|
zeren = "责任班组长"
|
|
case 5:
|
|
zeren = "主管"
|
|
case 6:
|
|
zeren = "三大员"
|
|
case 7:
|
|
zeren = "厂长、主任"
|
|
default:
|
|
zeren = "主要责任人"
|
|
}
|
|
quoteAreaContent = quoteAreaContent + fmt.Sprintf("%v:%v 责任占比:%v\n", zeren, drb_val.UserName, drb_val.Weight)
|
|
}
|
|
}
|
|
roleGroupInfo, roleGroupInfoIstrue := commonus.GetRoleGroup(16182159043990656)
|
|
twoLevelTitle := ""
|
|
if roleGroupInfoIstrue == true {
|
|
twoLevelTitle = roleGroupInfo.Title
|
|
}
|
|
twoLevelKeyName := roleGroupInfo.Title
|
|
twoLevelKeyValue := roleGroupInfo.Title
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
if userWechatErr == true {
|
|
twoLevelKeyName = userWechat.DepartmentName
|
|
twoLevelKeyValue = userWechat.Name
|
|
}
|
|
twoLevelUserId := t.FromUsername
|
|
fmt.Printf("close============3=============>\n")
|
|
// jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey)
|
|
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("4、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
case 3:
|
|
case 4:
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) < 4 {
|
|
fmt.Printf("未知整改措施--》:%v\n", t.EventKey)
|
|
return
|
|
}
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas != nil {
|
|
fmt.Printf("未知整改措施--->:%v\n", t.EventKey)
|
|
return
|
|
}
|
|
taskId := commonus.GetFileNumberEs()
|
|
evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 0, taskId, 3, userKeyStr)
|
|
//获取接收人是谁 第一责任人
|
|
var weChatStr []string
|
|
var divisResponInfo []assessmentmodel.DivisionResponsibilities
|
|
judegdivisErr := global.GVA_DB_Performanceappraisal.Where("`df_type` = 1 AND `df_sf_id` = ?", scoreFlowKey).Find(&divisResponInfo).Error
|
|
if judegdivisErr == nil {
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
for _, dri_v := range divisResponInfo {
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = dri_v.UserKey
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
if userConting.Wechat != "" && userConting.WorkWechat != "" {
|
|
weChatStr = append(weChatStr, userConting.WorkWechat)
|
|
} else if userConting.Wechat != "" && userConting.WorkWechat == "" {
|
|
weChatStr = append(weChatStr, userConting.Wechat)
|
|
} else if userConting.Wechat == "" && userConting.WorkWechat != "" {
|
|
weChatStr = append(weChatStr, userConting.WorkWechat)
|
|
}
|
|
}
|
|
}
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _, _ := commonus.GetDutyAssociatedItems(scoreFlowKey)
|
|
title := flowContent.Reason
|
|
if title == "" {
|
|
if detailedRulesInfo != "" {
|
|
title = detailedRulesInfo
|
|
} else if detailedRulesTitle != "" {
|
|
title = detailedRulesInfo
|
|
} else {
|
|
title = targettitle
|
|
}
|
|
}
|
|
var desc string
|
|
if flowContent.PlusReduceScore == 1 {
|
|
desc = fmt.Sprintf("增加:%v%v", flowContent.Score, unitStr)
|
|
} else {
|
|
desc = fmt.Sprintf("扣除:%v%v", flowContent.Score, unitStr)
|
|
}
|
|
|
|
sendUserList := strings.Join(weChatStr, "|")
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
quoteAreaTitle := "整改方案"
|
|
quoteAreaContent := recMeasCont.Content
|
|
|
|
roleGroupInfo, roleGroupInfoIstrue := commonus.GetRoleGroup(16182159043990656) //部门负责人
|
|
twoLevelTitle := ""
|
|
if roleGroupInfoIstrue == true {
|
|
twoLevelTitle = roleGroupInfo.Title
|
|
}
|
|
twoLevelKeyName := roleGroupInfo.Title
|
|
twoLevelKeyValue := roleGroupInfo.Title
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
if userWechatErr == true {
|
|
twoLevelKeyName = userWechat.DepartmentName
|
|
twoLevelKeyValue = userWechat.Name
|
|
}
|
|
twoLevelUserId := t.FromUsername
|
|
// jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", scoreFlowKey)
|
|
jumpUrlTitle := "请前往处理被驳回的任务"
|
|
sourceDesc := "驳回"
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
fmt.Printf("5、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
|
|
} else {
|
|
fmt.Printf("未找到责任人:%v-----------%v-----\n", judegdivisErr, divisResponInfo)
|
|
}
|
|
case 5:
|
|
taskId := commonus.GetFileNumberEs()
|
|
buttonClickAry := strings.Split(t.EventKey, "_")
|
|
if len(buttonClickAry) < 4 {
|
|
evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 0, taskId, 1, userKeyStr)
|
|
//发送消息
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
// return
|
|
}
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _, _ := commonus.GetDutyAssociatedItems(scoreFlowKey)
|
|
title := flowContent.Reason
|
|
if title == "" {
|
|
if detailedRulesInfo != "" {
|
|
title = detailedRulesInfo
|
|
} else if detailedRulesTitle != "" {
|
|
title = detailedRulesInfo
|
|
} else {
|
|
title = targettitle
|
|
}
|
|
|
|
}
|
|
var desc string
|
|
if flowContent.PlusReduceScore == 1 {
|
|
desc = fmt.Sprintf("增加:%v%v", flowContent.Score, unitStr)
|
|
} else {
|
|
desc = fmt.Sprintf("扣除:%v%v", flowContent.Score, unitStr)
|
|
}
|
|
quoteAreaTitle := "责任划分"
|
|
var divisionResponsibilities []assessmentmodel.DivisionResponsibilities
|
|
dRBerr := global.GVA_DB_Performanceappraisal.Where("df_sf_id = ?", scoreFlowKey).Find(&divisionResponsibilities).Error
|
|
var quoteAreaContent string
|
|
if dRBerr == nil {
|
|
for _, drb_val := range divisionResponsibilities {
|
|
var zeren string
|
|
switch drb_val.Type {
|
|
case 1:
|
|
zeren = "主要责任人"
|
|
case 2:
|
|
zeren = "互保责任人"
|
|
case 3:
|
|
zeren = "责任班组"
|
|
case 4:
|
|
zeren = "责任班组长"
|
|
case 5:
|
|
zeren = "主管"
|
|
case 6:
|
|
zeren = "三大员"
|
|
case 7:
|
|
zeren = "厂长、主任"
|
|
default:
|
|
zeren = "主要责任人"
|
|
}
|
|
quoteAreaContent = quoteAreaContent + fmt.Sprintf("%v:%v 责任占比:%v\n", zeren, drb_val.UserName, drb_val.Weight)
|
|
}
|
|
}
|
|
|
|
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://www.hxgk.group?orderid=%v", scoreFlowKey)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey)
|
|
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("6、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
} else {
|
|
if buttonClickAry[3] == "0" {
|
|
evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 0, taskId, 1, userKeyStr)
|
|
//发送消息
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
// return
|
|
}
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _, _ := commonus.GetDutyAssociatedItems(scoreFlowKey)
|
|
title := flowContent.Reason
|
|
if title == "" {
|
|
if detailedRulesInfo != "" {
|
|
title = detailedRulesInfo
|
|
} else if detailedRulesTitle != "" {
|
|
title = detailedRulesInfo
|
|
} else {
|
|
title = targettitle
|
|
}
|
|
|
|
}
|
|
var desc string
|
|
if flowContent.PlusReduceScore == 1 {
|
|
desc = fmt.Sprintf("增加:%v%v", flowContent.Score, unitStr)
|
|
} else {
|
|
desc = fmt.Sprintf("扣除:%v%v", flowContent.Score, unitStr)
|
|
}
|
|
quoteAreaTitle := "责任划分"
|
|
var divisionResponsibilities []assessmentmodel.DivisionResponsibilities
|
|
dRBerr := global.GVA_DB_Performanceappraisal.Where("df_sf_id = ?", scoreFlowKey).Find(&divisionResponsibilities).Error
|
|
var quoteAreaContent string
|
|
if dRBerr == nil {
|
|
for _, drb_val := range divisionResponsibilities {
|
|
var zeren string
|
|
switch drb_val.Type {
|
|
case 1:
|
|
zeren = "主要责任人"
|
|
case 2:
|
|
zeren = "互保责任人"
|
|
case 3:
|
|
zeren = "责任班组"
|
|
case 4:
|
|
zeren = "责任班组长"
|
|
case 5:
|
|
zeren = "主管"
|
|
case 6:
|
|
zeren = "三大员"
|
|
case 7:
|
|
zeren = "厂长、主任"
|
|
default:
|
|
zeren = "主要责任人"
|
|
}
|
|
quoteAreaContent = quoteAreaContent + fmt.Sprintf("%v:%v 责任占比:%v\n", zeren, drb_val.UserName, drb_val.Weight)
|
|
}
|
|
}
|
|
|
|
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://www.hxgk.group?orderid=%v", scoreFlowKey)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey)
|
|
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("7、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
} else {
|
|
var recMeasCont assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
|
|
if judgeRecMeas != nil {
|
|
fmt.Printf("未知整改措施--->:%v\n", t.EventKey)
|
|
return
|
|
}
|
|
evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 0, taskId, 3, userKeyStr)
|
|
//获取接收人是谁 第一责任人
|
|
var weChatStr []string
|
|
var divisResponInfo []assessmentmodel.DivisionResponsibilities
|
|
judegdivisErr := global.GVA_DB_Performanceappraisal.Where("`df_type` = 1 AND `df_sf_id` = ?", scoreFlowKey).Find(&divisResponInfo).Error
|
|
if judegdivisErr == nil {
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
for _, dri_v := range divisResponInfo {
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = dri_v.UserKey
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
if userConting.Wechat != "" && userConting.WorkWechat != "" {
|
|
weChatStr = append(weChatStr, userConting.WorkWechat)
|
|
} else if userConting.Wechat != "" && userConting.WorkWechat == "" {
|
|
weChatStr = append(weChatStr, userConting.Wechat)
|
|
} else if userConting.Wechat == "" && userConting.WorkWechat != "" {
|
|
weChatStr = append(weChatStr, userConting.WorkWechat)
|
|
}
|
|
}
|
|
}
|
|
targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _, _ := commonus.GetDutyAssociatedItems(scoreFlowKey)
|
|
title := flowContent.Reason
|
|
if title == "" {
|
|
if detailedRulesInfo != "" {
|
|
title = detailedRulesInfo
|
|
} else if detailedRulesTitle != "" {
|
|
title = detailedRulesInfo
|
|
} else {
|
|
title = targettitle
|
|
}
|
|
}
|
|
var desc string
|
|
if flowContent.PlusReduceScore == 1 {
|
|
desc = fmt.Sprintf("增加:%v%v", flowContent.Score, unitStr)
|
|
} else {
|
|
desc = fmt.Sprintf("扣除:%v%v", flowContent.Score, unitStr)
|
|
}
|
|
|
|
sendUserList := strings.Join(weChatStr, "|")
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
quoteAreaTitle := "整改方案"
|
|
quoteAreaContent := recMeasCont.Content
|
|
|
|
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://www.hxgk.group?orderid=%v", scoreFlowKey)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", scoreFlowKey)
|
|
jumpUrlTitle := "请前往处理被驳回的任务"
|
|
sourceDesc := "驳回"
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
fmt.Printf("8、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
|
|
|
|
} else {
|
|
fmt.Printf("未找到责任人:%v-----------%v-----\n", judegdivisErr, divisResponInfo)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// performSteps := 1
|
|
// fmt.Printf("3@@@@%v\n", flowLog[len(flowLog)-1].Step)
|
|
|
|
fmt.Printf("2@@@@%v--->%v\n", sendUserList, scoreFlowInfo.DutyDepartment)
|
|
|
|
// userAry := strings.Split(sendUserList, "|")
|
|
// for _, v := range userAry {
|
|
// if v != t.FromUsername {
|
|
// userInfoErr, userInfo := commonus.GetUesrContForWechatID(v)
|
|
// if userInfoErr == true {
|
|
// buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userInfo.Name, buttonClickNAmeOther)
|
|
// t.UpdateButton(v, buttonClickNAmeOtherEs)
|
|
// } else {
|
|
// t.UpdateButton(v, buttonClickNAmeOther)
|
|
// }
|
|
|
|
// }
|
|
// fmt.Printf("click---------------------->%v--->%v\n", sendUserList, scoreFlowInfo.DutyDepartment)
|
|
// }
|
|
}
|
|
|
|
//其他按钮处理
|
|
func (t *TemplateCardPush) OtherClickButton(userAry []string, buttonClickNAmeOther string) {
|
|
userInfoErr, userInfo := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
fmt.Printf("OtherClick------------->%v------------>%v\n", userAry, userInfo)
|
|
var userAryList []string
|
|
if len(userAry) > 0 {
|
|
for _, v := range userAry {
|
|
if v != t.FromUsername {
|
|
// if userInfoErr == true {
|
|
// // buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userInfo.Name, buttonClickNAmeOther)
|
|
// userAryList = append(userAryList, v)
|
|
// // t.UpdateButton(v, buttonClickNAmeOtherEs)
|
|
// } else {
|
|
// // t.UpdateButton(v, buttonClickNAmeOther)
|
|
// }
|
|
userAryList = append(userAryList, v)
|
|
}
|
|
}
|
|
buttonClickNAmeOtherEs := buttonClickNAmeOther
|
|
if userInfoErr == true {
|
|
buttonClickNAmeOtherEs = fmt.Sprintf("%v%v", userInfo.Name, buttonClickNAmeOther)
|
|
}
|
|
// userAryListStr := strings.Join(userAryList, "|")
|
|
t.UpdateButtonIng(userAryList, buttonClickNAmeOtherEs)
|
|
}
|
|
}
|
|
|
|
//更新按钮
|
|
func (t *TemplateCardPush) UpdateButton(userOpenId, buttonName string) {
|
|
var updateButtonNotClickable commonus.UpdateButtonNotClickable
|
|
updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, userOpenId)
|
|
updateButtonNotClickable.Atall = 0
|
|
updateButtonNotClickable.Agentid = t.Agentid
|
|
updateButtonNotClickable.ResponseCode = t.ResponseCode
|
|
updateButtonNotClickable.Button.ReplaceName = buttonName
|
|
callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage()
|
|
fmt.Printf("9、手动更新发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, updateButtonNotClickable)
|
|
}
|
|
|
|
func (t *TemplateCardPush) UpdateButtonIng(userOpenId []string, buttonName string) {
|
|
var updateButtonNotClickable commonus.UpdateButtonNotClickable
|
|
// updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, userOpenId)
|
|
updateButtonNotClickable.Userids = userOpenId
|
|
updateButtonNotClickable.Atall = 0
|
|
updateButtonNotClickable.Agentid = t.Agentid
|
|
updateButtonNotClickable.ResponseCode = t.ResponseCode
|
|
updateButtonNotClickable.Button.ReplaceName = buttonName
|
|
callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage()
|
|
fmt.Printf("10、更新发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, updateButtonNotClickable)
|
|
}
|
|
|
|
//获取操作人
|
|
func GetCaoZuoRen(stepVal int, s assessmentmodel.ScoreFlow) (sendUserList string, stepDepart int64) {
|
|
//1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人
|
|
|
|
switch stepVal {
|
|
case 1:
|
|
stepDepart = 16118387069540343
|
|
_, sendUserList = commonus.GetSendMsgUser(16118387069540343, s.DutyDepartment) //获取对应部门负责人(高科)
|
|
case 2:
|
|
stepDepart = 16182159043990656
|
|
//给相关部门内勤发送消息。确定相关责任人
|
|
_, sendUserList = commonus.GetSendMsgUser(16182159043990656, s.DutyDepartment) //获取对应部门负责人(高科)
|
|
case 3:
|
|
case 4:
|
|
stepDepart = 16182159043990656
|
|
//给相关部门内勤发送消息。确定相关责任人
|
|
_, sendUserList = commonus.GetSendMsgUser(16182159043990656, s.DutyDepartment) //获取对应部门负责人(高科)
|
|
case 5:
|
|
//获取操作人
|
|
userFileStr := "wm_number,qywx_key,wx_key"
|
|
//操作人条件
|
|
userWherAry := commonus.MapOut()
|
|
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|
userWherAry["wm_key"] = s.EvaluationUser
|
|
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
|
|
if userIsTrue == true {
|
|
if userConting.Wechat != "" {
|
|
sendUserList = userConting.Wechat
|
|
}
|
|
if userConting.WorkWechat != "" {
|
|
sendUserList = userConting.WorkWechat
|
|
}
|
|
}
|
|
|
|
default:
|
|
}
|
|
return
|
|
}
|
|
|
|
//发出整改通知
|
|
/*
|
|
@floeKey 方案KEY
|
|
@sendUserList 接收用户
|
|
@planIdInt 考核方案项目ID
|
|
@reason 原因
|
|
@typeSet 1:加分;2:减分
|
|
@departmentId 执行考核部门
|
|
@userKey 执行考核人
|
|
@Score 考核分值
|
|
*/
|
|
func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentId, userKey, Score, keyNumber int64, typeSet int) (callbakcMsg []byte, isTrueCall bool, callBackCont string, sendTextMsg sendmessage.TextNoticeTemplateMedium) {
|
|
var mainTitle string = ""
|
|
var mainTitleDesc string = ""
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planIdInt).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
return
|
|
}
|
|
|
|
if programme.Type == 1 {
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
|
|
if detailedTargetErr == true {
|
|
if detailedTargetCont.Title != "" {
|
|
mainTitle = detailedTargetCont.Title
|
|
} else {
|
|
mainTitle = reason
|
|
}
|
|
if programme.Content == "" {
|
|
mainTitleDesc = detailedTargetCont.Content
|
|
} else {
|
|
mainTitleDesc = programme.Content
|
|
}
|
|
} else {
|
|
mainTitle = strconv.FormatInt(programme.DetailedTarget, 10)
|
|
mainTitleDesc = programme.Content
|
|
}
|
|
} else {
|
|
targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
|
|
if targetErr == true {
|
|
mainTitle = targetCont.Title
|
|
mainTitleDesc = programme.Content
|
|
} else {
|
|
mainTitleDesc = programme.Content
|
|
}
|
|
}
|
|
scoreReason := ""
|
|
subTitleText := "部门"
|
|
// keyNumber := commonus.GetFileNumberEs()
|
|
//发送整改通知
|
|
handleUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", floeKey)
|
|
callbakcMsg, isTrueCall, callBackCont, sendTextMsg = sendmessage.SendMsgTxtPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, reason, handleUrl, scoreReason, subTitleText, typeSet, departmentId, userKey, Score, keyNumber, "请上报整改结果!")
|
|
return
|
|
}
|
|
|
|
/*
|
|
发送文本任务卡
|
|
@sendUserList 接收信息人员
|
|
@mainTitle 一级标题,建议不超过36个字
|
|
@Desc 标题辅助信息,建议不超过44个字
|
|
@Unit 考核计量单位
|
|
@Reason 二级文本标题
|
|
@handleUrl 访问Key
|
|
@Type 1:加分;2:减分
|
|
@departmentId 执行考核部门
|
|
@userKey 执行考核人
|
|
@Score 考核分值
|
|
@keyNumber 任务卡ID
|
|
@scoreReason 二级文本描述
|
|
@subTitleText 下级 组件标题"考核上报部门:"
|
|
@formId 表单ID
|
|
*/
|
|
func SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason string, departmentId, userKey, keyNumber, orderId, formId int64) (callbakcMsg []byte, isTrueCall bool, callBackCont string) {
|
|
if subtitle == "" {
|
|
subtitle = "整改内容"
|
|
}
|
|
var buttonMap []sendmessage.ButtonListtype
|
|
var buttonCont sendmessage.ButtonListtype
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "批准"
|
|
buttonCont.Style = 1
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderId, formId)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "驳回"
|
|
buttonCont.Style = 3
|
|
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, formId)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
callbakcMsg, isTrueCall, callBackCont, _ = sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, orderId, buttonMap)
|
|
return
|
|
}
|
|
|