diff --git a/gin_server_admin/api/index/enter.go b/gin_server_admin/api/index/enter.go index f1bb386..404d0bf 100644 --- a/gin_server_admin/api/index/enter.go +++ b/gin_server_admin/api/index/enter.go @@ -2,12 +2,14 @@ package index import ( "github.com/flipped-aurora/gin-vue-admin/server/api/index/assessment" + "github.com/flipped-aurora/gin-vue-admin/server/api/index/evaluation" "github.com/flipped-aurora/gin-vue-admin/server/api/index/examineandapprove" ) type ApiGroup struct { AssessMentApi assessment.ApiGroup ExamApproveApi examineandapprove.ApiGroup + EvaluationApi evaluation.ApiGroup } var ApiGroupApp = new(ApiGroup) diff --git a/gin_server_admin/api/index/evaluation/enter.go b/gin_server_admin/api/index/evaluation/enter.go new file mode 100644 index 0000000..8837fb3 --- /dev/null +++ b/gin_server_admin/api/index/evaluation/enter.go @@ -0,0 +1,6 @@ +package evaluation + +//数据评估 +type ApiGroup struct { + EvaluationApi EvaluationInterface +} diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go new file mode 100644 index 0000000..9cbf1bb --- /dev/null +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -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 +} diff --git a/gin_server_admin/api/index/evaluation/sendwechatmsg.go b/gin_server_admin/api/index/evaluation/sendwechatmsg.go new file mode 100644 index 0000000..e0006c4 --- /dev/null +++ b/gin_server_admin/api/index/evaluation/sendwechatmsg.go @@ -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 +} diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go new file mode 100644 index 0000000..6794c78 --- /dev/null +++ b/gin_server_admin/api/index/evaluation/type.go @@ -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"` //附件 +} diff --git a/gin_server_admin/api/v1/assessment/department_target.go b/gin_server_admin/api/v1/assessment/department_target.go index 1f3fccf..47db633 100644 --- a/gin_server_admin/api/v1/assessment/department_target.go +++ b/gin_server_admin/api/v1/assessment/department_target.go @@ -117,7 +117,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { if requestData.TargetSun != "" { gormDb = gormDb.Where("`qe_target_sun` = ?", requestData.TargetSun) } - listTargetErr := gormDb.Order("qe_type asc,qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error + listTargetErr := gormDb.Order("qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { response.Result(101, listTargetErr, "没有数据!", c) @@ -143,11 +143,14 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { if dutyClassErr == true { uotCont.DimensionName = dutyClassCont.Title } + uotCont.DimensionWeight = commonus.GetDimesionTargetWeight(1, v.Group, v.AcceptEvaluation, v.Dimension, 0) + uotCont.Target = strconv.FormatInt(v.Target, 10) targetInfo, targetErr := commonus.GetTargetInfo(v.Target) if targetErr == true { uotCont.TargetName = targetInfo.Title } + uotCont.TargetWeight = commonus.GetDimesionTargetWeight(1, v.Group, v.AcceptEvaluation, v.Dimension, v.Target) uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) if infoErr == true { @@ -159,6 +162,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { uotCont.DetailedTargetName = dtCont.Title uotCont.Content = dtCont.Content } + uotCont.Unit = v.Unit uotCont.ReferenceScore = v.ReferenceScore uotCont.Cycles = v.Cycles @@ -356,3 +360,100 @@ func eiteOneQuaEvaInfo(saveId int64, saveData map[string]interface{}) (isTrue bo isTrue = true return } + +//获取定性考核指标对应的结构树 +func (d *DutyHandle) QualEvalTargetTree(c *gin.Context) { + var requestData QualEvalTargetTreeDies + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Group == "" { + response.Result(102, err, "数据获取失败!", c) + return + } + if requestData.DepartmentId == "" { + response.Result(103, err, "数据获取失败!", c) + return + } + if requestData.Dimension == "" { + response.Result(104, err, "数据获取失败!", c) + return + } + if requestData.Target == "" { + response.Result(105, err, "数据获取失败!", c) + return + } + + var qualitativeEvaluationAry []assessmentmodel.QualitativeEvaluation + gormDb := global.GVA_DB_Performanceappraisal + + gormDb = gormDb.Where("`qe_group` = ?", requestData.Group) + gormDb = gormDb.Where("`qe_accept_evaluation` = ?", requestData.DepartmentId) + gormDb = gormDb.Where("`qe_dimension` = ?", requestData.Dimension) + gormDb = gormDb.Where("`qe_target` = ?", requestData.Target) + listTargetErr := gormDb.Order("qe_type asc,qe_group asc,qe_accept_evaluation asc,qe_dimension asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error + + if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { + response.Result(101, listTargetErr, "没有数据!", c) + return + } + var uotContAry []TargetContOutCont + for _, v := range qualitativeEvaluationAry { + 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) +} diff --git a/gin_server_admin/api/v1/assessment/dutytype.go b/gin_server_admin/api/v1/assessment/dutytype.go index d1a244f..7c20c3c 100644 --- a/gin_server_admin/api/v1/assessment/dutytype.go +++ b/gin_server_admin/api/v1/assessment/dutytype.go @@ -658,8 +658,10 @@ type TargetContOutCont struct { DepartmentName string `json:"parentname"` Dimension string `json:"dimension"` DimensionName string `json:"dimensionname"` + DimensionWeight int64 `json:"dimensionweight"` //维度权重 Target string `json:"target"` TargetName string `json:"targetname"` + TargetWeight int64 `json:"targetweight"` //指标权重 TargetSun string `json:"targetsun"` TargetSunName string `json:"targetsunname"` DetailedTarget string `json:"detailedtarget"` @@ -691,3 +693,11 @@ type addAssEssCard struct { AddQualEval TargetSunTitle string `json:"targetsuntitle"` } + +//定性考核指标对应的结构树参数 +type QualEvalTargetTreeDies struct { + Group string `json:"group"` //集团 + DepartmentId string `json:"parentid"` //部门 + Dimension string `json:"dimension"` //维度 + Target string `json:"target"` //指标 +} diff --git a/gin_server_admin/api/v1/assessment/newassessment.go b/gin_server_admin/api/v1/assessment/newassessment.go index 798845c..9e57a2d 100644 --- a/gin_server_admin/api/v1/assessment/newassessment.go +++ b/gin_server_admin/api/v1/assessment/newassessment.go @@ -1,6 +1,7 @@ package assessment import ( + "fmt" "strconv" "strings" "time" @@ -18,13 +19,27 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv sunTargetCont, sunTargetErr := judgeColumn(addData.Target, addData.TargetSun, addData.TargetSunTitle) if sunTargetErr != true { } + groupInt, groupIntErr := strconv.ParseInt(addData.Group, 10, 64) + if groupIntErr != nil { + groupInt = 1 + } + dimensionInt, departinIntErr := strconv.ParseInt(addData.Dimension, 10, 64) + if departinIntErr != nil { + dimensionInt = 0 + } + targetInt, targetIntErr := strconv.ParseInt(addData.Target, 10, 64) + if targetIntErr != nil { + targetInt = 0 + } + departmentIdInt, departmentIdIntErr := strconv.ParseInt(deparmentId, 10, 64) + if departmentIdIntErr != nil { + departmentIdInt = 0 + } var saveDataAry []assessmentmodel.QualitativeEvaluation for _, v := range addData.EvaluationList { var saveData assessmentmodel.QualitativeEvaluation - groupInt, groupIntErr := strconv.ParseInt(addData.Group, 10, 64) - if groupIntErr == nil { - saveData.Group = groupInt - } + + saveData.Group = groupInt saveData.Type = addData.Type // departidInt, departinIntErr := strconv.ParseInt(v.DepartmentId, 10, 64) @@ -32,15 +47,9 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv // saveData.DepartmentId = departidInt // } - dimensionInt, departinIntErr := strconv.ParseInt(addData.Dimension, 10, 64) - if departinIntErr == nil { - saveData.Dimension = dimensionInt - } + saveData.Dimension = dimensionInt - targetInt, targetIntErr := strconv.ParseInt(addData.Target, 10, 64) - if targetIntErr == nil { - saveData.Target = targetInt - } + saveData.Target = targetInt saveData.TargetSun = sunTargetCont.Id // targetSunInt, targetSunIntErr := strconv.ParseInt(addData.TargetSun, 10, 64) // if targetSunIntErr == nil { @@ -64,8 +73,7 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv saveData.Addtime = time.Now().Unix() saveData.Eitetime = time.Now().Unix() - departmentIdInt, departmentIdIntErr := strconv.ParseInt(deparmentId, 10, 64) - if departmentIdIntErr == nil { + if departmentIdInt != 0 { saveData.AcceptEvaluation = departmentIdInt } saveData.Operator = strings.Join(v.Operator, ",") @@ -75,11 +83,23 @@ func (d *dataLockStatistics) AddCardAssEss(deparmentId string, addData AddQualEv msg["msg"] = saveData d.dataMap = append(d.dataMap, msg) } + if len(saveDataAry) > 0 { + addErr := global.GVA_DB_Performanceappraisal.Create(&saveDataAry).Error + if addErr != nil { + msg := commonus.MapOut() + msg["data"] = saveDataAry + msg["msg"] = fmt.Sprintf("《%v》考核维度录入失败!请重新处理此方案", addData.Dimension) + d.dataErrMap = append(d.dataErrMap, msg) + } else { + + commonus.AddDimenTargetWeight(int64(addData.Type), groupInt, departmentIdInt, dimensionInt, targetInt) + } + } syncProcess.Done() } //判断该子栏目是否存在 -func judgeColumn(ascription, title, columId string) (content assessmentmodel.QualitativeTarget, isTrue bool) { +func judgeColumn(ascription, columId, title string) (content assessmentmodel.QualitativeTarget, isTrue bool) { isTrue = false if columId != "" { judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`q_id` = ?", columId).First(&content).Error @@ -98,7 +118,7 @@ func judgeColumn(ascription, title, columId string) (content assessmentmodel.Qua ascriptionId = 0 } saveColum := assessmentmodel.QualitativeTarget{Title: title, ParentId: ascriptionId, State: 1, AddTime: time.Now().Unix()} - addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum) + addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error if addErr != nil { return } @@ -113,6 +133,7 @@ func judgeDetails(ascription, title, explain, explainId string) (content assessm if explainId != "" { judgeIdErr := global.GVA_DB_Performanceappraisal.Where("`dt_id` = ?", explainId).First(&content).Error if judgeIdErr == nil { + // fmt.Printf("echo --------------1---------->%v\n", content) isTrue = true return } @@ -120,6 +141,7 @@ func judgeDetails(ascription, title, explain, explainId string) (content assessm judgeErr := global.GVA_DB_Performanceappraisal.Where("`dt_parentid` = ? AND `dt_title` = ?", ascription, title).First(&content).Error if judgeErr == nil { isTrue = true + // fmt.Printf("echo --------------2---------->%v\n", content) return } ascriptionId, ascriptionErr := strconv.ParseInt(ascription, 10, 64) @@ -127,10 +149,12 @@ func judgeDetails(ascription, title, explain, explainId string) (content assessm ascriptionId = 0 } saveColum := assessmentmodel.DetailedTarget{Title: title, Content: explain, ParentId: ascriptionId, State: 1, AddTime: time.Now().Unix()} - addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum) + addErr := global.GVA_DB_Performanceappraisal.Create(&saveColum).Error if addErr != nil { + // fmt.Printf("echo --------------3---------->%v\n", saveColum.Id) return } + // fmt.Printf("echo --------------4---------->%v\n", saveColum.Id) isTrue = true content = saveColum return diff --git a/gin_server_admin/api/v1/assessment/qualitative_evaluation.go b/gin_server_admin/api/v1/assessment/qualitative_evaluation.go index a1f2dd2..dcfc575 100644 --- a/gin_server_admin/api/v1/assessment/qualitative_evaluation.go +++ b/gin_server_admin/api/v1/assessment/qualitative_evaluation.go @@ -41,8 +41,8 @@ func (d *DutyHandle) AddQualEval(c *gin.Context) { response.Result(102, err, "请选择考核指标", c) return } - if requestData.TargetSun == "" { - response.Result(102, err, "请选择考核指标子栏目", c) + if requestData.TargetSunTitle == "" { + response.Result(102, err, "请输入栏目名称!", c) return } if len(requestData.EvaluationList) <= 0 { @@ -935,6 +935,26 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) { response.Result(102, err, "考核细则不能为空", c) return } + groupInt, groupIntErr := strconv.ParseInt(requestData.Group, 10, 64) + if groupIntErr != nil { + groupInt = 0 + } + dimensionInt, departinIntErr := strconv.ParseInt(requestData.Dimension, 10, 64) + if departinIntErr != nil { + dimensionInt = 0 + } + targetInt, targetIntErr := strconv.ParseInt(requestData.Target, 10, 64) + if targetIntErr != nil { + targetInt = 0 + } + targetSunInt, targetSunIntErr := strconv.ParseInt(requestData.TargetSun, 10, 64) + if targetSunIntErr != nil { + targetSunInt = 0 + } + departmentIdInt, departmentIdIntErr := strconv.ParseInt(requestData.DepartmentId, 10, 64) + if departmentIdIntErr != nil { + departmentIdInt = 0 + } //开启事务处理 affairDb := global.GVA_DB_Performanceappraisal.Begin() @@ -943,26 +963,14 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) { for _, v := range requestData.List { var saveData assessmentmodel.QualitativeEvaluation - groupInt, groupIntErr := strconv.ParseInt(requestData.Group, 10, 64) - if groupIntErr == nil { - saveData.Group = groupInt - } + saveData.Group = groupInt saveData.Type = 1 - dimensionInt, departinIntErr := strconv.ParseInt(requestData.Dimension, 10, 64) - if departinIntErr == nil { - saveData.Dimension = dimensionInt - } + saveData.Dimension = dimensionInt - targetInt, targetIntErr := strconv.ParseInt(requestData.Target, 10, 64) - if targetIntErr == nil { - saveData.Target = targetInt - } + saveData.Target = targetInt - targetSunInt, targetSunIntErr := strconv.ParseInt(requestData.TargetSun, 10, 64) - if targetSunIntErr == nil { - saveData.TargetSun = targetSunInt - } + saveData.TargetSun = targetSunInt detailedTargetInt, detailedTargetIntErr := strconv.ParseInt(v.Id, 10, 64) if detailedTargetIntErr == nil { @@ -978,10 +986,7 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) { saveData.Addtime = time.Now().Unix() saveData.Eitetime = time.Now().Unix() - departmentIdInt, departmentIdIntErr := strconv.ParseInt(requestData.DepartmentId, 10, 64) - if departmentIdIntErr == nil { - saveData.AcceptEvaluation = departmentIdInt - } + 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), ",") @@ -1004,6 +1009,7 @@ func (d *DutyHandle) EiteQualEvalCont(c *gin.Context) { response.Result(102, err, "数据写入失败!请重新提交!", c) return } + commonus.AddDimenTargetWeight(1, groupInt, departmentIdInt, dimensionInt, targetInt) response.Result(0, err, "数据写入成功!", c) } else { delOldContErr = affairDb.Rollback().Error @@ -1044,8 +1050,28 @@ func (d *DutyHandle) DelQualEvalCont(c *gin.Context) { requestData.Type = 1 } - affairDb := global.GVA_DB_Performanceappraisal.Begin() + groupInt, groupIntErr := strconv.ParseInt(requestData.Group, 10, 64) + if groupIntErr != nil { + groupInt = 0 + } + dimensionInt, departinIntErr := strconv.ParseInt(requestData.Dimension, 10, 64) + if departinIntErr != nil { + dimensionInt = 0 + } + targetInt, targetIntErr := strconv.ParseInt(requestData.Target, 10, 64) + if targetIntErr != nil { + targetInt = 0 + } + // targetSunInt, targetSunIntErr := strconv.ParseInt(requestData.TargetSun, 10, 64) + // if targetSunIntErr != nil { + // targetSunInt = 0 + // } + departmentIdInt, departmentIdIntErr := strconv.ParseInt(requestData.DepartmentId, 10, 64) + if departmentIdIntErr != nil { + departmentIdInt = 0 + } + 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 dimSurplusSum int64 @@ -1062,6 +1088,7 @@ func (d *DutyHandle) DelQualEvalCont(c *gin.Context) { response.Result(103, delOldContErr, "删除失败!", c) return } + commonus.AddDimenTargetWeight(requestData.Type, groupInt, departmentIdInt, dimensionInt, targetInt) response.Result(0, delOldContErr, "删除成功!", c) } else { delOldContErr = affairDb.Rollback().Error diff --git a/gin_server_admin/api/v1/fileuploaddownload/fileuploaddown.go b/gin_server_admin/api/v1/fileuploaddownload/fileuploaddown.go index a1cbd50..b0d9bb3 100644 --- a/gin_server_admin/api/v1/fileuploaddownload/fileuploaddown.go +++ b/gin_server_admin/api/v1/fileuploaddownload/fileuploaddown.go @@ -25,8 +25,13 @@ func (f *FileUploadDownload) LongRangeFileUpload(c *gin.Context) { var urlData urlData if urlData.Type == 0 { - typePostFormInt, _ := strconv.Atoi(typePostForm) - urlData.Type = typePostFormInt + if typePostForm != "" { + typePostFormInt, _ := strconv.Atoi(typePostForm) + urlData.Type = typePostFormInt + } else { + urlData.Type = 1 + } + } if fileErr != nil { diff --git a/gin_server_admin/api/v1/shiyan/shiyan.go b/gin_server_admin/api/v1/shiyan/shiyan.go index 347e5d7..8c96563 100644 --- a/gin_server_admin/api/v1/shiyan/shiyan.go +++ b/gin_server_admin/api/v1/shiyan/shiyan.go @@ -71,10 +71,10 @@ func (a *ShiyanApi) PostRequestOperation(c *gin.Context) { //实验递归 func (s *ShiyanApi) DiGui(c *gin.Context) { - var group []wechat.GroupForm - listErr := global.GVA_DB_WatchDate.Find(&group).Error - if listErr == nil { - } + // var group []wechat.GroupForm + // listErr := global.GVA_DB_WatchDate.Find(&group).Error + // if listErr == nil { + // } var ids wechat.GroupForm _ = c.ShouldBindJSON(&ids) var setid int64 @@ -82,23 +82,27 @@ func (s *ShiyanApi) DiGui(c *gin.Context) { if ids.Id != 0 { setid = ids.Id } + + _, connn := commonus.GetOfficeWork(16118387069540343, setid) + response.Result(0, connn, "查询成功", c) + return // var parentId []int64 // var dd Ddigui // dd.faherDigui(81, group, parentId) // dd.Date = commonus.BubbleSort(dd.Date) - var dd commonus.ErgodicStruct - dd.ParentId = 1 - dd.ErgodicParentClassGroup(setid, group) - dd.Date = append(dd.Date, setid) - dd.Date = commonus.BubbleSort(dd.Date) - setidIntString := strconv.FormatInt(setid, 10) - setidInt, _ := strconv.Atoi(setidIntString) - depart, isTrue := commonus.GetDepartment(setidInt) - dateary := commonus.MapOut() - dateary["data"] = depart - dateary["istrue"] = isTrue - dateary["digui"] = dd.Date - response.Result(0, dateary, "查询失败", c) + // var dd commonus.ErgodicStruct + // dd.ParentId = 1 + // dd.ErgodicParentClassGroup(setid, group) + // dd.Date = append(dd.Date, setid) + // dd.Date = commonus.BubbleSort(dd.Date) + // setidIntString := strconv.FormatInt(setid, 10) + // setidInt, _ := strconv.Atoi(setidIntString) + // depart, isTrue := commonus.GetDepartment(setidInt) + // dateary := commonus.MapOut() + // dateary["data"] = depart + // dateary["istrue"] = isTrue + // dateary["digui"] = dd.Date + // response.Result(0, dateary, "查询失败", c) } type Ddigui struct { @@ -1040,7 +1044,9 @@ func (s *ShiyanApi) SendButtonMessageAll(c *gin.Context) { //文本通知型 func (s *ShiyanApi) SendTextMessageAll(c *gin.Context) { // var sendTextMsg commonus.TextNotice - var sendTextMsg sendmessage.TextNoticeTemplateSimplify + + var sendTextMsg sendmessage.TextNoticeTemplateMedium + // var sendTextMsg sendmessage.TextNoticeTemplateSimplify sendTextMsg.Touser = "KaiXinGuo" sendTextMsg.MsgType = "template_card" appId, _ := strconv.ParseInt(global.GVA_CONFIG.WorkWechatSchool.AgentId, 10, 64) @@ -1074,10 +1080,10 @@ func (s *ShiyanApi) SendTextMessageAll(c *gin.Context) { sendTextMsg.TemplateCard.MainTitle.Desc = "请你认真查询审批内容!" //标题辅助信息,建议不超过44个字,(支持id转译) //引用文献样式 - // sendTextMsg.TemplateCard.QuoteArea.Type = 1 + sendTextMsg.TemplateCard.QuoteArea.Type = 0 // sendTextMsg.TemplateCard.QuoteArea.Url = "http://www.hxgk.group" - // sendTextMsg.TemplateCard.QuoteArea.Title = "用车编号" - // sendTextMsg.TemplateCard.QuoteArea.QuoteText = "用车理由:\n工作需要 \n目的地:宁阳" + sendTextMsg.TemplateCard.QuoteArea.Title = "用车编号" + sendTextMsg.TemplateCard.QuoteArea.QuoteText = "用车理由:\n工作需要 \n目的地:宁阳" // sendTextMsg.TemplateCard.EmphasisContent.Title = "100" // sendTextMsg.TemplateCard.EmphasisContent.DescStruct.Desc = "核心数据" @@ -1086,24 +1092,24 @@ func (s *ShiyanApi) SendTextMessageAll(c *gin.Context) { // sendTextMsg.TemplateCard.SubTitleText = "二级普通文本,下载企业微信还能抢红包!" //二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6(非必填) - // var htalConListStrMap []sendmessage.HorizontalContentListType - // var htalConListStrCon sendmessage.HorizontalContentListType + var htalConListStrMap []sendmessage.HorizontalContentListType + var htalConListStrCon sendmessage.HorizontalContentListType // htalConListStrCon.Type = 3 - // htalConListStrCon.KeyName = "申请人" - // htalConListStrCon.Value = "秦东" + htalConListStrCon.KeyName = "申请人" + htalConListStrCon.Value = "秦东" // htalConListStrCon.UserId = "KaiXinGuo" - // htalConListStrMap = append(htalConListStrMap, htalConListStrCon) + htalConListStrMap = append(htalConListStrMap, htalConListStrCon) // htalConListStrCon.Type = 1 // htalConListStrCon.KeyName = "企业微信官网" // htalConListStrCon.Value = "点击访问" // htalConListStrCon.Url = "tel:15069130853" // htalConListStrMap = append(htalConListStrMap, htalConListStrCon) - // htalConListStrCon.Type = 3 - // htalConListStrCon.KeyName = "乘车人" - // htalConListStrCon.Value = "秦东" - // htalConListStrCon.UserId = "KaiXinGuo" - // htalConListStrMap = append(htalConListStrMap, htalConListStrCon) - // sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap + htalConListStrCon.Type = 3 + htalConListStrCon.KeyName = "乘车人" + htalConListStrCon.Value = "秦东" + htalConListStrCon.UserId = "KaiXinGuo" + htalConListStrMap = append(htalConListStrMap, htalConListStrCon) + sendTextMsg.TemplateCard.HorizontalContentList = htalConListStrMap var jumpListStruct sendmessage.JumpListType jumpListStruct.Type = 1 @@ -1259,3 +1265,24 @@ func (s *ShiyanApi) GetEatilTemplate(c *gin.Context) { outData["jiamistrHa1"] = jiamistrHa1 response.Result(0, outData, "查询成功", c) } + +type timeDataType struct { + Time int64 `json:"time"` + Type int `json:"type"` +} + +//时间日期实现 +func (s *ShiyanApi) DateTime(c *gin.Context) { + var requestData timeDataType + err := c.ShouldBindJSON(&requestData) + if err != nil { + } + if requestData.Time == 0 { + requestData.Time = time.Now().Unix() + } + if requestData.Type == 0 { + requestData.Type = 1 + } + quer := commonus.ComputingTime(requestData.Time, requestData.Type) + response.Result(0, quer, "查询成功", c) +} diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index 141494a..2556aa6 100644 --- a/gin_server_admin/api/wechatapp/callback/apphandle.go +++ b/gin_server_admin/api/wechatapp/callback/apphandle.go @@ -148,7 +148,7 @@ func (c *CallBackData) DecryptMessage() { } callbackLog.AddTime = time.Now().Unix() if msgContent.Event != "LOCATION" { - global.GVA_DB_WechatCallBack.Create(&callbackLog) + // global.GVA_DB_WechatCallBack.Create(&callbackLog) } } diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index 0230412..caff78c 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -4,8 +4,14 @@ import ( "encoding/json" "encoding/xml" "fmt" + "strconv" + "strings" + "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" ) //更新数据 @@ -15,17 +21,323 @@ func templateEventPush(eventMsg []byte) { if nil != err { fmt.Println("***********Unmarshal fail") } - fmt.Printf("button======>%v\n", msgContent) + fmt.Printf("button======>%v\n", msgContent.EventKey) + + buttonClick := strings.Split(msgContent.EventKey, "_") + + if len(buttonClick) >= 3 { + // for i, v := range buttonClick { + + // fmt.Printf("%v====================>%v==================>%v\n", i, v, buttonClick[1]) + // } + switch buttonClick[0] { + case "duty": //数据考核审批工作 + fmt.Printf("@@@@\n") + msgContent.ButtonTemplateCallBackHandle(buttonClick[1], buttonClick[2]) + default: + } + } jsonStr, _ := json.Marshal(msgContent) fmt.Printf("jsonStr======>%v\n", string(jsonStr)) + // var updateButtonNotClickable commonus.UpdateButtonNotClickable + // updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo") + // updateButtonNotClickable.Atall = 0 + // updateButtonNotClickable.Agentid = msgContent.Agentid + // updateButtonNotClickable.ResponseCode = msgContent.ResponseCode + // updateButtonNotClickable.Button.ReplaceName = "已提交更新" + // callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage() + // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont) +} + +//按钮模板回调处理 +func (t *TemplateCardPush) ButtonTemplateCallBackHandle(scoreFlowKey, clickEnter string) { + var scoreFlowInfo assessmentmodel.ScoreFlow + judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", scoreFlowKey).First(&scoreFlowInfo).Error + fmt.Printf("1@@@@%v\n", scoreFlowInfo) + if judegFlowErr != nil { + return + } + + //获取审批流程 + var flowLog []evaluation.FlowStep + var evalProc assessmentmodel.EvaluationProcess + judgeErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", scoreFlowKey).First(&evalProc).Error + if judgeErr != nil { + return + } + jsonFlowErr := json.Unmarshal([]byte(evalProc.Content), &flowLog) + if jsonFlowErr != nil || len(flowLog) < 1 { + return + } + fmt.Printf("3@@@@%v\n", scoreFlowInfo) + if len(flowLog) < 1 { + return + } + sendUserList, _ := GetCaoZuoRen(flowLog[len(flowLog)-1].Step, scoreFlowInfo) + // fmt.Printf("1ssss@@@@%v\n", scoreFlowInfo) + buttonClickNAme := "已批准" + buttonClickNAmeOther := "其他人已批准" + fmt.Printf("45@@@@%v\n", flowLog[len(flowLog)-1].Step) + if clickEnter == "1" { + //1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人 + switch flowLog[len(flowLog)-1].Step { + case 1: + case 2: + //是否需要整改 + if scoreFlowInfo.Rectification != 1 { + evaluation.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, scoreFlowInfo.Key, 3) + _, sendUserList = commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科) + userAry := strings.Split(sendUserList, "|") + var userKeyInt int64 = 0 + if len(userAry) > 0 { + _, userConts := commonus.GetUesrContForWechatID(userAry[0]) + userKeyInt = userConts.Key + } + //获取接收人是谁 第一责任人 + var divisResponInfo assessmentmodel.DivisionResponsibilities + judegdivisErr := global.GVA_DB_Performanceappraisal.Where("`df_type` = 1 AND `df_sf_id` = ?", scoreFlowKey).First(&divisResponInfo).Error + if judegdivisErr == nil { + userKeyInt = divisResponInfo.UserKey + } + SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, scoreFlowInfo.PlusReduceScore) + // callbakcMsg, isTrueCall, callBackCont, sendTextMsg := SendRectifyMsg(sendUserList, scoreFlowInfo.Reason, scoreFlowInfo.EvaluationPlan, scoreFlowInfo.Key, scoreFlowInfo.DutyDepartment, userKeyInt, scoreFlowInfo.Score, scoreFlowInfo.PlusReduceScore) + // fmt.Printf("更新销售:%v-----------%v-----------%v-----------%v\n", scoreFlowInfo.DutyDepartment, userKeyInt, sendUserList, userAry[0]) + // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendTextMsg) + } else { + buttonClickAry := strings.Split(t.EventKey, "_") + if len(buttonClickAry) < 4 { + return + } + evaluation.UpEvaluationProcessApproval(scoreFlowInfo.Key, 0, scoreFlowInfo.Key, 5) + _, sendUserListing := commonus.GetSendMsgUser(16182159043990656, scoreFlowInfo.DutyDepartment) //获取对应部门负责人(高科) + userAry := strings.Split(sendUserListing, "|") + var userKeyInt int64 = 0 + if len(userAry) > 0 { + _, userConts := commonus.GetUesrContForWechatID(userAry[0]) + userKeyInt = userConts.Key + } + + //获取信息接收人 + 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 + } + } + + 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 + } + } + + var recMeasCont assessmentmodel.RectificationMeasures + judgeRecMeas := global.GVA_DB_Performanceappraisal.Where("`rm_id` = ?", buttonClickAry[3]).First(&recMeasCont).Error + if judgeRecMeas != nil { + return + } + mainTitleDesc := programme.Content + subtitle := "整改内容:" + reason := recMeasCont.Content + //获取当前执行人信息 + commonus.GetUesrContForWechatID(t.ToUsername) + + keyNumber := commonus.GetFileNumberEs() + SendRectifyReceipt(sendUserList, mainTitle, mainTitleDesc, subtitle, reason, scoreFlowInfo.DutyDepartment, userKeyInt, keyNumber, scoreFlowInfo.Key, recMeasCont.Id) + } + case 3: + case 4: + case 5: + default: + } + + } else { + buttonClickNAme = "已驳回" + buttonClickNAmeOther = "其他人已驳回" + scoreFlowKeyId, scoreFlowKeyErr := strconv.ParseInt(scoreFlowKey, 10, 64) + if scoreFlowKeyErr == nil { + evaluation.UpEvaluationProcessReject(scoreFlowKeyId) + } + + } + + // performSteps := 1 + // fmt.Printf("3@@@@%v\n", flowLog[len(flowLog)-1].Step) + + // fmt.Printf("2@@@@%v--->%v\n", sendUserList, scoreFlowInfo.DutyDepartment) + + userAry := strings.Split(sendUserList, "|") + for _, v := range userAry { + if v == t.FromUsername { + t.UpdateButton(v, buttonClickNAme) + } else { + t.UpdateButton(v, buttonClickNAmeOther) + } + } +} + +//更新按钮 +func (t *TemplateCardPush) UpdateButton(userOpenId, buttonName string) { var updateButtonNotClickable commonus.UpdateButtonNotClickable - updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, "KaiXinGuo") + updateButtonNotClickable.Userids = append(updateButtonNotClickable.Userids, userOpenId) updateButtonNotClickable.Atall = 0 - updateButtonNotClickable.Agentid = msgContent.Agentid - updateButtonNotClickable.ResponseCode = msgContent.ResponseCode - updateButtonNotClickable.Button.ReplaceName = "已提交更新" - callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage() - fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v\n", string(callbakcMsg), isTrueCall, callBackCont) + updateButtonNotClickable.Agentid = t.Agentid + updateButtonNotClickable.ResponseCode = t.ResponseCode + updateButtonNotClickable.Button.ReplaceName = buttonName + // callbakcMsg, isTrueCall, callBackCont := updateButtonNotClickable.UpdateSendButtonMessage() + // fmt.Printf("更新销售发送信息返回:%v-----------%v----------->%v------》%v\n", string(callbakcMsg), isTrueCall, callBackCont, updateButtonNotClickable) +} + +//获取操作人 +func GetCaoZuoRen(stepVal int, s assessmentmodel.ScoreFlow) (sendUserList string, stepDepart int64) { + //1:内勤;2:部门负责人:3:整改;4:整改后部门负责;5:归档起草人 + + switch stepVal { + case 1: + stepDepart = 16118387069540343 + _, sendUserList = commonus.GetSendMsgUser(16118387069540343, s.DutyDepartment) //获取对应部门负责人(高科) + case 2: + stepDepart = 16182159043990656 + //给相关部门内勤发送消息。确定相关责任人 + _, sendUserList = commonus.GetSendMsgUser(16182159043990656, s.DutyDepartment) //获取对应部门负责人(高科) + case 3: + case 4: + stepDepart = 16182159043990656 + //给相关部门内勤发送消息。确定相关责任人 + _, sendUserList = commonus.GetSendMsgUser(16182159043990656, s.DutyDepartment) //获取对应部门负责人(高科) + case 5: + //获取操作人 + userFileStr := "wm_number,qywx_key,wx_key" + //操作人条件 + userWherAry := commonus.MapOut() + // userWherAry["wm_key"] = "WoBenShanLiang_3" //"WoBenShanLiang_3" + userWherAry["wm_key"] = s.EvaluationUser + userConting, userIsTrue := commonus.GetUserInfoPublic(userFileStr, userWherAry) + if userIsTrue == true { + if userConting.WechatId != "" { + sendUserList = userConting.WechatId + } + if userConting.WorkWechatId != "" { + sendUserList = userConting.WorkWechatId + } + } + + default: + } + return +} + +//发出整改通知 +/* +@floeKey 方案KEY +@sendUserList 接收用户 +@planIdInt 考核方案项目ID +@reason 原因 +@typeSet 1:加分;2:减分 +@departmentId 执行考核部门 +@userKey 执行考核人 +@Score 考核分值 +*/ +func SendRectifyMsg(sendUserList, reason string, planIdInt, floeKey, departmentId, userKey, Score int64, typeSet int) (callbakcMsg []byte, isTrueCall bool, callBackCont string, sendTextMsg sendmessage.TextNoticeTemplateMedium) { + var mainTitle string = "" + var mainTitleDesc string = "" + var programme assessmentmodel.QualitativeEvaluation + judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", planIdInt).First(&programme).Error + if judgeProgramme != nil { + return + } + + if programme.Type == 1 { + detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) + if detailedTargetErr == true { + if detailedTargetCont.Title != "" { + mainTitle = detailedTargetCont.Title + } else { + mainTitle = 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 + } + } + scoreReason := "" + subTitleText := "部门" + keyNumber := commonus.GetFileNumberEs() + //发送整改通知 + handleUrl := fmt.Sprintf("http://www.hxgk.group?orderid=%v", floeKey) + callbakcMsg, isTrueCall, callBackCont, sendTextMsg = sendmessage.SendMsgTxtPublic(sendUserList, mainTitle, mainTitleDesc, programme.Unit, reason, handleUrl, scoreReason, subTitleText, typeSet, departmentId, userKey, Score, keyNumber, "请上报整改结果!") + return +} + +/* +发送文本任务卡 +@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 } diff --git a/gin_server_admin/api/wechatapp/sendmessage/apphandle.go b/gin_server_admin/api/wechatapp/sendmessage/apphandle.go index 39c381e..9a3f53e 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/apphandle.go +++ b/gin_server_admin/api/wechatapp/sendmessage/apphandle.go @@ -2,9 +2,11 @@ package sendmessage import ( "encoding/json" + "strconv" "github.com/flipped-aurora/gin-vue-admin/server/api/wechatapp/sharemethod" "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/common/response" "github.com/gin-gonic/gin" ) @@ -92,6 +94,50 @@ func (s *TextNoticeTemplate) SendMessage(appName string) ([]byte, bool, string) return addDePartMent, true, msg } +//文本通知型中配 +func (s *TextNoticeTemplateMedium) SendMessage(appName string) ([]byte, bool, string) { + sendUrl, IsTrue, msg := sharemethod.GetSendMsgTokenUrl(appName) + if IsTrue == false { + return nil, false, msg + } + sendJsonData, _ := json.Marshal(s) + addDePartMent := commonus.CurlPostJosn(sendUrl, sendJsonData) + // fmt.Printf("%v-------------->%v\n", string(sendJsonData), string(addDePartMent)) + return addDePartMent, true, msg +} +func (s *TextNoticeTemplateMedium) Inset(userList, msgType, CardType string, taskId int64) { + 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 = "text_notice" + } + //卡片来源样式信息,不需要来源样式可不填写(非必填) + s.TemplateCard.Source.IconUrl = "https://docu.hxgk.group/images/2022_01/3f7a1120a559e9bee3991b85eb34d103.png" + s.TemplateCard.Source.Desc = "知行学院" + s.TemplateCard.Source.DescColor = 2 + + if taskId == 0 { + taskId = commonus.GetFileNumberEs() + s.TemplateCard.TaskId = strconv.FormatInt(taskId, 10) + } else { + s.TemplateCard.TaskId = strconv.FormatInt(taskId, 10) + } + +} + //文本通知型简化 func (s *TextNoticeTemplateSimplify) SendMessage(appName string) ([]byte, bool, string) { sendUrl, IsTrue, msg := sharemethod.GetSendMsgTokenUrl(appName) @@ -140,6 +186,52 @@ func (s *ButtonTemplate) SendMessage(appName string) ([]byte, bool, string) { return addDePartMent, true, msg } +//按钮交互型中配 +func (s *ButtonNoticeTemplateMedium) SendMessage(appName string) ([]byte, bool, string) { + sendUrl, IsTrue, msg := sharemethod.GetSendMsgTokenUrl(appName) + if IsTrue == false { + return nil, false, msg + } + sendJsonData, _ := json.Marshal(s) + addDePartMent := commonus.CurlPostJosn(sendUrl, sendJsonData) + // fmt.Printf("%v-------------->%v\n", string(sendJsonData), string(addDePartMent)) + return addDePartMent, true, msg +} + +//按钮交互型中配 +func (s *ButtonNoticeTemplateMedium) Inset(userList, msgType, CardType string, taskId int64) { + 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 = "知行学院" + s.TemplateCard.Source.DescColor = 2 + + if taskId == 0 { + taskId = commonus.GetFileNumberEs() + s.TemplateCard.TaskId = strconv.FormatInt(taskId, 10) + } else { + s.TemplateCard.TaskId = strconv.FormatInt(taskId, 10) + } + +} + //投票选择型 func (s *VoteTemplate) SendMessage(appName string) ([]byte, bool, string) { sendUrl, IsTrue, msg := sharemethod.GetSendMsgTokenUrl(appName) diff --git a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go new file mode 100644 index 0000000..8b2c156 --- /dev/null +++ b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go @@ -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 +} diff --git a/gin_server_admin/api/wechatapp/sendmessage/type.go b/gin_server_admin/api/wechatapp/sendmessage/type.go index feb634e..5cedb6f 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/type.go +++ b/gin_server_admin/api/wechatapp/sendmessage/type.go @@ -303,7 +303,23 @@ type TextTemplateCardType struct { //文本通知型(完整版) type TextNoticeTemplate struct { ShareField - TemplateCard TextTemplateCardType `json:"template_card"` + TemplateCard TextTemplateCardType `json:"template_card"` //一级标题 + // QuoteArea QuoteAreaType `json:"quote_area"` //引用文献样式 +} + +//文本通知型(中配) +type TextNoticeTemplateMedium struct { + ShareField + TemplateCard TextNoticeTemplateMediumSimplify `json:"template_card"` +} +type TextNoticeTemplateMediumSimplify struct { + ShareTemplateCard + MainTitle MainTitleType `json:"main_title"` + QuoteArea QuoteAreaType `json:"quote_area"` //引用文献样式 + SubTitleTextType //二级普通文本 + HorizontalContentList []HorizontalContentListType `json:"horizontal_content_list"` //二级标题+文本列表 + JumpList []JumpListType `json:"jump_list"` //跳转指引样式的列表,该字段可为空数组 + CardAction CardActionType `json:"card_action"` } //文本结构体(简化) @@ -380,6 +396,23 @@ type ButtonTemplate struct { TemplateCard ButtonTemplateCardType `json:"template_card"` } +//按钮交互型(中配) +type ButtonNoticeTemplateMedium struct { + ShareField + TemplateCard ButtonNoticeTemplateMediumSimplify `json:"template_card"` +} + +//按钮交互型(中配) +type ButtonNoticeTemplateMediumSimplify struct { + ShareTemplateCard + MainTitle MainTitleType `json:"main_title"` + QuoteArea QuoteAreaType `json:"quote_area"` //引用文献样式 + SubTitleTextType //二级普通文本 + HorizontalContentList []HorizontalContentListType `json:"horizontal_content_list"` //二级标题+文本列表 + ButtonList []ButtonListtype `json:"button_list"` //按钮列表,列表长度不超过6 + CardAction CardActionType `json:"card_action"` +} + //投票选择型(完整版) type VoteTemplateCardType struct { ShareTemplateCard diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index f6d4aad..68adc6b 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -3,6 +3,7 @@ package commonus //公共函数类 import ( "encoding/json" + "fmt" "regexp" "strconv" "strings" @@ -1022,3 +1023,172 @@ func GetDutyClassInfo(id int64) (content assessmentmodel.DutyClass, isTrue bool) } return } + +//添加维度指标或维度权重 +func AddDimenTargetWeight(setType, group, departmentID, dimensionId, targetId int64) { + var weightSum int64 = 0 + // fmt.Printf("1-----@---2------->%v\n", targetId) + if targetId != 0 { + weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ?", group, departmentID, dimensionId, targetId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error + + // msg = fmt.Sprintf("1-----@---1------->%v\n", weightSum) + if weghtErr == nil { + var ddwCont assessmentmodel.DepartmentDimensionWeight + judgeTrue := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Select("ddw_id").Where("`ddw_hierarchy` = 2 AND `ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ? AND `ddw_target` = ?", group, departmentID, dimensionId, targetId).First(&ddwCont).Error + if judgeTrue == nil { + targetWeightMap := MapOut() + targetWeightMap["ddw_hierarchy"] = 2 + targetWeightMap["ddw_type"] = setType + targetWeightMap["ddw_weight"] = weightSum + targetWeightMap["ddw_time"] = time.Now().Unix() + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Where("`ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ? AND `ddw_target` = ?", group, departmentID, dimensionId, targetId).Updates(&targetWeightMap) + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Where("`ddw_id` = ?", ddwCont.Id).Updates(&targetWeightMap) + // msg = fmt.Sprintf("1--------1------->%v\n", weightSum) + } else { + var saveData assessmentmodel.DepartmentDimensionWeight + saveData.Group = group + saveData.DepartmentId = departmentID + saveData.Dimension = dimensionId + saveData.Target = targetId + saveData.Weight = weightSum + saveData.Addtime = time.Now().Unix() + saveData.Type = int64(setType) + saveData.Hierarchy = 2 + global.GVA_DB_Performanceappraisal.Create(&saveData) + // msg = fmt.Sprintf("2--------1------->%v\n", weightSum) + } + + } else { + var saveData assessmentmodel.DepartmentDimensionWeight + saveData.Group = group + saveData.DepartmentId = departmentID + saveData.Dimension = dimensionId + saveData.Target = targetId + saveData.Weight = weightSum + saveData.Addtime = time.Now().Unix() + saveData.Type = int64(setType) + saveData.Hierarchy = 2 + global.GVA_DB_Performanceappraisal.Create(&saveData) + // msg = fmt.Sprintf("3--------1------->%v\n", weightSum) + } + AddDimensionWeight(setType, group, departmentID, dimensionId) + } + // return +} + +func AddDimensionWeight(setType, group, departmentID, dimensionId int64) { + var weightSum int64 = 0 + fmt.Printf("1-------@-------->%v\n", departmentID) + if dimensionId != 0 { + weghtErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ?", group, departmentID, dimensionId).Pluck("COALESCE(SUM(qe_reference_score), 0) as qe_reference_score", &weightSum).Error + if weghtErr == nil { + var ddwCont assessmentmodel.DepartmentDimensionWeight + judgeTrue := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Select("ddw_id").Where("`ddw_hierarchy` = 1 AND `ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ?", group, departmentID, dimensionId).First(&ddwCont).Error + if judgeTrue == nil { + targetWeightMap := MapOut() + targetWeightMap["ddw_hierarchy"] = 1 + targetWeightMap["ddw_type"] = setType + targetWeightMap["ddw_weight"] = weightSum + targetWeightMap["ddw_time"] = time.Now().Unix() + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Where("`ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ? AND `ddw_target` = ?", group, departmentID, dimensionId, targetId).Updates(&targetWeightMap) + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartmentDimensionWeight{}).Where("`ddw_id` = ?", ddwCont.Id).Updates(&targetWeightMap) + // fmt.Printf("1--------------->%v\n", weightSum) + } else { + var saveData assessmentmodel.DepartmentDimensionWeight + saveData.Group = group + saveData.DepartmentId = departmentID + saveData.Dimension = dimensionId + saveData.Target = 0 + saveData.Weight = weightSum + saveData.Addtime = time.Now().Unix() + saveData.Type = int64(setType) + saveData.Hierarchy = 1 + global.GVA_DB_Performanceappraisal.Create(&saveData) + // fmt.Printf("2--------------->%v\n", weightSum) + } + + } else { + var saveData assessmentmodel.DepartmentDimensionWeight + saveData.Group = group + saveData.DepartmentId = departmentID + saveData.Dimension = dimensionId + saveData.Target = 0 + saveData.Weight = weightSum + saveData.Addtime = time.Now().Unix() + saveData.Type = int64(setType) + saveData.Hierarchy = 1 + global.GVA_DB_Performanceappraisal.Create(&saveData) + // fmt.Printf("3--------------->%v\n", weightSum) + } + } +} + +//获取维度或指标权重 +func GetDimesionTargetWeight(setType, group, departmentID, dimensionId, targetId int64) (weight int64) { + var ddwCont assessmentmodel.DepartmentDimensionWeight + gormDb := global.GVA_DB_Performanceappraisal + gormDb = gormDb.Select("ddw_weight").Where("`ddw_group` = ? AND `ddw_derpatment` = ? AND `ddw_dimension` = ?", group, departmentID, dimensionId) + if setType == 2 { + gormDb = gormDb.Where("`ddw_hierarchy` = 2 AND `ddw_target` = ?", targetId) + } else { + gormDb = gormDb.Where("`ddw_hierarchy` = 1") + } + judgeTrue := gormDb.First(&ddwCont).Error + if judgeTrue != nil { + weight = 0 + } else { + weight = ddwCont.Weight + } + return +} + +//根据部门获取内勤数据 +func GetOfficeWork(id, departmentId int64) (isTrue bool, roleUser []roleGroupBodyAry) { + isTrue = false + departID := strconv.FormatInt(departmentId, 10) + var roleGroup systemuser.RoleGroup + err := global.GVA_DB_Master.Where("`srg_id` = ?", id).First(&roleGroup).Error //16118387069540343 + if err != nil { + return + } + roleAry := MapOut() + errMap := json.Unmarshal([]byte(roleGroup.Contentes), &roleAry) + if errMap != nil { + return + } + for i, v := range roleAry { + // roleArys := MapOut() + if i == departID { + jsonMAp, _ := json.Marshal(v) + jsonErrs := json.Unmarshal(jsonMAp, &roleUser) + if jsonErrs == nil { + isTrue = true + } + // fmt.Printf("%v------->%v------->%v\n", i, roleGroup, roleUser) + } + + } + return +} + +//获取企业微信信息接收人 +func GetSendMsgUser(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, "|") + isTrue = true + } + return +} diff --git a/gin_server_admin/commonus/publicstruct.go b/gin_server_admin/commonus/publicstruct.go index b29c0b3..1136846 100644 --- a/gin_server_admin/commonus/publicstruct.go +++ b/gin_server_admin/commonus/publicstruct.go @@ -62,3 +62,14 @@ type DutyAssClass struct { AssessId int64 `json:"assessId"` //考核项目 AssTitle string `json:"asstitle"` //考核项目名称 } + +type roleGroupAry struct { + Id roleGroupBodyAry `json:"id"` +} +type roleGroupBodyAry struct { + Id string `json:"open_id"` + WechatName string `json:"wechat_name"` + Prentid string `json:"prentid"` + Bfid string `json:"bf_id"` + Icons string `json:"icons"` +} diff --git a/gin_server_admin/commonus/timeSub.go b/gin_server_admin/commonus/timeSub.go index e419c20..4a7a8b8 100644 --- a/gin_server_admin/commonus/timeSub.go +++ b/gin_server_admin/commonus/timeSub.go @@ -3,6 +3,7 @@ package commonus import ( "fmt" "math" + "strconv" "time" ) @@ -152,6 +153,17 @@ func TimeStampToDate(timeStamp int64, timeType int) (dateStr string) { timeTemplate = "02" case 10: timeTemplate = "2006-01" + case 11: + timeTemplate = "2006" //年 + case 12: + timeTemplate = "01" //月 + case 13: //季度 + dayMonth := time.Unix(timeStamp, 0).Format("01") + datMonthFloat, datMonthFloatErr := strconv.ParseFloat(dayMonth, 10) + if datMonthFloatErr == nil { + dateStr = strconv.FormatFloat(math.Ceil(datMonthFloat/3), 'g', 1, 64) + } + dateStr = "1" default: timeTemplate = "2006-01-02 15:04:05" //常规类型 } @@ -159,6 +171,65 @@ func TimeStampToDate(timeStamp int64, timeType int) (dateStr string) { return } +//时间计算(年、季、月、周、日、时、分、秒) +func ComputingTime(timeStamp int64, timeType int) (timeDataInt int64) { + var timeData string = "1" + switch timeType { + case 1: + timeData = time.Unix(timeStamp, 0).Format("2006") //年 + case 2: + dayMonth := time.Unix(timeStamp, 0).Format("01") //季度 + datMonthFloat, datMonthFloatErr := strconv.ParseFloat(dayMonth, 10) + if datMonthFloatErr == nil { + timeData = strconv.FormatFloat(math.Ceil(datMonthFloat/3), 'g', 1, 64) + } else { + timeData = "1" + } + case 3: + timeData = time.Unix(timeStamp, 0).Format("01") //月份 + case 4: //当前日期为本月第几周 + monthFirstDayStr := DateToTimeStamp(TimeStampToDate(timeStamp, 10) + "-01 00:00:00") //获取指定月第一天时间戳 + dayTime := time.Unix(monthFirstDayStr, 0) + dayOfWeek := int(dayTime.Weekday()) //获取本月第一天是周几 + if dayOfWeek == 0 { + dayOfWeek = 7 + } + + dayNumber, dayNumberErr := strconv.ParseInt(TimeStampToDate(timeStamp, 9), 10, 64) //获取今天是几号 + if dayNumberErr != nil { + dayNumber = 1 + } + daysAndWeeksDiff := dayNumber - (8 - int64(dayOfWeek)) + if daysAndWeeksDiff <= 0 { + timeData = "1" + } else { + daysAndWeeksDiffFlot, daysAndWeeksDiffFloatErr := strconv.ParseFloat(strconv.FormatInt(daysAndWeeksDiff, 10), 10) + if daysAndWeeksDiffFloatErr == nil { + daysWeeksDiffVal := math.Ceil(daysAndWeeksDiffFlot/7) + 1 + timeData = strconv.FormatFloat(daysWeeksDiffVal, 'g', 1, 64) + } else { + timeData = "1" + } + } + case 5: + timeData = time.Unix(timeStamp, 0).Format("02") //月份 + case 7: + timeData = time.Unix(timeStamp, 0).Format("15") //月份 + case 8: + timeData = time.Unix(timeStamp, 0).Format("04") //月份 + case 9: + timeData = time.Unix(timeStamp, 0).Format("05") //月份 + default: + timeData = "0" + } + timeDataInt, timeDataIntErr := strconv.ParseInt(timeData, 10, 64) + if timeDataIntErr != nil { + timeDataInt = 0 + return + } + return +} + /* 指定日期起止时间戳 @startTime diff --git a/gin_server_admin/commonus/updatemessagetype.go b/gin_server_admin/commonus/updatemessagetype.go index cb3cd1a..fb75bea 100644 --- a/gin_server_admin/commonus/updatemessagetype.go +++ b/gin_server_admin/commonus/updatemessagetype.go @@ -50,3 +50,13 @@ type UpdateButtonNotClickable struct { type ButtonNotClick struct { ReplaceName string `json:"replace_name"` } + +//模板卡片更新消息 +/* +更新点击用户的按钮文案 +更新按钮的文案,同时按钮自动变更为不可点击的状态 +仅原卡片为按钮交互型、投票选择型、多项选择型的卡片支持更新点击用户的按钮文案 +*/ +type UpdateButtonTemple struct { + ToUserName string `ToUserName` +} diff --git a/gin_server_admin/initialize/router.go b/gin_server_admin/initialize/router.go index f6237ac..3ffbe36 100644 --- a/gin_server_admin/initialize/router.go +++ b/gin_server_admin/initialize/router.go @@ -157,7 +157,7 @@ func Routers() *gin.Engine { // staffMan.InitStaffRouter(MyCustomPrivateGroup) //员工相关操作 dutyAssEss.InitDutyHandelRouter(MyCustomPrivateGroup) //前端数据考核 - + dutyAssEss.InitEvaluationRouter(MyCustomPrivateGroup) //用户端数据考核 ExamineApprove.InitShiyanRouter(MyCustomPrivateGroup) //前端审批相关 } //自定义后台登录 diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index 1a5cc1f..b8cbb98 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -2,7 +2,7 @@ package assessmentmodel //职责类别 type DutyClass struct { - Id int64 `json:"id" gorm:"column:id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:title;type:varchar(255);comment:职责类别名称"` Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:定性考核;2:定量考核)"` Weight int `json:"weight" gorm:"column:weight;type:int(3) unsigned;default:0;not null;comment:权重比例"` @@ -16,7 +16,7 @@ func (DutyClass *DutyClass) TableName() string { //履职考核表 type DepartDuty struct { - Id int64 `json:"id" gorm:"column:de_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:de_id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:de_title;type:varchar(255);comment:考核名称"` State int `json:"state" gorm:"column:de_satte;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` Time int64 `json:"time" gorm:"column:de_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` @@ -34,7 +34,7 @@ func (DepartDuty *DepartDuty) TableName() string { //考核细则 type DutyContent struct { - Id int64 `json:"id" gorm:"column:dc_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:dc_id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:dc_title;type:text;comment:具体职责"` Time int64 `json:"time" gorm:"column:dc_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` State int `json:"state" gorm:"column:dc_state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` @@ -55,7 +55,7 @@ func (DutyContent *DutyContent) TableName() string { //考核项目 type AssessMentitems struct { - Id int64 `json:"id" gorm:"column:ai_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:ai_id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:ai_title;type:varchar(255);comment:考核类别"` Weight int `json:"weight" gorm:"column:ai_weight;type:int(3) unsigned;default:0;not null;comment:权重比例"` Fraction int `json:"fraction" gorm:"column:ai_fraction;type:int(3) unsigned;default:0;not null;comment:分数"` @@ -85,7 +85,7 @@ type AssessClass struct { //评分记录 type Departscore struct { - Id int64 `json:"id" gorm:"column:s_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:s_id;type:bigint(20) unsigned;not null;comment:Id"` ClassId int64 `json:"classID" gorm:"column:s_class;type:bigint(20) unsigned;default:0;not null;comment:考核分类"` AssessId int64 `json:"assessId" gorm:"column:s_assess;type:bigint(20) unsigned;default:0;not null;comment:考核项目"` DutyId int64 `json:"dutyId" gorm:"column:s_duty;type:bigint(20) unsigned;default:0;not null;comment:具体职责"` @@ -109,7 +109,7 @@ func (Departscore *Departscore) TableName() string { //评分记录附表 type Departscores struct { - Id int64 `json:"id" gorm:"column:s_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:s_id;type:bigint(20) unsigned;not null;comment:Id"` ClassId int64 `json:"classID" gorm:"column:s_class;type:bigint(20) unsigned;default:0;not null;comment:考核分类"` AssessId int64 `json:"assessId" gorm:"column:s_assess;type:bigint(20) unsigned;default:0;not null;comment:考核项目"` DutyId int64 `json:"dutyId" gorm:"column:s_duty;type:bigint(20) unsigned;default:0;not null;comment:具体职责"` @@ -132,7 +132,7 @@ func (Departscores *Departscores) TableName() string { //考核记录 type AssessmentLog struct { - Id int64 `json:"id" gorm:"column:al_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:al_id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:al_title;type:varchar(255);comment:考核标题"` Assdepart int `json:"assdepart" gorm:"column:al_assdepart;type:int(5) unsigned;default:0;not null;comment:被考核部门"` ExecutorUser int64 `json:"executorUser" gorm:"column:al_executor_user;type:bigint(20) unsigned;default:0;not null;comment:执行人"` @@ -151,7 +151,7 @@ func (AssessmentLog *AssessmentLog) TableName() string { //考核方案 type EvaluationScheme struct { - Id int64 `json:"id" gorm:"column:es_id;type:bigint(20) unsigned;not null;comment:Id"` + Id int64 `json:"id" gorm:"primaryKey;column:es_id;type:bigint(20) unsigned;not null;comment:Id"` Title string `json:"title" gorm:"column:es_title;type:varchar(255);comment:方案名称"` Group int64 `json:"group" gorm:"column:es_group;type:bigint(10) unsigned;default:1;not null;comment:归属集团"` EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:es_evaluation_department;type:bigint(20);not null;comment:被考核部门"` @@ -171,7 +171,7 @@ func (EvaluationScheme *EvaluationScheme) TableName() string { //测评指标 type EvaluationTarget struct { - Id int64 `json:"id" gorm:"column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"` Title string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"` Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` State int `json:"state" gorm:"column:et_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` @@ -194,7 +194,7 @@ func (EvaluationTarget *EvaluationTarget) TableName() string { //定性测评指标子栏目 type QualitativeTarget struct { - Id int64 `json:"id" gorm:"column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"` Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"` ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"` State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` @@ -207,7 +207,7 @@ func (QualitativeTarget *QualitativeTarget) TableName() string { //指标细则 type DetailedTarget struct { - Id int64 `json:"id" gorm:"column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"` Title string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"` Content string `json:"content" gorm:"column:dt_content;type:text;comment:指标说明"` ParentId int64 `json:"parentid" gorm:"column:dt_parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` @@ -222,7 +222,7 @@ func (DetailedTarget *DetailedTarget) TableName() string { //性质考核方案 type QualitativeEvaluationScheme struct { - Id int64 `json:"id" gorm:"column:qes_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:qes_id;type:bigint(20) unsigned;not null;comment:Id;index"` Title string `json:"title" gorm:"column:qes_title;type:text;comment:方案名称"` Key int64 `json:"key" gorm:"column:qes_key;type:bigint(20) unsigned;default:0;not null;comment:key"` DepartmentId int64 `json:"parentid" gorm:"column:qes_department_id;type:bigint(20) unsigned;default:0;not null;comment:归属部门"` @@ -237,7 +237,7 @@ func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() stri //性质考核方案明细 type QualitativeEvaluation struct { - Id int64 `json:"id" gorm:"column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"` DepartmentId string `json:"parentid" gorm:"column:qe_department_id;type:text;comment:执行考核部门ID"` Dimension int64 `json:"dimension" gorm:"column:qe_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` @@ -266,7 +266,7 @@ func (QualitativeEvaluation *QualitativeEvaluation) TableName() string { //性质考核方案 type DepartmentDimension struct { - Id int64 `json:"id" gorm:"column:dd_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:dd_id;type:bigint(20) unsigned;not null;comment:Id;index"` Key int64 `json:"key" gorm:"column:dd_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` DepartmentId int64 `json:"parentid" gorm:"column:dd_department;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` Dimension int64 `json:"dimension" gorm:"column:dd_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` @@ -281,7 +281,7 @@ func (DepartmentDimension *DepartmentDimension) TableName() string { //性质考核方案 type DepartmentDimensionWeight struct { - Id int64 `json:"id" gorm:"column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Id int64 `json:"id" gorm:"primaryKey;column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"` Type int64 `json:"type" gorm:"column:ddw_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` Group int64 `json:"group" gorm:"column:ddw_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` DepartmentId int64 `json:"parentid" gorm:"column:ddw_derpatment;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go new file mode 100644 index 0000000..f7b7604 --- /dev/null +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -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:附件"` +} diff --git a/gin_server_admin/model/systemuser/systemrole.go b/gin_server_admin/model/systemuser/systemrole.go index 465a426..ecf2d02 100644 --- a/gin_server_admin/model/systemuser/systemrole.go +++ b/gin_server_admin/model/systemuser/systemrole.go @@ -17,3 +17,18 @@ type SystemRole struct { func (SystemRole *SystemRole) TableName() string { return "system_role" } + +//角色组(审批流程使用) +type RoleGroup struct { + Id int64 `json:"id" gorm:"primaryKey;column:srg_id;type:bigint(20) unsigned;not null;comment:Id;index"` + Title string `json:"title" gorm:"column:srg_name;type:text;comment:角色名称"` + Group int64 `json:"group" gorm:"column:srg_group;type:bigint(20) unsigned;default:0;not null;comment:角色归属"` + Addtime int64 `json:"addtime" gorm:"column:srg_time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` + State int `json:"state" gorm:"column:srg_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Contentes string `json:"content" gorm:"column:srg_extatry;type:mediumtext;comment:操作组"` + Type int `json:"type" gorm:"column:srg_type;type:int(1) unsigned;default:1;not null;comment:操作类型(1:部门矩阵;2:个人)"` +} + +func (RoleGroup *RoleGroup) TableName() string { + return "step_role_group" +} diff --git a/gin_server_admin/model/wechat/grouptree.go b/gin_server_admin/model/wechat/grouptree.go index 6f93d0f..a33afeb 100644 --- a/gin_server_admin/model/wechat/grouptree.go +++ b/gin_server_admin/model/wechat/grouptree.go @@ -81,3 +81,5 @@ func (SignOutWechatUsers *SignOutWechatUsers) TableName() string { return "signout_wechatusers" // return "wechatusers" } + +// diff --git a/gin_server_admin/router/assessment/assessmentrouter.go b/gin_server_admin/router/assessment/assessmentrouter.go index c95214e..3c4ac48 100644 --- a/gin_server_admin/router/assessment/assessmentrouter.go +++ b/gin_server_admin/router/assessment/assessmentrouter.go @@ -166,3 +166,21 @@ func (s *AssessmentRouter) InitEvaluationSchemeRouter(Router *gin.RouterGroup) { } } + +//用户端数据考核 +func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { + dutyIndexCodeRouter := Router.Group("eval") + var authorityIndexApi = v2.ApiGroupApp.EvaluationApi.EvaluationApi + { + dutyIndexCodeRouter.POST("/", authorityIndexApi.Index) // 入口 + dutyIndexCodeRouter.POST("", authorityIndexApi.Index) // 入口 + dutyIndexCodeRouter.GET("/", authorityIndexApi.Index) // 入口 + dutyIndexCodeRouter.GET("", authorityIndexApi.Index) // 入口 + + dutyIndexCodeRouter.POST("qualevalulist", authorityIndexApi.QualitativeEvaluation) // 定性考核列表 + dutyIndexCodeRouter.POST("additionandsubtractionscore", authorityIndexApi.AdditionAndSubtractionScore) // 加减分 + dutyIndexCodeRouter.POST("adddivisionresponsibility", authorityIndexApi.AddDivisionResponsibility) // 划分责任人 + dutyIndexCodeRouter.POST("addcorrectivemeasures", authorityIndexApi.AddCorrectiveMeasures) //添加整改措施 + + } +} diff --git a/gin_server_admin/router/shiyan/sys_shiyan.go b/gin_server_admin/router/shiyan/sys_shiyan.go index f8bf25e..967e841 100644 --- a/gin_server_admin/router/shiyan/sys_shiyan.go +++ b/gin_server_admin/router/shiyan/sys_shiyan.go @@ -26,5 +26,7 @@ func (s *ShiyanRouter) InitShiyanRouter(Router *gin.RouterGroup) { shiyanCodeRouter.POST("/geteatiltemplate", authorityApi.GetEatilTemplate) shiyanCodeRouter.POST("/getrequestoperation", authorityApi.GetRequestOperation) + + shiyanCodeRouter.POST("/datetime", authorityApi.DateTime) //测试时间 } } diff --git a/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220224165425.jpg b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220224165425.jpg new file mode 100644 index 0000000..5f2f14b Binary files /dev/null and b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220224165425.jpg differ diff --git a/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225085634.jpg b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225085634.jpg new file mode 100644 index 0000000..5f2f14b Binary files /dev/null and b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225085634.jpg differ diff --git a/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225110716.jpg b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225110716.jpg new file mode 100644 index 0000000..5f2f14b Binary files /dev/null and b/gin_server_admin/uploads/file/004bac1e7ca1b48ca640bbd5232e4a81_20220225110716.jpg differ diff --git a/gin_server_admin/uploads/file/e86bdd5d8908079d1ed4c06015f37eb0_20220225085659.jpg b/gin_server_admin/uploads/file/e86bdd5d8908079d1ed4c06015f37eb0_20220225085659.jpg new file mode 100644 index 0000000..240877b Binary files /dev/null and b/gin_server_admin/uploads/file/e86bdd5d8908079d1ed4c06015f37eb0_20220225085659.jpg differ diff --git a/gin_server_admin/其他支持文件/项目推进计划.ini b/gin_server_admin/其他支持文件/项目推进计划.ini new file mode 100644 index 0000000..b1cca95 --- /dev/null +++ b/gin_server_admin/其他支持文件/项目推进计划.ini @@ -0,0 +1,8 @@ +项目推进计划 +25日 前端 完成加分与加分页面搭建 对接好接口(加减分接口已出,根据实际情况进行微调) + 后端 完成审批接口与整改接口的开发,审批详细接口完成50%左右 +26日 前端 对接整改接口页面。处理文件上传问题。根据定量接口进度对接定量提报页面开发 + 后端 跑通审批流,开发定量考核接口开发 +27日 完成收尾,根据实际完成情况进行初步测试 + +28日 项目上线运行 \ No newline at end of file