diff --git a/gin_server_admin/api/admin/dutyassess/planversio.go b/gin_server_admin/api/admin/dutyassess/planversio.go index 030fe40..93bbdfc 100644 --- a/gin_server_admin/api/admin/dutyassess/planversio.go +++ b/gin_server_admin/api/admin/dutyassess/planversio.go @@ -72,7 +72,8 @@ func (d *DutyAssessApi) DepartDutyPlanVersion(c *gin.Context) { // response.Result(104, requestData, "没有查询到数据", c) // return var planVersio []DutyPlanVersioOut - dataErr := gormDb.Order("`group` ASC").Order("`department` ASC").Order("`state` ASC").Order("`addtime` ASC").Find(&planVersio).Error + // dataErr := gormDb.Order("`group` ASC").Order("`department` ASC").Order("`state` ASC").Order("`addtime` ASC").Find(&planVersio).Error + dataErr := gormDb.Order("`group` ASC").Order("`department` ASC").Order("`addtime` DESC").Find(&planVersio).Error if dataErr != nil { response.Result(104, dataErr, "没有查询到数据", c) return @@ -558,7 +559,7 @@ func (d *DutyAssessApi) OnOffDepartDutyVersio(c *gin.Context) { } //判断是否可以执行该操作 if judgeOnOffVersio(ContInfo, requestData.IsTrue) == true { - response.Result(103, ContInfo, "要禁用的方案还有未走完的审批流程!请不要进行此操作!", c) + response.Result(1003, ContInfo, "要禁用的方案还有未走完的审批流程!请不要进行此操作!", c) return } //获取 @@ -568,7 +569,7 @@ func (d *DutyAssessApi) OnOffDepartDutyVersio(c *gin.Context) { eiteOtherData["state"] = 2 eiteOtherData["eitetime"] = time.Now().Unix() // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ? AND `yeares` = ?", ContInfo.Group, ContInfo.Department, ContInfo.Year).Updates(eiteOtherData) - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ?", ContInfo.Group, ContInfo.Department).Updates(eiteOtherData) + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ? AND `state` <> 3 AND `key` <> ?", ContInfo.Group, ContInfo.Department, requestData.Key).Updates(eiteOtherData) } eiteData := commonus.MapOut() @@ -581,6 +582,24 @@ func (d *DutyAssessApi) OnOffDepartDutyVersio(c *gin.Context) { eiteQuerData["qe_eitetime"] = time.Now().Unix() global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_qual_eval_id` = ?", requestData.Key).Updates(eiteQuerData) + var planKey []assessmentmodel.PlanVersio + plankeErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`group` = ? AND `department` = ? AND `state` <> 3 AND `key` <> ?", ContInfo.Group, ContInfo.Department, requestData.Key).Find(&planKey).Error + if plankeErr == nil { + var keyPlanStr []string + for _, plv := range planKey { + keyPlanStr = append(keyPlanStr, plv.Key) + } + if requestData.State == 1 { + if len(keyPlanStr) > 0 { + eiteQuerDataAll := commonus.MapOut() + eiteQuerDataAll["qe_state"] = 2 + eiteQuerDataAll["qe_eitetime"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_qual_eval_id` IN ?", keyPlanStr).Updates(eiteQuerDataAll) + } + + } + } + if errOne != nil { response.Result(102, errOne, "修改失败", c) return @@ -718,8 +737,10 @@ func (d *DutyAssessApi) EiteDepartExplain(c *gin.Context) { eiteData := commonus.MapOut() eiteData["qe_eitetime"] = time.Now().Unix() eiteData["qe_content"] = requestData.Content - if requestData.State == 2 { + if requestData.State > 0 { eiteData["qe_state"] = requestData.State + } else { + eiteData["qe_state"] = 2 } if len(requestData.Operator) > 0 { eiteData["qe_operator"] = strings.Join(requestData.Operator, ",") @@ -767,7 +788,7 @@ func eitePlanVersion(key string, tarId string, state int, contStr string) { chidCont.State = state // `json:"state"` chidCont.Score = cv.Score // `json:"score"` //分数 chidCont.QualEvalId = cv.QualEvalId // `json:"qeid"` - chidCont.Status = cv.Status // `json:"status"` + chidCont.Status = state // `json:"status"` } else { chidCont.Id = cv.Id chidCont.Name = cv.Name // `json:"name"` diff --git a/gin_server_admin/api/index/evaluation/assessment.go b/gin_server_admin/api/index/evaluation/assessment.go index 282da22..aae6f99 100644 --- a/gin_server_admin/api/index/evaluation/assessment.go +++ b/gin_server_admin/api/index/evaluation/assessment.go @@ -91,7 +91,7 @@ func (e *EvaluationInterface) NewGetQualDetailedTarget(c *gin.Context) { return } var qualEvaList []NewQualDetailOutList - gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id,qe_group,qe_accept_evaluation,qe_dimension,qe_target,et_title,qe_detailed_target,dt_title,qe_target_sun").Joins("left join evaluationtarget on evaluationtarget.et_id = qualitative_evaluation.qe_target").Joins("left join detailed_target on detailed_target.dt_id = qualitative_evaluation.qe_detailed_target").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id,qe_group,qe_accept_evaluation,qe_dimension,qe_target,et_title,qe_detailed_target,dt_title,qe_target_sun,qe_qual_eval_id").Joins("left join evaluationtarget on evaluationtarget.et_id = qualitative_evaluation.qe_target").Joins("left join detailed_target on detailed_target.dt_id = qualitative_evaluation.qe_detailed_target").Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) gormDb = gormDb.Where("`qe_group` = ?", requestData.Group).Where("`qe_accept_evaluation` = ?", requestData.Department).Where("`qe_target` = ?", requestData.Target) if requestData.Title != "" { gormDb = gormDb.Where("`dt_title` LIKE ?", "%"+requestData.Title+"%") @@ -109,6 +109,8 @@ func (e *EvaluationInterface) NewGetQualDetailedTarget(c *gin.Context) { outCont.Id = v.Id outCont.Group = v.Group + outCont.PlanVersionNumber = v.PlanVersionNumber + where := commonus.MapOut() where["id"] = v.Group orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") @@ -177,3 +179,44 @@ func AllZreoConfig(cycles int) (monthInt int64) { } return } + +//获取定量考核任务列表===>筛出已经提交的数据 +func (e *EvaluationInterface) QualitativeEvalRationNew(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData GetRationFlowLog + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(102, err, "数据获取失败!", c) + return + } + //获取当月的起止时间 + startMonth, endMonth := commonus.GetAppointMonthStarAndEndTimeInt(time.Now().Unix()) + + //获取当月内所有的审批流程的部门及指标ID + // var qualEvalFlowLogList QualEvalFlowLog + var evalId []int64 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_evaluation_id").Where("fl_time BETWEEN ? AND ?", startMonth, endMonth).Find(&evalId) + + var qualEvaList []assessmentmodel.QualitativeEvaluation + gormDbIng := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qualitative_evaluation.*") + gormDbIng = gormDbIng.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) + gormDbIng = gormDbIng.Not(map[string]interface{}{"qe_id": evalId}) + if requestData.GroupId != "" { + gormDbIng = gormDbIng.Where("qe_group = ?", requestData.GroupId) + } + if requestData.DepartmentID != "" { + gormDbIng = gormDbIng.Where("qe_accept_evaluation = ?", requestData.DepartmentID) + } + if requestData.TargetId != "" { + gormDbIng = gormDbIng.Where("qe_target = ?", requestData.TargetId) + } + listErr := gormDbIng.Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error + if listErr != nil || len(qualEvaList) < 1 { + response.Result(102, qualEvaList, "您没有要参加的考核项目!", c) + return + } +} diff --git a/gin_server_admin/api/index/evaluation/enter.go b/gin_server_admin/api/index/evaluation/enter.go index 8837fb3..22ba6f8 100644 --- a/gin_server_admin/api/index/evaluation/enter.go +++ b/gin_server_admin/api/index/evaluation/enter.go @@ -1,6 +1,94 @@ package evaluation +import ( + "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" +) + //数据评估 type ApiGroup struct { EvaluationApi EvaluationInterface } + +//获取定量考核目标 +/* +@targetScore 指标分值 +@resultval 结算值 +@group 集团 +@depart 部门 +@dimen 维度 +@target 指标 +@deaTarget 细则 +@year 年份 +@timecopy 辅助计数 + +返回说明 +@scoreVal 计算得分 +@allPrize 全奖值 +@zeroPrize 零奖值 +@CappingVal 封顶值 +@achievement 达成率 +*/ +func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { + scoreVal = 0 + allPrize = 0 + zeroPrize = 0 + CappingVal = 0 + achievement = 0 + var qualConfig assessmentmodel.QuantitativeConfig + gormDb := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ?", group, depart, dimen, target, year) + if deaTarget != "0" { + gormDb = gormDb.Where("targetconfig = ?", deaTarget) + } + // if timecopy != 0 { + // gormDb = gormDb.Where("timecopy = ?", timecopy) + // } + gormDb = gormDb.Where("timecopy = ?", timecopy) + err := gormDb.First(&qualConfig).Error + + // fmt.Printf("达成率--0-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement, err) + if err != nil { + return + } + allPrize = qualConfig.Allprize / 100 + zeroPrize = qualConfig.Zeroprize / 100 + CappingVal = qualConfig.CappingVal / 100 + + chuShu := resultval - float64(qualConfig.Zeroprize) + beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) + if beiChuShu > 0 { + achievement = commonus.Decimal(chuShu / beiChuShu) + scoreVal = achievement * (resultval / 100) + achievement = commonus.Decimal(achievement * 100) + + if achievement >= CappingVal { + scoreVal = CappingVal * float64(targetScore) / 100 + } + } else { + scoreVal = float64(targetScore) + } + + // if qualConfig.CappingVal != 0 && resultval >= qualConfig.CappingVal { + // scoreVal = float64(targetScore) + // achievement = 100 + // // fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + // } else { + // chuShu := resultval - float64(qualConfig.Zeroprize) + // beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) + // if beiChuShu > 0 { + // achievement = commonus.Decimal(chuShu / beiChuShu) + // scoreVal = achievement * (resultval / 100) + + // if scoreVal >= CappingVal { + // scoreVal = CappingVal * float64(targetScore) + // } + // fmt.Printf("达成率--2-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement, resultval) + // } else { + // scoreVal = float64(targetScore) + // // fmt.Printf("达成率--3-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + // } + // } + // fmt.Printf("达成率--4-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + return +} diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 86034ec..28ef3e9 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -739,6 +739,14 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { return } + //获取当月的起止时间 + startMonth, endMonth := commonus.GetAppointMonthStarAndEndTimeInt(time.Now().Unix()) + + //获取当月内所有的审批流程的部门及指标ID + // var qualEvalFlowLogList QualEvalFlowLog + var evalId []int64 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_evaluation_id").Where("fl_time BETWEEN ? AND ?", startMonth, endMonth).Find(&evalId) + // 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 @@ -750,12 +758,18 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { var qualEvaList []assessmentmodel.QualitativeEvaluation gormDbIng := global.GVA_DB_Performanceappraisal gormDbIng = gormDbIng.Where("`qe_type` = 2 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key) + if len(evalId) > 0 { + gormDbIng = gormDbIng.Not(map[string]interface{}{"qe_id": evalId}) + } if requestData.GroupId != "" { gormDbIng = gormDbIng.Where("qe_group = ?", requestData.GroupId) } if requestData.DepartmentID != "" { gormDbIng = gormDbIng.Where("qe_accept_evaluation = ?", requestData.DepartmentID) } + if requestData.TargetId != "" { + gormDbIng = gormDbIng.Where("qe_target = ?", requestData.TargetId) + } listErr := gormDbIng.Order("qe_type ASC,qe_group ASC,qe_accept_evaluation ASC,qe_dimension ASC,qe_target ASC,qe_target_sun ASC,qe_detailed_target ASC").Find(&qualEvaList).Error if listErr != nil || len(qualEvaList) < 1 { response.Result(102, qualEvaList, "您没有要参加的考核项目!", c) @@ -763,7 +777,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { } var uotContAry []TargetContOutCont for _, v := range qualEvaList { - kickOut := 1 //踢出设置 + // kickOut := 1 //踢出设置 var uotCont TargetContOutCont uotCont.Id = strconv.FormatInt(v.Id, 10) uotCont.Type = v.Type @@ -779,6 +793,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { orgContDepart, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") uotCont.DepartmentName = orgContDepart.Name + uotCont.PlanVersionNumber = v.QualEvalId // groupErr, groupCont := commonus.GetGroupCont(v.Group) // if groupErr == true { // uotCont.GroupNAme = groupCont.Name @@ -849,7 +864,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { uotCont.ZeroPrize = strconv.FormatFloat(float64(quanTitCont.Zeroprize)/100, 'f', -1, 64) uotCont.AllPrize = strconv.FormatFloat(float64(quanTitCont.Allprize)/100, 'f', -1, 64) - + uotCont.CappingVal = quanTitCont.CappingVal / 100 //获取实际值 shiJiZhi := commonus.MapOut() shiJiZhi["fl_evaluation_user"] = userCont.Key @@ -903,10 +918,10 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { uotCont.ReachScore = 0 } - judgeActualValue := commonus.GetTimeIntervalDutyJudge(shiJiZhi, v.Id) //判断当前条件下时候又审批中和审批通过的 - if judgeActualValue > 0 { - kickOut = 2 - } + // judgeActualValue := commonus.GetTimeIntervalDutyJudge(shiJiZhi, v.Id) //判断当前条件下时候又审批中和审批通过的 + // if judgeActualValue > 0 { + // kickOut = 2 + // } //计算达成率 if quanTitCont.Zeroprize == 0 && quanTitCont.Allprize == 0 { uotCont.Reach = "未设置目标值" @@ -916,7 +931,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { if dividend == 0 { uotCont.Reach = "未设置目标值" } else { - uotCont.Reach = fmt.Sprintf("((实际值-零奖值)/(全奖值-零奖值))*指标权重\n((S-Z)/(A-Z))*W") + uotCont.Reach = fmt.Sprintf("((实际值-零奖值)/(全奖值-零奖值))*指标权重") // reachValue := ((divisor / 100) / (float64(dividend) / 100)) * 100 // if reachValue < 0 { // uotCont.Reach = "0%" @@ -929,10 +944,10 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { } uotCont.Reason = "" uotCont.DetailedTarget = strconv.FormatInt(v.DetailedTarget, 10) - if kickOut == 1 { - uotContAry = append(uotContAry, uotCont) - } - // uotContAry = append(uotContAry, uotCont) + // if kickOut == 1 { + // uotContAry = append(uotContAry, uotCont) + // } + uotContAry = append(uotContAry, uotCont) } response.Result(0, uotContAry, "用户端个人要执行的考核任务", c) } @@ -960,6 +975,13 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { return } + todaying := commonus.ComputingTime(time.Now().Unix(), 5) + + if todaying > 10 { + // response.Result(1051, todaying, "不在可提交数据提时间期限内!不可提交数据。请每月10号前提交数据!。", c) + // return + } + var requestData AddRationFlowLog err := c.ShouldBindJSON(&requestData) if err != nil { @@ -979,6 +1001,10 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { return } + //判断是否已经添加的条件 + existenceProess := commonus.MapOut() + existenceProess["fl_planversion"] = requestData.PlanVersionNumber + operationTime := time.Now().Unix() keyNumber := commonus.GetFileNumberEs() var flowLog assessmentmodel.FlowLog @@ -986,6 +1012,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { flowLog.Key = keyNumber flowLog.Time = time.Now().Unix() flowLog.EiteTime = time.Now().Unix() + flowLog.PlanVersion = requestData.PlanVersionNumber if requestData.Addtime != "" { timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间 flowLog.Year = commonus.ComputingTime(timeOccurrence, 1) @@ -993,6 +1020,13 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { flowLog.Month = commonus.ComputingTime(timeOccurrence, 3) flowLog.Week = commonus.ComputingTime(timeOccurrence, 4) flowLog.ToDay = commonus.ComputingTime(timeOccurrence, 5) + + existenceProess["fl_year"] = commonus.ComputingTime(timeOccurrence, 1) + existenceProess["fl_quarter"] = commonus.ComputingTime(timeOccurrence, 2) + existenceProess["fl_month"] = commonus.ComputingTime(timeOccurrence, 3) + existenceProess["fl_week"] = commonus.ComputingTime(timeOccurrence, 4) + existenceProess["fl_day"] = commonus.ComputingTime(timeOccurrence, 5) + } else { lastMonth, _, _ := commonus.GetLastMonth() @@ -1005,74 +1039,147 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { flowLog.Month = commonus.ComputingTime(operationTime, 3) flowLog.Week = commonus.ComputingTime(operationTime, 4) flowLog.ToDay = commonus.ComputingTime(operationTime, 5) + + existenceProess["fl_year"] = commonus.ComputingTime(operationTime, 1) + existenceProess["fl_quarter"] = commonus.ComputingTime(operationTime, 2) + existenceProess["fl_month"] = commonus.ComputingTime(operationTime, 3) + existenceProess["fl_week"] = commonus.ComputingTime(operationTime, 4) + existenceProess["fl_day"] = commonus.ComputingTime(operationTime, 5) } flowLog.EvaluationDepartment = departmentId flowLog.EvaluationUser = userKey flowLog.EvaluationGroup = userGroup + // existenceProess["fl_evaluation_department"] = departmentId + // existenceProess["fl_evaluation_user"] = userKey + // existenceProess["fl_evaluation_group"] = userGroup + dutyGroup, dutyGroupErr := strconv.ParseInt(requestData.GroupId, 10, 64) if dutyGroupErr == nil { flowLog.DutyGroup = dutyGroup + existenceProess["fl_duty_group"] = dutyGroup } departIdInt, departIdIntErr := strconv.ParseInt(requestData.DepartmentID, 10, 64) if departIdIntErr == nil { flowLog.DutyDepartment = departIdInt + existenceProess["fl_duty_department"] = departIdInt } flowLog.Reply = 1 + var evaluationIdStr string + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_evaluation_id").Where(existenceProess).First(&evaluationIdStr) + var evaluationIdStrAry []string + if evaluationIdStr != "" { + evaluationIdStrAry = strings.Split(evaluationIdStr, ",") + } + var flowDataLogAry []assessmentmodel.FlowLogData var reason string var evaluationPlan []string //方案ID + var yiTianJianMingc []string // jsonMapStr, _ := json.Marshal(requestData.List) json.Marshal(requestData.List) //fmt.Printf("OutJsonMap-----1------>%\n", string(jsonMapStr)) for i, v := range requestData.List { - var flowDataLog assessmentmodel.FlowLogData - evaluationPlan = append(evaluationPlan, v.Id) - evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) - if evaluationPlanidErr == nil { - flowDataLog.EvaluationPlan = evaluationPlanid - } - flowDataLog.Key = keyNumber - flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) - flowDataLog.Content = v.Reason - flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") - if v.ScoringMethod == 2 { - flowDataLog.ScoringMethod = 2 - flowDataLog.ScoringScore = v.ScoringScore - } else { - flowDataLog.ScoringMethod = 1 - flowDataLog.ScoringScore = 0 - } - flowDataLog.Time = time.Now().Unix() - targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) - tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) - if i == 0 { - if targetInfoErr == true { - if v.Reason != "" { - reason = fmt.Sprintf("%v :%v%v\n备注:%v", tarInfo.Title, v.Actual, v.Unit, v.Reason) + + if len(evaluationIdStrAry) > 0 { + if commonus.IsItTrueString(v.Id, evaluationIdStrAry) == false { + var flowDataLog assessmentmodel.FlowLogData + evaluationPlan = append(evaluationPlan, v.Id) + evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) + if evaluationPlanidErr == nil { + flowDataLog.EvaluationPlan = evaluationPlanid + } + flowDataLog.Key = keyNumber + flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) + flowDataLog.Content = v.Reason + flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + if v.ScoringMethod == 2 { + flowDataLog.ScoringMethod = 2 + flowDataLog.ScoringScore = v.ScoringScore } else { - reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Actual, v.Unit) + flowDataLog.ScoringMethod = 1 + flowDataLog.ScoringScore = 0 } + // flowDataLog.PlanVersion = v.PlanVersionNumber + flowDataLog.Time = time.Now().Unix() + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if i == 0 { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v :%v%v\n备注:%v", tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Actual, v.Unit) + } + } + } else { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v\n%v :%v%v\n备注:%v", reason, tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Actual, v.Unit) + } + + } + } + flowDataLogAry = append(flowDataLogAry, flowDataLog) + } else { + yiTianJianMingc = append(yiTianJianMingc, v.TargetName) } } else { - if targetInfoErr == true { - if v.Reason != "" { - reason = fmt.Sprintf("%v\n%v :%v%v\n备注:%v", reason, tarInfo.Title, v.Actual, v.Unit, v.Reason) - } else { - reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Actual, v.Unit) + var flowDataLog assessmentmodel.FlowLogData + evaluationPlan = append(evaluationPlan, v.Id) + evaluationPlanid, evaluationPlanidErr := strconv.ParseInt(v.Id, 10, 64) + if evaluationPlanidErr == nil { + flowDataLog.EvaluationPlan = evaluationPlanid + } + flowDataLog.Key = keyNumber + flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) + flowDataLog.Content = v.Reason + flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + if v.ScoringMethod == 2 { + flowDataLog.ScoringMethod = 2 + flowDataLog.ScoringScore = v.ScoringScore + } else { + flowDataLog.ScoringMethod = 1 + flowDataLog.ScoringScore = 0 + } + flowDataLog.PlanVersion = requestData.PlanVersionNumber + flowDataLog.Time = time.Now().Unix() + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + if i == 0 { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v :%v%v\n备注:%v", tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v :%v%v", tarInfo.Title, v.Actual, v.Unit) + } + } + } else { + if targetInfoErr == true { + if v.Reason != "" { + reason = fmt.Sprintf("%v\n%v :%v%v\n备注:%v", reason, tarInfo.Title, v.Actual, v.Unit, v.Reason) + } else { + reason = fmt.Sprintf("%v\n%v :%v%v", reason, tarInfo.Title, v.Actual, v.Unit) + } + } } + flowDataLogAry = append(flowDataLogAry, flowDataLog) } - flowDataLogAry = append(flowDataLogAry, flowDataLog) } gromDb := global.GVA_DB_Performanceappraisal.Begin() flowLog.EvaluationPlan = strings.Join(evaluationPlan, ",") - + if len(flowDataLogAry) <= 0 { + response.Result(0, yiTianJianMingc, "您的数据已经提交!请不要重复提交!", c) + return + } addFlowLogErr := gromDb.Create(&flowLog).Error addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error @@ -1093,7 +1200,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { } // UpEvaluationProcessApproval(keyNumber, 16182159043990656, keyNumber, 1, userCont.Key) - commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) + commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 1, 1, userCont.Key) mainTitle := fmt.Sprintf("%v数据表", commonus.TimeStampToDate(operationTime, 10)) mainTitleDesc := "" @@ -1120,23 +1227,28 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { //fmt.Printf("1、更新发送信息返回:%v-----------%v----------->%v-----%v\n", string(callbakcMsg), isTrueCall, callBackCont, sendText) - response.Result(0, affairDbErr, "数据写入成功!", c) + response.Result(0, yiTianJianMingc, "数据提交成功!", c) } else { gromDb.Rollback() - response.Result(118, affairDbErr, "数据写入失败!", c) + response.Result(118, yiTianJianMingc, "数据提交失败!", c) } } else { affairDbErr := gromDb.Rollback().Error if affairDbErr == nil { - response.Result(119, affairDbErr, "数据写入失败!", c) + response.Result(119, yiTianJianMingc, "数据提交失败!", c) } else { - response.Result(120, affairDbErr, "数据写入失败!", c) + response.Result(120, yiTianJianMingc, "数据提交失败!", c) } } } //查看定性考核审批列表 func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } var requestData commonus.SetIds err := c.ShouldBindJSON(&requestData) if err != nil { @@ -1320,6 +1432,14 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { gerEvalErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", requestData.Id).Find(&evalProInfo).Error //fmt.Printf("9-----------1--------->%v\n", gerEvalErr) if gerEvalErr == nil { + fmt.Printf("evalProInfo.NextExecutor------->%v\n", evalProInfo.NextExecutor) + dutyCecorFlowInfo.IsSet = 2 + isSetUser := strings.Split(evalProInfo.NextExecutor, ",") + if len(isSetUser) > 0 { + if commonus.IsItTrueString(userCont.Key, isSetUser) == true { + dutyCecorFlowInfo.IsSet = 1 + } + } var flowStepAryMaps []FlowStep jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps) //fmt.Printf("9-----------2--------->%v\n", flowStepAryMaps) @@ -1334,10 +1454,11 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { //fmt.Printf("9-----------4-----2---->%v\n", fw_v) if workUserErr == true { //fmt.Printf("9-----------4-----1---->%v\n", workUserErr) - bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId) + // bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId) + bf, bfErr := commonus.GetNewOrgCont(workUser.DepartmentId) //fmt.Printf("9-----------4-----3---->%v\n", bfErr) - if bfErr == true { - getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId)) + if bfErr == nil { + getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatOrganizationId)) //fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo) if getGroupRoleInfoErr == true { flowLog.GroupName = roleGroupInfo.Title @@ -1395,6 +1516,11 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { //查看定量考核列表 func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } var requestData commonus.SetIds err := c.ShouldBindJSON(&requestData) if err != nil { @@ -1417,18 +1543,65 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { response.Result(103, err, "参数错误!请重新提交!", c) return } + var flowLogInfo assessmentmodel.FlowLog + getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error + var planVersioCont assessmentmodel.PlanVersio + global.GVA_DB_Performanceappraisal.Where("`key` = ?", flowLogInfo.PlanVersion).First(&planVersioCont) + + var planVersioInfo []AddDutyNewCont + if planVersioCont.Content != "" { + json.Unmarshal([]byte(planVersioCont.Content), &planVersioInfo) + // jsonErr := json.Unmarshal([]byte(planVersioCont.Content), &planVersioInfo) + // if jsonErr == nil { + // for _, v := range planVersioInfo { + // for _, cv := range v.Child { + // if cv.Id == strconv.FormatInt(planVersioCont.Id, 10) { + // targetScore = cv.ReferenceScore + // } + // } + // } + // } + } + // var flowLogInfo var outList []RationOutStruct for _, v := range flowDataLog { + var targetScore int64 = 0 var outContt RationOutStruct outContt.Id = strconv.FormatInt(v.Id, 10) outContt.FlowId = strconv.FormatInt(v.Key, 10) targetCont, targetContErr := commonus.LookRationInfo(v.EvaluationPlan) + if targetContErr == true { outContt.Title = targetCont.Title outContt.Unit = targetCont.Unit outContt.Cycles = targetCont.Cycles outContt.CycleAttres = targetCont.CycleAttres + var monthQues int64 = 1 + switch targetCont.Cycles { + case 5: + monthQues = flowLogInfo.Quarter + case 6: + monthQues = 1 + default: + monthQues = flowLogInfo.Month + } + if len(planVersioInfo) > 0 { + for _, pviv := range planVersioInfo { + for _, pvivcv := range pviv.Child { + if pvivcv.Id == strconv.FormatInt(targetCont.Target, 10) { + targetScore = pvivcv.ReferenceScore + } + } + } + } + outContt.Weight = float64(targetScore) + //获取指标 + var tarGetId int64 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_target").Where("`qe_id` = ?", v.EvaluationPlan).First(&tarGetId) + // outContt.Actual, outContt.AllPrize, outContt.ZeroPrize, outContt.CappingVal, outContt.Achievement = GetQuantitativeConfig(targetScore, float64(v.Score), strconv.FormatInt(flowLogInfo.DutyGroup, 10), strconv.FormatInt(flowLogInfo.DutyDepartment, 10), strconv.FormatInt(targetCont.Dimension, 10), strconv.FormatInt(tarGetId, 10), strconv.FormatInt(targetCont.DetailedTarget, 10), flowLogInfo.Year, monthQues) + // targetScore = v.Score + outContt.Actual, outContt.AllPrize, outContt.ZeroPrize, outContt.CappingVal, outContt.Achievement = GetQuantitativeConfig(targetScore, float64(v.Score), strconv.FormatInt(flowLogInfo.DutyGroup, 10), strconv.FormatInt(flowLogInfo.DutyDepartment, 10), strconv.FormatInt(targetCont.Dimension, 10), strconv.FormatInt(tarGetId, 10), strconv.FormatInt(targetCont.DetailedTarget, 10), flowLogInfo.Year, monthQues) } outContt.Score = float64(v.Score) / 100 outContt.Content = v.Content @@ -1444,6 +1617,9 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { var evalProInfo assessmentmodel.EvaluationProcess gerEvalErr := global.GVA_DB_Performanceappraisal.Where("`ep_order_key` = ?", requestData.Id).Find(&evalProInfo).Error //fmt.Printf("9-----------1--------->%v\n", gerEvalErr) + + var isShenPi int = 2 + if gerEvalErr == nil { var flowStepAryMaps []FlowStep jsonFlowErr := json.Unmarshal([]byte(evalProInfo.Content), &flowStepAryMaps) @@ -1459,10 +1635,11 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { // //fmt.Printf("9-----------4-----2---->%v\n", fw_v) if workUserErr == true { // //fmt.Printf("9-----------4-----1---->%v\n", workUserErr) - bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId) + // bfErr, bf := commonus.GetBranchFactory(workUser.DepartmentId) + bf, bfErr := commonus.GetNewOrgCont(workUser.DepartmentId) // //fmt.Printf("9-----------4-----3---->%v\n", bfErr) - if bfErr == true { - getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatId)) + if bfErr == nil { + getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo := commonus.GetOfficeWork(fw_v.RoleGroup, int64(bf.WechatOrganizationId)) // //fmt.Printf("9-----------4-----5---->%v---->%v---->%v\n", getGroupRoleInfoErr, getGroupRoleInfo, roleGroupInfo) if getGroupRoleInfoErr == true { flowLog.GroupName = roleGroupInfo.Title @@ -1512,6 +1689,13 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { if jsonFlowErr == nil { } } + fmt.Printf("evalProInfo.NextExecutor-------------->%v\n", evalProInfo.NextExecutor) + if evalProInfo.NextExecutor != "" { + zhiXingRenAry := strings.Split(evalProInfo.NextExecutor, ",") + if commonus.IsItTrueString(userCont.Key, zhiXingRenAry) == true { + isShenPi = 1 + } + } } outListMap := commonus.MapOut() @@ -1519,20 +1703,22 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { outListMap["flowLog"] = flowLogList outListMap["flowall"] = flowAllMapList outListMap["title"] = "" - var flowLogInfo assessmentmodel.FlowLog - getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error + outListMap["isset"] = isShenPi if getErrs == nil { - titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) - titleStr := fmt.Sprintf("%v提交的%v年%v月%v日定量考核数据上报", titlekUserInfo.Name, flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) - gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup) - if gErr == true { + titlekUserInfo, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": flowLogInfo.EvaluationUser}, "`name`") + // titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) + titleStr := fmt.Sprintf("%v提交的%v年%v月定量考核数据", titlekUserInfo.Name, flowLogInfo.Year, flowLogInfo.Month) + // gErr, groupInfo := commonus.GetGroupCont(flowLogInfo.DutyGroup) + groupInfo, gErr := commonus.GetNewOrgCont(flowLogInfo.DutyGroup) + if gErr == nil { outListMap["groupname"] = groupInfo.Name } else { outListMap["groupname"] = "" } - dErr, BranchInfo := commonus.GetBranchFactory(flowLogInfo.DutyDepartment) - if dErr == true { + // dErr, BranchInfo := commonus.GetBranchFactory(flowLogInfo.DutyDepartment) + BranchInfo, dErr := commonus.GetNewOrgCont(flowLogInfo.DutyDepartment) + if dErr == nil { outListMap["departmentname"] = BranchInfo.Name titleStr = fmt.Sprintf("%v%v", BranchInfo.Name, titleStr) } else { diff --git a/gin_server_admin/api/index/evaluation/examineflow.go b/gin_server_admin/api/index/evaluation/examineflow.go index b887304..87798a9 100644 --- a/gin_server_admin/api/index/evaluation/examineflow.go +++ b/gin_server_admin/api/index/evaluation/examineflow.go @@ -66,81 +66,85 @@ func (e *EvaluationInterface) ExamineFlow(c *gin.Context) { } } flowMap = append(flowMap, twoFlowInfo) - //3、被考核部门内勤进行责任划分 - var threeFlowInfo commonus.FlowAllMap - threeFlowInfo.Step = 3 - threeFlowInfo.NodeName = commonus.GetSetpName(3) - threeFlowInfo.State = 1 - threeFlowInfo.Class = 1 - - // threeorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") - // sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, threeorgCont.WechatOrganizationId) - sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation) - if sendUserIsTrueThree == true { - for _, v := range sendUserListThree { - threeFlowInfo.UserList = append(threeFlowInfo.UserList, GetApproveUser(v)) + + if requestData.PlusReduction != 1 { + //3、被考核部门内勤进行责任划分 + var threeFlowInfo commonus.FlowAllMap + threeFlowInfo.Step = 3 + threeFlowInfo.NodeName = commonus.GetSetpName(3) + threeFlowInfo.State = 1 + threeFlowInfo.Class = 1 + + // threeorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") + // sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, threeorgCont.WechatOrganizationId) + sendUserIsTrueThree, sendUserListThree := commonus.GetSendMsgUserAry(16118387069540343, qualEvalInfo.AcceptEvaluation) + if sendUserIsTrueThree == true { + for _, v := range sendUserListThree { + threeFlowInfo.UserList = append(threeFlowInfo.UserList, GetApproveUser(v)) + } } - } - flowMap = append(flowMap, threeFlowInfo) - //4、被考核部门负责人对责任划分确认 - var fourFlowInfo commonus.FlowAllMap - fourFlowInfo.Step = 4 - fourFlowInfo.NodeName = commonus.GetSetpName(7) - fourFlowInfo.State = 1 - fourFlowInfo.Class = 1 - - // fourorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") - // sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, fourorgCont.WechatOrganizationId) - sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) - if sendUserIsTrueFour == true { - for _, v := range sendUserListFour { - fourFlowInfo.UserList = append(fourFlowInfo.UserList, GetApproveUser(v)) + flowMap = append(flowMap, threeFlowInfo) + //4、被考核部门负责人对责任划分确认 + var fourFlowInfo commonus.FlowAllMap + fourFlowInfo.Step = 4 + fourFlowInfo.NodeName = commonus.GetSetpName(7) + fourFlowInfo.State = 1 + fourFlowInfo.Class = 1 + + // fourorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") + // sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, fourorgCont.WechatOrganizationId) + sendUserIsTrueFour, sendUserListFour := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) + if sendUserIsTrueFour == true { + for _, v := range sendUserListFour { + fourFlowInfo.UserList = append(fourFlowInfo.UserList, GetApproveUser(v)) + } } - } - flowMap = append(flowMap, fourFlowInfo) - if requestData.IsCorrection == 1 { - //5、整改人节点。由内勤指定 - var fiveFlowInfo commonus.FlowAllMap - fiveFlowInfo.Step = 5 - fiveFlowInfo.NodeName = commonus.GetSetpName(4) - fiveFlowInfo.State = 1 - fiveFlowInfo.Class = 2 - // fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile) - flowMap = append(flowMap, fiveFlowInfo) - //6、被考核部门负责人对整改措施确认 - var sixFlowInfo commonus.FlowAllMap - sixFlowInfo.Step = 6 - sixFlowInfo.NodeName = commonus.GetSetpName(7) - sixFlowInfo.State = 1 - sixFlowInfo.Class = 1 - - // sixorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") - // sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, sixorgCont.WechatOrganizationId) - sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) - if sendUserIsTrueSix == true { - for _, v := range sendUserListSix { - sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v)) + flowMap = append(flowMap, fourFlowInfo) + if requestData.IsCorrection == 1 { + //5、整改人节点。由内勤指定 + var fiveFlowInfo commonus.FlowAllMap + fiveFlowInfo.Step = 5 + fiveFlowInfo.NodeName = commonus.GetSetpName(4) + fiveFlowInfo.State = 1 + fiveFlowInfo.Class = 2 + // fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile) + flowMap = append(flowMap, fiveFlowInfo) + //6、被考核部门负责人对整改措施确认 + var sixFlowInfo commonus.FlowAllMap + sixFlowInfo.Step = 6 + sixFlowInfo.NodeName = commonus.GetSetpName(7) + sixFlowInfo.State = 1 + sixFlowInfo.Class = 1 + + // sixorgCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": qualEvalInfo.AcceptEvaluation}, "id", "wechat_organization_id") + // sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, sixorgCont.WechatOrganizationId) + sendUserIsTrueSix, sendUserListSix := commonus.GetSendMsgUserAry(16182159043990656, qualEvalInfo.AcceptEvaluation) + if sendUserIsTrueSix == true { + for _, v := range sendUserListSix { + sixFlowInfo.UserList = append(sixFlowInfo.UserList, GetApproveUser(v)) + } } + flowMap = append(flowMap, sixFlowInfo) + //7、发起人验收 + var serverFlowInfo commonus.FlowAllMap + serverFlowInfo.Step = 7 + serverFlowInfo.NodeName = commonus.GetSetpName(5) + serverFlowInfo.State = 1 + serverFlowInfo.Class = 1 + serverFlowInfo.UserList = append(serverFlowInfo.UserList, GetApproveUser(userCont.Wechat)) + flowMap = append(flowMap, serverFlowInfo) + } else { + //5、发起人验收 + // var serverEsFlowInfo commonus.FlowAllMap + // serverEsFlowInfo.Step = 5 + // serverEsFlowInfo.NodeName = commonus.GetSetpName(5) + // serverEsFlowInfo.State = 1 + // serverEsFlowInfo.Class = 1 + // serverEsFlowInfo.UserList = append(serverEsFlowInfo.UserList, GetApproveUser(userCont.Wechat)) + // flowMap = append(flowMap, serverEsFlowInfo) } - flowMap = append(flowMap, sixFlowInfo) - //7、发起人验收 - var serverFlowInfo commonus.FlowAllMap - serverFlowInfo.Step = 7 - serverFlowInfo.NodeName = commonus.GetSetpName(5) - serverFlowInfo.State = 1 - serverFlowInfo.Class = 1 - serverFlowInfo.UserList = append(serverFlowInfo.UserList, GetApproveUser(userCont.Wechat)) - flowMap = append(flowMap, serverFlowInfo) - } else { - //5、发起人验收 - var serverEsFlowInfo commonus.FlowAllMap - serverEsFlowInfo.Step = 5 - serverEsFlowInfo.NodeName = commonus.GetSetpName(5) - serverEsFlowInfo.State = 1 - serverEsFlowInfo.Class = 1 - serverEsFlowInfo.UserList = append(serverEsFlowInfo.UserList, GetApproveUser(userCont.Wechat)) - flowMap = append(flowMap, serverEsFlowInfo) } + } else { //定量 //审批结束 diff --git a/gin_server_admin/api/index/evaluation/flowsend.go b/gin_server_admin/api/index/evaluation/flowsend.go index 9058ced..6e7837a 100644 --- a/gin_server_admin/api/index/evaluation/flowsend.go +++ b/gin_server_admin/api/index/evaluation/flowsend.go @@ -105,6 +105,7 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { var addScore assessmentmodel.ScoreFlow addScore.EvaluationPlan = planIdInt //考核方案项目ID addScore.PlusReduceScore = requestData.Type //1:加分;2:减分 + addScore.PlanVersion = requestData.PlanVersionNumber //分值转化 scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100) @@ -219,8 +220,9 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { twoLevelTitle := "考核上报部门:" twoLevelKeyName := "" - execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) - if execDerpatErr == true { + // execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { twoLevelKeyName = execDerpat.Name } var twoLevelKeyValue string = "" @@ -239,27 +241,60 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { // return //暂停审核方便录入测试数据 cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", keyNumber) - if myIsTrue != 1 { - //写入当前流程步骤 - // commonus.StepAddData(keyNumber, 0, 3, 1, 1, 2, 1, userCont.Key) //原 - commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) - //申请人也是部门负责人 - //给相关部门内勤发送消息。确定相关责任人 - sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 - if sendUserIsTrue != true { - response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) - return - } - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", keyNumber) - jumpUrlTitle := "请前往处理" - sourceDesc := "责任划分" - var sendTextMsg sendmessage.TextNoticeTemplateMedium - sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + if requestData.Type != 1 { + + if myIsTrue != 1 { + //写入当前流程步骤 + // commonus.StepAddData(keyNumber, 0, 3, 1, 1, 2, 1, userCont.Key) //原 + commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + //申请人也是部门负责人 + //给相关部门内勤发送消息。确定相关责任人 + sendUserIsTrue, sendUserList := commonus.GetSendMsgUser(16118387069540343, programme.AcceptEvaluation) //获取对应部门内勤 + if sendUserIsTrue != true { + response.Result(0, sendUserList, "未指定相关部门处理人!未能向相关人员发送考核项目!请手动发起!", c) + return + } + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", keyNumber) + jumpUrlTitle := "请前往处理" + sourceDesc := "责任划分" + var sendTextMsg sendmessage.TextNoticeTemplateMedium + sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + + } else { + //写入当前流程步骤 + // commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 2, 1, userCont.Key) //原 + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + //申请人不是是部门负责人 给本部门负责人发送审批 + //获取发起人部门负责人 + departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64) + _, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, departmentIdInts) //获取对应部门负责人 + sendUserStr := strings.Join(sendUserList, "|") + //按钮 + var buttonMap []sendmessage.ButtonListtype + var buttonCont sendmessage.ButtonListtype + buttonCont.Type = 0 + buttonCont.Text = "批准" + buttonCont.Style = 1 + buttonCont.Key = fmt.Sprintf("duty_%v_1_%v", keyNumber, 0) + buttonMap = append(buttonMap, buttonCont) + buttonCont.Type = 0 + buttonCont.Text = "驳回" + buttonCont.Style = 3 + buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", keyNumber, 0) + buttonMap = append(buttonMap, buttonCont) + // response.Result(0, buttonCont, "数据写入成功", c) + // return + var sendTextMsg sendmessage.ButtonNoticeTemplateMedium + callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendButtonShare(sendUserStr, taskId, "部门负责人审批", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap) + outData := commonus.MapOut() + outData["callbakcMsg"] = string(callbakcMsg) + outData["isTrueCall"] = isTrueCall + outData["callBackCont"] = callBackCont + response.Result(0, outData, "数据写入成功", c) + } } else { - //写入当前流程步骤 - // commonus.StepAddData(keyNumber, 16182159043990656, 2, 1, 1, 2, 1, userCont.Key) //原 - commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure) //申请人不是是部门负责人 给本部门负责人发送审批 //获取发起人部门负责人 departmentIdInts, _ := strconv.ParseInt(userCont.Deparment, 10, 64) @@ -278,6 +313,8 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { buttonCont.Style = 3 buttonCont.Key = fmt.Sprintf("duty_%v_2_%v", keyNumber, 0) buttonMap = append(buttonMap, buttonCont) + // response.Result(0, buttonCont, "数据写入成功", c) + // return var sendTextMsg sendmessage.ButtonNoticeTemplateMedium callbakcMsg, isTrueCall, callBackCont := sendTextMsg.SendButtonShare(sendUserStr, taskId, "部门负责人审批", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap) outData := commonus.MapOut() @@ -324,8 +361,14 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { return } } else { - response.Result(1042, regErr, "未知考核项目!请检查你的提交是否正确!", c) - return + // response.Result(1042, regErr, "未知考核项目!请检查你的提交是否正确!", c) + // return + registerNumber, _ := strconv.ParseInt(requestData.Register, 10, 64) + var registerCont assessmentmodel.Register + registerCont.Number = registerNumber + registerCont.State = 1 + registerCont.Time = time.Now().Unix() + registerCont.AddCont() } if len(requestData.UserList) < 1 { response.Result(105, requestData, "请选择要考核的人员!", c) @@ -345,7 +388,7 @@ func (e *EvaluationInterface) PersonInCharge(c *gin.Context) { } } //写入审批流程 - commonus.StepAddData(orderId, 0, 4, 3, 1, 1, 3, userCont.Key) + commonus.StepAddData(orderId, 0, 4, 3, 1, 2, 3, userCont.Key) var scoreFlowInfo assessmentmodel.ScoreFlow judegFlowErr := global.GVA_DB_Performanceappraisal.Where("`sf_key` = ?", orderId).First(&scoreFlowInfo).Error @@ -693,7 +736,7 @@ func (e *EvaluationInterface) RectificationMeasures(c *gin.Context) { registerCont.EiteCont(regWhere, saveRegData) //写入流程步骤 // commonus.StepAddData(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key) //原 - commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 1, 5, userCont.Key, requestData.Enclosure) + commonus.StepAddDataEs(orderidval, 0, 6, 4, 1, 2, 5, userCont.Key, requestData.Enclosure) /* 向本部门负责人发送审批 */ diff --git a/gin_server_admin/api/index/evaluation/flowsendnew.go b/gin_server_admin/api/index/evaluation/flowsendnew.go new file mode 100644 index 0000000..12fc744 --- /dev/null +++ b/gin_server_admin/api/index/evaluation/flowsendnew.go @@ -0,0 +1,177 @@ +package evaluation + +import ( + "encoding/json" + "fmt" + "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" + "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" + "github.com/gin-gonic/gin" +) + +//加减分 +func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, 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 + } + countFrequency := 1 + if requestData.Count != 0 { + countFrequency = requestData.Count + } + switch requestData.State { + case 2, 3: + if requestData.Score == "" { + response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c) + return + } + tijaoFenshu := commonus.GetDuyCycle(requestData.Score, 100) + if tijaoFenshu > programme.MaxScore { + response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最大值:%v)!", float64(programme.MaxScore)/100), c) + return + } + if tijaoFenshu < programme.MinScore { + response.Result(107, requestData, fmt.Sprintf("您提交的分数操作允许提交的最大值(最小值:%v)!", float64(programme.MinScore)/100), c) + return + } + case 1: + //获取分数 + requestData.Score = strconv.FormatInt(programme.MaxScore, 10) + default: + if requestData.Score == "" { + response.Result(107, requestData, "请您输入要操作的分数,谢谢!", c) + return + } + } + if requestData.Reason == "" { + response.Result(108, requestData, "请输入您的原因,谢谢!", c) + return + } + if requestData.Addtime == "" { + response.Result(108, requestData, "请输入您的检查时间,谢谢!", c) + return + } + if requestData.Rectification == 0 { + requestData.Rectification = 2 + } + var correctionTime int64 = 0 + if requestData.Rectification == 1 { + if requestData.CorrectionTime == "" { + response.Result(108, requestData, "请输入整改期限,谢谢!", c) + return + } + var corrTimeErr bool = false + correctionTime, corrTimeErr = commonus.DateToTimeStampEs(requestData.CorrectionTime) + if corrTimeErr == false { + response.Result(108, requestData, "请输入整改期限时间格式不对,谢谢!", c) + return + } + } + operationTime := time.Now().Unix() + keyNumber := commonus.GetFileNumberEs() + var addScore assessmentmodel.ScoreFlow + addScore.EvaluationPlan = planIdInt //考核方案项目ID + addScore.PlusReduceScore = requestData.Type //1:加分;2:减分 + addScore.PlanVersion = requestData.PlanVersionNumber + //分值转化 + scoreStringToInt64 := commonus.GetDuyCycle(requestData.Score, 100) + + addScore.Score = scoreStringToInt64 //分值(乘100录入) + addScore.Key = keyNumber //识别标志 + addScore.Reason = requestData.Reason //操作原因 + addScore.Time = operationTime + addScore.EiteTime = operationTime + addScore.Count = countFrequency //发生次数 + + timeOccurrence := commonus.DateToTimeStamp(requestData.Addtime) //发生时间 + addScore.HappenTime = timeOccurrence + // addScore.HappenTime = commonus.DateToTimeStamp(requestData.Addtime) //发生时间 + departmentId, departmentIdErr := strconv.ParseInt(userCont.Deparment, 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.Company, 10, 64) + if userGroupErr == nil { + addScore.EvaluationGroup = userGroup //测评集团 + } + //获取拆分时间节 + addScore.Year = commonus.ComputingTime(timeOccurrence, 1) + addScore.Quarter = commonus.ComputingTime(timeOccurrence, 2) + addScore.Month = commonus.ComputingTime(timeOccurrence, 3) + addScore.Week = commonus.ComputingTime(timeOccurrence, 4) + // addScore.Year = commonus.ComputingTime(operationTime, 1) + // addScore.Quarter = commonus.ComputingTime(operationTime, 2) + // addScore.Month = commonus.ComputingTime(operationTime, 3) + // addScore.Week = commonus.ComputingTime(operationTime, 4) + if len(requestData.Enclosure) > 0 { + 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 //1、需要整改;2:无需整改 + addScore.Reply = 1 + addScore.CorrectionTime = correctionTime + addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error + //步进内容 + + if addErr != nil { + response.Result(109, addErr, "数据写入失败", c) + return + } + myIsTrue := 1 + + if requestData.Type != 1 { + //减分 + if myIsTrue != 1 { + //申请人也是部门负责人 + commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + } else { + //申请人不是是部门负责人 给本部门负责人发送审批 + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 1, 1, 1, 1, userCont.Key, requestData.Enclosure) + } + } else { + //加分 + commonus.StepAddDataEs(keyNumber, 16182159043990656, 2, 7, 1, 1, 1, userCont.Key, requestData.Enclosure) + } + + response.Result(0, requestData, "数据写入成功", c) +} diff --git a/gin_server_admin/api/index/evaluation/lookquantita.go b/gin_server_admin/api/index/evaluation/lookquantita.go index 3959a59..9fd4ad1 100644 --- a/gin_server_admin/api/index/evaluation/lookquantita.go +++ b/gin_server_admin/api/index/evaluation/lookquantita.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "strconv" + "strings" "github.com/flipped-aurora/gin-vue-admin/server/commonus" "github.com/flipped-aurora/gin-vue-admin/server/global" @@ -129,12 +130,15 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { if requestData.Page <= 0 { requestData.Page = 1 } + if requestData.IsSet == 0 { + requestData.IsSet = 1 + } offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize) // var evalProContList []assessmentmodel.EvaluationProcess var evalProContList []accPerFlowLog gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}) - gormDb = gormDb.Select("evaluation_process.*,sf.sf_duty_department,sf.sf_evaluation_plan,fl.fl_evaluation_id,fl.fl_evaluation_department,qe.qe_dimension,qe.qe_target,qe.qe_detailed_target,dc.title,et.et_title,dt.dt_title") + gormDb = gormDb.Select("evaluation_process.*,sf.sf_duty_department,sf.sf_evaluation_plan,fl.fl_evaluation_id,fl.fl_evaluation_department,qe.qe_dimension,qe.qe_target,qe.qe_detailed_target,dc.title,et.et_title,dt.dt_title,qe.qe_accept_evaluation") gormDb = gormDb.Joins(("left join score_flow as sf on sf.sf_key = evaluation_process.ep_order_key")) gormDb = gormDb.Joins(("left join flow_log as fl on fl.fl_key = evaluation_process.ep_order_key")) @@ -152,7 +156,14 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { gormDb = gormDb.Where("sf.sf_duty_department = ? OR fl.fl_evaluation_department = ?", requestData.Department, requestData.Department) } } - gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) + // gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key) + + if requestData.IsSet == 1 { + gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`) OR NOT FIND_IN_SET(?,`ep_next_executor`)", userCont.Key, userCont.Key) + } else { + gormDb = gormDb.Where("FIND_IN_SET(?,`ep_participants`) OR FIND_IN_SET(?,`ep_next_executor`)", userCont.Key, userCont.Key) + } + if requestData.State != 0 { gormDb = gormDb.Where("evaluation_process.ep_state = ?", requestData.State) } else { @@ -171,7 +182,8 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { total = 0 } //获取记录数据 - evaErr := gormDb.Order("ep_id ASC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error + evaErr := gormDb.Order("ep_state ASC,ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error + // evaErr := gormDb.Order("ep_id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error if evaErr != nil { response.Result(104, evaErr, "数据获取失败!", c) return @@ -185,6 +197,16 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { flowLogListCont.OutId = orderId flowLogListCont.Class = v.TypeClass flowLogListCont.MonthDays = commonus.TimeStampToDate(v.StartTime, 15) + + flowLogListCont.IsSet = 1 + isSetUser := strings.Split(v.NextExecutor, ",") + if len(isSetUser) > 0 { + if commonus.IsItTrueString(userCont.Key, isSetUser) == true { + flowLogListCont.IsSet = 2 + } + } + + fmt.Printf("TypeClass ---------%v\n", v.TypeClass) if v.TypeClass == 1 { //获取考核项目关联项目 targettitle, detailedRulesTitle, _, _, scoreFlowCont, qualEvalInfo, dutyTarDetErr := commonus.GetDutyAssociatedItems(orderId) @@ -199,8 +221,21 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres if qualEvalInfo.AcceptEvaluation != 0 { whereDepart := commonus.MapOut() - whereDepart["id"] = qualEvalInfo.AcceptEvaluation + whereDepart["id"] = v.AcceptEvaluation + orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") + if orgContDerErr == nil { + if departTitleName == "" { + departTitleName = orgContDer.Name + } else { + departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) + } + flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) + } + } else { + whereDepart := commonus.MapOut() + whereDepart["id"] = v.AcceptEvaluation orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") + fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) if orgContDerErr == nil { if departTitleName == "" { departTitleName = orgContDer.Name @@ -221,6 +256,20 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { flowLogListCont.Week = scoreFlowCont.Week //`json:"week"` //周"` flowLogListCont.Days = commonus.ComputingTime(scoreFlowCont.HappenTime, 5) //`json:"days"` //天 + } else { + var departTitleName string + whereDepart := commonus.MapOut() + whereDepart["id"] = v.AcceptEvaluation + orgContDer, orgContDerErr := commonus.GetNewOrgCont(whereDepart, "name") + fmt.Printf("whereDepart ---------->%v------->%v-------->%v-------->%v\n", v.TypeClass, whereDepart, orgContDerErr, orgContDer) + if orgContDerErr == nil { + if departTitleName == "" { + departTitleName = orgContDer.Name + } else { + departTitleName = fmt.Sprintf("%v、%v", departTitleName, orgContDer.Name) + } + flowLogListCont.ExecutiveDepartment = append(flowLogListCont.ExecutiveDepartment, orgContDer.Name) + } } } else { flowLogInfo, flowLogErr := commonus.GetFlowLog(orderId) diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index 435f4d4..d1fb751 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -31,15 +31,19 @@ type TargetContOutCont struct { State int `json:"state"` UserList []string `json:"userlist"` //执行人列表 UserListAry []QualEvalArrt `json:"userlistary"` //执行人列表 - Actual string `json:"actual"` //实际值 - ZeroPrize string `json:"zeroprize"` //零奖值 - AllPrize string `json:"allprize"` //全奖奖值 - Reach string `json:"reach"` //达成率 - ReachScore float64 `json:"reachscore"` //达成率 - Reason string `json:"reason"` //说明 - ScoringMethod int64 `json:"scoringmethod"` - DimensionWeight int64 `json:"dimensionweight"` //权重 - TargetWeight int64 `json:"targetweight"` //权重 + + Actual string `json:"actual"` //实际值 + ZeroPrize string `json:"zeroprize"` //零奖值 + AllPrize string `json:"allprize"` //全奖奖值 + Reach string `json:"reach"` //达成率公式 + ReachScore float64 `json:"reachscore"` //达成率 + CappingVal float64 `json:"cappingcal"` //封顶值 + + Reason string `json:"reason"` //说明 + ScoringMethod int64 `json:"scoringmethod"` + DimensionWeight int64 `json:"dimensionweight"` //权重 + TargetWeight int64 `json:"targetweight"` //权重 + PlanVersionNumber string `json:"planversionnumber"` //版本号 } //定性考核列表输出 @@ -68,7 +72,8 @@ type addPlusOrMinusPoints struct { CorrectionTime string `json:"correctiontime"` //整改期限 // Enclosure []string `json:"enclosure"` //附件 // Enclosure []EnclosureFormat `json:"enclosure"` //附件 - Enclosure []commonus.EnclosureFormat `json:"enclosure"` //附件 + Enclosure []commonus.EnclosureFormat `json:"enclosure"` //附件 + PlanVersionNumber string `json:"planversionnumber"` //版本号 } type enclosureType struct { Type int `json:"type"` //1:加分;2:减分 @@ -123,28 +128,31 @@ type CorrectiveMeasuresType struct { //添加定量考核 type AddRationFlowLog struct { - GroupId string `json:"groupid"` - DepartmentID string `json:"departmentid"` - Addtime string `json:"time"` //检查时间 - List []RationLogList `json:"list"` + GroupId string `json:"groupid"` + DepartmentID string `json:"departmentid"` + Addtime string `json:"time"` //检查时间 + PlanVersionNumber string `json:"planversionnumber"` //版本号 + List []RationLogList `json:"list"` } type RationLogList struct { Id string `json:"id"` // Score int64 `json:"score` - Actual string `json:"actual` - Unit string `json:"unit` - // Content string `json:"content"` //原因 + Actual string `json:"actual` + Unit string `json:"unit` + TargetName string `json:"targetname"` //原因 Reason string `json:"reason"` //原因 Enclosure []string `json:"enclosure"` //附件 ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"` - ScoringScore int64 `json:"scoringscore"` //手动分"` + ScoringScore float64 `json:"scoringscore"` //手动分"` + // PlanVersionNumber string `json:"planversionnumber"` //版本号 } //获取定量考核列表 type GetRationFlowLog struct { GroupId string `json:"groupid"` DepartmentID string `json:"departmentid"` + TargetId string `json:"targetid"` } //定性指标流程展示 @@ -164,6 +172,7 @@ type DutyCecorFlow struct { FlowMapAll []commonus.FlowAllMap `json:"flowmapall"` //流程全貌 LanMuName string `json:"lanmuname"` //前端栏目显示名称 Enclosure []EnclosureFormat `json:"enclosure"` //附件 + IsSet int `json:"isset"` //是否已经审批 } //审批流 @@ -210,8 +219,14 @@ type RationOutStruct struct { Unit string `json:"unit"` //单位"` Score float64 `json:score` //分数\ Content string `json:"content"` - Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` - CycleAttres int `json:"cycleattr"` //辅助计数"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + Actual float64 `json:"actual"` //实际值 + ZeroPrize float64 `json:"zeroprize"` //零奖值 + AllPrize float64 `json:"allprize"` //全奖奖值 + CappingVal float64 `json:"CappingVal"` //封顶值 + Achievement float64 `json:"achievement"` //达成率 + Weight float64 `json:"weight"` } //定量考核目标设定查询 @@ -252,6 +267,7 @@ type FlowLogType struct { Title string `json:"title"` //指标 Department string `json:"department"` //部门 Time string `json:"time"` //时间 + IsSet int `json:"isset"` //未处理 1:已审核;2:未审核 } //流程记录输出 @@ -274,6 +290,8 @@ type FlowLogListOut struct { Week int64 `json:"week"` //周"` Days int64 `json:"days"` //天 MonthDays string `json:"monthdays"` //提报日期 + + IsSet int `json:"isset"` //是否已经审批 } //新定性考核列表 @@ -317,14 +335,16 @@ type NewQualDetailOutList struct { Score string `json:"score"` State int `json:"state"` //1、定分;2、区间分;3、不定性分值 TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"` - TargetSunId string `json:"targetsunid"` //子栏目ID - TargetSunName string `json:"targetsunname"` //子栏目名称 + TargetSunId string `json:"targetsunid"` //子栏目ID + TargetSunName string `json:"targetsunname"` //子栏目名称 + PlanVersionNumber string `json:"planversionnumber" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"` //版本号 } //定量或者定性考核审批流程全图 type getExamineFlow struct { - Id string `json:"id"` //考核项目ID - IsCorrection int `json:"iscorrection"` //是否整改 + Id string `json:"id"` //考核项目ID + IsCorrection int `json:"iscorrection"` //是否整改 + PlusReduction int `json:"plusreduction"` //加减分 } type AddDutyNewCont struct { @@ -362,4 +382,12 @@ type accPerFlowLog struct { DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` DetailedTitle string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"` TargetTitle string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"` + AcceptEvaluation int64 `json:"acceptevaluation" gorm:"column:qe_accept_evaluation;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` +} + +//新定性考核列表 +type QualEvalFlowLog struct { + Group string `json:"group"` //集团 + Department string `json:"department"` //部门 + QualId int64 `json:"qualid"` //指标名称 } diff --git a/gin_server_admin/api/statistics/quantification/quant.go b/gin_server_admin/api/statistics/quantification/quant.go index 08b9ca6..3ce8508 100644 --- a/gin_server_admin/api/statistics/quantification/quant.go +++ b/gin_server_admin/api/statistics/quantification/quant.go @@ -453,22 +453,34 @@ func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, zeroPrize = qualConfig.Zeroprize / 100 CappingVal = qualConfig.CappingVal / 100 - if qualConfig.CappingVal != 0 && resultval >= qualConfig.CappingVal { - scoreVal = float64(targetScore) - achievement = 100 - // fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) - } else { - chuShu := resultval - float64(qualConfig.Zeroprize) - beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) - if beiChuShu > 0 { - achievement = commonus.Decimal(chuShu / beiChuShu) - scoreVal = achievement * (resultval / 100) - fmt.Printf("达成率--2-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement, resultval) - } else { - scoreVal = float64(targetScore) - // fmt.Printf("达成率--3-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + chuShu := resultval - float64(qualConfig.Zeroprize) + beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) + if beiChuShu > 0 { + achievement = commonus.Decimal(chuShu / beiChuShu) + scoreVal = achievement * (resultval / 100) + if achievement >= CappingVal { + scoreVal = CappingVal * float64(targetScore) } + } else { + scoreVal = float64(targetScore) } + + // if qualConfig.CappingVal != 0 && resultval >= qualConfig.CappingVal { + // scoreVal = float64(targetScore) + // achievement = 100 + // // fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + // } else { + // chuShu := resultval - float64(qualConfig.Zeroprize) + // beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) + // if beiChuShu > 0 { + // achievement = commonus.Decimal(chuShu / beiChuShu) + // scoreVal = achievement * (resultval / 100) + // fmt.Printf("达成率--2-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement, resultval) + // } else { + // scoreVal = float64(targetScore) + // // fmt.Printf("达成率--3-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) + // } + // } // fmt.Printf("达成率--4-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", group, depart, dimen, target, year, allPrize, zeroPrize, CappingVal, achievement) return } diff --git a/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go b/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go index 15ea178..4613d1a 100644 --- a/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go +++ b/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go @@ -108,20 +108,22 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { if v.Zeroprize < 0 { saveDataCont.Zeroprize = 0 } else { - if v.Zeroprize > 100 { - saveDataCont.Zeroprize = 10000 - } else { - saveDataCont.Zeroprize = v.Zeroprize * 100 - } + // if v.Zeroprize > 100 { + // saveDataCont.Zeroprize = 10000 + // } else { + // saveDataCont.Zeroprize = v.Zeroprize * 100 + // } + saveDataCont.Zeroprize = v.Zeroprize * 100 } if v.Allprize < 0 { saveDataCont.Allprize = 0 } else { - if v.Allprize > 100 { - saveDataCont.Allprize = 10000 - } else { - saveDataCont.Allprize = v.Allprize * 100 - } + // if v.Allprize > 100 { + // saveDataCont.Allprize = 10000 + // } else { + // saveDataCont.Allprize = v.Allprize * 100 + // } + saveDataCont.Allprize = v.Allprize * 100 } if v.Capping > 0 { saveDataCont.Capping = 1 @@ -158,20 +160,22 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { if v.Zeroprize < 0 { saveDataCont.Zeroprize = 0 } else { - if v.Zeroprize > 100 { - saveDataCont.Zeroprize = 10000 - } else { - saveDataCont.Zeroprize = v.Zeroprize * 100 - } + // if v.Zeroprize > 100 { + // saveDataCont.Zeroprize = 10000 + // } else { + // saveDataCont.Zeroprize = v.Zeroprize * 100 + // } + saveDataCont.Zeroprize = v.Zeroprize * 100 } if v.Allprize < 0 { saveDataCont.Allprize = 0 } else { - if v.Allprize > 100 { - saveDataCont.Allprize = 10000 - } else { - saveDataCont.Allprize = v.Allprize * 100 - } + // if v.Allprize > 100 { + // saveDataCont.Allprize = 10000 + // } else { + // saveDataCont.Allprize = v.Allprize * 100 + // } + saveDataCont.Allprize = v.Allprize * 100 } if v.Capping > 0 { saveDataCont.Capping = 1 @@ -209,20 +213,22 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { if v.Zeroprize < 0 { saveDataCont.Zeroprize = 0 } else { - if v.Zeroprize > 100 { - saveDataCont.Zeroprize = 10000 - } else { - saveDataCont.Zeroprize = v.Zeroprize * 100 - } + // if v.Zeroprize > 100 { + // saveDataCont.Zeroprize = 10000 + // } else { + // saveDataCont.Zeroprize = v.Zeroprize * 100 + // } + saveDataCont.Zeroprize = v.Zeroprize * 100 } if v.Allprize < 0 { saveDataCont.Allprize = 0 } else { - if v.Allprize > 100 { - saveDataCont.Allprize = 10000 - } else { - saveDataCont.Allprize = v.Allprize * 100 - } + // if v.Allprize > 100 { + // saveDataCont.Allprize = 10000 + // } else { + // saveDataCont.Allprize = v.Allprize * 100 + // } + saveDataCont.Allprize = v.Allprize * 100 } if v.Capping > 0 { saveDataCont.Capping = 1 @@ -241,20 +247,22 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { if v.Zeroprize < 0 { eiteDataMap["zeroprize"] = 0 } else { - if v.Zeroprize > 100 { - eiteDataMap["zeroprize"] = 10000 - } else { - eiteDataMap["zeroprize"] = v.Zeroprize * 100 - } + // if v.Zeroprize > 100 { + // eiteDataMap["zeroprize"] = 10000 + // } else { + // eiteDataMap["zeroprize"] = v.Zeroprize * 100 + // } + eiteDataMap["zeroprize"] = v.Zeroprize * 100 } if v.Allprize < 0 { eiteDataMap["allprize"] = 0 } else { - if v.Allprize > 100 { - eiteDataMap["allprize"] = 10000 - } else { - eiteDataMap["allprize"] = v.Allprize * 100 - } + // if v.Allprize > 100 { + // eiteDataMap["allprize"] = 10000 + // } else { + // eiteDataMap["allprize"] = v.Allprize * 100 + // } + eiteDataMap["allprize"] = v.Allprize * 100 } if v.Capping > 0 { diff --git a/gin_server_admin/api/v1/staff/staffpeople.go b/gin_server_admin/api/v1/staff/staffpeople.go index 190853f..099239c 100644 --- a/gin_server_admin/api/v1/staff/staffpeople.go +++ b/gin_server_admin/api/v1/staff/staffpeople.go @@ -302,3 +302,21 @@ func getOrgCont(id string) (oldId, orgName string) { orgName = orgInfo.Name return } + +//获得员工列表 +func (s *StaffPeople) StaffListes(c *gin.Context) { + // var requestData staffRequest + // err := c.ShouldBindJSON(&requestData) + // if err != nil { + // // response.Result(101, err, "参数错误!请重新提交!", c) + // // return + // } + // if requestData.PageSize == 0 { + // requestData.PageSize = 20 + // } + // if requestData.Page <= 0 { + // requestData.Page = 1 + // } + // offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize) + +} diff --git a/gin_server_admin/api/web/jixiaokaohe/enter.go b/gin_server_admin/api/web/jixiaokaohe/enter.go index f97f827..b56a570 100644 --- a/gin_server_admin/api/web/jixiaokaohe/enter.go +++ b/gin_server_admin/api/web/jixiaokaohe/enter.go @@ -47,8 +47,9 @@ type NewQualDetailOutList struct { Score string `json:"score"` State int `json:"state"` //1、定分;2、区间分;3、不定性分值 TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"` - TargetSunId string `json:"targetsunid"` //子栏目ID - TargetSunName string `json:"targetsunname"` //子栏目名称 + TargetSunId string `json:"targetsunid"` //子栏目ID + TargetSunName string `json:"targetsunname"` //子栏目名称 + PlanVersionNumber string `json:"planversionnumber"` //版本号 } //新型定性考核列表输出 @@ -67,6 +68,7 @@ type NewQualOutList struct { //考核方案输出 type kaoHeFangAn struct { - Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` - DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` + Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` + DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` + QualEvalId string `json:"qualevalid" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"` } diff --git a/gin_server_admin/api/web/jixiaokaohe/myduty.go b/gin_server_admin/api/web/jixiaokaohe/myduty.go index 4e7ca7b..9181948 100644 --- a/gin_server_admin/api/web/jixiaokaohe/myduty.go +++ b/gin_server_admin/api/web/jixiaokaohe/myduty.go @@ -85,7 +85,7 @@ func (a *ApiGroup) TaskParameterTitleList(c *gin.Context) { return } var targetId []kaoHeFangAn - gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_detailed_target,qe_id").Where("`qe_group` = ?", requestData.Group).Where("`qe_accept_evaluation` = ?", requestData.Department).Where("`qe_target` = ?", requestData.Target).Where("`qe_target_sun` = ?", requestData.SunTarget).Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Limit(requestData.PageSize).Offset(commonus.CalculatePages(requestData.Page, requestData.PageSize)).Group("qe_detailed_target,qe_id").Find(&targetId) + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_detailed_target,qe_id,qe_qual_eval_id").Where("`qe_group` = ?", requestData.Group).Where("`qe_accept_evaluation` = ?", requestData.Department).Where("`qe_target` = ?", requestData.Target).Where("`qe_target_sun` = ?", requestData.SunTarget).Where("`qe_type` = 1 AND `qe_state` = 1 AND FIND_IN_SET(?,`qe_operator`)", userCont.Key).Limit(requestData.PageSize).Offset(commonus.CalculatePages(requestData.Page, requestData.PageSize)).Group("qe_detailed_target,qe_id").Find(&targetId) errDb := gormDb.Error if errDb != nil { @@ -129,6 +129,8 @@ func (a *ApiGroup) TaskParameterTitleList(c *gin.Context) { groupId, _ := strconv.ParseInt(requestData.Group, 10, 64) outCont.Group = groupId + outCont.PlanVersionNumber = v.QualEvalId + where := commonus.MapOut() where["id"] = groupId orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") diff --git a/gin_server_admin/api/wechatapp/callback/apphandle.go b/gin_server_admin/api/wechatapp/callback/apphandle.go index 2051887..c87ecd3 100644 --- a/gin_server_admin/api/wechatapp/callback/apphandle.go +++ b/gin_server_admin/api/wechatapp/callback/apphandle.go @@ -275,9 +275,10 @@ func WorkWechatMailList(changeType string, decryptMsg []byte) { func WechatCallBackDataWruteRedis(redisKey, redisVal, class string) { redisClient := redishandel.RunRedis() redisClient.SetRedisDb(2) - redisClient.SetRedisTime(0) + redisClient.SetRedisTime(604800) switch class { case "lpush": //列表 + redisClient.SetRedisTime(31536000) locationJson, locationErr := redisClient.Lindex(redisKey, 0) if locationErr != nil { redisClient.Lpush(redisKey, redisVal) diff --git a/gin_server_admin/api/wechatapp/callback/rationcallback.go b/gin_server_admin/api/wechatapp/callback/rationcallback.go index 2b9ce36..676ea42 100644 --- a/gin_server_admin/api/wechatapp/callback/rationcallback.go +++ b/gin_server_admin/api/wechatapp/callback/rationcallback.go @@ -86,11 +86,11 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if ii == 0 { if targetInfoErr == true { - quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) + quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, float64(vv.Score)/100, targetInfo.Unit) } } else { if targetInfoErr == true { - quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) + quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, float64(vv.Score)/100, targetInfo.Unit) } } } @@ -150,11 +150,11 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleRation(orderId, clickEnte tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if ii == 0 { if targetInfoErr == true { - quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, vv.Score, targetInfo.Unit) + quoteAreaContent = fmt.Sprintf("%v :%v%v", tarInfo.Title, float64(vv.Score)/100, targetInfo.Unit) } } else { if targetInfoErr == true { - quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, vv.Score, targetInfo.Unit) + quoteAreaContent = fmt.Sprintf("%v\n%v :%v%v", quoteAreaContent, tarInfo.Title, float64(vv.Score)/100, targetInfo.Unit) } } } diff --git a/gin_server_admin/api/wechatapp/callback/updatehandle.go b/gin_server_admin/api/wechatapp/callback/updatehandle.go index 70c7115..0940d92 100644 --- a/gin_server_admin/api/wechatapp/callback/updatehandle.go +++ b/gin_server_admin/api/wechatapp/callback/updatehandle.go @@ -131,7 +131,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt switch flowLog[currentSetp].NextStep { case 1: orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) - commonus.StepAddData(orderIdInt, 0, 1, 1, 1, 1, 1, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 0, 1, 1, 1, 2, 1, strconv.FormatInt(userContInfo.Key, 10)) //发起人 taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) evaluationPlanStr := strconv.FormatInt(scoreFlowInfo.EvaluationPlan, 10) @@ -150,7 +150,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt case 2: //发起人部门负责人 orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) - commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 1, 2, strconv.FormatInt(userContInfo.Key, 10)) + //获取发起人部门负责人 sendUserIsTrue, sendUserList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendUserIsTrue == true { @@ -165,78 +165,97 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt t.UpdateButtonIng(otherUser, buttonClickNAmeOtherEs) } } - //向相关部门内勤发送确认责任人信息 - //1、获取责任部门内勤信息 - officWorkUserIsTrue, officWorkUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤 - if officWorkUserIsTrue != true { - fmt.Printf("Step------5------->\n") - cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) - return - } - taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) - var programme assessmentmodel.QualitativeEvaluation - judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error - if judgeProgramme != nil { - fmt.Printf("Step------6------->\n") - cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) - sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) - return - } - //确定标题 - var title string = "" - //一级标题副本内容 - var desc string = "" - detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则 - if detailedTargetErr == true { - tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息 - if tarErr == true { - title = tarInf.Title //一级标题,建议不超过36个字 - desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字 + + if scoreFlowInfo.PlusReduceScore == 1 { + commonus.StepAddData(orderIdInt, 16182159043990656, 1, 2, 1, 2, 2, strconv.FormatInt(userContInfo.Key, 10)) + flowSaveData := commonus.MapOut() + flowSaveData["sf_reply"] = 3 + flowSaveData["sf_eite_time"] = time.Now().Unix() + commonus.EiteScoreFlow(orderIdInt, flowSaveData) + + evalProcSaveData := commonus.MapOut() + evalProcSaveData["ep_state"] = 2 + evalProcSaveData["ep_time"] = time.Now().Unix() + // var evalProc assessmentmodel.EvaluationProcess + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderId).Updates(&evalProcSaveData) + + } else { + commonus.StepAddData(orderIdInt, 16182159043990656, 3, 2, 1, 2, 2, strconv.FormatInt(userContInfo.Key, 10)) + + //向相关部门内勤发送确认责任人信息 + //1、获取责任部门内勤信息 + officWorkUserIsTrue, officWorkUserList := commonus.GetSendMsgUser(16118387069540343, scoreFlowInfo.DutyDepartment) //获取对应部门内勤 + if officWorkUserIsTrue != true { + fmt.Printf("Step------5------->\n") + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + return + } + taskId := strconv.FormatInt(commonus.GetFileNumberEs(), 10) + var programme assessmentmodel.QualitativeEvaluation + judgeProgramme := global.GVA_DB_Performanceappraisal.Where("`qe_id` = ?", scoreFlowInfo.EvaluationPlan).First(&programme).Error + if judgeProgramme != nil { + fmt.Printf("Step------6------->\n") + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v", orderId) + sendErrMsg(t.FromUsername, orderId, "此审批流程已经关闭!请联系发起人!", "此审批流程已经关闭!请联系发起人!", userContInfo.DepartmentName, userContInfo.Name, cardJumpUrl, jumpUrl) + return + } + //确定标题 + var title string = "" + //一级标题副本内容 + var desc string = "" + detailedTargetCont, detailedTargetErr := commonus.GetDetailedTargetInfo(programme.DetailedTarget) //获取指标细则 + if detailedTargetErr == true { + tarInf, tarErr := commonus.GetTargetInfo(detailedTargetCont.ParentId) //获取指标信息 + if tarErr == true { + title = tarInf.Title //一级标题,建议不超过36个字 + desc = detailedTargetCont.Title //一级标题辅助信息,建议不超过44个字 + } else { + title = detailedTargetCont.Title //一级标题,建议不超过36个字 + } } else { - title = detailedTargetCont.Title //一级标题,建议不超过36个字 + tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息 + if tarErr == true { + title = tarInf.Title //一级标题,建议不超过36个字 + } else { + title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字 + } } - } else { - tarInf, tarErr := commonus.GetTargetInfo(programme.Target) //获取指标信息 - if tarErr == true { - title = tarInf.Title //一级标题,建议不超过36个字 + var quoteAreaTitle string = "" + sendScore := scoreFlowInfo.Score * int64(scoreFlowInfo.Count) + if scoreFlowInfo.PlusReduceScore == 1 { + quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100) } else { - title = strconv.FormatInt(programme.DetailedTarget, 10) //一级标题,建议不超过36个字 + quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100) } + // if scoreFlowInfo.PlusReduceScore == 1 { + // quoteAreaTitle = fmt.Sprintf("加:%v%v\n", scoreFlowInfo.Score, programme.Unit) + // } else { + // quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", scoreFlowInfo.Score, programme.Unit) + // } + //生成唯一编号 + registerNumber := commonus.GetFileNumberEs() + var registerCont assessmentmodel.Register + registerCont.Number = registerNumber + registerCont.State = 1 + registerCont.Time = time.Now().Unix() + registerCont.AddCont() + + cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) + jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10)) + jumpUrlTitle := "请前往处理" + sourceDesc := "责任划分" + // quoteAreaContent := programme + var sendTextMsg sendmessage.TextNoticeTemplateMedium + sendTextMsg.SendMsgTextShare(officWorkUserList, taskId, title, desc, quoteAreaTitle, scoreFlowInfo.Reason, "考核上报部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) + flowSaveData := commonus.MapOut() + flowSaveData["sf_reply"] = 2 + flowSaveData["sf_eite_time"] = time.Now().Unix() + commonus.EiteScoreFlow(orderIdInt, flowSaveData) } - var quoteAreaTitle string = "" - sendScore := scoreFlowInfo.Score * int64(scoreFlowInfo.Count) - if scoreFlowInfo.PlusReduceScore == 1 { - quoteAreaTitle = fmt.Sprintf("考核加分:%v\n", float64(sendScore)/100) - } else { - quoteAreaTitle = fmt.Sprintf("考核减分:%v\n", float64(sendScore)/100) - } - // if scoreFlowInfo.PlusReduceScore == 1 { - // quoteAreaTitle = fmt.Sprintf("加:%v%v\n", scoreFlowInfo.Score, programme.Unit) - // } else { - // quoteAreaTitle = fmt.Sprintf("扣除:%v%v\n", scoreFlowInfo.Score, programme.Unit) - // } - //生成唯一编号 - registerNumber := commonus.GetFileNumberEs() - var registerCont assessmentmodel.Register - registerCont.Number = registerNumber - registerCont.State = 1 - registerCont.Time = time.Now().Unix() - registerCont.AddCont() - cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", orderId) - jumpUrl := fmt.Sprintf("http://new.hxgk.group/#/responsible?id=%v&num=%v", orderId, strconv.FormatInt(registerNumber, 10)) - jumpUrlTitle := "请前往处理" - sourceDesc := "责任划分" - // quoteAreaContent := programme - var sendTextMsg sendmessage.TextNoticeTemplateMedium - sendTextMsg.SendMsgTextShare(officWorkUserList, taskId, title, desc, quoteAreaTitle, scoreFlowInfo.Reason, "考核上报部门", userContInfo.DepartmentName, userContInfo.Name, t.FromUsername, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) - flowSaveData := commonus.MapOut() - flowSaveData["sf_reply"] = 2 - flowSaveData["sf_eite_time"] = time.Now().Unix() - commonus.EiteScoreFlow(orderIdInt, flowSaveData) case 3: //责任划分(相关部门内勤) case 4: @@ -317,7 +336,7 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt sourceDesc := "整改通知" var sendTextMsg sendmessage.TextNoticeTemplateMedium sendTextMsg.SendMsgTextShare(sendUserList, taskId, title, desc, quoteAreaTitle, quoteAreaContent, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, jumpUrl, jumpUrlTitle, sourceDesc) - commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 1, 4, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 5, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10)) } else { //不需要整改 @@ -391,14 +410,14 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt buttonMap = append(buttonMap, buttonCont) var sendTextMsg sendmessage.ButtonNoticeTemplateMedium sendTextMsg.SendButtonShare(sendUser, taskId, "验收", title, desc, subtitle, reason, twoLevelTitle, twoLevelKeyName, twoLevelKeyValue, twoLevelUserId, cardJumpUrl, buttonMap) - commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 1, 4, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 4, strconv.FormatInt(userContInfo.Key, 10)) } case 5: //主要责任人整改 case 6: //责任部门审批(部门负责人) orderIdInt, _ := strconv.ParseInt(orderId, 10, 64) //流程Key - commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 1, 6, strconv.FormatInt(userContInfo.Key, 10)) + commonus.StepAddData(orderIdInt, 16182159043990656, 7, 7, 1, 2, 6, strconv.FormatInt(userContInfo.Key, 10)) sendButtonIsTrue, sendButtonList := commonus.GetSendMsgUserAry(16182159043990656, userContInfo.DepartmentId) //获取发起人部门负责人 if sendButtonIsTrue == true { @@ -487,6 +506,13 @@ func (t *TemplateCardPush) ButtonTemplateCallBackHandleBackups(orderId, clickEnt scoreFlowMap["sf_reply"] = 3 scoreFlowMap["sf_eite_time"] = time.Now().Unix() global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_id` = ?", scoreFlowInfo.Id).Updates(scoreFlowMap) + + evalProcSaveData := commonus.MapOut() + evalProcSaveData["ep_state"] = 2 + evalProcSaveData["ep_time"] = time.Now().Unix() + // var evalProc assessmentmodel.EvaluationProcess + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("`ep_order_key` = ?", orderId).Updates(&evalProcSaveData) + //2、获取要抄送人员名单 var sendUserAry []string //2.1 获取发起人部门负责人 diff --git a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go index b797ad3..3cc5f4c 100644 --- a/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go +++ b/gin_server_admin/api/wechatapp/sendmessage/sendmsgHandle.go @@ -46,9 +46,13 @@ func SendMsgPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl string, Ty sendTextMsg.TemplateCard.SubTitleText = "考核上报部门:" execDerpatCont := "" // execDerpatCont := "考核部门:" - execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) - if execDerpatErr == true { - execDerpatCont = execDerpatCont + execDerpat.Name + // execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) + // if execDerpatErr == true { + // execDerpatCont = execDerpatCont + execDerpat.Name + // } + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + execDerpatCont = execDerpat.Name } htalConListStrCon.KeyName = execDerpatCont //获取操作人 @@ -132,9 +136,13 @@ func SendButtonPublic(sendUserList, Title, Desc, subtitle, reason string, depart sendTextMsg.TemplateCard.SubTitleText = "责任部门:" execDerpatCont := "" // execDerpatCont := "考核部门:" - execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) - if execDerpatErr == true { - execDerpatCont = execDerpatCont + execDerpat.Name + // execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) + // if execDerpatErr == true { + // execDerpatCont = execDerpatCont + execDerpat.Name + // } + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + execDerpatCont = execDerpat.Name } htalConListStrCon.KeyName = execDerpatCont //获取操作人 @@ -201,10 +209,15 @@ func SendButtonPublicRation(sendUserList, Title, Desc, subtitle, reason string, sendTextMsg.TemplateCard.SubTitleText = "责任部门:" execDerpatCont := "" // execDerpatCont := "考核部门:" - execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) - if execDerpatErr == true { - execDerpatCont = execDerpatCont + execDerpat.Name + // execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) + // if execDerpatErr == true { + // execDerpatCont = execDerpatCont + execDerpat.Name + // } + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + execDerpatCont = execDerpat.Name } + htalConListStrCon.KeyName = execDerpatCont //获取操作人 userFileStr := "wm_number,qywx_key,wx_key" @@ -285,9 +298,13 @@ func SendMsgTxtPublic(sendUserList, Title, Desc, Unit, Reason, handleUrl, scoreR sendTextMsg.TemplateCard.SubTitleText = subTitleText execDerpatCont := "" // execDerpatCont := "考核部门:" - execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) - if execDerpatErr == true { - execDerpatCont = execDerpatCont + execDerpat.Name + // execDerpatErr, execDerpat := commonus.GetBranchFactory(departmentId) + // if execDerpatErr == true { + // execDerpatCont = execDerpatCont + execDerpat.Name + // } + execDerpat, execDerpatErr := commonus.GetNewOrgCont(departmentId) + if execDerpatErr == nil { + execDerpatCont = execDerpat.Name } htalConListStrCon.KeyName = execDerpatCont //获取操作人 diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index f6ec2fa..c4ada7a 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1388,11 +1388,17 @@ func GetOfficeWork(id, departmentId int64) (isTrue bool, roleUser []roleGroupBod //获取企业微信信息接收人 func GetSendMsgUser(id, departmentId int64) (isTrue bool, userStr string) { isTrue = false - err, departmentCont := GetBranchFactory(departmentId) - if err != true { + // err, departmentCont := GetBranchFactory(departmentId) + // if err != true { + // return + // } + departWhere := MapOut() + departWhere["id"] = departmentId + departmentCont, errDepart := GetNewOrgCont(departWhere, "wechat_organization_id") + if errDepart != nil { return } - err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatId)) + err, roleGroup, _ := GetOfficeWork(id, int64(departmentCont.WechatOrganizationId)) if err != true { return } @@ -1586,10 +1592,13 @@ func GetWorkUser(key string) (userCont testpage.PersonalDetails, isTrue bool) { } type sendMsg struct { - Title string `json:"title"` - Unit string `json:"unit"` //单位"` - Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` - CycleAttres int `json:"cycleattr"` //辅助计数"` + Title string `json:"title"` + Unit string `json:"unit"` //单位"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + Dimension int64 `json:"dimension"` //维度"` + Target int64 `json:"target"` //指标"` + DetailedTarget int64 `json:"detailedtarget"` //指标细则"` } //查看定量考核数据 @@ -1601,6 +1610,7 @@ func LookRationInfo(id int64) (cont sendMsg, isTrue bool) { } cont.Cycles = qeInfo.Cycles cont.CycleAttres = qeInfo.CycleAttres + cont.Target = qeInfo.Target targetCong, isTrues := GetTargetInfo(qeInfo.Target) if isTrues == false { return @@ -1615,6 +1625,8 @@ func LookRationInfo(id int64) (cont sendMsg, isTrue bool) { } } + cont.Dimension = qeInfo.Dimension + cont.DetailedTarget = qeInfo.DetailedTarget return } @@ -1670,13 +1682,39 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state if flowStepErr == nil { evalProCont.Content = string(flowStepJson) } + evalProCont.Participants = userKey - evalProCont.NextContent = IntegrationFlowAll(flowID, typeclass) + + evalProCont.NextStep = nextStep + if nextStep != 0 { + var flowAry []FlowAllMap + evalProCont.NextContent, flowAry = IntegrationFlowAll(flowID, typeclass) + var userKeyMap []string + for _, fav := range flowAry { + if fav.Step == nextStep { + for _, facv := range fav.UserList { + if IsItTrueString(facv.Id, userKeyMap) == false { + userKeyMap = append(userKeyMap, facv.Id) + } + } + } + } + if len(userKeyMap) > 0 { + evalProCont.NextExecutor = strings.Join(userKeyMap, ",") + } else { + evalProCont.NextExecutor = "" + } + } else { + evalProCont.NextExecutor = "" + } + global.GVA_DB_Performanceappraisal.Create(&evalProCont) } else { var flowStepAry []FlowStep var flowStepArys []FlowStep json.Unmarshal([]byte(evalProCont.Content), &flowStepAry) + + var userKeyMap []string for _, f_v := range flowStepAry { if f_v.Step == evalProCont.Step { f_v.State = 2 @@ -1702,10 +1740,35 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state if flowStepErr == nil { saveData["ep_cont"] = string(flowStepJson) } + saveData["ep_next_step"] = nextStep + + if nextStep > 0 { + var flowContAry []FlowAllMap + json.Unmarshal([]byte(evalProCont.NextContent), &flowContAry) + if len(flowContAry) > 0 { + for _, fav := range flowContAry { + if fav.Step == nextStep { + for _, facv := range fav.UserList { + if IsItTrueString(facv.Id, userKeyMap) == false { + userKeyMap = append(userKeyMap, facv.Id) + } + } + } + } + } + if len(userKeyMap) > 0 { + saveData["ep_next_executor"] = strings.Join(userKeyMap, ",") + } else { + saveData["ep_next_executor"] = "" + } + } else { + saveData["ep_next_executor"] = "" + } + saveData["ep_participants"] = fmt.Sprintf("%v,%v", evalProCont.Participants, userKey) saveData["ep_state"] = state saveData["ep_next_cont"] = InsetFlowLog(state, stepInt, userKey, evalProCont.NextContent) - fmt.Printf("Flow---Map:--->%v\n", saveData) + // fmt.Printf("Flow---Map:--->%v\n", saveData) caozuoMap := MapOut() caozuoMap["flowID"] = flowID @@ -1717,8 +1780,8 @@ func StepAddData(flowID, roleGroupId int64, nextStep, stepName, typeclass, state caozuoMap["stepInt"] = stepInt caozuoMap["userKey"] = userKey caozuoMap["NextContent"] = evalProCont.NextContent - mapJson, _ := json.Marshal(caozuoMap) - fmt.Printf("Flow---Map:--Out---->%v\n", string(mapJson)) + // mapJson, _ := json.Marshal(caozuoMap) + // fmt.Printf("Flow---Map:--Out---->%v\n", string(mapJson)) // flowID, roleGroupId int64, nextStep, stepName, typeclass, state, stepInt int, userKey string EiteDutiesInfoes(evalProCont.Id, saveData) } @@ -1755,7 +1818,31 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta evalProCont.Content = string(flowStepJson) } evalProCont.Participants = userKey - evalProCont.NextContent = IntegrationFlowAllEs(flowID, typeclass, encFile) + + var flowAry []FlowAllMap + evalProCont.NextContent, flowAry = IntegrationFlowAllEs(flowID, typeclass, encFile) + + evalProCont.NextStep = nextStep + if nextStep > 0 { + var userKeyMap []string + for _, fav := range flowAry { + if fav.Step == nextStep { + for _, facv := range fav.UserList { + if IsItTrueString(facv.Id, userKeyMap) == false { + userKeyMap = append(userKeyMap, facv.Id) + } + } + } + } + if len(userKeyMap) > 0 { + evalProCont.NextExecutor = strings.Join(userKeyMap, ",") + } else { + evalProCont.NextExecutor = "" + } + } else { + evalProCont.NextExecutor = "" + } + global.GVA_DB_Performanceappraisal.Create(&evalProCont) } else { var flowStepAry []FlowStep @@ -1786,10 +1873,37 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta if flowStepErr == nil { saveData["ep_cont"] = string(flowStepJson) } + + saveData["ep_next_step"] = nextStep + + if nextStep > 0 { + var userKeyMap []string + var flowContAry []FlowAllMap + json.Unmarshal([]byte(evalProCont.NextContent), &flowContAry) + if len(flowContAry) > 0 { + for _, fav := range flowContAry { + if fav.Step == nextStep { + for _, facv := range fav.UserList { + if IsItTrueString(facv.Id, userKeyMap) == false { + userKeyMap = append(userKeyMap, facv.Id) + } + } + } + } + } + if len(userKeyMap) > 0 { + saveData["ep_next_executor"] = strings.Join(userKeyMap, ",") + } else { + saveData["ep_next_executor"] = "" + } + } else { + saveData["ep_next_executor"] = "" + } + saveData["ep_participants"] = fmt.Sprintf("%v,%v", evalProCont.Participants, userKey) saveData["ep_state"] = state saveData["ep_next_cont"] = InsetFlowLogEs(state, stepInt, userKey, evalProCont.NextContent, encFile) - fmt.Printf("Flow---Map:--->%v\n", saveData) + // fmt.Printf("Flow---Map:--->%v\n", saveData) caozuoMap := MapOut() caozuoMap["flowID"] = flowID @@ -1801,8 +1915,8 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta caozuoMap["stepInt"] = stepInt caozuoMap["userKey"] = userKey caozuoMap["NextContent"] = evalProCont.NextContent - mapJson, _ := json.Marshal(caozuoMap) - fmt.Printf("Flow---Map:--Out---->%v\n", string(mapJson)) + // mapJson, _ := json.Marshal(caozuoMap) + // fmt.Printf("Flow---Map:--Out---->%v\n", string(mapJson)) // flowID, roleGroupId int64, nextStep, stepName, typeclass, state, stepInt int, userKey string EiteDutiesInfoes(evalProCont.Id, saveData) } @@ -2054,8 +2168,8 @@ func WriteFlowMainSet(orderId int64, userKey []int64) { /* @class 流程类型 */ -func IntegrationFlowAll(flowID int64, class int) (flowAllMap string) { - var flowMap []FlowAllMap +func IntegrationFlowAll(flowID int64, class int) (flowAllMap string, flowMap []FlowAllMap) { + // var flowMap []FlowAllMap //1、创建 var oneFlowInfo FlowAllMap oneFlowInfo.Step = 1 @@ -2069,7 +2183,7 @@ func IntegrationFlowAll(flowID int64, class int) (flowAllMap string) { // fmt.Print("Flow_log:-->%v") if class == 1 { - + //定性 var scoreFlowCont assessmentmodel.ScoreFlow flowLogErr := global.GVA_DB_Performanceappraisal.Where("sf_key = ?", flowID).First(&scoreFlowCont).Error if flowLogErr == nil { @@ -2153,8 +2267,8 @@ func IntegrationFlowAll(flowID int64, class int) (flowAllMap string) { return } -func IntegrationFlowAllEs(flowID int64, class int, encFile []EnclosureFormat) (flowAllMap string) { - var flowMap []FlowAllMap +func IntegrationFlowAllEs(flowID int64, class int, encFile []EnclosureFormat) (flowAllMap string, flowMap []FlowAllMap) { + // var flowMap []FlowAllMap //1、创建 var oneFlowInfo FlowAllMap oneFlowInfo.Step = 1 @@ -2172,64 +2286,75 @@ func IntegrationFlowAllEs(flowID int64, class int, encFile []EnclosureFormat) (f var scoreFlowCont assessmentmodel.ScoreFlow flowLogErr := global.GVA_DB_Performanceappraisal.Where("sf_key = ?", flowID).First(&scoreFlowCont).Error if flowLogErr == nil { - //2、创建人部门负责人审核 - var twoFlowInfo FlowAllMap - twoFlowInfo.Step = 2 - twoFlowInfo.NodeName = GetSetpName(2) - twoFlowInfo.State = 1 - twoFlowInfo.Class = 1 - twoFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 3, 2, encFile) - flowMap = append(flowMap, twoFlowInfo) - //3、被考核部门内勤进行责任划分 - var threeFlowInfo FlowAllMap - threeFlowInfo.Step = 3 - threeFlowInfo.NodeName = GetSetpName(3) - threeFlowInfo.State = 1 - threeFlowInfo.Class = 1 - threeFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 4, 2, encFile) - flowMap = append(flowMap, threeFlowInfo) - //4、被考核部门负责人对责任划分确认 - var fourFlowInfo FlowAllMap - fourFlowInfo.Step = 4 - fourFlowInfo.NodeName = GetSetpName(7) - fourFlowInfo.State = 1 - fourFlowInfo.Class = 1 - fourFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5, 2, encFile) - flowMap = append(flowMap, fourFlowInfo) - if scoreFlowCont.Rectification == 1 { - //5、整改人节点。由内勤指定 - var fiveFlowInfo FlowAllMap - fiveFlowInfo.Step = 5 - fiveFlowInfo.NodeName = GetSetpName(4) - fiveFlowInfo.State = 1 - fiveFlowInfo.Class = 2 - // fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile) - flowMap = append(flowMap, fiveFlowInfo) - //6、被考核部门负责人对整改措施确认 - var sixFlowInfo FlowAllMap - sixFlowInfo.Step = 6 - sixFlowInfo.NodeName = GetSetpName(7) - sixFlowInfo.State = 1 - sixFlowInfo.Class = 1 - sixFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5, 2, encFile) - flowMap = append(flowMap, sixFlowInfo) - //7、发起人验收 - var serverFlowInfo FlowAllMap - serverFlowInfo.Step = 7 - serverFlowInfo.NodeName = GetSetpName(5) - serverFlowInfo.State = 1 - serverFlowInfo.Class = 1 - serverFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 1, 2, encFile) - flowMap = append(flowMap, serverFlowInfo) + if scoreFlowCont.PlusReduceScore != 1 { + //2、创建人部门负责人审核 + var twoFlowInfo FlowAllMap + twoFlowInfo.Step = 2 + twoFlowInfo.NodeName = GetSetpName(2) + twoFlowInfo.State = 1 + twoFlowInfo.Class = 1 + twoFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 3, 2, encFile) + flowMap = append(flowMap, twoFlowInfo) + //3、被考核部门内勤进行责任划分 + var threeFlowInfo FlowAllMap + threeFlowInfo.Step = 3 + threeFlowInfo.NodeName = GetSetpName(3) + threeFlowInfo.State = 1 + threeFlowInfo.Class = 1 + threeFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 4, 2, encFile) + flowMap = append(flowMap, threeFlowInfo) + //4、被考核部门负责人对责任划分确认 + var fourFlowInfo FlowAllMap + fourFlowInfo.Step = 4 + fourFlowInfo.NodeName = GetSetpName(7) + fourFlowInfo.State = 1 + fourFlowInfo.Class = 1 + fourFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5, 2, encFile) + flowMap = append(flowMap, fourFlowInfo) + if scoreFlowCont.Rectification == 1 { + //5、整改人节点。由内勤指定 + var fiveFlowInfo FlowAllMap + fiveFlowInfo.Step = 5 + fiveFlowInfo.NodeName = GetSetpName(4) + fiveFlowInfo.State = 1 + fiveFlowInfo.Class = 2 + // fiveFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5,encFile) + flowMap = append(flowMap, fiveFlowInfo) + //6、被考核部门负责人对整改措施确认 + var sixFlowInfo FlowAllMap + sixFlowInfo.Step = 6 + sixFlowInfo.NodeName = GetSetpName(7) + sixFlowInfo.State = 1 + sixFlowInfo.Class = 1 + sixFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 5, 2, encFile) + flowMap = append(flowMap, sixFlowInfo) + //7、发起人验收 + var serverFlowInfo FlowAllMap + serverFlowInfo.Step = 7 + serverFlowInfo.NodeName = GetSetpName(5) + serverFlowInfo.State = 1 + serverFlowInfo.Class = 1 + serverFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 1, 2, encFile) + flowMap = append(flowMap, serverFlowInfo) + } else { + //5、发起人验收 + var serverEsFlowInfo FlowAllMap + serverEsFlowInfo.Step = 5 + serverEsFlowInfo.NodeName = GetSetpName(5) + serverEsFlowInfo.State = 1 + serverEsFlowInfo.Class = 1 + serverEsFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 1, 2, encFile) + flowMap = append(flowMap, serverEsFlowInfo) + } } else { - //5、发起人验收 - var serverEsFlowInfo FlowAllMap - serverEsFlowInfo.Step = 5 - serverEsFlowInfo.NodeName = GetSetpName(5) - serverEsFlowInfo.State = 1 - serverEsFlowInfo.Class = 1 - serverEsFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 1, 2, encFile) - flowMap = append(flowMap, serverEsFlowInfo) + //2、创建人部门负责人审核 + var twoFlowInfo FlowAllMap + twoFlowInfo.Step = 2 + twoFlowInfo.NodeName = GetSetpName(2) + twoFlowInfo.State = 1 + twoFlowInfo.Class = 1 + twoFlowInfo.UserList = GetFlowNodeManEs(flowID, class, 3, 2, encFile) + flowMap = append(flowMap, twoFlowInfo) } } diff --git a/gin_server_admin/commonus/timeSub.go b/gin_server_admin/commonus/timeSub.go index 5167e25..58645a2 100644 --- a/gin_server_admin/commonus/timeSub.go +++ b/gin_server_admin/commonus/timeSub.go @@ -509,3 +509,10 @@ func GetAppointMonthStarAndEndTime(dayTime string) (startTime, endTime int64) { endTime, _ = DateToTimeStampEs(endTimeStr) return } + +//获取指定月的起止时间 +func GetAppointMonthStarAndEndTimeInt(monthStartTime int64) (monthStartTimgStamp, monthEndTimeStamp int64) { + t := time.Unix(monthStartTime, 0) + monthStartTimgStamp, monthEndTimeStamp = GetMonthStartOrEndTime(t) + return +} diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index d9074a5..46c92ce 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -361,6 +361,7 @@ type FlowLog struct { DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` + PlanVersion string `json:"planversion" gorm:"column:fl_planversion;type:varchar(255);comment:版本号"` } func (FlowLog *FlowLog) TableName() string { @@ -369,15 +370,16 @@ func (FlowLog *FlowLog) TableName() string { //定量考核数据流 type FlowLogData struct { - Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` - EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` - Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` - Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` - Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` - Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` - Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` - ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` - ScoringScore int64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` + Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` + EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` + Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` + Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` + Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` + Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` + Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` + ScoringScore float64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` + PlanVersion string `json:"planversion" gorm:"column:fld_planversion;type:varchar(255);comment:版本号"` } func (FlowLogData *FlowLogData) TableName() string { diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go index 4be6960..ea8d049 100644 --- a/gin_server_admin/model/assessmentmodel/performance_appraisal.go +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -32,6 +32,7 @@ type ScoreFlow struct { HappenTime int64 `json:"happentime" gorm:"column:sf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` Count int `json:"count" gorm:"column:sf_count;type:int(5) unsigned;default:1;not null;comment:发生次数"` CorrectionTime int64 `json:"correctiontime" gorm:"column:sf_correctiontime;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` + PlanVersion string `json:"planversion" gorm:"column:sf_planversion;type:varchar(255);comment:版本号"` } func (ScoreFlow *ScoreFlow) TableName() string { @@ -74,6 +75,8 @@ type EvaluationProcess struct { TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` StartTime int64 `json:"starttime" gorm:"column:ep_start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` + NextStep int `json:"nextstep" gorm:"column:ep_next_step;type:int(7) unsigned;default:1;not null;comment:下一步"` + NextExecutor string `json:"nextexecutor" gorm:"column:ep_next_executor;type:mediumtext;comment:下一步执行人"` } func (EvaluationProcess *EvaluationProcess) TableName() string { diff --git a/gin_server_admin/router/assessment/assessmentrouter.go b/gin_server_admin/router/assessment/assessmentrouter.go index 84938ee..fe1c010 100644 --- a/gin_server_admin/router/assessment/assessmentrouter.go +++ b/gin_server_admin/router/assessment/assessmentrouter.go @@ -210,5 +210,7 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { dutyIndexCodeRouter.POST("newgetqualdetailedtarget", authorityIndexApi.NewGetQualDetailedTarget) //获取新定性考核详细指标 dutyIndexCodeRouter.POST("examineflow", authorityIndexApi.ExamineFlow) // 流程图 + + dutyIndexCodeRouter.POST("plusorminuspointsnew", authorityIndexApi.PlusOrMinusPointsNew) // 加减分NEW(内部审批方法) } }