32 changed files with 2348 additions and 100 deletions
@ -0,0 +1,6 @@ |
|||
package evaluation |
|||
|
|||
//数据评估
|
|||
type ApiGroup struct { |
|||
EvaluationApi EvaluationInterface |
|||
} |
|||
@ -0,0 +1,689 @@ |
|||
package evaluation |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
"fmt" |
|||
"strconv" |
|||
"strings" |
|||
"time" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/archiveapi" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/api/wechatapp/sendmessage" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" |
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//个人要执行的考核任务
|
|||
func (e *EvaluationInterface) Index(c *gin.Context) { |
|||
outPut := commonus.MapOut() |
|||
response.Result(0, outPut, "用户端个人要执行的考核任务", c) |
|||
} |
|||
|
|||
//获取定性考核任务列表
|
|||
func (e *EvaluationInterface) QualitativeEvaluation(c *gin.Context) { |
|||
isTrue, userCont := commonus.ClientIdentity() |
|||
if isTrue != true { |
|||
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
// var qualEvaList []assessmentmodel.QualitativeEvaluation
|
|||
// var detailsId []int64
|
|||
// listErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Group("qe_accept_evaluation").Find(&detailsId).Error
|
|||
// if listErr != nil || len(detailsId) < 1 {
|
|||
// response.Result(102, isTrue, "您没有要参加的考核项目!", c)
|
|||
// return
|
|||
// }
|
|||
// response.Result(0, detailsId, "用户端个人要执行的考核任务", c)
|
|||
var qualEvaList []assessmentmodel.QualitativeEvaluation |
|||
listErr := global.GVA_DB_Performanceappraisal.Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error |
|||
if listErr != nil || len(qualEvaList) < 1 { |
|||
response.Result(102, isTrue, "您没有要参加的考核项目!", c) |
|||
return |
|||
} |
|||
var uotContAry []TargetContOutCont |
|||
for _, v := range qualEvaList { |
|||
var uotCont TargetContOutCont |
|||
uotCont.Id = strconv.FormatInt(v.Id, 10) |
|||
uotCont.Type = v.Type |
|||
uotCont.Group = strconv.FormatInt(v.Group, 10) |
|||
groupErr, groupCont := commonus.GetGroupCont(v.Group) |
|||
if groupErr == true { |
|||
uotCont.GroupNAme = groupCont.Name |
|||
} |
|||
uotCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10) |
|||
deparConErr, deparConCont := commonus.GetBranchFactory(v.AcceptEvaluation) |
|||
if deparConErr == true { |
|||
uotCont.DepartmentName = deparConCont.Name |
|||
} |
|||
uotCont.Dimension = strconv.FormatInt(v.Dimension, 10) |
|||
dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(v.Dimension) |
|||
if dutyClassErr == true { |
|||
uotCont.DimensionName = dutyClassCont.Title |
|||
} |
|||
uotCont.Target = strconv.FormatInt(v.Target, 10) |
|||
targetInfo, targetErr := commonus.GetTargetInfo(v.Target) |
|||
if targetErr == true { |
|||
uotCont.TargetName = targetInfo.Title |
|||
} |
|||
uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) |
|||
info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) |
|||
if infoErr == true { |
|||
uotCont.TargetSunName = info.Title |
|||
} |
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(v.DetailedTarget) |
|||
if dtIsTrue == true { |
|||
uotCont.DetailedTargetName = dtCont.Title |
|||
uotCont.Content = dtCont.Content |
|||
} |
|||
uotCont.Unit = v.Unit |
|||
uotCont.ReferenceScore = v.ReferenceScore |
|||
uotCont.Cycles = v.Cycles |
|||
uotCont.CycleAttres = v.CycleAttres |
|||
uotCont.State = v.State |
|||
userAry := strings.Split(v.Operator, ",") |
|||
uotCont.UserList = userAry |
|||
for _, u_v := range userAry { |
|||
usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": u_v}) |
|||
if usErr == true { |
|||
var userCont QualEvalArrt |
|||
userCont.Id = u_v |
|||
userCont.Name = usCont.Name |
|||
uotCont.UserListAry = append(uotCont.UserListAry, userCont) |
|||
} |
|||
} |
|||
|
|||
uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) |
|||
uotContAry = append(uotContAry, uotCont) |
|||
} |
|||
response.Result(0, uotContAry, "用户端个人要执行的考核任务", c) |
|||
} |
|||
|
|||
//添加扣分或加分选项
|
|||
func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) { |
|||
isTrue, userCont := commonus.ClientIdentity() |
|||
if isTrue != true { |
|||
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
var requestData addPlusOrMinusPoints |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(102, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.PlanId == "" { |
|||
response.Result(103, requestData, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
planIdInt, planIdIntErr := strconv.ParseInt(requestData.PlanId, 10, 64) |
|||
if planIdIntErr != nil { |
|||
response.Result(104, requestData, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
//获取考核项目内容
|
|||
var programme assessmentmodel.QualitativeEvaluation |
|||
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planIdInt).First(&programme).Error |
|||
if judgeProgramme != nil { |
|||
response.Result(105, programme, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
if requestData.Type == 0 { |
|||
response.Result(106, requestData, "请问您是要进行加分还是减分?请指定,谢谢!", c) |
|||
return |
|||
} |
|||
if requestData.Score == 0 { |
|||
response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c) |
|||
return |
|||
} |
|||
if requestData.Reason == "" { |
|||
response.Result(108, requestData, "请输入您的原因,谢谢!", c) |
|||
return |
|||
} |
|||
if requestData.Rectification == 0 { |
|||
requestData.Rectification = 1 |
|||
} |
|||
operationTime := time.Now().Unix() |
|||
keyNumber := commonus.GetFileNumberEs() |
|||
var addScore assessmentmodel.ScoreFlow |
|||
addScore.EvaluationPlan = planIdInt |
|||
addScore.PlusReduceScore = requestData.Type |
|||
addScore.Score = requestData.Score |
|||
addScore.Key = keyNumber |
|||
addScore.Reason = requestData.Reason |
|||
addScore.Time = operationTime |
|||
addScore.EiteTime = operationTime |
|||
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) |
|||
if departmentIdErr == nil { |
|||
addScore.EvaluationDepartment = departmentId |
|||
} |
|||
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) |
|||
if userKeyErr == nil { |
|||
addScore.EvaluationUser = userKey |
|||
} |
|||
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64) |
|||
if userGroupErr == nil { |
|||
addScore.EvaluationGroup = userGroup |
|||
} |
|||
addScore.Year = commonus.ComputingTime(operationTime, 1) |
|||
addScore.Quarter = commonus.ComputingTime(operationTime, 1) |
|||
addScore.Month = commonus.ComputingTime(operationTime, 1) |
|||
addScore.Week = commonus.ComputingTime(operationTime, 1) |
|||
enclosure, enclosureErr := json.Marshal(requestData.Enclosure) |
|||
if enclosureErr == nil { |
|||
addScore.Enclosure = string(enclosure) |
|||
} |
|||
addScore.DutyGroup = programme.Group |
|||
addScore.DutyDepartment = programme.AcceptEvaluation |
|||
addScore.Rectification = requestData.Rectification |
|||
addScore.Reply = 1 |
|||
addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error |
|||
//步进内容
|
|||
|
|||
if addErr != nil { |
|||
response.Result(109, addErr, "数据写入失败", c) |
|||
return |
|||
} |
|||
var evalProCont assessmentmodel.EvaluationProcess |
|||
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", keyNumber).First(&evalProCont).Error |
|||
if judgeErr != nil { |
|||
var flowStepAryMaps []FlowStep |
|||
var flowSteping FlowStep |
|||
flowSteping.Step = 1 |
|||
flowSteping.Key = strconv.FormatInt(keyNumber, 10) |
|||
flowSteping.State = 1 |
|||
flowSteping.RoleGroup = 16118387069540343 |
|||
flowSteping.NextStep = 1 |
|||
flowStepAryMaps = append(flowStepAryMaps, flowSteping) |
|||
|
|||
fmt.Printf("%v------------------>%v\n", flowSteping, flowStepAryMaps) |
|||
|
|||
evalProCont.OrderKey = keyNumber |
|||
evalProCont.Step = 1 |
|||
evalProCont.State = 1 |
|||
evalProCont.RoleGroup = 16118387069540343 |
|||
evalProCont.Time = time.Now().Unix() |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepAryMaps) |
|||
if flowStepErr == nil { |
|||
evalProCont.Content = string(flowStepJson) |
|||
} |
|||
// fmt.Printf("------------------>%v\n", evalProCont)
|
|||
global.GVA_DB_Performanceappraisal.Create(&evalProCont) |
|||
} else { |
|||
var flowStepAry []FlowStep |
|||
var flowStepArys []FlowStep |
|||
json.Unmarshal([]byte(evalProCont.Content), &flowStepAry) |
|||
for _, f_v := range flowStepAry { |
|||
if f_v.Step == evalProCont.Step { |
|||
f_v.State = 2 |
|||
} |
|||
flowStepArys = append(flowStepArys, f_v) |
|||
} |
|||
var flowStep FlowStep |
|||
flowStep.Step = evalProCont.Step + 1 |
|||
flowStep.Key = strconv.FormatInt(keyNumber, 10) |
|||
flowStep.State = 1 |
|||
flowStep.RoleGroup = 16118387069540343 |
|||
flowStep.NextStep = 1 |
|||
flowStepArys = append(flowStepArys, flowStep) |
|||
|
|||
saveData := commonus.MapOut() |
|||
saveData["ep_time"] = time.Now().Unix() |
|||
saveData["ep_role_group"] = 16118387069540343 |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepArys) |
|||
if flowStepErr == nil { |
|||
saveData["ep_cont"] = string(flowStepJson) |
|||
} |
|||
EiteDutiesInfoes(evalProCont.Id, saveData) |
|||
fmt.Printf("----------3-------->%v\n", evalProCont) |
|||
} |
|||
//给相关部门内勤发送消息。确定相关责任人
|
|||
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤
|
|||
if sendUserIsTrue != true { |
|||
response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) |
|||
return |
|||
} |
|||
// response.Result(0, sendUserList, "数据写入成功", c)
|
|||
// return
|
|||
var mainTitle string = "" |
|||
var mainTitleDesc string = "" |
|||
if programme.Type == 1 { |
|||
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) |
|||
if detailedTargetErr == true { |
|||
if detailedTargetCont.Title != "" { |
|||
mainTitle = detailedTargetCont.Title |
|||
} else { |
|||
mainTitle = requestData.Reason |
|||
} |
|||
if programme.Content == "" { |
|||
mainTitleDesc = detailedTargetCont.Content |
|||
} else { |
|||
mainTitleDesc = programme.Content |
|||
} |
|||
} else { |
|||
mainTitle = strconv.FormatInt(programme.DetailedTarget, 10) |
|||
mainTitleDesc = programme.Content |
|||
} |
|||
} else { |
|||
targetCont, targetErr := commonus.GetTargetInfo(programme.Target) |
|||
if targetErr == true { |
|||
mainTitle = targetCont.Title |
|||
mainTitleDesc = programme.Content |
|||
} else { |
|||
mainTitleDesc = programme.Content |
|||
} |
|||
} |
|||
handleUrl := fmt.Sprintf("http://www.hxgk.group?key=%v", keyNumber) |
|||
callbakcMsg, isTrueCall, callBackCont := sendmessage.SendMsgPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, requestData.Reason, handleUrl, requestData.Type, departmentId, userKey, requestData.Score, keyNumber, "请前往处理") |
|||
outData := commonus.MapOut() |
|||
outData["callbakcMsg"] = string(callbakcMsg) |
|||
outData["isTrueCall"] = isTrueCall |
|||
outData["callBackCont"] = callBackCont |
|||
outData["addScore"] = addScore |
|||
outData["mainTitle"] = mainTitle |
|||
outData["mainTitleDesc"] = mainTitleDesc |
|||
|
|||
response.Result(0, outData, "数据写入成功", c) |
|||
} |
|||
|
|||
//添加责任人
|
|||
func (e *EvaluationInterface) AddDivisionResponsibility(c *gin.Context) { |
|||
isTrue, userCont := commonus.ClientIdentity() |
|||
if isTrue != true { |
|||
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
var requestData DivisionResponsibilityType |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(102, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.Id == "" { |
|||
response.Result(103, requestData, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
orderId, orderIdIntErr := strconv.ParseInt(requestData.Id, 10, 64) |
|||
if orderIdIntErr != nil { |
|||
response.Result(104, requestData, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
if len(requestData.UserList) < 1 { |
|||
response.Result(105, requestData, "请选择要考核的人员!", c) |
|||
return |
|||
} |
|||
var scoreFlowInfo assessmentmodel.ScoreFlow |
|||
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error |
|||
if judegFlowErr != nil { |
|||
response.Result(106, judegFlowErr, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
//获取考核项目内容
|
|||
var programme assessmentmodel.QualitativeEvaluation |
|||
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error |
|||
if judgeProgramme != nil { |
|||
response.Result(105, programme, "未知考核项目!请检查你的提交是否正确!", c) |
|||
return |
|||
} |
|||
//给相关部门内勤发送消息。确定相关责任人
|
|||
sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门内勤
|
|||
if sendUserIsTrue != true { |
|||
response.Result(109, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) |
|||
return |
|||
} |
|||
var reason string |
|||
var saveDataAry []assessmentmodel.DivisionResponsibilities |
|||
var saveDataErrAry []assessmentmodel.DivisionResponsibilities |
|||
for _, v := range requestData.UserList { |
|||
var saveDataCont assessmentmodel.DivisionResponsibilities |
|||
saveDataCont.ScoreFlow = orderId |
|||
saveDataCont.Type = v.Type |
|||
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) |
|||
if departmentIdErr == nil { |
|||
saveDataCont.EvaluationDepartment = departmentId |
|||
} |
|||
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) |
|||
if userKeyErr == nil { |
|||
saveDataCont.EvaluationUser = userKey |
|||
} |
|||
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64) |
|||
if userGroupErr == nil { |
|||
saveDataCont.EvaluationGroup = userGroup |
|||
} |
|||
|
|||
//获取操作人
|
|||
userFileStr := "wm_number,qywx_key,wx_key" |
|||
//操作人条件
|
|||
userWherAry := commonus.MapOut() |
|||
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|||
userWherAry["wm_key"] = v.UserKey |
|||
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) |
|||
saveDataCont.UserName = v.UserName |
|||
saveDataCont.Weight = v.Weight |
|||
saveDataCont.Time = time.Now().Unix() |
|||
saveDataCont.EiteTime = time.Now().Unix() |
|||
saveDataCont.DistributionUser = commonus.GetFileNumberEs() |
|||
var userWechatErr bool |
|||
var userWechat commonus.PublicUserCont |
|||
if userIsTrue == true { |
|||
if userConting.WechatId != "" { |
|||
userWechatErr, userWechat = commonus.GetUesrContForWechatID(userConting.WechatId) |
|||
} |
|||
if userConting.WorkWechatId != "" { |
|||
userWechatErr, userWechat = commonus.GetUesrContForWechatID(userConting.WorkWechatId) |
|||
} |
|||
} |
|||
if userWechatErr == true { |
|||
saveDataCont.UserKey = userWechat.Key |
|||
saveDataCont.Group = userWechat.Group |
|||
saveDataCont.Department = userWechat.DepartmentId |
|||
saveDataCont.Tema = userWechat.Tema |
|||
var zeren string |
|||
switch v.Type { |
|||
case 1: |
|||
zeren = "主要责任人" |
|||
case 2: |
|||
zeren = "互保责任人" |
|||
case 3: |
|||
zeren = "责任班组" |
|||
case 4: |
|||
zeren = "责任班组长" |
|||
case 5: |
|||
zeren = "主管" |
|||
case 6: |
|||
zeren = "三大员" |
|||
case 7: |
|||
zeren = "厂长、主任" |
|||
default: |
|||
zeren = "主要责任人" |
|||
} |
|||
reason = reason + fmt.Sprintf("%v:%v 责任占比:%v\n", zeren, v.UserName, v.Weight) |
|||
|
|||
saveDataAry = append(saveDataAry, saveDataCont) |
|||
} else { |
|||
saveDataErrAry = append(saveDataErrAry, saveDataCont) |
|||
} |
|||
} |
|||
if len(saveDataAry) < 1 { |
|||
response.Result(107, saveDataAry, "请检查您提交的要考核人员名单是否正确!", c) |
|||
return |
|||
} |
|||
global.GVA_DB_Performanceappraisal.Where("`df_sf_id` = ?", orderId).Delete(&assessmentmodel.DivisionResponsibilities{}) |
|||
writeDataErr := global.GVA_DB_Performanceappraisal.Create(&saveDataAry).Error |
|||
if writeDataErr != nil { |
|||
response.Result(108, writeDataErr, "数据写入失败", c) |
|||
return |
|||
} |
|||
flowSaveData := commonus.MapOut() |
|||
flowSaveData["sf_reply"] = 2 |
|||
flowSaveData["sf_eite_time"] = time.Now().Unix() |
|||
eiteScoreFlow(orderId, flowSaveData) |
|||
// return
|
|||
keyNumber := commonus.GetFileNumberEs() |
|||
var evalProCont assessmentmodel.EvaluationProcess |
|||
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&evalProCont).Error |
|||
// fmt.Printf("VVVVVVVVVVVVVVVVVVVVVVVVV%v\n", judgeErr)
|
|||
if judgeErr != nil { |
|||
var flowStepAry []FlowStep |
|||
var flowStep FlowStep |
|||
flowStep.Step = 1 |
|||
flowStep.Key = strconv.FormatInt(keyNumber, 10) |
|||
flowStep.State = 1 |
|||
flowStep.RoleGroup = 16182159043990656 |
|||
flowStep.NextStep = 2 |
|||
flowStepAry = append(flowStepAry, flowStep) |
|||
|
|||
evalProCont.OrderKey = orderId |
|||
evalProCont.Step = 1 |
|||
evalProCont.State = 1 |
|||
evalProCont.Time = time.Now().Unix() |
|||
evalProCont.RoleGroup = 16182159043990656 |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepAry) |
|||
if flowStepErr == nil { |
|||
evalProCont.Content = string(flowStepJson) |
|||
} |
|||
global.GVA_DB_Performanceappraisal.Create(&evalProCont) |
|||
// fmt.Printf("VVVVV--->%v\n", jsh)
|
|||
} else { |
|||
var flowStepAry []FlowStep |
|||
var flowStepArys []FlowStep |
|||
json.Unmarshal([]byte(evalProCont.Content), &flowStepAry) |
|||
for _, f_v := range flowStepAry { |
|||
if f_v.Step == evalProCont.Step { |
|||
f_v.State = 2 |
|||
} |
|||
flowStepArys = append(flowStepArys, f_v) |
|||
} |
|||
var flowStep FlowStep |
|||
flowStep.Step = evalProCont.Step + 1 |
|||
flowStep.Key = strconv.FormatInt(keyNumber, 10) |
|||
flowStep.State = 1 |
|||
flowStep.RoleGroup = 16182159043990656 |
|||
flowStep.NextStep = 2 |
|||
flowStepArys = append(flowStepArys, flowStep) |
|||
|
|||
saveData := commonus.MapOut() |
|||
saveData["ep_time"] = time.Now().Unix() |
|||
saveData["ep_role_group"] = 16182159043990656 |
|||
saveData["ep_step"] = evalProCont.Step + 1 |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepArys) |
|||
if flowStepErr == nil { |
|||
saveData["ep_cont"] = string(flowStepJson) |
|||
} |
|||
EiteDutiesInfoes(evalProCont.Id, saveData) |
|||
} |
|||
|
|||
// response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c)
|
|||
|
|||
var mainTitle string = "责任划分" |
|||
var mainTitleDesc string = "" |
|||
mainTitle = scoreFlowInfo.Reason |
|||
if scoreFlowInfo.PlusReduceScore == 1 { |
|||
mainTitleDesc = "增加:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit |
|||
} else { |
|||
mainTitleDesc = "扣除:" + strconv.FormatInt(scoreFlowInfo.Score, 10) + programme.Unit |
|||
} |
|||
|
|||
// if programme.Type == 1 {
|
|||
// detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget)
|
|||
// if detailedTargetErr == true {
|
|||
// if detailedTargetCont.Title != "" {
|
|||
// mainTitle = detailedTargetCont.Title
|
|||
// } else {
|
|||
// targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
|
|||
// if targetErr == true {
|
|||
// mainTitle = targetCont.Title
|
|||
// } else {
|
|||
// mainTitle = strconv.FormatInt(programme.Target, 10)
|
|||
// }
|
|||
// }
|
|||
// if programme.Content == "" {
|
|||
// mainTitleDesc = detailedTargetCont.Content
|
|||
// } else {
|
|||
// mainTitleDesc = programme.Content
|
|||
// }
|
|||
// } else {
|
|||
// mainTitle = strconv.FormatInt(programme.DetailedTarget, 10)
|
|||
// mainTitleDesc = programme.Content
|
|||
// }
|
|||
// } else {
|
|||
// targetCont, targetErr := commonus.GetTargetInfo(programme.Target)
|
|||
// if targetErr == true {
|
|||
// mainTitle = targetCont.Title
|
|||
// mainTitleDesc = programme.Content
|
|||
// } else {
|
|||
// mainTitleDesc = programme.Content
|
|||
// }
|
|||
// }
|
|||
subtitle := "责任划分" |
|||
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) |
|||
if departmentIdErr != nil { |
|||
departmentId = 1 |
|||
} |
|||
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) |
|||
if userKeyErr != nil { |
|||
userKey = 0 |
|||
} |
|||
|
|||
var buttonMap []sendmessage.ButtonListtype |
|||
var buttonCont sendmessage.ButtonListtype |
|||
buttonCont.Type = 0 |
|||
buttonCont.Text = "批准" |
|||
buttonCont.Style = 1 |
|||
buttonCont.Key = fmt.Sprintf("duty_%v_1", orderId) |
|||
buttonMap = append(buttonMap, buttonCont) |
|||
buttonCont.Type = 0 |
|||
buttonCont.Text = "驳回" |
|||
buttonCont.Style = 3 |
|||
buttonCont.Key = fmt.Sprintf("duty_%v_2", orderId) |
|||
buttonMap = append(buttonMap, buttonCont) |
|||
|
|||
callbakcMsg, isTrueCall, callBackCont, ss := sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, buttonMap) |
|||
outData := commonus.MapOut() |
|||
outData["callbakcMsg"] = string(callbakcMsg) |
|||
outData["isTrueCall"] = isTrueCall |
|||
outData["callBackCont"] = callBackCont |
|||
outData["addScore"] = ss |
|||
// outData["sendTextMsg"] = sendTextMsg
|
|||
|
|||
response.Result(0, outData, "数据写入成功", c) |
|||
} |
|||
|
|||
//添加整改措施
|
|||
func (e *EvaluationInterface) AddCorrectiveMeasures(c *gin.Context) { |
|||
isTrue, userCont := commonus.ClientIdentity() |
|||
if isTrue != true { |
|||
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) |
|||
if userKeyErr != nil { |
|||
response.Result(102, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) |
|||
if departmentIdErr != nil { |
|||
response.Result(103, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64) |
|||
if userGroupErr != nil { |
|||
response.Result(104, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) |
|||
return |
|||
} |
|||
var requestData CorrectiveMeasuresType |
|||
err := c.ShouldBindJSON(&requestData) |
|||
if err != nil { |
|||
response.Result(105, err, "数据获取失败!", c) |
|||
return |
|||
} |
|||
if requestData.OrderId == "" { |
|||
response.Result(106, err, "数据异常!", c) |
|||
return |
|||
} |
|||
orderidval, orderidvalErr := strconv.ParseInt(requestData.OrderId, 10, 64) |
|||
if orderidvalErr != nil { |
|||
response.Result(107, isTrue, "数据异常!!", c) |
|||
return |
|||
} |
|||
if requestData.Content == "" { |
|||
response.Result(108, err, "请输入整改内容!", c) |
|||
return |
|||
} |
|||
var addRecMeas assessmentmodel.RectificationMeasures |
|||
addRecMeas.UserKey = userKey |
|||
addRecMeas.Department = departmentId |
|||
addRecMeas.Group = userGroup |
|||
addRecMeas.OrderKey = orderidval |
|||
addRecMeas.State = 1 |
|||
addRecMeas.Time = time.Now().Unix() |
|||
addRecMeas.EiteTime = time.Now().Unix() |
|||
addRecMeas.Content = requestData.Content |
|||
enclosure, enclosureErr := json.Marshal(requestData.Enclosure) |
|||
if enclosureErr == nil { |
|||
addRecMeas.Enclosure = string(enclosure) |
|||
} |
|||
addErr := global.GVA_DB_Performanceappraisal.Create(&addRecMeas).Error |
|||
//步进内容
|
|||
if addErr != nil { |
|||
response.Result(109, addErr, "数据写入失败", c) |
|||
return |
|||
} |
|||
keyNumber := commonus.GetFileNumberEs() |
|||
UpEvaluationProcessApproval(orderidval, 16182159043990656, keyNumber, 4) |
|||
_, sendUserList := commonus.GetSendMsgUser(16182159043990656, departmentId) //获取对应部门负责人(高科)
|
|||
|
|||
var scoreFlowInfo assessmentmodel.ScoreFlow |
|||
judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderidval).First(&scoreFlowInfo).Error |
|||
if judegFlowErr != nil { |
|||
response.Result(110, err, "审批发送失败!", c) |
|||
return |
|||
} |
|||
var programme assessmentmodel.QualitativeEvaluation |
|||
judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error |
|||
if judgeProgramme != nil { |
|||
return |
|||
} |
|||
var mainTitle string = "" |
|||
if programme.DetailedTarget != 0 { |
|||
detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) |
|||
if detailedTargetErr == true { |
|||
mainTitle = detailedTargetCont.Title |
|||
} |
|||
} else { |
|||
detailedTargetCont, detailedTargetErr := commonus.GetTargetInfo(programme.Target) |
|||
if detailedTargetErr == true { |
|||
mainTitle = detailedTargetCont.Title |
|||
} |
|||
} |
|||
mainTitleDesc := scoreFlowInfo.Reason |
|||
subtitle := "整改内容:" |
|||
reason := requestData.Content |
|||
callbakcMsg, isTrueCall, callBackCont := SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKey, keyNumber, scoreFlowInfo.Key, addRecMeas.Id) |
|||
outData := commonus.MapOut() |
|||
outData["callbakcMsg"] = string(callbakcMsg) |
|||
outData["isTrueCall"] = isTrueCall |
|||
outData["callBackCont"] = callBackCont |
|||
outData["addRecMeas"] = addRecMeas |
|||
response.Result(0, outData, "数据写入成功", c) |
|||
} |
|||
|
|||
/* |
|||
发送文本任务卡 |
|||
@sendUserList 接收信息人员 |
|||
@Title 一级标题,建议不超过36个字 |
|||
@Desc 标题辅助信息,建议不超过44个字 |
|||
@Unit 考核计量单位 |
|||
@Reason 二级文本标题 |
|||
@handleUrl 访问Key |
|||
@Type 1:加分;2:减分 |
|||
@departmentId 执行考核部门 |
|||
@userKey 执行考核人 |
|||
@Score 考核分值 |
|||
@keyNumber 任务卡ID |
|||
@scoreReason 二级文本描述 |
|||
@subTitleText 下级 组件标题"考核上报部门:" |
|||
@formId 表单ID |
|||
*/ |
|||
func SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason string, departmentId, userKey, keyNumber, orderId, formId int64) (callbakcMsg []byte, isTrueCall bool, callBackCont string) { |
|||
if subtitle == "" { |
|||
subtitle = "整改内容" |
|||
} |
|||
var buttonMap []sendmessage.ButtonListtype |
|||
var buttonCont sendmessage.ButtonListtype |
|||
buttonCont.Type = 0 |
|||
buttonCont.Text = "批准" |
|||
buttonCont.Style = 1 |
|||
buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", orderId, formId) |
|||
buttonMap = append(buttonMap, buttonCont) |
|||
buttonCont.Type = 0 |
|||
buttonCont.Text = "驳回" |
|||
buttonCont.Style = 3 |
|||
buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", orderId, formId) |
|||
buttonMap = append(buttonMap, buttonCont) |
|||
callbakcMsg, isTrueCall, callBackCont, _ = sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, buttonMap) |
|||
return |
|||
} |
|||
@ -0,0 +1,184 @@ |
|||
package evaluation |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
"strconv" |
|||
"time" |
|||
|
|||
"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" |
|||
) |
|||
|
|||
//编辑流程步进器
|
|||
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 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 UpEvaluationProcessReject(orderKey int64) (evalProc assessmentmodel.EvaluationProcess, isTrue bool) { |
|||
isTrue = false |
|||
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderKey).First(&evalProc).Error |
|||
if judgeErr != nil { |
|||
return |
|||
} |
|||
var flowLog []FlowStep |
|||
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) |
|||
if jsonFlowErr != nil { |
|||
return |
|||
} |
|||
roleGroupStep := len(flowLog) - 1 |
|||
if roleGroupStep < 0 { |
|||
roleGroupStep = 0 |
|||
} |
|||
if len(flowLog) < 1 { |
|||
var rejectFlow FlowStep |
|||
rejectFlow.Step = 1 |
|||
rejectFlow.Key = strconv.FormatInt(orderKey, 10) |
|||
rejectFlow.State = 1 |
|||
rejectFlow.RoleGroup = 16118387069540343 |
|||
rejectFlow.NextStep = 2 |
|||
flowLog = append(flowLog, rejectFlow) |
|||
|
|||
evalProc.OrderKey = orderKey |
|||
evalProc.Step = 1 |
|||
evalProc.State = 1 |
|||
evalProc.RoleGroup = 16118387069540343 |
|||
evalProc.Time = time.Now().Unix() |
|||
flowStepJson, flowStepErr := json.Marshal(flowLog) |
|||
if flowStepErr == nil { |
|||
evalProc.Content = string(flowStepJson) |
|||
} |
|||
adErr := global.GVA_DB_Performanceappraisal.Create(&evalProc).Error |
|||
if adErr != nil { |
|||
return |
|||
} |
|||
} else { |
|||
var flowStepArys []FlowStep |
|||
for _, f_v := range flowLog { |
|||
if f_v.Step == evalProc.Step { |
|||
f_v.State = 2 |
|||
} |
|||
flowStepArys = append(flowStepArys, f_v) |
|||
} |
|||
var flowStep FlowStep |
|||
flowStep.Step = evalProc.Step + 1 |
|||
flowStep.Key = strconv.FormatInt(orderKey, 10) |
|||
flowStep.State = 1 |
|||
roleGroupSteps := roleGroupStep - 1 |
|||
if roleGroupSteps < 0 { |
|||
roleGroupSteps = 0 |
|||
} |
|||
flowStep.RoleGroup = flowLog[roleGroupSteps].RoleGroup |
|||
flowStep.NextStep = flowLog[roleGroupStep].NextStep - 1 |
|||
flowStepArys = append(flowStepArys, flowStep) |
|||
|
|||
saveData := commonus.MapOut() |
|||
saveData["ep_time"] = time.Now().Unix() |
|||
saveData["ep_role_group"] = flowLog[roleGroupSteps].RoleGroup |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepArys) |
|||
if flowStepErr == nil { |
|||
saveData["ep_cont"] = string(flowStepJson) |
|||
} |
|||
isTrueErr, _ := EiteDutiesInfoes(evalProc.Id, saveData) |
|||
if isTrueErr != true { |
|||
return |
|||
} |
|||
} |
|||
isTrue = true |
|||
return |
|||
} |
|||
|
|||
//更新审批流程(批准)
|
|||
/* |
|||
orderKey 流程Key |
|||
roleGroup 角色数组 |
|||
nextStep 下一步 |
|||
*/ |
|||
func UpEvaluationProcessApproval(orderKey, roleGroup, keyNumber int64, nextStep int) (evalProc assessmentmodel.EvaluationProcess, isTrue bool) { |
|||
isTrue = false |
|||
judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderKey).First(&evalProc).Error |
|||
if judgeErr != nil { |
|||
return |
|||
} |
|||
var flowLog []FlowStep |
|||
jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) |
|||
if jsonFlowErr != nil { |
|||
return |
|||
} |
|||
roleGroupStep := len(flowLog) - 1 |
|||
if roleGroupStep < 0 { |
|||
roleGroupStep = 0 |
|||
} |
|||
if len(flowLog) < 1 { |
|||
var rejectFlow FlowStep |
|||
rejectFlow.Step = 1 |
|||
rejectFlow.Key = strconv.FormatInt(keyNumber, 10) |
|||
rejectFlow.State = 1 |
|||
rejectFlow.RoleGroup = roleGroup |
|||
rejectFlow.NextStep = nextStep |
|||
flowLog = append(flowLog, rejectFlow) |
|||
|
|||
evalProc.OrderKey = orderKey |
|||
evalProc.Step = 1 |
|||
evalProc.State = 1 |
|||
evalProc.RoleGroup = roleGroup |
|||
evalProc.Time = time.Now().Unix() |
|||
flowStepJson, flowStepErr := json.Marshal(flowLog) |
|||
if flowStepErr == nil { |
|||
evalProc.Content = string(flowStepJson) |
|||
} |
|||
adErr := global.GVA_DB_Performanceappraisal.Create(&evalProc).Error |
|||
if adErr != nil { |
|||
return |
|||
} |
|||
} else { |
|||
var flowStepArys []FlowStep |
|||
for _, f_v := range flowLog { |
|||
if f_v.Step == evalProc.Step { |
|||
f_v.State = 2 |
|||
} |
|||
flowStepArys = append(flowStepArys, f_v) |
|||
} |
|||
var flowStep FlowStep |
|||
flowStep.Step = evalProc.Step + 1 |
|||
flowStep.Key = strconv.FormatInt(keyNumber, 10) |
|||
flowStep.State = 1 |
|||
|
|||
flowStep.RoleGroup = roleGroup |
|||
flowStep.NextStep = nextStep |
|||
flowStepArys = append(flowStepArys, flowStep) |
|||
|
|||
saveData := commonus.MapOut() |
|||
saveData["ep_time"] = time.Now().Unix() |
|||
saveData["ep_role_group"] = roleGroup |
|||
saveData["ep_step"] = evalProc.Step + 1 |
|||
flowStepJson, flowStepErr := json.Marshal(flowStepArys) |
|||
if flowStepErr == nil { |
|||
saveData["ep_cont"] = string(flowStepJson) |
|||
} |
|||
isTrueErr, _ := EiteDutiesInfoes(evalProc.Id, saveData) |
|||
if isTrueErr != true { |
|||
return |
|||
} |
|||
} |
|||
isTrue = true |
|||
return |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package evaluation |
|||
|
|||
type EvaluationInterface struct{} |
|||
|
|||
//考核方案细则列表输出
|
|||
type TargetContOutCont struct { |
|||
Id string `json:"id"` |
|||
Type int `json:"type"` |
|||
Group string `json:"group"` |
|||
GroupNAme string `json:"groupname"` |
|||
DepartmentId string `json:"parentid"` |
|||
DepartmentName string `json:"parentname"` |
|||
Dimension string `json:"dimension"` |
|||
DimensionName string `json:"dimensionname"` |
|||
Target string `json:"target"` |
|||
TargetName string `json:"targetname"` |
|||
TargetSun string `json:"targetsun"` |
|||
TargetSunName string `json:"targetsunname"` |
|||
DetailedTarget string `json:"detailedtarget"` |
|||
DetailedTargetName string `json:"detailedtargetname"` |
|||
Content string `json:"content"` //指标说明
|
|||
Unit string `json:"unit"` //单位"`
|
|||
ReferenceScore int64 `json:"referencescore"` //标准分值"`
|
|||
Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"`
|
|||
CycleAttres int `json:"cycleattr"` //辅助计数"`
|
|||
State int `json:"state"` |
|||
UserList []string `json:"userlist"` //执行人列表
|
|||
UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表
|
|||
} |
|||
|
|||
//定性考核列表输出
|
|||
type QualEvalArrt struct { |
|||
Id string `json:"id"` |
|||
Name string `json:"name"` |
|||
} |
|||
|
|||
//加减分数据获取项
|
|||
type addPlusOrMinusPoints struct { |
|||
PlanId string `json:"planid"` //方案id
|
|||
Type int `json:"type"` //1:加分;2:减分
|
|||
Score int64 `json:""score` //分数
|
|||
Reason string `json:"reason"` //原因
|
|||
Rectification int `json:"rectification"` //1:整改;2:无需整改
|
|||
Enclosure []string `json:"enclosure"` //附件
|
|||
} |
|||
type enclosureType struct { |
|||
Type int `json:"type"` //1:加分;2:减分
|
|||
FilePath string `json:"filepath"` //文件路径
|
|||
} |
|||
|
|||
//划分责任人
|
|||
type DivisionResponsibilityType struct { |
|||
Id string `json:"id"` //提交审批流ID
|
|||
UserList []DivisionResponsibilityUser `json:"userlist"` //责任人
|
|||
} |
|||
type DivisionResponsibilityUser struct { |
|||
Type int `json:"type"` //责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)
|
|||
UserKey string `json:"userkey"` //责任人key
|
|||
UserName string `json:"username"` //责任人姓名
|
|||
Weight int `json:"weight"` //权重
|
|||
} |
|||
|
|||
//流程步进
|
|||
type FlowStep struct { |
|||
Step int `json:"step"` //当前是第几步
|
|||
Key string `json:"key"` //任务卡ID
|
|||
State int `json:"state"` //状态
|
|||
RoleGroup int64 `json:"rolefroup"` //状态
|
|||
NextStep int `json:"nextstep"` //下一步 1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人
|
|||
} |
|||
|
|||
//改正措施数据提交
|
|||
type CorrectiveMeasuresType struct { |
|||
OrderId string `json:"orderid"` |
|||
Content string `json:"content"` //整改内容
|
|||
Enclosure []string `json:"enclosure"` //附件
|
|||
} |
|||
@ -0,0 +1,269 @@ |
|||
package sendmessage |
|||
|
|||
import ( |
|||
"strconv" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/commonus" |
|||
) |
|||
|
|||
/* |
|||
发送文本 |
|||
@sendUserList 接收信息人员 |
|||
@Title 一级标题,建议不超过36个字 |
|||
@Desc 标题辅助信息,建议不超过44个字 |
|||
@Unit 考核计量单位 |
|||
@Reason 考核原因 |
|||
@handleUrl 访问Key |
|||
@Type 1:加分;2:减分 |
|||
@departmentId 执行考核部门 |
|||
@userKey 执行考核人 |
|||
@Score 考核分值 |
|||
@keyNumber 任务卡ID |
|||
*/ |
|||
func SendMsgPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl string, Type int, departmentId, userKey, Score, keyNumber int64, msgTxt string) (callbakcMsg []byte, isTrueCall bool, callBackCont string) { |
|||
var sendTextMsg TextNoticeTemplateMedium |
|||
sendTextMsg.Inset(sendUserList, "template_card", "text_notice", keyNumber) |
|||
|
|||
//获取考核详情
|
|||
sendTextMsg.TemplateCard.MainTitle.Title = Title |
|||
sendTextMsg.TemplateCard.MainTitle.Desc = Desc |
|||
|
|||
var scoreReason string |
|||
if Type == 1 { |
|||
scoreReason = "增加:" + strconv.FormatInt(Score, 10) + Unit |
|||
} else { |
|||
scoreReason = "扣除:" + strconv.FormatInt(Score, 10) + Unit |
|||
} |
|||
//引用文献样式
|
|||
sendTextMsg.TemplateCard.QuoteArea.Type = 0 |
|||
sendTextMsg.TemplateCard.QuoteArea.Title = scoreReason |
|||
sendTextMsg.TemplateCard.QuoteArea.QuoteText = "原因:\n" + Reason |
|||
|
|||
var htalConListStrMap []HorizontalContentListType |
|||
var htalConListStrCon HorizontalContentListType |
|||
//二级普通文本,
|
|||
sendTextMsg.TemplateCard.SubTitleText = "考核上报部门:" |
|||
execDerpatCont := "" |
|||
// execDerpatCont := "考核部门:"
|
|||
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) |
|||
if execDerpatErr == true { |
|||
execDerpatCont = execDerpatCont + execDerpat.Name |
|||
} |
|||
htalConListStrCon.KeyName = execDerpatCont |
|||
//获取操作人
|
|||
userFileStr := "wm_number,qywx_key,wx_key" |
|||
//操作人条件
|
|||
userWherAry := commonus.MapOut() |
|||
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|||
userWherAry["wm_key"] = userKey |
|||
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) |
|||
if userIsTrue == true { |
|||
|
|||
if userConting.WechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
if userConting.WorkWechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WorkWechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
} |
|||
htalConListStrMap = append(htalConListStrMap, htalConListStrCon) |
|||
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap |
|||
|
|||
sendTextMsg.TemplateCard.CardAction.Type = 1 |
|||
sendTextMsg.TemplateCard.CardAction.Url = handleUrl |
|||
|
|||
if msgTxt == "" { |
|||
msgTxt = "请前往处理" |
|||
} |
|||
//地板处理
|
|||
var jumpListStruct JumpListType |
|||
jumpListStruct.Type = 1 |
|||
jumpListStruct.Title = msgTxt |
|||
jumpListStruct.Url = handleUrl |
|||
sendTextMsg.TemplateCard.JumpList = append(sendTextMsg.TemplateCard.JumpList, jumpListStruct) |
|||
|
|||
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school") |
|||
return |
|||
} |
|||
|
|||
/* |
|||
发送按钮交互 |
|||
@sendUserList 接收信息人员 |
|||
@Title 一级标题,建议不超过36个字 |
|||
@Desc 标题辅助信息,建议不超过44个字 |
|||
@subtitle 二级文献标题 |
|||
@reason 二级文献内容 |
|||
@Type 1:加分;2:减分 |
|||
@departmentId 执行考核部门 |
|||
@userKey 执行考核人 |
|||
@keyNumber 任务卡ID |
|||
*/ |
|||
func SendButtonPublic(sendUserList, Title, Desc, subtitle, reason string, departmentId, userKey, keyNumber int64, buttonMap []ButtonListtype) (callbakcMsg []byte, isTrueCall bool, callBackCont string, send ButtonNoticeTemplateMedium) { |
|||
var sendTextMsg ButtonNoticeTemplateMedium |
|||
sendTextMsg.Inset(sendUserList, "template_card", "button_interaction", keyNumber) |
|||
|
|||
//获取考核详情
|
|||
sendTextMsg.TemplateCard.MainTitle.Title = Title |
|||
sendTextMsg.TemplateCard.MainTitle.Desc = Desc |
|||
|
|||
//引用文献样式
|
|||
sendTextMsg.TemplateCard.QuoteArea.Type = 0 |
|||
sendTextMsg.TemplateCard.QuoteArea.Title = subtitle |
|||
sendTextMsg.TemplateCard.QuoteArea.QuoteText = reason |
|||
|
|||
var htalConListStrMap []HorizontalContentListType |
|||
var htalConListStrCon HorizontalContentListType |
|||
//二级普通文本,
|
|||
sendTextMsg.TemplateCard.SubTitleText = "责任部门:" |
|||
execDerpatCont := "" |
|||
// execDerpatCont := "考核部门:"
|
|||
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) |
|||
if execDerpatErr == true { |
|||
execDerpatCont = execDerpatCont + execDerpat.Name |
|||
} |
|||
htalConListStrCon.KeyName = execDerpatCont |
|||
//获取操作人
|
|||
userFileStr := "wm_number,qywx_key,wx_key" |
|||
//操作人条件
|
|||
userWherAry := commonus.MapOut() |
|||
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|||
userWherAry["wm_key"] = userKey |
|||
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) |
|||
if userIsTrue == true { |
|||
|
|||
if userConting.WechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
if userConting.WorkWechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WorkWechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
} |
|||
htalConListStrMap = append(htalConListStrMap, htalConListStrCon) |
|||
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap |
|||
|
|||
sendTextMsg.TemplateCard.CardAction.Type = 1 |
|||
sendTextMsg.TemplateCard.CardAction.Url = "http://www.hxgk.group" |
|||
//按钮列表,列表长度不超过6(必填)
|
|||
sendTextMsg.TemplateCard.ButtonList = buttonMap |
|||
send = sendTextMsg |
|||
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school") |
|||
return |
|||
} |
|||
|
|||
/* |
|||
发送文本任务卡 |
|||
@sendUserList 接收信息人员 |
|||
@Title 一级标题,建议不超过36个字 |
|||
@Desc 标题辅助信息,建议不超过44个字 |
|||
@Unit 考核计量单位 |
|||
@Reason 二级文本标题 |
|||
@handleUrl 访问Key |
|||
@Type 1:加分;2:减分 |
|||
@departmentId 执行考核部门 |
|||
@userKey 执行考核人 |
|||
@Score 考核分值 |
|||
@keyNumber 任务卡ID |
|||
@scoreReason 二级文本描述 |
|||
@subTitleText 下级 组件标题"考核上报部门:" |
|||
*/ |
|||
func SendMsgTxtPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl, scoreReason, subTitleText string, Type int, departmentId, userKey, Score, keyNumber int64, msgTxt string) (callbakcMsg []byte, isTrueCall bool, callBackCont string, sendTextMsg TextNoticeTemplateMedium) { |
|||
// var sendTextMsg TextNoticeTemplateMedium
|
|||
sendTextMsg.Inset(sendUserList, "template_card", "text_notice", keyNumber) |
|||
|
|||
//获取考核详情
|
|||
sendTextMsg.TemplateCard.MainTitle.Title = Title |
|||
sendTextMsg.TemplateCard.MainTitle.Desc = Desc |
|||
|
|||
//引用文献样式
|
|||
sendTextMsg.TemplateCard.QuoteArea.Type = 0 |
|||
sendTextMsg.TemplateCard.QuoteArea.Title = scoreReason |
|||
sendTextMsg.TemplateCard.QuoteArea.QuoteText = Reason |
|||
|
|||
var htalConListStrMap []HorizontalContentListType |
|||
var htalConListStrCon HorizontalContentListType |
|||
//二级普通文本,
|
|||
sendTextMsg.TemplateCard.SubTitleText = subTitleText |
|||
execDerpatCont := "" |
|||
// execDerpatCont := "考核部门:"
|
|||
execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) |
|||
if execDerpatErr == true { |
|||
execDerpatCont = execDerpatCont + execDerpat.Name |
|||
} |
|||
htalConListStrCon.KeyName = execDerpatCont |
|||
//获取操作人
|
|||
userFileStr := "wm_number,qywx_key,wx_key" |
|||
//操作人条件
|
|||
userWherAry := commonus.MapOut() |
|||
// userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3"
|
|||
userWherAry["wm_key"] = userKey |
|||
userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) |
|||
if userIsTrue == true { |
|||
|
|||
if userConting.WechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
if userConting.WorkWechatId != "" { |
|||
userWechatErr, userWechat := commonus.GetUesrContForWechatID(userConting.WorkWechatId) |
|||
if userWechatErr == true { |
|||
htalConListStrCon.Type = 3 |
|||
htalConListStrCon.Value = userWechat.Name |
|||
htalConListStrCon.UserId = userConting.WorkWechatId |
|||
// htalConListStrMap = append(htalConListStrMap, htalConListStrCon)
|
|||
// sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap
|
|||
} |
|||
} |
|||
} |
|||
htalConListStrMap = append(htalConListStrMap, htalConListStrCon) |
|||
sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap |
|||
|
|||
sendTextMsg.TemplateCard.CardAction.Type = 1 |
|||
sendTextMsg.TemplateCard.CardAction.Url = handleUrl |
|||
|
|||
if msgTxt == "" { |
|||
msgTxt = "请前往处理" |
|||
} |
|||
//地板处理
|
|||
var jumpListStruct JumpListType |
|||
jumpListStruct.Type = 1 |
|||
jumpListStruct.Title = msgTxt |
|||
jumpListStruct.Url = handleUrl |
|||
sendTextMsg.TemplateCard.JumpList = append(sendTextMsg.TemplateCard.JumpList, jumpListStruct) |
|||
|
|||
callbakcMsg, isTrueCall, callBackCont = sendTextMsg.SendMessage("school") |
|||
return |
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
package assessmentmodel |
|||
|
|||
//分数流水
|
|||
type ScoreFlow struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:sf_id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:sf_evaluation_plan;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` |
|||
PlusReduceScore int `json:"plusreducescore" gorm:"column:sf_plus_reduce_score;type:tinyint(1) unsigned;default:1;not null;comment:1:加分;2:减分"` |
|||
Score int64 `json:"score" gorm:"column:sf_score;type:bigint(20) unsigned;default:0;not null;comment:分值(乘100录入)"` |
|||
Key int64 `json:"key" gorm:"column:sf_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Reason string `json:"reason" gorm:"column:sf_reason;type:mediumtext;comment:操作原因"` |
|||
Content string `json:"content" gorm:"column:sf_content;type:mediumtext;comment:操作结构体"` |
|||
Time int64 `json:"time" gorm:"column:sf_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:sf_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:sf_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:sf_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:sf_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
Year int64 `json:"year" gorm:"column:sf_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:sf_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:sf_month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:sf_week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
Enclosure string `json:"enclosure" gorm:"column:sf_enclosure;type:longtext;comment:附件"` |
|||
DutyGroup int64 `json:"dutygroup" gorm:"column:sf_duty_group;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:通过)"` |
|||
Rectification int `json:"rectification" gorm:"column:sf_rectification;type:tinyint(1) unsigned;default:1;not null;comment:1、需要整改;2:无需整改"` |
|||
} |
|||
|
|||
func (ScoreFlow *ScoreFlow) TableName() string { |
|||
return "score_flow" |
|||
} |
|||
|
|||
//划分责任 division_responsibilities
|
|||
type DivisionResponsibilities struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:df_id;type:bigint(20) unsigned;not null"` |
|||
ScoreFlow int64 `json:"scoreflow" gorm:"column:df_sf_id;type:bigint(20) unsigned;default:0;not null;comment:归属加减分关联值"` |
|||
Type int `json:"type" gorm:"column:df_type;type:tinyint(1) unsigned;default:1;not null;comment:责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)"` |
|||
UserName string `json:"username" gorm:"column:df_user_name;type:varchar(100);comment:责任人名"` |
|||
UserKey int64 `json:"userkey" gorm:"column:df_user_key;type:bigint(20) unsigned;default:0;not null;comment:责任人KEY"` |
|||
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:责任人集团"` |
|||
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:比重"` |
|||
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:修改时间"` |
|||
DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:df_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:df_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:df_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
} |
|||
|
|||
func (DivisionResponsibilities *DivisionResponsibilities) TableName() string { |
|||
return "division_responsibilities" |
|||
} |
|||
|
|||
//流程步进器
|
|||
type EvaluationProcess struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` |
|||
OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` |
|||
Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` |
|||
Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` |
|||
NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` |
|||
Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:状态(1:正常,2:禁用;3:废弃;4:删除)"` |
|||
RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` |
|||
} |
|||
|
|||
func (EvaluationProcess *EvaluationProcess) TableName() string { |
|||
return "evaluation_process" |
|||
} |
|||
|
|||
//整改单具
|
|||
type RectificationMeasures struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:rm_id;type:bigint(20) unsigned;not null"` |
|||
UserKey int64 `json:"userkey" gorm:"column:rm_user_key;type:bigint(20) unsigned;default:0;not null;comment:整改人"` |
|||
Department int64 `json:"department" gorm:"column:rm_department;type:bigint(20) unsigned;default:0;not null;comment:整改部门"` |
|||
Group int64 `json:"group" gorm:"column:rm_group;type:bigint(20) unsigned;default:0;not null;comment:集团"` |
|||
OrderKey int64 `json:"order" gorm:"column:rm_order;type:bigint(20) unsigned;default:0;not null;comment:订单ID"` |
|||
State int `json:"state" gorm:"column:rm_state;type:int(1) unsigned;default:1;not null;comment:1:草果;2:审批中;3:不合格;4:合格"` |
|||
Time int64 `json:"time" gorm:"column:rm_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:rm_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
Content string `json:"content" gorm:"column:rm_content;type:longtext;comment:整改内容"` |
|||
Enclosure string `json:"enclosure" gorm:"column:rm_files;type:longtext;comment:附件"` |
|||
} |
|||
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,8 @@ |
|||
项目推进计划 |
|||
25日 前端 完成加分与加分页面搭建 对接好接口(加减分接口已出,根据实际情况进行微调) |
|||
后端 完成审批接口与整改接口的开发,审批详细接口完成50%左右 |
|||
26日 前端 对接整改接口页面。处理文件上传问题。根据定量接口进度对接定量提报页面开发 |
|||
后端 跑通审批流,开发定量考核接口开发 |
|||
27日 完成收尾,根据实际完成情况进行初步测试 |
|||
|
|||
28日 项目上线运行 |
|||
Loading…
Reference in new issue