Browse Source

修改定性考核审批

qin_1
超级管理员 4 years ago
parent
commit
9ad35821e4
  1. 91
      gin_server_admin/api/admin/dutyassess/assess.go
  2. 23
      gin_server_admin/api/admin/dutyassess/assesstype.go
  3. 181
      gin_server_admin/api/index/evaluation/evaluation.go
  4. 647
      gin_server_admin/api/index/evaluation/flowsend.go
  5. 4
      gin_server_admin/api/index/evaluation/sendwechatmsg.go
  6. 38
      gin_server_admin/api/index/evaluation/type.go
  7. 1
      gin_server_admin/api/v1/assessment/department_target.go
  8. 128
      gin_server_admin/api/v1/assessment/qualitative_evaluation.go
  9. 24
      gin_server_admin/api/v1/assessment/set_evaluation_objectives.go
  10. 1
      gin_server_admin/api/v1/custom/customhandle.go
  11. 12
      gin_server_admin/api/v1/shiyan/shiyan.go
  12. 77
      gin_server_admin/api/wechatapp/callback/apphandle.go
  13. 4
      gin_server_admin/api/wechatapp/callback/rationcallback.go
  14. 59
      gin_server_admin/api/wechatapp/callback/sendmsg.go
  15. 18
      gin_server_admin/api/wechatapp/callback/type.go
  16. 795
      gin_server_admin/api/wechatapp/callback/updatehandle.go
  17. 40
      gin_server_admin/api/wechatapp/sendmessage/apphandle.go
  18. 111
      gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go
  19. 422
      gin_server_admin/commonus/publichaneld.go
  20. 12
      gin_server_admin/commonus/publicstruct.go
  21. 4
      gin_server_admin/config.yaml
  22. 1
      gin_server_admin/config/config.go
  23. 1
      gin_server_admin/core/server.go
  24. 2
      gin_server_admin/global/global.go
  25. 16
      gin_server_admin/initialize/redis.go
  26. 4
      gin_server_admin/middleware/myjwt.go
  27. 3
      gin_server_admin/model/assessmentmodel/performance_appraisal.go
  28. 1
      gin_server_admin/router/assessment/assessmentrouter.go
  29. 2
      gin_server_admin/router/systemadmin/dutyassess.go
  30. 2
      gin_server_admin/utils/redishandel/myredis.go
  31. 4
      gin_server_admin/其他支持文件/config.yaml

91
gin_server_admin/api/admin/dutyassess/assess.go

@ -392,3 +392,94 @@ func GetDutyInfoCont(id int64) (isTrue bool, outAssDutyInfo outAessDuty) {
isTrue = true isTrue = true
return return
} }
//查看定量考核目标设定
func (e *DutyAssessApi) LookQuantitativeConfig(c *gin.Context) {
var requestData SelectQuantitativeConfig
err := c.ShouldBindJSON(&requestData)
if err != nil {
response.Result(101, err, "数据获取失败!", c)
return
}
var qualConfigList []assessmentmodel.QuantitativeConfig
gormDb := global.GVA_DB_Performanceappraisal
if requestData.GroupId != "" {
gormDb = gormDb.Where("`group` = ?", requestData.GroupId)
}
if requestData.DepartmentID != "" {
gormDb = gormDb.Where("`departmentid` = ?", requestData.DepartmentID)
}
if requestData.Dimension != "" {
gormDb = gormDb.Where("`dimension` = ?", requestData.Dimension)
}
if requestData.Target != "" {
gormDb = gormDb.Where("`target` = ?", requestData.Target)
}
if requestData.DetailedTarget != "" {
gormDb = gormDb.Where("`targetconfig` = ?", requestData.DetailedTarget)
}
switch requestData.Type {
case 1:
gormDb = gormDb.Where("`type` = ?", requestData.Type)
case 2:
gormDb = gormDb.Where("`type` = ?", requestData.Type)
if requestData.Class != 0 {
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class)
}
case 3:
gormDb = gormDb.Where("`type` = ?", requestData.Type)
if requestData.Class != 0 {
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class)
}
default:
}
if requestData.Year != 0 {
gormDb = gormDb.Where("`year` = ?", requestData.Year)
}
if requestData.State != 0 {
gormDb = gormDb.Where("`state` = ?", requestData.State)
}
// gormDb = gormDb.Order("group ASC,departmentid ASC,dimension ASC,target ASC,targetconfig ASC").Order("year DESC").Order("timecopy ASC,id ASC")
gormDb = gormDb.Order("`group` ASC").Order("`departmentid` ASC").Order("`dimension` ASC").Order("`target` ASC").Order("`targetconfig` ASC").Order("`year` DESC").Order("`timecopy` ASC").Order("`id` ASC")
contErr := gormDb.Find(&qualConfigList).Error
if contErr != nil {
response.Result(102, err, "没有数据!", c)
return
}
var outList []OutQuantitativeConfig
for _, v := range qualConfigList {
var outCont OutQuantitativeConfig
outCont.Id = v.Id
outCont.DepartmentId = v.DepartmentId
outCont.Group = v.Group
outCont.Dimension = v.Dimension
outCont.Target = v.Target
outCont.TargetConfig = v.TargetConfig
outCont.Type = v.Type
outCont.Year = v.Year
outCont.Timecopy = v.Timecopy
outCont.Zeroprize = v.Zeroprize / 100
outCont.Allprize = v.Allprize / 100
outCont.Time = v.Time
outCont.State = v.State
outCont.DimensionId = strconv.FormatInt(v.Dimension, 10)
gErr, groupInfo := commonus.GetGroupCont(v.Group)
if gErr == true {
outCont.GroupTitle = groupInfo.Name
}
dErr, departmentInfo := commonus.GetBranchFactory(v.DepartmentId)
if dErr == true {
outCont.DimensionTitle = departmentInfo.Name
}
targetInfo, tErr := commonus.GetTargetInfo(v.Target)
if tErr == true {
outCont.TargetTitle = targetInfo.Title
}
dtargetInfo, dtErr := commonus.GetDetailedTargetInfo(v.TargetConfig)
if dtErr == true {
outCont.DetailedTargetTitle = dtargetInfo.Title
}
outList = append(outList, outCont)
}
response.Result(0, outList, "获取成功!", c)
}

23
gin_server_admin/api/admin/dutyassess/assesstype.go

@ -73,3 +73,26 @@ type departMonthMap struct {
TimeStr string `json:"timestr"` //时间字符串 TimeStr string `json:"timestr"` //时间字符串
DateStr string `json:"datestr"` //日期字符串 DateStr string `json:"datestr"` //日期字符串
} }
//定量考核目标设定查询
type SelectQuantitativeConfig struct {
GroupId string `json:"groupid"`
DepartmentID string `json:"departmentid"`
Dimension string `json:"dimension"` //维度
Target string `json:"target"` //指标
DetailedTarget string `json:"detailedtargent"` //指标明细
Type int `json:"type"` //1、年度;2、季度;3、月度
Year int `json:"year"` //年度
Class int `json:"class"` //季度与月度辅助值
State int `json:"state"` //状态(1、启用;2、禁用;3、删除)
}
//输出
type OutQuantitativeConfig struct {
assessmentmodel.QuantitativeConfig
GroupTitle string `json:"grouptitle"` //操作组
DimensionTitle string `json:"dimensiontitle"` //维度
DimensionId string `json:"dimensionid"` //维度
TargetTitle string `json:"targettitle"` //指标
DetailedTargetTitle string `json:"detailedtargenttitle"` //指标明细
}

181
gin_server_admin/api/index/evaluation/evaluation.go

