KPI绩效考核系统
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.

1022 lines
43 KiB

package systemapproval
import (
"encoding/json"
"fmt"
"key_performance_indicators/api/version1/flowchart"
"key_performance_indicators/middleware/wechatapp/wechatcallback"
"key_performance_indicators/middleware/wechatapp/wechatsendmsg"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelskpi"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
)
// 岗位审批
func (a *ApiMethod) PostNatureAppFlow(c *gin.Context) {
var receivedValue AppFlowData
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.OrderId != "" {
publicmethod.Result(101, err, c)
return
}
if receivedValue.YesOrNo == 0 {
receivedValue.YesOrNo = 2
}
if receivedValue.Stepper == 0 {
receivedValue.Stepper = 1
}
//获取登录人信息
context, err := publicmethod.LoginMyCont(c)
if err != nil {
publicmethod.Result(1, err, c, "您无权进行此操作!")
return
}
//获取订单信息
var orderCont modelskpi.PostWorkflowOrders
err = orderCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId})
if err != nil {
publicmethod.Result(1, err, c, "该流程不存在!请检查数据!")
return
}
flowMap, flowCont, err := wechatcallback.GetOneNodeCont(orderCont.WorkFlow, orderCont.NextStep)
if err != nil {
publicmethod.Result(1, err, c, "该流程不存在!请检查数据!")
return
}
//获取当前审批人是否是本人
nextExecutor := strings.Split(orderCont.NextExecutor, ",")
if len(nextExecutor) < 1 {
publicmethod.Result(1, err, c, "您不是审批人!请不要进行操作!")
return
}
contextKeyStr := strconv.FormatInt(context.Key, 10)
if publicmethod.IsInTrue[string](contextKeyStr, nextExecutor) == false {
publicmethod.Result(1, err, c, "您不是审批人!请不要进行操作!")
return
}
//判断节点是否可操作
runIsTrue, responseCode := UpDataAppconueFlowLog(orderCont.OrderId, context.Key, receivedValue.Stepper, receivedValue.YesOrNo, orderCont.Class, flowCont)
if runIsTrue == 1 {
syncSeting.Add(1)
go EidtFlowLog(orderCont.OrderId, flowMap, contextKeyStr, receivedValue.Content, receivedValue.YesOrNo, orderCont.NextStep) //更改操作流程节点信息
var clickUserCont modelshr.PersonArchives
clickUserCont.GetCont(map[string]interface{}{"`id`": context.Id})
clickEnter := strconv.Itoa(receivedValue.YesOrNo)
syncSeting.Add(1)
go UpdataOtherButtonTextXml("kpi", clickEnter, responseCode, clickUserCont, flowCont, 1) //更新按钮操作
switch receivedValue.YesOrNo {
case 1: //同意
syncSeting.Add(1)
go ApproveFlow("kpi", flowMap, flowCont, orderCont.NextStep, orderCont)
case 2: //驳回
syncSeting.Add(1)
go RejectFlow("kpi", flowMap, flowCont, orderCont.NextStep, orderCont)
case 3: //撤回
default: //未知操作
}
}
syncSeting.Wait()
publicmethod.Result(0, err, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-06 11:42:06
@ 功能: 更改操作流程节点信息
@ 参数
#pwoId 岗位审批工作流ID
#flowMap 流程结构体
#operatorWechat 操作人
#appIdea 操作意见
#clickEnter 操作
#step 执行的哪一步
func EidtFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, operatorWechat, appIdea string, clickEnter, step int)
@ 返回值
#
*/
func EidtFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, operatorWechat, appIdea string, clickEnter, step int) {
defer syncSeting.Done()
// flowState := 3 //判断流程状态
var newFlowMap []publicmethod.FlowChartList
for _, v := range flowMap {
var newFlowMapCont publicmethod.FlowChartList
newFlowMapCont.Step = v.Step //步伐
newFlowMapCont.NodeName = v.NodeName //节点名称
newFlowMapCont.Class = v.Class //节点类型 1、普通节点;2、运行中指定节点
newFlowMapCont.RunType = v.RunType //运行状态(1:开始;2:操作点;3:结束)
newFlowMapCont.NodeRelationship = v.NodeRelationship
if v.Step == step { //获取到当前执行的节点
newFlowMapCont.State = 2 //状态 1、不点亮;2、点亮
for _, uv := range v.UserList { //遍历审批人列表
if uv.Wechat == operatorWechat { //当前操作人
var logCont publicmethod.LogList
switch clickEnter {
case 1:
logCont.State = 2
case 2:
logCont.State = 3
default:
logCont.State = 1
}
logCont.Content = appIdea
logCont.TimeVal = publicmethod.UnixTimeToDay(time.Now().Unix(), 1)
uv.LogList = append(uv.LogList, logCont)
}
newFlowMapCont.UserList = append(newFlowMapCont.UserList, uv)
}
} else {
newFlowMapCont.State = v.Class //状态 1、不点亮;2、点亮
newFlowMapCont.UserList = v.UserList
}
newFlowMap = append(newFlowMap, newFlowMapCont)
}
jsonStr, _ := json.Marshal(newFlowMap)
var pwoCont modelskpi.PostWorkflowOrders
pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`work_flow`": string(jsonStr), "`time`": time.Now().Unix()})
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-29 10:24:33
@ 功能: 更新审批记录
@ 参数
#orderId 订单Key
#step 步进器
#flowCont 审批节点
#clickEnterInt 0:未操作;1:同意;2:驳回;3:撤回
#clickUser 操作人
#class 1:定性;2:定量
#responseCode 更新卡片所需要消费的code,可通过发消息接口和回调接口返回值获取,一个code只能调用一次该接口,且只能在72小时内调用
UpDataAppconueFlowLog(orderId, clickUser int64, step, clickEnterInt, class int, flowCont publicmethod.FlowChartList)
@ 返回值
#runIsTrue 是否可继续操作
*/
func UpDataAppconueFlowLog(orderId, clickUser int64, step, clickEnterInt, class int, flowCont publicmethod.FlowChartList) (runIsTrue int, responseCode string) {
runIsTrue = 1
//判断当前步进位是否已经被操作
var operatorIsTreu modelskpi.OpenApprovalChangeLog
err := operatorIsTreu.GetCont(map[string]interface{}{"`orderid`": orderId, `stepper`: step})
if err != nil { //无记录,可继续操作
wechatcallback.UpdateLogNotChange(orderId)
runIsTrue = 1
operatorIsTreu.Type = 2
operatorIsTreu.Title = flowCont.NodeName
operatorIsTreu.Operator = clickUser
operatorIsTreu.OrderId = orderId
operatorIsTreu.OperatorTime = time.Now().Unix()
operatorIsTreu.Step = flowCont.Step
operatorIsTreu.OperatorType = 2
operatorIsTreu.Msgid = ""
operatorIsTreu.ResponseCode = ""
operatorIsTreu.Stepper = step
operatorIsTreu.ChangeIsTrue = 2
operatorIsTreu.YesOrNo = clickEnterInt
operatorIsTreu.Eiteyime = time.Now().Unix()
overall.CONSTANT_DB_KPI.Create(&operatorIsTreu)
} else { //有记录判断该节点是否可继续操作
responseCode = operatorIsTreu.ResponseCode
if operatorIsTreu.ChangeIsTrue != 1 { //同级人员已经操作过不可继续操作
runIsTrue = 2
//获取操作人信息
var carryPeopleOld modelshr.PersonArchives
carryPeopleOld.GetCont(map[string]interface{}{"`key`": operatorIsTreu.Operator}, "`number`", "`name`", "`wechat`", "`work_wechat`")
toUserName := ""
if clickUser != operatorIsTreu.Operator { //当前操作人不是已操作人
//获取同节点其他操作人
var otherPeopleWechat []string
operatorStr := strconv.FormatInt(operatorIsTreu.Operator, 10)
for _, v := range flowCont.UserList {
if operatorStr != v.Id {
if publicmethod.IsInTrue[string](v.Wechat, otherPeopleWechat) == false {
otherPeopleWechat = append(otherPeopleWechat, v.Wechat)
}
}
}
toUserName = strings.Join(otherPeopleWechat, "|")
} else {
toUserName = carryPeopleOld.Wechat
if carryPeopleOld.WorkWechat != "" {
toUserName = carryPeopleOld.WorkWechat
}
}
if toUserName != "" {
var sendMsgText wechatsendmsg.SendTextCard
sendMsgText.Touser = toUserName
sendMsgText.Msgtype = "textcard"
agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64)
sendMsgText.Agentid = agentIdInt
sendMsgText.EnableDuplicateCheck = 0
sendMsgText.DuplicateCheckInterval = 1800
sendMsgText.EnableIdTrans = 0
sendMsgText.MsgBody.Title = "已审批"
sendMsgText.MsgBody.Description = fmt.Sprintf("此审批流程已被%v审批!请不要重复操作!", carryPeopleOld.Name)
jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, class)
if class != 1 {
jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, orderId, class)
}
sendMsgText.MsgBody.URL = jumpUrl
sendMsgText.MsgBody.BtnTxt = ""
sendMsgText.SendMsg("kpi")
}
} else { //有记录,没有人锁止操作,可继续操作
runIsTrue = 1
operatorIsTreu.EiteCont(map[string]interface{}{"`id`": operatorIsTreu.Id}, map[string]interface{}{"`change_is_true`": 2, "`operator`": clickUser, "`yesorno`": clickEnterInt, "eiteyime": time.Now().Unix()})
}
}
return
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-06 15:13:59
@ 功能: 更新审批节点审批文案
@ 参数
#systemApp 系统
#clickEnter 1:同意;2:驳回
#responseCode 更新卡片所需要消费的code,可通过发消息接口和回调接口返回值获取,一个code只能调用一次该接口,且只能在72小时内调用
#carryOutPeople 当前操作人信息
#flowOneCont 当前审批节点信息
#isAll 1:发送全部,2:发送其他
UpdataOtherButtonTextXml(systemApp, clickEnter, responseCode string, carryOutPeople modelshr.PersonArchives, flowOneCont publicmethod.FlowChartList, isAll int)
@ 返回值
#
*/
func UpdataOtherButtonTextXml(systemApp, clickEnter, responseCode string, carryOutPeople modelshr.PersonArchives, flowOneCont publicmethod.FlowChartList, isAll int) {
defer syncSeting.Done()
var buttonClickNAme string
switch clickEnter {
case "1":
buttonClickNAme = fmt.Sprintf("%v已批准", carryOutPeople.Name)
case "3":
buttonClickNAme = fmt.Sprintf("%v已撤回", carryOutPeople.Name)
default:
buttonClickNAme = fmt.Sprintf("%v已驳回", carryOutPeople.Name)
}
// wechatOpenID := carryOutPeople.Wechat
var userOpenId []string
if len(flowOneCont.UserList) > 0 {
for _, v := range flowOneCont.UserList {
if isAll != 1 {
if v.Wechat != carryOutPeople.Wechat && v.Wechat != carryOutPeople.WorkWechat && publicmethod.IsInTrue[string](v.Wechat, userOpenId) == false {
userOpenId = append(userOpenId, v.Wechat)
}
} else {
if publicmethod.IsInTrue[string](v.Wechat, userOpenId) == false {
userOpenId = append(userOpenId, v.Wechat)
}
}
}
}
// userOpenId = append(userOpenId, "KaiXinGuo")
if len(userOpenId) > 0 {
var sendMsgText wechatsendmsg.UpdateButtonNotClickable
sendMsgText.Userids = userOpenId
sendMsgText.Atall = 0
agentIdInt, _ := strconv.ParseUint(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 32)
sendMsgText.Agentid = agentIdInt
sendMsgText.ResponseCode = responseCode
sendMsgText.Button.ReplaceName = buttonClickNAme
callBackCont, err := sendMsgText.UpdateButtonNotClick(systemApp)
// sendMsgText.UpdateButtonNotClick(systemApp)
fmt.Printf("10、更新发送信息返回:%v-----------%v----------->%v------》%v\n", callBackCont, err, sendMsgText, buttonClickNAme)
} else {
fmt.Printf("\n\n同级没有其他审批人:%v\n\n%v\n\n", carryOutPeople, flowOneCont)
}
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-08 11:20:38
@ 功能: 同意
@ 参数
#systemApp 系统
#pwoCont 岗位审批工作流
#flowMap 流程结构体
#flowOneCont 当前节点构体
#step 记录值
#liangOrXing 属性1、定性;2、定量
ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders)
@ 返回值
#
*/
func ApproveFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) {
defer syncSeting.Done()
nextStep := 0
flowState := 2 //判断流程状态
switch flowOneCont.RunType {
case 1:
flowState = 2
case 2:
flowState = 2
case 3:
flowState = 4
case 4:
flowState = 4
default:
flowState = 1
}
//判断下一个当前节点是否为最后一个节点
if flowState == 4 {
nextStep = 0
} else {
nextStep = flowOneCont.Step + 1
}
//更新审批流状态
var pwoCont modelskpi.PostWorkflowOrders
nextUserKey, _ := flowchart.GetNodeOperator(flowMap, nextStep)
nextUserKeyStr := strings.Join(nextUserKey, ",")
if nextStep == 0 {
nextUserKeyStr = ""
}
flowParticipants := strings.Split(pwoContOld.Participants, ",")
for _, vuk := range nextUserKey {
if publicmethod.IsInTrue[string](vuk, flowParticipants) == false {
flowParticipants = append(flowParticipants, vuk)
}
}
flowParticipantStr := strings.Join(flowParticipants, ",")
pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowParticipantStr, "`time`": time.Now().Unix()}) //改变审批流状态
//获取下一部操作
for _, fv := range flowMap {
if fv.Step == flowOneCont.Step+1 {
var sendToUserList []string //获取发送人
for _, fvu := range fv.UserList {
if publicmethod.IsInTrue[string](fvu.Wechat, sendToUserList) == false {
sendToUserList = append(sendToUserList, fvu.Wechat)
}
}
if len(sendToUserList) > 0 { //存在接收人执行以下操作
var postTarDeta modelskpi.PostTarget
postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`")
if fv.Class < 3 {
sendNextStep := step + 1
//发送按钮信息
if pwoContOld.Class == 1 { //定性操作
var postTarDetailsDeta modelskpi.PostTargetDetails
postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`")
unitTitle := postTarDetailsDeta.Company
if unitTitle == "" {
unitTitle = postTarDeta.Unit
}
var postNatuerFlowCont modelskpi.PostNatureFlow
postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
if fv.Class == 2 { //需要填写信息,发送相关信息
//挂号
registerNum := publicmethod.GetUUid(2)
var setUpRegister modelskpi.Register
setUpRegister.Number = registerNum
setUpRegister.State = 1
setUpRegister.Time = time.Now().Unix()
setUpRegister.AddCont()
//抄送信息
markDowmStr := "整改通知"
markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr)
markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title)
markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title)
markDowmStr = fmt.Sprintf("%v\n><font color=\"info\">发生时间: %v</font> ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1))
switch postTarDetailsDeta.Punishmode {
case 1:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
case 2:
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
default:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
}
//获取提报人信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">提报人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n>\n>[填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum)
//发送同通信息
SendNoticeMsg(sendToUserList, markDowmStr, systemApp)
} else { //无需填写信息。继续发送
//考核标准
var sunTextCont string
var quoteTextCont string
switch postTarDetailsDeta.Punishmode {
case 2:
var moneyTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
moneyTitle = "现金奖励标准"
quoteTextCont = fmt.Sprintf("奖励现金:%v元", postNatuerFlowCont.Money)
} else {
moneyTitle = "现金罚款标准"
quoteTextCont = fmt.Sprintf("罚款现金:%v元", postNatuerFlowCont.Money)
}
var scoreStr string
if postTarDetailsDeta.Minmoney != 0 {
scoreStr = fmt.Sprintf("%v元-%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
} else {
scoreStr = fmt.Sprintf("%v元", publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
}
sunTextCont = fmt.Sprintf("%v:%v", moneyTitle, scoreStr)
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
case 3:
var moneyTitle string
var scoreTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
moneyTitle = "现金奖励标准"
scoreTitle = "考核扣分标准"
quoteTextCont = fmt.Sprintf("考核加:%v%v\n奖励现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money)
} else {
moneyTitle = "现金罚款标准"
scoreTitle = "考核加分标准"
quoteTextCont = fmt.Sprintf("考核扣:%v%v\n罚款现金:%v元", postNatuerFlowCont.Score, unitTitle, postNatuerFlowCont.Money)
}
var scoreStr string
if postTarDetailsDeta.MinScore != 0 {
scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
} else {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
}
sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr)
if postTarDetailsDeta.Minmoney != 0 {
sunTextCont = fmt.Sprintf("%v\n%v:%v元-%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Minmoney)/100, 2), publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
} else {
sunTextCont = fmt.Sprintf("%v\n%v:%v元", sunTextCont, moneyTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.Maxmoney)/100, 2))
}
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
default:
var scoreTitle string
if postNatuerFlowCont.AddOrDecrease == 1 {
scoreTitle = "考核加分标准"
quoteTextCont = fmt.Sprintf("考核加:%v%v", postNatuerFlowCont.Score, unitTitle)
} else {
scoreTitle = "考核扣分标准"
quoteTextCont = fmt.Sprintf("考核扣:%v%v", postNatuerFlowCont.Score, unitTitle)
}
var scoreStr string
if postTarDetailsDeta.MinScore != 0 {
scoreStr = fmt.Sprintf("%v%v-%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MinScore)/100, 2), unitTitle, publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
} else {
scoreStr = fmt.Sprintf("%v%v", publicmethod.DecimalEs(float64(postTarDetailsDeta.MaxScore)/100, 2), unitTitle)
}
sunTextCont = fmt.Sprintf("%v:%v", scoreTitle, scoreStr)
if postNatuerFlowCont.Reason != "" {
quoteTextCont = fmt.Sprintf("%v\n备注:%v", quoteTextCont, postNatuerFlowCont.Reason)
}
}
var quoteAreaInfo wechatsendmsg.QuoteAreaCont
quoteAreaInfo.Type = 0
quoteAreaInfo.Title = "考核明细"
quoteAreaInfo.QuoteText = quoteTextCont
//二级标题+文本列表
var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo
var shenQingRen modelshr.PersonArchives
shenQingRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`")
if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" {
wechatOpenId := shenQingRen.Wechat
if shenQingRen.WorkWechat != "" {
wechatOpenId = shenQingRen.WorkWechat
}
//发送人
var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo
horizontalContentLis3.KeyName = "申请人:"
horizontalContentLis3.Value = "点击查看"
horizontalContentLis3.Type = 3
horizontalContentLis3.Userid = wechatOpenId
twoTitleTextList = append(twoTitleTextList, horizontalContentLis3)
}
var beiKaoHeRen modelshr.PersonArchives
beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`wechat`", "`work_wechat`")
//被考核人
if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" {
weChatStrs := beiKaoHeRen.Wechat
if beiKaoHeRen.WorkWechat != "" {
weChatStrs = beiKaoHeRen.WorkWechat
}
var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo
twoTitleTextCont.KeyName = "被考核人:"
twoTitleTextCont.Value = "点击查看"
twoTitleTextCont.Type = 3
twoTitleTextCont.Userid = weChatStrs
twoTitleTextList = append(twoTitleTextList, twoTitleTextCont)
}
SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, pwoContOld.Class, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList)
}
} else { //定量操作
//定量操作
var postMeterFlowCont modelskpi.PostMeteringFlow
postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
//获取考核项目信息
var postShemeCont modelskpi.QualitativeEvaluationScheme
postShemeCont.GetCont(map[string]interface{}{"`id`": postMeterFlowCont.ShemeId})
//引用文献
var quoteAreaInfo wechatsendmsg.QuoteAreaCont
quoteAreaInfo.Type = 0
quoteAreaInfo.Title = "数据详细"
quoteAreaInfo.QuoteText = fmt.Sprintf("数值:%v%v\n备注:%v", publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit, postMeterFlowCont.Reason)
//二级标题+文本列表
var twoTitleTextList []wechatsendmsg.HorizontalContentListInfo
var shenQingRen modelshr.PersonArchives
shenQingRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`")
if shenQingRen.Wechat != "" || shenQingRen.WorkWechat != "" {
wechatOpenId := shenQingRen.Wechat
if shenQingRen.WorkWechat != "" {
wechatOpenId = shenQingRen.WorkWechat
}
//发送人
var horizontalContentLis3 wechatsendmsg.HorizontalContentListInfo
horizontalContentLis3.KeyName = "申请人:"
horizontalContentLis3.Value = "点击查看"
horizontalContentLis3.Type = 3
horizontalContentLis3.Userid = wechatOpenId
twoTitleTextList = append(twoTitleTextList, horizontalContentLis3)
}
var beiKaoHeRen modelshr.PersonArchives
beiKaoHeRen.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.Executor}, "`wechat`", "`work_wechat`")
//被考核人
if beiKaoHeRen.Wechat != "" || beiKaoHeRen.WorkWechat != "" {
weChatStrs := beiKaoHeRen.Wechat
if beiKaoHeRen.WorkWechat != "" {
weChatStrs = beiKaoHeRen.WorkWechat
}
var twoTitleTextCont wechatsendmsg.HorizontalContentListInfo
twoTitleTextCont.KeyName = "被考核人:"
twoTitleTextCont.Value = "点击查看"
twoTitleTextCont.Type = 3
twoTitleTextCont.Userid = weChatStrs
twoTitleTextList = append(twoTitleTextList, twoTitleTextCont)
}
SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, pwoContOld.Class, sendToUserList, quoteAreaInfo, twoTitleTextList)
}
} else {
jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class)
if pwoContOld.Class != 1 {
jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class)
}
//抄送信息
markDowmStr := "审批通过-抄送"
markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr)
markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title)
if pwoContOld.Class == 1 {
//定性操作
var postTarDetailsDeta modelskpi.PostTargetDetails
postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`")
markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title)
var postNatuerFlowCont modelskpi.PostNatureFlow
postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
switch postTarDetailsDeta.Punishmode {
case 1:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
case 2:
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
default:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
}
//获取责任信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.PersonLiable}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">被考核人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n><font color=\"info\">发生时间: %v</font> ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1))
// markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId)
markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl)
} else {
//定量操作
var postMeterFlowCont modelskpi.PostMeteringFlow
postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
markDowmStr = fmt.Sprintf("%v\n>%v年", markDowmStr, postMeterFlowCont.Year)
switch postTarDeta.Cycle {
case 5:
markDowmStr = fmt.Sprintf("%v\n>%v季度上报数值%v%v", markDowmStr, postMeterFlowCont.Quarter, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
case 6:
markDowmStr = fmt.Sprintf("%v\n>上报数值%v%v", markDowmStr, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
default:
markDowmStr = fmt.Sprintf("%v\n>%v月上报数值%v%v", markDowmStr, postMeterFlowCont.Month, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
}
//获取责任信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">被考核人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
// markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](http://new.hxgk.group/#/quantitativeList?id=%v)", markDowmStr, pwoContOld.OrderId)
markDowmStr = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl)
}
//发送抄送信息
SendNoticeMsg(sendToUserList, markDowmStr, systemApp)
}
}
}
}
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-09 08:38:02
@ 功能: 发送通知信息
@ 参数
#sendToUserList 信息接收人
#markDowmStr 消息主体
#systemApp 系统
@ 返回值
#
*/
func SendNoticeMsg(sendToUserList []string, markDowmStr, systemApp string) {
agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64) //应用AgentId
var sendCopyMsg wechatsendmsg.SendMarkDown
sendCopyMsg.Touser = strings.Join(sendToUserList, "|")
sendCopyMsg.Msgtype = "markdown"
sendCopyMsg.Agentid = agentIdInt
sendCopyMsg.EnableDuplicateCheck = 0
sendCopyMsg.DuplicateCheckInterval = 1800
sendCopyMsg.MsgBody.Content = markDowmStr
sendCopyMsg.SendMsg(systemApp)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-09 09:19:54
@ 功能: 发送按钮卡片
@ 参数
#systemApp 系统
#mainTitle 主标题
#descInfo 主标题描述
#sunTextCont 二级文本
#sendTitle 头部信息
#uuId 订单ID
#step 步进值
#sendUserList 接收人
#quoteAreaInfo 引用文献
#twoTitleTextList 二级标题+文本列表
#class 1、定性;2、定量
func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo)
@ 返回值
#
*/
func SendButtonCard(systemApp, mainTitle, descInfo, sunTextCont, sendTitle string, uuId int64, step, class int, sendUserList []string, quoteAreaInfo wechatsendmsg.QuoteAreaCont, twoTitleTextList []wechatsendmsg.HorizontalContentListInfo) {
//头部信息
var sourceText wechatsendmsg.SourceText
sourceText.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png"
sourceText.Desc = fmt.Sprintf("恒信高科-%v", sendTitle)
sourceText.DescColor = 1
//按钮
var buttonList []wechatsendmsg.ButtonListCont
var buttonList1 wechatsendmsg.ButtonListCont
buttonList1.Text = "批准"
buttonList1.Style = 1
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, step)
buttonList = append(buttonList, buttonList1)
var buttonList2 wechatsendmsg.ButtonListCont
buttonList2.Text = "驳回"
buttonList2.Style = 3
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, step)
buttonList = append(buttonList, buttonList2)
//卡片跳转地址
var cardActionContStr wechatsendmsg.CardActionCont
cardActionContStr.Type = 1
jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class)
if class != 1 {
jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId, class)
}
cardActionContStr.Url = jumpUrl
// cardActionContStr.Url = fmt.Sprintf("%v/#/quantitativeList?id=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, uuId)
var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify
// sendButtionMsg.Touser = strings.Join(sendUserList, "|")
sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
sendButtionMsg.Msgtype = "template_card"
agentIdInt, _ := strconv.ParseInt(overall.CONSTANT_CONFIG.WechatKpi.Agentid, 10, 64)
sendButtionMsg.Agentid = agentIdInt
sendButtionMsg.EnableDuplicateCheck = 0
sendButtionMsg.DuplicateCheckInterval = 1800
sendButtionMsg.EnableIdTrans = 0
sendButtionMsg.TemplateCard.CardType = "button_interaction"
sendButtionMsg.TemplateCard.Source = sourceText
sendButtionMsg.TemplateCard.TaskId = fmt.Sprintf("KPI_%v_%v", uuId, step)
sendButtionMsg.TemplateCard.MainTitle.Title = mainTitle
sendButtionMsg.TemplateCard.MainTitle.Desc = descInfo
sendButtionMsg.TemplateCard.QuoteArea = quoteAreaInfo
sendButtionMsg.TemplateCard.SubTitleText = sunTextCont
sendButtionMsg.TemplateCard.ButtonList = buttonList
sendButtionMsg.TemplateCard.HorizontalContentList = twoTitleTextList
sendButtionMsg.TemplateCard.CardAction = cardActionContStr
// callData, err := sendButtionMsg.SendMsg(systemApp)
sendButtionMsg.SendMsg(systemApp)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-11 08:10:43
@ 功能: 驳回
@ 参数
#systemApp 系统
#pwoCont 岗位审批工作流
#flowMap 流程结构体
#flowOneCont 当前节点构体
#step 记录值
#liangOrXing 属性1、定性;2、定量
RejectFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders)
@ 返回值
#
*/
func RejectFlow(systemApp string, flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList, step int, pwoContOld modelskpi.PostWorkflowOrders) {
defer syncSeting.Done()
//获取要驳回到的节点
if flowOneCont.NodeRelationship.RejectNode < 1 {
return
}
var clickUrlPath string
markDowmStr := "驳回"
flowState := 3
rejectNode := GetRejectNode(flowMap, flowOneCont)
var sendToUserList []string //获取发送人
for _, fvu := range rejectNode.UserList {
if publicmethod.IsInTrue[string](fvu.Wechat, sendToUserList) == false {
sendToUserList = append(sendToUserList, fvu.Wechat)
}
}
switch rejectNode.Class {
case 2: //发送整改信息
//挂号
registerNum := publicmethod.GetUUid(2)
var setUpRegister modelskpi.Register
setUpRegister.Number = registerNum
setUpRegister.State = 1
setUpRegister.Time = time.Now().Unix()
setUpRegister.AddCont()
markDowmStr = fmt.Sprintf("您的整改措施被%v", markDowmStr)
clickUrlPath = fmt.Sprintf("%v\n>\n>[重新填写整改措施](%v/#/pages/approval/corraction?id=%v&num=%v)", markDowmStr, overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, registerNum)
default: //发送驳回信息
jumpUrl := fmt.Sprintf("%v/#/pages/approval/postdingxin?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class)
if pwoContOld.Class != 1 {
jumpUrl = fmt.Sprintf("%v/#/pages/approval/postdingliang?orderid=%v&class=%v", overall.CONSTANT_CONFIG.Appsetup.WebUrl, pwoContOld.OrderId, pwoContOld.Class)
}
clickUrlPath = fmt.Sprintf("%v\n>\n>[查看审批详情](%v)", markDowmStr, jumpUrl)
}
var postTarDeta modelskpi.PostTarget
postTarDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Target}, "`title`")
markDowmStr = fmt.Sprintf("%v\n>**事项详情** ", markDowmStr)
markDowmStr = fmt.Sprintf("%v\n>指标: %v", markDowmStr, postTarDeta.Title)
if pwoContOld.Class == 1 { //定性操作
var postTarDetailsDeta modelskpi.PostTargetDetails
postTarDetailsDeta.GetCont(map[string]interface{}{"`id`": pwoContOld.Detailed}, "`title`", "`punishmode`", "`company`")
var postNatuerFlowCont modelskpi.PostNatureFlow
postNatuerFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
markDowmStr = fmt.Sprintf("%v\n>指标详情: %v", markDowmStr, postTarDetailsDeta.Title)
markDowmStr = fmt.Sprintf("%v\n><font color=\"info\">发生时间: %v</font> ", markDowmStr, publicmethod.UnixTimeToDay(postNatuerFlowCont.HappenTime, 1))
switch postTarDetailsDeta.Punishmode {
case 1:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
case 2:
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
default:
if postNatuerFlowCont.Score != 0 {
scoreFloat := (float64(postNatuerFlowCont.Score) * float64(postNatuerFlowCont.HappenCount)) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>增奖励: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v%v", markDowmStr, publicmethod.DecimalEs(scoreFloat, 2), postTarDetailsDeta.Company)
}
}
if postNatuerFlowCont.Money != 0 {
moneyFloat := float64(postNatuerFlowCont.Money) / 100
if postNatuerFlowCont.AddOrDecrease == 1 {
//增加
markDowmStr = fmt.Sprintf("%v\n>奖励: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
} else {
//减少
markDowmStr = fmt.Sprintf("%v\n>减少: %v元", markDowmStr, publicmethod.DecimalEs(moneyFloat, 2))
}
}
}
//获取提报人信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postNatuerFlowCont.Executor}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">提报人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
markDowmStr = fmt.Sprintf("%v\n> \n>%v", markDowmStr, clickUrlPath)
} else {
//定量操作
var postMeterFlowCont modelskpi.PostMeteringFlow
postMeterFlowCont.GetCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId})
markDowmStr = fmt.Sprintf("%v\n>%v年", markDowmStr, postMeterFlowCont.Year)
switch postTarDeta.Cycle {
case 5:
markDowmStr = fmt.Sprintf("%v\n>%v季度上报数值%v%v", markDowmStr, postMeterFlowCont.Quarter, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
case 6:
markDowmStr = fmt.Sprintf("%v\n>上报数值%v%v", markDowmStr, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
default:
markDowmStr = fmt.Sprintf("%v\n>%v月上报数值%v%v", markDowmStr, postMeterFlowCont.Month, publicmethod.DecimalEs(postMeterFlowCont.Score, 2), postTarDeta.Unit)
}
//获取责任信息
var zeRenRenCont modelshr.PersonArchives
zeRenRenCont.GetCont(map[string]interface{}{"`key`": postMeterFlowCont.PersonLiable}, "`name`", "`number`")
markDowmStr = fmt.Sprintf("%v\n> \n><font color=\"warning\">被考核人: %v(%v)</font>", markDowmStr, zeRenRenCont.Name, zeRenRenCont.Number)
}
nextStep := rejectNode.Step + 1
var pwoCont modelskpi.PostWorkflowOrders
nextUserKey, _ := flowchart.GetNodeOperator(flowMap, nextStep)
nextUserKeyStr := strings.Join(nextUserKey, ",")
if nextStep == 0 {
nextUserKeyStr = ""
}
// pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`time`": time.Now().Unix()}) //改变审批流状态
flowParticipants := strings.Split(pwoContOld.Participants, ",")
for _, vuk := range nextUserKey {
if publicmethod.IsInTrue[string](vuk, flowParticipants) == false {
flowParticipants = append(flowParticipants, vuk)
}
}
flowParticipantStr := strings.Join(flowParticipants, ",")
pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "'next_executor'": nextUserKeyStr, "`participants`": flowParticipantStr, "`time`": time.Now().Unix()}) //改变审批流状态
//发送同通信息
SendNoticeMsg(sendToUserList, markDowmStr, systemApp)
}
/*
*
@ 作者: 秦东
@ 时间: 2022-10-11 08:56:06
@ 功能: 获取要驳回到的节点
@ 参数
#
@ 返回值
#
*/
func GetRejectNode(flowMap []publicmethod.FlowChartList, flowOneCont publicmethod.FlowChartList) (rejectFlowCont publicmethod.FlowChartList) {
if flowOneCont.NodeRelationship.RejectNode > 0 {
for _, v := range flowMap {
if v.Step == flowOneCont.NodeRelationship.RejectNode {
rejectFlowCont = v
}
}
}
return
}