dddd
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.
 
 
 
 
 

691 lines
25 KiB

package evaluation
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/archiveapi"
"github.com/flipped-aurora/gin-vue-admin/server/api/wechatapp/sendmessage"
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/gin-gonic/gin"
)
//个人要执行的考核任务
func (e *EvaluationInterface) Index(c *gin.Context) {
outPut := commonus.MapOut()
response.Result(0, outPut, "用户端个人要执行的考核任务", c)
}
//获取定性考核任务列表
func (e *EvaluationInterface) QualitativeEvaluation(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
// var qualEvaList []assessmentmodel.QualitativeEvaluation
// var detailsId []int64
// listErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Group("qe_accept_evaluation").Find(&detailsId).Error
// if listErr != nil || len(detailsId) < 1 {
// response.Result(102, isTrue, "您没有要参加的考核项目!", c)
// return
// }
// response.Result(0, detailsId, "用户端个人要执行的考核任务", c)
var qualEvaList []assessmentmodel.QualitativeEvaluation
listErr := global.GVA_DB_Performanceappraisal.Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error
if listErr != nil || len(qualEvaList) < 1 {
response.Result(102, isTrue, "您没有要参加的考核项目!", c)
return
}
var uotContAry []TargetContOutCont
for _, v := range qualEvaList {
var uotCont TargetContOutCont
uotCont.Id = strconv.FormatInt(v.Id, 10)
uotCont.Type = v.Type
uotCont.Group = strconv.FormatInt(v.Group, 10)
groupErr, groupCont := commonus.GetGroupCont(v.Group)
if groupErr == true {
uotCont.GroupNAme = groupCont.Name
}
uotCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10)
deparConErr, deparConCont := commonus.GetBranchFactory(v.AcceptEvaluation)
if deparConErr == true {
uotCont.DepartmentName = deparConCont.Name
}
uotCont.Dimension = strconv.FormatInt(v.Dimension, 10)
dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(v.Dimension)
if dutyClassErr == true {
uotCont.DimensionName = dutyClassCont.Title
}
uotCont.Target = strconv.FormatInt(v.Target, 10)
targetInfo, targetErr := commonus.GetTargetInfo(v.Target)
if targetErr == true {
uotCont.TargetName = targetInfo.Title
}
uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10)
info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun)
if infoErr == true {
uotCont.TargetSunName = info.Title
}
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(v.DetailedTarget)
if dtIsTrue == true {
uotCont.DetailedTargetName = dtCont.Title
uotCont.Content = dtCont.Content
}
uotCont.Unit = v.Unit
uotCont.ReferenceScore = v.ReferenceScore
uotCont.Cycles = v.Cycles
uotCont.CycleAttres = v.CycleAttres
uotCont.State = v.State
userAry := strings.Split(v.Operator, ",")
uotCont.UserList = userAry
for _, u_v := range userAry {
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": u_v})
if usErr == true {
var userCont QualEvalArrt
userCont.Id = u_v
userCont.Name = usCont.Name
uotCont.UserListAry = append(uotCont.UserListAry, userCont)
}
}
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10)
uotContAry = append(uotContAry, uotCont)
}
response.Result(0, uotContAry, "用户端个人要执行的考核任务", c)
}
//添加扣分或加分选项
func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, 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
}
if requestData.Score == 0 {
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c)
return
}
if requestData.Reason == "" {
response.Result(108, requestData, "请输入您的原因,谢谢!", c)
return
}
if requestData.Rectification == 0 {
requestData.Rectification = 1
}
operationTime := time.Now().Unix()
keyNumber := commonus.GetFileNumberEs()
var addScore assessmentmodel.ScoreFlow
addScore.EvaluationPlan = planIdInt
addScore.PlusReduceScore = requestData.Type
addScore.Score = requestData.Score
addScore.Key = keyNumber
addScore.Reason = requestData.Reason
addScore.Time = operationTime
addScore.EiteTime = operationTime
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 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.Group, 10, 64)
if userGroupErr == nil {
addScore.EvaluationGroup = userGroup
}
addScore.Year = commonus.ComputingTime(operationTime, 1)
addScore.Quarter = commonus.ComputingTime(operationTime, 1)
addScore.Month = commonus.ComputingTime(operationTime, 1)
addScore.Week = commonus.ComputingTime(operationTime, 1)
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
addScore.Reply = 1
addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error
//步进内容
if addErr != nil {
response.Result(109, addErr, "数据写入失败", c)
return
}
var evalProCont assessmentmodel.EvaluationProcess
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", keyNumber).First(&evalProCont).Error
if judgeErr != nil {
var flowStepAryMaps []FlowStep
var flowSteping FlowStep
flowSteping.Step = 1
flowSteping.Key = strconv.FormatInt(keyNumber, 10)
flowSteping.State = 1
flowSteping.RoleGroup = 16118387069540343
flowSteping.NextStep = 1
flowStepAryMaps = append(flowStepAryMaps, flowSteping)
fmt.Printf("%v------------------>%v\n", flowSteping, flowStepAryMaps)
evalProCont.OrderKey = keyNumber
evalProCont.Step = 1
evalProCont.State = 1
evalProCont.RoleGroup = 16118387069540343
evalProCont.Time = time.Now().Unix()
flowStepJson, flowStepErr := json.Marshal(flowStepAryMaps)
if flowStepErr == nil {
evalProCont.Content = string(flowStepJson)
}
// fmt.Printf("------------------>%v\n", evalProCont)
global.GVA_DB_Performanceappraisal.Create(&evalProCont)
} else {
var flowStepAry []FlowStep
var flowStepArys []FlowStep
json.Unmarshal([]byte(evalProCont.Content), &flowStepAry)
for _, f_v := range flowStepAry {
if f_v.Step == evalProCont.Step {
f_v.State = 2
}
flowStepArys = append(flowStepArys, f_v)
}
var flowStep FlowStep
flowStep.Step = evalProCont.Step + 1
flowStep.Key = strconv.FormatInt(keyNumber, 10)
flowStep.State = 1
flowStep.RoleGroup = 16118387069540343
flowStep.NextStep = 1
flowStepArys = append(flowStepArys, flowStep)
saveData := commonus.MapOut()
saveData["ep_time"] = time.Now().Unix()
saveData["ep_role_group"] = 16118387069540343
flowStepJson, flowStepErr := json.Marshal(flowStepArys)
if flowStepErr == nil {
saveData["ep_cont"] = string(flowStepJson)
}
EiteDutiesInfoes(evalProCont.Id, saveData)
fmt.Printf("----------3-------->%v\n", evalProCont)
}
//给相关部门内勤发送消息。确定相关责任人
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
if sendUserIsTrue != true {
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
return
}
// response.Result(0, sendUserList, "数据写入成功", c)
// return
var mainTitle string = ""
var mainTitleDesc string = ""
if programme.Type == 1 {
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
if detailedTargetErr == true {
if detailedTargetCont.Title != "" {
mainTitle = detailedTargetCont.Title
} else {
mainTitle = requestData.Reason
}
if programme.Content == "" {
mainTitleDesc = detailedTargetCont.Content
} else {
mainTitleDesc = programme.Content
}
} else {
mainTitle = strconv.FormatInt(programme.DetailedTarget, 10)
mainTitleDesc = programme.Content
}
} else {
targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
if targetErr == true {
mainTitle = targetCont.Title
mainTitleDesc = programme.Content
} else {
mainTitleDesc = programme.Content
}
}
handleUrl := fmt.Sprintf("http://www.hxgk.group?key=%v", keyNumber)
callbakcMsg, isTrueCall, callBackCont := sendmessage.SendMsgPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, requestData.Reason, handleUrl, requestData.Type, departmentId, userKey, requestData.Score, keyNumber, "请前往处理")
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
outData["addScore"] = addScore
outData["mainTitle"] = mainTitle
outData["mainTitleDesc"] = mainTitleDesc
response.Result(0, outData, "数据写入成功", c)
}
//添加责任人
func (e *EvaluationInterface) AddDivisionResponsibility(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData DivisionResponsibilityType
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(102, err, "数据获取失败!", c)
return
}
if requestData.Id == "" {
response.Result(103, requestData, "未知考核项目!请检查你的提交是否正确!", c)
return
}
orderId, orderIdIntErr := strconv.ParseInt(requestData.Id, 10, 64)
if orderIdIntErr != nil {
response.Result(104, requestData, "未知考核项目!请检查你的提交是否正确!", c)
return
}
if len(requestData.UserList) < 1 {
response.Result(105, requestData, "请选择要考核的人员!", c)
return
}
var scoreFlowInfo assessmentmodel.ScoreFlow
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error
if judegFlowErr != nil {
response.Result(106, judegFlowErr, "未知考核项目!请检查你的提交是否正确!", 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
}
//给相关部门内勤发送消息。确定相关责任人
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
if sendUserIsTrue != true {
response.Result(109, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
return
}
var reason string
var saveDataAry []assessmentmodel.DivisionResponsibilities
var saveDataErrAry []assessmentmodel.DivisionResponsibilities
for _, v := range requestData.UserList {
var saveDataCont assessmentmodel.DivisionResponsibilities
saveDataCont.ScoreFlow = orderId
saveDataCont.Type = v.Type
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64)
if departmentIdErr == nil {
saveDataCont.EvaluationDepartment = departmentId
}
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
if userKeyErr == nil {
saveDataCont.EvaluationUser = userKey
}
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64)
if userGroupErr == nil {
saveDataCont.EvaluationGroup = userGroup
}
//获取操作人
userFileStr := "wm_number,qywx_key,wx_key"
//操作人条件
userWherAry := commonus.MapOut()
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
userWherAry["wm_key"] = v.UserKey
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry)
saveDataCont.UserName = v.UserName
saveDataCont.Weight = v.Weight
saveDataCont.Time = time.Now().Unix()
saveDataCont.EiteTime = time.Now().Unix()
saveDataCont.DistributionUser = commonus.GetFileNumberEs()
var userWechatErr bool
var userWechat commonus.PublicUserCont
if userIsTrue == true {
if userConting.WechatId != "" {
userWechatErr, userWechat = commonus.GetUesrContForWechatID(userConting.WechatId)
}
if userConting.WorkWechatId != "" {
userWechatErr, userWechat = commonus.GetUesrContForWechatID(userConting.WorkWechatId)
}
}
if userWechatErr == true {
saveDataCont.UserKey = userWechat.Key
saveDataCont.Group = userWechat.Group
saveDataCont.Department = userWechat.DepartmentId
saveDataCont.Tema = userWechat.Tema
var zeren string
switch v.Type {
case 1:
zeren = "主要责任人"
case 2:
zeren = "互保责任人"
case 3:
zeren = "责任班组"
case 4:
zeren = "责任班组长"
case 5:
zeren = "主管"
case 6:
zeren = "三大员"
case 7:
zeren = "厂长、主任"
default:
zeren = "主要责任人"
}
reason = reason + fmt.Sprintf("%v:%v 责任占比:%v\n", zeren, v.UserName, v.Weight)
saveDataAry = append(saveDataAry, saveDataCont)
} else {
saveDataErrAry = append(saveDataErrAry, saveDataCont)
}
}
if len(saveDataAry) < 1 {
response.Result(107, saveDataAry, "请检查您提交的要考核人员名单是否正确!", c)
return
}
global.GVA_DB_Performanceappraisal.Where("`df_sf_id` = ?", orderId).Delete(&assessmentmodel.DivisionResponsibilities{})
writeDataErr := global.GVA_DB_Performanceappraisal.Create(&saveDataAry).Error
if writeDataErr != nil {
response.Result(108, writeDataErr, "数据写入失败", c)
return
}
flowSaveData := commonus.MapOut()
flowSaveData["sf_reply"] = 2
flowSaveData["sf_eite_time"] = time.Now().Unix()
EiteScoreFlow(orderId, flowSaveData)
// return
keyNumber := commonus.GetFileNumberEs()
var evalProCont assessmentmodel.EvaluationProcess
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProCont).Error
// fmt.Printf("VVVVVVVVVVVVVVVVVVVVVVVVV%v\n", judgeErr)
if judgeErr != nil {
var flowStepAry []FlowStep
var flowStep FlowStep
flowStep.Step = 1
flowStep.Key = strconv.FormatInt(keyNumber, 10)
flowStep.State = 1
flowStep.RoleGroup = 16182159043990656
flowStep.NextStep = 2
flowStepAry = append(flowStepAry, flowStep)
evalProCont.OrderKey = orderId
evalProCont.Step = 1
evalProCont.State = 1
evalProCont.Time = time.Now().Unix()
evalProCont.RoleGroup = 16182159043990656
flowStepJson, flowStepErr := json.Marshal(flowStepAry)
if flowStepErr == nil {
evalProCont.Content = string(flowStepJson)
}
global.GVA_DB_Performanceappraisal.Create(&evalProCont)
// fmt.Printf("VVVVV--->%v\n", jsh)
} else {
var flowStepAry []FlowStep
var flowStepArys []FlowStep
json.Unmarshal([]byte(evalProCont.Content), &flowStepAry)
for _, f_v := range flowStepAry {
if f_v.Step == evalProCont.Step {
f_v.State = 2
}
flowStepArys = append(flowStepArys, f_v)
}
var flowStep FlowStep
flowStep.Step = evalProCont.Step + 1
flowStep.Key = strconv.FormatInt(keyNumber, 10)
flowStep.State = 1
flowStep.RoleGroup = 16182159043990656
flowStep.NextStep = 2
flowStepArys = append(flowStepArys, flowStep)
saveData := commonus.MapOut()
saveData["ep_time"] = time.Now().Unix()
saveData["ep_role_group"] = 16182159043990656
saveData["ep_step"] = evalProCont.Step + 1
flowStepJson, flowStepErr := json.Marshal(flowStepArys)
if flowStepErr == nil {
saveData["ep_cont"] = string(flowStepJson)
}
EiteDutiesInfoes(evalProCont.Id, saveData)
}
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
var mainTitle string = "责任划分"
var mainTitleDesc string = ""
mainTitle = scoreFlowInfo.Reason
if scoreFlowInfo.PlusReduceScore == 1 {
mainTitleDesc = "增加:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit
} else {
mainTitleDesc = "扣除:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit
}
// if programme.Type == 1 {
// detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
// if detailedTargetErr == true {
// if detailedTargetCont.Title != "" {
// mainTitle = detailedTargetCont.Title
// } else {
// targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
// if targetErr == true {
// mainTitle = targetCont.Title
// } else {
// mainTitle = strconv.FormatInt(programme.Target, 10)
// }
// }
// if programme.Content == "" {
// mainTitleDesc = detailedTargetCont.Content
// } else {
// mainTitleDesc = programme.Content
// }
// } else {
// mainTitle = strconv.FormatInt(programme.DetailedTarget, 10)
// mainTitleDesc = programme.Content
// }
// } else {
// targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
// if targetErr == true {
// mainTitle = targetCont.Title
// mainTitleDesc = programme.Content
// } else {
// mainTitleDesc = programme.Content
// }
// }
subtitle := "责任划分"
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64)
if departmentIdErr != nil {
departmentId = 1
}
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
if userKeyErr != nil {
userKey = 0
}
var buttonMap []sendmessage.ButtonListtype
var buttonCont sendmessage.ButtonListtype
buttonCont.Type = 0
buttonCont.Text = "批准"
buttonCont.Style = 1
buttonCont.Key = fmt.Sprintf("duty_%v_1", orderId)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2", orderId)
buttonMap = append(buttonMap, buttonCont)
callbakcMsg, isTrueCall, callBackCont, ss := sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, buttonMap)
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
outData["addScore"] = ss
// outData["sendTextMsg"] = sendTextMsg
response.Result(0, outData, "数据写入成功", c)
}
//添加整改措施
func (e *EvaluationInterface) AddCorrectiveMeasures(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
if userKeyErr != nil {
response.Result(102, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64)
if departmentIdErr != nil {
response.Result(103, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64)
if userGroupErr != nil {
response.Result(104, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData CorrectiveMeasuresType
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(105, err, "数据获取失败!", c)
return
}
if requestData.OrderId == "" {
response.Result(106, err, "数据异常!", c)
return
}
orderidval, orderidvalErr := strconv.ParseInt(requestData.OrderId, 10, 64)
if orderidvalErr != nil {
response.Result(107, isTrue, "数据异常!!", c)
return
}
if requestData.Content == "" {
response.Result(108, err, "请输入整改内容!", c)
return
}
var addRecMeas assessmentmodel.RectificationMeasures
addRecMeas.UserKey = userKey
addRecMeas.Department = departmentId
addRecMeas.Group = userGroup
addRecMeas.OrderKey = orderidval
addRecMeas.State = 1
addRecMeas.Time = time.Now().Unix()
addRecMeas.EiteTime = time.Now().Unix()
addRecMeas.Content = requestData.Content
enclosure, enclosureErr := json.Marshal(requestData.Enclosure)
if enclosureErr == nil {
addRecMeas.Enclosure = string(enclosure)
}
addErr := global.GVA_DB_Performanceappraisal.Create(&addRecMeas).Error
//步进内容
if addErr != nil {
response.Result(109, addErr, "数据写入失败", c)
return
}
keyNumber := commonus.GetFileNumberEs()
UpEvaluationProcessApproval(orderidval, 16182159043990656, keyNumber, 4)
_, sendUserList := commonus.GetSendMsgUser(16182159043990656, departmentId) //获取对应部门负责人(高科)
var scoreFlowInfo assessmentmodel.ScoreFlow
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderidval).First(&scoreFlowInfo).Error
if judegFlowErr != nil {
response.Result(110, err, "审批发送失败!", c)
return
}
var programme assessmentmodel.QualitativeEvaluation
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
if judgeProgramme != nil {
return
}
var mainTitle string = ""
if programme.DetailedTarget != 0 {
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
if detailedTargetErr == true {
mainTitle = detailedTargetCont.Title
}
} else {
detailedTargetCont, detailedTargetErr := commonus.GetTargetInfo(programme.Target)
if detailedTargetErr == true {
mainTitle = detailedTargetCont.Title
}
}
mainTitleDesc := scoreFlowInfo.Reason
subtitle := "整改内容:"
reason := requestData.Content
callbakcMsg, isTrueCall, callBackCont := SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKey, keyNumber, scoreFlowInfo.Key, addRecMeas.Id)
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
outData["addRecMeas"] = addRecMeas
response.Result(0, outData, "数据写入成功", c)
}
/*
发送文本任务卡
@sendUserList 接收信息人员
@Title 一级标题,建议不超过36个字
@Desc 标题辅助信息,建议不超过44个字
@Unit 考核计量单位
@Reason 二级文本标题
@handleUrl 访问Key
@Type 1:加分;2:减分
@departmentId 执行考核部门
@userKey 执行考核人
@Score 考核分值
@keyNumber 任务卡ID
@scoreReason 二级文本描述
@subTitleText 下级 组件标题"考核上报部门:"
@formId 表单ID
*/
func SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason string, departmentId, userKey, keyNumber, orderId, formId int64) (callbakcMsg []byte, isTrueCall bool, callBackCont string) {
if subtitle == "" {
subtitle = "整改内容"
}
var buttonMap []sendmessage.ButtonListtype
var buttonCont sendmessage.ButtonListtype
buttonCont.Type = 0
buttonCont.Text = "批准"
buttonCont.Style = 1
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderId, formId)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, formId)
buttonMap = append(buttonMap, buttonCont)
callbakcMsg, isTrueCall, callBackCont, _ = sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, buttonMap)
return
}
//审批流程查询