@ -143,9 +143,15 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) {
response.Result(108, requestData, "请输入您的原因,谢谢!", c) response.Result(108, requestData, "请输入您的原因,谢谢!", c)
return return
} }
if requestData.Addtime == "" {
response.Result(108, requestData, "请输入您的检查时间,谢谢!", c)
return
}
if requestData.Rectification == 0 { if requestData.Rectification == 0 {
requestData.Rectification = 1 requestData.Rectification = 1
} }
// happenTimeStr := fmt.Sprintf("%v:00", requestData.Addtime)
// happenTime := commonus.DateToTimeStamp(happenTimeStr)
operationTime := time.Now().Unix() operationTime := time.Now().Unix()
keyNumber := commonus.GetFileNumberEs() keyNumber := commonus.GetFileNumberEs()
var addScore assessmentmodel.ScoreFlow var addScore assessmentmodel.ScoreFlow
@ -156,6 +162,7 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) {
addScore.Reason = requestData.Reason addScore.Reason = requestData.Reason
addScore.Time = operationTime addScore.Time = operationTime
addScore.EiteTime = operationTime addScore.EiteTime = operationTime
addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime)
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64)
if departmentIdErr == nil { if departmentIdErr == nil {
addScore.EvaluationDepartment = departmentId addScore.EvaluationDepartment = departmentId
@ -187,63 +194,73 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) {
response.Result(109, addErr, "数据写入失败", c) response.Result(109, addErr, "数据写入失败", c)
return 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
flowSteping.ClickName = userCont.Key
flowSteping.AddTime = time.Now().Unix()
flowStepAryMaps = append(flowStepAryMaps, flowSteping)
fmt.Printf("%v------------------>%v\n", flowSteping, flowStepAryMaps) commonus.StepAddData(keyNumber, 0, 2, 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)
evalProCont.OrderKey = keyNumber // fmt.Printf("%v------------------>%v\n", flowSteping, flowStepAryMaps)
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() // evalProCont.OrderKey = keyNumber
saveData["ep_time"] = time.Now().Unix() // evalProCont.Step = 1
saveData["ep_role_group"] = 16118387069540343 // evalProCont.State = 1
flowStepJson, flowStepErr := json.Marshal(flowStepArys) // evalProCont.RoleGroup = 16118387069540343
if flowStepErr == nil { // evalProCont.Time = time.Now().Unix()
saveData["ep_cont"] = string(flowStepJson) // flowStepJson, flowStepErr := json.Marshal(flowStepAryMaps)
} // if flowStepErr == nil {
EiteDutiesInfoes(evalProCont.Id, saveData) // evalProCont.Content = string(flowStepJson)
fmt.Printf("----------3-------->%v\n", evalProCont) // }
} // // 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) //获取对应部门内勤 sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
if sendUserIsTrue != true { if sendUserIsTrue != true {
@ -1106,6 +1123,15 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) {
caoZuoRenInfnfo.TimeVal = commonus.TimeStampToDate(fw_v.AddTime, 1) 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 caoZuoRenInfnfo.Name = clickUserInfo.Name
flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo) flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo)
} }
@ -1156,10 +1182,10 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
var outContt RationOutStruct var outContt RationOutStruct
outContt.Id = strconv.FormatInt(v.Id, 10) outContt.Id = strconv.FormatInt(v.Id, 10)
outContt.FlowId = strconv.FormatInt(v.Key, 10) outContt.FlowId = strconv.FormatInt(v.Key, 10)
targetCont, targetContErr := commonus.GetTargetInfo(v.EvaluationPlan) targetCont, targetContErr := commonus.LookRationInfo(v.EvaluationPlan)
if targetContErr == true { if targetContErr == true {
outContt.Title = targetCont.Title outContt.Title = targetCont.Title
outContt.Unit = targetCont.Uniteing outContt.Unit = targetCont.Unit
} }
outContt.Score = float64(v.Score) / 100 outContt.Score = float64(v.Score) / 100
outContt.Content = v.Content outContt.Content = v.Content
@ -1177,29 +1203,30 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
if gerEvalErr == nil { if gerEvalErr == nil {
var flowStepAryMaps []FlowStep var flowStepAryMaps []FlowStep
jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps) jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps)
fmt.Printf("9-----------2--------->%v\n", flowStepAryMaps) fmt.Printf("9-----------2--------->%v\n", jsonFlowErr)
if jsonFlowErr == nil { if jsonFlowErr == nil {
fmt.Printf("9-----------3--------->%v\n", flowStepAryMaps) // fmt.Printf("9-----------3--------->%v\n", flowStepAryMaps)
if len(flowStepAryMaps) > 0 { if len(flowStepAryMaps) > 0 {
for _, fw_v := range flowStepAryMaps { for _, fw_v := range flowStepAryMaps {
var flowLog TechnologicalProcessType var flowLog TechnologicalProcessType
flowLog.Step = fw_v.Step flowLog.Step = fw_v.Step
flowLog.State = fw_v.State flowLog.State = fw_v.State
workUser, workUserErr := commonus.GetWorkUser(fw_v.ClickName) workUser, workUserErr := commonus.GetWorkUser(fw_v.ClickName)
fmt.Printf("9-----------4-----2---->%v\n", fw_v) // fmt.Printf("9-----------4-----2---->%v\n", fw_v)
if workUserErr == true { if workUserErr == true {
fmt.Printf("9-----------4-----1---->%v\n", workUserErr) // fmt.Printf("9-----------4-----1---->%v\n", workUserErr)
bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId) bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId)
fmt.Printf("9-----------4-----3---->%v\n", bfErr) // fmt.Printf("9-----------4-----3---->%v\n", bfErr)
if bfErr == true { if bfErr == true {
getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId)) getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId))
fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo) // fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo)
if getGroupRoleInfoErr == true { if getGroupRoleInfoErr == true {
flowLog.GroupName = roleGroupInfo.Title flowLog.GroupName = roleGroupInfo.Title
for _, rg_v := range getGroupRoleInfo { for _, rg_v := range getGroupRoleInfo {
clickUserInfoErr, clickUserInfo := commonus.GetUesrContForWechatID(rg_v.Id) clickUserInfoErr, clickUserInfo := commonus.GetUesrContForWechatID(rg_v.Id)
fmt.Printf("9-----------4--------->%v\n", clickUserInfoErr) // jjsk, _ := json.Marshal(clickUserInfo)
// fmt.Printf("9-----------4--------->%v-->%v\n", string(jjsk), clickUserInfo.Key)
var caoZuoRenInfnfo caoZuoRen var caoZuoRenInfnfo caoZuoRen
if clickUserInfoErr == true { if clickUserInfoErr == true {
if strconv.FormatInt(clickUserInfo.Key, 10) == fw_v.ClickName { if strconv.FormatInt(clickUserInfo.Key, 10) == fw_v.ClickName {
@ -1208,6 +1235,15 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
caoZuoRenInfnfo.TimeVal = commonus.TimeStampToDate(fw_v.AddTime, 1) 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 caoZuoRenInfnfo.Name = clickUserInfo.Name
flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo) flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo)
} }
@ -1229,6 +1265,25 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) {
outListMap := commonus.MapOut() outListMap := commonus.MapOut()
outListMap["List"] = outList outListMap["List"] = outList
outListMap["flowLog"] = flowLogList outListMap["flowLog"] = flowLogList
var flowLogInfo assessmentmodel.FlowLog
getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error
if getErrs == nil {
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
} else {
outListMap["departmentname"] = ""
}
}
response.Result(0, outListMap, "查询成功", c) response.Result(0, outListMap, "查询成功", c)
} }

647
gin_server_admin/api/index/evaluation/flowsend.go

@ -0,0 +1,647 @@
package evaluation
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"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) PlusOrMinusPoints(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
}
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
}
//给发起人部门负责人发送消息
//1、获取发起人部门负责人
founderDepartId, _ := strconv.ParseInt(userCont.DepartmentId, 10, 64)
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, founderDepartId) //获取对应部门负责人
if sendUserIsTrue != true {
// global.GVA_DB_Performanceappraisal.Where("`sf_id` = ?", addScore.Id).Delete(&assessmentmodel.ScoreFlow{})
response.Result(0, sendUserList, "未指定相关部门处理人!请确定部门负责人后,重新发起请求!", c)
return
}
//判断发起人是否为部门负责人
myIsTrue := 1
for _, v := range sendUserList {
if v == userCont.WechatId || v == userCont.WorkWechatId {
myIsTrue = 2
}
}
taskId := strconv.FormatInt(keyNumber, 10)
//确定标题
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)
//执行操作内容
var subtitle string = ""
if requestData.Type == 1 {
subtitle = fmt.Sprintf("加:%v%v\n", requestData.Score, programme.Unit)
} else {
subtitle = fmt.Sprintf("扣除:%v%v\n", requestData.Score, programme.Unit)
}
twoLevelTitle := "考核上报部门:"
twoLevelKeyName := ""
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId)
if execDerpatErr == true {
twoLevelKeyName = execDerpat.Name
}
var twoLevelKeyValue string = ""
var twoLevelUserId string = ""
//获取操作人
if userCont.WechatId != "" {
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.WechatId)
if userWechatErr == true {
twoLevelKeyValue = userWechat.Name
twoLevelUserId = userCont.WechatId
}
}
if userCont.WorkWechatId != "" {
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userCont.WorkWechatId)
if userWechatErr == true {
twoLevelKeyValue = userWechat.Name
twoLevelUserId = userCont.WorkWechatId
}
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", keyNumber)
if myIsTrue != 1 {
//写入当前流程步骤
commonus.StepAddData(keyNumber, 0, 3, 1, userCont.Key)
//申请人也是部门负责人
//给相关部门内勤发送消息。确定相关责任人
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", keyNumber)
jumpUrlTitle := "请前往处理"
sourceDesc := "责任划分"
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
} else {
//写入当前流程步骤
commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, userCont.Key)
//申请人不是是部门负责人 给本部门负责人发送审批
//获取发起人部门负责人
departmentIdInts, _ := strconv.ParseInt(userCont.DepartmentId, 10, 64)
_, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departmentIdInts) //获取对应部门负责人
sendUserStr := strings.Join(sendUserList, "|")
//按钮
var buttonMap []sendmessage.ButtonListtype
var buttonCont sendmessage.ButtonListtype
buttonCont.Type = 0
buttonCont.Text = "批准"
buttonCont.Style = 1
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", keyNumber, 0)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", keyNumber, 0)
buttonMap = append(buttonMap, buttonCont)
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendButtonShare(sendUserStr, taskId, "部门负责人审批", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap)
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
response.Result(0, outData, "数据写入成功", c)
}
}
//添加责任人
func (e *EvaluationInterface) PersonInCharge(c *gin.Context) {
isTrue, userCont := commonus.ClientIdentity()
if isTrue != true {
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
return
}
var requestData DivisionResponsibilityTypes
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
} else {
for _, u_v := range requestData.UserList {
if len(u_v.UserKey) < 1 {
response.Result(105, requestData, "您有未输入的考核的人员选项!", c)
return
}
// if u_v.Type != 3 {
// if len(u_v.UserKey) < 1 {
// response.Result(105, requestData, "您有未输入的考核的人员选项!", c)
// return
// }
// }else{}
}
}
//写入审批流程
commonus.StepAddData(orderId, 0, 4, 3, userCont.Key)
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(107, 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 userKeyAry []int64
var MainResponsiblePerson MainResponsiblePersonType
var teamIsTrue int = 1
for _, v := range requestData.UserList {
var saveDataCont assessmentmodel.DivisionResponsibilities
saveDataCont.ScoreFlow = orderId //流程Key
saveDataCont.Type = v.Type //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)
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 //测评人集团
}
if v.Type != 3 {
userKeyLen := len(v.UserKey)
if userKeyLen < 1 {
userKeyLen = 1
}
//分配权限
weightFloat := float64(v.Weight) / float64(userKeyLen)
weightInt := commonus.Round(weightFloat, 2) * 100
weightInt64, _ := strconv.ParseInt(strconv.FormatFloat(weightInt, 'g', 1, 64), 10, 64)
//不是班组选项
for _, ua_v := range v.UserKey {
userConting, userIsTrue := commonus.GetWorkUser(ua_v)
if userIsTrue == true {
}
saveDataCont.UserName = userConting.Name
saveDataCont.Weight = weightInt64
saveDataCont.Time = time.Now().Unix()
saveDataCont.EiteTime = time.Now().Unix()
saveDataCont.DistributionUser = commonus.GetFileNumberEs()
saveDataCont.UserKey = userConting.Key
saveDataCont.Group = userConting.Group
saveDataCont.Department = userConting.DepartmentId
saveDataCont.Tema = userConting.Tema
userKeyAry = append(userKeyAry, userConting.Key)
var zeren string
switch v.Type {
case 1:
zeren = "主要责任人"
MainResponsiblePerson.UserKey = userConting.Key
MainResponsiblePerson.Group = userConting.Group
MainResponsiblePerson.Department = userConting.DepartmentId
MainResponsiblePerson.WorkshopId = userConting.WorkshopId
MainResponsiblePerson.Tema = userConting.Tema
case 2:
zeren = "互保责任人"
case 3:
zeren = "责任班组"
case 4:
zeren = "责任班组长"
case 5:
zeren = "主管"
case 6:
zeren = "三大员"
case 7:
zeren = "主任"
case 8:
zeren = "厂长"
default:
zeren = "主要责任人"
}
reason = fmt.Sprintf("%v%v:%v 责任占比:%v\n", reason, zeren, userConting.Name, weightInt64/100)
saveDataAry = append(saveDataAry, saveDataCont)
}
} else {
teamIsTrue = 2
}
}
//遍历班组情况
if teamIsTrue == 2 {
for _, t_v := range requestData.UserList {
if t_v.Type == 3 {
var saveDataContTeam assessmentmodel.DivisionResponsibilities
saveDataContTeam.ScoreFlow = orderId //流程Key
saveDataContTeam.Type = t_v.Type //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64)
if departmentIdErr == nil {
saveDataContTeam.EvaluationDepartment = departmentId //测评人部门
}
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64)
if userKeyErr == nil {
saveDataContTeam.EvaluationUser = userKey //测评人
}
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64)
if userGroupErr == nil {
saveDataContTeam.EvaluationGroup = userGroup //测评人集团
}
for _, tt_v := range t_v.UserKey {
teamIdInt64, _ := strconv.ParseInt(tt_v, 10, 64)
teamContErr, teamCont := commonus.GetTeaming(teamIdInt64)
if teamContErr == true {
reason = fmt.Sprintf("%v%v:%v 责任占比:%v\n", reason, "责任班组", teamCont.Name, t_v.Weight)
}
teamGroup := strconv.FormatInt(MainResponsiblePerson.Group, 10)
teamDepartment := strconv.FormatInt(MainResponsiblePerson.Department, 10)
teamWorkshopId := strconv.FormatInt(MainResponsiblePerson.WorkshopId, 10)
teamUserList, teamUserErr := commonus.GetTeamUserList(teamGroup, teamDepartment, teamWorkshopId, tt_v)
if teamUserErr == true {
var jiShuQi int64 = 0
for _, tu_v := range teamUserList {
if judgeIsSet(tu_v.Key, userKeyAry) == false {
jiShuQi++
}
}
if jiShuQi < 1 {
jiShuQi = 1
}
//分配权限
weightFloat := float64(t_v.Weight) / float64(jiShuQi)
weightInt := commonus.Round(weightFloat, 2) * 100
weightInt64, _ := strconv.ParseInt(strconv.FormatFloat(weightInt, 'g', 1, 64), 10, 64)
for _, tu_v := range teamUserList {
if judgeIsSet(tu_v.Key, userKeyAry) == false {
saveDataContTeam.UserName = tu_v.Name
saveDataContTeam.Weight = weightInt64
saveDataContTeam.Time = time.Now().Unix()
saveDataContTeam.EiteTime = time.Now().Unix()
saveDataContTeam.DistributionUser = commonus.GetFileNumberEs()
saveDataContTeam.UserKey = tu_v.Key
saveDataContTeam.Group = tu_v.Group
saveDataContTeam.Department = tu_v.DepartmentId
saveDataContTeam.Tema = tu_v.Tema
saveDataAry = append(saveDataAry, saveDataContTeam)
}
}
}
}
}
}
}
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)
//提交部门负责人审批
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
//获取执行结果
var mainTitleDesc string = ""
if scoreFlowInfo.PlusReduceScore == 1 {
mainTitleDesc = "增加:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit
} else {
mainTitleDesc = "扣除:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit
}
//部门名称
var twoLevelKeyName string = ""
departmentId, _ := strconv.ParseInt(userCont.DepartmentId, 10, 64)
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId)
if execDerpatErr == true {
twoLevelKeyName = execDerpat.Name
}
var twoLevelUserId string = ""
if userCont.WechatId != "" {
twoLevelUserId = userCont.WechatId
}
if userCont.WorkWechatId != "" {
twoLevelUserId = userCont.WorkWechatId
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
// 按钮
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, 0)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, 0)
buttonMap = append(buttonMap, buttonCont)
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendButtonShare(sendUserList, taskId, "部门负责人审批", scoreFlowInfo.Reason, mainTitleDesc, "责任划分", reason, "责任部门", twoLevelKeyName, userCont.Name, twoLevelUserId, cardJumpUrl, buttonMap)
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
response.Result(0, outData, "数据写入成功", c)
}
//判断是否已经存在
func judgeIsSet(id int64, idAry []int64) (isTrue bool) {
isTrue = false
for _, v := range idAry {
if id == v {
isTrue = true
}
}
return
}
//填写整改措施
func (e *EvaluationInterface) RectificationMeasures(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
}
//写入流程步骤
commonus.StepAddData(orderidval, 0, 6, 4, userCont.Key)
/*
向本部门负责人发送审批
*/
//确定相关责任人
departmentIdInts, _ := strconv.ParseInt(userCont.DepartmentId, 10, 64)
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departmentIdInts) //获取对应部门负责人
sendUserStr := strings.Join(sendUserList, "|")
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
if sendUserIsTrue != true {
response.Result(109, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
return
}
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(requestData.OrderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
//获取执行结果
var mainTitleDesc string
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
if flowContent.PlusReduceScore == 1 {
mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
} else {
mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
}
var reason string
reason = fmt.Sprintf("整改措施:\n%v", requestData.Content)
//部门名称
var twoLevelKeyName string = ""
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentIdInts)
if execDerpatErr == true {
twoLevelKeyName = execDerpat.Name
}
var twoLevelUserId string = ""
if userCont.WechatId != "" {
twoLevelUserId = userCont.WechatId
}
if userCont.WorkWechatId != "" {
twoLevelUserId = userCont.WorkWechatId
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", requestData.OrderId)
// 按钮
var buttonMap []sendmessage.ButtonListtype
var buttonCont sendmessage.ButtonListtype
buttonCont.Type = 0
buttonCont.Text = "批准"
buttonCont.Style = 1
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderidval, addRecMeas.Id)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderidval, addRecMeas.Id)
buttonMap = append(buttonMap, buttonCont)
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendButtonShare(sendUserStr, taskId, "部门负责人审批", title, desc, mainTitleDesc, reason, "责任人", twoLevelKeyName, userCont.Name, twoLevelUserId, cardJumpUrl, buttonMap)
outData := commonus.MapOut()
outData["callbakcMsg"] = string(callbakcMsg)
outData["isTrueCall"] = isTrueCall
outData["callBackCont"] = callBackCont
response.Result(0, outData, "数据写入成功", c)
}

4
gin_server_admin/api/index/evaluation/sendwechatmsg.go

