From 0bef303a19d25b98786bca982f0728052c6fcf8a Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Mon, 28 Feb 2022 15:18:44 +0800 Subject: [PATCH] Beta-V0.1 --- .../api/index/evaluation/evaluation.go | 254 +++++++++++++++++- gin_server_admin/api/index/evaluation/type.go | 21 ++ .../api/v1/assessment/department_target.go | 5 +- .../api/v1/assessment/dutytype.go | 8 +- .../api/wechatapp/callback/rationcallback.go | 170 ++++++++++++ .../api/wechatapp/callback/updatehandle.go | 25 +- .../wechatapp/sendmessage/sendmsgHandle.go | 4 +- gin_server_admin/commonus/publichaneld.go | 44 ++- gin_server_admin/commonus/timeSub.go | 8 +- .../model/assessmentmodel/dutyclass.go | 42 +++ .../router/assessment/assessmentrouter.go | 3 + 11 files changed, 557 insertions(+), 27 deletions(-) create mode 100644 gin_server_admin/api/wechatapp/callback/rationcallback.go diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 4b48534..9abde6b 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -169,9 +169,9 @@ func (e *EvaluationInterface) AdditionAndSubtractionScore(c *gin.Context) { 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) + 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) @@ -541,7 +541,7 @@ func (e *EvaluationInterface) AddDivisionResponsibility(c *gin.Context) { 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) + callbakcMsg, isTrueCall, callBackCont, ss := sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, orderId, buttonMap) outData := commonus.MapOut() outData["callbakcMsg"] = string(callbakcMsg) outData["isTrueCall"] = isTrueCall @@ -684,8 +684,250 @@ func SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason 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) + callbakcMsg, isTrueCall, callBackCont, _ = sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, orderId, buttonMap) return } -//审批流程查询 +//获取定量考核任务列表 +func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData GetRationFlowLog + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(102, err, "数据获取失败!", c) + return + } + + // var qualEvaList []assessmentmodel.QualitativeEvaluation + // var detailsId []int64 + // listErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_accept_evaluation").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Group("qe_accept_evaluation").Find(&detailsId).Error + // if listErr != nil || len(detailsId) < 1 { + // response.Result(102, isTrue, "您没有要参加的考核项目!", c) + // return + // } + // response.Result(0, detailsId, "用户端个人要执行的考核任务", c) + var qualEvaList []assessmentmodel.QualitativeEvaluation + gormDbIng := global.GVA_DB_Performanceappraisal + gormDbIng = gormDbIng.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) + if requestData.GroupId != "" { + gormDbIng = gormDbIng.Where("qe_group = ?", requestData.GroupId) + } + if requestData.DepartmentID != "" { + gormDbIng = gormDbIng.Where("qe_accept_evaluation = ?", requestData.DepartmentID) + } + listErr := gormDbIng.Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error + if listErr != nil || len(qualEvaList) < 1 { + response.Result(102, qualEvaList, "您没有要参加的考核项目!", c) + return + } + var uotContAry []TargetContOutCont + for _, v := range qualEvaList { + var uotCont TargetContOutCont + uotCont.Id = strconv.FormatInt(v.Id, 10) + uotCont.Type = v.Type + uotCont.Group = strconv.FormatInt(v.Group, 10) + groupErr, groupCont := commonus.GetGroupCont(v.Group) + if groupErr == true { + uotCont.GroupNAme = groupCont.Name + } + uotCont.DepartmentId = strconv.FormatInt(v.AcceptEvaluation, 10) + deparConErr, deparConCont := commonus.GetBranchFactory(v.AcceptEvaluation) + if deparConErr == true { + uotCont.DepartmentName = deparConCont.Name + } + uotCont.Dimension = strconv.FormatInt(v.Dimension, 10) + dutyClassCont, dutyClassErr := commonus.GetDutyClassInfo(v.Dimension) + if dutyClassErr == true { + uotCont.DimensionName = dutyClassCont.Title + } + uotCont.Target = strconv.FormatInt(v.Target, 10) + targetInfo, targetErr := commonus.GetTargetInfo(v.Target) + if targetErr == true { + uotCont.TargetName = targetInfo.Title + } + uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) + info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) + if infoErr == true { + uotCont.TargetSunName = info.Title + } + uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) + dtCont, dtIsTrue := commonus.GetDetailedTargetInfo(v.DetailedTarget) + if dtIsTrue == true { + uotCont.DetailedTargetName = dtCont.Title + uotCont.Content = dtCont.Content + } + uotCont.Unit = v.Unit + uotCont.ReferenceScore = v.ReferenceScore + uotCont.Cycles = v.Cycles + uotCont.CycleAttres = v.CycleAttres + uotCont.State = v.State + userAry := strings.Split(v.Operator, ",") + uotCont.UserList = userAry + for _, u_v := range userAry { + usCont, usErr := archiveapi.GetUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": u_v}) + if usErr == true { + var userCont QualEvalArrt + userCont.Id = u_v + userCont.Name = usCont.Name + uotCont.UserListAry = append(uotCont.UserListAry, userCont) + } + } + + uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) + uotContAry = append(uotContAry, uotCont) + } + response.Result(0, uotContAry, "用户端个人要执行的考核任务", c) +} + +//添加定量考核项目 +func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + userKey, userKeyErr := strconv.ParseInt(userCont.Key, 10, 64) + if userKeyErr != nil { + response.Result(102, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + departmentId, departmentIdErr := strconv.ParseInt(userCont.DepartmentId, 10, 64) + if departmentIdErr != nil { + response.Result(103, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + userGroup, userGroupErr := strconv.ParseInt(userCont.Group, 10, 64) + if userGroupErr != nil { + response.Result(104, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + + var requestData AddRationFlowLog + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(105, err, "数据获取失败!", c) + return + } + if requestData.GroupId == "" { + response.Result(106, err, "数据异常!", c) + return + } + if requestData.DepartmentID == "" { + response.Result(107, err, "数据异常!", c) + return + } + if len(requestData.List) < 1 { + response.Result(108, err, "没有要考核的项目", c) + return + } + operationTime := time.Now().Unix() + keyNumber := commonus.GetFileNumberEs() + var flowLog assessmentmodel.FlowLog + flowLog.Key = keyNumber + flowLog.Time = time.Now().Unix() + flowLog.EiteTime = time.Now().Unix() + flowLog.Year = commonus.ComputingTime(operationTime, 1) + flowLog.Quarter = commonus.ComputingTime(operationTime, 2) + flowLog.Month = commonus.ComputingTime(operationTime, 3) + flowLog.Week = commonus.ComputingTime(operationTime, 4) + flowLog.ToDay = commonus.ComputingTime(operationTime, 5) + + flowLog.EvaluationDepartment = departmentId + flowLog.EvaluationUser = userKey + flowLog.EvaluationGroup = userGroup + + dutyGroup, dutyGroupErr := strconv.ParseInt(requestData.GroupId, 10, 64) + if dutyGroupErr == nil { + flowLog.DutyGroup = dutyGroup + } + departIdInt, departIdIntErr := strconv.ParseInt(requestData.DepartmentID, 10, 64) + if departIdIntErr == nil { + flowLog.DutyDepartment = departIdInt + } + flowLog.Reply = 1 + var flowDataLogAry []assessmentmodel.FlowLogData + var reason string + for i, v := range requestData.List { + var flowDataLog assessmentmodel.FlowLogData + evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) + if evaluationPlanidErr == nil { + flowDataLog.EvaluationPlan = evaluationPlanid + } + flowDataLog.Key = keyNumber + flowDataLog.Score = v.Score + flowDataLog.Content = v.Reason + flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + flowDataLog.Time = time.Now().Unix() + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if i == 0 { + if targetInfoErr == true { + reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Score, v.Unit) + } + } else { + if targetInfoErr == true { + reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Score, v.Unit) + } + } + + flowDataLogAry = append(flowDataLogAry, flowDataLog) + } + gromDb := global.GVA_DB_Performanceappraisal.Begin() + + addFlowLogErr := gromDb.Create(&flowLog).Error + addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error + fmt.Printf("%v---------------------->%v\n", addFlowLogErr, addFlowLogDataErr) + if addFlowLogErr == nil && addFlowLogDataErr == nil { + affairDbErr := gromDb.Commit().Error + if affairDbErr == nil { + + //发送消息 + sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16182159043990656, departIdInt) //获取对应部门负责人 + if sendUserIsTrue != true { + // response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) + // return + } + UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1) + + mainTitle := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) + mainTitleDesc := "" + subtitle := "数据详情:" + // reason := requestData.Content + + // callbakcMsg, isTrueCall, callBackCont := SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, keyNumber, 0) + + var buttonMap []sendmessage.ButtonListtype + var buttonCont sendmessage.ButtonListtype + buttonCont.Type = 0 + buttonCont.Text = "批准" + buttonCont.Style = 1 + buttonCont.Key = fmt.Sprintf("ration_%v_1", keyNumber) + buttonMap = append(buttonMap, buttonCont) + buttonCont.Type = 0 + buttonCont.Text = "驳回" + buttonCont.Style = 3 + buttonCont.Key = fmt.Sprintf("ration_%v_2", keyNumber) + buttonMap = append(buttonMap, buttonCont) + + callbakcMsg, isTrueCall, callBackCont, sendText := sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, keyNumber, buttonMap) + + fmt.Printf("更新发送信息返回:%v-----------%v----------->%v-----%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendText) + + response.Result(0, affairDbErr, "数据写入成功!", c) + } else { + gromDb.Rollback() + response.Result(118, affairDbErr, "数据写入失败!", c) + } + } else { + affairDbErr := gromDb.Rollback().Error + if affairDbErr == nil { + response.Result(119, affairDbErr, "数据写入失败!", c) + } else { + response.Result(120, affairDbErr, "数据写入失败!", c) + } + } +} diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index 6794c78..8bff6e5 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -75,3 +75,24 @@ type CorrectiveMeasuresType struct { Content string `json:"content"` //整改内容 Enclosure []string `json:"enclosure"` //附件 } + +//添加定量考核 +type AddRationFlowLog struct { + GroupId string `json:"groupid"` + DepartmentID string `json:"departmentid"` + List []RationLogList `json:"list"` +} + +type RationLogList struct { + Id string `json:"id"` + Score int64 `json:"score` + Unit string `json:"unit` + Reason string `json:"reason"` //原因 + Enclosure []string `json:"enclosure"` //附件 +} + +//获取定量考核列表 +type GetRationFlowLog struct { + GroupId string `json:"groupid"` + DepartmentID string `json:"departmentid"` +} diff --git a/gin_server_admin/api/v1/assessment/department_target.go b/gin_server_admin/api/v1/assessment/department_target.go index 066fadc..c816d46 100644 --- a/gin_server_admin/api/v1/assessment/department_target.go +++ b/gin_server_admin/api/v1/assessment/department_target.go @@ -549,7 +549,7 @@ func (d *DutyHandle) AddDepartmentDutyInfo(c *gin.Context) { return } departId, departErr := strconv.ParseInt(requestData.DepartmentId, 10, 64) - if departErr == nil { + if departErr != nil { departId = 0 } if len(requestData.Child) < 0 { @@ -719,6 +719,9 @@ func (d *DutyHandle) AddDepartmentDutyInfo(c *gin.Context) { if addErr != nil { response.Result(106, len(saveDataAry), "数据添加失败", c) return + } + if departId != 0 { + } response.Result(0, saveDataAry, "数据添加成功", c) } diff --git a/gin_server_admin/api/v1/assessment/dutytype.go b/gin_server_admin/api/v1/assessment/dutytype.go index c76a7f6..a7f63e5 100644 --- a/gin_server_admin/api/v1/assessment/dutytype.go +++ b/gin_server_admin/api/v1/assessment/dutytype.go @@ -713,10 +713,10 @@ type AddDutyNewContGroup struct { Child []AddDutyNewCont `json:"child"` //考核细则 } type AddDutyNewCont struct { - Id string `json:"id"` //维度ID - Name string `json:"name"` - Order int `json:"order"` - zhiFraction int `json:"zhiFraction"` + Id string `json:"id"` //维度ID + Name string `json:"name"` + // Order int64 `json:"ordering"` + ZhiFraction int `json:"zhiFraction"` Child []EvaluPross `json:"child"` //考核细则 } diff --git a/gin_server_admin/api/wechatapp/callback/rationcallback.go b/gin_server_admin/api/wechatapp/callback/rationcallback.go new file mode 100644 index 0000000..5ebbfbe --- /dev/null +++ b/gin_server_admin/api/wechatapp/callback/rationcallback.go @@ -0,0 +1,170 @@ +package callback + +import ( + "fmt" + "strconv" + "strings" + "time" + + evals "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" + "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" +) + +func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnter string) { + buttonClickNAme := "已批准" + // buttonClickNAmeOther := "其他人已批准" + if clickEnter == "1" { + t.UpdateButton(t.FromUsername, buttonClickNAme) + } else { + buttonClickNAme = "已驳回" + // buttonClickNAmeOther = "其他人已驳回" + t.UpdateButton(t.FromUsername, buttonClickNAme) + } + //获取点击人信息 + _, userContInfo := commonus.GetUesrContForWechatID(t.FromUsername) + var scoreFlowInfo assessmentmodel.FlowLog + judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", orderId).First(&scoreFlowInfo).Error + if judegFlowErr != nil { + _, butCallBackUser := commonus.GetSendMsgUser(16182159043990656, userContInfo.DepartmentId) //获取对应部门负责人(高科) + userCallAry := strings.Split(butCallBackUser, "|") + t.OtherClickButton(userCallAry, buttonClickNAme) + return + } + if clickEnter == "1" { + evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2) + saveData := commonus.MapOut() + saveData["fl_reply"] = 2 + saveData["fl_eite_time"] = time.Now().Unix() + EiteDutiesInfoes(scoreFlowInfo.Key, saveData) + + //获取信息接收人 + sendUserList := "" + userFileStr := "wm_number,qywx_key,wx_key" + //操作人条件 + userWherAry := commonus.MapOut() + // userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3" + userWherAry["wm_key"] = scoreFlowInfo.EvaluationUser + userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) + if userIsTrue == true { + if userConting.WechatId != "" { + sendUserList = userConting.WechatId + } + if userConting.WorkWechatId != "" { + sendUserList = userConting.WorkWechatId + } + } + taskId := commonus.GetFileNumberEs() + + // targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _ := commonus.GetDutyAssociatedItems(orderId) + title := fmt.Sprintf("%v-%v数据表", scoreFlowInfo.Year, scoreFlowInfo.Month) + desc := "" + quoteAreaTitle := "数据详情" + var quoteAreaContent string + var flowLogDataList []assessmentmodel.FlowLogData + dlgContErr := global.GVA_DB_Performanceappraisal.Where("fld_flow_log = ?", orderId).Find(&flowLogDataList).Error + if dlgContErr == nil { + for ii, vv := range flowLogDataList { + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(vv.EvaluationPlan, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if ii == 0 { + if targetInfoErr == true { + quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) + } + } else { + if targetInfoErr == true { + quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) + } + } + } + } + twoLevelTitle := "考核上报部门" + var twoLevelKeyName, twoLevelKeyValue string + userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername) + if userWechatErr == true { + twoLevelKeyName = userWechat.DepartmentName + twoLevelKeyValue = userWechat.Name + } + twoLevelUserId := t.FromUsername + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + jumpUrlTitle := "查看详情" + sourceDesc := "通过" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) + fmt.Printf("更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) + } else { + evals.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, 0, 2) + saveData := commonus.MapOut() + saveData["fl_reply"] = 2 + saveData["fl_eite_time"] = time.Now().Unix() + EiteDutiesInfoes(scoreFlowInfo.Key, saveData) + + //获取信息接收人 + sendUserList := "" + userFileStr := "wm_number,qywx_key,wx_key" + //操作人条件 + userWherAry := commonus.MapOut() + // userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3" + userWherAry["wm_key"] = scoreFlowInfo.EvaluationUser + userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) + if userIsTrue == true { + if userConting.WechatId != "" { + sendUserList = userConting.WechatId + } + if userConting.WorkWechatId != "" { + sendUserList = userConting.WorkWechatId + } + } + taskId := commonus.GetFileNumberEs() + + // targettitle, detailedRulesTitle, detailedRulesInfo, unitStr, flowContent, _ := commonus.GetDutyAssociatedItems(orderId) + title := fmt.Sprintf("%v-%v数据表", scoreFlowInfo.Year, scoreFlowInfo.Month) + desc := "" + quoteAreaTitle := "数据详情" + var quoteAreaContent string + var flowLogDataList []assessmentmodel.FlowLogData + dlgContErr := global.GVA_DB_Performanceappraisal.Where("fld_flow_log = ?", orderId).Find(&flowLogDataList).Error + if dlgContErr == nil { + for ii, vv := range flowLogDataList { + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(vv.EvaluationPlan, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if ii == 0 { + if targetInfoErr == true { + quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) + } + } else { + if targetInfoErr == true { + quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) + } + } + } + } + twoLevelTitle := "考核上报部门" + var twoLevelKeyName, twoLevelKeyValue string + userWechatErr, userWechat := commonus.GetUesrContForWechatID(t.FromUsername) + if userWechatErr == true { + twoLevelKeyName = userWechat.DepartmentName + twoLevelKeyValue = userWechat.Name + } + twoLevelUserId := t.FromUsername + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + jumpUrlTitle := "请前往重新提报!" + sourceDesc := "驳回" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) + fmt.Printf("更新发送信息返回:%v-----------%v----------->%v-----\n", string(callbakcMsg), isTrueCall, callBackCont) + } +} + +//编辑流程步进器 +func EiteDutiesInfoes(saveId int64, saveData map[string]interface{}) (isTrue bool, infoErr error) { + isTrue = false + infoErr = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Where("`fl_key` = ?", saveId).Updates(saveData).Error + if infoErr != nil { + return + } + isTrue = true + return +} diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index 16f83d9..4ebd918 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -34,8 +34,10 @@ func templateEventPush(eventMsg []byte) { // } switch buttonClick[0] { case "duty": //数据考核审批工作 - fmt.Printf("@@@@\n") + // fmt.Printf("@@@@\n") msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2]) + case "ration": + msgContent.ButtonTemplateCallBackHandleRation(buttonClick[1], buttonClick[2]) default: } } @@ -398,7 +400,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter } twoLevelUserId := t.FromUsername fmt.Printf("close============3=============>\n") - jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + // jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey) jumpUrlTitle := "请前往处理被驳回的任务" sourceDesc := "驳回" var sendTextMsg sendmessage.TextNoticeTemplateMedium @@ -479,7 +482,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter twoLevelKeyValue = userWechat.Name } twoLevelUserId := t.FromUsername - jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + // jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", scoreFlowKey) jumpUrlTitle := "请前往处理被驳回的任务" sourceDesc := "驳回" callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) @@ -554,7 +558,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter twoLevelKeyValue = userWechat.Name } twoLevelUserId := t.FromUsername - jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + // jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey) jumpUrlTitle := "请前往处理被驳回的任务" sourceDesc := "驳回" var sendTextMsg sendmessage.TextNoticeTemplateMedium @@ -624,7 +629,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter twoLevelKeyValue = userWechat.Name } twoLevelUserId := t.FromUsername - jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + // jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", scoreFlowKey) jumpUrlTitle := "请前往处理被驳回的任务" sourceDesc := "驳回" var sendTextMsg sendmessage.TextNoticeTemplateMedium @@ -694,7 +700,8 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter } twoLevelUserId := t.FromUsername - jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + // jumpUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", scoreFlowKey) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", scoreFlowKey) jumpUrlTitle := "请前往处理被驳回的任务" sourceDesc := "驳回" callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendNewsMsgText(sendUserList, strconv.FormatInt(taskId, 10), title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, jumpUrl, jumpUrlTitle, sourceDesc) @@ -849,7 +856,7 @@ func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentI subTitleText := "部门" // keyNumber := commonus.GetFileNumberEs() //发送整改通知 - handleUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", floeKey) + handleUrl := fmt.Sprintf("http://new.hxgk.group/#/rectification?id=%v", floeKey) callbakcMsg, isTrueCall, callBackCont, sendTextMsg = sendmessage.SendMsgTxtPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, reason, handleUrl, scoreReason, subTitleText, typeSet, departmentId, userKey, Score, keyNumber, "请上报整改结果!") return } @@ -857,7 +864,7 @@ func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentI /* 发送文本任务卡 @sendUserList 接收信息人员 -@Title 一级标题,建议不超过36个字 +@mainTitle 一级标题,建议不超过36个字 @Desc 标题辅助信息,建议不超过44个字 @Unit 考核计量单位 @Reason 二级文本标题 @@ -887,6 +894,6 @@ func SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason 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) + callbakcMsg, isTrueCall, callBackCont, _ = sendmessage.SendButtonPublic(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, departmentId, userKey, keyNumber, orderId, buttonMap) return } diff --git a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go index f7b4d95..812f6b9 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go +++ b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go @@ -113,7 +113,7 @@ func SendMsgPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl string, Ty @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) { +func SendButtonPublic(sendUserList, Title, Desc, subtitle, reason string, departmentId, userKey, keyNumber, orderId int64, buttonMap []ButtonListtype) (callbakcMsg []byte, isTrueCall bool, callBackCont string, send ButtonNoticeTemplateMedium) { var sendTextMsg ButtonNoticeTemplateMedium sendTextMsg.Inset(sendUserList, "template_card", "button_interaction", keyNumber) @@ -171,7 +171,7 @@ func SendButtonPublic(sendUserList, Title, Desc, subtitle, reason string, depart sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap sendTextMsg.TemplateCard.CardAction.Type = 1 - sendTextMsg.TemplateCard.CardAction.Url = "http://www.hxgk.group" + sendTextMsg.TemplateCard.CardAction.Url = fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) //按钮列表,列表长度不超过6(必填) sendTextMsg.TemplateCard.ButtonList = buttonMap send = sendTextMsg diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 4438db2..7e6098d 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1216,7 +1216,7 @@ func GetEvaluationProcess(orderId string) (content assessmentmodel.EvaluationPro //考核方案 func GetQualitativeEvaluation(orderId string) (content assessmentmodel.QualitativeEvaluation, isTrue bool) { isTrue = false - judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", orderId).First(&content).Error + judgeErr := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", orderId).First(&content).Error if judgeErr == nil { isTrue = true } @@ -1256,6 +1256,48 @@ func GetDutyAssociatedItems(orderId string) (targettitle, detailedRulesTitle, de return } +//获取加减分订单 +func GetFlowLog(orderId string) (content assessmentmodel.FlowLog, isTrue bool) { + isTrue = false + judgeErr := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", orderId).First(&content).Error + if judgeErr == nil { + isTrue = true + } + return +} + +/* +@orderId 加减分订单Id +returnData +#targettitle 指标名称 +#detailedRulesTitle 明细 +#detailedRulesInfo 明细说明 +*/ +func GetDutyRationtedItems(orderId string) (targettitle, detailedRulesTitle, detailedRulesInfo, unit string, flowContent assessmentmodel.FlowLog, isTrue bool) { + // flowContent, isTrue = GetFlowLog(orderId) + // if isTrue != true { + // return + // } + // qualEvalCont, qualEvalErr := GetQualitativeEvaluation(strconv.FormatInt(flowContent.EvaluationPlan, 10)) + // if qualEvalErr != true { + // return + // } + // unit = qualEvalCont.Unit + // targetCont, targetErr := GetTargetInfo(qualEvalCont.Target) + // if targetErr == true { + // targettitle = targetCont.Title + // unit = targetCont.Uniteing + // } + + // detailedTargetCont, detailedTargetErr := GetDetailedTargetInfo(qualEvalCont.Target) + // if detailedTargetErr == true { + // detailedRulesTitle = detailedTargetCont.Title + // detailedRulesInfo = detailedTargetCont.Content + // } + isTrue = true + return +} + //获取角色组 func GetRoleGroup(id int64) (roleGroup systemuser.RoleGroup, isTrue bool) { isTrue = false diff --git a/gin_server_admin/commonus/timeSub.go b/gin_server_admin/commonus/timeSub.go index 4a7a8b8..df97a52 100644 --- a/gin_server_admin/commonus/timeSub.go +++ b/gin_server_admin/commonus/timeSub.go @@ -212,13 +212,13 @@ func ComputingTime(timeStamp int64, timeType int) (timeDataInt int64) { } } case 5: - timeData = time.Unix(timeStamp, 0).Format("02") //月份 + timeData = time.Unix(timeStamp, 0).Format("02") //天 case 7: - timeData = time.Unix(timeStamp, 0).Format("15") //月份 + timeData = time.Unix(timeStamp, 0).Format("15") //时 case 8: - timeData = time.Unix(timeStamp, 0).Format("04") //月份 + timeData = time.Unix(timeStamp, 0).Format("04") //分 case 9: - timeData = time.Unix(timeStamp, 0).Format("05") //月份 + timeData = time.Unix(timeStamp, 0).Format("05") //秒 default: timeData = "0" } diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index b8cbb98..8b8720e 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -295,3 +295,45 @@ type DepartmentDimensionWeight struct { func (DepartmentDimensionWeight *DepartmentDimensionWeight) TableName() string { return "department_dimension_weight" } + +//定量考核数据表 +type FlowLog struct { + Id int64 `json:"id" gorm:"primaryKey;column:fl_id;type:bigint(20) unsigned;not null;comment:Id;index"` + EvaluationPlan string `json:"evaluationplan" gorm:"column:fl_evaluation_id;type:mediumtext unsigned;default:0;not null;comment:考核方案项目ID"` + Score int64 `json:"score" gorm:"column:fl_data;type:bigint(20) unsigned;default:0;not null;comment:数据"` + Key int64 `json:"key" gorm:"column:fl_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` + Content string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"` + Time int64 `json:"time" gorm:"column:fl_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + EiteTime int64 `json:"eitetime" gorm:"column:fl_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` + EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` + EvaluationUser int64 `json:"evaluationuser" gorm:"column:fl_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` + EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:fl_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` + Year int64 `json:"year" gorm:"column:fl_year;type:int(7) unsigned;default:0;not null;comment:年分"` + Quarter int64 `json:"quarter" gorm:"column:fl_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` + Month int64 `json:"month" gorm:"column:fl_month;type:int(2) unsigned;default:0;not null;comment:月"` + Week int64 `json:"week" gorm:"column:fl_week;type:int(5) unsigned;default:0;not null;comment:周"` + ToDay int64 `json:"today" gorm:"column:fl_day;type:int(5) unsigned;default:0;not null;comment:天"` + Enclosure string `json:"enclosure" gorm:"column:fl_enclosure;type:longtext;comment:附件"` + DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` + DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` + Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` +} + +func (FlowLog *FlowLog) TableName() string { + return "flow_log" +} + +//定量考核数据流 +type FlowLogData struct { + Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` + EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` + Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` + Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` + Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` + Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` + Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` +} + +func (FlowLogData *FlowLogData) TableName() string { + return "flow_log_data" +} diff --git a/gin_server_admin/router/assessment/assessmentrouter.go b/gin_server_admin/router/assessment/assessmentrouter.go index f9f128c..124a027 100644 --- a/gin_server_admin/router/assessment/assessmentrouter.go +++ b/gin_server_admin/router/assessment/assessmentrouter.go @@ -186,5 +186,8 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { dutyIndexCodeRouter.POST("adddivisionresponsibility", authorityIndexApi.AddDivisionResponsibility) // 划分责任人 dutyIndexCodeRouter.POST("addcorrectivemeasures", authorityIndexApi.AddCorrectiveMeasures) //添加整改措施 + dutyIndexCodeRouter.POST("qualitativeevalration", authorityIndexApi.QualitativeEvalRation) // 定量考核列表 + dutyIndexCodeRouter.POST("addflowrationlog", authorityIndexApi.AddFlowRationLog) // 添加定量考核列表 + } }