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.
1319 lines
49 KiB
1319 lines
49 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.Addtime == "" {
|
|
response.Result(108, requestData, "请输入您的检查时间,谢谢!", c)
|
|
return
|
|
}
|
|
if requestData.Rectification == 0 {
|
|
requestData.Rectification = 1
|
|
}
|
|
// happenTimeStr := fmt.Sprintf("%v:00", requestData.Addtime)
|
|
// happenTime := commonus.DateToTimeStamp(happenTimeStr)
|
|
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
|
|
addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime)
|
|
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, 2)
|
|
addScore.Month = commonus.ComputingTime(operationTime, 3)
|
|
addScore.Week = commonus.ComputingTime(operationTime, 4)
|
|
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
|
|
}
|
|
|
|
commonus.StepAddData(keyNumber, 0, 2, 1, 1, 1, 1, userCont.Key)
|
|
|
|
// /*
|
|
// @flowID 流程ID
|
|
// @userKey 操作人key
|
|
// @roleGroupId 角色组Id
|
|
// @stepName 步骤名称
|
|
// @stepInt 当前是第几部
|
|
// @nextStep 下一步
|
|
// */
|
|
// 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
|
|
// flowSteping.ClickName = userCont.Key
|
|
// flowSteping.AddTime = time.Now().Unix()
|
|
// 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
|
|
// flowStep.ClickName = userCont.Key
|
|
// flowStep.AddTime = time.Now().Unix()
|
|
// 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://new.hxgk.group/#/responsible?id=%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
|
|
flowStep.ClickName = userCont.Key
|
|
flowStep.AddTime = time.Now().Unix()
|
|
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
|
|
flowStep.ClickName = userCont.Key
|
|
flowStep.AddTime = time.Now().Unix()
|
|
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, orderId, 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, userCont.Key)
|
|
_, 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, orderId, buttonMap)
|
|
return
|
|
}
|
|
|
|
//获取定量考核任务列表
|
|
func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
var requestData GetRationFlowLog
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(102, err, "数据获取失败!", 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
|
|
gormDbIng := global.GVA_DB_Performanceappraisal
|
|
gormDbIng = gormDbIng.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key)
|
|
if requestData.GroupId != "" {
|
|
gormDbIng = gormDbIng.Where("qe_group = ?", requestData.GroupId)
|
|
}
|
|
if requestData.DepartmentID != "" {
|
|
gormDbIng = gormDbIng.Where("qe_accept_evaluation = ?", requestData.DepartmentID)
|
|
}
|
|
listErr := gormDbIng.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, qualEvaList, "您没有要参加的考核项目!", 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) AddFlowRationLog(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 AddRationFlowLog
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(105, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
if requestData.GroupId == "" {
|
|
response.Result(106, err, "数据异常!", c)
|
|
return
|
|
}
|
|
if requestData.DepartmentID == "" {
|
|
response.Result(107, err, "数据异常!", c)
|
|
return
|
|
}
|
|
if len(requestData.List) < 1 {
|
|
response.Result(108, err, "没有要考核的项目", c)
|
|
return
|
|
}
|
|
operationTime := time.Now().Unix()
|
|
keyNumber := commonus.GetFileNumberEs()
|
|
var flowLog assessmentmodel.FlowLog
|
|
flowLog.Key = keyNumber
|
|
flowLog.Time = time.Now().Unix()
|
|
flowLog.EiteTime = time.Now().Unix()
|
|
flowLog.Year = commonus.ComputingTime(operationTime, 1)
|
|
flowLog.Quarter = commonus.ComputingTime(operationTime, 2)
|
|
flowLog.Month = commonus.ComputingTime(operationTime, 3)
|
|
flowLog.Week = commonus.ComputingTime(operationTime, 4)
|
|
flowLog.ToDay = commonus.ComputingTime(operationTime, 5)
|
|
|
|
flowLog.EvaluationDepartment = departmentId
|
|
flowLog.EvaluationUser = userKey
|
|
flowLog.EvaluationGroup = userGroup
|
|
|
|
dutyGroup, dutyGroupErr := strconv.ParseInt(requestData.GroupId, 10, 64)
|
|
if dutyGroupErr == nil {
|
|
flowLog.DutyGroup = dutyGroup
|
|
}
|
|
departIdInt, departIdIntErr := strconv.ParseInt(requestData.DepartmentID, 10, 64)
|
|
if departIdIntErr == nil {
|
|
flowLog.DutyDepartment = departIdInt
|
|
}
|
|
flowLog.Reply = 1
|
|
var flowDataLogAry []assessmentmodel.FlowLogData
|
|
var reason string
|
|
for i, v := range requestData.List {
|
|
var flowDataLog assessmentmodel.FlowLogData
|
|
evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64)
|
|
if evaluationPlanidErr == nil {
|
|
flowDataLog.EvaluationPlan = evaluationPlanid
|
|
}
|
|
flowDataLog.Key = keyNumber
|
|
flowDataLog.Score = v.Score * 100
|
|
flowDataLog.Content = v.Reason
|
|
flowDataLog.Enclosure = strings.Join(v.Enclosure, ",")
|
|
flowDataLog.Time = time.Now().Unix()
|
|
targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10))
|
|
tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target)
|
|
if i == 0 {
|
|
if targetInfoErr == true {
|
|
reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Score, v.Unit)
|
|
}
|
|
} else {
|
|
if targetInfoErr == true {
|
|
reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Score, v.Unit)
|
|
}
|
|
}
|
|
|
|
flowDataLogAry = append(flowDataLogAry, flowDataLog)
|
|
}
|
|
gromDb := global.GVA_DB_Performanceappraisal.Begin()
|
|
|
|
addFlowLogErr := gromDb.Create(&flowLog).Error
|
|
addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error
|
|
fmt.Printf("%v---------------------->%v\n", addFlowLogErr, addFlowLogDataErr)
|
|
if addFlowLogErr == nil && addFlowLogDataErr == nil {
|
|
affairDbErr := gromDb.Commit().Error
|
|
if affairDbErr == nil {
|
|
|
|
//发送消息
|
|
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人
|
|
if sendUserIsTrue != true {
|
|
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|
// return
|
|
}
|
|
// UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key)
|
|
|
|
commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 1, 1, userCont.Key)
|
|
|
|
mainTitle := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10))
|
|
mainTitleDesc := ""
|
|
subtitle := "数据详情:"
|
|
// reason := requestData.Content
|
|
|
|
// callbakcMsg, isTrueCall, callBackCont := SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, keyNumber, 0)
|
|
|
|
var buttonMap []sendmessage.ButtonListtype
|
|
var buttonCont sendmessage.ButtonListtype
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "批准"
|
|
buttonCont.Style = 1
|
|
buttonCont.Key = fmt.Sprintf("ration_%v_1", keyNumber)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
buttonCont.Type = 0
|
|
buttonCont.Text = "驳回"
|
|
buttonCont.Style = 3
|
|
buttonCont.Key = fmt.Sprintf("ration_%v_2", keyNumber)
|
|
buttonMap = append(buttonMap, buttonCont)
|
|
|
|
callbakcMsg, isTrueCall, callBackCont, sendText := sendmessage.SendButtonPublicRation(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, keyNumber, buttonMap)
|
|
|
|
fmt.Printf("1、更新发送信息返回:%v-----------%v----------->%v-----%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendText)
|
|
|
|
response.Result(0, affairDbErr, "数据写入成功!", c)
|
|
} else {
|
|
gromDb.Rollback()
|
|
response.Result(118, affairDbErr, "数据写入失败!", c)
|
|
}
|
|
} else {
|
|
affairDbErr := gromDb.Rollback().Error
|
|
if affairDbErr == nil {
|
|
response.Result(119, affairDbErr, "数据写入失败!", c)
|
|
} else {
|
|
response.Result(120, affairDbErr, "数据写入失败!", c)
|
|
}
|
|
}
|
|
}
|
|
|
|
//查看定性考核审批列表
|
|
func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) {
|
|
var requestData commonus.SetIds
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(101, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
if requestData.Id == 0 && requestData.OutId == "" {
|
|
response.Result(102, err, "参数错误!请重新提交!", c)
|
|
return
|
|
}
|
|
if requestData.OutId != "" {
|
|
idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
|
|
if inIntErr == nil {
|
|
requestData.Id = idInt
|
|
}
|
|
}
|
|
var titleVal string = ""
|
|
fmt.Printf("1-------------------->\n")
|
|
var addScore assessmentmodel.ScoreFlow
|
|
gerErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", requestData.Id).Find(&addScore).Error
|
|
fmt.Printf("2-------------------->%v\n", gerErr)
|
|
if gerErr != nil {
|
|
response.Result(103, gerErr, "没有此审批单!", c)
|
|
return
|
|
}
|
|
fmt.Printf("3-------------------->%v\n", gerErr)
|
|
// return
|
|
//获取方案
|
|
qualEvalCont, qualEvalErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(addScore.EvaluationPlan, 10))
|
|
fmt.Printf("4-------------------->%v\n", addScore.EvaluationPlan)
|
|
if qualEvalErr != true {
|
|
response.Result(103, qualEvalErr, "没有此方案!", c)
|
|
return
|
|
}
|
|
fmt.Printf("5-------------------->%v\n", qualEvalErr)
|
|
var dutyCecorFlowInfo DutyCecorFlow
|
|
dutyCecorFlowInfo.OrderId = strconv.FormatInt(requestData.Id, 10)
|
|
fmt.Printf("6-------------------->%v\n", requestData.Id)
|
|
if qualEvalCont.Dimension != 0 {
|
|
dimInfo, dimInfoErr := commonus.GetDutyClassInfo(qualEvalCont.Dimension)
|
|
if dimInfoErr == true {
|
|
dutyCecorFlowInfo.Dimension = dimInfo.Title
|
|
titleVal = dimInfo.Title
|
|
}
|
|
}
|
|
if qualEvalCont.Target != 0 {
|
|
target, targetErr := commonus.GetTargetInfo(qualEvalCont.Target)
|
|
if targetErr == true {
|
|
dutyCecorFlowInfo.Target = target.Title
|
|
titleVal = target.Title
|
|
}
|
|
|
|
}
|
|
if qualEvalCont.TargetSun != 0 {
|
|
tarsun, tarsunErr := commonus.GetQualitativeTargetInfo(qualEvalCont.TargetSun)
|
|
if tarsunErr == true {
|
|
dutyCecorFlowInfo.TargetSun = tarsun.Title
|
|
titleVal = tarsun.Title
|
|
}
|
|
}
|
|
if qualEvalCont.DetailedTarget != 0 {
|
|
detaTar, detaTarErr := commonus.GetDetailedTargetInfo(qualEvalCont.DetailedTarget)
|
|
if detaTarErr == true {
|
|
dutyCecorFlowInfo.DetailedTarget = detaTar.Title
|
|
dutyCecorFlowInfo.Content = detaTar.Content
|
|
titleVal = detaTar.Title
|
|
}
|
|
}
|
|
fmt.Printf("7-------------------->%v\n", requestData.Id)
|
|
dutyCecorFlowInfo.Reason = addScore.Reason
|
|
|
|
if addScore.PlusReduceScore == 1 {
|
|
dutyCecorFlowInfo.ReasonInfo = "增加:" + strconv.FormatInt(addScore.Score, 10) + qualEvalCont.Unit
|
|
} else {
|
|
dutyCecorFlowInfo.ReasonInfo = "扣除:" + strconv.FormatInt(addScore.Score, 10) + qualEvalCont.Unit
|
|
}
|
|
fmt.Printf("8-------------------->%v\n", requestData.Id)
|
|
if addScore.Rectification == 1 {
|
|
var divisionResponsibilities []assessmentmodel.DivisionResponsibilities
|
|
dRBerr := global.GVA_DB_Performanceappraisal.Where("df_sf_id = ?", requestData.Id).Find(&divisionResponsibilities).Error
|
|
fmt.Printf("8-------1------------->%v\n", divisionResponsibilities)
|
|
if dRBerr == nil {
|
|
|
|
for _, d_v := range divisionResponsibilities {
|
|
fmt.Printf("8-------2------------->%v\n", d_v.UserKey)
|
|
var divBilInfo DivisiosibilityType
|
|
switch d_v.Type {
|
|
case 1:
|
|
divBilInfo.Type = "主要责任人"
|
|
case 2:
|
|
divBilInfo.Type = "互保责任人"
|
|
case 3:
|
|
divBilInfo.Type = "责任班组"
|
|
case 4:
|
|
divBilInfo.Type = "责任班组长"
|
|
case 5:
|
|
divBilInfo.Type = "主管"
|
|
case 6:
|
|
divBilInfo.Type = "三大员"
|
|
case 7:
|
|
divBilInfo.Type = "厂长、主任"
|
|
default:
|
|
divBilInfo.Type = "主要责任人"
|
|
}
|
|
userInfoGet, userInfoGetErr := commonus.GetWorkUser(strconv.FormatInt(d_v.UserKey, 10))
|
|
if userInfoGetErr == true {
|
|
divBilInfo.UserName = userInfoGet.Name
|
|
}
|
|
fmt.Printf("8-------1-3------------>%v\n", userInfoGet)
|
|
divBilInfo.Weight = int64(d_v.Weight)
|
|
dutyCecorFlowInfo.DivisionResponsibility = append(dutyCecorFlowInfo.DivisionResponsibility, divBilInfo)
|
|
}
|
|
}
|
|
var recMeasCont []assessmentmodel.RectificationMeasures
|
|
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_order` = ?", requestData.Id).First(&recMeasCont).Error
|
|
if judgeRecMeas == nil {
|
|
for _, r_v := range recMeasCont {
|
|
var recMeasInfo RectifMeasures
|
|
whe := commonus.MapOut()
|
|
whe["wm_key"] = r_v.UserKey
|
|
uidVal, uidValErr := commonus.GetUserInfoPublic("worker_man.*,worker_man_data.*", whe)
|
|
if uidValErr == true {
|
|
recMeasInfo.RecName = uidVal.Name
|
|
}
|
|
recMeasInfo.RecCont = r_v.Content
|
|
recMeasInfo.State = r_v.State
|
|
recMeasInfo.TimeVal = commonus.TimeStampToDate(r_v.Time, 1)
|
|
dutyCecorFlowInfo.RectifMeasures = append(dutyCecorFlowInfo.RectifMeasures, recMeasInfo)
|
|
}
|
|
}
|
|
}
|
|
fmt.Printf("9-------------------->%v\n", requestData.Id)
|
|
var evalProInfo assessmentmodel.EvaluationProcess
|
|
gerEvalErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", requestData.Id).Find(&evalProInfo).Error
|
|
fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
|
|
if gerEvalErr == nil {
|
|
var flowStepAryMaps []FlowStep
|
|
jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps)
|
|
fmt.Printf("9-----------2--------->%v\n", flowStepAryMaps)
|
|
if jsonFlowErr == nil {
|
|
fmt.Printf("9-----------3--------->%v\n", flowStepAryMaps)
|
|
if len(flowStepAryMaps) > 0 {
|
|
for _, fw_v := range flowStepAryMaps {
|
|
var flowLog TechnologicalProcessType
|
|
flowLog.Step = fw_v.Step
|
|
flowLog.State = fw_v.State
|
|
workUser, workUserErr := commonus.GetWorkUser(fw_v.ClickName)
|
|
fmt.Printf("9-----------4-----2---->%v\n", fw_v)
|
|
if workUserErr == true {
|
|
fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
|
|
bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId)
|
|
fmt.Printf("9-----------4-----3---->%v\n", bfErr)
|
|
if bfErr == true {
|
|
getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId))
|
|
fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
|
|
if getGroupRoleInfoErr == true {
|
|
flowLog.GroupName = roleGroupInfo.Title
|
|
|
|
for _, rg_v := range getGroupRoleInfo {
|
|
clickUserInfoErr, clickUserInfo := commonus.GetUesrContForWechatID(rg_v.Id)
|
|
fmt.Printf("9-----------4--------->%v\n", clickUserInfoErr)
|
|
var caoZuoRenInfnfo caoZuoRen
|
|
if clickUserInfoErr == true {
|
|
if strconv.FormatInt(clickUserInfo.Key, 10) == fw_v.ClickName {
|
|
caoZuoRenInfnfo.IsTrue = 1
|
|
if fw_v.AddTime != 0 {
|
|
caoZuoRenInfnfo.TimeVal = commonus.TimeStampToDate(fw_v.AddTime, 1)
|
|
}
|
|
}
|
|
gErrs, groupInfos := commonus.GetGroupCont(clickUserInfo.Group)
|
|
if gErrs == true {
|
|
caoZuoRenInfnfo.GroupName = groupInfos.Name
|
|
}
|
|
caoZuoRenInfnfo.DepartmentName = clickUserInfo.DepartmentName
|
|
caoZuoRenInfnfo.WorkShopName = clickUserInfo.WorkshopName
|
|
caoZuoRenInfnfo.Postname = clickUserInfo.PostName
|
|
caoZuoRenInfnfo.TeamName = clickUserInfo.TemaName
|
|
caoZuoRenInfnfo.Icon = clickUserInfo.Icon
|
|
caoZuoRenInfnfo.Name = clickUserInfo.Name
|
|
flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo)
|
|
}
|
|
// var caoZuoRenInfnfo caoZuoRen
|
|
// caoZuoRenInfnfo.Name =
|
|
// if workUser.WechatId == rg_v.Id || workUser.WorkWechatId == rg_v.Id {
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
dutyCecorFlowInfo.TechnologicalProcess = append(dutyCecorFlowInfo.TechnologicalProcess, flowLog)
|
|
}
|
|
}
|
|
}
|
|
//流程全面
|
|
var flowAllMapList []commonus.FlowAllMap
|
|
jsonFlowErrers := json.Unmarshal([]byte(evalProInfo.NextContent), &flowAllMapList)
|
|
if jsonFlowErrers == nil {
|
|
dutyCecorFlowInfo.FlowMapAll = flowAllMapList
|
|
}
|
|
}
|
|
dutyCecorFlowInfo.Title = titleVal
|
|
response.Result(0, dutyCecorFlowInfo, "获取成功", c)
|
|
}
|
|
|
|
//查看定量考核列表
|
|
func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
|
|
var requestData commonus.SetIds
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(101, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
if requestData.Id == 0 && requestData.OutId == "" {
|
|
response.Result(102, requestData, "参数错误!请重新提交!", c)
|
|
return
|
|
}
|
|
if requestData.OutId != "" {
|
|
idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
|
|
if inIntErr == nil {
|
|
requestData.Id = idInt
|
|
}
|
|
}
|
|
var flowDataLog []assessmentmodel.FlowLogData
|
|
getErr := global.GVA_DB_Performanceappraisal.Where("`fld_flow_log` = ?", requestData.Id).Order("fld_id ASC").Find(&flowDataLog).Error
|
|
if getErr != nil {
|
|
response.Result(103, err, "参数错误!请重新提交!", c)
|
|
return
|
|
}
|
|
var outList []RationOutStruct
|
|
for _, v := range flowDataLog {
|
|
var outContt RationOutStruct
|
|
outContt.Id = strconv.FormatInt(v.Id, 10)
|
|
outContt.FlowId = strconv.FormatInt(v.Key, 10)
|
|
targetCont, targetContErr := commonus.LookRationInfo(v.EvaluationPlan)
|
|
if targetContErr == true {
|
|
outContt.Title = targetCont.Title
|
|
outContt.Unit = targetCont.Unit
|
|
}
|
|
outContt.Score = float64(v.Score) / 100
|
|
outContt.Content = v.Content
|
|
outList = append(outList, outContt)
|
|
}
|
|
if len(outList) <= 0 {
|
|
response.Result(103, err, "没有数据!", c)
|
|
return
|
|
}
|
|
//流程查看
|
|
var flowAllMapList []commonus.FlowAllMap
|
|
var flowLogList []TechnologicalProcessType
|
|
var evalProInfo assessmentmodel.EvaluationProcess
|
|
gerEvalErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", requestData.Id).Find(&evalProInfo).Error
|
|
fmt.Printf("9-----------1--------->%v\n", gerEvalErr)
|
|
if gerEvalErr == nil {
|
|
var flowStepAryMaps []FlowStep
|
|
jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps)
|
|
fmt.Printf("9-----------2--------->%v\n", jsonFlowErr)
|
|
if jsonFlowErr == nil {
|
|
// fmt.Printf("9-----------3--------->%v\n", flowStepAryMaps)
|
|
if len(flowStepAryMaps) > 0 {
|
|
for _, fw_v := range flowStepAryMaps {
|
|
var flowLog TechnologicalProcessType
|
|
flowLog.Step = fw_v.Step
|
|
flowLog.State = fw_v.State
|
|
workUser, workUserErr := commonus.GetWorkUser(fw_v.ClickName)
|
|
// fmt.Printf("9-----------4-----2---->%v\n", fw_v)
|
|
if workUserErr == true {
|
|
// fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
|
|
bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId)
|
|
// fmt.Printf("9-----------4-----3---->%v\n", bfErr)
|
|
if bfErr == true {
|
|
getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId))
|
|
// fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
|
|
if getGroupRoleInfoErr == true {
|
|
flowLog.GroupName = roleGroupInfo.Title
|
|
|
|
for _, rg_v := range getGroupRoleInfo {
|
|
clickUserInfoErr, clickUserInfo := commonus.GetUesrContForWechatID(rg_v.Id)
|
|
// jjsk, _ := json.Marshal(clickUserInfo)
|
|
// fmt.Printf("9-----------4--------->%v-->%v\n", string(jjsk), clickUserInfo.Key)
|
|
var caoZuoRenInfnfo caoZuoRen
|
|
if clickUserInfoErr == true {
|
|
if strconv.FormatInt(clickUserInfo.Key, 10) == fw_v.ClickName {
|
|
caoZuoRenInfnfo.IsTrue = 1
|
|
if fw_v.AddTime != 0 {
|
|
caoZuoRenInfnfo.TimeVal = commonus.TimeStampToDate(fw_v.AddTime, 1)
|
|
}
|
|
}
|
|
gErrs, groupInfos := commonus.GetGroupCont(clickUserInfo.Group)
|
|
if gErrs == true {
|
|
caoZuoRenInfnfo.GroupName = groupInfos.Name
|
|
}
|
|
caoZuoRenInfnfo.DepartmentName = clickUserInfo.DepartmentName
|
|
caoZuoRenInfnfo.WorkShopName = clickUserInfo.WorkshopName
|
|
caoZuoRenInfnfo.Postname = clickUserInfo.PostName
|
|
caoZuoRenInfnfo.TeamName = clickUserInfo.TemaName
|
|
caoZuoRenInfnfo.Icon = clickUserInfo.Icon
|
|
caoZuoRenInfnfo.Name = clickUserInfo.Name
|
|
flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo)
|
|
}
|
|
// var caoZuoRenInfnfo caoZuoRen
|
|
// caoZuoRenInfnfo.Name =
|
|
// if workUser.WechatId == rg_v.Id || workUser.WorkWechatId == rg_v.Id {
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
flowLogList = append(flowLogList, flowLog)
|
|
}
|
|
}
|
|
}
|
|
//流程图全面
|
|
// flowAllMapList
|
|
if evalProInfo.NextContent != "" {
|
|
jsonFlowErr := json.Unmarshal([]byte(evalProInfo.NextContent), &flowAllMapList)
|
|
if jsonFlowErr == nil {
|
|
}
|
|
}
|
|
}
|
|
|
|
outListMap := commonus.MapOut()
|
|
outListMap["List"] = outList
|
|
outListMap["flowLog"] = flowLogList
|
|
outListMap["flowall"] = flowAllMapList
|
|
outListMap["title"] = ""
|
|
var flowLogInfo assessmentmodel.FlowLog
|
|
getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error
|
|
if getErrs == nil {
|
|
titleStr := fmt.Sprintf("%v年%v月%v日数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay)
|
|
gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup)
|
|
if gErr == true {
|
|
outListMap["groupname"] = groupInfo.Name
|
|
} else {
|
|
outListMap["groupname"] = ""
|
|
}
|
|
|
|
dErr, BranchInfo := commonus.GetBranchFactory(flowLogInfo.DutyDepartment)
|
|
if dErr == true {
|
|
outListMap["departmentname"] = BranchInfo.Name
|
|
titleStr = fmt.Sprintf("%v%v", BranchInfo.Name, titleStr)
|
|
} else {
|
|
outListMap["departmentname"] = ""
|
|
}
|
|
outListMap["title"] = titleStr
|
|
}
|
|
|
|
response.Result(0, outListMap, "查询成功", c)
|
|
}
|
|
|
|
//获取点击人信息
|
|
// userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
|
|
|