@ -124,12 +124,12 @@ func UpEvaluationProcessApproval(orderKey, roleGroup, keyNumber int64, nextStep
isTrue = false isTrue = false
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderKey).First(&evalProc).Error judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderKey).First(&evalProc).Error
if judgeErr != nil { if judgeErr != nil {
return // return
} }
var flowLog []FlowStep var flowLog []FlowStep
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog)
if jsonFlowErr != nil { if jsonFlowErr != nil {
return // return
} }
roleGroupStep := len(flowLog) - 1 roleGroupStep := len(flowLog) - 1
if roleGroupStep < 0 { if roleGroupStep < 0 {

38
gin_server_admin/api/index/evaluation/type.go

@ -39,6 +39,7 @@ type QualEvalArrt struct {
//加减分数据获取项 //加减分数据获取项
type addPlusOrMinusPoints struct { type addPlusOrMinusPoints struct {
PlanId string `json:"planid"` //方案id PlanId string `json:"planid"` //方案id
Addtime string `json:"time"` //检查时间
Type int `json:"type"` //1:加分;2:减分 Type int `json:"type"` //1:加分;2:减分
Score int64 `json:""score` //分数 Score int64 `json:""score` //分数
Reason string `json:"reason"` //原因 Reason string `json:"reason"` //原因
@ -56,21 +57,33 @@ type DivisionResponsibilityType struct {
UserList []DivisionResponsibilityUser `json:"userlist"` //责任人 UserList []DivisionResponsibilityUser `json:"userlist"` //责任人
} }
type DivisionResponsibilityUser struct { type DivisionResponsibilityUser struct {
Type int `json:"type"` //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任) Type int `json:"type"` //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长;8、主任)
UserKey string `json:"userkey"` //责任人key UserKey string `json:"userkey"` //责任人key
UserName string `json:"username"` //责任人姓名 UserName string `json:"username"` //责任人姓名
Weight int `json:"weight"` //权重 Weight int64 `json:"weight"` //权重
}
type DivisionResponsibilityTypes struct {
Id string `json:"id"` //提交审批流ID
UserList []DivisionResponsibilityUsers `json:"userlist"` //责任人
}
type DivisionResponsibilityUsers struct {
Type int `json:"type"` //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长;8、主任)
UserKey []string `json:"userkey"` //责任人key
UserName string `json:"username"` //责任人姓名
Weight int64 `json:"weight"` //权重
} }
//流程步进 //流程步进
type FlowStep struct { type FlowStep struct {
Step int `json:"step"` //当前是第几步 Step int `json:"step"` //当前是第几步
Key string `json:"key"` //任务卡ID Key string `json:"key"` //任务卡ID
State int `json:"state"` //状态 State int `json:"state"` //状态 (1:为操作;2:已操作;3:驳回)
RoleGroup int64 `json:"rolefroup"` //角色组 RoleGroup int64 `json:"rolefroup"` //角色组
ClickName string `json:"clickname"` //操作人 ClickName string `json:"clickname"` //操作人
AddTime int64 `json:"addtime"` //添加时间 AddTime int64 `json:"addtime"` //添加时间
NextStep int `json:"nextstep"` //下一步 1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人 StepName string `json:"stepname"` //步骤名称
NextStep int `json:"nextstep"` //下一步 1:创建;2:创建人部门负责人审批:3:责任划分;4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
} }
//改正措施数据提交 //改正措施数据提交
@ -91,7 +104,7 @@ type RationLogList struct {
Id string `json:"id"` Id string `json:"id"`
Score int64 `json:"score` Score int64 `json:"score`
Unit string `json:"unit` Unit string `json:"unit`
Reason string `json:"reason"` //原因 Reason string `json:"content"` //原因
Enclosure []string `json:"enclosure"` //附件 Enclosure []string `json:"enclosure"` //附件
} }
@ -128,6 +141,12 @@ type caoZuoRen struct {
Name string `json:"name"` Name string `json:"name"`
IsTrue int `json:"istrue"` IsTrue int `json:"istrue"`
TimeVal string `json:"timeval"` //操作时间 TimeVal string `json:"timeval"` //操作时间
Icon string `json:"icon"` //头像
GroupName string `json:"groupname"` //集团
DepartmentName string `json:"parentname"` //部门
WorkShopName string `json:"workshopname"` //岗位
Postname string `json:"postname"` //职务
TeamName string `json:"teamname"` //班组
} }
//责任划分 //责任划分
@ -176,3 +195,12 @@ type OutQuantitativeConfig struct {
TargetTitle string `json:"targettitle"` //指标 TargetTitle string `json:"targettitle"` //指标
DetailedTargetTitle string `json:"detailedtargenttitle"` //指标明细 DetailedTargetTitle string `json:"detailedtargenttitle"` //指标明细
} }
type MainResponsiblePersonType struct {
UserKey int64 `json:"userkey"`
Department int64 `json:"department"`
Group int64 `json:"group"`
WorkshopId int64 `json:"workshopid"`
Tema int64 `json:"tema"`
Weight int64 `json:"weight"`
}

1
gin_server_admin/api/v1/assessment/department_target.go

@ -619,6 +619,7 @@ func (d *DutyHandle) AddDepartmentDutyInfo(c *gin.Context) {
saveData.Type = evalTarCont.Type //类型 saveData.Type = evalTarCont.Type //类型
saveData.Unit = v_s.Unit //单位 saveData.Unit = v_s.Unit //单位
saveData.ReferenceScore = v_s.ReferenceScore //分值 saveData.ReferenceScore = v_s.ReferenceScore //分值
// saveData.ReferenceScore = v_s.ReferenceScore //分值
saveData.State = 1 //状态 saveData.State = 1 //状态
saveData.Addtime = time.Now().Unix() saveData.Addtime = time.Now().Unix()
saveData.Eitetime = time.Now().Unix() saveData.Eitetime = time.Now().Unix()

128
gin_server_admin/api/v1/assessment/qualitative_evaluation.go

@ -876,7 +876,7 @@ func (d *DutyHandle) GetQualEval(c *gin.Context) {
outCont.State = v.State outCont.State = v.State
if targetInfoErr == nil { if targetInfoErr == nil {
outCont.Unit = targetInfo.Uniteing outCont.Unit = targetInfo.Uniteing
// outCont.ReferenceScore = v.Content outCont.ReferenceScore = v.ReferenceScore
outCont.Cycles = targetInfo.Cycles outCont.Cycles = targetInfo.Cycles
outCont.CycleAttres = targetInfo.CycleAttres outCont.CycleAttres = targetInfo.CycleAttres
if targetInfo.Report != "" { if targetInfo.Report != "" {
@ -955,28 +955,38 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) {
if departmentIdIntErr != nil { if departmentIdIntErr != nil {
departmentIdInt = 0 departmentIdInt = 0
} }
var writeInfo []int
//开启事务处理
affairDb := global.GVA_DB_Performanceappraisal.Begin()
delOldContErr := affairDb.Where("`qe_type` = 1 AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ? AND `qe_target_sun` = ?", requestData.Group, requestData.DepartmentId, requestData.Dimension, requestData.Target, requestData.TargetSun).Delete(&assessmentmodel.QualitativeEvaluation{}).Error
var quaEvaCont []assessmentmodel.QualitativeEvaluation
for _, v := range requestData.List { for _, v := range requestData.List {
var qeInfo assessmentmodel.QualitativeEvaluation
judjeisErr := global.GVA_DB_Performanceappraisal.Where("qe_id = ?", v.Id).First(&qeInfo).Error
if judjeisErr == nil {
qeSaveMap := commonus.MapOut()
qeSaveMap["qe_reference_score"] = v.ReferenceScore
qeSaveMap["qe_operator"] = strings.Join(v.UserList, ",")
qeSaveMap["qe_department_id"] = strings.Join(GetDepartmentByUserBast(v.UserList), ",")
qeSaveMap["qe_eitetime"] = time.Now().Unix()
eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("qe_id = ?", v.Id).Updates(&qeSaveMap).Error
if eiteErr == nil {
detaTargetMap := commonus.MapOut()
detaTargetMap["dt_title"] = v.Name
detaTargetMap["dt_content"] = v.Content
detaTargetMap["dt_time"] = time.Now().Unix()
eiteDetaErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DetailedTarget{}).Where("dt_id = ?", qeInfo.DetailedTarget).Updates(&detaTargetMap).Error
if eiteDetaErr == nil {
writeInfo = append(writeInfo, 1)
}
}
} else {
var saveData assessmentmodel.QualitativeEvaluation var saveData assessmentmodel.QualitativeEvaluation
saveData.Group = groupInt saveData.Group = groupInt
saveData.Type = 1 saveData.Type = 1
saveData.Dimension = dimensionInt saveData.Dimension = dimensionInt
saveData.Target = targetInt saveData.Target = targetInt
saveData.TargetSun = targetSunInt saveData.TargetSun = targetSunInt
detailedTargetInt, detailedTargetIntErr := strconv.ParseInt(v.Id, 10, 64) detailedTargetInt, detailedTargetIntErr := strconv.ParseInt(v.Id, 10, 64)
if detailedTargetIntErr == nil { if detailedTargetIntErr == nil {
saveData.DetailedTarget = detailedTargetInt saveData.DetailedTarget = detailedTargetInt
} }
saveData.Unit = v.Unit saveData.Unit = v.Unit
saveData.ReferenceScore = v.ReferenceScore saveData.ReferenceScore = v.ReferenceScore
saveData.Cycles = v.Cycles saveData.Cycles = v.Cycles
@ -988,33 +998,85 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) {
saveData.AcceptEvaluation = departmentIdInt saveData.AcceptEvaluation = departmentIdInt
saveData.Operator = strings.Join(v.UserList, ",") saveData.Operator = strings.Join(v.UserList, ",")
// fmt.Printf("%v-------->%v\n", GetDepartmentByUserBast(v.UserList), strings.Join(GetDepartmentByUserBast(v.UserList), ","))
saveData.DepartmentId = strings.Join(GetDepartmentByUserBast(v.UserList), ",") saveData.DepartmentId = strings.Join(GetDepartmentByUserBast(v.UserList), ",")
// operatorInt, operatorIntErr := strconv.ParseInt(v.Operator, 10, 64) addDataErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error
// if operatorIntErr == nil { if addDataErr == nil {
// saveData.Operator = strings.Join(v.Operator,",") writeInfo = append(writeInfo, 1)
// }
// saveData.AcceptEvaluation = departmentIdInt
quaEvaCont = append(quaEvaCont, saveData)
} }
var infoAttrErr error
if len(quaEvaCont) > 0 {
infoAttrErr = affairDb.Create(&quaEvaCont).Error
} }
if delOldContErr == nil && infoAttrErr == nil {
delOldContErr = affairDb.Commit().Error }
if delOldContErr != nil { if len(writeInfo) <= 0 {
delOldContErr = affairDb.Rollback().Error response.Result(102, writeInfo, "数据写入失败!请重新提交!", c)
response.Result(102, err, "数据写入失败!请重新提交!", c)
return return
} }
commonus.AddDimenTargetWeight(1, groupInt, departmentIdInt, dimensionInt, targetInt)
response.Result(0, err, "数据写入成功!", c) response.Result(0, err, "数据写入成功!", c)
} else { // eiteDataSave := commonus.MapOut()
delOldContErr = affairDb.Rollback().Error // eiteDataSave["qe_state"] = 2
response.Result(102, err, "数据写入失败!请重新提交!", c) // eiteDataSave["qe_eitetime"] = time.Now().Unix()
} // //开启事务处理
// affairDb := global.GVA_DB_Performanceappraisal.Begin()
// delOldContErr := affairDb.Where("`qe_type` = 1 AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ? AND `qe_target_sun` = ?", requestData.Group, requestData.DepartmentId, requestData.Dimension, requestData.Target, requestData.TargetSun).Delete(&assessmentmodel.QualitativeEvaluation{}).Error
// delOldContErr := affairDb.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_type` = 1 AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ? AND `qe_target_sun` = ?", requestData.Group, requestData.DepartmentId, requestData.Dimension, requestData.Target, requestData.TargetSun).Updates(&eiteDataSave).Error
// var quaEvaCont []assessmentmodel.QualitativeEvaluation
// for _, v := range requestData.List {
// var saveData assessmentmodel.QualitativeEvaluation
// saveData.Group = groupInt
// saveData.Type = 1
// saveData.Dimension = dimensionInt
// saveData.Target = targetInt
// saveData.TargetSun = targetSunInt
// detailedTargetInt, detailedTargetIntErr := strconv.ParseInt(v.Id, 10, 64)
// if detailedTargetIntErr == nil {
// saveData.DetailedTarget = detailedTargetInt
// }
// saveData.Unit = v.Unit
// saveData.ReferenceScore = v.ReferenceScore
// saveData.Cycles = v.Cycles
// saveData.CycleAttres = v.CycleAttres
// saveData.State = 1
// saveData.Addtime = time.Now().Unix()
// saveData.Eitetime = time.Now().Unix()
// saveData.AcceptEvaluation = departmentIdInt
// saveData.Operator = strings.Join(v.UserList, ",")
// // fmt.Printf("%v-------->%v\n", GetDepartmentByUserBast(v.UserList), strings.Join(GetDepartmentByUserBast(v.UserList), ","))
// saveData.DepartmentId = strings.Join(GetDepartmentByUserBast(v.UserList), ",")
// // operatorInt, operatorIntErr := strconv.ParseInt(v.Operator, 10, 64)
// // if operatorIntErr == nil {
// // saveData.Operator = strings.Join(v.Operator,",")
// // }
// // saveData.AcceptEvaluation = departmentIdInt
// quaEvaCont = append(quaEvaCont, saveData)
// }
// var infoAttrErr error
// if len(quaEvaCont) > 0 {
// infoAttrErr = affairDb.Create(&quaEvaCont).Error
// if delOldContErr == nil && infoAttrErr == nil {
// delOldContErr = affairDb.Commit().Error
// if delOldContErr != nil {
// delOldContErr = affairDb.Rollback().Error
// response.Result(102, err, "数据写入失败!请重新提交!", c)
// return
// }
// commonus.AddDimenTargetWeight(1, groupInt, departmentIdInt, dimensionInt, targetInt)
// response.Result(0, err, "数据写入成功!", c)
// } else {
// delOldContErr = affairDb.Rollback().Error
// response.Result(102, err, "数据写入失败!请重新提交!", c)
// }
// } else {
// response.Result(0, err, "数据写入成功!", c)
// }
} }
//删除定性考核 //删除定性考核

24
gin_server_admin/api/v1/assessment/set_evaluation_objectives.go

@ -23,47 +23,47 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) {
return return
} }
if requestData.Group == 0 { if requestData.Group == 0 {
response.Result(102, err, "请选择归属集团", c) response.Result(103, err, "请选择归属集团", c)
return return
} }
if requestData.DepartMent == 0 { if requestData.DepartMent == 0 {
response.Result(102, err, "请选择归属部门", c) response.Result(104, err, "请选择归属部门", c)
return return
} }
if requestData.Dimension == "" { if requestData.Dimension == "" {
response.Result(102, err, "请选择归属维度", c) response.Result(105, err, "请选择归属维度", c)
return return
} }
if requestData.Target == "" { if requestData.Target == "" {
response.Result(102, err, "请选择归属指标", c) response.Result(106, err, "请选择归属指标", c)
return return
} }
switch requestData.Cycle { switch requestData.Cycle {
case 1: case 1:
if len(requestData.CycleAdded) != 1 { if len(requestData.CycleAdded) != 1 {
response.Result(102, err, "年度只可填写一条!", c) response.Result(107, err, "年度只可填写一条!", c)
return return
} }
case 2: case 2:
if len(requestData.CycleAdded) > 4 { if len(requestData.CycleAdded) > 4 {
response.Result(102, err, "季度最多只可填写四条!", c) response.Result(108, err, "季度最多只可填写四条!", c)
return return
} }
if len(requestData.CycleAdded) < 1 { if len(requestData.CycleAdded) < 1 {
response.Result(102, err, "季度至少填写一条!", c) response.Result(109, err, "季度至少填写一条!", c)
return return
} }
case 3: case 3:
if len(requestData.CycleAdded) > 12 { if len(requestData.CycleAdded) > 12 {
response.Result(102, err, "月度最多只可填写十二条!", c) response.Result(110, err, "月度最多只可填写十二条!", c)
return return
} }
if len(requestData.CycleAdded) < 1 { if len(requestData.CycleAdded) < 1 {
response.Result(102, err, "月度至少填写一条!", c) response.Result(111, err, "月度至少填写一条!", c)
return return
} }
default: default:
response.Result(102, err, "请选择周期", c) response.Result(112, err, "请选择周期", c)
return return
} }
var timecopy []int64 var timecopy []int64
@ -239,13 +239,13 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) {
} }
} }
if len(saveData) <= 0 && len(eiteAddData) <= 0 { if len(saveData) <= 0 && len(eiteAddData) <= 0 {
response.Result(102, err, "没有要添加的数据!", c) response.Result(113, err, "没有要添加的数据!", c)
return return
} }
if len(saveData) > 0 { if len(saveData) > 0 {
saveErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error saveErr := global.GVA_DB_Performanceappraisal.Create(&saveData).Error
if saveErr != nil { if saveErr != nil {
response.Result(102, err, "数据添加失败!", c) response.Result(114, err, "数据添加失败!", c)
return return
} }
} }

