diff --git a/gin_server_admin/api/admin/dutyassess/assess.go b/gin_server_admin/api/admin/dutyassess/assess.go index 91e87aa..fa76b96 100644 --- a/gin_server_admin/api/admin/dutyassess/assess.go +++ b/gin_server_admin/api/admin/dutyassess/assess.go @@ -740,41 +740,50 @@ func (d *DutyAssessApi) LookDepartDutyVersio(c *gin.Context) { if jsonErr == nil { for _, pv := range planVersioInfo { for _, pvChild := range pv.Child { - var uotCont TargetContOutCont - //集团 - uotCont.Group = strconv.FormatInt(assessTargetContent.Group, 10) - where := commonus.MapOut() - where["id"] = assessTargetContent.Group - orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") - uotCont.GroupNAme = orgCont.Name - //维度 - uotCont.Id = pvChild.Id - uotCont.Dimension = pv.Id - uotCont.DimensionName = pv.Name - uotCont.DimensionWeight = int64(pv.ZhiFraction) - //指标 - uotCont.Target = pvChild.Id - uotCont.TargetName = pvChild.Name - uotCont.TargetWeight = pvChild.ReferenceScore - uotCont.Unit = pvChild.Unit - uotCont.Content = pvChild.Content - uotCont.State = pvChild.State - //获取指标内容 - var evalTargerCont assessmentmodel.EvaluationTarget - evalErr := global.GVA_DB_Performanceappraisal.Where("`et_id` = ?", pvChild.Id).First(&evalTargerCont).Error - if evalErr == nil { - uotCont.Type = evalTargerCont.Type - uotCont.Cycles = evalTargerCont.Cycles - uotCont.CycleAttres = evalTargerCont.CycleAttres - // if uotCont.Type == 1 { - // } else { - - // } - //获取执行人 - uotCont.UserListAry, _ = getQualEvalUser(requestData.Key, pv.Id, pvChild.Id) + if pvChild.Status == 1 || pvChild.Status == 3 { + var uotCont TargetContOutCont + //集团 + uotCont.Group = strconv.FormatInt(assessTargetContent.Group, 10) + where := commonus.MapOut() + where["id"] = assessTargetContent.Group + orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + uotCont.GroupNAme = orgCont.Name + //部门 + uotCont.DepartmentId = strconv.FormatInt(assessTargetContent.Department, 10) + // where := commonus.MapOut() + // where["id"] = assessTargetContent.Group + // orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + // uotCont.GroupNAme = orgCont.Name + //维度 + uotCont.Id = pvChild.Id + uotCont.Dimension = pv.Id + uotCont.DimensionName = pv.Name + uotCont.DimensionWeight = int64(pv.ZhiFraction) + //指标 + uotCont.Target = pvChild.Id + uotCont.TargetName = pvChild.Name + uotCont.TargetWeight = pvChild.ReferenceScore + uotCont.Unit = pvChild.Unit + uotCont.Content = pvChild.Content + uotCont.State = pvChild.State + //获取指标内容 + var evalTargerCont assessmentmodel.EvaluationTarget + evalErr := global.GVA_DB_Performanceappraisal.Where("`et_id` = ?", pvChild.Id).First(&evalTargerCont).Error + if evalErr == nil { + uotCont.Type = evalTargerCont.Type + uotCont.Cycles = evalTargerCont.Cycles + uotCont.CycleAttres = evalTargerCont.CycleAttres + // if uotCont.Type == 1 { + // } else { + + // } + //获取执行人 + uotCont.UserListAry, uotCont.UserList, _ = getQualEvalUser(requestData.Key, pv.Id, pvChild.Id) + } + uotCont.QualEvalId = requestData.Key + uotContAry = append(uotContAry, uotCont) } - uotCont.QualEvalId = requestData.Key - uotContAry = append(uotContAry, uotCont) + } } } else { @@ -807,14 +816,14 @@ func (d *DutyAssessApi) LookDepartDutyVersio(c *gin.Context) { @dimensionId 维度 @targetId 指标 */ -func getQualEvalUser(key, dimensionId, targetId string) (userContAry []QualEvalArrt, istrue bool) { +func getQualEvalUser(key, dimensionId, targetId string) (userContAry []QualEvalArrt, userKey []string, istrue bool) { istrue = false var qualEvalCont []assessmentmodel.QualitativeEvaluation listTargetErr := global.GVA_DB_Performanceappraisal.Select("qe_operator").Where("`qe_dimension` = ? AND `qe_target` = ? AND `qe_qual_eval_id` = ?", dimensionId, targetId, key).Find(&qualEvalCont).Error if listTargetErr != nil { return } - var userKey []string + // var userKey []string for _, v := range qualEvalCont { //判断执行人是否为空 if v.Operator != "" { @@ -860,6 +869,7 @@ func getQualEvalUser(key, dimensionId, targetId string) (userContAry []QualEvalA // userCont.DepartmentName = bfInfo.Name userCont.Number = usCont.Number userContAry = append(userContAry, userCont) + } } @@ -993,3 +1003,58 @@ func getLookAssessQualEvalList(Key string) (uotContAry []TargetContOutCont, errM errMsg = true return } + +//查看考核方案 +func (d *DutyAssessApi) CopyDepartDutyVersio(c *gin.Context) { + var requestData LookDutyVersio + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Key == "" { + response.Result(102, err, "数据获取失败!", c) + return + } + //获取考核方案 + var assessTargetContent assessmentmodel.PlanVersio + + planVersioErr := global.GVA_DB_Performanceappraisal.Where("`key` = ?", requestData.Key).First(&assessTargetContent).Error + if planVersioErr != nil { + response.Result(103, planVersioErr, "数据获取失败!", c) + return + } + var copyCont CopyPlanVersion + copyCont.Group = strconv.FormatInt(assessTargetContent.Group, 10) + copyCont.Department = strconv.FormatInt(assessTargetContent.Department, 10) + copyCont.Year = fmt.Sprintf("%v", assessTargetContent.Year) + if assessTargetContent.Content != "" { + var planVersioInfo []AddDutyNewCont + jsonErr := json.Unmarshal([]byte(assessTargetContent.Content), &planVersioInfo) + + if jsonErr == nil { + var copyInfoAry []CopyDutyNewCont + for _, v := range planVersioInfo { + var copyInfoXonr CopyDutyNewCont + copyInfoXonr.Id = v.Id + copyInfoXonr.Name = v.Name + copyInfoXonr.ZhiFraction = v.ZhiFraction + for _, cv := range v.Child { + var copyEvalCont CopyEvaluPross + copyEvalCont.Id = cv.Id //`json:"id"` //维度ID + copyEvalCont.Name = cv.Name //`json:"name"` + copyEvalCont.Content = cv.Content //`json:"content"` //指标说明 + copyEvalCont.Unit = cv.Unit //`json:"unit"` //单位"` + copyEvalCont.ReferenceScore = cv.ReferenceScore //`json:"referencescore"` //标准分值"` + copyEvalCont.State = cv.State //`json:"state"` + copyEvalCont.Istrue = 2 //`json:"istrue"` //是否允许修改 + + copyInfoXonr.Child = append(copyInfoXonr.Child, copyEvalCont) + } + copyInfoAry = append(copyInfoAry, copyInfoXonr) + } + copyCont.Child = copyInfoAry + } + } + response.Result(0, copyCont, "查询完成!", c) +} diff --git a/gin_server_admin/api/admin/dutyassess/assesstype.go b/gin_server_admin/api/admin/dutyassess/assesstype.go index 3a294d8..8c9f958 100644 --- a/gin_server_admin/api/admin/dutyassess/assesstype.go +++ b/gin_server_admin/api/admin/dutyassess/assesstype.go @@ -494,14 +494,16 @@ type bingFaOutDingLiang struct { //修改部门考核方案说明 type EitrDepartExplan struct { - Group string `json:"group"` //集团 - DeaprtId string `json:"deaprtid"` //部门ID - Dimension string `json:"dimension"` //维度 - TargetId string `json:"targetid"` //指标ID - SunTargetId string `json:"suntargetid"` //子栏目 - DetailedTarget string `json:"detailedtarget"` //指标细则 - QualEvalId string `json:"qualevalid"` - Content string `json:"content"` //指标说明 + Group string `json:"group"` //集团 + DeaprtId string `json:"deaprtid"` //部门ID + Dimension string `json:"dimension"` //维度 + TargetId string `json:"targetid"` //指标ID + SunTargetId string `json:"suntargetid"` //子栏目 + DetailedTarget string `json:"detailedtarget"` //指标细则 + QualEvalId string `json:"qualevalid"` //部门方案版本号 + Content string `json:"content"` //指标说明 + Operator []string `json:"operator"` //操作人 + State int `json:"state"` } //获取 @@ -596,3 +598,28 @@ type departPlanDutyOut struct { CensorCont string `json:"censorcont"` //检查依据 CensorRate int `json:"censorrate"` //检查频次 } + +type CopyPlanVersion struct { + Group string `json:"group"` + Department string `json:"department"` + Year string `json:"year"` + Child []CopyDutyNewCont `json:"child"` +} + +type CopyDutyNewCont struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + ZhiFraction int `json:"zhiFraction"` + Child []CopyEvaluPross `json:"child"` //考核细则 +} + +//指标 +type CopyEvaluPross struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + Content string `json:"content"` //指标说明 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + State int `json:"status"` + Istrue int `json:"istrue"` //是否允许修改 +} diff --git a/gin_server_admin/api/admin/dutyassess/dutyes.go b/gin_server_admin/api/admin/dutyassess/dutyes.go index c45072d..8ac274d 100644 --- a/gin_server_admin/api/admin/dutyassess/dutyes.go +++ b/gin_server_admin/api/admin/dutyassess/dutyes.go @@ -98,14 +98,14 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile eiteCont["dt_censor_type"] = strings.Join(detailedTarget.CensorType, ",") } eiteCont["dt_censor_cont"] = detailedTarget.CensorCont - if detailedTarget.CensorRate != 0 { - eiteCont["dt_censor_rate"] = detailedTarget.CensorRate - } + // if detailedTarget.CensorRate != 0 { + eiteCont["dt_censor_rate"] = detailedTarget.CensorRate + // } if departStr != "" { eiteCont["dt_paretment"] = departStr } - + eiteCont["dt_state"] = 1 global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", detailedTarget.DetailedTarget).Updates(&eiteCont) // fmt.Printf("echo --------------1---------->%v\n", content) isTrue = true @@ -145,12 +145,13 @@ func JudgeDetailsCopyEs(ascription, departStr string, sunTargetId int64, detaile eiteCont["dt_censor_type"] = strings.Join(detailedTarget.CensorType, ",") } eiteCont["dt_censor_cont"] = detailedTarget.CensorCont - if detailedTarget.CensorRate != 0 { - eiteCont["dt_censor_rate"] = detailedTarget.CensorRate - } + // if detailedTarget.CensorRate != 0 { + eiteCont["dt_censor_rate"] = detailedTarget.CensorRate + // } if departStr != "" { eiteCont["dt_paretment"] = departStr } + eiteCont["dt_state"] = 1 global.GVA_DB_Performanceappraisal.Model(&content).Where("`dt_id` = ?", content.Id).Updates(&eiteCont) // fmt.Printf("echo --------------2---------->%v\n", content) return @@ -377,8 +378,11 @@ func (d *DutyAssessApi) LookDutyTargetInfo(c *gin.Context) { } var xieCheng dataLockStatistics for _, v := range assessInfoList { + // if v.SunTargetId == 217 || v.SunTargetId == 151 { syncProcess.Add(1) go xieCheng.jieXieZiLanMu(v.Id, v.SunTargetId, v.Content, requestData) + // } + } syncProcess.Wait() readDingXingDataMap, _ := xieCheng.readMyDayData() @@ -421,13 +425,23 @@ func (d *dataLockStatistics) jieXieZiLanMu(dutyAssessId, sunTargetId int64, sunC gormDb = gormDb.Where("dt_censor_cont LIKE ?", "%"+selectData.CensorCont+"%") } if len(selectData.CensorType) > 0 { - if commonus.IsItTrueString("1", selectData.CensorType) == true && commonus.IsItTrueString("2", selectData.CensorType) == true { - gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`) OR FIND_IN_SET(2,`dt_censor_type`)") - } else if commonus.IsItTrueString("1", selectData.CensorType) == true { - gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`)") - } else { - gormDb = gormDb.Where("FIND_IN_SET(2,`dt_censor_type`)") + var findInSet []string + for _, ctv := range selectData.CensorType { + findWher := fmt.Sprintf("FIND_IN_SET(%v,`dt_censor_type`)", ctv) + if commonus.IsItTrueString(findWher, findInSet) == false { + findInSet = append(findInSet, findWher) + } + } + if len(findInSet) > 0 { + gormDb = gormDb.Where(strings.Join(findInSet, " OR ")) } + // if commonus.IsItTrueString("1", selectData.CensorType) == true && commonus.IsItTrueString("2", selectData.CensorType) == true && commonus.IsItTrueString("3", selectData.CensorType) == true { + // gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`) OR FIND_IN_SET(2,`dt_censor_type`) OR FIND_IN_SET(3,`dt_censor_type`)") + // } else if commonus.IsItTrueString("1", selectData.CensorType) == true { + // gormDb = gormDb.Where("FIND_IN_SET(1,`dt_censor_type`)") + // } else { + // gormDb = gormDb.Where("FIND_IN_SET(2,`dt_censor_type`)") + // } } detaErr := gormDb.Order("dt_id DESC").Find(&detailedList).Error if detaErr != nil { diff --git a/gin_server_admin/api/admin/dutyassess/planversio.go b/gin_server_admin/api/admin/dutyassess/planversio.go index d78781c..9421a9f 100644 --- a/gin_server_admin/api/admin/dutyassess/planversio.go +++ b/gin_server_admin/api/admin/dutyassess/planversio.go @@ -14,6 +14,31 @@ import ( "github.com/gin-gonic/gin" ) +//获取正在激活的考核方案 +func (d *DutyAssessApi) GetActivationPlanVersion(c *gin.Context) { + var requestData DutyPlanVersio + c.ShouldBindJSON(&requestData) + if requestData.Group == "" { + response.Result(101, requestData, "请选择集团!", c) + return + } + if requestData.DeaprtId == "" { + response.Result(101, requestData, "请选择部门!", c) + return + } + gormDb := global.GVA_DB_Performanceappraisal + gormDb = gormDb.Where("`group` = ?", requestData.Group) + gormDb = gormDb.Where("`department` = ?", requestData.DeaprtId) + gormDb = gormDb.Where("`state` = 1") + var planVersio []DutyPlanVersioOut + dataErr := gormDb.Order("`addtime` DESC").Find(&planVersio).Error + if dataErr != nil { + response.Result(104, dataErr, "没有查询到数据", c) + return + } + response.Result(0, planVersio, "获取成功", c) +} + //部门考核方案版本列表 func (d *DutyAssessApi) DepartDutyPlanVersion(c *gin.Context) { var requestData DutyPlanVersio @@ -47,7 +72,7 @@ func (d *DutyAssessApi) DepartDutyPlanVersion(c *gin.Context) { // response.Result(104, requestData, "没有查询到数据", c) // return var planVersio []DutyPlanVersioOut - dataErr := gormDb.Order("`addtime` DESC").Find(&planVersio).Error + dataErr := gormDb.Order("`group` ASC").Order("`department` ASC").Order("`state` ASC").Order("`addtime` ASC").Find(&planVersio).Error if dataErr != nil { response.Result(104, dataErr, "没有查询到数据", c) return @@ -664,38 +689,117 @@ func (d *dataLockStatistics) SelectDutyVersioProcessLing(departId []int64) { //修改部门考核方案内的说明 func (d *DutyAssessApi) EiteDepartExplain(c *gin.Context) { var requestData EitrDepartExplan - err := c.ShouldBindJSON(&requestData) - if err != nil { - response.Result(101, err, "数据获取失败!", c) - return - } + c.ShouldBindJSON(&requestData) + // err := c.ShouldBindJSON(&requestData) + // if err != nil { + // response.Result(101, err, "数据获取失败!", c) + // return + // } if requestData.Group == "" { - response.Result(102, err, "数据获取失败!", c) + response.Result(102, requestData, "数据获取失败!", c) return } if requestData.DeaprtId == "" { - response.Result(103, err, "数据获取失败!", c) + response.Result(103, requestData, "数据获取失败!", c) return } if requestData.Dimension == "" { - response.Result(104, err, "数据获取失败!", c) + response.Result(104, requestData, "数据获取失败!", c) return } if requestData.TargetId == "" { - response.Result(105, err, "数据获取失败!", c) + response.Result(105, requestData, "数据获取失败!", c) return } if requestData.QualEvalId == "" { - response.Result(106, err, "数据获取失败!", c) + response.Result(106, requestData, "数据获取失败!", c) return } eiteData := commonus.MapOut() eiteData["qe_eitetime"] = time.Now().Unix() eiteData["qe_content"] = requestData.Content + if requestData.State == 2 { + eiteData["qe_state"] = requestData.State + } + if len(requestData.Operator) > 0 { + eiteData["qe_operator"] = strings.Join(requestData.Operator, ",") + } saveErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Where("`qe_qual_eval_id` = ? AND `qe_group` = ? AND `qe_accept_evaluation` = ? AND `qe_dimension` = ? AND `qe_target` = ?", requestData.QualEvalId, requestData.Group, requestData.DeaprtId, requestData.Dimension, requestData.TargetId).Updates(eiteData).Error if saveErr == nil { + if requestData.State != 0 { + eitePlanVersion(requestData.QualEvalId, requestData.TargetId, requestData.State, requestData.Content) + } response.Result(0, eiteData, "数据处理成功!", c) } else { - response.Result(102, err, "数据处理失败!", c) + response.Result(102, saveErr, "数据处理失败!", c) + } +} + +//编辑版本主体 +func eitePlanVersion(key string, tarId string, state int, contStr string) { + var planVersioCont assessmentmodel.PlanVersio + planErr := global.GVA_DB_Performanceappraisal.Where("`key` = ?", key).First(&planVersioCont).Error + var planContSave []AddDutyNewCont + // fmt.Printf("Plan--------1----------->%v\n", planErr) + if planErr == nil { + if planVersioCont.Content != "" { + // fmt.Printf("Plan--------2----------->%v\n", planVersioCont) + var planCont []AddDutyNewCont + jsonErrPlan := json.Unmarshal([]byte(planVersioCont.Content), &planCont) + // fmt.Printf("Plan--------3----------->%v\n", jsonErrPlan) + if jsonErrPlan == nil { + + for _, v := range planCont { + var saveCont AddDutyNewCont + saveCont.Id = v.Id + saveCont.Name = v.Name + saveCont.ZhiFraction = v.ZhiFraction + for _, cv := range v.Child { + var chidCont EvaluPross + if cv.Id == tarId { + chidCont.Id = cv.Id + chidCont.Name = cv.Name // `json:"name"` + chidCont.Content = contStr // `json:"content"` //指标说明 + chidCont.Unit = cv.Unit // `json:"unit"` //单位"` + chidCont.ReferenceScore = cv.ReferenceScore // `json:"referencescore"` //标准分值"` + chidCont.Cycles = cv.Cycles // `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + chidCont.CycleAttres = cv.CycleAttres // `json:"cycleattr"` //辅助计数"` + chidCont.State = state // `json:"state"` + chidCont.Score = cv.Score // `json:"score"` //分数 + chidCont.QualEvalId = cv.QualEvalId // `json:"qeid"` + chidCont.Status = cv.Status // `json:"status"` + } else { + chidCont.Id = cv.Id + chidCont.Name = cv.Name // `json:"name"` + chidCont.Content = cv.Content // `json:"content"` //指标说明 + chidCont.Unit = cv.Unit // `json:"unit"` //单位"` + chidCont.ReferenceScore = cv.ReferenceScore // `json:"referencescore"` //标准分值"` + chidCont.Cycles = cv.Cycles // `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + chidCont.CycleAttres = cv.CycleAttres // `json:"cycleattr"` //辅助计数"` + chidCont.State = cv.State // `json:"state"` + chidCont.Score = cv.Score // `json:"score"` //分数 + chidCont.QualEvalId = cv.QualEvalId // `json:"qeid"` + chidCont.Status = cv.Status // `json:"status"` + + } + saveCont.Child = append(saveCont.Child, chidCont) + } + planContSave = append(planContSave, saveCont) + } + + } + } + + } + // fmt.Printf("Plan--------4----------->%v\n", len(planContSave)) + if len(planContSave) > 0 { + planContInfo, planJsonErr := json.Marshal(planContSave) + if planJsonErr == nil { + eitaData := commonus.MapOut() + eitaData["content"] = string(planContInfo) + eitaData["eitetime"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`key` = ?", key).Updates(eitaData) + } + } } diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 192f736..ff738f5 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -797,6 +797,7 @@ func (e *EvaluationInterface) QualitativeEvalRation(c *gin.Context) { targetInfo, targetErr := commonus.GetTargetInfo(v.Target) if targetErr == true { uotCont.TargetName = targetInfo.Title + uotCont.ScoringMethod = int64(targetInfo.ScoringMethod) } uotCont.TargetSun = strconv.FormatInt(v.TargetSun, 10) info, infoErr := commonus.GetQualitativeTargetInfo(v.TargetSun) @@ -958,6 +959,7 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { response.Result(108, err, "没有要考核的项目", c) return } + operationTime := time.Now().Unix() keyNumber := commonus.GetFileNumberEs() var flowLog assessmentmodel.FlowLog @@ -1010,6 +1012,13 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { 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) @@ -1043,8 +1052,8 @@ func (e *EvaluationInterface) AddFlowRationLog(c *gin.Context) { addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error commonus.StepAddData(keyNumber, 16182159043990656, 2, 7, 2, 2, 1, userCont.Key) - response.Result(0, flowLog, "数据写入成功", c) - return + // response.Result(0, flowLog, "数据写入成功", c) + // return //暂停审核方便录入测试数据 //fmt.Printf("%v---------------------->%v\n", addFlowLogErr, addFlowLogDataErr) if addFlowLogErr == nil && addFlowLogDataErr == nil { diff --git a/gin_server_admin/api/index/evaluation/flowsend.go b/gin_server_admin/api/index/evaluation/flowsend.go index d62503e..8a77bd3 100644 --- a/gin_server_admin/api/index/evaluation/flowsend.go +++ b/gin_server_admin/api/index/evaluation/flowsend.go @@ -235,8 +235,8 @@ func (e *EvaluationInterface) PlusOrMinusPoints(c *gin.Context) { } commonus.StepAddDataEs(keyNumber, 0, 3, 1, 1, 2, 1, userCont.Key, requestData.Enclosure) - response.Result(0, addScore, "数据写入成功", c) - return + // response.Result(0, addScore, "数据写入成功", c) + // return //暂停审核方便录入测试数据 cardJumpUrl := fmt.Sprintf("http://new.hxgk.group/#/approvalList?id=%v", keyNumber) if myIsTrue != 1 { diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index adfdf77..b9b4ecc 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -36,6 +36,7 @@ type TargetContOutCont struct { AllPrize string `json:"allprize"` //全奖奖值 Reach string `json:"reach"` //达成率 Reason string `json:"reason"` //说明 + ScoringMethod int64 `json:"scoringmethod"` } //定性考核列表输出 @@ -131,8 +132,10 @@ type RationLogList struct { Actual string `json:"actual` Unit string `json:"unit` // Content string `json:"content"` //原因 - Reason string `json:"reason"` //原因 - Enclosure []string `json:"enclosure"` //附件 + Reason string `json:"reason"` //原因 + Enclosure []string `json:"enclosure"` //附件 + ScoringMethod int `json:"scoringmethod"` //计分方式(1:自动;2:手动)"` + ScoringScore int64 `json:"scoringscore"` //手动分"` } //获取定量考核列表 diff --git a/gin_server_admin/api/index/statistics/dataform.go b/gin_server_admin/api/index/statistics/dataform.go new file mode 100644 index 0000000..d587f79 --- /dev/null +++ b/gin_server_admin/api/index/statistics/dataform.go @@ -0,0 +1,318 @@ +package statistics + +import ( + "encoding/json" + "fmt" + "strconv" + "time" + + "github.com/flipped-aurora/gin-vue-admin/server/api/statistics/quantification" + "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 (a *ApiGroup) GetPlanVersionValid(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData DutyPlanVersio + c.ShouldBindJSON(&requestData) + if requestData.Year == "" { + requestData.Year = commonus.TimeStampToDate(time.Now().Unix(), 11) + } + var planVersioCont []assessmentmodel.PlanVersio + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`state` = 1") + switch userCont.IsAdmin { + case "2": + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", userCont.Deparment) + } + gormDb = gormDb.Where("`group` = ? ", userCont.Company) + case "3": + if requestData.Group != "" { + gormDb = gormDb.Where("`group` = ? ", requestData.Group) + } + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) + } + case "4": + if requestData.Group != "" { + gormDb = gormDb.Where("`group` = ? ", requestData.Group) + } + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) + } + default: + // gormDb = gormDb.Where("`group` = ? AND `department` = ?", userCont.Company, userCont.Deparment) + } + err := gormDb.Find(&planVersioCont).Error + if err != nil { + response.Result(102, err, "没有查询到数据", c) + return + } + yserInt, _ := strconv.ParseInt(requestData.Year, 10, 64) + var outData []TargetContOutCont + for _, v := range planVersioCont { //版本列表 + + if v.Content != "" { + var planInfo []AddDutyNewCont + jsonErr := json.Unmarshal([]byte(v.Content), &planInfo) + if jsonErr == nil { + for _, pv := range planInfo { //维度列表 + + for _, pcv := range pv.Child { //指标列表 + if pcv.Status != 2 { + var outCont TargetContOutCont + outCont.Id = strconv.FormatInt(v.Id, 10) + //集团信息 + outCont.Group = strconv.FormatInt(v.Group, 10) + where := commonus.MapOut() + where["id"] = v.Group + orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + outCont.GroupName = orgCont.Name + //接受考核部门 + outCont.DepartmentId = strconv.FormatInt(v.Department, 10) + whereDepart := commonus.MapOut() + whereDepart["id"] = v.Department + orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") + outCont.DepartmentName = orgContDer.Name + //维度信息 + outCont.Dimension = pv.Id + outCont.DimensionName = pv.Name + outCont.DimensionWeight = int64(pv.ZhiFraction) + //指标信息 + outCont.Target = pcv.Id + outCont.TargetName = pcv.Name + outCont.TargetCont = pcv.Content + outCont.TargetWeight = pcv.ReferenceScore + outCont.Unit = pcv.Unit + //获取指标内容 + var evalTargerCont assessmentmodel.EvaluationTarget + evalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Select("et_type,et_scoring_method").Where("`et_id` = ?", pcv.Id).First(&evalTargerCont).Error + scoringMethod := 1 + if evalErr == nil { + outCont.Type = evalTargerCont.Type + scoringMethod = evalTargerCont.ScoringMethod + } + /* + @key 方案版本号 + @dimeId 维度 + @targetId 指标 + @accDepartId 接收考核的部门 + + outPut + + @qualId //方案ID + @departId 执行部门ID + @departName 执行部门名称 + @cycle 1:班;2:天;3:周;4:月;5:季度;6:年 + @cycleattr 辅助计数 + @isDuty 1:定性考核;2:定量考核 + */ + taskId, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(v.Key, pv.Id, pcv.Id, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10)) + if isDutyErr == nil { + outCont.ExecutiveDepartment = departName + outCont.Cycles = cycle + outCont.CycleAttres = cycleattr + if isDuty != 0 { + outCont.Type = isDuty + } + } else { + isDuty = 2 + } + + if isDuty == 1 { + //定性考核 + switch cycle { + case 1: + case 2: //天 + allYearDays := 365 + if commonus.IsLeapYear(yserInt) == true { + allYearDays = 366 + } + for i := 1; i <= allYearDays; i++ { + if pcv.Status != 3 { + wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_week` = %v", taskId, v.Group, v.Department, yserInt, i) + + resultData := commonus.Decimal(SubjectiveAuxiliaryCalculationSumMethod(wherStr) / 100) + if resultData > float64(pcv.ReferenceScore) { + resultData = float64(pcv.ReferenceScore) + } + outCont.Score = append(outCont.Score, resultData) + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + } + case 3: + case 5: //季度 + for i := 1; i <= 4; i++ { + if pcv.Status != 3 { + wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_quarter` = %v", taskId, v.Group, v.Department, yserInt, i) + + resultData := commonus.Decimal(SubjectiveAuxiliaryCalculationSumMethod(wherStr) / 100) + if resultData > float64(pcv.ReferenceScore) { + resultData = float64(pcv.ReferenceScore) + } + outCont.Score = append(outCont.Score, resultData) + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + } + case 6: //年 + if pcv.Status != 3 { + wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v", taskId, v.Group, v.Department, yserInt) + + resultData := commonus.Decimal(SubjectiveAuxiliaryCalculationSumMethod(wherStr) / 100) + if resultData > float64(pcv.ReferenceScore) { + resultData = float64(pcv.ReferenceScore) + } + outCont.Score = append(outCont.Score, resultData) + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + default: //月 + monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + if commonus.TimeStampToDate(time.Now().Unix(), 11) != requestData.Year { + monthValue = "12" + } + monthValueInt, _ := strconv.Atoi(monthValue) + for i := 1; i <= monthValueInt; i++ { + if pcv.Status != 3 { + wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", taskId, v.Group, v.Department, yserInt, i) + + resultData := commonus.Decimal(SubjectiveAuxiliaryCalculationSumMethod(wherStr) / 100) + if resultData > float64(pcv.ReferenceScore) { + resultData = float64(pcv.ReferenceScore) + } + outCont.Score = append(outCont.Score, resultData) + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + } + } + } else { + //定量考核 + switch cycle { + case 1: + case 2: //天 + allYearDays := 365 + if commonus.IsLeapYear(yserInt) == true { + allYearDays = 366 + } + for i := 1; i <= allYearDays; i++ { + if pcv.Status != 3 { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_day` = %v", taskId, yserInt, v.Group, v.Department, i) + resultData := commonus.Decimal(AuxiliaryCalculationSumMethod(wherStr, scoringMethod) / 100) + if scoringMethod != 2 { + outCont.Score = append(outCont.Score, quantification.GetQuantitativeConfig(resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0)) + } else { + outCont.Score = append(outCont.Score, resultData) + } + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + } + case 3: + case 5: //季度 + for i := 1; i <= 4; i++ { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_quarter` = %v", taskId, yserInt, v.Group, v.Department, i) + if pcv.Status != 3 { + resultData := commonus.Decimal(AuxiliaryCalculationSumMethod(wherStr, scoringMethod) / 100) + if scoringMethod != 2 { + outCont.Score = append(outCont.Score, quantification.GetQuantitativeConfig(resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0)) + } else { + outCont.Score = append(outCont.Score, resultData) + } + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + } + case 6: //年 + if pcv.Status != 3 { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v ", taskId, yserInt, v.Group, v.Department) + resultData := commonus.Decimal(AuxiliaryCalculationSumMethod(wherStr, scoringMethod) / 100) + if scoringMethod != 2 { + outCont.Score = append(outCont.Score, quantification.GetQuantitativeConfig(resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0)) + } else { + outCont.Score = append(outCont.Score, resultData) + } + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + default: //月 + monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + if commonus.TimeStampToDate(time.Now().Unix(), 11) != requestData.Year { + monthValue = "12" + } + monthValueInt, _ := strconv.Atoi(monthValue) + for i := 1; i <= monthValueInt; i++ { + if pcv.Status != 3 { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", taskId, yserInt, v.Group, v.Department, i) + resultData := commonus.Decimal(AuxiliaryCalculationSumMethod(wherStr, scoringMethod) / 100) + if scoringMethod != 2 { + outCont.Score = append(outCont.Score, quantification.GetQuantitativeConfig(resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i)) + } else { + outCont.Score = append(outCont.Score, resultData) + } + } else { + outCont.Score = append(outCont.Score, float64(pcv.ReferenceScore)) + } + + } + } + } + + outData = append(outData, outCont) + } + } + + } + } + } else { + + } + + } + response.Result(0, outData, "获取成功", c) +} + +//获取总值 定量 +func AuxiliaryCalculationSumMethod(where interface{}, scoringMethod int) (sumScore float64) { + if scoringMethod == 2 { + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(where) + gormDb.Pluck("COALESCE(SUM(fld_scoring_score), 0) as rescore", &sumScore) + } else { + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(where) + gormDb.Pluck("COALESCE(SUM(fld_score), 0) as rescore", &sumScore) + } + + return +} + +//定性 +func SubjectiveAuxiliaryCalculationSumMethod(where interface{}) (sumScore float64) { + //加分 + var addSumScore float64 = 0 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 1").Pluck("COALESCE(SUM(sf_score), 0) as addrescore", &addSumScore) + //加分 + var scoreReduction float64 = 0 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Select("sf_score").Where(where).Where("sf_plus_reduce_score = 2").Pluck("COALESCE(SUM(sf_score), 0) as redurescore", &scoreReduction) + if addSumScore != 0 && scoreReduction != 0 { + if addSumScore > scoreReduction { + sumScore = addSumScore - scoreReduction + } else { + sumScore = scoreReduction - addSumScore + } + } else if addSumScore != 0 { + sumScore = addSumScore + } else { + sumScore = scoreReduction + } + return +} diff --git a/gin_server_admin/api/index/statistics/enter.go b/gin_server_admin/api/index/statistics/enter.go index 7fc27e2..3e0e227 100644 --- a/gin_server_admin/api/index/statistics/enter.go +++ b/gin_server_admin/api/index/statistics/enter.go @@ -46,3 +46,82 @@ type EvaluPross struct { QualEvalId string `json:"qeid"` Status int `json:"status"` } + +//统计表格输出 +type StaticsOut struct { + Id string `json:"id"` //维度ID + Key string `json:"name"` + Group string `json:"group"` //归属集团 + GroupName string `json:"groupname"` //归属集团名称 + DeaprtId string `json:"deaprtid"` //部门ID + DeaprtName string `json:"deaprtname"` //部门名称 + Child []StaticsOutData `json:"child"` //考核细则 +} +type StaticsOutData struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + Content string `json:"content"` //指标说明 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + DeaprtName string `json:"deaprtname"` //数据提交部门ID + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + StatisticsData []float64 `json:"statisticsdata"` //统计值 + Child []StaticsOutData `json:"child"` //考核细则 +} + +type OrgStatics struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + Child []OrgStaticsDepary `json:"child"` //考核细则 +} + +type OrgStaticsDepary struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + Child []ProgrammeStatisticsCallBack `json:"child"` //考核细则 +} + +//方案统计回显 +type ProgrammeStatisticsCallBack struct { + Id string `json:"id"` //维度ID + Name string `json:"name"` + ZhiFraction int `json:"zhiFraction"` + Child []EvaluProssCall `json:"child"` //考核细则 +} + +//指标 +type EvaluProssCall struct { + Id string `json:"id"` //指标ID + Name string `json:"name"` //指标名称 + Content string `json:"content"` //指标说明 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + ExecuteDepart []string `json:"executedepart"` //执行部门 + TimeData []float64 `json:"timedata"` //统计结果 +} + +//考核方案细则列表输出 +type TargetContOutCont struct { + Id string `json:"id"` + Type int `json:"type"` + Group string `json:"group"` + GroupName string `json:"groupname"` + DepartmentId string `json:"departmentid"` + DepartmentName string `json:"departmentname"` + Dimension string `json:"dimension"` //维度ID + DimensionName string `json:"dimensionname"` //维度名称 + DimensionWeight int64 `json:"dimensionweight"` //维度权重 + Target string `json:"target"` //指标Id + TargetName string `json:"targetname"` //指标名称 + TargetCont string `json:"targetcont"` //指标描述 + TargetWeight int64 `json:"targetweight"` //指标权重 + Unit string `json:"unit"` //单位"` + ReferenceScore int64 `json:"referencescore"` //标准分值"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + CycleAttres int `json:"cycleattr"` //辅助计数"` + Score []float64 `json:"score"` //得分 + ExecutiveDepartment []string `json:"executivedepartment"` //执行部门 +} diff --git a/gin_server_admin/api/index/statistics/programme.go b/gin_server_admin/api/index/statistics/programme.go index 2d55866..1dac92c 100644 --- a/gin_server_admin/api/index/statistics/programme.go +++ b/gin_server_admin/api/index/statistics/programme.go @@ -2,10 +2,15 @@ package statistics import ( "encoding/json" + "fmt" "strconv" + "strings" + "time" + "github.com/flipped-aurora/gin-vue-admin/server/api/statistics/quantification" "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" ) @@ -51,3 +56,272 @@ func (a *ApiGroup) PlanVersioStatistics(c *gin.Context) { outCont["Content"] = planVersioCont.Content response.Result(0, outCont, "获取成功", c) } + +//根据部门获取绩效考核数据统计表格 +func (a *ApiGroup) DepartPerAppDataStatistics(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData DutyPlanVersio + c.ShouldBindJSON(&requestData) + if requestData.Year == "" { + requestData.Year = commonus.TimeStampToDate(time.Now().Unix(), 11) + } + var planVersioCont []assessmentmodel.PlanVersio + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Where("`state` = 1") + switch userCont.IsAdmin { + case "2": + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", userCont.Deparment) + } + gormDb = gormDb.Where("`group` = ? ", userCont.Company) + case "3": + if requestData.Group != "" { + gormDb = gormDb.Where("`group` = ? ", requestData.Group) + } + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) + } + case "4": + if requestData.Group != "" { + gormDb = gormDb.Where("`group` = ? ", requestData.Group) + } + if requestData.DeaprtId != "" { + gormDb = gormDb.Where("`department` = ? ", requestData.DeaprtId) + } + default: + // gormDb = gormDb.Where("`group` = ? AND `department` = ?", userCont.Company, userCont.Deparment) + } + err := gormDb.Find(&planVersioCont).Error + if err != nil { + response.Result(102, err, "没有查询到数据", c) + return + } + // response.Result(102, planVersioCont, "没有查询到数据", c) + // return + var statisticsAry []OrgStatics + for _, v := range planVersioCont { + var statisticsCont OrgStatics + idStr := strconv.FormatInt(v.Group, 10) + if judgeOrgStatic(idStr, statisticsAry) == true { + strDepartment := strconv.FormatInt(v.Department, 10) + if judegOrgDeparStatic(idStr, strDepartment, statisticsAry) == false { + var departInfo OrgStaticsDepary + departInfo.Id = strDepartment + whereDepart := commonus.MapOut() + whereDepart["id"] = strDepartment + orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") + departInfo.Name = orgContDer.Name + sunChild, sunChildErr := StaticDataOperation(v.Key, idStr, strDepartment, v.Content, requestData.Year) + if sunChildErr == true { + departInfo.Child = sunChild + } + for ori, orv := range statisticsAry { + fmt.Printf("opp---------->%v---------->%v\n", orv.Id, idStr) + if orv.Id == idStr { + statisticsAry[ori].Child = append(statisticsAry[ori].Child, departInfo) + } + } + // statisticsCont.Child = append(statisticsCont.Child, departInfo) + } + // fmt.Printf("kkkkkk------1--------->%v\n", v) + } else { + // fmt.Printf("kkkkkk------2--------->%v\n", v) + statisticsCont.Id = idStr + where := commonus.MapOut() + where["id"] = idStr + orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + statisticsCont.Name = orgCont.Name + + strDepartment := strconv.FormatInt(v.Department, 10) + if judegOrgDeparStatic(idStr, strDepartment, statisticsAry) == false { + var departInfo OrgStaticsDepary + departInfo.Id = strDepartment + whereDepart := commonus.MapOut() + whereDepart["id"] = strDepartment + orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "id", "name") + departInfo.Name = orgContDer.Name + sunChild, sunChildErr := StaticDataOperation(v.Key, idStr, strDepartment, v.Content, requestData.Year) + if sunChildErr == true { + departInfo.Child = sunChild + } + statisticsCont.Child = append(statisticsCont.Child, departInfo) + } + statisticsAry = append(statisticsAry, statisticsCont) + } + + } + response.Result(0, statisticsAry, "查询完成", c) +} + +//判断集团是否存在 +func judgeOrgStatic(id string, orgAry []OrgStatics) bool { + for _, v := range orgAry { + if id == v.Id { + return true + } + } + return false +} + +//判断部门是否存在 +func judegOrgDeparStatic(id, departId string, orgAry []OrgStatics) bool { + for _, v := range orgAry { + if id == v.Id { + for _, cv := range v.Child { + if departId == cv.Id { + return true + } + } + } + } + return false +} + +//统计值 +func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDataAry []ProgrammeStatisticsCallBack, isTrue bool) { + isTrue = false + var planInfo []AddDutyNewCont + jsonErr := json.Unmarshal([]byte(staticFrame), &planInfo) + if jsonErr != nil { + return + } + yserInt, _ := strconv.ParseInt(year, 10, 64) + //统计 + // var staticData ProgrammeStatisticsCallBack + for _, v := range planInfo { + var staticData ProgrammeStatisticsCallBack + staticData.Id = v.Id + staticData.Name = v.Name + for _, cv := range v.Child { + if cv.Status == 1 { + var tarCont EvaluProssCall + tarCont.Id = cv.Id + tarCont.Name = cv.Name + tarCont.Content = cv.Content + tarCont.ReferenceScore = cv.ReferenceScore + + taskId, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(key, v.Id, cv.Id, group, depart) + if isDutyErr == nil { + tarCont.ExecuteDepart = departName + tarCont.Cycles = cycle + tarCont.CycleAttres = cycleattr + if isDuty == 1 { + } else { + switch cycle { + case 1: + //按班统计 + allYearDays := 365 + // yserInt, _ := strconv.ParseInt(year, 10, 64) + if commonus.IsLeapYear(yserInt) == true { + allYearDays = 366 + } + + for i := 1; i <= allYearDays; i++ { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_day` = %v", taskId, year, group, depart, i) + + resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) + + tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) + + // tarCont.TimeData = append(tarCont.TimeData, commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr)/100)) + } + + case 2: + //按天统计 + allYearDays := 365 + // yserInt, _ := strconv.ParseInt(year, 10, 64) + if commonus.IsLeapYear(yserInt) == true { + allYearDays = 366 + } + + for i := 1; i <= allYearDays; i++ { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_day` = %v", taskId, year, group, depart, i) + + resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) + + tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) + + // tarCont.TimeData = append(tarCont.TimeData, commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr)/100)) + } + case 3: + case 4: + monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + if commonus.TimeStampToDate(time.Now().Unix(), 11) != year { + monthValue = "12" + } + monthValueInt, _ := strconv.Atoi(monthValue) + for i := 1; i <= monthValueInt; i++ { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", taskId, year, group, depart, i) + + resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) + + tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, i)) + + // tarCont.TimeData = append(tarCont.TimeData, commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr)/100)) + } + case 5: + for i := 1; i <= 4; i++ { + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_quarter` = %v", taskId, year, group, depart, i) + + resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) + + tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, i)) + + // tarCont.TimeData = append(tarCont.TimeData, commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr)/100)) + } + default: + wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v ", taskId, year, group, depart) + resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) + tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) + } + } + } + + // tarCont.ExecuteDepart = cv.ExecuteDepart + staticData.Child = append(staticData.Child, tarCont) + } + } + staticDataAry = append(staticDataAry, staticData) + } + isTrue = true + return +} + +//获取执行部门及指标性质 +/* +@key 方案版本号 +@dimeId 维度 +@targetId 指标 +@accDepartId 接收考核的部门 + +outPut + +@qualId //方案ID +@departId 执行部门ID +@departName 执行部门名称 +@cycle 1:班;2:天;3:周;4:月;5:季度;6:年 +@cycleattr 辅助计数 +@isDuty 1:定性考核;2:定量考核 +*/ +func getDepartTarget(key, dimeId, targetId, group, accDepartId string) (qualId int64, departId, departName []string, cycle, cycleattr, isDuty int, err error) { + var qualEvalCont assessmentmodel.QualitativeEvaluation + err = global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id,qe_department_id,qe_type,qe_cycle,qe_cycleattr").Where("qe_qual_eval_id = ? AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ? AND qe_group = ? AND qe_state = 1", key, dimeId, targetId, accDepartId, group).First(&qualEvalCont).Error + departId = strings.Split(qualEvalCont.DepartmentId, ",") + if len(departId) > 0 { + for _, v := range departId { + fmt.Printf("部门Id =====>%v\n", v) + where := commonus.MapOut() + where["id"] = v + orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + departName = append(departName, orgCont.Name) + } + } + isDuty = qualEvalCont.Type + cycle = qualEvalCont.Cycles + cycleattr = qualEvalCont.CycleAttres + qualId = qualEvalCont.Id + return +} diff --git a/gin_server_admin/api/statistics/quantification/auxiliarycalculation.go b/gin_server_admin/api/statistics/quantification/auxiliarycalculation.go index 4505b53..ccfe5b7 100644 --- a/gin_server_admin/api/statistics/quantification/auxiliarycalculation.go +++ b/gin_server_admin/api/statistics/quantification/auxiliarycalculation.go @@ -131,6 +131,7 @@ func EstimatedTime(dataAry natureParameter) (timeFrame []TimeFrame) { var timeFrameInfo TimeFrame timeFrameInfo.XLine = fmt.Sprintf("%v年", yv) timeFrameInfo.Class = 0 + timeFrameInfo.YearName = yv yearInt, _ := strconv.Atoi(yv) timeFrameInfo.Where = append(timeFrameInfo.Where, yearInt) timeFrame = append(timeFrame, timeFrameInfo) @@ -949,17 +950,3 @@ func TimeDimensionStatistics(taskId string, dataAry natureParameter) (outputData // fmt.Println(normName) return } - -//行政维度统计计算 -/* -@taskId 执行中的考核方案ID -@dataAry 接收的界定参数 -*/ -func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) { - //获取时间参数 - // timeFrame := EstimatedTime(dataAry) - orgAry, orgList := getGroupOrg(dataAry.Org) - fmt.Printf("orgAry====>%v\n", orgAry) - fmt.Printf("orgList-====>%v\n", orgList) - return -} diff --git a/gin_server_admin/api/statistics/quantification/departmentstatisc.go b/gin_server_admin/api/statistics/quantification/departmentstatisc.go new file mode 100644 index 0000000..33c94c1 --- /dev/null +++ b/gin_server_admin/api/statistics/quantification/departmentstatisc.go @@ -0,0 +1,74 @@ +package quantification + +import ( + "encoding/json" + "fmt" + + "github.com/flipped-aurora/gin-vue-admin/server/commonus" + "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" +) + +//行政维度统计计算 +/* +@taskId 执行中的考核方案ID +@dataAry 接收的界定参数 +*/ +func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) { + //当同时查询多个指标时启用 获取指标名称 + outErr = true + var normName string = "" + if len(dataAry.TargetId) > 1 { + //当同时查询多个指标时启用 获取指标名称 + var qualEvalCont assessmentmodel.QualitativeEvaluation + qualEvaWhe := commonus.MapOut() + qualEvaWhe["qe_id"] = taskId + qualEvalCont.GetCont(qualEvaWhe, "qe_target") + taskCont, taskErr := commonus.GetTargetInfo(qualEvalCont.Target) + if taskErr == true { + normName = taskCont.Title + outErr = taskErr + } else { + // outErr = error.Error("此考核项目没有数据!") + outErr = taskErr + return + } + } + //获取时间参数 + timeFrame := EstimatedTime(dataAry) + //获取组织架构参数 + orgAry, orgList := getGroupOrg(dataAry.Org) + //统计方式 + statisticalMethod := 3 + if len(dataAry.AccMethod) == 1 { + if commonus.IsItTrueInt(1, dataAry.AccMethod) == true { + statisticalMethod = 1 + } else { + statisticalMethod = 2 + } + } + + for _, v := range orgList { + if commonus.IsItTrueString(v.Name, outputData.XLine) == false { + outputData.XLine = append(outputData.XLine, v.Name) + for _, tv := range timeFrame { //在部门维度下进行时间跨度计算 + switch tv.Class { + case 1: //半年 + case 2: //季度 + case 3: //月 + default: //全年 + // wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v", taskId, tv.YearName) + } + } + } + } + outErr = true + + fmt.Printf("orgAry====>%v\n", orgAry) + jn, je := json.Marshal(orgList) + fmt.Printf("orgList-====>%v-====>%v\n", string(jn), je) + fmt.Printf("timeFrame-====>%v\n", timeFrame) + fmt.Printf("normName-====>%v\n", normName) + fmt.Printf("statisticalMethod-====>%v\n", statisticalMethod) + + return +} diff --git a/gin_server_admin/api/statistics/quantification/enter.go b/gin_server_admin/api/statistics/quantification/enter.go index 6ed99d6..a74475b 100644 --- a/gin_server_admin/api/statistics/quantification/enter.go +++ b/gin_server_admin/api/statistics/quantification/enter.go @@ -39,6 +39,7 @@ type TimeAttributeMap struct { //组织架构 type orgModels struct { Id string `json:"id"` + Pid string `jsonL:"pid"` Name string `json:"name"` Level int64 `json:level` } diff --git a/gin_server_admin/api/statistics/quantification/quant.go b/gin_server_admin/api/statistics/quantification/quant.go index f18086d..082220d 100644 --- a/gin_server_admin/api/statistics/quantification/quant.go +++ b/gin_server_admin/api/statistics/quantification/quant.go @@ -179,21 +179,16 @@ func (a *ApiGroup) QuantEChart(c *gin.Context) { outMap := commonus.MapOut() var graphicStatistics GraphicStatistics for _, v := range requestData.TargetId { - // var qualEvalCont assessmentmodel.QualitativeEvaluation - // qualEvaWhe := commonus.MapOut() - // qualEvaWhe["qe_id"] = v - // qualEvalCont.GetCont(qualEvaWhe, "qe_target") - // calculationEvaluation(qualEvalCont.Target, requestData) - // calculationEvaluation(v, requestData) - // kjs, kjddd := calculationEvaluation(v, requestData) - // jsonStr, jsonEr := json.Marshal(kjs) - // fmt.Printf("task------------>%v----->%v----->%v\n", string(jsonStr), jsonEr, kjddd) - // outMap["TimeDimension_"+v] = TimeDimension(v, requestData) if requestData.AnalysisAngle == 1 { getStatistics, gstErr := OrgDimensionStatistics(v, requestData) outMap["TimeDimension_"+v] = getStatistics if gstErr == true { + for _, gsv := range getStatistics.XLine { + if commonus.IsItTrueString(gsv, graphicStatistics.XLine) == false { + graphicStatistics.XLine = append(graphicStatistics.XLine, gsv) + } + } } } else { //时间维度 @@ -249,6 +244,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel if sgv.Id != strconv.FormatInt(v.Id, 10) { var orgSun orgModels orgSun.Id = strconv.FormatInt(v.Id, 10) + orgSun.Pid = strconv.FormatInt(v.Superior, 10) orgSun.Name = v.Name orgSun.Level = v.Level if v.Abbreviation != "" { @@ -268,6 +264,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel var groupInfo orgModelsAry groupInfo.Id = strconv.FormatInt(groupId, 10) groupInfo.Name = orgGroupCont.Name + groupInfo.Pid = strconv.FormatInt(v.Superior, 10) if orgGroupCont.Abbreviation != "" { groupInfo.Name = orgGroupCont.Abbreviation } @@ -283,6 +280,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel orgSun.Name = v.Abbreviation } orgSun.Level = v.Level + orgSun.Pid = strconv.FormatInt(v.Superior, 10) groupInfo.Child = append(groupInfo.Child, orgSun) orgMap = append(orgMap, groupInfo) } @@ -297,6 +295,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel if v.Abbreviation != "" { groupInfo.Name = v.Abbreviation } + groupInfo.Pid = strconv.FormatInt(v.Superior, 10) groupInfo.Level = v.Level orgMap = append(orgMap, groupInfo) } @@ -317,6 +316,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel if orgGroupCont.Abbreviation != "" { groupInfo.Name = orgGroupCont.Abbreviation } + groupInfo.Pid = strconv.FormatInt(v.Superior, 10) var aotModel hrsystem.AdministrativeOrganizationType where := commonus.MapOut() where["id"] = orgGroupCont.OrganizationType @@ -341,6 +341,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel if v.Abbreviation != "" { groupInfo.Name = v.Abbreviation } + groupInfo.Pid = strconv.FormatInt(v.Superior, 10) groupInfo.Level = v.Level orgMap = append(orgMap, groupInfo) @@ -362,6 +363,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel var orgList orgModels orgList.Id = ov.Id orgList.Name = ov.Name + orgList.Pid = ov.Pid orgList.Level = ov.Level orgWherList = append(orgWherList, orgList) } @@ -369,6 +371,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel var orgList orgModels orgList.Id = ov.Id orgList.Name = ov.Name + orgList.Pid = ov.Pid orgList.Level = ov.Level orgWherList = append(orgWherList, orgList) } @@ -385,6 +388,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel if isIn == true { var orgList orgModels orgList.Id = ocv.Id + orgList.Pid = ov.Pid orgList.Name = fmt.Sprintf("%v%v", ov.Name, ocv.Name) orgList.Level = ocv.Level orgWherList = append(orgWherList, orgList) @@ -392,6 +396,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel } else { var orgList orgModels orgList.Id = ocv.Id + orgList.Pid = ov.Pid orgList.Name = fmt.Sprintf("%v%v", ov.Name, ocv.Name) orgList.Level = ocv.Level orgWherList = append(orgWherList, orgList) @@ -403,3 +408,35 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel } return } + +//获取定量考核目标 +/* +@resultval 结算值 +@group 集团 +@depart 部门 +@dimen 维度 +@target 指标 +@deaTarget 细则 +@year 年份 +@timecopy 辅助计数 +*/ +func GetQuantitativeConfig(resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int) float64 { + 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) + } + err := gormDb.First(&qualConfig).Error + if err != nil { + return 0 + } + chuShu := resultval - float64(qualConfig.Zeroprize) + beiChuShu := float64(qualConfig.Allprize) - float64(qualConfig.Zeroprize) + if beiChuShu > 0 { + return commonus.Decimal(chuShu / beiChuShu) + } + return 0 +} diff --git a/gin_server_admin/api/v1/assessment/department_target.go b/gin_server_admin/api/v1/assessment/department_target.go index 2f2edab..085ac36 100644 --- a/gin_server_admin/api/v1/assessment/department_target.go +++ b/gin_server_admin/api/v1/assessment/department_target.go @@ -130,7 +130,7 @@ func (d *DutyHandle) DepartmentTaskList(c *gin.Context) { listTargetErr := gormDb.Joins("left join dutyclass on id = qe_dimension").Order("qe_group asc,qe_accept_evaluation asc,sort asc,qe_type asc,qe_target asc,qe_target_sun asc").Find(&qualitativeEvaluationAry).Error if listTargetErr != nil || len(qualitativeEvaluationAry) < 1 { - response.Result(101, listTargetErr, "没有数据!", c) + response.Result(101, qualitativeEvaluationAry, "没有数据!", c) return } var uotContAry []TargetContOutCont diff --git a/gin_server_admin/api/v1/assessment/dutytype.go b/gin_server_admin/api/v1/assessment/dutytype.go index d25c202..f520b42 100644 --- a/gin_server_admin/api/v1/assessment/dutytype.go +++ b/gin_server_admin/api/v1/assessment/dutytype.go @@ -764,10 +764,10 @@ type SetEvaluationObjectives struct { //周期列表 type CycleAddedType struct { - Id int64 `json:"id"` - Zeroprize int64 `json:"zeroprize"` //零奖值"` - Allprize int64 `json:"allprize"` //全奖值"` - Capping int64 `json:"capping"` //封顶值"` + Id int64 `json:"id"` + Zeroprize float64 `json:"zeroprize"` //零奖值"` + Allprize float64 `json:"allprize"` //全奖值"` + Capping float64 `json:"capping"` //封顶值"` } //添加 定性考核指标关系指定细则 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 ce95ca6..8b46fe8 100644 --- a/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go +++ b/gin_server_admin/api/v1/assessment/set_evaluation_objectives.go @@ -67,11 +67,18 @@ func (d *DutyHandle) SetEvaluationObjectives(c *gin.Context) { return } var timecopy []int64 - gromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QuantitativeConfig{}).Select("Timecopy").Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? AND `type` = ?", requestData.Group, requestData.DepartMent, requestData.Dimension, requestData.Target, requestData.Year, requestData.Cycle) + // gromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QuantitativeConfig{}).Select("Timecopy").Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? AND `type` = ?", requestData.Group, requestData.DepartMent, requestData.Dimension, requestData.Target, requestData.Year, requestData.Cycle) + gromDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QuantitativeConfig{}).Select("Timecopy").Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ? ", requestData.Group, requestData.DepartMent, requestData.Dimension, requestData.Target, requestData.Year) if requestData.TargetDetails != "" { gromDb = gromDb.Where("`targetconfig` = ?", requestData.TargetDetails) } judgeErr := gromDb.Find(&timecopy).Error + + if judgeErr == nil { + response.Result(121, judgeErr, "已经存在!不要重复添加!", c) + return + } + var saveData []assessmentmodel.QuantitativeConfig var eiteAddData []int64 for _, v := range requestData.CycleAdded { diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index d1df511..d6c004b 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -698,6 +698,7 @@ func getPeopleInfo() (redisUserInfo testpage.RedisUserInfo, isTrue bool) { oldpostis, _ := getPositionCont(ueInfo.Position) redisUserInfo.Oldposition = oldpostis // `json:"oldposition"` isTrue = true + redisUserInfo.IsAdmin = fmt.Sprintf("%v", ueInfo.IsAdmin) redisClient := redishandel.RunRedis() redisClient.SetRedisDb(5) @@ -724,6 +725,7 @@ func getPeopleInfo() (redisUserInfo testpage.RedisUserInfo, isTrue bool) { "oldgroup": oldGroup, "olddepartment": olddepart, "oldposition": oldpostis, + "isadmin": fmt.Sprintf("%v", ueInfo.IsAdmin), } redisClient.HashMsetAdd(redisFileKey, writeRedisData) return @@ -3656,3 +3658,13 @@ func Decimal(value float64) float64 { value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64) return value } + +//判断是否为闰年 +func IsLeapYear(year int64) bool { //y == 2000,2004 + //判断是否为闰年 + if year%4 == 0 && year%100 != 0 || year%400 == 0 { + return true + } + + return false +} diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index 140b37a..d9074a5 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -376,6 +376,8 @@ type FlowLogData struct { 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:手动分"` } func (FlowLogData *FlowLogData) TableName() string { @@ -384,21 +386,21 @@ func (FlowLogData *FlowLogData) TableName() string { //定量考核目标设定 type QuantitativeConfig struct { - Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` - DepartmentId int64 `json:"departmentid" gorm:"column:departmentid;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` - Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` - Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` - Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` - TargetConfig int64 `json:"targetconfig" gorm:"column:targetconfig;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` - Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` - Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` - Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` - Zeroprize int64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` - Allprize int64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` - Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` - State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` - Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` - CappingVal int64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + DepartmentId int64 `json:"departmentid" gorm:"column:departmentid;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` + Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` + Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` + Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` + TargetConfig int64 `json:"targetconfig" gorm:"column:targetconfig;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` + Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` + Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` + Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` + Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` + Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` + Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` + Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` + CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` } func (QuantitativeConfig *QuantitativeConfig) TableName() string { diff --git a/gin_server_admin/model/hrsystem/personnel.go b/gin_server_admin/model/hrsystem/personnel.go index e39adb1..62d55b0 100644 --- a/gin_server_admin/model/hrsystem/personnel.go +++ b/gin_server_admin/model/hrsystem/personnel.go @@ -29,6 +29,7 @@ type Personnel struct { Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` + IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` } func (Personnel *Personnel) TableName() string { diff --git a/gin_server_admin/model/testpage/myuser.go b/gin_server_admin/model/testpage/myuser.go index e64c45f..835c4e9 100644 --- a/gin_server_admin/model/testpage/myuser.go +++ b/gin_server_admin/model/testpage/myuser.go @@ -75,6 +75,7 @@ type RedisUserInfo struct { Wechat string `json:"wechat"` Jurisdiction string `json:"jurisdiction"` Menuoper string `json:"menuoper"` + IsAdmin string `json:"isadmin"` Oldgroup string `json:"oldgroup"` Olddepartment string `json:"olddepartment"` Oldposition string `json:"oldposition"` diff --git a/gin_server_admin/router/index/statisticsroute/programme.go b/gin_server_admin/router/index/statisticsroute/programme.go index ba70ec5..fda126e 100644 --- a/gin_server_admin/router/index/statisticsroute/programme.go +++ b/gin_server_admin/router/index/statisticsroute/programme.go @@ -15,6 +15,8 @@ func (s *StatisticsRoute) InitRouter(Router *gin.RouterGroup) { shiyanCodeRouter.GET("", authorityApi.Index) shiyanCodeRouter.GET("/", authorityApi.Index) - shiyanCodeRouter.POST("planversiostatistics", authorityApi.PlanVersioStatistics) //方案数据表格统计 + shiyanCodeRouter.POST("planversiostatistics", authorityApi.PlanVersioStatistics) //方案数据表格统计 + shiyanCodeRouter.POST("departperappdatastatistics", authorityApi.DepartPerAppDataStatistics) //绩效考核数据统计 + shiyanCodeRouter.POST("getplanversionvalid", authorityApi.GetPlanVersionValid) //绩效考核数据统计(改版) } } diff --git a/gin_server_admin/router/systemadmin/dutyassess.go b/gin_server_admin/router/systemadmin/dutyassess.go index 7ebc4a5..5d783f5 100644 --- a/gin_server_admin/router/systemadmin/dutyassess.go +++ b/gin_server_admin/router/systemadmin/dutyassess.go @@ -53,6 +53,10 @@ func (a *AdminRouter) InitStaffRouter(Router *gin.RouterGroup) { //岗位考核 adminRouter.POST("positiondepartplanversion", authorityApi.PositionDepartPlanVersion) //岗位考核列表方案版本列表 + adminRouter.POST("getactivationplanversion", authorityApi.GetActivationPlanVersion) //获取正在激活的考核方案 + + adminRouter.POST("copydepartdutyversio", authorityApi.CopyDepartDutyVersio) //复制部门考核版本 + } }