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.
656 lines
28 KiB
656 lines
28 KiB
package evaluation
|
|
|
|
import (
|
|
"encoding/json"
|
|
"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 (e *EvaluationInterface) PlusOrMinusPointsNewYuan(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
var requestData addPlusOrMinusPoints
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(102, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
if requestData.PlanId == "" {
|
|
response.Result(103, requestData, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
planIdInt, planIdIntErr := strconv.ParseInt(requestData.PlanId, 10, 64)
|
|
if planIdIntErr != nil {
|
|
response.Result(104, requestData, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
//获取考核项目内容
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planIdInt).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
response.Result(105, programme, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
if requestData.Type == 0 {
|
|
response.Result(106, requestData, "请问您是要进行加分还是减分?请指定,谢谢!", c)
|
|
return
|
|
}
|
|
countFrequency := 1
|
|
if requestData.Count != 0 {
|
|
countFrequency = requestData.Count
|
|
}
|
|
switch requestData.State {
|
|
case 2, 3:
|
|
if requestData.Score == "" {
|
|
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
|
|
return
|
|
}
|
|
tijaoFenshu := commonus.GetDuyCycle(requestData.Score, 100)
|
|
if tijaoFenshu > programme.MaxScore {
|
|
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最大值:%v)!", float64(programme.MaxScore)/100), c)
|
|
return
|
|
}
|
|
if tijaoFenshu < programme.MinScore {
|
|
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最小值:%v)!", float64(programme.MinScore)/100), c)
|
|
return
|
|
}
|
|
case 1:
|
|
//获取分数
|
|
requestData.Score = strconv.FormatInt(programme.MaxScore, 10)
|
|
default:
|
|
if requestData.Score == "" {
|
|
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
|
|
return
|
|
}
|
|
}
|
|
if requestData.Reason == "" {
|
|
response.Result(108, requestData, "请输入您的原因,谢谢!", c)
|
|
return
|
|
}
|
|
if requestData.Addtime == "" {
|
|
response.Result(108, requestData, "请输入您的检查时间,谢谢!", c)
|
|
return
|
|
}
|
|
if requestData.Rectification == 0 {
|
|
requestData.Rectification = 2
|
|
}
|
|
var correctionTime int64 = 0
|
|
if requestData.Rectification == 1 {
|
|
if requestData.CorrectionTime == "" {
|
|
response.Result(108, requestData, "请输入整改期限,谢谢!", c)
|
|
return
|
|
}
|
|
var corrTimeErr bool = false
|
|
correctionTime, corrTimeErr = commonus.DateToTimeStampEs(requestData.CorrectionTime)
|
|
if corrTimeErr == false {
|
|
response.Result(108, requestData, "请输入整改期限时间格式不对,谢谢!", c)
|
|
return
|
|
}
|
|
}
|
|
operationTime := time.Now().Unix()
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
var addScore assessmentmodel.ScoreFlow
|
|
addScore.EvaluationPlan = planIdInt //考核方案项目ID
|
|
addScore.PlusReduceScore = requestData.Type //1:加分;2:减分
|
|
addScore.PlanVersion = requestData.PlanVersionNumber
|
|
//分值转化
|
|
scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100)
|
|
|
|
addScore.Score = scoreStringToInt64 //分值(乘100录入)
|
|
addScore.Key = keyNumber //识别标志
|
|
addScore.Reason = requestData.Reason //操作原因
|
|
addScore.Time = operationTime
|
|
addScore.EiteTime = operationTime
|
|
addScore.Count = countFrequency //发生次数
|
|
|
|
timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间
|
|
addScore.HappenTime = timeOccurrence
|
|
// addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间
|
|
departmentId, departmentIdErr := strconv.ParseInt(userCont.MainDeparment, 10, 64)
|
|
if departmentIdErr == nil {
|
|
addScore.EvaluationDepartment = departmentId //测评部门
|
|
}
|
|
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
|
|
if userKeyErr == nil {
|
|
addScore.EvaluationUser = userKey //测评人
|
|
}
|
|
userGroup, userGroupErr := strconv.ParseInt(userCont.Company, 10, 64)
|
|
if userGroupErr == nil {
|
|
addScore.EvaluationGroup = userGroup //测评集团
|
|
}
|
|
//获取拆分时间节
|
|
addScore.Year = commonus.ComputingTime(timeOccurrence, 1)
|
|
addScore.Quarter = commonus.ComputingTime(timeOccurrence, 2)
|
|
addScore.Month = commonus.ComputingTime(timeOccurrence, 3)
|
|
addScore.Week = commonus.ComputingTime(timeOccurrence, 4)
|
|
// addScore.Year = commonus.ComputingTime(operationTime, 1)
|
|
// addScore.Quarter = commonus.ComputingTime(operationTime, 2)
|
|
// addScore.Month = commonus.ComputingTime(operationTime, 3)
|
|
// addScore.Week = commonus.ComputingTime(operationTime, 4)
|
|
if len(requestData.Enclosure) > 0 {
|
|
enclosure, enclosureErr := json.Marshal(requestData.Enclosure)
|
|
if enclosureErr == nil {
|
|
addScore.Enclosure = string(enclosure) //附件
|
|
}
|
|
}
|
|
|
|
addScore.DutyGroup = programme.Group //职责集团
|
|
addScore.DutyDepartment = programme.AcceptEvaluation //职责部门
|
|
addScore.Rectification = requestData.Rectification //1、需要整改;2:无需整改
|
|
addScore.Reply = 1
|
|
addScore.CorrectionTime = correctionTime
|
|
addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error
|
|
//步进内容
|
|
|
|
if addErr != nil {
|
|
response.Result(109, addErr, "数据写入失败", c)
|
|
return
|
|
}
|
|
myIsTrue := 1
|
|
|
|
//流程审批相关
|
|
//生成唯一编号
|
|
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", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
// jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
|
|
// jumpUrlTitle := "请前往处理"
|
|
// sourceDesc := commonus.GetSetpName(2)
|
|
|
|
//获取通知人信息
|
|
//1、获取发起人部门负责人
|
|
var officWorkUserList string
|
|
founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64)
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人
|
|
if sendUserIsTrue != true {
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c)
|
|
return
|
|
}
|
|
|
|
for _, v := range sendUserList {
|
|
if v == userCont.Wechat {
|
|
myIsTrue = 2
|
|
}
|
|
}
|
|
|
|
fmt.Printf("userCont.Wechat====>%v------------>myIsTrue:%v------------>sendUserList:%v\n", userCont.Wechat, myIsTrue, sendUserList)
|
|
|
|
officWorkUserList = strings.Join(sendUserList, "|")
|
|
|
|
//确定标题
|
|
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个字
|
|
}
|
|
}
|
|
//执行原因
|
|
reason := fmt.Sprintf("原因:%v\n", requestData.Reason)
|
|
|
|
twoLevelKeyName := ""
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId)
|
|
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
|
|
}
|
|
}
|
|
twoLevelTitle := "考核上报部门:"
|
|
//分数
|
|
sendScore := scoreStringToInt64 * int64(countFrequency)
|
|
sendScVal := float64(sendScore) / 100
|
|
scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64)
|
|
outMap := commonus.MapOut()
|
|
var quoteAreaTitle string //引用文献标题
|
|
if requestData.Type != 1 {
|
|
//减分
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
if myIsTrue != 1 {
|
|
//申请人也是部门负责人
|
|
commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
|
|
commonus.StepAddData(keyNumber, 16182159043990656, 3, 2, 1, 2, 2, userCont.Key)
|
|
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), "同意")
|
|
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
return
|
|
}
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, 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"] = 1
|
|
|
|
//修改定性审批流状态
|
|
eiteScoreFlow := commonus.MapOut()
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).Updates(&eiteScoreFlow)
|
|
} else {
|
|
//申请人不是是部门负责人 给本部门负责人发送审批
|
|
commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "审核"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, 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
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
/*func WriteReplyLog(orderId, acceptDepartment, launchDepartment, launchUser, state int64, title, content string)
|
|
@orderId 审批单key
|
|
@title 节点名称
|
|
@acceptDepartment 接受考核部门
|
|
@launchDepartment 发起考核部门
|
|
@launchUser 考核发起人
|
|
@state 申请单当前审批状态:1-审批中;2-已通过;3-已驳回;4-已取消
|
|
@content 意见
|
|
*/
|
|
}
|
|
} else {
|
|
//加分
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "审核"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, 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"] = 3
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
}
|
|
|
|
response.Result(0, outMap, "数据写入成功", c)
|
|
}
|
|
|
|
// 加减分
|
|
func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
var requestData addPlusOrMinusPoints
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(102, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
// fmt.Printf("%v\n", requestData)
|
|
if requestData.PlanId == "" {
|
|
response.Result(103, requestData, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
planIdInt, planIdIntErr := strconv.ParseInt(requestData.PlanId, 10, 64)
|
|
if planIdIntErr != nil {
|
|
response.Result(104, requestData, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
//获取考核项目内容
|
|
var programme assessmentmodel.QualitativeEvaluation
|
|
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planIdInt).First(&programme).Error
|
|
if judgeProgramme != nil {
|
|
response.Result(105, programme, "未知考核项目!请检查你的提交是否正确!", c)
|
|
return
|
|
}
|
|
if requestData.Type == 0 {
|
|
response.Result(106, requestData, "请问您是要进行加分还是减分?请指定,谢谢!", c)
|
|
return
|
|
}
|
|
countFrequency := 1
|
|
if requestData.Count != 0 {
|
|
countFrequency = requestData.Count
|
|
}
|
|
switch requestData.State {
|
|
case 2, 3:
|
|
if requestData.Score == "" {
|
|
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
|
|
return
|
|
}
|
|
tijaoFenshu := commonus.GetDuyCycle(requestData.Score, 100)
|
|
if tijaoFenshu > programme.MaxScore {
|
|
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最大值:%v)!", float64(programme.MaxScore)/100), c)
|
|
return
|
|
}
|
|
if tijaoFenshu < programme.MinScore {
|
|
response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最小值:%v)!", float64(programme.MinScore)/100), c)
|
|
return
|
|
}
|
|
case 1:
|
|
//获取分数
|
|
xiaoshufen := strconv.FormatFloat(float64(programme.MaxScore)/100, 'f', -1, 64)
|
|
// requestData.Score = strconv.FormatInt(programme.MaxScore, 10)
|
|
requestData.Score = xiaoshufen
|
|
default:
|
|
if requestData.Score == "" {
|
|
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
|
|
return
|
|
}
|
|
}
|
|
if requestData.Reason == "" {
|
|
response.Result(108, requestData, "请输入您的原因,谢谢!", c)
|
|
return
|
|
}
|
|
if requestData.Addtime == "" {
|
|
response.Result(108, requestData, "请输入您的检查时间,谢谢!", c)
|
|
return
|
|
}
|
|
if requestData.Rectification == 0 {
|
|
requestData.Rectification = 2
|
|
}
|
|
var correctionTime int64 = 0
|
|
if requestData.Rectification == 1 {
|
|
if requestData.CorrectionTime == "" {
|
|
response.Result(108, requestData, "请输入整改期限,谢谢!", c)
|
|
return
|
|
}
|
|
var corrTimeErr bool = false
|
|
correctionTime, corrTimeErr = commonus.DateToTimeStampEs(requestData.CorrectionTime)
|
|
if corrTimeErr == false {
|
|
response.Result(108, requestData, "请输入整改期限时间格式不对,谢谢!", c)
|
|
return
|
|
}
|
|
}
|
|
operationTime := time.Now().Unix()
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
var addScore assessmentmodel.ScoreFlow
|
|
addScore.EvaluationPlan = planIdInt //考核方案项目ID
|
|
addScore.PlusReduceScore = requestData.Type //1:加分;2:减分
|
|
addScore.PlanVersion = requestData.PlanVersionNumber
|
|
//分值转化
|
|
scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100)
|
|
fmt.Printf("分值转化----------->%v------------->%v\n", requestData.Score, scoreStringToInt64)
|
|
addScore.Score = scoreStringToInt64 //分值(乘100录入)
|
|
addScore.Key = keyNumber //识别标志
|
|
addScore.Reason = requestData.Reason //操作原因
|
|
addScore.Time = operationTime
|
|
addScore.EiteTime = operationTime
|
|
addScore.Count = countFrequency //发生次数
|
|
|
|
timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间
|
|
if timeOccurrence < 0 {
|
|
addTimeStr := fmt.Sprintf("%v:00", requestData.Addtime)
|
|
timeOccurrence = commonus.DateToTimeStamp(addTimeStr)
|
|
}
|
|
addScore.HappenTime = timeOccurrence
|
|
// addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间
|
|
departmentId, departmentIdErr := strconv.ParseInt(userCont.MainDeparment, 10, 64)
|
|
if departmentIdErr == nil {
|
|
addScore.EvaluationDepartment = departmentId //测评部门
|
|
}
|
|
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
|
|
if userKeyErr == nil {
|
|
addScore.EvaluationUser = userKey //测评人
|
|
}
|
|
userGroup, userGroupErr := strconv.ParseInt(userCont.Company, 10, 64)
|
|
if userGroupErr == nil {
|
|
addScore.EvaluationGroup = userGroup //测评集团
|
|
}
|
|
//获取拆分时间节
|
|
addScore.Year = commonus.ComputingTime(timeOccurrence, 1)
|
|
addScore.Quarter = commonus.ComputingTime(timeOccurrence, 2)
|
|
addScore.Month = commonus.ComputingTime(timeOccurrence, 3)
|
|
addScore.Week = commonus.ComputingTime(timeOccurrence, 4)
|
|
// addScore.Year = commonus.ComputingTime(operationTime, 1)
|
|
// addScore.Quarter = commonus.ComputingTime(operationTime, 2)
|
|
// addScore.Month = commonus.ComputingTime(operationTime, 3)
|
|
// addScore.Week = commonus.ComputingTime(operationTime, 4)
|
|
if len(requestData.Enclosure) > 0 {
|
|
enclosure, enclosureErr := json.Marshal(requestData.Enclosure)
|
|
if enclosureErr == nil {
|
|
addScore.Enclosure = string(enclosure) //附件
|
|
}
|
|
}
|
|
|
|
addScore.DutyGroup = programme.Group //职责集团
|
|
addScore.DutyDepartment = programme.AcceptEvaluation //职责部门
|
|
addScore.Rectification = requestData.Rectification //1、需要整改;2:无需整改
|
|
addScore.Reply = 1
|
|
addScore.CorrectionTime = correctionTime
|
|
addScore.TargetId = programme.Target
|
|
addScore.DetailedId = programme.DetailedTarget
|
|
|
|
addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error
|
|
//步进内容
|
|
|
|
if addErr != nil {
|
|
response.Result(109, addErr, "数据写入失败", c)
|
|
return
|
|
}
|
|
myIsTrue := 1
|
|
|
|
//流程审批相关
|
|
//生成唯一编号
|
|
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", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
// jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
|
|
// jumpUrlTitle := "请前往处理"
|
|
// sourceDesc := commonus.GetSetpName(2)
|
|
|
|
//获取通知人信息
|
|
//1、获取发起人部门负责人
|
|
var officWorkUserList string
|
|
founderDepartId, _ := strconv.ParseInt(userCont.MainDeparment, 10, 64)
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人
|
|
if sendUserIsTrue != true {
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c)
|
|
return
|
|
}
|
|
|
|
for _, v := range sendUserList {
|
|
if v == userCont.Wechat {
|
|
myIsTrue = 2
|
|
}
|
|
}
|
|
|
|
// fmt.Printf("userCont.Wechat====>%v------------>myIsTrue:%v------------>sendUserList:%v\n", userCont.Wechat, myIsTrue, sendUserList)
|
|
|
|
officWorkUserList = strings.Join(sendUserList, "|")
|
|
|
|
//确定标题
|
|
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个字
|
|
}
|
|
}
|
|
//执行原因
|
|
reason := fmt.Sprintf("原因:%v\n", requestData.Reason)
|
|
|
|
twoLevelKeyName := ""
|
|
execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId)
|
|
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
|
|
}
|
|
}
|
|
twoLevelTitle := "考核上报部门:"
|
|
//分数
|
|
sendScore := scoreStringToInt64 * int64(countFrequency)
|
|
sendScVal := float64(sendScore) / 100
|
|
scoreFloat64ToStringsss := strconv.FormatFloat(sendScVal, 'f', -1, 64)
|
|
outMap := commonus.MapOut()
|
|
var quoteAreaTitle string //引用文献标题
|
|
if requestData.Type != 1 {
|
|
//减分
|
|
quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", scoreFloat64ToStringsss)
|
|
if myIsTrue != 1 {
|
|
//申请人也是部门负责人
|
|
commonus.StepAddDataEs(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
|
|
commonus.StepAddData(keyNumber, 16182159043990656, 3, 2, 1, 2, 2, userCont.Key)
|
|
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(2), "同意")
|
|
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
|
|
if sendUserIsTrue != true {
|
|
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
return
|
|
}
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", keyNumber, 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"] = 1
|
|
|
|
//修改定性审批流状态
|
|
eiteScoreFlow := commonus.MapOut()
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).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` = ?", keyNumber).Updates(&evalProcSaveData)
|
|
} else {
|
|
//申请人不是是部门负责人 给本部门负责人发送审批
|
|
commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "审核"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, 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
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).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` = ?", keyNumber).Updates(&evalProcSaveData)
|
|
}
|
|
} else {
|
|
//加分
|
|
quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", scoreFloat64ToStringsss)
|
|
commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure, timeOccurrence)
|
|
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v&num=%v", keyNumber, strconv.FormatInt(registerNumber, 10))
|
|
jumpUrlTitle := "请前往处理"
|
|
sourceDesc := "审核"
|
|
var sendTextMsg sendmessage.TextNoticeTemplateMedium
|
|
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendMsgTextShare(officWorkUserList, 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"] = 3
|
|
|
|
userKeyInt, _ := strconv.ParseInt(userCont.Key, 10, 64)
|
|
commonus.WriteReplyLog(keyNumber, programme.AcceptEvaluation, founderDepartId, userKeyInt, 1, commonus.GetSetpName(1), "")
|
|
|
|
eiteScoreFlow := commonus.MapOut()
|
|
eiteScoreFlow["sf_eite_time"] = time.Now().Unix()
|
|
eiteScoreFlow["sf_reply"] = 2
|
|
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", keyNumber).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` = ?", keyNumber).Updates(&evalProcSaveData)
|
|
}
|
|
|
|
response.Result(0, outMap, "数据写入成功", c)
|
|
}
|
|
|