1
gin_server_admin/api/v1/custom/customhandle.go

@ -26,6 +26,7 @@ func (cu *CustomHandle) CustomLogin(c *gin.Context) {
// return // return
// } // }
userAgent := c.Request.Header.Get("User-Agent") userAgent := c.Request.Header.Get("User-Agent")
userAgent = "250"
// store // store
// if store.Verify(l.CaptchaId, l.Captcha, true) { // if store.Verify(l.CaptchaId, l.Captcha, true) {
userErr, user := staff.GetUserWork(l.Username, l.Password) userErr, user := staff.GetUserWork(l.Username, l.Password)

12
gin_server_admin/api/v1/shiyan/shiyan.go

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"math"
"os" "os"
"strconv" "strconv"
"time" "time"
@ -69,12 +70,20 @@ func (a *ShiyanApi) PostRequestOperation(c *gin.Context) {
response.Ok(c) response.Ok(c)
} }
func Round(val float64, precision int) float64 {
p := math.Pow10(precision)
return math.Floor(val*p+0.5) / p
}
//实验递归 //实验递归
func (s *ShiyanApi) DiGui(c *gin.Context) { func (s *ShiyanApi) DiGui(c *gin.Context) {
// var group []wechat.GroupForm // var group []wechat.GroupForm
// listErr := global.GVA_DB_WatchDate.Find(&group).Error // listErr := global.GVA_DB_WatchDate.Find(&group).Error
// if listErr == nil { // if listErr == nil {
// } // }
sdf := Round(19.2365233642256, 2)
response.Result(0, sdf, "查询成功", c)
return
var ids wechat.GroupForm var ids wechat.GroupForm
_ = c.ShouldBindJSON(&ids) _ = c.ShouldBindJSON(&ids)
var setid int64 var setid int64
@ -83,6 +92,9 @@ func (s *ShiyanApi) DiGui(c *gin.Context) {
setid = ids.Id setid = ids.Id
} }
redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(2)
redisClient.Set("cesi", "ccccc")
_, connn, _ := commonus.GetOfficeWork(16118387069540343, setid) _, connn, _ := commonus.GetOfficeWork(16118387069540343, setid)
response.Result(0, connn, "查询成功", c) response.Result(0, connn, "查询成功", c)
return return

77
gin_server_admin/api/wechatapp/callback/apphandle.go

@ -12,6 +12,7 @@ import (
"github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/wechatcallback" "github.com/flipped-aurora/gin-vue-admin/server/model/wechatcallback"
"github.com/flipped-aurora/gin-vue-admin/server/utils/redishandel"
"github.com/flipped-aurora/gin-vue-admin/server/wechatjiexi/wxbizmsgcrypt" "github.com/flipped-aurora/gin-vue-admin/server/wechatjiexi/wxbizmsgcrypt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -52,8 +53,9 @@ func (a *CallBackApi) CallbackMessageApi(c *gin.Context) {
basicValueCallback.ToUserName = xmlMessageStr.ToUserName.Text basicValueCallback.ToUserName = xmlMessageStr.ToUserName.Text
basicValueCallback.Encrypt = xmlMessageStr.Encrypt.Text basicValueCallback.Encrypt = xmlMessageStr.Encrypt.Text
basicValueCallback.AgentID = xmlMessageStr.AgentID.Text basicValueCallback.AgentID = xmlMessageStr.AgentID.Text
msgStr := basicValueCallback.DecryptMessage() basicValueCallback.DecryptMessage(c)
c.String(200, msgStr) // msgStr := basicValueCallback.DecryptMessage(c)
// c.String(200, msgStr)
} }
} }
@ -100,7 +102,7 @@ func (c *CallBackData) VerificationUrl() (msg string) {
} }
//解析消息结构 //解析消息结构
func (c *CallBackData) DecryptMessage() (echoMsg string) { func (c *CallBackData) DecryptMessage(cs *gin.Context) (echoMsg string) {
wecahtCpt := WechatVerification() wecahtCpt := WechatVerification()
timestampStr := strconv.FormatInt(c.Timestamp, 10) timestampStr := strconv.FormatInt(c.Timestamp, 10)
reqData := []byte("<xml><ToUserName><![CDATA[" + c.ToUserName + "]]></ToUserName><Encrypt><![CDATA[" + c.Encrypt + "]]></Encrypt><AgentID><![CDATA[" + c.AgentID + "]]></AgentID></xml>") reqData := []byte("<xml><ToUserName><![CDATA[" + c.ToUserName + "]]></ToUserName><Encrypt><![CDATA[" + c.Encrypt + "]]></Encrypt><AgentID><![CDATA[" + c.AgentID + "]]></AgentID></xml>")
@ -132,11 +134,11 @@ func (c *CallBackData) DecryptMessage() (echoMsg string) {
/* /*
事件附属格式 事件附属格式
*/ */
echoMsg = EventProcessing(msgContent.Event, msg, c) echoMsg = EventProcessing(msgContent.Event, msg, c, cs)
return // return
default: default:
} }
// fmt.Printf("yyyyyyyy------------->%v\n", 123456)
var callbackLog wechatcallback.CallbackLog var callbackLog wechatcallback.CallbackLog
// //
callbackLog.MsgSignature = c.MsgSignature callbackLog.MsgSignature = c.MsgSignature
@ -150,6 +152,33 @@ func (c *CallBackData) DecryptMessage() (echoMsg string) {
callbackLog.Jsonstr = string(msgCont) callbackLog.Jsonstr = string(msgCont)
} }
callbackLog.AddTime = time.Now().Unix() callbackLog.AddTime = time.Now().Unix()
var redisList WechatCallBackRedis
redisList.MsgSignature = c.MsgSignature
redisList.TimeStamp = c.Timestamp
redisList.Nonce = c.Nonce
redisList.Echostr = c.Echostr
redisList.Xmlstr = string(msg)
redisList.Reqdata = string(reqData)
msgContr, jsonrErr := json.Marshal(msgContent)
if jsonrErr == nil {
redisList.Jsonstr = string(msgContr)
}
redisList.AddTime = time.Now().Unix()
redisList.Content = msgContent
jsonStr, jsonRedisErr := json.Marshal(redisList)
// redisClient := redishandel.RunRedis()
// redisClient.SetRedisDb(2)
// redisClient.SetRedisTime(0)
redisPrefix := fmt.Sprintf("Wechat:CallBack_%v:XML_%v", global.GVA_CONFIG.RedisPrefix.PreFix, msgContent.Event) //redis KEY
// redisClient.Lpush(redisPrefix, string(jsonStr))
if jsonRedisErr == nil {
WechatCallBackDataWruteRedis(redisPrefix, string(jsonStr), "lpush")
}
// fmt.Printf("yyyyyyyy------------->%v\n", string(jsonStr))
if msgContent.Event != "LOCATION" { if msgContent.Event != "LOCATION" {
global.GVA_DB_WechatCallBack.Create(&callbackLog) global.GVA_DB_WechatCallBack.Create(&callbackLog)
} }
@ -157,7 +186,7 @@ func (c *CallBackData) DecryptMessage() (echoMsg string) {
} }
//企业微信事件处理 //企业微信事件处理
func EventProcessing(event string, decryptMsg []byte, v *CallBackData) (msg string) { func EventProcessing(event string, decryptMsg []byte, v *CallBackData, cs *gin.Context) (msg string) {
var msgContent MsgContentMailList var msgContent MsgContentMailList
err := xml.Unmarshal(decryptMsg, &msgContent) err := xml.Unmarshal(decryptMsg, &msgContent)
if nil != err { if nil != err {
@ -209,7 +238,11 @@ func EventProcessing(event string, decryptMsg []byte, v *CallBackData) (msg stri
} else { } else {
msg = "25000" msg = "25000"
} }
templateEventPush(decryptMsg) synergeticProcess.Add(1)
go templateEventPush(decryptMsg)
defer synergeticProcess.Wait()
cs.String(200, msg)
case "template_card_menu_event": //通用模板卡片右上角菜单事件推送 case "template_card_menu_event": //通用模板卡片右上角菜单事件推送
default: default:
} }
@ -233,3 +266,31 @@ func WorkWechatMailList(changeType string, decryptMsg []byte) {
default: default:
} }
} }
//回调写入redis
func WechatCallBackDataWruteRedis(redisKey, redisVal, class string) {
redisClient := redishandel.RunRedis()
redisClient.SetRedisDb(2)
redisClient.SetRedisTime(0)
switch class {
case "lpush": //列表
locationJson, locationErr := redisClient.Lindex(redisKey, 0)
if locationErr != nil {
redisClient.Lpush(redisKey, redisVal)
} else {
var geographicalPositionRedis GeographicalPositionRedis
jsonErr := json.Unmarshal([]byte(locationJson), &geographicalPositionRedis)
if jsonErr != nil {
redisClient.Lpush(redisKey, redisVal)
} else {
timeVal := geographicalPositionRedis.Time
if time.Now().Unix()-timeVal >= 300 {
redisClient.Lpush(redisKey, redisVal)
}
}
}
default:
redisClient.Set(redisKey, redisVal)
}
}

4
gin_server_admin/api/wechatapp/callback/rationcallback.go

@ -49,7 +49,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte
} }
if clickEnter == "1" { if clickEnter == "1" {
userKeyStr := strconv.FormatInt(userContInfo.Key, 10) userKeyStr := strconv.FormatInt(userContInfo.Key, 10)
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2, userKeyStr) evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr)
saveData := commonus.MapOut() saveData := commonus.MapOut()
saveData["fl_reply"] = 2 saveData["fl_reply"] = 2
saveData["fl_eite_time"] = time.Now().Unix() saveData["fl_eite_time"] = time.Now().Unix()
@ -112,7 +112,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte
fmt.Printf("2、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) fmt.Printf("2、更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont)
} else { } else {
userKeyStr := strconv.FormatInt(userContInfo.Key, 10) userKeyStr := strconv.FormatInt(userContInfo.Key, 10)
evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2, userKeyStr) evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 16182159043990656, 0, 2, userKeyStr)
saveData := commonus.MapOut() saveData := commonus.MapOut()
saveData["fl_reply"] = 2 saveData["fl_reply"] = 2
saveData["fl_eite_time"] = time.Now().Unix() saveData["fl_eite_time"] = time.Now().Unix()

59
gin_server_admin/api/wechatapp/callback/sendmsg.go

@ -0,0 +1,59 @@
package callback
import (
"fmt"
"strconv"
"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"
)
//发送流程文本信息
/*
@userList 接收人
@taskId 标签ID
@planId 考核方案项目ID
@executeReason 执行原因
@secondaryCont 参考文本
*/
func SendUpdateCallBackMsg(userList, orderId, taskId, planId, executeReason, secondaryCont, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId string) (isTrue bool) {
isTrue = false
//获取考核项目内容
var programme assessmentmodel.QualitativeEvaluation
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planId).First(&programme).Error
if judgeProgramme != nil {
return
}
executeReason = fmt.Sprintf("%v%v\n", executeReason, programme.Unit)
//确定标题
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个字
}
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrlTitle := "请前往处理"
sourceDesc := "信息提示"
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(userList, taskId, title, desc, secondaryCont, executeReason, "考核上报部门:", twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
isTrue = true
return
}

18
gin_server_admin/api/wechatapp/callback/type.go

