|
|
|
|
package qual
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"gin_server_admin/api/wechatapp/sendmessage"
|
|
|
|
|
"gin_server_admin/commonus"
|
|
|
|
|
"gin_server_admin/global"
|
|
|
|
|
"gin_server_admin/model/assessmentmodel"
|
|
|
|
|
"gin_server_admin/model/common/response"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 定性审批解析
|
|
|
|
|
func (a *ApiGroup) Operation(c *gin.Context) {
|
|
|
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
|
|
|
if isTrue != true {
|
|
|
|
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
founderDepartId, _ := strconv.ParseInt(userCont.Deparment, 10, 64)
|
|
|
|
|
|
|
|
|
|
var requestData ApprovalParameters
|
|
|
|
|
err := c.ShouldBindJSON(&requestData)
|
|
|
|
|
if err != nil {
|
|
|
|
|
response.Result(101, err, "参数错误!请重新提交!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if requestData.OrderId == "" {
|
|
|
|
|
response.Result(102, err, "参数错误!请重新提交!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var evalProcessInfo assessmentmodel.EvaluationProcess
|
|
|
|
|
evalErr := global.GVA_DB_Performanceappraisal.Where("ep_order_key = ?", requestData.OrderId).First(&evalProcessInfo).Error
|
|
|
|
|
if evalErr != nil {
|
|
|
|
|
response.Result(103, err, "审批流不存在!请检查您的数据!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if evalProcessInfo.State == 3 || evalProcessInfo.NextStep <= 0 {
|
|
|
|
|
response.Result(104, err, "该流程已结束!不可进行操作!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if evalProcessInfo.NextContent == "" {
|
|
|
|
|
response.Result(105, err, "对不起!您没有权限对此流程进行操作!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
nextReplyUserMap := strings.Split(evalProcessInfo.NextExecutor, ",")
|
|
|
|
|
// fmt.Printf("userCont.Key:%v\n", userCont.Key)
|
|
|
|
|
if commonus.IsItTrueString(userCont.Key, nextReplyUserMap) == false {
|
|
|
|
|
response.Result(106, nextReplyUserMap, "对不起!您没有权限对此流程进行操作!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//2、获取审批单信息
|
|
|
|
|
var scoreFlowInfo assessmentmodel.ScoreFlow
|
|
|
|
|
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", requestData.OrderId).First(&scoreFlowInfo).Error
|
|
|
|
|
if judegFlowErr != nil {
|
|
|
|
|
response.Result(107, err, "对不起!此审批流程已经关闭!请联系发起人!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//获取考核项目内容
|
|
|
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
|
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
|
|
|
|
|
if judgeProgramme != nil {
|
|
|
|
|
response.Result(105, programme, "未知考核项目!请检查你的提交是否正确!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//确定标题
|
|
|
|
|
var title string = ""
|
|
|
|
|
//一级标题副本内容
|
|
|
|
|
var desc string = ""
|
|
|
|
|
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则
|
|
|
|
|
if detailedTargetErr == true {
|
|
|
|
|
tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息
|
|
|
|
|
if tarErr == true {
|
|
|
|
|
title = tarInf.Title //一级标题,建议不超过36个字
|
|
|
|
|
desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字
|
|
|
|
|
} else {
|
|
|
|
|
title = detailedTargetCont.Title //一级标题,建议不超过36个字
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息
|
|
|
|
|
if tarErr == true {
|
|
|
|
|
title = tarInf.Title //一级标题,建议不超过36个字
|
|
|
|
|
} else {
|
|
|
|
|
title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var quoteAreaTitle string //引用文献标题
|
|
|
|
|
|
|
|
|
|
orderIdInt, _ := strconv.ParseInt(requestData.OrderId, 10, 64) //流程Key
|
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64) //使用人KEY
|
|
|
|
|
|
|
|
|
|
sendScVal := float64(scoreFlowInfo.Score) / 100
|
|
|
|
|
scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64)
|
|
|
|
|
|
|
|
|
|
outMap := commonus.MapOut()
|
|
|
|
|
if requestData.YesOrNo != 1 {
|
|
|
|
|
//驳回
|
|
|
|
|
opinionCont := "不同意"
|
|
|
|
|
if requestData.Content != "" {
|
|
|
|
|
opinionCont = requestData.Content
|
|
|
|
|
}
|
|
|
|
|
// //执行原因
|
|
|
|
|
var reason string
|
|
|
|
|
switch evalProcessInfo.NextStep {
|
|
|
|
|
case 0:
|
|
|
|
|
response.Result(104, err, "该流程已结束!不可进行操作!", c)
|
|
|
|
|
return
|
|
|
|
|
case 1:
|
|
|
|
|
//申请
|
|
|
|
|
case 2:
|
|
|
|
|
//申请人部门负责人
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 3, 2, userCont.Key) //审批步骤处理
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(2), opinionCont) //写入审批流
|
|
|
|
|
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 3
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
|
|
|
|
|
reason = fmt.Sprintf("审批意见:%v\n", opinionCont)
|
|
|
|
|
|
|
|
|
|
//获取发起人信息
|
|
|
|
|
var sendUser string = ""
|
|
|
|
|
var sendUserAry []string
|
|
|
|
|
faQiRen, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": scoreFlowInfo.EvaluationUser}, "`wechat`", "`work_wechat`")
|
|
|
|
|
if faQiRen.Wechat != "" {
|
|
|
|
|
sendUser = faQiRen.Wechat
|
|
|
|
|
}
|
|
|
|
|
if faQiRen.WorkWechat != "" {
|
|
|
|
|
sendUser = faQiRen.WorkWechat
|
|
|
|
|
}
|
|
|
|
|
if sendUser != "" {
|
|
|
|
|
sendUserAry = append(sendUserAry, sendUser)
|
|
|
|
|
}
|
|
|
|
|
sendUserList := strings.Join(sendUserAry, "|")
|
|
|
|
|
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
|
|
|
|
|
if scoreFlowInfo.PlusReduceScore != 1 {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
} else {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrlTitle := "查看详情"
|
|
|
|
|
sourceDesc := "驳回"
|
|
|
|
|
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 2
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
//接受考核部门内勤(责任划分)
|
|
|
|
|
case 4:
|
|
|
|
|
//接受考核部门负责人(责任划分确认)
|
|
|
|
|
|
|
|
|
|
//申请人部门负责人
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 3, 1, 3, 4, userCont.Key)
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(3), opinionCont) //写入审批流
|
|
|
|
|
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 3
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
|
|
|
|
|
//判断是加分还是减分
|
|
|
|
|
if scoreFlowInfo.PlusReduceScore != 1 {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
} else {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
}
|
|
|
|
|
//获取责任划分
|
|
|
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(requestData.OrderId, 2)
|
|
|
|
|
if teamErr == nil {
|
|
|
|
|
for _, team_v := range teamBility {
|
|
|
|
|
if team_v["type"] != 3 {
|
|
|
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
|
|
|
|
|
} else {
|
|
|
|
|
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reason = fmt.Sprintf("驳回原因:%v\n", opinionCont)
|
|
|
|
|
|
|
|
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
|
|
|
if sendUserIsTrue != true {
|
|
|
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成唯一编号
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderIdInt)
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrlTitle := "请前往处理"
|
|
|
|
|
sourceDesc := "驳回"
|
|
|
|
|
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 2
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
//主要责任人整改(提交)
|
|
|
|
|
case 6:
|
|
|
|
|
//接受考核部门负责人(整改确认)
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 5, 1, 3, 6, userCont.Key)
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 3, commonus.GetSetpName(5), opinionCont) //写入审批流
|
|
|
|
|
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 3
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
//获取主要责任人
|
|
|
|
|
var personLiable []string
|
|
|
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(requestData.OrderId, 1)
|
|
|
|
|
if teamErr == nil {
|
|
|
|
|
for _, tm_v := range teamBility {
|
|
|
|
|
if tm_v["type"] == 1 {
|
|
|
|
|
personLiable = append(personLiable, tm_v["wechatid"].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(personLiable) < 1 {
|
|
|
|
|
response.Result(0, personLiable, "未指定相关部门处理人!未能向相关人员发送考核项目!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
sendUserList := strings.Join(personLiable, "|")
|
|
|
|
|
|
|
|
|
|
//判断是加分还是减分
|
|
|
|
|
if scoreFlowInfo.PlusReduceScore != 1 {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
} else {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reason = fmt.Sprintf("驳回原因:%v\n", opinionCont)
|
|
|
|
|
|
|
|
|
|
//生成唯一编号
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderIdInt)
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrlTitle := "请前往处理"
|
|
|
|
|
sourceDesc := "驳回"
|
|
|
|
|
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 2
|
|
|
|
|
case 7:
|
|
|
|
|
//发起人验收
|
|
|
|
|
default:
|
|
|
|
|
response.Result(404, err, "未知操作!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
opinionCont := "同意"
|
|
|
|
|
if requestData.Content != "" {
|
|
|
|
|
opinionCont = requestData.Content
|
|
|
|
|
}
|
|
|
|
|
//执行原因
|
|
|
|
|
reason := fmt.Sprintf("审批意见:%v\n", opinionCont)
|
|
|
|
|
|
|
|
|
|
//同意
|
|
|
|
|
switch evalProcessInfo.NextStep {
|
|
|
|
|
case 0:
|
|
|
|
|
response.Result(104, err, "该流程已结束!不可进行操作!", c)
|
|
|
|
|
return
|
|
|
|
|
case 1:
|
|
|
|
|
//申请
|
|
|
|
|
case 2:
|
|
|
|
|
//申请人部门负责人
|
|
|
|
|
|
|
|
|
|
//判断是加分还是减分
|
|
|
|
|
if scoreFlowInfo.PlusReduceScore == 1 {
|
|
|
|
|
//加分
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 1, 2, 2, userCont.Key) //审批步骤处理
|
|
|
|
|
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(2), opinionCont) //写入审批流
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow)
|
|
|
|
|
} else {
|
|
|
|
|
//减分
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, userCont.Key) //审批步骤处理
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), opinionCont) //写入审批流
|
|
|
|
|
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", requestData.OrderId).Updates(&eiteScoreFlow)
|
|
|
|
|
|
|
|
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|
|
|
|
if sendUserIsTrue != true {
|
|
|
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//将步骤写入 判断该步骤是否已经操作
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
//审批卡片跳转链接
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrlTitle := "请前往划分责任人"
|
|
|
|
|
sourceDesc := "责任划分"
|
|
|
|
|
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 2
|
|
|
|
|
// fmt.Printf("sendClick----->%v\n", outMap)
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
//接受考核部门内勤(责任划分)
|
|
|
|
|
case 4:
|
|
|
|
|
//接受考核部门负责人(责任划分确认)
|
|
|
|
|
if scoreFlowInfo.PlusReduceScore == 1 {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
} else {
|
|
|
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
|
|
|
}
|
|
|
|
|
//是否需要整改
|
|
|
|
|
if scoreFlowInfo.Rectification == 1 {
|
|
|
|
|
//需要整改
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 2, 4, userCont.Key)
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(7), opinionCont) //写入审批流
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", orderIdInt).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 2
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
//步骤内容写入
|
|
|
|
|
|
|
|
|
|
//获取主要责任人
|
|
|
|
|
var personLiable []string
|
|
|
|
|
teamBility, teamErr := commonus.GetDivisionOfResponsibility(requestData.OrderId, 1)
|
|
|
|
|
if teamErr == nil {
|
|
|
|
|
for _, tm_v := range teamBility {
|
|
|
|
|
if tm_v["type"] == 1 {
|
|
|
|
|
personLiable = append(personLiable, tm_v["wechatid"].(string))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if len(personLiable) < 1 {
|
|
|
|
|
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
|
|
|
|
|
}
|
|
|
|
|
sendUserList := strings.Join(personLiable, "|")
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//将步骤写入 判断该步骤是否已经操作
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
//审批卡片跳转链接
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
|
|
|
|
|
jumpUrlTitle := "查看详情"
|
|
|
|
|
sourceDesc := "整改通知"
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 41
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
//不要整改
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 0, 2, 1, 2, 4, userCont.Key)
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(2), opinionCont) //写入审批流
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", orderIdInt).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 3
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
|
|
|
|
|
//获取发起人信息
|
|
|
|
|
var sendUser string = ""
|
|
|
|
|
// faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
|
|
|
|
|
faQiRen, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": scoreFlowInfo.EvaluationUser}, "`wechat`", "`work_wechat`")
|
|
|
|
|
if faQiRen.Wechat != "" {
|
|
|
|
|
sendUser = faQiRen.Wechat
|
|
|
|
|
}
|
|
|
|
|
if faQiRen.WorkWechat != "" {
|
|
|
|
|
sendUser = faQiRen.WorkWechat
|
|
|
|
|
}
|
|
|
|
|
//将步骤写入 判断该步骤是否已经操作
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
//审批卡片跳转链接
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//抄送发起人
|
|
|
|
|
if sendUser != "" {
|
|
|
|
|
jumpUrlTitle := "查看详情"
|
|
|
|
|
sourceDesc := "抄送"
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendUser, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 41
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
//主要责任人整改(提交)
|
|
|
|
|
case 6:
|
|
|
|
|
//接受考核部门负责人(整改确认)
|
|
|
|
|
commonus.StepAddData(orderIdInt, 16182159043990656, 0, 7, 1, 2, 6, userCont.Key)
|
|
|
|
|
commonus.WriteReplyLog(orderIdInt, scoreFlowInfo.DutyDepartment, founderDepartId, userKeyInt, 2, commonus.GetSetpName(7), opinionCont) //写入审批流
|
|
|
|
|
|
|
|
|
|
//修改定性审批流状态
|
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
|
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
|
|
|
eiteScoreFlow["sf_reply"] = 3
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", orderIdInt).Updates(&eiteScoreFlow)
|
|
|
|
|
evalProcSaveData := commonus.MapOut()
|
|
|
|
|
evalProcSaveData["ep_state"] = 3
|
|
|
|
|
evalProcSaveData["ep_time"] = time.Now().Unix()
|
|
|
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderIdInt).Updates(&evalProcSaveData)
|
|
|
|
|
|
|
|
|
|
//2、获取要抄送人员名单
|
|
|
|
|
var sendUserAry []string
|
|
|
|
|
//2.1 获取发起人部门负责人
|
|
|
|
|
launchUserIsTrue, launchUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.EvaluationDepartment) //获取发起人部门负责人
|
|
|
|
|
if launchUserIsTrue == true {
|
|
|
|
|
for _, lau_v := range launchUserList {
|
|
|
|
|
sendUserAry = append(sendUserAry, lau_v)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//2.2、获取职责部门负责人
|
|
|
|
|
dutyUserIsTrue, dutyUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.DutyDepartment) //获取职责部门负责人
|
|
|
|
|
if dutyUserIsTrue == true {
|
|
|
|
|
for _, duty_v := range dutyUserList {
|
|
|
|
|
sendUserAry = append(sendUserAry, duty_v)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//2.3、获取发起人信息
|
|
|
|
|
var sendUser string = ""
|
|
|
|
|
// faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
|
|
|
|
|
faQiRen, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": scoreFlowInfo.EvaluationUser}, "`wechat`", "`work_wechat`")
|
|
|
|
|
if faQiRen.Wechat != "" {
|
|
|
|
|
sendUser = faQiRen.Wechat
|
|
|
|
|
}
|
|
|
|
|
if faQiRen.WorkWechat != "" {
|
|
|
|
|
sendUser = faQiRen.WorkWechat
|
|
|
|
|
}
|
|
|
|
|
if sendUser != "" {
|
|
|
|
|
sendUserAry = append(sendUserAry, sendUser)
|
|
|
|
|
}
|
|
|
|
|
sendMsgToUserList := strings.Join(sendUserAry, "|")
|
|
|
|
|
|
|
|
|
|
twoLevelKeyName := ""
|
|
|
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(founderDepartId)
|
|
|
|
|
if execDerpatErr == nil {
|
|
|
|
|
twoLevelKeyName = execDerpat.Name
|
|
|
|
|
}
|
|
|
|
|
var twoLevelKeyValue string = ""
|
|
|
|
|
var twoLevelUserId string = ""
|
|
|
|
|
//获取操作人
|
|
|
|
|
if userCont.Wechat != "" {
|
|
|
|
|
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.Wechat)
|
|
|
|
|
if userWechatErr == true {
|
|
|
|
|
twoLevelKeyValue = userWechat.Name
|
|
|
|
|
twoLevelUserId = userCont.Wechat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//将步骤写入 判断该步骤是否已经操作
|
|
|
|
|
registerNumber := commonus.GetFileNumberEs()
|
|
|
|
|
var registerCont assessmentmodel.Register
|
|
|
|
|
registerCont.Number = registerNumber
|
|
|
|
|
registerCont.State = 1
|
|
|
|
|
registerCont.Time = time.Now().Unix()
|
|
|
|
|
registerCont.AddCont()
|
|
|
|
|
//审批卡片跳转链接
|
|
|
|
|
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", orderIdInt, strconv.FormatInt(registerNumber, 10))
|
|
|
|
|
|
|
|
|
|
jumpUrlTitle := "查看详情"
|
|
|
|
|
sourceDesc := "抄送"
|
|
|
|
|
twoLevelTitle := "审批信息:"
|
|
|
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
|
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(sendMsgToUserList, strconv.FormatInt(registerNumber, 10), title, desc, quoteAreaTitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
|
|
|
|
|
outMap["callbakcMsg"] = string(callbakcMsg)
|
|
|
|
|
outMap["isTrueCall"] = isTrueCall
|
|
|
|
|
outMap["callBackCont"] = callBackCont
|
|
|
|
|
outMap["setval"] = 41
|
|
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
|
//发起人验收
|
|
|
|
|
default:
|
|
|
|
|
response.Result(404, err, "未知操作!", c)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
response.Result(0, outMap, "审批成功!", c)
|
|
|
|
|
|
|
|
|
|
}
|