From 8dc0dd1921b8fbdf38757624d71256fd51de09f5 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Sun, 27 Feb 2022 09:33:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=80=A7=E8=80=83=E6=A0=B8=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E5=AE=A1=E6=89=B9=E6=B5=81=E7=A8=8B=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/index/evaluation/evaluation.go | 2 +- .../api/index/evaluation/sendwechatmsg.go | 26 +- .../api/wechatapp/callback/apphandle.go | 2 +- .../api/wechatapp/callback/updatehandle.go | 623 ++++++++++++++++-- .../api/wechatapp/sendmessage/apphandle.go | 80 +++ .../wechatapp/sendmessage/sendmsgHandle.go | 60 ++ .../api/wechatapp/sendmessage/type.go | 14 + gin_server_admin/commonus/publichaneld.go | 74 +++ .../assessmentmodel/performance_appraisal.go | 4 + 9 files changed, 835 insertions(+), 50 deletions(-) diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 9cbf1bb..45388ed 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -420,7 +420,7 @@ func (e *EvaluationInterface) AddDivisionResponsibility(c *gin.Context) { flowSaveData := commonus.MapOut() flowSaveData["sf_reply"] = 2 flowSaveData["sf_eite_time"] = time.Now().Unix() - eiteScoreFlow(orderId, flowSaveData) + EiteScoreFlow(orderId, flowSaveData) // return keyNumber := commonus.GetFileNumberEs() var evalProCont assessmentmodel.EvaluationProcess diff --git a/gin_server_admin/api/index/evaluation/sendwechatmsg.go b/gin_server_admin/api/index/evaluation/sendwechatmsg.go index e0006c4..94b0645 100644 --- a/gin_server_admin/api/index/evaluation/sendwechatmsg.go +++ b/gin_server_admin/api/index/evaluation/sendwechatmsg.go @@ -22,7 +22,7 @@ func EiteDutiesInfoes(saveId int64, saveData map[string]interface{}) (isTrue boo } //编辑分数流水 -func eiteScoreFlow(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { +func EiteScoreFlow(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { isTrue = false infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", saveId).Updates(saveData).Error if infoErr != nil { @@ -33,7 +33,13 @@ func eiteScoreFlow(saveId int64, saveData map[string]interface{}) (isTrue bool, } //更新审批流程(驳回) -func UpEvaluationProcessReject(orderKey int64) (evalProc assessmentmodel.EvaluationProcess, isTrue bool) { +/* +@orderKey 流程ID +@roleGroup 角色组Id +@keyNumber 卡片TaskID +@nextStep 下一步 +*/ +func UpEvaluationProcessReject(orderKey, roleGroup, keyNumber int64, nextStep int) (evalProc assessmentmodel.EvaluationProcess, isTrue bool) { isTrue = false judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderKey).First(&evalProc).Error if judgeErr != nil { @@ -53,14 +59,14 @@ func UpEvaluationProcessReject(orderKey int64) (evalProc assessmentmodel.Evaluat rejectFlow.Step = 1 rejectFlow.Key = strconv.FormatInt(orderKey, 10) rejectFlow.State = 1 - rejectFlow.RoleGroup = 16118387069540343 + rejectFlow.RoleGroup = roleGroup rejectFlow.NextStep = 2 flowLog = append(flowLog, rejectFlow) evalProc.OrderKey = orderKey evalProc.Step = 1 evalProc.State = 1 - evalProc.RoleGroup = 16118387069540343 + evalProc.RoleGroup = roleGroup evalProc.Time = time.Now().Unix() flowStepJson, flowStepErr := json.Marshal(flowLog) if flowStepErr == nil { @@ -82,17 +88,15 @@ func UpEvaluationProcessReject(orderKey int64) (evalProc assessmentmodel.Evaluat flowStep.Step = evalProc.Step + 1 flowStep.Key = strconv.FormatInt(orderKey, 10) flowStep.State = 1 - roleGroupSteps := roleGroupStep - 1 - if roleGroupSteps < 0 { - roleGroupSteps = 0 - } - flowStep.RoleGroup = flowLog[roleGroupSteps].RoleGroup - flowStep.NextStep = flowLog[roleGroupStep].NextStep - 1 + + flowStep.RoleGroup = roleGroup + flowStep.NextStep = nextStep flowStepArys = append(flowStepArys, flowStep) saveData := commonus.MapOut() saveData["ep_time"] = time.Now().Unix() - saveData["ep_role_group"] = flowLog[roleGroupSteps].RoleGroup + saveData["ep_role_group"] = roleGroup + saveData["ep_step"] = evalProc.Step + 1 flowStepJson, flowStepErr := json.Marshal(flowStepArys) if flowStepErr == nil { saveData["ep_cont"] = string(flowStepJson) diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index 2556aa6..141494a 100644 --- a/gin_server_admin/api/wechatapp/callback/apphandle.go +++ b/gin_server_admin/api/wechatapp/callback/apphandle.go @@ -148,7 +148,7 @@ func (c *CallBackData) DecryptMessage() { } callbackLog.AddTime = time.Now().Unix() if msgContent.Event != "LOCATION" { - // global.GVA_DB_WechatCallBack.Create(&callbackLog) + global.GVA_DB_WechatCallBack.Create(&callbackLog) } } diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index caff78c..16f83d9 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -6,8 +6,10 @@ import ( "fmt" "strconv" "strings" + "time" - "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" + // 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" @@ -53,41 +55,79 @@ func templateEventPush(eventMsg []byte) { //按钮模板回调处理 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) + } + //获取点击人信息 + userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername) 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) //获取审批流程 - var flowLog []evaluation.FlowStep + // 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 } sendUserList, _ := GetCaoZuoRen(flowLog[len(flowLog)-1].Step, scoreFlowInfo) // fmt.Printf("1ssss@@@@%v\n", scoreFlowInfo) - buttonClickNAme := "已批准" - buttonClickNAmeOther := "其他人已批准" fmt.Printf("45@@@@%v\n", flowLog[len(flowLog)-1].Step) if clickEnter == "1" { //1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人 - switch flowLog[len(flowLog)-1].Step { + switch flowLog[len(flowLog)-1].NextStep { case 1: case 2: //是否需要整改 - if scoreFlowInfo.Rectification != 1 { - evaluation.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, scoreFlowInfo.Key, 3) + if scoreFlowInfo.Rectification == 1 { + keyNumber := commonus.GetFileNumberEs() + evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, keyNumber, 3) _, sendUserList = commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科) userAry := strings.Split(sendUserList, "|") var userKeyInt int64 = 0 @@ -101,16 +141,15 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter if judegdivisErr == nil { userKeyInt = divisResponInfo.UserKey } - SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, scoreFlowInfo.PlusReduceScore) - // callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, scoreFlowInfo.PlusReduceScore) - // fmt.Printf("更新销售:%v-----------%v-----------%v-----------%v\n", scoreFlowInfo.DutyDepartment, userKeyInt, sendUserList, userAry[0]) - // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg) + callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, keyNumber, scoreFlowInfo.PlusReduceScore) + fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg) } else { buttonClickAry := strings.Split(t.EventKey, "_") if len(buttonClickAry) < 4 { return } - evaluation.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, scoreFlowInfo.Key, 5) + keyNumber := commonus.GetFileNumberEs() + evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, keyNumber, 5) _, sendUserListing := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科) userAry := strings.Split(sendUserListing, "|") var userKeyInt int64 = 0 @@ -154,32 +193,518 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter } } - var recMeasCont assessmentmodel.RectificationMeasures - judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error - if judgeRecMeas != nil { - return - } + // 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 + reason := "" + // reason := recMeasCont.Content //获取当前执行人信息 commonus.GetUesrContForWechatID(t.ToUsername) - keyNumber := commonus.GetFileNumberEs() - 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, 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) + _, 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.WechatId != "" { + sendUserList = userConting.WechatId + } + if userConting.WorkWechatId != "" { + sendUserList = userConting.WorkWechatId + } + } + + 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) + 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://www.hxgk.group?orderid=%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 { - buttonClickNAme = "已驳回" - buttonClickNAmeOther = "其他人已驳回" - scoreFlowKeyId, scoreFlowKeyErr := strconv.ParseInt(scoreFlowKey, 10, 64) - if scoreFlowKeyErr == nil { - evaluation.UpEvaluationProcessReject(scoreFlowKeyId) + 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) + //发送消息 + 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) + 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) + 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) + //获取接收人是谁 第一责任人 + 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.WechatId != "" && userConting.WorkWechatId != "" { + weChatStr = append(weChatStr, userConting.WorkWechatId) + } else if userConting.WechatId != "" && userConting.WorkWechatId == "" { + weChatStr = append(weChatStr, userConting.WechatId) + } else if userConting.WechatId == "" && userConting.WorkWechatId != "" { + weChatStr = append(weChatStr, userConting.WorkWechatId) + } + } + } + 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) + 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("更新发送信息返回:%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) + //发送消息 + 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) + 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 { + if buttonClickAry[3] == "0" { + evals.UpEvaluationProcessReject(scoreFlowInfo.Key, 0, taskId, 1) + //发送消息 + 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) + 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 { + 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) + //获取接收人是谁 第一责任人 + 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.WechatId != "" && userConting.WorkWechatId != "" { + weChatStr = append(weChatStr, userConting.WorkWechatId) + } else if userConting.WechatId != "" && userConting.WorkWechatId == "" { + weChatStr = append(weChatStr, userConting.WechatId) + } else if userConting.WechatId == "" && userConting.WorkWechatId != "" { + weChatStr = append(weChatStr, userConting.WorkWechatId) + } + } + } + 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) + 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("更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) + + } else { + fmt.Printf("未找到责任人:%v-----------%v-----\n", judegdivisErr, divisResponInfo) + } + } + } } } @@ -187,14 +712,38 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter // performSteps := 1 // fmt.Printf("3@@@@%v\n", flowLog[len(flowLog)-1].Step) - // fmt.Printf("2@@@@%v--->%v\n", sendUserList, scoreFlowInfo.DutyDepartment) + fmt.Printf("2@@@@%v--->%v\n", sendUserList, scoreFlowInfo.DutyDepartment) - userAry := strings.Split(sendUserList, "|") - for _, v := range userAry { - if v == t.FromUsername { - t.UpdateButton(v, buttonClickNAme) - } else { - t.UpdateButton(v, buttonClickNAmeOther) + // 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) + if len(userAry) > 0 { + for _, v := range userAry { + if v != t.FromUsername { + if userInfoErr == true { + buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userInfo.Name, buttonClickNAmeOther) + t.UpdateButton(v, buttonClickNAmeOtherEs) + } else { + t.UpdateButton(v, buttonClickNAmeOther) + } + + } } } } @@ -207,8 +756,8 @@ func (t *TemplateCardPush) UpdateButton(userOpenId, buttonName string) { updateButtonNotClickable.Agentid = t.Agentid updateButtonNotClickable.ResponseCode = t.ResponseCode updateButtonNotClickable.Button.ReplaceName = buttonName - // callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage() - // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, updateButtonNotClickable) + callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage() + fmt.Printf("更新发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, updateButtonNotClickable) } //获取操作人 @@ -261,7 +810,7 @@ func GetCaoZuoRen(stepVal int, s assessmentmodel.ScoreFlow) (sendUserList string @userKey 执行考核人 @Score 考核分值 */ -func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentId, userKey, Score int64, typeSet int) (callbakcMsg []byte, isTrueCall bool, callBackCont string, sendTextMsg sendmessage.TextNoticeTemplateMedium) { +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 @@ -298,7 +847,7 @@ func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentI } scoreReason := "" subTitleText := "部门" - keyNumber := commonus.GetFileNumberEs() + // keyNumber := commonus.GetFileNumberEs() //发送整改通知 handleUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", floeKey) callbakcMsg, isTrueCall, callBackCont, sendTextMsg = sendmessage.SendMsgTxtPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, reason, handleUrl, scoreReason, subTitleText, typeSet, departmentId, userKey, Score, keyNumber, "请上报整改结果!") diff --git a/gin_server_admin/api/wechatapp/sendmessage/apphandle.go b/gin_server_admin/api/wechatapp/sendmessage/apphandle.go index 9a3f53e..9049eeb 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/apphandle.go +++ b/gin_server_admin/api/wechatapp/sendmessage/apphandle.go @@ -255,3 +255,83 @@ func (s *OpenApprovalState) SendMessage(appName string) ([]byte, bool, string) { // fmt.Printf("%v-------------->%v----%v\n", string(sendJsonData), string(addDePartMent), sendUrl) return addDePartMent, true, msg } + +//图文展示型 +func (s *TextNoticeTemplateSimplifyes) SendMessage(appName string) ([]byte, bool, string) { + sendUrl, IsTrue, msg := sharemethod.GetSendMsgTokenUrl(appName) + if IsTrue == false { + return nil, false, msg + } + sendJsonData, _ := json.Marshal(s) + addDePartMent := commonus.CurlPostJosn(sendUrl, sendJsonData) + // fmt.Printf("%v-------------->%v\n", string(sendJsonData), string(addDePartMent)) + return addDePartMent, true, msg +} + +//发送文本信息初始化 +func (s *TextNoticeTemplateMedium) InsetCont(userList, msgType, CardType, taskId string) { + s.Touser = userList + if CardType != "" { + s.MsgType = msgType + } else { + s.MsgType = "template_card" + } + appId, _ := strconv.ParseInt(global.GVA_CONFIG.WorkWechatSchool.AgentId, 10, 64) + s.AgentId = appId + s.EnableIdTrans = 0 + s.EnableDuplicateCheck = 0 + s.DuplicateCheckInterval = 1800 + + // s.TemplateCard.CardType = "text_notice" + if CardType != "" { + s.TemplateCard.CardType = CardType + } else { + s.TemplateCard.CardType = "text_notice" + } + //卡片来源样式信息,不需要来源样式可不填写(非必填) + s.TemplateCard.Source.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png" + s.TemplateCard.Source.Desc = "知行学院" + s.TemplateCard.Source.DescColor = 2 + + if taskId == "" { + taskIdInt := commonus.GetFileNumberEs() + s.TemplateCard.TaskId = strconv.FormatInt(taskIdInt, 10) + } else { + s.TemplateCard.TaskId = taskId + } + +} + +//发送文本信息初始化新版本 +func (s *TextNoticeTemplateMedium) InsetContNew(userList, msgType, CardType, taskId, sourceDesc string) { + s.Touser = userList + if CardType != "" { + s.MsgType = msgType + } else { + s.MsgType = "template_card" + } + appId, _ := strconv.ParseInt(global.GVA_CONFIG.WorkWechatSchool.AgentId, 10, 64) + s.AgentId = appId + s.EnableIdTrans = 0 + s.EnableDuplicateCheck = 0 + s.DuplicateCheckInterval = 1800 + + // s.TemplateCard.CardType = "text_notice" + if CardType != "" { + s.TemplateCard.CardType = CardType + } else { + s.TemplateCard.CardType = "text_notice" + } + //卡片来源样式信息,不需要来源样式可不填写(非必填) + s.TemplateCard.Source.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png" + s.TemplateCard.Source.Desc = sourceDesc + s.TemplateCard.Source.DescColor = 2 + + if taskId == "" { + taskIdInt := commonus.GetFileNumberEs() + s.TemplateCard.TaskId = strconv.FormatInt(taskIdInt, 10) + } else { + s.TemplateCard.TaskId = taskId + } + +} diff --git a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go index 8b2c156..f7b4d95 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go +++ b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go @@ -1,6 +1,7 @@ package sendmessage import ( + "fmt" "strconv" "github.com/flipped-aurora/gin-vue-admin/server/commonus" @@ -267,3 +268,62 @@ func SendMsgTxtPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl, scoreR callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school") return } + +//发送文本信息News +/* +@sendUserList 信息接收人 +@taskId 任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成,最长128字节,填了action_menu字段的话本字段必填 +@Title 一级标题,建议不超过36个字, +@Desc 标题辅助信息,建议不超过44个字 +@quoteAreaTitle 引用文献标题 +@quoteAreaContent 引用文献内容 +@twoLevelTitle 二级文本标题 +@twoLevelKeyName 二级标题,建议不超过5个字 +@twoLevelValue 二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字, +@twoLevelUserId 成员详情的userid,horizontal_content_list.type是3时必填 +@jumpUrl 整体卡片跳转链接 +@jumpUrlTitle 跳转链接文案 +@sourceDesc 左上角标题 +*/ +func (t *TextNoticeTemplateMedium) SendNewsMsgText(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) { + + if sourceDesc != "" { + sourceDesc = fmt.Sprintf("知行学院 - %v", sourceDesc) + } else { + sourceDesc = "知行学院" + } + + t.InsetContNew(sendUserList, "template_card", "text_notice", taskId, sourceDesc) + //获取考核详情 + t.TemplateCard.MainTitle.Title = title + t.TemplateCard.MainTitle.Desc = desc + + //引用文献样式 + t.TemplateCard.QuoteArea.Type = 0 + t.TemplateCard.QuoteArea.Title = quoteAreaTitle + t.TemplateCard.QuoteArea.QuoteText = quoteAreaContent + + var htalConListStrMap []HorizontalContentListType + var htalConListStrCon HorizontalContentListType + //二级普通文本, + t.TemplateCard.SubTitleText = twoLevelTitle + // 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6 + htalConListStrCon.Type = 3 //链接类型,0或不填代表不是链接,1 代表跳转url,2 代表下载附件,3 代表点击跳转成员详情 + htalConListStrCon.KeyName = twoLevelKeyName //二级标题,建议不超过5个字 + htalConListStrCon.Value = twoLevelKeyValue //二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,( + htalConListStrCon.UserId = twoLevelUserId //成员详情的userid,horizontal_content_list.type是3时必填 + htalConListStrMap = append(htalConListStrMap, htalConListStrCon) + t.TemplateCard.HorizontalContentList = htalConListStrMap + //整体卡片的点击跳转事件 + t.TemplateCard.CardAction.Type = 1 + t.TemplateCard.CardAction.Url = jumpUrl + //地板处理 + var jumpListStruct JumpListType + jumpListStruct.Type = 1 + jumpListStruct.Title = jumpUrlTitle //跳转链接样式的文案内容,建议不超过18个字 + jumpListStruct.Url = jumpUrl + t.TemplateCard.JumpList = append(t.TemplateCard.JumpList, jumpListStruct) + + callbakcMsg, isTrueCall, callBackCont = t.SendMessage("school") + return +} diff --git a/gin_server_admin/api/wechatapp/sendmessage/type.go b/gin_server_admin/api/wechatapp/sendmessage/type.go index 5cedb6f..832770b 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/type.go +++ b/gin_server_admin/api/wechatapp/sendmessage/type.go @@ -458,3 +458,17 @@ type TemplatedEtailType struct { type OpenApprovalState struct { ThirdNo string `json:"thirdNo"` //审批单ID } + +//文本结构体(简化) +type TextTemplateCardTypeSimplifyes struct { + ShareTemplateCard + QuoteArea QuoteAreaType `json:"quote_area"` //引用文献样式 + JumpList []JumpListType `json:"jump_list"` //跳转指引样式的列表,该字段可为空数组 + CardAction CardActionType `json:"card_action"` +} + +//文本通知型(简化) +type TextNoticeTemplateSimplifyes struct { + ShareField + TemplateCard TextTemplateCardTypeSimplifyes `json:"template_card"` +} diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 68adc6b..4438db2 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1192,3 +1192,77 @@ func GetSendMsgUser(id, departmentId int64) (isTrue bool, userStr string) { } return } + +//获取加减分订单 +func GetScoreFlow(orderId string) (content assessmentmodel.ScoreFlow, isTrue bool) { + isTrue = false + judgeErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&content).Error + if judgeErr == nil { + isTrue = true + } + return +} + +//审批流程 +func GetEvaluationProcess(orderId string) (content assessmentmodel.EvaluationProcess, isTrue bool) { + isTrue = false + judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&content).Error + if judgeErr == nil { + isTrue = true + } + return +} + +//考核方案 +func GetQualitativeEvaluation(orderId string) (content assessmentmodel.QualitativeEvaluation, isTrue bool) { + isTrue = false + judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&content).Error + if judgeErr == nil { + isTrue = true + } + return +} + +//获取考核项目关联项目 +/* +@orderId 加减分订单Id +returnData +#targettitle 指标名称 +#detailedRulesTitle 明细 +#detailedRulesInfo 明细说明 +*/ +func GetDutyAssociatedItems(orderId string) (targettitle, detailedRulesTitle, detailedRulesInfo, unit string, flowContent assessmentmodel.ScoreFlow, isTrue bool) { + flowContent, isTrue = GetScoreFlow(orderId) + if isTrue != true { + return + } + qualEvalCont, qualEvalErr := GetQualitativeEvaluation(strconv.FormatInt(flowContent.EvaluationPlan, 10)) + if qualEvalErr != true { + return + } + unit = qualEvalCont.Unit + targetCont, targetErr := GetTargetInfo(qualEvalCont.Target) + if targetErr == true { + targettitle = targetCont.Title + unit = targetCont.Uniteing + } + + detailedTargetCont, detailedTargetErr := GetDetailedTargetInfo(qualEvalCont.Target) + if detailedTargetErr == true { + detailedRulesTitle = detailedTargetCont.Title + detailedRulesInfo = detailedTargetCont.Content + } + isTrue = true + return +} + +//获取角色组 +func GetRoleGroup(id int64) (roleGroup systemuser.RoleGroup, isTrue bool) { + isTrue = false + err := global.GVA_DB_Master.Where("`srg_id` = ?", id).First(&roleGroup).Error //16118387069540343 + if err != nil { + return + } + isTrue = true + return +} diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go index f7b7604..c463973 100644 --- a/gin_server_admin/model/assessmentmodel/performance_appraisal.go +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -81,3 +81,7 @@ type RectificationMeasures struct { Content string `json:"content" gorm:"column:rm_content;type:longtext;comment:整改内容"` Enclosure string `json:"enclosure" gorm:"column:rm_files;type:longtext;comment:附件"` } + +func (RectificationMeasures *RectificationMeasures) TableName() string { + return "rectification_measures" +}