@ -1,8 +1,13 @@
package callback package callback
import "sync"
//企业微信回调 //企业微信回调
type CallBackApi struct{} type CallBackApi struct{}
//协程设置
var synergeticProcess = sync.WaitGroup{}
//企业微信回调基础参数 //企业微信回调基础参数
type CallBackData struct { type CallBackData struct {
MsgSignature string `json:"msg_signature"` MsgSignature string `json:"msg_signature"`
@ -163,3 +168,16 @@ type OpenApprovalChangeUser struct {
ItemImage string `xml:"ItemImage"` // 头像 ItemImage string `xml:"ItemImage"` // 头像
ItemUserId string `xml:"ItemUserId"` //userid ItemUserId string `xml:"ItemUserId"` //userid
} }
//微信回调写入Redis结构
type WechatCallBackRedis struct {
MsgSignature string `json:"msgSignature"`
TimeStamp int64 `json:"timestamp"`
Nonce string `json:"nonce"`
Echostr string `json:"echostr"`
Xmlstr string `json:"xmlstr"`
Jsonstr string `json:"jsonstr"`
AddTime int64 `json:"addtime"`
Reqdata string `json:"reqdata"`
Content MsgContent `json:"content"`
}

795
gin_server_admin/api/wechatapp/callback/updatehandle.go

@ -35,7 +35,8 @@ func templateEventPush(eventMsg []byte) {
switch buttonClick[0] { switch buttonClick[0] {
case "duty": //数据考核审批工作 case "duty": //数据考核审批工作
// fmt.Printf("@@@@\n") // fmt.Printf("@@@@\n")
msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2]) // msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2])
msgContent.ButtonTemplateCallBackHandleBackups(buttonClick[1], buttonClick[2])
case "ration": case "ration":
msgContent.ButtonTemplateCallBackHandleRation(buttonClick[1], buttonClick[2]) msgContent.ButtonTemplateCallBackHandleRation(buttonClick[1], buttonClick[2])
default: default:
@ -44,7 +45,7 @@ func templateEventPush(eventMsg []byte) {
jsonStr, _ := json.Marshal(msgContent) jsonStr, _ := json.Marshal(msgContent)
fmt.Printf("jsonStr======>%v\n", string(jsonStr)) fmt.Printf("jsonStr======>%v\n", string(jsonStr))
defer synergeticProcess.Done()
// var updateButtonNotClickable commonus.UpdateButtonNotClickable // var updateButtonNotClickable commonus.UpdateButtonNotClickable
// updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo") // updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo")
// updateButtonNotClickable.Atall = 0 // updateButtonNotClickable.Atall = 0
@ -55,32 +56,784 @@ func templateEventPush(eventMsg []byte) {
// fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont) // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont)
} }
//发送错误信息
func sendErrMsg(userKey, orderId, title, cont, DepartmentName, Name, cardJumpUrl, jumpUrl string) {
desc := ""
reason := commonus.TimeStampToDate(time.Now().Unix(), 14)
var sendTextMsg sendmessage.TextNoticeTemplateMedium
jumpUrlTitle := "请前往处理"
sourceDesc := "信息提示"
sendTextMsg.SendMsgTextShare(userKey, orderId, title, desc, cont, reason, "提交人", DepartmentName, Name, userKey, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
}
/*
按钮模板回调处理
@orderId 流程Key
@clickEnter 1同意2驳回
*/
func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnter string) {
//1、获取点击人信息
userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
if userContInfoIstrue != true {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
//2、获取审批单信息
var scoreFlowInfo assessmentmodel.ScoreFlow
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error
if judegFlowErr != nil {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
//3、获取审批流程
var evalProc assessmentmodel.EvaluationProcess
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProc).Error
if judgeErr != nil {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
//解析审批流
var flowLog []evals.FlowStep
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog)
setpLen := len(flowLog)
if jsonFlowErr != nil || setpLen < 1 {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
//得到当前步进值
currentSetp := setpLen - 1
if currentSetp < 0 {
currentSetp = 0
}
//判断通过还是驳回
if clickEnter == "1" {
//同意
//1:创建;2:创建人部门负责人审批:3:责任划分(内勤);4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
switch flowLog[currentSetp].NextStep {
case 1:
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64)
commonus.StepAddData(orderIdInt, 0, 1, 1, strconv.FormatInt(userContInfo.Key, 10))
//发起人
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
evaluationPlanStr := strconv.FormatInt(scoreFlowInfo.EvaluationPlan, 10)
var executeReason string = ""
if scoreFlowInfo.PlusReduceScore == 1 {
executeReason = fmt.Sprintf("加:%v\n", scoreFlowInfo.Score)
} else {
executeReason = fmt.Sprintf("减:%v\n", scoreFlowInfo.Score)
}
SendUpdateCallBackMsg(t.FromUsername, orderId, taskId, evaluationPlanStr, executeReason, "考核部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername)
flowSaveData := commonus.MapOut()
flowSaveData["sf_reply"] = 2
flowSaveData["sf_eite_time"] = time.Now().Unix()
commonus.EiteScoreFlow(orderIdInt, flowSaveData)
case 2:
//发起人部门负责人
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64)
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, strconv.FormatInt(userContInfo.Key, 10))
//获取发起人部门负责人
sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendUserIsTrue == true {
var otherUser []string
for _, u_v := range sendUserList {
if u_v != t.FromUsername {
otherUser = append(otherUser, u_v)
}
}
if len(otherUser) > 0 {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
t.UpdateButtonIng(otherUser, buttonClickNAmeOtherEs)
}
}
//向相关部门内勤发送确认责任人信息
//1、获取责任部门内勤信息
officWorkUserIsTrue, officWorkUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
if officWorkUserIsTrue != true {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
var programme assessmentmodel.QualitativeEvaluation
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error
if judgeProgramme != nil {
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl)
return
}
//确定标题
var title string = ""
//一级标题副本内容
var desc string = ""
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则
if detailedTargetErr == true {
tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息
if tarErr == true {
title = tarInf.Title //一级标题,建议不超过36个字
desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字
} else {
title = detailedTargetCont.Title //一级标题,建议不超过36个字
}
} else {
tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息
if tarErr == true {
title = tarInf.Title //一级标题,建议不超过36个字
} else {
title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字
}
}
var quoteAreaTitle string = ""
if scoreFlowInfo.PlusReduceScore == 1 {
quoteAreaTitle = fmt.Sprintf("加:%v%v\n", scoreFlowInfo.Score, programme.Unit)
} else {
quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", scoreFlowInfo.Score, programme.Unit)
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
jumpUrlTitle := "请前往处理"
sourceDesc := "责任划分"
// quoteAreaContent := programme
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(officWorkUserList, taskId, title, desc, quoteAreaTitle, scoreFlowInfo.Reason, "考核上报部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
flowSaveData := commonus.MapOut()
flowSaveData["sf_reply"] = 2
flowSaveData["sf_eite_time"] = time.Now().Unix()
commonus.EiteScoreFlow(orderIdInt, flowSaveData)
case 3:
//责任划分(相关部门内勤)
case 4:
//责任部门审批(部门负责人)
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendButtonIsTrue == true {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
}
//是否需要整改
if scoreFlowInfo.Rectification == 1 {
//需要整改
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, strconv.FormatInt(userContInfo.Key, 10))
//获取主要责任人
var personLiable []string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
if teamErr == nil {
for _, tm_v := range teamBility {
if tm_v["type"] == 1 {
personLiable = append(personLiable, tm_v["wechatid"].(string))
}
}
}
if len(personLiable) < 1 {
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
}
sendUserList := strings.Join(personLiable, "|")
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
var quoteAreaTitle string = ""
if flowContent.PlusReduceScore == 1 {
quoteAreaTitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
} else {
quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
}
quoteAreaContent := flowContent.Reason
twoLevelTitle := "部门负责人"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", orderId)
jumpUrlTitle := "填写整改方案==============>GOTO"
sourceDesc := "整改通知"
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
} else {
//不需要整改
commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, strconv.FormatInt(userContInfo.Key, 10))
//获取发起人信息
var sendUser string = ""
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
if faQiRen.WechatId != "" {
sendUser = faQiRen.WechatId
}
if faQiRen.WorkWechatId != "" {
sendUser = faQiRen.WorkWechatId
}
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
var subtitle string = ""
if flowContent.PlusReduceScore == 1 {
subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
} else {
subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
}
//获取责任划分
var reason string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
if teamErr == nil {
for _, team_v := range teamBility {
if team_v["type"] != 3 {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
} else {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
}
}
}
twoLevelTitle := "部门负责人"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
// 按钮
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, 0)
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, 0)
buttonMap = append(buttonMap, buttonCont)
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap)
}
case 5:
//主要责任人整改
case 6:
//责任部门审批(部门负责人)
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, strconv.FormatInt(userContInfo.Key, 10))
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendButtonIsTrue == true {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已批准")
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
}
//获取发起人信息
var sendUser string = ""
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
if faQiRen.WechatId != "" {
sendUser = faQiRen.WechatId
}
if faQiRen.WorkWechatId != "" {
sendUser = faQiRen.WorkWechatId
}
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
//获取执行结果
var mainTitleDesc string
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
if flowContent.PlusReduceScore == 1 {
mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
} else {
mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
}
var reason string
buttonClickAry := strings.Split(t.EventKey, "_")
if len(buttonClickAry) > 4 {
var recMeasCont assessmentmodel.RectificationMeasures
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
if judgeRecMeas == nil {
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
}
}
twoLevelTitle := "部门负责人"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
// 按钮
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, buttonClickAry[3])
buttonMap = append(buttonMap, buttonCont)
buttonCont.Type = 0
buttonCont.Text = "驳回"
buttonCont.Style = 3
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, buttonClickAry[3])
buttonMap = append(buttonMap, buttonCont)
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
//向考核发起人发起验收通知
var sendTextMsg sendmessage.ButtonNoticeTemplateMedium
sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap)
case 7:
//发起人验收
//1、修改审批流
scoreFlowMap := commonus.MapOut()
scoreFlowMap["sf_reply"] = 3
scoreFlowMap["sf_eite_time"] = time.Now().Unix()
global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_id` = ?", scoreFlowInfo.Id).Updates(scoreFlowMap)
//2、获取要抄送人员名单
var sendUserAry []string
//2.1 获取发起人部门负责人
launchUserIsTrue, launchUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.EvaluationDepartment) //获取发起人部门负责人
if launchUserIsTrue == true {
for _, lau_v := range launchUserList {
sendUserAry = append(sendUserAry, lau_v)
}
}
//2.2、获取职责部门负责人
dutyUserIsTrue, dutyUserList := commonus.GetSendMsgUserAry(16182159043990656, scoreFlowInfo.DutyDepartment) //获取职责部门负责人
if dutyUserIsTrue == true {
for _, duty_v := range dutyUserList {
sendUserAry = append(sendUserAry, duty_v)
}
}
//2.3、获取职责部门内勤
dutyOffUserIsTrue, dutyOffUserList := commonus.GetSendMsgUserAry(16118387069540343, scoreFlowInfo.DutyDepartment) //获取职责部门内勤
if dutyOffUserIsTrue == true {
for _, dutyOff_v := range dutyOffUserList {
sendUserAry = append(sendUserAry, dutyOff_v)
}
}
sendMsgToUserList := strings.Join(sendUserAry, "|")
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
//获取执行结果
var mainTitleDesc string
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
if flowContent.PlusReduceScore == 1 {
mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
} else {
mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
}
var reason string
commonus.GetDivisionOfResponsibility(orderId, 2)
if flowContent.Rectification == 1 {
buttonClickAry := strings.Split(t.EventKey, "_")
if len(buttonClickAry) > 4 {
var recMeasCont assessmentmodel.RectificationMeasures
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
if judgeRecMeas == nil {
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
}
}
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrlTitle := "查看详情==============>LOOK"
sourceDesc := "验收通过"
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendMsgToUserList, taskId, title, desc, mainTitleDesc, reason, "验收", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
default:
fmt.Printf("未知操作!\n")
}
} else {
//驳回
//1:创建;2:创建人部门负责人审批:3:责任划分(内勤);4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
switch flowLog[currentSetp].NextStep {
case 1:
//发起人
case 2:
//发起人部门负责人
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, strconv.FormatInt(userContInfo.Key, 10))
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendButtonIsTrue == true {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
}
//1、退回到发起人重新发起审批
//获取发起人信息
var sendUser string = ""
faQiRen, _ := commonus.GetWorkUser(strconv.FormatInt(scoreFlowInfo.EvaluationUser, 10))
if faQiRen.WechatId != "" {
sendUser = faQiRen.WechatId
}
if faQiRen.WorkWechatId != "" {
sendUser = faQiRen.WorkWechatId
}
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
var quoteAreaTitle string = ""
if flowContent.PlusReduceScore == 1 {
quoteAreaTitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
} else {
quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
}
quoteAreaContent := flowContent.Reason
twoLevelTitle := "部门负责人"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/qualitative?id=%v", orderId)
jumpUrlTitle := "填写考核数据==============>GOTO"
sourceDesc := "驳回"
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUser, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
case 3:
//责任划分(相关部门内勤)
case 4:
//责任部门审批(部门负责人)
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendButtonIsTrue == true {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
}
//退回到本部门内勤
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
commonus.StepAddData(orderIdInt, 16182159043990656, 3, 7, strconv.FormatInt(userContInfo.Key, 10))
//1、获取本部门内勤
_, butCallBackUser := commonus.GetSendMsgUser(16118387069540343, userContInfo.DepartmentId) //获取对应部门内勤(高科)
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
var subtitle string = ""
if flowContent.PlusReduceScore == 1 {
subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
} else {
subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
}
//获取责任划分
subtitle = fmt.Sprintf("%v责任划分\n", subtitle)
var reason string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
if teamErr == nil {
for _, team_v := range teamBility {
if team_v["type"] != 3 {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
} else {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
}
}
}
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId)
jumpUrlTitle := "请前往处理============>GOTO"
sourceDesc := "驳回"
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(butCallBackUser, taskId, title, desc, subtitle, reason, "部门负责人", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
case 5:
//主要责任人整改
case 6:
//责任部门审批(部门负责人)
sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人
if sendButtonIsTrue == true {
buttonClickNAmeOtherEs := fmt.Sprintf("%v%v", userContInfo.Name, "已驳回")
t.UpdateButtonIng(sendButtonList, buttonClickNAmeOtherEs)
}
//退回到主要责任人
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, strconv.FormatInt(userContInfo.Key, 10))
//获取主要责任人
var personLiable []string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
if teamErr == nil {
for _, tm_v := range teamBility {
if tm_v["type"] == 1 {
personLiable = append(personLiable, tm_v["wechatid"].(string))
}
}
}
if len(personLiable) < 1 {
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
}
sendUserList := strings.Join(personLiable, "|")
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
//获取执行结果
var mainTitleDesc string
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
if flowContent.PlusReduceScore == 1 {
mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
} else {
mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
}
var reason string
commonus.GetDivisionOfResponsibility(orderId, 2)
if flowContent.Rectification == 1 {
buttonClickAry := strings.Split(t.EventKey, "_")
if len(buttonClickAry) > 4 {
var recMeasCont assessmentmodel.RectificationMeasures
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
if judgeRecMeas == nil {
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
}
}
}
// quoteAreaContent := flowContent.Reason
twoLevelTitle := "部门负责人"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", orderId)
jumpUrlTitle := "重新填写整改方案==============>GOTO"
sourceDesc := "驳回"
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10)
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
case 7:
//发起人验收
orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key
taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) //卡片唯一识别符
//是否需要整改
if scoreFlowInfo.Rectification == 1 {
//存在整改
commonus.StepAddData(orderIdInt, 0, 5, 5, strconv.FormatInt(userContInfo.Key, 10))
//获取主要责任人
var personLiable []string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 1)
if teamErr == nil {
for _, tm_v := range teamBility {
if tm_v["type"] == 1 {
personLiable = append(personLiable, tm_v["wechatid"].(string))
}
}
}
if len(personLiable) < 1 {
fmt.Printf("发送整改通知!没有主要负责人%v\n", teamBility)
}
sendUserList := strings.Join(personLiable, "|")
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
//获取执行结果
var mainTitleDesc string
mainTitleDesc = fmt.Sprintf("执行原因:%v\n", flowContent.Reason)
if flowContent.PlusReduceScore == 1 {
mainTitleDesc = fmt.Sprintf("%v加:%v%v\n", mainTitleDesc, flowContent.Score, unit)
} else {
mainTitleDesc = fmt.Sprintf("%v减:%v%v\n", mainTitleDesc, flowContent.Score, unit)
}
var reason string
commonus.GetDivisionOfResponsibility(orderId, 2)
if flowContent.Rectification == 1 {
buttonClickAry := strings.Split(t.EventKey, "_")
if len(buttonClickAry) > 4 {
var recMeasCont assessmentmodel.RectificationMeasures
judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error
if judgeRecMeas == nil {
reason = fmt.Sprintf("整改措施:\n%v", recMeasCont.Content)
}
}
}
// quoteAreaContent := flowContent.Reason
twoLevelTitle := "验收部门"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", orderId)
jumpUrlTitle := "重新填写整改方案==============>GOTO"
sourceDesc := "驳回"
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, mainTitleDesc, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
} else {
//不需要整改
commonus.StepAddData(orderIdInt, 0, 3, 5, strconv.FormatInt(userContInfo.Key, 10))
//2.3、获取职责部门内勤
_, dutyOffUserList := commonus.GetSendMsgUserAry(16118387069540343, scoreFlowInfo.DutyDepartment) //获取职责部门内勤
//获取考核项目关联项目
targettitle, detailedRulesTitle, detailedRulesInfo, unit, flowContent, _ := commonus.GetDutyAssociatedItems(orderId)
//一级文本处理
var title, desc string
if detailedRulesTitle != "" {
if targettitle != "" {
title = targettitle
desc = detailedRulesTitle
} else {
title = detailedRulesTitle
desc = detailedRulesInfo
}
} else if targettitle != "" {
title = targettitle
}
var subtitle string = ""
if flowContent.PlusReduceScore == 1 {
subtitle = fmt.Sprintf("加:%v%v\n", flowContent.Score, unit)
} else {
subtitle = fmt.Sprintf("扣除:%v%v\n", flowContent.Score, unit)
}
//获取责任划分
subtitle = fmt.Sprintf("%v责任划分\n", subtitle)
var reason string
teamBility, teamErr := commonus.GetDivisionOfResponsibility(orderId, 2)
if teamErr == nil {
for _, team_v := range teamBility {
if team_v["type"] != 3 {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["username"], team_v["weight"])
} else {
reason = fmt.Sprintf("%v%v:%v 占比:%v%\n", reason, team_v["typename"], team_v["temaname"], team_v["weight"])
}
}
}
twoLevelTitle := "验收部门"
twoLevelKeyName := userContInfo.DepartmentName
twoLevelKeyValue := userContInfo.Name
twoLevelUserId := t.FromUsername
cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId)
jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", orderId)
jumpUrlTitle := "重新填写整改方案==============>GOTO"
sourceDesc := "驳回"
sendUserSet := strings.Join(dutyOffUserList, "|")
var sendTextMsg sendmessage.TextNoticeTemplateMedium
sendTextMsg.SendMsgTextShare(sendUserSet, taskId, title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc)
}
default:
fmt.Printf("未知操作!\n")
}
}
}
//按钮模板回调处理 //按钮模板回调处理
func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter string) { func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter string) {
buttonClickNAme := "已批准" buttonClickNAme := "已批准"
buttonClickNAmeOther := "其他人已批准" buttonClickNAmeOther := "其他人已批准"
if clickEnter == "1" { // if clickEnter == "1" {
t.UpdateButton(t.FromUsername, buttonClickNAme) // t.UpdateButton(t.FromUsername, buttonClickNAme)
} else { // } else {
buttonClickNAme = "已驳回" // buttonClickNAme = "已驳回"
buttonClickNAmeOther = "其他人已驳回" // buttonClickNAmeOther = "其他人已驳回"
t.UpdateButton(t.FromUsername, buttonClickNAme) // t.UpdateButton(t.FromUsername, buttonClickNAme)
} // }UpdateButtonIng
//获取点击人信息 //获取点击人信息
userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername) userContInfoIstrue, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername)
//更新同级别其他人按钮 //更新同级别其他人按钮
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科) // _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
userCallAry := strings.Split(butCallBackUser, "|") // userCallAry := strings.Split(butCallBackUser, "|")
t.OtherClickButton(userCallAry, buttonClickNAme) // t.OtherClickButton(userCallAry, buttonClickNAme)
var scoreFlowInfo assessmentmodel.ScoreFlow var scoreFlowInfo assessmentmodel.ScoreFlow
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", scoreFlowKey).First(&scoreFlowInfo).Error judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", scoreFlowKey).First(&scoreFlowInfo).Error
fmt.Printf("1@@@@%v\n", scoreFlowInfo) fmt.Printf("1@@@@%v\n", scoreFlowInfo)
if judegFlowErr == nil { if judegFlowErr == nil {
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科) // _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
userCallAry := strings.Split(butCallBackUser, "|") // userCallAry := strings.Split(butCallBackUser, "|")
t.OtherClickButton(userCallAry, buttonClickNAme) // t.OtherClickButton(userCallAry, buttonClickNAme)
return // return
} }
fmt.Printf("scoreFlowKey ----------------------------------> %v\n", scoreFlowKey) fmt.Printf("scoreFlowKey ----------------------------------> %v\n", scoreFlowKey)
//获取审批流程 //获取审批流程
@ -98,10 +851,10 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog)
if jsonFlowErr != nil || len(flowLog) < 1 { if jsonFlowErr != nil || len(flowLog) < 1 {
_, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科) // _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科)
userCallAry := strings.Split(butCallBackUser, "|") // userCallAry := strings.Split(butCallBackUser, "|")
t.OtherClickButton(userCallAry, buttonClickNAme) // t.OtherClickButton(userCallAry, buttonClickNAme)
return // return
} }
if userContInfoIstrue == true { if userContInfoIstrue == true {
@ -151,7 +904,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter
userKeyInt = divisResponInfo.UserKey userKeyInt = divisResponInfo.UserKey
} }
callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, keyNumber, scoreFlowInfo.PlusReduceScore) callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, keyNumber, scoreFlowInfo.PlusReduceScore)
fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg) fmt.Printf("更新销售发送1信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg)
} else { } else {
buttonClickAry := strings.Split(t.EventKey, "_") buttonClickAry := strings.Split(t.EventKey, "_")
if len(buttonClickAry) < 4 { if len(buttonClickAry) < 4 {

40
gin_server_admin/api/wechatapp/sendmessage/apphandle.go

@ -105,6 +105,13 @@ func (s *TextNoticeTemplateMedium) SendMessage(appName string) ([]byte, bool, st
// fmt.Printf("%v-------------->%v\n", string(sendJsonData), string(addDePartMent)) // fmt.Printf("%v-------------->%v\n", string(sendJsonData), string(addDePartMent))
return addDePartMent, true, msg return addDePartMent, true, msg
} }
/*
@userList 接收人
@msgType 模板类型
@CardType 卡片类型
@taskId 卡片识别ID
*/
func (s *TextNoticeTemplateMedium) Inset(userList, msgType, CardType string, taskId int64) { func (s *TextNoticeTemplateMedium) Inset(userList, msgType, CardType string, taskId int64) {
s.Touser = userList s.Touser = userList
if CardType != "" { if CardType != "" {
@ -335,3 +342,36 @@ func (s *TextNoticeTemplateMedium) InsetContNew(userList, msgType, CardType, tas
} }
} }
func (s *ButtonNoticeTemplateMedium) InsetContNew(userList, msgType, CardType, taskId, sourceDesc string) {
s.Touser = userList
if CardType != "" {
s.MsgType = msgType
} else {
s.MsgType = "template_card"
}
appId, _ := strconv.ParseInt(global.GVA_CONFIG.WorkWechatSchool.AgentId, 10, 64)
s.AgentId = appId
s.EnableIdTrans = 0
s.EnableDuplicateCheck = 0
s.DuplicateCheckInterval = 1800
// s.TemplateCard.CardType = "text_notice"
if CardType != "" {
s.TemplateCard.CardType = CardType
} else {
s.TemplateCard.CardType = "button_interaction"
}
//卡片来源样式信息,不需要来源样式可不填写(非必填)
s.TemplateCard.Source.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png"
s.TemplateCard.Source.Desc = sourceDesc
s.TemplateCard.Source.DescColor = 2
if taskId == "" {
taskIdInt := commonus.GetFileNumberEs()
s.TemplateCard.TaskId = strconv.FormatInt(taskIdInt, 10)
} else {
s.TemplateCard.TaskId = taskId
}
}

111
gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go

@ -398,3 +398,114 @@ func (t *TextNoticeTemplateMedium) SendNewsMsgText(sendUserList, taskId, title,
callbakcMsg, isTrueCall, callBackCont = t.SendMessage("school") callbakcMsg, isTrueCall, callBackCont = t.SendMessage("school")
return return
} }
//发送文本信息通用
/*
@sendUserList 信息接收人
@taskId 任务id同一个应用任务id不能重复只能由数字字母和_-@组成最长128字节填了action_menu字段的话本字段必填
@Title 一级标题建议不超过36个字
@Desc 标题辅助信息建议不超过44个字
@quoteAreaTitle 引用文献标题
@quoteAreaContent 引用文献内容
@twoLevelTitle 二级文本标题
@twoLevelKeyName 二级标题建议不超过5个字
@twoLevelValue 二级文本如果horizontal_content_list.type是2该字段代表文件名称要包含文件类型建议不超过30个字
@twoLevelUserId 成员详情的useridhorizontal_content_list.type是3时必填
@cardJumpUrl 整体卡片跳转链接
@jumpUrl 底部标题跳转链接
@jumpUrlTitle 跳转链接文案
@sourceDesc 左上角标题
*/
func (t *TextNoticeTemplateMedium) SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) {
if sourceDesc != "" {
sourceDesc = fmt.Sprintf("知行学院 - %v", sourceDesc)
} else {
sourceDesc = "知行学院"
}
t.InsetContNew(sendUserList, "template_card", "text_notice", taskId, sourceDesc)
//获取考核详情
t.TemplateCard.MainTitle.Title = title
t.TemplateCard.MainTitle.Desc = desc
//引用文献样式
t.TemplateCard.QuoteArea.Type = 0
t.TemplateCard.QuoteArea.Title = quoteAreaTitle
t.TemplateCard.QuoteArea.QuoteText = quoteAreaContent
var htalConListStrMap []HorizontalContentListType
var htalConListStrCon HorizontalContentListType
//二级普通文本,
t.TemplateCard.SubTitleText = twoLevelTitle
// 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
htalConListStrCon.Type = 3 //链接类型,0或不填代表不是链接,1 代表跳转url,2 代表下载附件,3 代表点击跳转成员详情
htalConListStrCon.KeyName = twoLevelKeyName //二级标题,建议不超过5个字
htalConListStrCon.Value = twoLevelKeyValue //二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,(
htalConListStrCon.UserId = twoLevelUserId //成员详情的userid,horizontal_content_list.type是3时必填
htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
t.TemplateCard.HorizontalContentList = htalConListStrMap
//整体卡片的点击跳转事件
t.TemplateCard.CardAction.Type = 1
t.TemplateCard.CardAction.Url = cardJumpUrl
//地板处理
var jumpListStruct JumpListType
jumpListStruct.Type = 1
jumpListStruct.Title = jumpUrlTitle //跳转链接样式的文案内容,建议不超过18个字
jumpListStruct.Url = jumpUrl
t.TemplateCard.JumpList = append(t.TemplateCard.JumpList, jumpListStruct)
callbakcMsg, isTrueCall, callBackCont = t.SendMessage("school")
return
}
/*
通用按钮发送
@sendUserList 接收人
@taskId 任务id同一个应用任务id不能重复只能由数字字母和_-@组成最长128字节填了action_menu字段的话本字段必填
@sourceDesc 左上角标题
@Title 一级标题建议不超过36个字
@Desc 一级标题辅助信息建议不超过44个字
@subtitle 二级文献标题
@reason 二级文献内容
@twoLevelTitle 二级文本标题
@twoLevelKeyName 二级标题建议不超过5个字
@twoLevelValue 二级文本如果horizontal_content_list.type是2该字段代表文件名称要包含文件类型建议不超过30个字
@twoLevelUserId 成员详情的useridhorizontal_content_list.type是3时必填
@cardJumpUrl 整体卡片跳转链接
@buttonMap 按钮组合
*/
func (t *ButtonNoticeTemplateMedium) SendButtonShare(sendUserList, taskId, sourceDesc, Title, Desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl string, buttonMap []ButtonListtype) (callbakcMsg []byte, isTrueCall bool, callBackCont string) {
if sourceDesc != "" {
sourceDesc = fmt.Sprintf("知行学院 - %v", sourceDesc)
} else {
sourceDesc = "知行学院"
}
t.InsetContNew(sendUserList, "template_card", "button_interaction", taskId, sourceDesc)
//获取考核详情
t.TemplateCard.MainTitle.Title = Title
t.TemplateCard.MainTitle.Desc = Desc
//引用文献样式
t.TemplateCard.QuoteArea.Type = 0
t.TemplateCard.QuoteArea.Title = subtitle
t.TemplateCard.QuoteArea.QuoteText = reason
//二级普通文本区域,
//二级普通文本标题,
t.TemplateCard.SubTitleText = twoLevelTitle
var htalConListStrMap []HorizontalContentListType
var htalConListStrCon HorizontalContentListType
// 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
htalConListStrCon.Type = 3 //链接类型,0或不填代表不是链接,1 代表跳转url,2 代表下载附件,3 代表点击跳转成员详情
htalConListStrCon.KeyName = twoLevelKeyName //二级标题,建议不超过5个字
htalConListStrCon.Value = twoLevelKeyValue //二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,(
htalConListStrCon.UserId = twoLevelUserId //成员详情的userid,horizontal_content_list.type是3时必填
htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
t.TemplateCard.HorizontalContentList = htalConListStrMap
t.TemplateCard.CardAction.Type = 1
t.TemplateCard.CardAction.Url = cardJumpUrl
//按钮列表,列表长度不超过6(必填)
t.TemplateCard.ButtonList = buttonMap
callbakcMsg, isTrueCall, callBackCont = t.SendMessage("school")
return
}

422
gin_server_admin/commonus/publichaneld.go

@ -4,6 +4,7 @@ package commonus
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"math"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -707,6 +708,21 @@ func GetUesrContForWechatID(wechatId string) (isTrue bool, myCont PublicUserCont
userErr := global.GVA_DB_Master.Model(&testpage.WorkMan{}).Select("worker_man.*", "worker_man_data.*").Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key").Where("`qywx_key` = ? OR `wx_key` = ?", wechatId, wechatId).Find(&userCont).Error userErr := global.GVA_DB_Master.Model(&testpage.WorkMan{}).Select("worker_man.*", "worker_man_data.*").Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key").Where("`qywx_key` = ? OR `wx_key` = ?", wechatId, wechatId).Find(&userCont).Error
userInfo := MapOut() userInfo := MapOut()
if userErr == nil { if userErr == nil {
userIconUrl := ""
if userCont.Icon == "" {
wechatInfo, wechatInfoErr := GetWorkWechatDuiZhao(wechatId)
if wechatInfoErr == true {
if wechatInfo.ThumbAvatar != "" {
userIconUrl = wechatInfo.ThumbAvatar
} else {
userIconUrl = wechatInfo.Avatar
}
}
} else {
userIconUrl = userCont.Icon
}
userInfo["number"] = userCont.Number userInfo["number"] = userCont.Number
userInfo["departmentid"] = userCont.DepartmentId userInfo["departmentid"] = userCont.DepartmentId
userInfo["workshopid"] = userCont.WorkshopId userInfo["workshopid"] = userCont.WorkshopId
@ -728,7 +744,8 @@ func GetUesrContForWechatID(wechatId string) (isTrue bool, myCont PublicUserCont
userInfo["entrytime"] = TimeStampToDate(userCont.EntryTime, 6) userInfo["entrytime"] = TimeStampToDate(userCont.EntryTime, 6)
userInfo["quittimeattr"] = TimeStampToDate(userCont.QuitTimeAttr, 6) userInfo["quittimeattr"] = TimeStampToDate(userCont.QuitTimeAttr, 6)
userInfo["addrest"] = userCont.Addrest userInfo["addrest"] = userCont.Addrest
userInfo["icon"] = userCont.Icon
userInfo["icon"] = userIconUrl
userInfo["nickname"] = userCont.NickName userInfo["nickname"] = userCont.NickName
isTrue = true isTrue = true
myCont.Number = userCont.Number myCont.Number = userCont.Number
@ -781,7 +798,7 @@ func GetUesrContForWechatID(wechatId string) (isTrue bool, myCont PublicUserCont
myCont.EntryTime = TimeStampToDate(userCont.EntryTime, 6) myCont.EntryTime = TimeStampToDate(userCont.EntryTime, 6)
myCont.QuitTimeAttr = TimeStampToDate(userCont.QuitTimeAttr, 6) myCont.QuitTimeAttr = TimeStampToDate(userCont.QuitTimeAttr, 6)
myCont.Addrest = userCont.Addrest myCont.Addrest = userCont.Addrest
myCont.Icon = userCont.Icon myCont.Icon = userIconUrl
myCont.NickName = userCont.NickName myCont.NickName = userCont.NickName
redisClient.SetRedisTime(604800) redisClient.SetRedisTime(604800)
@ -1193,6 +1210,29 @@ func GetSendMsgUser(id, departmentId int64) (isTrue bool, userStr string) {
return return
} }
//获取企业微信信息接收人数组形态
func GetSendMsgUserAry(id, departmentId int64) (isTrue bool, userStr []string) {
isTrue = false
err, departmentCont := GetBranchFactory(departmentId)
if err != true {
return
}
err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatId))
if err != true {
return
}
var userList []string
for _, v := range roleGroup {
userList = append(userList, v.Id)
}
if len(userList) > 0 {
// userStr = strings.Join(userList, "|")
userStr = userList
isTrue = true
}
return
}
//获取加减分订单 //获取加减分订单
func GetScoreFlow(orderId string) (content assessmentmodel.ScoreFlow, isTrue bool) { func GetScoreFlow(orderId string) (content assessmentmodel.ScoreFlow, isTrue bool) {
isTrue = false isTrue = false
@ -1319,3 +1359,381 @@ func GetWorkUser(key string) (userCont testpage.PersonalDetails, isTrue bool) {
} }
return return
} }
type sendMsg struct {
Title string `json:"title"`
Unit string `json:"unit"` //单位"`
}
//查看定量考核数据
func LookRationInfo(id int64) (cont sendMsg, isTrue bool) {
isTrue = false
qeInfo, isTrue := GetQualitativeEvaluation(strconv.FormatInt(id, 10))
if isTrue == false {
return
}
targetCong, isTrues := GetTargetInfo(qeInfo.Target)
if isTrues == false {
return
}
cont.Title = targetCong.Title
cont.Unit = targetCong.Uniteing
isTrue = true
if qeInfo.DetailedTarget != 0 {
deTarInfo, isTruees := GetDetailedTargetInfo(qeInfo.DetailedTarget)
if isTruees == true {
cont.Title = deTarInfo.Title
}
}
return
}
//获取企业微信对照表
func GetWorkWechatDuiZhao(openid string) (userInfoStruct wechat.WechatUsers, isTrue bool) {
isTrue = false
myErr := global.GVA_DB_WatchDate.Where("userid = ?", openid).First(&userInfoStruct).Error
if myErr == nil {
isTrue = true
}
return
}
//步骤内容写入
/*
@flowID 流程ID
@userKey 操作人key
@roleGroupId 角色组Id
@stepName 步骤名称
@stepInt 当前是第几部
@nextStep 下一步
*/
func StepAddData(flowID, roleGroupId int64, nextStep, stepName int, userKey string) {
var evalProCont assessmentmodel.EvaluationProcess
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", flowID).First(&evalProCont).Error
var flowStepAryMap []FlowStep
if judgeErr != nil {
var flowSteping FlowStep
flowSteping.Step = 1
flowSteping.StepName = GetSetpName(stepName) //步骤名称
flowSteping.Key = strconv.FormatInt(flowID, 10) //流程ID
flowSteping.State = 2 // (1:为操作;2:已操作;3:驳回)
flowSteping.RoleGroup = roleGroupId //角色组
flowSteping.NextStep = 2 //下一步 1:创建;2:创建人部门负责人审批:3:责任划分;4:责任部门审批;5:主要责任人整改;6:责任部门审批;7:验收
flowSteping.ClickName = userKey //操作人
flowSteping.AddTime = time.Now().Unix() //添加时间
flowStepAryMap = append(flowStepAryMap, flowSteping)
} 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.StepName = GetSetpName(stepName) //步骤名称
flowStep.Key = strconv.FormatInt(flowID, 10)
flowStep.State = 2
flowStep.RoleGroup = roleGroupId
flowStep.NextStep = nextStep
flowStep.ClickName = userKey
flowStep.AddTime = time.Now().Unix()
flowStepArys = append(flowStepArys, flowStep)
saveData := MapOut()
saveData["ep_time"] = time.Now().Unix()
saveData["ep_role_group"] = roleGroupId
saveData["ep_step"] = evalProCont.Step + 1
flowStepJson, flowStepErr := json.Marshal(flowStepArys)
if flowStepErr == nil {
saveData["ep_cont"] = string(flowStepJson)
}
EiteDutiesInfoes(evalProCont.Id, saveData)
}
}
//编辑流程步进器
func EiteDutiesInfoes(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) {
isTrue = false
infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_id` = ?", saveId).Updates(saveData).Error
if infoErr != nil {
return
}
isTrue = true
return
}
//步骤名称
func GetSetpName(setId int) (setpName string) {
switch setId {
case 1:
setpName = "创建申请"
case 2:
setpName = "审核确认"
case 3:
setpName = "责任划分"
case 4:
setpName = "整改措施"
case 5:
setpName = "验收"
case 6:
setpName = "抄送"
case 7:
setpName = "部门负责人"
default:
setpName = "创建申请"
}
return
}
//四舍五入
/*
@val 目标值
@precision 保留几位
*/
func Round(val float64, precision int) float64 {
p := math.Pow10(precision)
return math.Floor(val*p+0.5) / p
}
//获取班组成员
func GetTeamUserList(group, department, postId, teamId string) (userCont []testpage.PersonalDetails, isTrue bool) {
wheAry := MapOut()
wheAry["wm_group"] = group
wheAry["wm_bf_id"] = department
wheAry["wm_ws_id"] = postId
wheAry["wm_tema"] = teamId
// userCont, isTrue = GetUserInfoPublic("worker_man.*,worker_man_data.*", wheAry)
isTrue = false
var userInfo testpage.WorkMan
userErr := global.GVA_DB_Master.Model(&userInfo).Select("worker_man.*,worker_man_data.*").Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key").Where(wheAry).Find(&userCont).Error
if userErr == nil {
isTrue = true
}
return
}
//编辑分数流水
func EiteScoreFlow(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) {
isTrue = false
infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_key` = ?", saveId).Updates(saveData).Error
if infoErr != nil {
return
}
isTrue = true
return
}
//获取通用责任划分
func GetDivisionOfResponsibility(orderId string, class int) (contList []map[string]interface{}, err error) {
var dataContList []assessmentmodel.DivisionResponsibilities
err = global.GVA_DB_Performanceappraisal.Where("`df_sf_id` = ?", orderId).Order("df_type ASC").Find(&dataContList).Error
if err != nil {
return
}
if class == 1 {
for _, v := range dataContList {
cont := MapOut()
cont["type"] = v.Type
switch v.Type {
case 1:
cont["typename"] = "主要责任人"
case 2:
cont["typename"] = "互保责任人"
case 3:
cont["typename"] = "责任班组"
case 4:
cont["typename"] = "责任班组长"
case 5:
cont["typename"] = "主管"
case 6:
cont["typename"] = "三大员"
case 7:
cont["typename"] = "主任"
case 8:
cont["typename"] = "厂长"
default:
cont["typename"] = "主要责任人"
}
cont["weight"] = v.Weight
cont["userkey"] = v.UserKey
if v.UserName != "" {
cont["username"] = v.UserName
} else {
//获取人员信息
userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10))
if userContErr == true {
cont["username"] = userCont.Name
} else {
cont["username"] = v.UserName
}
}
cont["groupid"] = v.Group
groupErr, groupInfo := GetGroupCont(v.Group)
if groupErr == true {
cont["groupname"] = groupInfo.Name
} else {
cont["groupname"] = ""
}
cont["departmentid"] = v.Department
departErr, departInfo := GetBranchFactory(v.Department)
if departErr == true {
cont["departmentname"] = departInfo.Name
} else {
cont["departmentname"] = ""
}
cont["temaid"] = v.Tema
teamErr, teamInfo := GetTeaming(v.Tema)
if teamErr == true {
cont["temaname"] = teamInfo.Name
} else {
cont["temaname"] = ""
}
cont["taskid"] = v.DistributionUser
contList = append(contList, cont)
}
} else {
teamAry := MapOut()
for _, v := range dataContList {
if v.Type != 3 {
cont := MapOut()
cont["type"] = v.Type
switch v.Type {
case 1:
cont["typename"] = "主要责任人"
case 2:
cont["typename"] = "互保责任人"
case 3:
cont["typename"] = "责任班组"
case 4:
cont["typename"] = "责任班组长"
case 5:
cont["typename"] = "主管"
case 6:
cont["typename"] = "三大员"
case 7:
cont["typename"] = "主任"
case 8:
cont["typename"] = "厂长"
default:
cont["typename"] = "主要责任人"
}
cont["weight"] = v.Weight
cont["userkey"] = v.UserKey
if v.UserName != "" {
cont["username"] = v.UserName
} else {
//获取人员信息
userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10))
if userContErr == true {
cont["username"] = userCont.Name
} else {
cont["username"] = v.UserName
}
}
cont["groupid"] = v.Group
groupErr, groupInfo := GetGroupCont(v.Group)
if groupErr == true {
cont["groupname"] = groupInfo.Name
} else {
cont["groupname"] = ""
}
cont["departmentid"] = v.Department
departErr, departInfo := GetBranchFactory(v.Department)
if departErr == true {
cont["departmentname"] = departInfo.Name
} else {
cont["departmentname"] = ""
}
cont["temaid"] = v.Tema
teamErr, teamInfo := GetTeaming(v.Tema)
if teamErr == true {
cont["temaname"] = teamInfo.Name
} else {
cont["temaname"] = ""
}
cont["taskid"] = v.DistributionUser
contList = append(contList, cont)
} else {
teamAry["type"] = v.Type
switch v.Type {
case 1:
teamAry["typename"] = "主要责任人"
case 2:
teamAry["typename"] = "互保责任人"
case 3:
teamAry["typename"] = "责任班组"
case 4:
teamAry["typename"] = "责任班组长"
case 5:
teamAry["typename"] = "主管"
case 6:
teamAry["typename"] = "三大员"
case 7:
teamAry["typename"] = "主任"
case 8:
teamAry["typename"] = "厂长"
default:
teamAry["typename"] = "主要责任人"
}
teamAry["weight"] = v.Weight
teamAry["userkey"] = v.UserKey
//获取人员信息
userCont, userContErr := GetWorkUser(strconv.FormatInt(v.UserKey, 10))
teamAry["wechatid"] = ""
if v.UserName != "" {
teamAry["username"] = v.UserName
if userContErr == true {
if userCont.WechatId != "" {
teamAry["wechatid"] = userCont.WechatId
}
if userCont.WorkWechatId != "" {
teamAry["wechatid"] = userCont.WorkWechatId
}
}
} else {
if userContErr == true {
teamAry["username"] = userCont.Name
if userCont.WechatId != "" {
teamAry["wechatid"] = userCont.WechatId
}
if userCont.WorkWechatId != "" {
teamAry["wechatid"] = userCont.WorkWechatId
}
}
}
teamAry["groupid"] = v.Group
groupErr, groupInfo := GetGroupCont(v.Group)
if groupErr == true {
teamAry["groupname"] = groupInfo.Name
} else {
teamAry["groupname"] = ""
}
teamAry["departmentid"] = v.Department
departErr, departInfo := GetBranchFactory(v.Department)
if departErr == true {
teamAry["departmentname"] = departInfo.Name
} else {
teamAry["departmentname"] = ""
}
teamAry["temaid"] = v.Tema
teamErr, teamInfo := GetTeaming(v.Tema)
if teamErr == true {
teamAry["temaname"] = teamInfo.Name
} else {
teamAry["temaname"] = ""
}
teamAry["taskid"] = v.DistributionUser
}
}
if len(teamAry) > 0 {
contList = append(contList, teamAry)
}
}
return
}

