|
|
|
@ -4,6 +4,7 @@ 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" |
|
|
|
@ -512,7 +513,7 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
} |
|
|
|
//获取被考核人基本信息
|
|
|
|
var userCont modelshr.PersonArchives |
|
|
|
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.UserKey}, "`company`", "`maindeparment`", "`admin_org`", "`position`,`wechat`,`work_wechat`") |
|
|
|
err = userCont.GetCont(map[string]interface{}{"`key`": receivedValue.UserKey}, "`company`", "`maindeparment`", "`admin_org`", "`position`", "`wechat`", "`work_wechat`", "`key`") |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(107, err, c) |
|
|
|
return |
|
|
|
@ -523,30 +524,30 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
if receivedValue.Punishmode == 0 { |
|
|
|
receivedValue.Punishmode = 1 |
|
|
|
} |
|
|
|
var scoreVal int64 = 0 |
|
|
|
var moneyVal int64 = 0 |
|
|
|
var scoreVal float64 = 0 |
|
|
|
var moneyVal float64 = 0 |
|
|
|
isTrue := false |
|
|
|
var msg string |
|
|
|
switch receivedValue.Punishmode { |
|
|
|
case 1: |
|
|
|
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, postShemeCont.MaxScore, postShemeCont.MinScore) |
|
|
|
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, float64(postShemeCont.MaxScore), float64(postShemeCont.MinScore)) |
|
|
|
if isTrue != true { |
|
|
|
publicmethod.Result(1, isTrue, c, msg) |
|
|
|
return |
|
|
|
} |
|
|
|
case 2: |
|
|
|
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, postShemeCont.Maxmoney, postShemeCont.Minmoney) |
|
|
|
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, float64(postShemeCont.Maxmoney), float64(postShemeCont.Minmoney)) |
|
|
|
if isTrue != true { |
|
|
|
publicmethod.Result(1, isTrue, c, msg) |
|
|
|
return |
|
|
|
} |
|
|
|
case 3: |
|
|
|
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, postShemeCont.MaxScore, postShemeCont.MinScore) |
|
|
|
scoreVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.ScoreState, receivedValue.Score, float64(postShemeCont.MaxScore), float64(postShemeCont.MinScore)) |
|
|
|
if isTrue != true { |
|
|
|
publicmethod.Result(1, isTrue, c, msg) |
|
|
|
return |
|
|
|
} |
|
|
|
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, postShemeCont.Maxmoney, postShemeCont.Minmoney) |
|
|
|
moneyVal, isTrue, msg = judgeScoreOrMoneyIsTrue(receivedValue.MoneyState, receivedValue.Money, float64(postShemeCont.Maxmoney), float64(postShemeCont.Minmoney)) |
|
|
|
if isTrue != true { |
|
|
|
publicmethod.Result(1, isTrue, c, msg) |
|
|
|
return |
|
|
|
@ -617,6 +618,13 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
flowCont.OrderId = uuId //审批单ID"`
|
|
|
|
flowCont.Step = 1 //当前执行到第几步"`
|
|
|
|
flowCont.NextStep = 2 //下一步执行哪个步骤"`
|
|
|
|
sumStep := len(flowMap) |
|
|
|
if sumStep-1 > 0 { |
|
|
|
sumStep = sumStep - 1 |
|
|
|
} else { |
|
|
|
sumStep = 1 |
|
|
|
} |
|
|
|
flowCont.CountStep = sumStep |
|
|
|
flowMapJson, _ := json.Marshal(flowMap) |
|
|
|
flowCont.WorkFlow = string(flowMapJson) //工作流(审批json字符串)"`
|
|
|
|
flowCont.CompanyId = userCont.Company //公司"`
|
|
|
|
@ -667,7 +675,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
postNatureFlowCont.HappenTime = currentTime //发生时间"`
|
|
|
|
postNatureFlowCont.HappenCount = receivedValue.Count //发生次数"`
|
|
|
|
postNatureFlowCont.Time = time.Now().Unix() //时间"`
|
|
|
|
|
|
|
|
// publicmethod.Result(1, postNatureFlowCont, c, msg)
|
|
|
|
// return
|
|
|
|
//开启事务提交
|
|
|
|
gormDbAffair := overall.CONSTANT_DB_KPI.Begin() |
|
|
|
|
|
|
|
@ -774,12 +783,12 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
var buttonList1 wechatsendmsg.ButtonListCont |
|
|
|
buttonList1.Text = "批准" |
|
|
|
buttonList1.Style = 1 |
|
|
|
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 1) |
|
|
|
buttonList1.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 1, 2) |
|
|
|
buttonList = append(buttonList, buttonList1) |
|
|
|
var buttonList2 wechatsendmsg.ButtonListCont |
|
|
|
buttonList2.Text = "驳回" |
|
|
|
buttonList2.Style = 3 |
|
|
|
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 1) |
|
|
|
buttonList2.Key = fmt.Sprintf("KPI_post_%v_%v_%v", uuId, 2, 2) |
|
|
|
buttonList = append(buttonList, buttonList2) |
|
|
|
|
|
|
|
//二级标题+文本列表
|
|
|
|
@ -810,8 +819,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
cardActionContStr.Url = fmt.Sprintf("http://new.hxgk.group/#/quantitativeList?id=%v", uuId) |
|
|
|
|
|
|
|
var sendButtionMsg wechatsendmsg.SendButtonInteractionSimplify |
|
|
|
// sendButtionMsg.Touser = strings.Join(sendUserList, "|")
|
|
|
|
sendButtionMsg.Touser = "KaiXinGuo" //指定接收消息的成员,成员ID列表;特殊情况:指定为
|
|
|
|
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 |
|
|
|
@ -866,6 +875,8 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
openAppChangeLog.ResponseCode = callData.ResponseCode //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"`
|
|
|
|
openAppChangeLog.Stepper = 1 |
|
|
|
openAppChangeLog.ChangeIsTrue = 1 //是否可变更(1:可变更;2:不可变更)"`
|
|
|
|
openAppChangeLog.Eiteyime = addTime |
|
|
|
openAppChangeLog.YesOrNo = 1 |
|
|
|
overall.CONSTANT_DB_KPI.Create(&openAppChangeLog) |
|
|
|
|
|
|
|
} |
|
|
|
@ -888,14 +899,15 @@ func (a *ApiMethod) SendUsNatureEvaluation(c *gin.Context) { |
|
|
|
@MaxScore 最大值 |
|
|
|
@minScore 最小值 |
|
|
|
*/ |
|
|
|
func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore int64) (scoreInt64 int64, isTrue bool, msg string) { |
|
|
|
func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore float64) (scoreInt64 float64, isTrue bool, msg string) { |
|
|
|
isTrue = false |
|
|
|
// fmt.Printf("\n\nscoreState:%v\n\nscore:%v\n\nmaxScore:%v\n\nminScore:%v\n\n", scoreState, score, maxScore, minScore)
|
|
|
|
switch scoreState { |
|
|
|
case 2, 3: |
|
|
|
if score == "" { |
|
|
|
return |
|
|
|
} |
|
|
|
scoreInt64, _ = strconv.ParseInt(score, 10, 64) |
|
|
|
scoreInt64, _ = strconv.ParseFloat(score, 64) |
|
|
|
scoreInt64 = scoreInt64 * 100 |
|
|
|
if scoreInt64 > maxScore { |
|
|
|
msg = fmt.Sprintf("您提交的数值超过允许提交的最大值(最大值:%v)!", float64(maxScore)/100) |
|
|
|
@ -907,12 +919,661 @@ func judgeScoreOrMoneyIsTrue(scoreState int, score string, maxScore, minScore in |
|
|
|
} |
|
|
|
isTrue = true |
|
|
|
case 1: |
|
|
|
scoreInt64, _ = strconv.ParseInt(score, 10, 64) |
|
|
|
scoreInt64, _ = strconv.ParseFloat(score, 64) |
|
|
|
scoreInt64 = scoreInt64 * 100 |
|
|
|
isTrue = true |
|
|
|
default: |
|
|
|
msg = "请您输入要操作的数据,谢谢!" |
|
|
|
return |
|
|
|
} |
|
|
|
// fmt.Printf("\nscoreInt64:%v\n\nisTrue:%v\n\nmsg:%v\n\n", scoreInt64, isTrue, msg)
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 整改措施
|
|
|
|
func (a *ApiMethod) PostRectificationMeasures(c *gin.Context) { |
|
|
|
var receivedValue publicmethod.CorrectiveMeasuresType |
|
|
|
c.ShouldBindJSON(&receivedValue) |
|
|
|
if receivedValue.OrderId == "" || receivedValue.Register == "" || receivedValue.Content == "" { |
|
|
|
publicmethod.Result(101, receivedValue, c) |
|
|
|
return |
|
|
|
} |
|
|
|
//判断此号码是否可以使用
|
|
|
|
var setUpRegister modelskpi.Register |
|
|
|
err := setUpRegister.GetCont(map[string]interface{}{"`number`": receivedValue.Register}, "`state`", "`id`") |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!") |
|
|
|
return |
|
|
|
} |
|
|
|
if setUpRegister.State != 1 { |
|
|
|
publicmethod.Result(1, err, c, "此考核项已经提交过整改方案!") |
|
|
|
return |
|
|
|
} |
|
|
|
syncSeting.Add(1) |
|
|
|
go UpdateRegister(setUpRegister.Id, 2) |
|
|
|
//获取登录人信息
|
|
|
|
context, _ := publicmethod.LoginMyCont(c) |
|
|
|
//获取审批流
|
|
|
|
var pwoCont modelskpi.PostWorkflowOrders |
|
|
|
err = pwoCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId}) |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(1, err, c, "不存在的审批整改项目!") |
|
|
|
return |
|
|
|
} |
|
|
|
if pwoCont.State != 3 { |
|
|
|
publicmethod.Result(1, err, c, "此考核项目已经审批结束!请不要重复提交整改措施!") |
|
|
|
return |
|
|
|
} |
|
|
|
if pwoCont.Class == 1 { //定性
|
|
|
|
var pnfCont modelskpi.PostNatureFlow |
|
|
|
err = pnfCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId}) |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(1, err, c, "不存在的审批整改项目!") |
|
|
|
return |
|
|
|
} |
|
|
|
if pnfCont.PersonLiable != context.Key { |
|
|
|
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
} else { //定量
|
|
|
|
var pnfCont modelskpi.PostMeteringFlow |
|
|
|
err = pnfCont.GetCont(map[string]interface{}{"`order_id`": receivedValue.OrderId}) |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(1, err, c, "不存在的审批整改项目!") |
|
|
|
return |
|
|
|
} |
|
|
|
if pnfCont.PersonLiable != context.Key { |
|
|
|
publicmethod.Result(1, err, c, "你们不是此考核项整改的责任人!您无权进行此项操作!") |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
//提交整改内容
|
|
|
|
var addRecMeas modelskpi.RectificationMeasures |
|
|
|
addRecMeas.UserKey = context.Key |
|
|
|
addRecMeas.Department = context.MainDeparment |
|
|
|
addRecMeas.Group = context.Company |
|
|
|
addRecMeas.OrderKey = pwoCont.OrderId |
|
|
|
addRecMeas.State = 1 |
|
|
|
addRecMeas.Time = time.Now().Unix() |
|
|
|
addRecMeas.EiteTime = time.Now().Unix() |
|
|
|
addRecMeas.Content = receivedValue.Content |
|
|
|
if len(receivedValue.Enclosure) > 0 { |
|
|
|
enclosure, enclosureErr := json.Marshal(receivedValue.Enclosure) |
|
|
|
if enclosureErr == nil { |
|
|
|
addRecMeas.Enclosure = string(enclosure) //附件
|
|
|
|
} |
|
|
|
} |
|
|
|
err = overall.CONSTANT_DB_KPI.Create(&addRecMeas).Error |
|
|
|
if err != nil { |
|
|
|
publicmethod.Result(104, err, c) |
|
|
|
return |
|
|
|
} |
|
|
|
//发送下一步审批信息
|
|
|
|
stepIng := pwoCont.NextStep |
|
|
|
if stepIng == 0 { |
|
|
|
if pwoCont.CountStep-1 > 0 { |
|
|
|
stepIng = pwoCont.CountStep - 1 |
|
|
|
} else { |
|
|
|
stepIng = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
flowMap, flowOneCont, _ := wechatcallback.GetOneNodeCont(pwoCont.WorkFlow, stepIng) //获取流程图
|
|
|
|
|
|
|
|
nextStep := 0 //下一步执行哪个步骤
|
|
|
|
flowState := 3 //判断流程状态
|
|
|
|
switch flowOneCont.RunType { |
|
|
|
case 1: |
|
|
|
flowState = 3 |
|
|
|
case 2: |
|
|
|
flowState = 3 |
|
|
|
case 3: |
|
|
|
flowState = 4 |
|
|
|
case 4: |
|
|
|
flowState = 4 |
|
|
|
default: |
|
|
|
flowState = 1 |
|
|
|
} |
|
|
|
//判断下一个当前节点是否为最后一个节点
|
|
|
|
if flowState == 4 { |
|
|
|
nextStep = 0 |
|
|
|
} else { |
|
|
|
nextStep = flowOneCont.Step + 1 |
|
|
|
} |
|
|
|
//更新审批流状态
|
|
|
|
syncSeting.Add(1) |
|
|
|
go UpdateStateFlow(pwoCont.Id, nextStep, flowState) |
|
|
|
//更新审批工作流json内容
|
|
|
|
wechatName := context.Wechat |
|
|
|
if context.WorkWechat != "" { |
|
|
|
wechatName = context.WorkWechat |
|
|
|
} |
|
|
|
syncSeting.Add(1) |
|
|
|
go EidtPostFlowLog(pwoCont.Id, flowMap, flowOneCont, wechatName, 2, stepIng) |
|
|
|
|
|
|
|
//获取下一个执行点位
|
|
|
|
var nextClickStep int |
|
|
|
overall.CONSTANT_DB_KPI.Model(&modelskpi.OpenApprovalChangeLog{}).Select("stepper").Where("`orderid` = ?", pwoCont.OrderId).Order("stepper DESC").First(&nextClickStep) |
|
|
|
//执行下一步审批
|
|
|
|
nextClickStep = nextClickStep + 1 |
|
|
|
syncSeting.Add(1) |
|
|
|
go ApproveFlow("kpi", flowMap, flowOneCont, nextClickStep, pwoCont) |
|
|
|
|
|
|
|
var operatorIsTreu modelskpi.OpenApprovalChangeLog |
|
|
|
operatorIsTreu.Type = 2 |
|
|
|
operatorIsTreu.Title = flowOneCont.NodeName |
|
|
|
operatorIsTreu.Operator = context.Key |
|
|
|
operatorIsTreu.OrderId = pwoCont.OrderId |
|
|
|
operatorIsTreu.OperatorTime = time.Now().Unix() |
|
|
|
operatorIsTreu.Step = flowOneCont.Step |
|
|
|
operatorIsTreu.OperatorType = 2 |
|
|
|
operatorIsTreu.Msgid = "" |
|
|
|
operatorIsTreu.ResponseCode = "" |
|
|
|
operatorIsTreu.Stepper = nextClickStep |
|
|
|
operatorIsTreu.ChangeIsTrue = 2 |
|
|
|
operatorIsTreu.YesOrNo = 1 |
|
|
|
operatorIsTreu.Eiteyime = time.Now().Unix() |
|
|
|
overall.CONSTANT_DB_KPI.Create(&operatorIsTreu) |
|
|
|
|
|
|
|
syncSeting.Wait() |
|
|
|
sendMap := publicmethod.MapOut[string]() |
|
|
|
sendMap["flowMap"] = flowMap |
|
|
|
sendMap["flowOneCont"] = flowOneCont |
|
|
|
publicmethod.Result(0, sendMap, c) |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2022-10-09 16:48:09 |
|
|
|
@ 功能: 更新挂号单 |
|
|
|
@ 参数 |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
# |
|
|
|
*/ |
|
|
|
func UpdateRegister(id int64, state int) { |
|
|
|
defer syncSeting.Done() |
|
|
|
var setUpRegister modelskpi.Register |
|
|
|
setUpRegister.EiteCont(map[string]interface{}{"`id`": id}, map[string]interface{}{"`state`": state, "`time`": time.Now().Unix()}) |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 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 := 3 //判断流程状态
|
|
|
|
switch flowOneCont.RunType { |
|
|
|
case 1: |
|
|
|
flowState = 3 |
|
|
|
case 2: |
|
|
|
flowState = 3 |
|
|
|
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 |
|
|
|
pwoCont.EiteCont(map[string]interface{}{"`order_id`": pwoContOld.OrderId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "`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>[填写整改措施](http://new.hxgk.group/#/rectification?id=%v&num=%v)", markDowmStr, pwoContOld.OrderId, registerNum) |
|
|
|
//发送同通信息
|
|
|
|
wechatcallback.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) |
|
|
|
} |
|
|
|
|
|
|
|
wechatcallback.SendButtonCard(systemApp, postTarDeta.Title, postTarDetailsDeta.Title, sunTextCont, fv.NodeName, pwoContOld.OrderId, 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) |
|
|
|
} |
|
|
|
|
|
|
|
wechatcallback.SendButtonCard(systemApp, postShemeCont.Title, postShemeCont.Content, "", fv.NodeName, pwoContOld.OrderId, sendNextStep, sendToUserList, quoteAreaInfo, twoTitleTextList) |
|
|
|
} |
|
|
|
} else { |
|
|
|
//抄送信息
|
|
|
|
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) |
|
|
|
} 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) |
|
|
|
} |
|
|
|
//发送抄送信息
|
|
|
|
wechatcallback.SendNoticeMsg(sendToUserList, markDowmStr, systemApp) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2022-10-09 16:15:56 |
|
|
|
@ 功能: 更新审批流 |
|
|
|
@ 参数 |
|
|
|
|
|
|
|
#pwoId 岗位审批工作流ID |
|
|
|
#flowMap 流程结构体 |
|
|
|
#operatorWechat 操作人 |
|
|
|
#clickEnter 操作 |
|
|
|
#step 执行的哪一步 |
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
# |
|
|
|
*/ |
|
|
|
func EidtPostFlowLog(pwoId int64, flowMap []publicmethod.FlowChartList, oneFlowCont publicmethod.FlowChartList, operatorWechat string, clickEnter, step int) { |
|
|
|
defer syncSeting.Done() |
|
|
|
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 == oneFlowCont.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.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-09 16:09:35 |
|
|
|
@ 功能: 更新审批状态 |
|
|
|
@ 参数 |
|
|
|
|
|
|
|
#pwoId 审批流ID |
|
|
|
#nextStep 下一步 |
|
|
|
#flowState 流程状态 |
|
|
|
|
|
|
|
@ 返回值 |
|
|
|
|
|
|
|
# |
|
|
|
*/ |
|
|
|
func UpdateStateFlow(pwoId int64, nextStep, flowState int) { |
|
|
|
defer syncSeting.Done() |
|
|
|
var pwoCont modelskpi.PostWorkflowOrders |
|
|
|
pwoCont.EiteCont(map[string]interface{}{"`id`": pwoId}, map[string]interface{}{"`next_step`": nextStep, "`state`": flowState, "`time`": time.Now().Unix()}) //改变审批流状态
|
|
|
|
} |
|
|
|
|