12
gin_server_admin/commonus/publicstruct.go

@ -73,3 +73,15 @@ type roleGroupBodyAry struct {
Bfid string `json:"bf_id"` Bfid string `json:"bf_id"`
Icons string `json:"icons"` Icons string `json:"icons"`
} }
//流程步进
type FlowStep struct {
Step int `json:"step"` //当前是第几步
Key string `json:"key"` //任务卡ID
State int `json:"state"` //状态
RoleGroup int64 `json:"rolefroup"` //角色组
ClickName string `json:"clickname"` //操作人
AddTime int64 `json:"addtime"` //添加时间
StepName string `json:"stepname"` //步骤名称
NextStep int `json:"nextstep"` //下一步 1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人
}

4
gin_server_admin/config.yaml

@ -26,6 +26,10 @@ rediswechat:
db: 1 db: 1
addr: 127.0.0.1:6379 addr: 127.0.0.1:6379
password: "" password: ""
rediswechat2:
db: 2
addr: 127.0.0.1:6379
password: ""
redisprefix: redisprefix:
prefix: "HXGK_GO_ZhixingCollege" prefix: "HXGK_GO_ZhixingCollege"
alias: "dev" alias: "dev"

1
gin_server_admin/config/config.go

@ -5,6 +5,7 @@ type Server struct {
Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"` Zap Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"` Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
WechatRedis Redis `mapstructure:"rediswechat" json:"rediswechat" yaml:"rediswechat"` WechatRedis Redis `mapstructure:"rediswechat" json:"rediswechat" yaml:"rediswechat"`
WechatRedis2 Redis `mapstructure:"rediswechat2" json:"rediswechat2" yaml:"rediswechat2"`
RedisPrefix RedisPrefixStr `mapstructure:"redisprefix" json:"redisprefix" yaml:"redisprefix"` //redis键浅醉 RedisPrefix RedisPrefixStr `mapstructure:"redisprefix" json:"redisprefix" yaml:"redisprefix"` //redis键浅醉
Email Email `mapstructure:"email" json:"email" yaml:"email"` Email Email `mapstructure:"email" json:"email" yaml:"email"`
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"` Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`

1
gin_server_admin/core/server.go

@ -18,6 +18,7 @@ func RunWindowsServer() {
//初始化企业微信redis //初始化企业微信redis
initialize.WechatRedis() initialize.WechatRedis()
initialize.WechatRedis2()
if global.GVA_CONFIG.System.UseMultipoint { if global.GVA_CONFIG.System.UseMultipoint {
// 初始化redis服务 // 初始化redis服务

2
gin_server_admin/global/global.go

@ -44,7 +44,7 @@ var (
//企业微信专用redis //企业微信专用redis
GVA_REDIS_WeChat *redis.Client GVA_REDIS_WeChat *redis.Client
GVA_REDIS_WeChat2 *redis.Client
//个人配置 //个人配置
// GVA_MyConfig config.MyConfig // GVA_MyConfig config.MyConfig
//鉴权 //鉴权

16
gin_server_admin/initialize/redis.go

@ -40,3 +40,19 @@ func WechatRedis() {
global.GVA_REDIS_WeChat = client global.GVA_REDIS_WeChat = client
} }
} }
func WechatRedis2() {
redisCfg := global.GVA_CONFIG.WechatRedis2
client := redis.NewClient(&redis.Options{
Addr: redisCfg.Addr,
Password: redisCfg.Password, // no password set
DB: redisCfg.DB, // use default DB
})
pong, err := client.Ping(context.Background()).Result()
if err != nil {
global.GVA_LOG.Error("企业微信Redis链接失败!, err:", zap.Any("err", err))
} else {
global.GVA_LOG.Info("企业微信Redis链接成功:", zap.String("pong", pong))
global.GVA_REDIS_WeChat2 = client
}
}

4
gin_server_admin/middleware/myjwt.go

@ -25,7 +25,7 @@ func MyAuthentication() gin.HandlerFunc {
c.Abort() c.Abort()
return return
} }
userAgent = "250"
userKeyInt, userKeyIntErr := strconv.ParseInt(userKey, 10, 64) userKeyInt, userKeyIntErr := strconv.ParseInt(userKey, 10, 64)
if userKeyIntErr != nil { if userKeyIntErr != nil {
response.FailWithDetailed(gin.H{"reload": true, "code": 2}, "未登录或非法访问", c) response.FailWithDetailed(gin.H{"reload": true, "code": 2}, "未登录或非法访问", c)
@ -55,7 +55,7 @@ func MyAuthentication() gin.HandlerFunc {
sha1Token := commonus.Sha1Encryption(sha1Str) sha1Token := commonus.Sha1Encryption(sha1Str)
// fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent) // fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent)
if sha1Token != userToken { if sha1Token != userToken {
response.FailWithDetailed(gin.H{"reload": true, "code": 3}, "授权已过期", c) response.FailWithDetailed(gin.H{"reload": true, "code": 3, "userAgent": userAgent, "sha1Token": sha1Token, "userToken": userToken, "tokenInfo": tokenInfo}, "授权已过期", c)
c.Abort() c.Abort()
return return
} }

3
gin_server_admin/model/assessmentmodel/performance_appraisal.go

@ -23,6 +23,7 @@ type ScoreFlow struct {
DutyDepartment int64 `json:"dutydepartment" gorm:"column:sf_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` DutyDepartment int64 `json:"dutydepartment" gorm:"column:sf_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"`
Reply int `json:"reply" gorm:"column:sf_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` Reply int `json:"reply" gorm:"column:sf_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"`
Rectification int `json:"rectification" gorm:"column:sf_rectification;type:tinyint(1) unsigned;default:1;not null;comment:1、需要整改;2:无需整改"` Rectification int `json:"rectification" gorm:"column:sf_rectification;type:tinyint(1) unsigned;default:1;not null;comment:1、需要整改;2:无需整改"`
HappenTime int64 `json:"happentime" gorm:"column:sf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"`
} }
func (ScoreFlow *ScoreFlow) TableName() string { func (ScoreFlow *ScoreFlow) TableName() string {
@ -39,7 +40,7 @@ type DivisionResponsibilities struct {
Department int64 `json:"department" gorm:"column:df_department_id;type:bigint(20) unsigned;default:0;not null;comment:责任人部门"` Department int64 `json:"department" gorm:"column:df_department_id;type:bigint(20) unsigned;default:0;not null;comment:责任人部门"`
Group int64 `json:"group" gorm:"column:df_group;type:bigint(20) unsigned;default:0;not null;comment:责任人集团"` Group int64 `json:"group" gorm:"column:df_group;type:bigint(20) unsigned;default:0;not null;comment:责任人集团"`
Tema int64 `json:"tema" gorm:"column:df_tema;type:bigint(20) unsigned;default:0;not null;comment:责任人班组"` Tema int64 `json:"tema" gorm:"column:df_tema;type:bigint(20) unsigned;default:0;not null;comment:责任人班组"`
Weight int `json:"weight" gorm:"column:df_weight;type:int(7) unsigned;default:0;not null;comment:比重"` Weight int64 `json:"weight" gorm:"column:df_weight;type:int(7) unsigned;default:0;not null;comment:比重"`
Time int64 `json:"time" gorm:"column:df_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` Time int64 `json:"time" gorm:"column:df_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
EiteTime int64 `json:"eitetime" gorm:"column:df_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` EiteTime int64 `json:"eitetime" gorm:"column:df_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"` DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"`

1
gin_server_admin/router/assessment/assessmentrouter.go

@ -187,6 +187,7 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) {
dutyIndexCodeRouter.POST("qualevalulist", authorityIndexApi.QualitativeEvaluation) // 定性考核列表 dutyIndexCodeRouter.POST("qualevalulist", authorityIndexApi.QualitativeEvaluation) // 定性考核列表
dutyIndexCodeRouter.POST("additionandsubtractionscore", authorityIndexApi.AdditionAndSubtractionScore) // 加减分 dutyIndexCodeRouter.POST("additionandsubtractionscore", authorityIndexApi.AdditionAndSubtractionScore) // 加减分
dutyIndexCodeRouter.POST("plusorminuspoints", authorityIndexApi.PlusOrMinusPoints) // 加减分NEW
dutyIndexCodeRouter.POST("adddivisionresponsibility", authorityIndexApi.AddDivisionResponsibility) // 划分责任人 dutyIndexCodeRouter.POST("adddivisionresponsibility", authorityIndexApi.AddDivisionResponsibility) // 划分责任人
dutyIndexCodeRouter.POST("addcorrectivemeasures", authorityIndexApi.AddCorrectiveMeasures) //添加整改措施 dutyIndexCodeRouter.POST("addcorrectivemeasures", authorityIndexApi.AddCorrectiveMeasures) //添加整改措施

2
gin_server_admin/router/systemadmin/dutyassess.go

@ -18,6 +18,6 @@ func (a *AdminRouter) InitStaffRouter(Router *gin.RouterGroup) {
adminRouter.POST("getdepartevaluate", authorityApi.GetDepartEvaluate) //获取部门考核列表 adminRouter.POST("getdepartevaluate", authorityApi.GetDepartEvaluate) //获取部门考核列表
adminRouter.POST("getdepartmentassesslist", authorityApi.GetDepartmentAssessList) //获取考核列表 adminRouter.POST("getdepartmentassesslist", authorityApi.GetDepartmentAssessList) //获取考核列表
adminRouter.POST("lookquantitativeconfig", authorityApi.LookQuantitativeConfig) // 查看定量考核目标设定
} }
} }

2
gin_server_admin/utils/redishandel/myredis.go

@ -39,6 +39,8 @@ func (r *RedisStoreType) SetRedisDb(dbId int) {
r.RedisDb = global.GVA_REDIS r.RedisDb = global.GVA_REDIS
case 1: case 1:
r.RedisDb = global.GVA_REDIS_WeChat r.RedisDb = global.GVA_REDIS_WeChat
case 2:
r.RedisDb = global.GVA_REDIS_WeChat2
default: default:
r.RedisDb = global.GVA_REDIS r.RedisDb = global.GVA_REDIS
} }

4
gin_server_admin/其他支持文件/config.yaml

@ -68,6 +68,10 @@ rediswechat:
db: 1 db: 1
addr: 127.0.0.1:6379 addr: 127.0.0.1:6379
password: "" password: ""
rediswechat2:
db: 2
addr: 127.0.0.1:6379
password: ""
redisprefix: redisprefix:
prefix: "HXGK_GO_ZhixingCollege" prefix: "HXGK_GO_ZhixingCollege"
alias: "dev" alias: "dev"

Loading…
Cancel
Save