diff --git a/gin_server_admin/README.md b/gin_server_admin/README.md index 2f486ed..00c0b90 100644 --- a/gin_server_admin/README.md +++ b/gin_server_admin/README.md @@ -93,4 +93,42 @@ approvalList 流程详情页面 responsible 责任划分页面 -rectification 整改措施 \ No newline at end of file +rectification 整改措施 + + +### 2022.06.06纪要 + +``` +1、 修改evaluation_process 结构 + 添加字段 + ALTER TABLE `evaluation_process` ADD `ep_setup_department` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '发起部门'; + ALTER TABLE `evaluation_process` ADD `ep_dimension` mediumtext COMMENT '维度'; + ALTER TABLE `evaluation_process` ADD `ep_target` mediumtext COMMENT '指标'; + ALTER TABLE `evaluation_process` ADD `ep_detailedtarget` mediumtext COMMENT '指标细则'; + ALTER TABLE `evaluation_process` ADD `ep_accept_department` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '接受考核部门'; +``` +``` +2、添加视图 evalprocess + + select `dt`.`title` AS `class_title`,`et`.`et_title` AS `et_title`,`dgt`.`dt_title` AS `dt_title`,`ep`.`ep_id` AS `ep_id`,`ep`.`ep_order_key` AS `ep_order_key`,`ep`.`ep_step` AS `ep_step`,`ep`.`ep_cont` AS `ep_cont`,`ep`.`ep_next_cont` AS `ep_next_cont`,`ep`.`ep_time` AS `ep_time`,`ep`.`ep_state` AS `ep_state`,`ep`.`ep_role_group` AS `ep_role_group`,`ep`.`ep_type` AS `ep_type`,`ep`.`ep_participants` AS `ep_participants`,`ep`.`ep_start_time` AS `ep_start_time`,`ep`.`ep_next_step` AS `ep_next_step`,`ep`.`ep_next_executor` AS `ep_next_executor`,`ep`.`ep_setup_department` AS `ep_setup_department`,`ep`.`ep_dimension` AS `ep_dimension`,`ep`.`ep_target` AS `ep_target`,`ep`.`ep_detailedtarget` AS `ep_detailedtarget`,`ep`.`ep_accept_department` AS `ep_accept_department` from (((`evaluation_process` `ep` left join `dutyclass` `dt` on(find_in_set(`dt`.`id`,`ep`.`ep_dimension`))) left join `evaluationtarget` `et` on(find_in_set(`et`.`et_id`,`ep`.`ep_target`))) left join `detailed_target` `dgt` on(find_in_set(`dgt`.`dt_id`,`ep`.`ep_detailedtarget`))) +``` + +``` +3、修改 flow_log_data 结构 + ALTER TABLE `flow_log_data` ADD `fld_target_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标ID'; + +``` + +``` +4、修改 score_flow 结构 + ALTER TABLE `score_flow` ADD `sf_target_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标ID'; + ALTER TABLE `score_flow` ADD `sf_detailed_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '指标细则ID'; + +``` + +``` +4、添加视图 flow_data_log + + select `fl`.`fl_baseline` AS `baseline`,`fl`.`fl_duty_department` AS `department`,`fl`.`fl_duty_group` AS `group`,`fd`.`fld_flow_log` AS `key`,`fd`.`fld_score` AS `score`,`fd`.`fld_scoring_method` AS `method`,`fd`.`fld_scoring_score` AS `scoring_score`,`fl`.`fl_year` AS `year`,`fl`.`fl_quarter` AS `quarte`,`fl`.`fl_month` AS `month`,`fl`.`fl_week` AS `week`,`fl`.`fl_day` AS `day`,`fd`.`fld_id` AS `id`,`fd`.`fld_target_id` AS `targetid` from (`flow_log_data` `fd` left join `flow_log` `fl` on((`fd`.`fld_flow_log` = `fl`.`fl_key`))) + +``` \ No newline at end of file diff --git a/gin_server_admin/api/admin/dutyassess/assess.go b/gin_server_admin/api/admin/dutyassess/assess.go index fcb4696..5c4c0fc 100644 --- a/gin_server_admin/api/admin/dutyassess/assess.go +++ b/gin_server_admin/api/admin/dutyassess/assess.go @@ -774,19 +774,29 @@ func (d *DutyAssessApi) LookDepartDutyVersio(c *gin.Context) { uotCont.Content = pvChild.Content uotCont.State = pvChild.Status //获取指标内容 - 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 { - - // } - //获取执行人 + var qualEvalContInfo assessmentmodel.QualitativeEvaluation + qualEvalErr := global.GVA_DB_Performanceappraisal.Where("`qe_qual_eval_id` = ? AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", requestData.Key, pv.Id, pvChild.Id, assessTargetContent.Department).First(&qualEvalContInfo).Error + if qualEvalErr == nil { + uotCont.Type = qualEvalContInfo.Type + uotCont.Cycles = qualEvalContInfo.Cycles + uotCont.CycleAttres = qualEvalContInfo.CycleAttres uotCont.UserListAry, uotCont.UserList, _ = getQualEvalUser(requestData.Key, pv.Id, pvChild.Id) + } else { + 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) } @@ -1043,12 +1053,16 @@ func (d *DutyAssessApi) CopyDepartDutyVersio(c *gin.Context) { var copyInfoAry []CopyDutyNewCont for _, v := range planVersioInfo { var copyInfoXonr CopyDutyNewCont - copyInfoXonr.Id = v.Id + copyInfoXonr.Id = v.Id //维度ID copyInfoXonr.Name = v.Name copyInfoXonr.ZhiFraction = v.ZhiFraction + var displayTargetId []string for _, cv := range v.Child { var copyEvalCont CopyEvaluPross - copyEvalCont.Id = cv.Id //`json:"id"` //维度ID + copyEvalCont.Id = cv.Id //`json:"id"` //指标ID + if commonus.IsInTrue[string](cv.Id, displayTargetId) == false { + displayTargetId = append(displayTargetId, cv.Id) + } var tarGetContent assessmentmodel.EvaluationTarget tarGetContentErr := tarGetContent.GetCont(map[string]interface{}{"et_id": cv.Id}, "et_title") if tarGetContentErr == nil { @@ -1070,6 +1084,42 @@ func (d *DutyAssessApi) CopyDepartDutyVersio(c *gin.Context) { copyInfoXonr.Child = append(copyInfoXonr.Child, copyEvalCont) } + if len(displayTargetId) > 0 { + copyEvalContFuBen := GetTargetGroup(strconv.FormatInt(assessTargetContent.Group, 10), v.Id, strconv.FormatInt(assessTargetContent.Department, 10)) + // var copyEvalContAry []CopyEvaluPross + for _, cecfv := range copyEvalContFuBen { + if commonus.IsInTrue[string](cecfv.Id, displayTargetId) == false { + var copyEvalCont CopyEvaluPross + copyEvalCont.Id = cecfv.Id + copyEvalCont.Name = cecfv.Name + copyEvalCont.Content = cecfv.Content + copyEvalCont.Unit = cecfv.Unit + copyEvalCont.ReferenceScore = 0 + copyEvalCont.State = cecfv.State + copyEvalCont.Istrue = cecfv.IsTrue + // copyEvalContAry = append(copyEvalContAry, copyEvalCont) + copyInfoXonr.Child = append(copyInfoXonr.Child, copyEvalCont) + } + + } + + } else { + + copyEvalContFuBen := GetTargetGroup(strconv.FormatInt(assessTargetContent.Group, 10), v.Id, strconv.FormatInt(assessTargetContent.Department, 10)) + // var copyEvalContAry []CopyEvaluPross + for _, cecfv := range copyEvalContFuBen { + var copyEvalCont CopyEvaluPross + copyEvalCont.Id = cecfv.Id + copyEvalCont.Name = cecfv.Name + copyEvalCont.Content = cecfv.Content + copyEvalCont.Unit = cecfv.Unit + copyEvalCont.ReferenceScore = 0 + copyEvalCont.State = cecfv.State + copyEvalCont.Istrue = cecfv.IsTrue + copyInfoXonr.Child = append(copyInfoXonr.Child, copyEvalCont) + } + } + copyInfoAry = append(copyInfoAry, copyInfoXonr) } copyCont.Child = copyInfoAry diff --git a/gin_server_admin/api/admin/dutyassess/assesstype.go b/gin_server_admin/api/admin/dutyassess/assesstype.go index 41dba4d..916c314 100644 --- a/gin_server_admin/api/admin/dutyassess/assesstype.go +++ b/gin_server_admin/api/admin/dutyassess/assesstype.go @@ -144,7 +144,7 @@ type TargetContOutCont struct { Content string `json:"content"` //指标说明 Unit string `json:"unit"` //单位"` ReferenceScore int64 `json:"referencescore"` //标准分值"` - Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年"` + Cycles int `json:"cycle"` //1:班;2:天;3:周;4:月;5:季度;6:年;7:半年 CycleAttres int `json:"cycleattr"` //辅助计数"` State int `json:"state"` UserList []string `json:"userlist"` //执行人列表 diff --git a/gin_server_admin/api/admin/dutyassess/planversio.go b/gin_server_admin/api/admin/dutyassess/planversio.go index 93bbdfc..d6fb4e5 100644 --- a/gin_server_admin/api/admin/dutyassess/planversio.go +++ b/gin_server_admin/api/admin/dutyassess/planversio.go @@ -153,29 +153,30 @@ func (d *DutyAssessApi) AddDepartDutyVersio(c *gin.Context) { //判断年度是否存在版本 var sumVerson float64 judgeVersioNum := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.PlanVersio{}).Select("`id`").Where("`group` = ? AND `yeares` = ?", requestData.Group, requestData.Year).Pluck("COALESCE(COUNT(id), 0) as countid", &sumVerson).Error - fmt.Printf("sumVerson---->%v\n", sumVerson) + // fmt.Printf("sumVerson---->%v\n", sumVerson) if judgeVersioNum == nil { if sumVerson == 0 { versioNum = "0001" } else { sumVerson++ - if sumVerson <= 9999 { - versioNumGuoDu := strconv.FormatFloat(sumVerson/10000, 'f', -1, 64) - versioNumAry := strings.Split(versioNumGuoDu, ".") - if len(versioNumAry) == 2 { - versioNum = versioNumAry[1] - } else { - versioNum = "0001" - } - } else { - versioNumGuoDu := strconv.FormatFloat(sumVerson/10000000, 'f', -1, 64) - versioNumAry := strings.Split(versioNumGuoDu, ".") - if len(versioNumAry) == 2 { - versioNum = versioNumAry[1] - } else { - versioNum = "0001" - } - } + versioNum = fmt.Sprintf("%04v", sumVerson) + // if sumVerson <= 9999 { + // versioNumGuoDu := strconv.FormatFloat(sumVerson/10000, 'f', -1, 64) + // versioNumAry := strings.Split(versioNumGuoDu, ".") + // if len(versioNumAry) == 2 { + // versioNum = versioNumAry[1] + // } else { + // versioNum = "0001" + // } + // } else { + // versioNumGuoDu := strconv.FormatFloat(sumVerson/10000000, 'f', -1, 64) + // versioNumAry := strings.Split(versioNumGuoDu, ".") + // if len(versioNumAry) == 2 { + // versioNum = versioNumAry[1] + // } else { + // versioNum = "0001" + // } + // } } } else { diff --git a/gin_server_admin/api/index/evaluation/enter.go b/gin_server_admin/api/index/evaluation/enter.go index d07b243..0c1356f 100644 --- a/gin_server_admin/api/index/evaluation/enter.go +++ b/gin_server_admin/api/index/evaluation/enter.go @@ -24,6 +24,7 @@ type ApiGroup struct { @deaTarget 细则 @year 年份 @timecopy 辅助计数 +@typeClass 1:定性;2:定量 返回说明 @scoreVal 计算得分 @@ -32,7 +33,7 @@ type ApiGroup struct { @CappingVal 封顶值 @achievement 达成率 */ -func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { +func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int64, typeClass int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { scoreVal = 0 allPrize = 0 zeroPrize = 0 @@ -57,7 +58,7 @@ func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, return } - scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal) + scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal, typeClass) return allPrize = qualConfig.Allprize / 100 diff --git a/gin_server_admin/api/index/evaluation/evaluation.go b/gin_server_admin/api/index/evaluation/evaluation.go index 7500f78..b53b569 100644 --- a/gin_server_admin/api/index/evaluation/evaluation.go +++ b/gin_server_admin/api/index/evaluation/evaluation.go @@ -1546,7 +1546,14 @@ func (e *EvaluationInterface) LookDutkScoreFlow(c *gin.Context) { titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(addScore.EvaluationUser, 10)) // titleStr := fmt.Sprintf("%v提交%v考核数据 %v", titlekUserInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime,6)) - dutyCecorFlowInfo.Title = fmt.Sprintf("%v提交%v考核数据 %v", titlekUserInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime, 6)) + + BranchInfo, dErr := commonus.GetNewOrgCont(addScore.DutyDepartment, "name") + if dErr == nil { + dutyCecorFlowInfo.Title = fmt.Sprintf("%v提交%v%v考核数据 %v", titlekUserInfo.Name, BranchInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime, 6)) + } else { + dutyCecorFlowInfo.Title = fmt.Sprintf("%v提交%v考核数据 %v", titlekUserInfo.Name, titleVal, commonus.TimeStampToDate(addScore.HappenTime, 6)) + } + response.Result(0, dutyCecorFlowInfo, "获取成功", c) } @@ -1637,7 +1644,7 @@ func (d *EvaluationInterface) LookRationkScoreFlow(c *gin.Context) { 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.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, 2) } outContt.Score = float64(v.Score) / 100 outContt.Content = v.Content @@ -1819,3 +1826,268 @@ func getPlanVersionWeghit(planKey, dimensionId, targetId string) (dimensionIdWeg } return } + +//新查看定量考核列表 +func (e *EvaluationInterface) NewLookRationkScoreFlow(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 { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == 0 && requestData.OutId == "" { + response.Result(102, requestData, "参数错误!请重新提交!", c) + return + } + if requestData.OutId != "" { + idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) + if inIntErr == nil { + requestData.Id = idInt + } + } + var flowDataLog []assessmentmodel.FlowLogData + getErr := global.GVA_DB_Performanceappraisal.Where("`fld_flow_log` = ?", requestData.Id).Order("fld_id ASC").Find(&flowDataLog).Error + if getErr != nil { + response.Result(103, err, "参数错误!请重新提交!", c) + return + } + //获取数据列 + var flowLogInfo assessmentmodel.FlowLog + getErrs := global.GVA_DB_Performanceappraisal.Where("`fl_key` = ?", requestData.Id).First(&flowLogInfo).Error + //获取 审批记录数据参考值 + var allZreoCappVal []FlowLogAllZreo + baseLineErr := json.Unmarshal([]byte(flowLogInfo.Baseline), &allZreoCappVal) + //获取版本 + 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) + } + //指标列表 + 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) + + if baseLineErr != nil { //当数据流不存在 全奖、零奖、封顶值 设定时 + 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, 2) + } else { + isExistence := false + var allprizeVal float64 = 0 + var zeroprizeVal float64 = 0 + var cappingVal float64 = 0 + if len(allZreoCappVal) > 0 { + for _, azcv := range allZreoCappVal { + if strconv.FormatInt(v.EvaluationPlan, 10) == azcv.Id { + allprizeVal = azcv.Allprize + zeroprizeVal = azcv.Zeroprize + cappingVal = azcv.Capping + isExistence = true + break + } + } + } + + if isExistence == true { + outContt.Actual, outContt.AllPrize, outContt.ZeroPrize, outContt.CappingVal, outContt.Achievement = commonus.CalculateScore(targetScore, float64(v.Score), allprizeVal, zeroprizeVal, cappingVal, 2) + } else { + 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, 2) + } + } + } + outContt.Score = float64(v.Score) / 100 //打分分值 + outContt.Content = v.Content + outList = append(outList, outContt) + } + if len(outList) <= 0 { + response.Result(103, err, "没有数据!", c) + return + } + //流程查看 + var flowAllMapList []commonus.FlowAllMap + var flowLogList []TechnologicalProcessType + 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) + //fmt.Printf("9-----------2--------->%v\n", jsonFlowErr) + if jsonFlowErr == nil { + // //fmt.Printf("9-----------3--------->%v\n", flowStepAryMaps) + if len(flowStepAryMaps) > 0 { + for _, fw_v := range flowStepAryMaps { + var flowLog TechnologicalProcessType + flowLog.Step = fw_v.Step + flowLog.State = fw_v.State + workUser, workUserErr := commonus.GetWorkUser(fw_v.ClickName) + // //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) + bf, bfErr := commonus.GetNewOrgCont(workUser.DepartmentId) + // //fmt.Printf("9-----------4-----3---->%v\n", bfErr) + 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 + + for _, rg_v := range getGroupRoleInfo { + clickUserInfoErr, clickUserInfo := commonus.GetUesrContForWechatID(rg_v.Id) + // jjsk, _ := json.Marshal(clickUserInfo) + // //fmt.Printf("9-----------4--------->%v-->%v\n", string(jjsk), clickUserInfo.Key) + var caoZuoRenInfnfo caoZuoRen + if clickUserInfoErr == true { + if strconv.FormatInt(clickUserInfo.Key, 10) == fw_v.ClickName { + caoZuoRenInfnfo.IsTrue = 1 + if fw_v.AddTime != 0 { + caoZuoRenInfnfo.TimeVal = commonus.TimeStampToDate(fw_v.AddTime, 1) + } + } + gErrs, groupInfos := commonus.GetGroupCont(clickUserInfo.Group) + if gErrs == true { + caoZuoRenInfnfo.GroupName = groupInfos.Name + } + caoZuoRenInfnfo.DepartmentName = clickUserInfo.DepartmentName + caoZuoRenInfnfo.WorkShopName = clickUserInfo.WorkshopName + caoZuoRenInfnfo.Postname = clickUserInfo.PostName + caoZuoRenInfnfo.TeamName = clickUserInfo.TemaName + caoZuoRenInfnfo.Icon = clickUserInfo.Icon + caoZuoRenInfnfo.Name = clickUserInfo.Name + flowLog.UserList = append(flowLog.UserList, caoZuoRenInfnfo) + } + // var caoZuoRenInfnfo caoZuoRen + // caoZuoRenInfnfo.Name = + // if workUser.WechatId == rg_v.Id || workUser.WorkWechatId == rg_v.Id { + // } + } + } + } + + } + + flowLogList = append(flowLogList, flowLog) + } + } + } + //流程图全面 + // flowAllMapList + if evalProInfo.NextContent != "" { + jsonFlowErr := json.Unmarshal([]byte(evalProInfo.NextContent), &flowAllMapList) + 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() + outListMap["List"] = outList + outListMap["flowLog"] = flowLogList + outListMap["flowall"] = flowAllMapList + outListMap["title"] = "" + outListMap["isset"] = isShenPi + outListMap["orderid"] = requestData.Id + if getErrs == nil { + titlekUserInfo, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": flowLogInfo.EvaluationUser}, "`name`") + // titlekUserInfo, _ := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) + titleStr := fmt.Sprintf("%v提交的", titlekUserInfo.Name) + // 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) + BranchInfo, dErr := commonus.GetNewOrgCont(flowLogInfo.DutyDepartment) + if dErr == nil { + outListMap["departmentname"] = BranchInfo.Name + titleStr = fmt.Sprintf("%v%v", titleStr, BranchInfo.Name) + } else { + outListMap["departmentname"] = "" + } + titleStr = fmt.Sprintf("%v%v年%v月定量考核数据", titleStr, flowLogInfo.Year, flowLogInfo.Month) + outListMap["title"] = titleStr + } + + var flowLogListes []assessmentmodel.AssessmentLogIng + + var approvalRecord []FlowContLog + + flowLogErr := global.GVA_DB_Performanceappraisal.Where("al_order_id = ?", requestData.Id).Order("al_id ASC").Find(&flowLogListes).Error + if flowLogErr == nil { + + for flli, fllv := range flowLogListes { + var flowListCont FlowContLog + if fllv.DutyList == "" && flli == 0 { + flowListCont.Content = "创建申请" + } else { + flowListCont.Content = fllv.DutyList + } + + flowListCont.TimeVal = commonus.TimeStampToDate(fllv.ExecutorTime, 6) + userFlowCont, _ := commonus.GetNewHrPeopleInfo(map[string]interface{}{"`key`": fllv.ExecutorUser}) + flowListCont.Name = userFlowCont.Name + flowListCont.Icon = userFlowCont.Icon + gorupCont, _ := commonus.GetNewOrgCont(map[string]interface{}{"`id`": fllv.ExecutorDepart}, "`name`") + flowListCont.DepartmentName = gorupCont.Name + approvalRecord = append(approvalRecord, flowListCont) + } + } + + outListMap["flowLogList"] = approvalRecord + + response.Result(0, outListMap, "查询成功", c) +} diff --git a/gin_server_admin/api/index/evaluation/flowsendnew.go b/gin_server_admin/api/index/evaluation/flowsendnew.go index 40f6658..9637265 100644 --- a/gin_server_admin/api/index/evaluation/flowsendnew.go +++ b/gin_server_admin/api/index/evaluation/flowsendnew.go @@ -462,6 +462,9 @@ func (e *EvaluationInterface) PlusOrMinusPointsNew(c *gin.Context) { addScore.Rectification = requestData.Rectification //1、需要整改;2:无需整改 addScore.Reply = 1 addScore.CorrectionTime = correctionTime + addScore.TargetId = programme.Target + addScore.DetailedId = programme.DetailedTarget + addErr := global.GVA_DB_Performanceappraisal.Create(&addScore).Error //步进内容 diff --git a/gin_server_admin/api/index/evaluation/lookquantita.go b/gin_server_admin/api/index/evaluation/lookquantita.go index c1d5ca3..aaf824a 100644 --- a/gin_server_admin/api/index/evaluation/lookquantita.go +++ b/gin_server_admin/api/index/evaluation/lookquantita.go @@ -115,7 +115,7 @@ func (e *EvaluationInterface) LookQuantitativeConfig(c *gin.Context) { } //查看审批流程 -func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { +func (e *EvaluationInterface) SeeFlowLogOld(c *gin.Context) { isTrue, userCont := commonus.ClientIdentity() if isTrue != true { response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) @@ -368,3 +368,273 @@ func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, flowLogListOut) response.Result(0, printData, "查询成功!", c) } + +func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) { + isTrue, userCont := commonus.ClientIdentity() + if isTrue != true { + response.Result(1001, userCont, "您的身份令牌已经失效!请重新登录获取身份令牌!", c) + return + } + var requestData FlowLogType + c.ShouldBindJSON(&requestData) + + if requestData.PageSize == 0 { + requestData.PageSize = 20 + } + 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 []assessmentmodel.EvalProcess + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvalProcess{}) + // 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")) + + // gormDb = gormDb.Joins(("left join qualitative_evaluation as qe on qe.qe_id = sf.sf_evaluation_plan OR qe.qe_id = fl.fl_evaluation_id")) + // gormDb = gormDb.Joins(("left join dutyclass as dc on dc.id = qe.qe_dimension")) + // gormDb = gormDb.Joins(("left join evaluationtarget as et on et.et_id = qe.qe_target")) + // gormDb = gormDb.Joins(("left join detailed_target as dt on dt.dt_id = qe.qe_detailed_target")) + + if requestData.Title != "" || requestData.Department != "" { + + if requestData.Title != "" { + gormDb = gormDb.Where("dc.title LIKE ? OR et.et_title LIKE ? OR dt.dt_title LIKE ?", "%"+requestData.Title+"%", "%"+requestData.Title+"%", "%"+requestData.Title+"%") + } + if requestData.Department != "" { + gormDb = gormDb.Where("sf.sf_duty_department = ? OR fl.fl_evaluation_department = ?", requestData.Department, requestData.Department) + } + } + //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管 + fmt.Printf("userCont.IsAdmin =============>%v\n", userCont.IsAdmin) + switch userCont.IsAdmin { + case "2": + fmt.Printf("userCont.IsAdmin =====2========>%v\n", userCont.IsAdmin) + case "3": + fmt.Printf("userCont.IsAdmin ======3=======>%v\n", userCont.IsAdmin) + case "4": + fmt.Printf("userCont.IsAdmin =======4======>%v\n", userCont.IsAdmin) + default: + fmt.Printf("userCont.IsAdmin =======5======>%v\n", userCont.IsAdmin) + 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_next_executor`)", userCont.Key) + } + + if requestData.State != 0 { + gormDb = gormDb.Where("ep_state = ?", requestData.State) + } else { + gormDb = gormDb.Where("ep_state IN ?", []int{1, 2, 3}) + } + if requestData.Time != "" { + startTime, endTime := commonus.GetAppointMonthStarAndEndTime(requestData.Time) + gormDb = gormDb.Where("ep_start_time BETWEEN ? AND ?", startTime, endTime) + } + + if requestData.Class != 0 { + gormDb = gormDb.Where("ep_type = ?", requestData.Class) + } + /* + 获取总共有多少记录 + */ + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + //获取记录数据 + 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 + } + // response.Result(104, evalProContList, "数据获取失败!", c) + // return + var flowLogListOut []FlowLogListOut + for _, v := range evalProContList { + var flowLogListCont FlowLogListOut + orderId := strconv.FormatInt(v.OrderKey, 10) + 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) + if dutyTarDetErr == true { + + addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(scoreFlowCont.EvaluationUser, 10)) + if addUserErr == true { + flowLogListCont.FounDer = addUser.Name + } + var departTitleName string + flowLogListCont.Cycles = qualEvalInfo.Cycles + flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres + if qualEvalInfo.AcceptEvaluation != 0 { + whereDepart := commonus.MapOut() + whereDepart["id"] = qualEvalInfo.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.AcceptDepartment + 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) + } + } + // jsnnn, _ := json.Marshal(qualEvalInfo) + // fmt.Printf("qualEvalInfo-------------->%v\n", string(jsnnn)) + // BranchInfo, dErr := commonus.GetNewOrgCont(v.AcceptDepartment, "name") + if detailedRulesTitle != "" { + flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, detailedRulesTitle) + } else { + flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targettitle) + } + flowLogListCont.Year = scoreFlowCont.Year //`json:"year"` //年分"` + flowLogListCont.Quarter = scoreFlowCont.Quarter //`json:"quarter"` //季度"` + flowLogListCont.Month = scoreFlowCont.Month //`json:"month"` //月"` + 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.AcceptDepartment + 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) + if flowLogErr == true { + + flowLogListCont.Year = flowLogInfo.Year //`json:"year"` //年分"` + flowLogListCont.Quarter = flowLogInfo.Quarter //`json:"quarter"` //季度"` + flowLogListCont.Month = flowLogInfo.Month //`json:"month"` //月"` + flowLogListCont.Week = flowLogInfo.Week //`json:"week"` //周"` + flowLogListCont.Days = flowLogInfo.ToDay //`json:"days"` //天 + // fmt.Printf("Title---1-->%v\n", flowLogErr) + var qualEvalInfo assessmentmodel.QualitativeEvaluation + qualEvaTargetErr := qualEvalInfo.GetCont(map[string]interface{}{"qe_id": flowLogInfo.EvaluationPlan}, "qe_target", "qe_cycle", "qe_cycleattr", "qe_accept_evaluation") + // fmt.Printf("Title---2-->%v\n", qualEvaTargetErr) + if qualEvaTargetErr == nil { + flowLogListCont.Cycles = qualEvalInfo.Cycles + flowLogListCont.CycleAttres = qualEvalInfo.CycleAttres + var departTitleName string + if qualEvalInfo.AcceptEvaluation != 0 { + whereDepart := commonus.MapOut() + whereDepart["id"] = qualEvalInfo.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) + } + } + + var targetInfo assessmentmodel.EvaluationTarget + targetInfoErr := targetInfo.GetCont(map[string]interface{}{"et_id": qualEvalInfo.Target}, "et_title") + // fmt.Printf("Title---3-->%v\n", targetInfoErr) + if targetInfoErr == nil { + flowLogListCont.Title = fmt.Sprintf("%v %v", departTitleName, targetInfo.Title) + // flowLogListCont.Title = fmt.Sprintf("%v %v-%v-%v数据上报", targetInfo.Title, flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) + } else { + // flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) + flowLogListCont.Title = fmt.Sprintf("%v", departTitleName) + } + + } else { + flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay) + } + + addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10)) + if addUserErr == true { + flowLogListCont.FounDer = addUser.Name + } + } + + } + + //解析审批流 + var flowLog []FlowStep + jsonFlowErr := json.Unmarshal([]byte(v.Content), &flowLog) + setpLen := len(flowLog) + if jsonFlowErr == nil { + //得到当前步进值 + currentSetp := setpLen - 1 + if currentSetp < 0 { + currentSetp = 0 + } + flowLogListCont.Node = flowLog[currentSetp].StepName + addUser, addUserErr := commonus.GetWorkUser(flowLog[currentSetp].ClickName) + if addUserErr == true { + flowLogListCont.CurrentPeo = addUser.Name + } + } + switch v.State { + case 1: + flowLogListCont.Result = "起草" + flowLogListCont.Condition = "起草" + case 2: + flowLogListCont.Result = "审批中" + flowLogListCont.Condition = "审批中" + case 3: + flowLogListCont.Result = "审批通过" + flowLogListCont.Condition = "已结束" + case 4: + flowLogListCont.Result = "驳回" + flowLogListCont.Condition = "审批中" + default: + flowLogListCont.Result = "审批中" + flowLogListCont.Condition = "审批中" + } + flowLogListOut = append(flowLogListOut, flowLogListCont) + } + countSum := len(flowLogListOut) + printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, flowLogListOut) + response.Result(0, printData, "查询成功!", c) +} diff --git a/gin_server_admin/api/index/evaluation/type.go b/gin_server_admin/api/index/evaluation/type.go index 76d6916..014368f 100644 --- a/gin_server_admin/api/index/evaluation/type.go +++ b/gin_server_admin/api/index/evaluation/type.go @@ -410,3 +410,11 @@ type TongjiFenShu struct { Score float64 `json:"score" gorm:"column:sf_score;type:bigint(20) unsigned;default:0;not null;comment:分值(乘100录入)"` Count float64 `json:"count" gorm:"column:sf_count;type:int(5) unsigned;default:1;not null;comment:发生次数"` } + +//定量流水全奖值、零奖值、封顶值 +type FlowLogAllZreo struct { + Id string `json:"id"` + Zeroprize float64 `json:"zeroprize"` //零奖值"` + Allprize float64 `json:"allprize"` //全奖值"` + Capping float64 `json:"capping"` //封顶值"` +} diff --git a/gin_server_admin/api/index/statistics/dataform.go b/gin_server_admin/api/index/statistics/dataform.go index 15eb27a..822bb1e 100644 --- a/gin_server_admin/api/index/statistics/dataform.go +++ b/gin_server_admin/api/index/statistics/dataform.go @@ -372,7 +372,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { var jiSuanZhi ScoreList jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData - jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) @@ -398,7 +398,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData jiSuanZhi.ActualScore = float64(pcv.ReferenceScore) - jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) @@ -427,7 +427,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { var jiSuanZhi ScoreList jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData - jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) stccStatistics.AllPrize = append(stccStatistics.AllPrize, jiSuanZhi.AllPrize) @@ -452,7 +452,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData jiSuanZhi.ActualScore = float64(pcv.ReferenceScore) - jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) stccStatistics.AllPrize = append(stccStatistics.AllPrize, jiSuanZhi.AllPrize) @@ -478,7 +478,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { var jiSuanZhi ScoreList jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData - jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0) + jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) @@ -508,7 +508,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData jiSuanZhi.ActualScore = float64(pcv.ReferenceScore) - jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0) + jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, 0, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) @@ -542,7 +542,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { var jiSuanZhi ScoreList jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData - jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ActualScore, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfig(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) @@ -568,7 +568,7 @@ func (a *ApiGroup) GetPlanVersionValides(c *gin.Context) { jiSuanZhi.Class = 2 jiSuanZhi.ScoreVal = resultData jiSuanZhi.ActualScore = float64(pcv.ReferenceScore) - jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i) + jiSuanZhi.ScoreVal, jiSuanZhi.AllPrize, jiSuanZhi.ZeroPrize, jiSuanZhi.CappingVal, jiSuanZhi.Achievement = quantification.GetQuantitativeConfigEs(pcv.ReferenceScore, resultData, strconv.FormatInt(v.Group, 10), strconv.FormatInt(v.Department, 10), pv.Id, pcv.Id, "0", yserInt, i, 2) outCont.Score = append(outCont.Score, jiSuanZhi) stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, resultData) diff --git a/gin_server_admin/api/index/statistics/enter.go b/gin_server_admin/api/index/statistics/enter.go index 3265908..f0a586f 100644 --- a/gin_server_admin/api/index/statistics/enter.go +++ b/gin_server_admin/api/index/statistics/enter.go @@ -169,6 +169,7 @@ type TargetContOutCont struct { ExecutiveDepartment []string `json:"executivedepartment"` //执行部门 ScoreAllList []ScoreListAry `json:"scorealllist"` StatisticsName []string `json:"statisticsname"` //执行部门 + ManualGear int `json:"manualgear"` //1:自动;2:手动 } type ScoreList struct { @@ -206,3 +207,21 @@ type TongjiFenShu struct { type banNian struct { Month []int `json:"month"` } + +//定量流水全奖值、零奖值、封顶值 +type FlowLogAllZreo struct { + Id string `json:"id"` + TargetId string `json:"targetid"` //指标ID` + Zeroprize float64 `json:"zeroprize"` //零奖值"` + Allprize float64 `json:"allprize"` //全奖值"` + Capping float64 `json:"capping"` //封顶值"` +} + +type FlowDataLogList struct { + assessmentmodel.FlowLogData + 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:数据"` + 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:手动分"` + EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` +} diff --git a/gin_server_admin/api/index/statistics/newstatistics.go b/gin_server_admin/api/index/statistics/newstatistics.go new file mode 100644 index 0000000..c56ace5 --- /dev/null +++ b/gin_server_admin/api/index/statistics/newstatistics.go @@ -0,0 +1,165 @@ +package statistics + +import ( + "encoding/json" + "fmt" + "strconv" + + "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" +) + +//计算定量考核 +/* +统计分数 +@group 集团 +@department 部门 +@dimensionId 维度 +@targetId 指标 +@i 步进器 +@status 是否为观察数据 +@scoringMethod 手动计分还是自动计分 +@class 指标类型 1、定性;2:定量 +@referenceScore 指标权重 +@yserInt 年度 +@timeClass 4:月;5:季度;6:年;7:半年 +@typeClass 1:定性;2:定量;3:观察 +*/ +func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensionId, targetId string, i, status, scoringMethod, class int, yserInt, referenceScore int64, timeClass, typeClass int) { + t.mutext.Lock() + defer t.mutext.Unlock() + var fldList []assessmentmodel.FlowDataLogType + var tableScoreCont TableScoreList + tableScoreCont.Counter = i + gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowDataLogType{}) + gormDb = gormDb.Where("`targetid` = ? AND `group` = ? AND `department` = ? AND `year` = ?", targetId, group, department, yserInt) + switch timeClass { + case 5: + gormDb = gormDb.Where("`quarte` = ?", i) + case 6: + case 7: + if i == 1 { + gormDb = gormDb.Where("`month` IN ?", []int{1, 2, 3, 4, 5, 6}) + } else { + gormDb = gormDb.Where("`month` IN ?", []int{7, 8, 9, 10, 11, 12}) + } + default: + gormDb = gormDb.Where("`month` = ?", i) + } + gormDb = gormDb.Order("`id` ASC").Find(&fldList) + + jsCon, _ := json.Marshal(fldList) + + fmt.Printf("targetid------------->%v------------>%v---->%v\n", targetId, timeClass, string(jsCon)) + + var mtScore float64 = 0 + var atScore float64 = 0 + var lastEvalId int64 + var scoreSum float64 = 0 + if len(fldList) > 0 { + for _, v := range fldList { + // fmt.Printf("Key----------------->%v\n", v.Key) + if v.Key != 0 { + lastEvalId = v.Key + } + if v.ScoringMethod == 1 { + atScore = atScore + float64(v.Score) + } else { + atScore = atScore + float64(v.ScoringScore) + } + scoreSum = scoreSum + float64(v.Score) + mtScore = mtScore + v.ScoringScore + + whereDepart := commonus.MapOut() + whereDepart["id"] = v.DutyDepartment + orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "name") + tableScoreCont.ExecutiveDepartment = append(tableScoreCont.ExecutiveDepartment, orgContDer.Name) + } + } + tableScoreCont.ScoreVal = commonus.Decimal(scoreSum / 100) + targetIdInt, _ := strconv.ParseInt(targetId, 10, 64) + groupId, _ := strconv.ParseInt(group, 10, 64) + departmentId, _ := strconv.ParseInt(department, 10, 64) + dimensionIdInt, _ := strconv.ParseInt(dimensionId, 10, 64) + zeroPrize, allPrize, cappingPrize := GetAllZreoCapp(lastEvalId, groupId, departmentId, dimensionIdInt, targetIdInt, yserInt, int64(i), 0) + + // fmt.Printf("scoreSum--->%v------->mtScore--->%v---->zeroPrize--->%v---->allPrize--->%v---->cappingPrize--->%v---->typeClass---->%v\n", scoreSum, mtScore, zeroPrize, allPrize, cappingPrize, typeClass) + + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = commonus.CalculateScore(referenceScore, scoreSum, allPrize, zeroPrize, cappingPrize, typeClass) + // fmt.Printf("达成率--13-->%v-->%v-->%v-->%v-->%v\n", tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement) + if status == 3 { + tableScoreCont.ActualScore = float64(referenceScore) + } + t.TableScore = append(t.TableScore, tableScoreCont) + syncProcessDepartTarget.Done() +} + +//获取定量数据得全奖零奖封顶值得历史数据 +/* +@flKey 流水KEY +@group 集团 +@depart 部门 +@dimen 维度 +@target 指标 +@deaTarget 细则 +@year 年份 +@timecopy 辅助计数 +*/ +func GetAllZreoCapp(flKey, group, depart, dimen, targetId, year, timecopy, deaTarget int64) (zeroPrize, allPrize, cappingPrize float64) { + + var baseLineStr string + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_baseline").Where("fl_key = ?", flKey).First(&baseLineStr).Error + if err != nil { + zeroPrize, allPrize, cappingPrize = GetPassRate(group, depart, dimen, targetId, year, timecopy, deaTarget) + return + } + var flowLogConfig []FlowLogAllZreo + jsonErr := json.Unmarshal([]byte(baseLineStr), &flowLogConfig) + // fmt.Printf("flKey, targetId----------------->%v--------->%v---------->%v--------->%v\n", flKey, targetId, jsonErr, baseLineStr) + if jsonErr != nil { + zeroPrize, allPrize, cappingPrize = GetPassRate(group, depart, dimen, targetId, year, timecopy, deaTarget) + return + } + for _, v := range flowLogConfig { + if v.TargetId == strconv.FormatInt(targetId, 10) { + zeroPrize = v.Zeroprize + allPrize = v.Allprize + cappingPrize = v.Capping + // fmt.Printf("zeroPrize----------------->%v----allPrize----->%v-----cappingPrize----->%v------TargetId--->%v\n", zeroPrize, allPrize, cappingPrize, v.TargetId) + return + } + } + return +} + +//获取达成率配置 +func GetPassRate(group, depart, dimen, target, year, timecopy, deaTarget int64) (zeroPrize, allPrize, cappingPrize 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) + } + gormDb = gormDb.Where("timecopy = ?", timecopy) + err := gormDb.First(&qualConfig).Error + if err != nil { + return + } + allPrize = qualConfig.Allprize + zeroPrize = qualConfig.Zeroprize + cappingPrize = qualConfig.CappingVal + return +} + +//定性 +/*SubjectiveAuxiliaryCalculationSumMethod(wherStr string, i, status, class int, referenceScore int64) +统计分数 +@wherStr 统计条件 +@i 步进器 +@status 是否为观察数据 +@class 指标类型 1、定性;2:定量 +@referenceScore 指标权重 +*/ + +func (t *tablePlanVersionStic) SubjectiveMethodNew(wherStr string, i, status, class int, referenceScore int64) { +} diff --git a/gin_server_admin/api/index/statistics/programme.go b/gin_server_admin/api/index/statistics/programme.go index f33b4f0..5f0adc4 100644 --- a/gin_server_admin/api/index/statistics/programme.go +++ b/gin_server_admin/api/index/statistics/programme.go @@ -224,7 +224,7 @@ func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDa resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) - ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i) + ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i, 2) tarCont.TimeData = append(tarCont.TimeData, ActualScore) // tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) @@ -245,7 +245,7 @@ func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDa resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) - ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i) + ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i, 2) tarCont.TimeData = append(tarCont.TimeData, ActualScore) // tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) @@ -263,7 +263,7 @@ func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDa resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) - ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i) + ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i, 2) tarCont.TimeData = append(tarCont.TimeData, ActualScore) // tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, i)) @@ -275,7 +275,7 @@ func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDa resultData := commonus.Decimal(quantification.AuxiliaryCalculationSum(wherStr) / 100) - ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i) + ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, i, 2) tarCont.TimeData = append(tarCont.TimeData, ActualScore) // tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, i)) @@ -284,7 +284,7 @@ func StaticDataOperation(key, group, depart, staticFrame, year string) (staticDa 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) - ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0) + ActualScore, _, _, _, _ := quantification.GetQuantitativeConfig(cv.ReferenceScore, resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0, 2) tarCont.TimeData = append(tarCont.TimeData, ActualScore) // tarCont.TimeData = append(tarCont.TimeData, quantification.GetQuantitativeConfig(resultData, group, depart, v.Id, cv.Id, "0", yserInt, 0)) } diff --git a/gin_server_admin/api/index/statistics/tablestatistics.go b/gin_server_admin/api/index/statistics/tablestatistics.go index 09212be..e43c238 100644 --- a/gin_server_admin/api/index/statistics/tablestatistics.go +++ b/gin_server_admin/api/index/statistics/tablestatistics.go @@ -69,7 +69,8 @@ func (a *ApiGroup) GetPlanVersionValid(c *gin.Context) { var xieCheng dataLockStatistics for _, v := range planVersioCont { //版本列表 syncProcess.Add(1) - go xieCheng.planVersiconProcess(v, requestData) + // go xieCheng.planVersiconProcess(v, requestData) + go xieCheng.planVersiconProcessV1(v, requestData) // return } syncProcess.Wait() @@ -137,8 +138,9 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers } else { isAdd = 2 } + outCont.ManualGear = scoringMethod //获取执行部门及指标性质 - taskId, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(pvInfo.Key, pv.Id, pcv.Id, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10)) + _, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(pvInfo.Key, pv.Id, pcv.Id, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10)) if isDutyErr == nil { outCont.ExecutiveDepartment = departName outCont.Cycles = cycle @@ -173,7 +175,9 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers // monthValueInt, _ := strconv.Atoi(monthValue) var tpsProcess tablePlanVersionStic for i := 1; i <= 4; i++ { - 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, pvInfo.Group, pvInfo.Department, yserInt, i) + // 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, pvInfo.Group, pvInfo.Department, yserInt, i) + + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_quarter` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, i) // 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, pvInfo.Group, pvInfo.Department, yserInt, i) syncProcessDepartTarget.Add(1) go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) @@ -234,7 +238,7 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers // syncProcessDepartTarget.Add(1) // go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) // } - wherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v", taskId, pvInfo.Group, pvInfo.Department, yserInt) + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt) syncProcessDepartTarget.Add(1) go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, 1, pcv.Status, 1, pcv.ReferenceScore) syncProcessDepartTarget.Wait() @@ -272,11 +276,11 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers case 7: //半年 var tpsProcess tablePlanVersionStic //上半年 - firstHalfwherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, []int{1, 2, 3, 4, 5, 6}) + firstHalfwherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, []int{1, 2, 3, 4, 5, 6}) syncProcessDepartTarget.Add(1) go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(firstHalfwherStr, 1, pcv.Status, 1, pcv.ReferenceScore) //下半年 - secondHalfwherStr := fmt.Sprintf("`sf_evaluation_plan` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", taskId, pvInfo.Group, pvInfo.Department, yserInt, []int{7, 8, 9, 10, 11, 12}) + secondHalfwherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, []int{7, 8, 9, 10, 11, 12}) syncProcessDepartTarget.Add(1) go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(secondHalfwherStr, 2, pcv.Status, 1, pcv.ReferenceScore) @@ -322,7 +326,7 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers monthValueInt, _ := strconv.Atoi(monthValue) var tpsProcess tablePlanVersionStic for i := 1; i <= monthValueInt; i++ { - 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, pvInfo.Group, pvInfo.Department, yserInt, i) + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, i) syncProcessDepartTarget.Add(1) go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) } @@ -375,8 +379,10 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers for i := 1; i <= 4; i++ { // fmt.Printf("年--4-->%v--->%v-->%v\n", i, giveData.Year, yserInt) - 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, pvInfo.Group, pvInfo.Department, i) + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_quarter` = %v", pcv.Id, yserInt, pvInfo.Group, pvInfo.Department, 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, yserInt, pvInfo.Group, pvInfo.Department, i) + // fmt.Printf("wherStr----->%v\n", wherStr) + // return syncProcessDepartTarget.Add(1) go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) } @@ -463,7 +469,7 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers // syncProcessDepartTarget.Add(1) // go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) // } - wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v ", taskId, yserInt, pvInfo.Group, pvInfo.Department) + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v ", pcv.Id, yserInt, pvInfo.Group, pvInfo.Department) syncProcessDepartTarget.Add(1) go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 1, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) syncProcessDepartTarget.Wait() @@ -504,12 +510,12 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers case 7: var tpsProcess tablePlanVersionStic //上半年 - wherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` IN %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, []int{1, 2, 3, 4, 5, 6}) + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` IN %v", pcv.Id, yserInt, pvInfo.Group, pvInfo.Department, []int{1, 2, 3, 4, 5, 6}) syncProcessDepartTarget.Add(1) go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 1, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) //下半年 - secondwherStr := fmt.Sprintf("fld_evaluation_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` IN %v", taskId, yserInt, pvInfo.Group, pvInfo.Department, []int{1, 2, 3, 4, 5, 6}) + secondwherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` IN %v", pcv.Id, yserInt, pvInfo.Group, pvInfo.Department, []int{7, 8, 9, 10, 11, 12}) syncProcessDepartTarget.Add(1) go tpsProcess.conditionStatistics(secondwherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 2, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) @@ -558,7 +564,7 @@ func (d *dataLockStatistics) planVersiconProcess(pvInfo assessmentmodel.PlanVers var tpsProcess tablePlanVersionStic for i := 1; i <= monthValueInt; i++ { // fmt.Printf("年--6-->%v--->%v-->%v\n", i, giveData.Year, yserInt) - 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, pvInfo.Group, pvInfo.Department, i) + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_duty_group` = %v AND `fl_duty_department` = %v AND `fl_month` = %v", pcv.Id, yserInt, pvInfo.Group, pvInfo.Department, i) syncProcessDepartTarget.Add(1) go tpsProcess.conditionStatistics(wherStr, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore) } @@ -637,6 +643,78 @@ func (t *tablePlanVersionStic) conditionStatistics(wherStr, group, department, d tableScoreCont.Counter = i var sumScore float64 var departmentAry []int64 //部门ID + // 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(wherStr) + // 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(wherStr) + // gormDb.Pluck("COALESCE(SUM(fld_score), 0) as rescore", &sumScore) + // } + + 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(wherStr) + gormDb.Pluck("COALESCE(SUM(fld_score), 0) as rescore", &sumScore) + + // fmt.Printf("计算得分--3-->%v--->%v-->%v--->%v\n", scoringMethod, wherStr, i, sumScore) + + //获取测评部门 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Select("fl_evaluation_department").Joins("left join flow_log as fl on fl.fl_key = flow_log_data.fld_flow_log").Where(wherStr).Find(&departmentAry) + if len(departmentAry) > 0 { + for _, v := range departmentAry { + whereDepart := commonus.MapOut() + whereDepart["id"] = v + orgContDer, _ := commonus.GetNewOrgCont(whereDepart, "name") + tableScoreCont.ExecutiveDepartment = append(tableScoreCont.ExecutiveDepartment, orgContDer.Name) + } + } + + // fmt.Printf("年--3-->%v--->%v\n", wherStr, yserInt) + //组装数据 + // resultData := commonus.Decimal(sumScore / 100) + resultData := sumScore + tableScoreCont.Class = class + tableScoreCont.ScoreVal = commonus.Decimal(sumScore / 100) + if status != 3 { + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfig(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i, 2) + + // t.TableScore = append(t.TableScore, tableScoreCont) + } else { + tableScoreCont.ActualScore = float64(referenceScore) + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfigEs(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i, 3) + // t.TableScore = append(t.TableScore, tableScoreCont) + } + + if scoringMethod == 2 { + var sumManualScore float64 + 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(wherStr) + gormDb.Pluck("COALESCE(SUM(fld_scoring_score), 0) as rescore", &sumManualScore) + tableScoreCont.ActualScore = sumManualScore / 100 + fmt.Printf("sumManualScore =====> %v\n", sumManualScore) + } + // if sumScore == 0 { + // tableScoreCont.ActualScore = float64(referenceScore) + // } + t.TableScore = append(t.TableScore, tableScoreCont) + // tableScoreCont.ActualScore = commonus.Decimal(tableScoreCont.ActualScore / 100) + syncProcessDepartTarget.Done() + + // type ScoreList struct { + // Class int `json:"class"` //统计类型 + // ScoreVal float64 `json:"scoreval"` //原始值 + // AllPrize float64 `json:"allprize"` //全奖值 + // ZeroPrize float64 `json:"zeroprize"` //零奖值 + // CappingVal float64 `json:"cappingval"` //封顶值 + // ActualScore float64 `json:"actualscore"` //实际得分 + // Achievement float64 `json:"achievement"` //达成率 + // } +} +func (t *tablePlanVersionStic) conditionStatisticsold(wherStr, group, department, dimensionId, targetId string, i, status, scoringMethod, class int, yserInt, referenceScore int64) { + t.mutext.Lock() + defer t.mutext.Unlock() + fmt.Printf("年--3-4->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v--->%v\n", wherStr, group, department, dimensionId, targetId, i, status, scoringMethod, class, yserInt, referenceScore) + var tableScoreCont TableScoreList + tableScoreCont.Counter = i + var sumScore float64 + var departmentAry []int64 //部门ID 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(wherStr) gormDb.Pluck("COALESCE(SUM(fld_scoring_score), 0) as rescore", &sumScore) @@ -665,12 +743,12 @@ func (t *tablePlanVersionStic) conditionStatistics(wherStr, group, department, d tableScoreCont.Class = class tableScoreCont.ScoreVal = commonus.Decimal(sumScore / 100) if status != 3 { - tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfig(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i) + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfig(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i, 2) t.TableScore = append(t.TableScore, tableScoreCont) } else { tableScoreCont.ActualScore = float64(referenceScore) - tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfigEs(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i) + tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = quantification.GetQuantitativeConfigEs(referenceScore, resultData, group, department, dimensionId, targetId, "0", yserInt, i, 2) t.TableScore = append(t.TableScore, tableScoreCont) } @@ -763,11 +841,517 @@ func (t *tablePlanVersionStic) SubjectiveAuxiliaryCalculationSumMethod(wherStr s tableScoreCont.CappingVal = 0 tableScoreCont.ScoreVal = 0 tableScoreCont.Achievement = 0 + tableScoreCont.ScoreVal = resultData if status != 3 { - tableScoreCont.ActualScore = resultData + // fmt.Printf("referenceScore--1--->%v\n", referenceScore) + // tableScoreCont.ActualScore = resultData + if addSumScore == 0 && scoreReduction == 0 { + // fmt.Printf("referenceScore--2--->%v\n", referenceScore) + tableScoreCont.ActualScore = float64(referenceScore) + } else { + // fmt.Printf("referenceScore--3--->%v\n", referenceScore) + deFen := float64(referenceScore) - resultData + if deFen > 0 { + tableScoreCont.ActualScore = deFen + } else { + tableScoreCont.ActualScore = 0 + } + + } } else { tableScoreCont.ActualScore = float64(referenceScore) + // if addSumScore == 0 && scoreReduction == 0 { + // fmt.Printf("referenceScore--2--->%v\n", referenceScore) + // tableScoreCont.ActualScore = float64(referenceScore) + // } else { + // fmt.Printf("referenceScore--3--->%v\n", referenceScore) + // tableScoreCont.ActualScore = resultData + // } + } + // fmt.Printf("referenceScore--4--->%v\n", referenceScore) t.TableScore = append(t.TableScore, tableScoreCont) syncProcessDepartTarget.Done() } + +func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVersio, giveData PlanVersioMingXi) { + d.mutext.Lock() + defer d.mutext.Unlock() + yserInt, _ := strconv.ParseInt(giveData.Year, 10, 64) + // fmt.Printf("年--2-->%v--->%v\n", giveData.Year, yserInt) + if pvInfo.Content != "" { + //当版本内容不为空时 + var planInfo []AddDutyNewCont + jsonErr := json.Unmarshal([]byte(pvInfo.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(pvInfo.Id, 10) + //集团信息 + outCont.Group = strconv.FormatInt(pvInfo.Group, 10) + where := commonus.MapOut() + where["id"] = pvInfo.Group + orgCont, _ := commonus.GetNewOrgCont(where, "id", "name") + outCont.GroupName = orgCont.Name + //接受考核部门 + outCont.DepartmentId = strconv.FormatInt(pvInfo.Department, 10) + whereDepart := commonus.MapOut() + whereDepart["id"] = pvInfo.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 + targetGormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Select("et_type,et_scoring_method,et_title").Where("`et_id` = ?", pcv.Id) + if giveData.Title != "" { + targetGormDb = targetGormDb.Where("et_title LIKE ?", "%"+giveData.Title+"%") + } + if giveData.Class != 0 { + targetGormDb = targetGormDb.Where("et_type = ?", giveData.Class) + } + isAdd := 1 + evalErr := targetGormDb.First(&evalTargerCont).Error + scoringMethod := 1 + if evalErr == nil { + outCont.Type = evalTargerCont.Type + scoringMethod = evalTargerCont.ScoringMethod + isAdd = 1 + } else { + isAdd = 2 + } + outCont.ManualGear = scoringMethod + //获取执行部门及指标性质 + qualEvalId, _, departName, cycle, cycleattr, isDuty, isDutyErr := getDepartTarget(pvInfo.Key, pv.Id, pcv.Id, strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10)) + + fmt.Printf("qualEvalId----------->%v----------->departName----------->%v----------->cycle----------->%v----------->cycleattr----------->%v----------->isDuty----------->%v----------->isDutyErr----------->%v\n", qualEvalId, departName, cycle, cycleattr, isDuty, isDutyErr) + + if isDutyErr == nil { + outCont.ExecutiveDepartment = departName + outCont.Cycles = cycle + outCont.CycleAttres = cycleattr + if isDuty != 0 { + outCont.Type = isDuty + } + } else { + var evalTargerCont assessmentmodel.EvaluationTarget + evalErr := global.GVA_DB_Performanceappraisal.Where("`et_id` = ?", pcv.Id).First(&evalTargerCont).Error + if evalErr == nil { + outCont.Cycles = evalTargerCont.Cycles + outCont.CycleAttres = evalTargerCont.CycleAttres + } + isDuty = 2 + } + // fmt.Printf("taskId--->%v--->yyyy--->%v--->departName--->%v--->cycle--->%v--->cycleattr--->%v--->isDuty--->%v--->isDutyErr--->%v\n", taskId, yyyy, departName, cycle, cycleattr, isDuty, isDutyErr) + // panic(isDutyErr) + var stccStatistics ScoreListAry + stccStatistics.Class = isDuty + if isDuty == 1 { + //定性考核 + switch cycle { + case 1: + case 2: //天 + case 3: + case 5: //季度 + + var tpsProcess tablePlanVersionStic + for i := 1; i <= 4; i++ { + // 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, pvInfo.Group, pvInfo.Department, yserInt, i) + + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_quarter` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, i) + // 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, pvInfo.Group, pvInfo.Department, yserInt, i) + syncProcessDepartTarget.Add(1) + go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) + } + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + for _, rsdv := range readStatisticsData { + + // for ik := 0; ik <= 1; ik++ { + // var jiSuanZhiBuLing ScoreList + // outCont.Score = append(outCont.Score, jiSuanZhiBuLing) + // stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, 0) + // stccStatistics.AllPrize = append(stccStatistics.AllPrize, 0) + // stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, 0) + // stccStatistics.CappingVal = append(stccStatistics.CappingVal, 0) + // stccStatistics.ActualScore = append(stccStatistics.ActualScore, 0) + // stccStatistics.Achievement = append(stccStatistics.Achievement, 0) + // } + + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + case 6: //年 + // monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + // if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { + // monthValue = "12" + // } + // monthValueInt, _ := strconv.Atoi(monthValue) + var tpsProcess tablePlanVersionStic + // for i := 1; i <= monthValueInt; i++ { + // 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, pvInfo.Group, pvInfo.Department, yserInt, i) + // syncProcessDepartTarget.Add(1) + // go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) + // } + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt) + syncProcessDepartTarget.Add(1) + go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, 1, pcv.Status, 1, pcv.ReferenceScore) + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + case 7: //半年 + var tpsProcess tablePlanVersionStic + //上半年 + firstHalfwherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, []int{1, 2, 3, 4, 5, 6}) + syncProcessDepartTarget.Add(1) + go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(firstHalfwherStr, 1, pcv.Status, 1, pcv.ReferenceScore) + //下半年 + secondHalfwherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` IN %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, []int{7, 8, 9, 10, 11, 12}) + syncProcessDepartTarget.Add(1) + go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(secondHalfwherStr, 2, pcv.Status, 1, pcv.ReferenceScore) + + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + + default: //月 + monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { + monthValue = "12" + } + monthValueInt, _ := strconv.Atoi(monthValue) + var tpsProcess tablePlanVersionStic + for i := 1; i <= monthValueInt; i++ { + wherStr := fmt.Sprintf("`sf_target_id` = %v AND `sf_duty_group` = %v AND `sf_duty_department` = %v AND `sf_year` = %v AND `sf_month` = %v", pcv.Id, pvInfo.Group, pvInfo.Department, yserInt, i) + syncProcessDepartTarget.Add(1) + go tpsProcess.SubjectiveAuxiliaryCalculationSumMethod(wherStr, i, pcv.Status, 1, pcv.ReferenceScore) + } + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + } + } else { + //定量考核 + switch cycle { + case 1: + case 2: //天 + case 3: + case 5: //季度 + + var tpsProcess tablePlanVersionStic + for i := 1; i <= 4; i++ { + + syncProcessDepartTarget.Add(1) + go tpsProcess.conditionStatisticsNew(strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore, 5, 2) + } + + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + + for _, rsdv := range readStatisticsData { + + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + case 6: //年 + + var tpsProcess tablePlanVersionStic + + syncProcessDepartTarget.Add(1) + + go tpsProcess.conditionStatisticsNew(strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 1, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore, 6, 2) + + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + case 7: + var tpsProcess tablePlanVersionStic + //上半年 + syncProcessDepartTarget.Add(1) + go tpsProcess.conditionStatisticsNew(strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 1, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore, 7, 2) + + //下半年 + syncProcessDepartTarget.Add(1) + go tpsProcess.conditionStatisticsNew(strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, 3, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore, 6, 2) + + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + // jsonVal, jsonErr := json.Marshal(readStatisticsData) + // fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr) + + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + + default: //月 + monthValue := commonus.TimeStampToDate(time.Now().Unix(), 12) + if commonus.TimeStampToDate(time.Now().Unix(), 11) != giveData.Year { + monthValue = "12" + } + monthValueInt, _ := strconv.Atoi(monthValue) + var tpsProcess tablePlanVersionStic + for i := 1; i <= monthValueInt; i++ { + syncProcessDepartTarget.Add(1) + go tpsProcess.conditionStatisticsNew(strconv.FormatInt(pvInfo.Group, 10), strconv.FormatInt(pvInfo.Department, 10), pv.Id, pcv.Id, i, pcv.Status, scoringMethod, 2, yserInt, pcv.ReferenceScore, 4, 2) + } + syncProcessDepartTarget.Wait() + readStatisticsData := tpsProcess.readMyDayData() + //按照最大值排序 + sort.Slice(readStatisticsData, func(i int, j int) bool { + return readStatisticsData[i].Counter < readStatisticsData[j].Counter + }) + // jsonVal, jsonErr := json.Marshal(readStatisticsData) + // fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr) + + for _, rsdv := range readStatisticsData { + var jiSuanZhi ScoreList + jiSuanZhi.Class = rsdv.Class + jiSuanZhi.ScoreVal = rsdv.ScoreVal + jiSuanZhi.ActualScore = rsdv.ActualScore + jiSuanZhi.AllPrize = rsdv.AllPrize + jiSuanZhi.ZeroPrize = rsdv.ZeroPrize + jiSuanZhi.CappingVal = rsdv.CappingVal + jiSuanZhi.Achievement = rsdv.Achievement + + outCont.Score = append(outCont.Score, jiSuanZhi) + if len(rsdv.ExecutiveDepartment) > 0 { //写入执行考核的部门 + for _, edv := range rsdv.ExecutiveDepartment { + if commonus.IsItTrueString(edv, outCont.ExecutiveDepartment) == false { + outCont.ExecutiveDepartment = append(outCont.ExecutiveDepartment, edv) + } + } + } + + stccStatistics.ScoreVal = append(stccStatistics.ScoreVal, rsdv.ScoreVal) + stccStatistics.AllPrize = append(stccStatistics.AllPrize, rsdv.AllPrize) + stccStatistics.ZeroPrize = append(stccStatistics.ZeroPrize, rsdv.ZeroPrize) + stccStatistics.CappingVal = append(stccStatistics.CappingVal, rsdv.CappingVal) + stccStatistics.ActualScore = append(stccStatistics.ActualScore, rsdv.ActualScore) + stccStatistics.Achievement = append(stccStatistics.Achievement, rsdv.Achievement) + } + } + } + outCont.ScoreAllList = append(outCont.ScoreAllList, stccStatistics) + outCont.StatisticsName = []string{"全奖值", "零奖值", "实际值", "达成率", "得分"} + if isAdd == 1 { + d.outData = append(d.outData, outCont) + } + + } + } + } + } + } else { + //当版本内容为空时 + } + syncProcess.Done() +} diff --git a/gin_server_admin/api/reply/quan/enter.go b/gin_server_admin/api/reply/quan/enter.go index af57194..962c4b9 100644 --- a/gin_server_admin/api/reply/quan/enter.go +++ b/gin_server_admin/api/reply/quan/enter.go @@ -30,6 +30,7 @@ type RationLogList struct { // Score int64 `json:"score` Actual string `json:"actual` Unit string `json:"unit` + Target string `json:"target` TargetName string `json:"targetname"` //原因 Reason string `json:"reason"` //原因 Enclosure []string `json:"enclosure"` //附件 @@ -59,3 +60,12 @@ type TimeAllDay struct { Week int64 `json:"week"` //周"` ToDay int64 `json:"today"` //天"` } + +//定量流水全奖值、零奖值、封顶值 +type FlowLogAllZreo struct { + Id string `json:"id"` + TargetId string `json:"targetid"` //指标ID` + Zeroprize float64 `json:"zeroprize"` //零奖值"` + Allprize float64 `json:"allprize"` //全奖值"` + Capping float64 `json:"capping"` //封顶值"` +} diff --git a/gin_server_admin/api/reply/quan/ration.go b/gin_server_admin/api/reply/quan/ration.go index 8e37c63..af40c47 100644 --- a/gin_server_admin/api/reply/quan/ration.go +++ b/gin_server_admin/api/reply/quan/ration.go @@ -475,8 +475,35 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { // jsonMapStr, _ := json.Marshal(requestData.List) json.Marshal(requestData.List) //fmt.Printf("OutJsonMap-----1------>%\n", string(jsonMapStr)) + var allZreoConfig []FlowLogAllZreo for i, v := range requestData.List { + var allZreoConfigInfo FlowLogAllZreo + allZreoConfigInfo.Id = v.Id + allZreoConfigInfo.TargetId = v.Target + + targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(v.Id) + tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) + switch targetInfo.Cycles { + case 5: + qualConfig, _ := commonus.GetDingLiangMuBiao(dutyGroup, departIdInt, targetInfo.Dimension, targetInfo.Target, allTimeSet.Year, allTimeSet.Quarter) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + case 6: + qualConfig, _ := commonus.GetDingLiangMuBiao(dutyGroup, departIdInt, targetInfo.Dimension, targetInfo.Target, allTimeSet.Year, 1) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + default: + qualConfig, _ := commonus.GetDingLiangMuBiao(dutyGroup, departIdInt, targetInfo.Dimension, targetInfo.Target, allTimeSet.Year, allTimeSet.Month) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + } + + allZreoConfig = append(allZreoConfig, allZreoConfigInfo) + if len(evaluationIdStrAry) > 0 { if commonus.IsItTrueString(v.Id, evaluationIdStrAry) == false { var flowDataLog assessmentmodel.FlowLogData @@ -491,15 +518,15 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") if v.ScoringMethod == 2 { flowDataLog.ScoringMethod = 2 - flowDataLog.ScoringScore = v.ScoringScore + flowDataLog.ScoringScore = v.ScoringScore * 100 } else { 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) + + // tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if i == 0 { if targetInfoErr == true { if v.Reason != "" { @@ -524,6 +551,9 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { flowDataLog.Month = allTimeSet.Month flowDataLog.Week = allTimeSet.Week flowDataLog.ToDay = allTimeSet.ToDay + targetId, _ := strconv.ParseInt(v.Target, 10, 64) + flowDataLog.TargetId = targetId + flowDataLogAry = append(flowDataLogAry, flowDataLog) } else { yiTianJianMingc = append(yiTianJianMingc, v.TargetName) @@ -539,17 +569,18 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { flowDataLog.Score = commonus.GetDuyCycle(v.Actual, 100) flowDataLog.Content = v.Reason flowDataLog.Enclosure = strings.Join(v.Enclosure, ",") + // fmt.Printf("v.ScoringMethod ----->%v\n", v.ScoringMethod) if v.ScoringMethod == 2 { flowDataLog.ScoringMethod = 2 - flowDataLog.ScoringScore = v.ScoringScore + flowDataLog.ScoringScore = v.ScoringScore * 100 } 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) + // targetInfo, targetInfoErr := commonus.GetQualitativeEvaluation(strconv.FormatInt(evaluationPlanid, 10)) + // tarInfo, _ := commonus.GetTargetInfo(targetInfo.Target) if i == 0 { if targetInfoErr == true { if v.Reason != "" { @@ -575,18 +606,23 @@ func (a *ApiGroup) SendRationFlow(c *gin.Context) { flowDataLog.Month = allTimeSet.Month flowDataLog.Week = allTimeSet.Week flowDataLog.ToDay = allTimeSet.ToDay - + targetId, _ := strconv.ParseInt(v.Target, 10, 64) + flowDataLog.TargetId = targetId flowDataLogAry = append(flowDataLogAry, flowDataLog) } } gromDb := global.GVA_DB_Performanceappraisal.Begin() - + baselineJson, _ := json.Marshal(allZreoConfig) + flowLog.Baseline = string(baselineJson) flowLog.EvaluationPlan = strings.Join(evaluationPlan, ",") if len(flowDataLogAry) <= 0 { response.Result(0, yiTianJianMingc, "您的数据已经提交!请不要重复提交!", c) return } + // jsonCont, _ := json.Marshal(flowDataLogAry) + // fmt.Printf("flowDataLogAry=>%v\n", string(jsonCont)) + // return addFlowLogErr := gromDb.Create(&flowLog).Error addFlowLogDataErr := gromDb.Create(&flowDataLogAry).Error if addFlowLogErr == nil && addFlowLogDataErr == nil { diff --git a/gin_server_admin/api/statistics/quantification/departmentstatisc.go b/gin_server_admin/api/statistics/quantification/departmentstatisc.go index 1acfccb..a29a507 100644 --- a/gin_server_admin/api/statistics/quantification/departmentstatisc.go +++ b/gin_server_admin/api/statistics/quantification/departmentstatisc.go @@ -124,7 +124,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData switch statisticalMethod { case 1: // sumScore, _ := AverageOfSum(wherStr) - normNameTotal := fmt.Sprintf("%v%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -158,7 +158,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData default: //合计与平均 // sumScore, averageScore := AverageOfSum(wherStr, 1) - normNameTotal := fmt.Sprintf("%v%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -206,7 +206,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData switch statisticalMethod { case 1: // sumScore, _ := AverageOfSum(wherStr) - normNameTotal := fmt.Sprintf("%v %v总值", tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -240,7 +240,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData default: //合计与平均 // sumScore, averageScore := AverageOfSum(wherStr, 1) - normNameTotal := fmt.Sprintf("%v %v总值", tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -292,7 +292,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData switch statisticalMethod { case 1: // sumScore, _ := AverageOfSum(wherStr) - normNameTotal := fmt.Sprintf("%v第%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v第%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -326,7 +326,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData default: //合计与平均 // sumScore, averageScore := AverageOfSum(wherStr, 1) - normNameTotal := fmt.Sprintf("%v第%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v第%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -378,7 +378,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData switch statisticalMethod { case 1: // sumScore, _ := AverageOfSum(wherStr) - normNameTotal := fmt.Sprintf("%v年%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v年%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -412,7 +412,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData default: //合计与平均 // sumScore, averageScore := AverageOfSum(wherStr, 1) - normNameTotal := fmt.Sprintf("%v年%v %v总值", dayv, tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v年%v %v", dayv, tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -462,7 +462,7 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData switch statisticalMethod { case 1: // sumScore, _ := AverageOfSum(wherStr) - normNameTotal := fmt.Sprintf("%v %v总值", tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series @@ -496,7 +496,536 @@ func OrgDimensionStatistics(taskId string, dataAry natureParameter) (outputData default: //合计与平均 // sumScore, averageScore := AverageOfSum(wherStr, 1) - normNameTotal := fmt.Sprintf("%v %v总值", tv.XLine, normName) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v %v平均值", tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + + } + } + } + } + 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) + // tjn, tje := json.Marshal(timeFrame) + // fmt.Printf("timeFrameJson-====>%v-====>%v\n", string(tjn), tje) + // fmt.Printf("normName-====>%v\n", normName) + // fmt.Printf("statisticalMethod-====>%v\n", statisticalMethod) + + return +} +func OrgDimensionStatisticsNew(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) { + //当同时查询多个指标时启用 获取指标名称 + outErr = true + var normName string = "" + norm := 1 //1:定性考核;2:定量考核 + // if len(dataAry.TargetId) > 1 { + //当同时查询多个指标时启用 获取指标名称 + // var qualEvalCont assessmentmodel.QualitativeEvaluation + // qualEvaWhe := commonus.MapOut() + // qualEvaWhe["qe_id"] = taskId + // qualEvalCont.GetCont(qualEvaWhe, "qe_target", "qe_type") + // taskCont, taskErr := commonus.GetTargetIn + taskIdInt, _ := strconv.ParseInt(taskId, 10, 64) + taskCont, taskErr := commonus.GetTargetInfo(taskIdInt) + if taskErr == true { + normName = taskCont.Title + outErr = taskErr + norm = taskCont.Type + } else { + // outErr = error.Error("此考核项目没有数据!") + outErr = taskErr + return + } + // } + + //获取时间参数 + timeFrame := EstimatedTime(dataAry) + //获取组织架构参数 + // orgAry, orgList := getGroupOrgList(dataAry.Org) + //获取组织架构参数 + // var orgAry []orgModelsAry + var orgList []orgModels + if len(dataAry.Org) > 0 { + _, orgList = getGroupOrgList(dataAry.Org) + } else { + _, orgList = getGroupOrgList(GetTargerDepartment(taskCont.Dimension, taskIdInt)) + } + //统计方式 + statisticalMethod := 3 + if len(dataAry.AccMethod) == 1 { + if commonus.IsItTrueInt(1, dataAry.AccMethod) == true { + statisticalMethod = 1 + } else { + statisticalMethod = 2 + } + } + + for _, v := range orgList { + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, v.SunOrg).Find(&taskIdAry) + + orgvSunOrg := "(" + for tiai, tiav := range v.SunOrg { + if tiai != 0 { + orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav) + } else { + orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav) + } + } + orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg) + // //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + + if commonus.IsItTrueString(v.Name, outputData.XLine) == false { + outputData.XLine = append(outputData.XLine, v.Name) + for _, tv := range timeFrame { //在部门维度下进行时间跨度计算 + switch tv.Class { + case 1: //半年 + + //组合月 + monthStr := "(" + for twi, twv := range tv.Where { + if twi != 0 { + monthStr = fmt.Sprintf("%v,%v", monthStr, twv) + } else { + monthStr = fmt.Sprintf("%v%v", monthStr, twv) + } + + } + monthStr = fmt.Sprintf("%v)", monthStr) + if len(dataAry.Year) > 0 { + for _, dayv := range dataAry.Year { + var sumScore float64 + var averageScore float64 + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department IN %v", taskIdInt, dayv, monthStr, orgvSunOrg) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department IN %v", taskIdInt, dayv, monthStr, orgvSunOrg) + sumScore, averageScore = AverageOfSum(wherStr) + + } + //判断计算总值还是平均值 + switch statisticalMethod { + case 1: + // sumScore, _ := AverageOfSum(wherStr) + normNameTotal := fmt.Sprintf("%v%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + // _, averageScore := AverageOfSum(wherStr, 1) + normNameAverage := fmt.Sprintf("%v%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + // sumScore, averageScore := AverageOfSum(wherStr, 1) + normNameTotal := fmt.Sprintf("%v%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } else { + var sumScore float64 + var averageScore float64 + yearVal := commonus.ComputingTime(time.Now().Unix(), 1) + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg) + sumScore, averageScore = AverageOfSum(wherStr) + } + //判断计算总值还是平均值 + switch statisticalMethod { + case 1: + // sumScore, _ := AverageOfSum(wherStr) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + // _, averageScore := AverageOfSum(wherStr, 1) + normNameAverage := fmt.Sprintf("%v %v平均值", tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + // sumScore, averageScore := AverageOfSum(wherStr, 1) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v %v平均值", tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + + case 2: //季度 + for _, dayv := range dataAry.Year { + var sumScore float64 + var averageScore float64 + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department IN %v", taskIdInt, dayv, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department IN %v", taskIdInt, dayv, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSum(wherStr) + + } + // } + //判断计算总值还是平均值 + switch statisticalMethod { + case 1: + // sumScore, _ := AverageOfSum(wherStr) + normNameTotal := fmt.Sprintf("%v第%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + // _, averageScore := AverageOfSum(wherStr, 1) + normNameAverage := fmt.Sprintf("%v第%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + // sumScore, averageScore := AverageOfSum(wherStr, 1) + normNameTotal := fmt.Sprintf("%v第%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v第%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + case 3: //月 + for _, dayv := range dataAry.Year { + var sumScore float64 + var averageScore float64 + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department IN %v", taskIdInt, dayv, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department IN %v", taskIdInt, dayv, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSum(wherStr) + + } + // } + //判断计算总值还是平均值 + switch statisticalMethod { + case 1: + // sumScore, _ := AverageOfSum(wherStr) + normNameTotal := fmt.Sprintf("%v年%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + // _, averageScore := AverageOfSum(wherStr, 1) + normNameAverage := fmt.Sprintf("%v年%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + // sumScore, averageScore := AverageOfSum(wherStr, 1) + normNameTotal := fmt.Sprintf("%v年%v %v", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v年%v %v平均值", dayv, tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + default: //全年 + var sumScore float64 + var averageScore float64 + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND sf_duty_department IN %v", taskIdInt, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND fl_duty_department IN %v", taskIdInt, tv.YearName, orgvSunOrg) + sumScore, averageScore = AverageOfSum(wherStr) + } + // } + //判断计算总值还是平均值 + switch statisticalMethod { + case 1: + // sumScore, _ := AverageOfSum(wherStr) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + // _, averageScore := AverageOfSum(wherStr, 1) + normNameAverage := fmt.Sprintf("%v %v平均值", tv.XLine, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + // sumScore, averageScore := AverageOfSum(wherStr, 1) + normNameTotal := fmt.Sprintf("%v %v", tv.XLine, normName) if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) var seriesInfo series diff --git a/gin_server_admin/api/statistics/quantification/jisuanshuzhi.go b/gin_server_admin/api/statistics/quantification/jisuanshuzhi.go index cd99d4e..a770fd4 100644 --- a/gin_server_admin/api/statistics/quantification/jisuanshuzhi.go +++ b/gin_server_admin/api/statistics/quantification/jisuanshuzhi.go @@ -67,71 +67,52 @@ func AverageOfSumNature(where interface{}, class ...int) (sumScore float64, aver func (d *dataLockStatistics) StatisticalQueryCriteria(qualId int64) { d.mutext.Lock() defer d.mutext.Unlock() - var flowLogList []assessmentmodel.FlowLog - floLogErr := global.GVA_DB_Performanceappraisal.Where("FIND_IN_SET(?,`fl_evaluation_id`)", qualId).Find(&flowLogList).Error - if floLogErr == nil { - for _, fv := range flowLogList { - // fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10) - // if commonus.IsItTrueString(fvDepartId, d.accDepart) == false { - // d.accDepart = append(d.accDepart, fvDepartId) - // } - yearStr := strconv.FormatInt(int64(fv.Year), 10) - if commonus.IsItTrueString(yearStr, d.YearTime) == false { - d.YearTime = append(d.YearTime, yearStr) - } - //判断组织架构是否有数据 - if len(d.OrgMap) > 0 { - for oi, ov := range d.OrgMap { - //判断公司是否已经存在 - if ov.Id == strconv.FormatInt(fv.DutyGroup, 10) { - //判断是否有分厂数据 - if len(ov.Child) > 0 { - isYes := true - for _, dv := range ov.Child { - if dv.Id == strconv.FormatInt(fv.DutyDepartment, 10) { - isYes = false //该部门分厂已经存在 - } - } - if isYes == true { - //该部门分厂不存在是添加 - //写入部门 - whereDepart := commonus.MapOut() - whereDepart["id"] = fv.DutyDepartment - orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") - if orgDepartErr == nil { - var orgDepartMapCont orgModels - orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) - orgDepartMapCont.Name = orgDepartCont.Name - d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) - } - } - } else { - //没有分厂数据,根据上级数据进行新增 - if fv.DutyDepartment != 0 { - //写入部门 - whereDepart := commonus.MapOut() - whereDepart["id"] = fv.DutyDepartment - orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") - if orgDepartErr == nil { - var orgDepartMapCont orgModels - orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) - orgDepartMapCont.Name = orgDepartCont.Name - d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) - } - } - } - } else { - if fv.DutyGroup != 0 { - //写入集团信息 - where := commonus.MapOut() - where["id"] = fv.DutyGroup - orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") - if orgGroupErr == nil { - var orgMapCont orgModelsAry - orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) - orgMapCont.Name = orgGroupCont.Name + var flKey []int64 + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Distinct("fld_flow_log").Select("fld_flow_log").Where("fld_target_id = ?", qualId).Find(&flKey) + if len(flKey) > 0 { + var flowLogList []assessmentmodel.FlowLog + // floLogErr := global.GVA_DB_Performanceappraisal.Where("FIND_IN_SET(?,`fl_evaluation_id`)", qualId).Find(&flowLogList).Error + floLogErr := global.GVA_DB_Performanceappraisal.Where("fl_key IN ?", flKey).Find(&flowLogList).Error + if floLogErr == nil { + for _, fv := range flowLogList { + // fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10) + // if commonus.IsItTrueString(fvDepartId, d.accDepart) == false { + // d.accDepart = append(d.accDepart, fvDepartId) + // } + yearStr := strconv.FormatInt(int64(fv.Year), 10) + if commonus.IsItTrueString(yearStr, d.YearTime) == false { + d.YearTime = append(d.YearTime, yearStr) + } + //判断组织架构是否有数据 + if len(d.OrgMap) > 0 { + for oi, ov := range d.OrgMap { + //判断公司是否已经存在 + if ov.Id == strconv.FormatInt(fv.DutyGroup, 10) { + //判断是否有分厂数据 + if len(ov.Child) > 0 { + isYes := true + for _, dv := range ov.Child { + if dv.Id == strconv.FormatInt(fv.DutyDepartment, 10) { + isYes = false //该部门分厂已经存在 + } + } + if isYes == true { + //该部门分厂不存在是添加 + //写入部门 + whereDepart := commonus.MapOut() + whereDepart["id"] = fv.DutyDepartment + orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") + if orgDepartErr == nil { + var orgDepartMapCont orgModels + orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) + orgDepartMapCont.Name = orgDepartCont.Name + d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) + } + } + } else { + //没有分厂数据,根据上级数据进行新增 if fv.DutyDepartment != 0 { //写入部门 whereDepart := commonus.MapOut() @@ -141,42 +122,68 @@ func (d *dataLockStatistics) StatisticalQueryCriteria(qualId int64) { var orgDepartMapCont orgModels orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) orgDepartMapCont.Name = orgDepartCont.Name - orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) + d.OrgMap[oi].Child = append(d.OrgMap[oi].Child, orgDepartMapCont) } } - d.OrgMap = append(d.OrgMap, orgMapCont) } + } else { + if fv.DutyGroup != 0 { + //写入集团信息 + where := commonus.MapOut() + where["id"] = fv.DutyGroup + orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") + if orgGroupErr == nil { + var orgMapCont orgModelsAry + orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) + orgMapCont.Name = orgGroupCont.Name + + if fv.DutyDepartment != 0 { + //写入部门 + whereDepart := commonus.MapOut() + whereDepart["id"] = fv.DutyDepartment + orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") + if orgDepartErr == nil { + var orgDepartMapCont orgModels + orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) + orgDepartMapCont.Name = orgDepartCont.Name + orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) + } + } + d.OrgMap = append(d.OrgMap, orgMapCont) + } + + } } } - } - } else { - //没有数据的时候根据数值进行新增 - if fv.DutyGroup != 0 { - //写入集团信息 - where := commonus.MapOut() - where["id"] = fv.DutyGroup - orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") - if orgGroupErr == nil { - var orgMapCont orgModelsAry - orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) - orgMapCont.Name = orgGroupCont.Name + } else { + //没有数据的时候根据数值进行新增 + if fv.DutyGroup != 0 { + //写入集团信息 + where := commonus.MapOut() + where["id"] = fv.DutyGroup + orgGroupCont, orgGroupErr := commonus.GetNewOrgCont(where, "name") + if orgGroupErr == nil { + var orgMapCont orgModelsAry + orgMapCont.Id = strconv.FormatInt(fv.DutyGroup, 10) + orgMapCont.Name = orgGroupCont.Name - if fv.DutyDepartment != 0 { - //写入部门 - whereDepart := commonus.MapOut() - whereDepart["id"] = fv.DutyDepartment - orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") - if orgDepartErr == nil { - var orgDepartMapCont orgModels - orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) - orgDepartMapCont.Name = orgDepartCont.Name - orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) + if fv.DutyDepartment != 0 { + //写入部门 + whereDepart := commonus.MapOut() + whereDepart["id"] = fv.DutyDepartment + orgDepartCont, orgDepartErr := commonus.GetNewOrgCont(whereDepart, "name") + if orgDepartErr == nil { + var orgDepartMapCont orgModels + orgDepartMapCont.Id = strconv.FormatInt(fv.DutyDepartment, 10) + orgDepartMapCont.Name = orgDepartCont.Name + orgMapCont.Child = append(orgMapCont.Child, orgDepartMapCont) + } } + d.OrgMap = append(d.OrgMap, orgMapCont) } - d.OrgMap = append(d.OrgMap, orgMapCont) - } + } } } } @@ -189,7 +196,8 @@ func (d *dataLockStatistics) StatisticalQueryCriteriaXin(qualId int64) { defer d.mutext.Unlock() // fmt.Printf("%v----------1--3--------%v\n", qualId, qualId) var flowLogList []assessmentmodel.ScoreFlow - floLogErr := global.GVA_DB_Performanceappraisal.Where("sf_evaluation_plan = ?", qualId).Find(&flowLogList).Error + // floLogErr := global.GVA_DB_Performanceappraisal.Where("sf_evaluation_plan = ?", qualId).Find(&flowLogList).Error + floLogErr := global.GVA_DB_Performanceappraisal.Where("sf_target_id = ?", qualId).Find(&flowLogList).Error if floLogErr == nil { for _, fv := range flowLogList { // fvDepartId := strconv.FormatInt(fv.DutyDepartment, 10) diff --git a/gin_server_admin/api/statistics/quantification/quant.go b/gin_server_admin/api/statistics/quantification/quant.go index 98c7c67..74e2717 100644 --- a/gin_server_admin/api/statistics/quantification/quant.go +++ b/gin_server_admin/api/statistics/quantification/quant.go @@ -39,35 +39,36 @@ func (a *ApiGroup) GetQuantEChartOrgAndYear(c *gin.Context) { targetInfoErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationTarget{}).Select("et_type,et_dimension").Where("et_id = ?", v).First(&targetInfoAry).Error if targetInfoErr == nil { - var taskIdAry []int64 - global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? ", targetInfoAry.Dimension, v).Find(&taskIdAry) - // fmt.Printf("%v----------1-----------%v\n", len(taskIdAry), taskIdAry) + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? ", targetInfoAry.Dimension, v).Find(&taskIdAry) + // fmt.Printf("%v----------1----@--->%v----%v\n", len(taskIdAry), targetInfoAry.Type, taskIdAry) // panic(taskIdAry) - if len(taskIdAry) > 0 { - - var timeOrDemper dataLockStatistics - for _, rikv := range taskIdAry { - - if targetInfoAry.Type == 1 { - //定性考核 - // fmt.Printf("%v----------1--1--------%v\n", len(taskIdAry), rikv) - synergeticProcess.Add(1) - go timeOrDemper.StatisticalQueryCriteriaXin(rikv) - } else { - //定量考核 - synergeticProcess.Add(1) - go timeOrDemper.StatisticalQueryCriteria(rikv) - } - } - synergeticProcess.Wait() - orgMapGo, yearTimeGo := timeOrDemper.readDataLock() - for _, gtv := range yearTimeGo { - if commonus.IsInTrue[string](gtv, yearTime) == false { - yearTime = append(yearTime, gtv) - } + // if len(taskIdAry) > 0 { + + var timeOrDemper dataLockStatistics + // for _, rikv := range taskIdAry { + targetId, _ := strconv.ParseInt(v, 10, 64) + if targetInfoAry.Type == 1 { + //定性考核 + // fmt.Printf("%v----------1--1--------%v\n", len(taskIdAry), rikv) + synergeticProcess.Add(1) + go timeOrDemper.StatisticalQueryCriteriaXin(targetId) + } else { + //定量考核 + // fmt.Printf("%v----------1--2--------%v\n", len(taskIdAry), rikv) + synergeticProcess.Add(1) + go timeOrDemper.StatisticalQueryCriteria(targetId) + } + // } + synergeticProcess.Wait() + orgMapGo, yearTimeGo := timeOrDemper.readDataLock() + for _, gtv := range yearTimeGo { + if commonus.IsInTrue[string](gtv, yearTime) == false { + yearTime = append(yearTime, gtv) } - orgMapGuodu = append(orgMapGuodu, orgMapGo...) } + orgMapGuodu = append(orgMapGuodu, orgMapGo...) + // } } @@ -130,7 +131,8 @@ func (a *ApiGroup) QuantEChart(c *gin.Context) { for _, v := range requestData.TargetId { if requestData.AnalysisAngle == 1 { - getStatistics, gstErr := OrgDimensionStatistics(v, requestData) + // getStatistics, gstErr := OrgDimensionStatistics(v, requestData) + getStatistics, gstErr := OrgDimensionStatisticsNew(v, requestData) outMap["TimeDimension_"+v] = getStatistics if gstErr == true { for _, gsv := range getStatistics.XLine { @@ -152,7 +154,8 @@ func (a *ApiGroup) QuantEChart(c *gin.Context) { } } else { //时间维度 - getStatistics, gstErr := TimeDimensionStatistics(v, requestData) + // getStatistics, gstErr := TimeDimensionStatistics(v, requestData) + getStatistics, gstErr := TimeDimensionStatisticsNew(v, requestData) outMap["TimeDimension_"+v] = getStatistics if gstErr == true { for _, gsv := range getStatistics.XLine { @@ -445,6 +448,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel @deaTarget 细则 @year 年份 @timecopy 辅助计数 +@typeClass 1:定性;2:定量 返回说明 @scoreVal 计算得分 @@ -453,7 +457,7 @@ func getGroupOrg(orgAry []string) (orgMap []orgModelsAry, orgWherList []orgModel @CappingVal 封顶值 @achievement 达成率 */ -func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { +func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy, typeClass int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { scoreVal = 0 allPrize = 0 zeroPrize = 0 @@ -475,7 +479,7 @@ func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, return } - scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal) + scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal, typeClass) return @@ -539,6 +543,7 @@ func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, @deaTarget 细则 @year 年份 @timecopy 辅助计数 +@typeClass 1:定性;2:定量 返回说明 @scoreVal 计算得分 @@ -547,7 +552,7 @@ func GetQuantitativeConfig(targetScore int64, resultval float64, group, depart, @CappingVal 封顶值 @achievement 达成率 */ -func GetQuantitativeConfigEs(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { +func GetQuantitativeConfigEs(targetScore int64, resultval float64, group, depart, dimen, target, deaTarget string, year int64, timecopy int, typeClass int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { allPrize = 0 zeroPrize = 0 CappingVal = 0 @@ -565,7 +570,7 @@ func GetQuantitativeConfigEs(targetScore int64, resultval float64, group, depart return } - scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal) + scoreVal, allPrize, zeroPrize, CappingVal, achievement = commonus.CalculateScore(targetScore, resultval, qualConfig.Allprize, qualConfig.Zeroprize, qualConfig.CappingVal, typeClass) return diff --git a/gin_server_admin/api/statistics/quantification/timestatistics.go b/gin_server_admin/api/statistics/quantification/timestatistics.go index 961451a..94bb9da 100644 --- a/gin_server_admin/api/statistics/quantification/timestatistics.go +++ b/gin_server_admin/api/statistics/quantification/timestatistics.go @@ -1021,3 +1021,1003 @@ func GetTargerDepartment(dimension, targerId int64) (departID []string) { } return } + +func TimeDimensionStatisticsNew(taskId string, dataAry natureParameter) (outputData GraphicStatistics, outErr bool) { + outErr = true + var normName string = "" + norm := 1 //1:定性考核;2:定量考核 + //获取指标信息 + taskIdInt, _ := strconv.ParseInt(taskId, 10, 64) + taskCont, taskErr := commonus.GetTargetInfo(taskIdInt) + if taskErr == true { + normName = taskCont.Title + outErr = taskErr + norm = taskCont.Type + } else { + // outErr = error.Error("此考核项目没有数据!") + outErr = taskErr + return + } + //获取时间参数 + timeFrame := EstimatedTime(dataAry) + //获取组织架构参数 + // var orgAry []orgModelsAry + var orgList []orgModels + if len(dataAry.Org) > 0 { + _, orgList = getGroupOrgList(dataAry.Org) + } else { + _, orgList = getGroupOrgList(GetTargerDepartment(taskCont.Dimension, taskIdInt)) + } + // fmt.Printf("orgList ---> %v\n", orgList) + //统计方式 + statisticalMethod := 3 + if len(dataAry.AccMethod) == 1 { + if commonus.IsItTrueInt(1, dataAry.AccMethod) == true { + statisticalMethod = 1 + } else { + statisticalMethod = 2 + } + } + // jsonCont, _ := json.Marshal(dataAry) + // fmt.Printf("wherStr------>%v\n", string(jsonCont)) + // return + //根据时间维度进行统计 + for _, tfv := range timeFrame { + if commonus.IsItTrueString(tfv.XLine, outputData.XLine) == false { + outputData.XLine = append(outputData.XLine, tfv.XLine) + } + switch tfv.Class { + case 1: //半年 + + //组合月 + monthStr := "(" + for twi, twv := range tfv.Where { + if twi != 0 { + monthStr = fmt.Sprintf("%v,%v", monthStr, twv) + } else { + monthStr = fmt.Sprintf("%v%v", monthStr, twv) + } + + } + monthStr = fmt.Sprintf("%v)", monthStr) + + //定量考核 + if len(orgList) > 0 { + //有政组织 + for _, orgv := range orgList { + var orgvSunOrg string + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry) + // if len(orgv.SunOrg) > 0 { + // orgvSunOrg = "(" + // for tiai, tiav := range orgv.SunOrg { + // if tiai != 0 { + // orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav) + // } else { + // orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav) + // } + // } + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry) + // } else { + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry) + // } + + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + for _, yearVal := range dataAry.Year { + var sumScore float64 + var averageScore float64 + + // if len(taskIdAry) > 0 { + var wherStr string + + if norm == 1 { + var canKaoZhi float64 = 0 + //定性考核 + if len(orgv.SunOrg) > 0 { + + orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg) + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v AND sf_duty_department = %v", taskIdInt, yearVal, monthStr, orgv.Id) + + canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id) + } + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + if canKaoZhi != 0 { + if sumScore > canKaoZhi { + sumScore = canKaoZhi + } + } + } else { + //定量考核 + + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department IN %v", taskIdInt, yearVal, monthStr, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v AND fl_duty_department = %v", taskIdInt, yearVal, monthStr, orgv.Id) + } + sumScore, averageScore = AverageOfSum(wherStr, 1) + + } + // } + + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } + } else { + //无行政组织 + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry) + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` IN %v ", taskIdInt, tfv.YearName, monthStr) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` IN %v", taskIdInt, tfv.YearName, monthStr) + sumScore, averageScore = AverageOfSum(wherStr, 1) + + } + // } + //不存在行政组织 + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + + case 2: //季度 + for _, yearVal := range dataAry.Year { + + if len(orgList) > 0 { + //有组织 + for _, orgv := range orgList { + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + var orgvSunOrg string + // var taskIdAry []int64 + if len(orgv.SunOrg) > 0 { + orgvSunOrg = "(" + for tiai, tiav := range orgv.SunOrg { + if tiai != 0 { + orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav) + } else { + orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav) + } + } + orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry) + } else { + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry) + } + + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + var wherStr string + var canKaoZhi float64 = 0 + if norm == 1 { + //定性考核 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_quarter` = %v AND sf_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id) + canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id) + } + + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + if canKaoZhi != 0 && sumScore > canKaoZhi { + sumScore = canKaoZhi + } + } else { + //定量考核 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` = %v AND fl_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id) + + } + + sumScore, averageScore = AverageOfSum(wherStr, 1) + } + // } + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } else { + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry) + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + //无组织 + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `fl_quarter` IN %v ", taskIdInt, tfv.YearName, tfv.YearName) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + // wherStr := fmt.Sprintf("`fl_year` = %v AND `fl_quarter` = %v", yearVal, tfv.YearName) + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_quarter` IN %v ", taskIdInt, yearVal, tfv.YearName) + sumScore, averageScore = AverageOfSum(wherStr, 1) + + } + // } + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } + case 3: //月 + for _, yearVal := range dataAry.Year { + + if len(orgList) > 0 { + //有组织 + for _, orgv := range orgList { + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + var orgvSunOrg string + // var taskIdAry []int64 + if len(orgv.SunOrg) > 0 { + orgvSunOrg = "(" + for tiai, tiav := range orgv.SunOrg { + if tiai != 0 { + orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav) + } else { + orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav) + } + } + orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry) + } else { + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry) + } + + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + var wherStr string + if norm == 1 { + //定性考核 + var canKaoZhi float64 = 0 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `sf_month` = %v AND sf_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id) + canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id) + } + + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + if canKaoZhi != 0 && sumScore > canKaoZhi { + sumScore = canKaoZhi + } + } else { + //定量考核 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department IN %v", taskIdInt, yearVal, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v AND fl_duty_department = %v", taskIdInt, yearVal, tfv.YearName, orgv.Id) + } + + sumScore, averageScore = AverageOfSum(wherStr, 1) + } + // } + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v%v %v平均值", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v%v %v", yearVal, orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + + } else { + //无组织 + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry) + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND `fl_month` IN %v ", taskIdInt, tfv.YearName, tfv.YearName) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND `fl_month` = %v ", taskIdInt, yearVal, tfv.YearName) + sumScore, averageScore = AverageOfSum(wherStr, 1) + } + // } + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } + default: //全年 + // if tfv.YearName == ""{} + // fmt.Printf("tfv------------>%v\n", tfv) + if len(orgList) > 0 { + for _, orgv := range orgList { + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + var orgvSunOrg string + // var taskIdAry []int64 + if len(orgv.SunOrg) > 0 { + orgvSunOrg = "(" + for tiai, tiav := range orgv.SunOrg { + if tiai != 0 { + orgvSunOrg = fmt.Sprintf("%v,%v", orgvSunOrg, tiav) + } else { + orgvSunOrg = fmt.Sprintf("%v%v", orgvSunOrg, tiav) + } + } + orgvSunOrg = fmt.Sprintf("%v)", orgvSunOrg) + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation IN ?", taskCont.Dimension, taskIdInt, orgv.SunOrg).Find(&taskIdAry) + } else { + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ? AND qe_accept_evaluation = ?", taskCont.Dimension, taskIdInt, orgv.Id).Find(&taskIdAry) + } + + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + var wherStr string + if norm == 1 { + //定性考核 + var canKaoZhi float64 = 0 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND sf_duty_department IN %v", taskIdInt, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v AND sf_duty_department = %v", taskIdInt, tfv.YearName, orgv.Id) + canKaoZhi = GetTargetReferenceValue(strconv.FormatInt(taskCont.Dimension, 10), taskId, orgv.Id) + } + + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + if canKaoZhi != 0 && sumScore > canKaoZhi { + sumScore = canKaoZhi + } + } else { + //定量考核 + if len(orgv.SunOrg) > 0 { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND fl_duty_department IN %v", taskIdInt, tfv.YearName, orgvSunOrg) + } else { + wherStr = fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdInt, tfv.YearName, orgv.Id) + } + // wherStr := fmt.Sprintf("fld_evaluation_id IN %v AND `fl_year` = %v AND fl_duty_department = %v", taskIdStrWher, tfv.YearName, orgv.Id) + sumScore, averageScore = AverageOfSum(wherStr, 1) + + } + // } + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v %v", orgv.Name, normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v %v平均值", orgv.Name, normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + + } + + } else { + var sumScore float64 + var averageScore float64 + //获取此指标跟查询部门相关的考核方案ID + // var taskIdAry []int64 + // global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_state = 1 AND qe_dimension = ? AND qe_target = ?", taskCont.Dimension, taskIdInt).Find(&taskIdAry) + //组合考核方案ID + // taskIdStrWher := "(" + // for tiai, tiav := range taskIdAry { + // if tiai != 0 { + // taskIdStrWher = fmt.Sprintf("%v,%v", taskIdStrWher, tiav) + // } else { + // taskIdStrWher = fmt.Sprintf("%v%v", taskIdStrWher, tiav) + // } + + // } + // taskIdStrWher = fmt.Sprintf("%v)", taskIdStrWher) + // if len(taskIdAry) > 0 { + if norm == 1 { + //定性考核 + wherStr := fmt.Sprintf("sf_target_id = %v AND `sf_year` = %v", taskIdInt, tfv.YearName) + sumScore, averageScore = AverageOfSumNature(wherStr, 1) + } else { + //定量考核 + wherStr := fmt.Sprintf("fld_target_id = %v AND `fl_year` = %v ", taskIdInt, tfv.YearName) + sumScore, averageScore = AverageOfSum(wherStr, 1) + + } + // } + //不存在行政组织 + switch statisticalMethod { + case 1: + //合计 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + case 2: + //平均 + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + default: + //合计与平均 + normNameTotal := fmt.Sprintf("%v", normName) + if commonus.IsItTrueString(normNameTotal, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameTotal) + var seriesInfo series + seriesInfo.Name = normNameTotal + seriesInfo.Data = append(seriesInfo.Data, sumScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfo) + + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameTotal { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, sumScore) + } + } + } + normNameAverage := fmt.Sprintf("%v平均值", normName) + if commonus.IsItTrueString(normNameAverage, outputData.Cylindrical) == false { + outputData.Cylindrical = append(outputData.Cylindrical, normNameAverage) + var seriesInfoAverage series + seriesInfoAverage.Name = normNameAverage + seriesInfoAverage.Data = append(seriesInfoAverage.Data, averageScore) + outputData.CylindricalData = append(outputData.CylindricalData, seriesInfoAverage) + } else { + for cdi, cdv := range outputData.CylindricalData { + if cdv.Name == normNameAverage { + outputData.CylindricalData[cdi].Data = append(outputData.CylindricalData[cdi].Data, averageScore) + } + } + } + } + } + } + } + + // 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/v1/shiyan/enter.go b/gin_server_admin/api/v1/shiyan/enter.go index 302e073..2ad934a 100644 --- a/gin_server_admin/api/v1/shiyan/enter.go +++ b/gin_server_admin/api/v1/shiyan/enter.go @@ -1,6 +1,10 @@ package shiyan -import "sync" +import ( + "sync" + + "github.com/flipped-aurora/gin-vue-admin/server/commonus" +) var synPro = sync.WaitGroup{} @@ -29,3 +33,24 @@ type jobAttber struct { Jobid int64 `json:"jobid" gorm:"column:jobid;type:bigint(20) unsigned;default:0;not null;comment:职务分类Id"` JobName string `json:"jobname" gorm:"column:jobname;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` } + +//删除提交指标数据 +type delTargetStr struct { + commonus.SetIds + UserKey string `json:"userkey"` +} + +//更具提交人删除定量信息 +type basisType struct { + UserKey string `json:"userkey"` +} + +//定量流水全奖值、零奖值、封顶值 +type FlowLogAllZreo struct { + Id string `json:"id"` + TargetId string `json:"targetid"` //指标ID` + Zeroprize float64 `json:"zeroprize"` //零奖值"` + Allprize float64 `json:"allprize"` //全奖值"` + Capping float64 `json:"capping"` //封顶值"` + +} diff --git a/gin_server_admin/api/v1/shiyan/shiyan.go b/gin_server_admin/api/v1/shiyan/shiyan.go index 4bb3a97..f9b7c98 100644 --- a/gin_server_admin/api/v1/shiyan/shiyan.go +++ b/gin_server_admin/api/v1/shiyan/shiyan.go @@ -52,6 +52,55 @@ func Fanxing[T faxingType](key T, keyAry []T) bool { return true } +//校正定量审核流水全奖值零奖值封顶值设置 +func (s *ShiyanApi) XiaoZhengDingliang(c *gin.Context) { + var flowLogList []assessmentmodel.FlowLog + err := global.GVA_DB_Performanceappraisal.Find(&flowLogList).Error + if err != nil { + response.Result(250, err, "没有数据", c) + return + } + for _, v := range flowLogList { + // fmt.Println(v) + var allZreoConfig []FlowLogAllZreo + evalQualId := strings.Split(v.EvaluationPlan, ",") + if len(evalQualId) > 0 { + for _, ev := range evalQualId { + var allZreoConfigInfo FlowLogAllZreo + allZreoConfigInfo.Id = ev + + targetInfo, _ := commonus.GetQualitativeEvaluation(ev) + allZreoConfigInfo.TargetId = strconv.FormatInt(targetInfo.Target, 10) + switch targetInfo.Cycles { + case 5: + qualConfig, _ := commonus.GetDingLiangMuBiao(v.DutyGroup, v.DutyDepartment, targetInfo.Dimension, targetInfo.Target, v.Year, v.Quarter) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + case 6: + qualConfig, _ := commonus.GetDingLiangMuBiao(v.DutyGroup, v.DutyDepartment, targetInfo.Dimension, targetInfo.Target, v.Year, 1) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + default: + qualConfig, _ := commonus.GetDingLiangMuBiao(v.DutyGroup, v.DutyDepartment, targetInfo.Dimension, targetInfo.Target, v.Year, v.Month) + allZreoConfigInfo.Zeroprize = qualConfig.Zeroprize + allZreoConfigInfo.Allprize = qualConfig.Allprize + allZreoConfigInfo.Capping = qualConfig.CappingVal + } + + allZreoConfig = append(allZreoConfig, allZreoConfigInfo) + } + } + editData := commonus.MapOut() + baselineJson, _ := json.Marshal(allZreoConfig) + editData["fl_baseline"] = string(baselineJson) + editData["fl_eite_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Where("fl_id = ?", v.Id).Updates(editData) + } + response.Result(0, err, "完成", c) +} + //get请求获参 func (a *ShiyanApi) GetRequestOperation(c *gin.Context) { id := c.Query("id") @@ -1851,3 +1900,215 @@ func getJobInfo(jobId int64) (cont jobAttber, err error) { err = global.GVA_DB_HrDataBase.Model(&positionInfo).Select("position.id,position.number,position.name,position.person_in_charge,d.id as dutid,d.name as dutname,d.number as dutnumber,j.id as jobid,j.name as jobname").Joins("left join duties as d on d.id = position.duties").Joins("left join job_class as j on j.id = d.job_type").Where("`position`.`id` = ?", jobId).First(&cont).Error return } + +//删除指标数据 +func (s *ShiyanApi) DeleteTarget(c *gin.Context) { + var requestData delTargetStr + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.Id == 0 && requestData.OutId == "" { + response.Result(102, requestData, "参数错误!请重新提交!", c) + return + } + if requestData.OutId != "" { + idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64) + if inIntErr == nil { + requestData.Id = idInt + } + } + var qualEvalId []int64 + + qualEvalErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.QualitativeEvaluation{}).Select("qe_id").Where("qe_target = ?", requestData.Id).Find(&qualEvalId).Error + if qualEvalErr != nil { + response.Result(102, qualEvalErr, "没有数据!", c) + return + } + if len(qualEvalId) <= 0 { + response.Result(102, qualEvalErr, "没有数据!", c) + return + } + //定性考核 + var scoreFlowOrderKey []int64 + sfGormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_key").Where("sf_evaluation_plan IN ?", qualEvalId) + if requestData.UserKey != "" { + sfGormDb = sfGormDb.Where("sf_evaluation_user = ?", requestData.UserKey) + } + scoreFlowOrderKeyErr := sfGormDb.Find(&scoreFlowOrderKey).Error + if scoreFlowOrderKeyErr != nil { + if len(scoreFlowOrderKey) > 0 { + global.GVA_DB_Performanceappraisal.Where("ep_order_key IN ?", scoreFlowOrderKey).Delete(&assessmentmodel.EvaluationProcess{}) + global.GVA_DB_Performanceappraisal.Where("sf_evaluation_plan IN ?", qualEvalId).Delete(&assessmentmodel.ScoreFlow{}) + } + } + //定量考核 + var flowIdAry []int64 + var flowKey []int64 + for _, v := range qualEvalId { + var flowLogCont []assessmentmodel.FlowLog + flGormDb := global.GVA_DB_Performanceappraisal.Where("FIND_IN_SET(?,`fl_evaluation_id`)", v) + if requestData.UserKey != "" { + sfGormDb = sfGormDb.Where("fl_evaluation_user = ?", requestData.UserKey) + } + flErr := flGormDb.Find(&flowLogCont).Error + if flErr == nil { + if len(flowLogCont) > 0 { + for _, flcv := range flowLogCont { + if commonus.IsInTrue[int64](flcv.Id, flowIdAry) == false { + flowIdAry = append(flowIdAry, flcv.Id) + } + + if commonus.IsInTrue[int64](flcv.Key, flowKey) == false { + flowKey = append(flowKey, flcv.Key) + } + } + } + + } + } + if len(flowIdAry) > 0 { + global.GVA_DB_Performanceappraisal.Where("fl_id IN ?", flowIdAry).Delete(&assessmentmodel.FlowLog{}) + } + if len(flowKey) > 0 { + global.GVA_DB_Performanceappraisal.Where("ep_order_key IN ?", flowKey).Delete(&assessmentmodel.EvaluationProcess{}) + global.GVA_DB_Performanceappraisal.Where("fld_flow_log IN ?", flowKey).Delete(&assessmentmodel.FlowLogData{}) + } + response.Result(0, qualEvalId, "处理完成!", c) +} + +//根据提交人删除定量数据 +func (s *ShiyanApi) BasisMan(c *gin.Context) { + var requestData basisType + err := c.ShouldBindJSON(&requestData) + if err != nil { + response.Result(101, err, "数据获取失败!", c) + return + } + if requestData.UserKey == "" { + response.Result(102, requestData, "请输入人员KEY", c) + return + } + var flowKey []int64 + flowLogErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLog{}).Select("fl_key").Where("fl_evaluation_user = ?", requestData.UserKey).Find(&flowKey).Error + if flowLogErr != nil { + response.Result(102, flowLogErr, "没有数据!", c) + return + } + if len(flowKey) <= 0 { + response.Result(102, flowLogErr, "没有数据!", c) + return + } + global.GVA_DB_Performanceappraisal.Where("ep_order_key IN ?", flowKey).Delete(&assessmentmodel.EvaluationProcess{}) + global.GVA_DB_Performanceappraisal.Where("fld_flow_log IN ?", flowKey).Delete(&assessmentmodel.FlowLogData{}) + global.GVA_DB_Performanceappraisal.Where("fl_id IN ?", flowKey).Delete(&assessmentmodel.FlowLog{}) + response.Result(0, flowLogErr, "处理完成!", c) +} + +//归档审批流程 +func (s *ShiyanApi) EvalProcesGuiDang(c *gin.Context) { + var epList []assessmentmodel.EvaluationProcess + err := global.GVA_DB_Performanceappraisal.Find(&epList).Error + if err != nil { + response.Result(102, err, "没有数据!", c) + return + } + for _, v := range epList { + saveDate := commonus.MapOut() + if v.TypeClass == 1 { + //定性 + var scoreFlowInfo assessmentmodel.ScoreFlow + sfiErr := global.GVA_DB_Performanceappraisal.Select("sf_evaluation_plan,sf_evaluation_department").Where("sf_key = ?", v.OrderKey).First(&scoreFlowInfo).Error + if sfiErr == nil { + saveDate["ep_setup_department"] = scoreFlowInfo.EvaluationDepartment + //获取维度,指标,指标详情 + var qeInfo assessmentmodel.QualitativeEvaluation + qeErr := global.GVA_DB_Performanceappraisal.Select("qe_dimension,qe_target,qe_detailed_target").Where("qe_id = ?", scoreFlowInfo.EvaluationPlan).First(&qeInfo).Error + if qeErr == nil { + saveDate["ep_dimension"] = qeInfo.Dimension + saveDate["ep_target"] = qeInfo.Target + saveDate["ep_detailedtarget"] = qeInfo.DetailedTarget + } + saveDate["ep_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("ep_id = ?", v.Id).Updates(&saveDate) + } + } else { + //定量 + var flowLogList assessmentmodel.FlowLog + sfiErr := global.GVA_DB_Performanceappraisal.Select("fl_evaluation_id,fl_evaluation_department").Where("fl_key = ?", v.OrderKey).First(&flowLogList).Error + if sfiErr == nil { + saveDate["ep_setup_department"] = flowLogList.EvaluationDepartment + evalId := strings.Split(flowLogList.EvaluationPlan, ",") + var dimAry []string + var tarAry []string + if len(evalId) > 0 { + for _, flv := range evalId { + var qeInfo assessmentmodel.QualitativeEvaluation + qeErr := global.GVA_DB_Performanceappraisal.Select("qe_dimension,qe_target").Where("qe_id = ?", flv).First(&qeInfo).Error + if qeErr == nil { + if commonus.IsInTrue[string](strconv.FormatInt(qeInfo.Dimension, 10), dimAry) == false { + dimAry = append(dimAry, strconv.FormatInt(qeInfo.Dimension, 10)) + } + if commonus.IsInTrue[string](strconv.FormatInt(qeInfo.Target, 10), tarAry) == false { + tarAry = append(tarAry, strconv.FormatInt(qeInfo.Target, 10)) + } + } + } + } + if len(dimAry) > 0 { + saveDate["ep_dimension"] = strings.Join(dimAry, ",") + } + if len(tarAry) > 0 { + saveDate["ep_target"] = strings.Join(tarAry, ",") + } + saveDate["ep_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("ep_id = ?", v.Id).Updates(&saveDate) + } + } + } + response.Result(0, err, "处理完成!", c) +} + +//归档定性考核指标数据 +func (s *ShiyanApi) GuiDangDingLiangKaoHeData(c *gin.Context) { + var fldList []assessmentmodel.FlowLogData + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Select("fld_id,fld_evaluation_id").Find(&fldList).Error + if err != nil { + response.Result(102, err, "没有数据!", c) + return + } + for _, v := range fldList { + var qeInfo assessmentmodel.QualitativeEvaluation + qeErr := global.GVA_DB_Performanceappraisal.Select("qe_target").Where("qe_id = ?", v.EvaluationPlan).First(&qeInfo).Error + if qeErr == nil { + saveData := commonus.MapOut() + saveData["fld_target_id"] = qeInfo.Target + saveData["fld_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.FlowLogData{}).Where("fld_id = ?", v.Id).Updates(&saveData) + } + } + response.Result(0, err, "处理完成!", c) +} + +//定性考核归档指标ID +func (s *ShiyanApi) GuiDangDingXingKaoHeData(c *gin.Context) { + var slDataList []assessmentmodel.ScoreFlow + err := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Select("sf_id,sf_evaluation_plan").Find(&slDataList).Error + if err != nil { + response.Result(102, err, "没有数据!", c) + return + } + for _, v := range slDataList { + var qeInfo assessmentmodel.QualitativeEvaluation + qeErr := global.GVA_DB_Performanceappraisal.Select("qe_target,qe_detailed_target").Where("qe_id = ?", v.EvaluationPlan).First(&qeInfo).Error + if qeErr == nil { + saveData := commonus.MapOut() + saveData["sf_target_id"] = qeInfo.Target + saveData["sf_detailed_id"] = qeInfo.DetailedTarget + saveData["sf_eite_time"] = time.Now().Unix() + global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("sf_id = ?", v.Id).Updates(&saveData) + } + } + response.Result(0, err, "处理完成!", c) +} diff --git a/gin_server_admin/commonus/floataccuracy.go b/gin_server_admin/commonus/floataccuracy.go index d07905c..b4161fe 100644 --- a/gin_server_admin/commonus/floataccuracy.go +++ b/gin_server_admin/commonus/floataccuracy.go @@ -6,6 +6,8 @@ import ( "strconv" "time" + "github.com/flipped-aurora/gin-vue-admin/server/global" + "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel" "github.com/shopspring/decimal" ) @@ -28,3 +30,19 @@ func GetFileNumber() (num int64) { num, _ = strconv.ParseInt(strconv.FormatInt(timeVal, 10)+strconv.Itoa(randVal), 10, 64) return } + +//获取 定量考核目标设定 +/* +@group 集团 +@depart 部门 +@dimen 维度 +@target 指标 +@year 年份 +@timecopy 参考值 +*/ +func GetDingLiangMuBiao(group, depart, dimen, target, year, timecopy int64) (qualConfig assessmentmodel.QuantitativeConfig, err error) { + gormDb := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `departmentid` = ? AND `dimension` = ? AND `target` = ? AND `year` = ?", group, depart, dimen, target, year) + gormDb = gormDb.Where("timecopy = ?", timecopy) + err = gormDb.First(&qualConfig).Error + return +} diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go index 369fe41..7698dc6 100644 --- a/gin_server_admin/commonus/publichaneld.go +++ b/gin_server_admin/commonus/publichaneld.go @@ -1486,7 +1486,7 @@ returnData #detailedRulesTitle 明细 #detailedRulesInfo 明细说明 */ -func GetDutyAssociatedItems(orderId string) (targettitle, detailedRulesTitle, detailedRulesInfo, unit string, flowContent assessmentmodel.ScoreFlow, qualEvalInfo assessmentmodel.QualitativeEvaluation, isTrue bool) { +func GetDutyAssociatedItems(orderId string) (targettitle, detailedRulesTitle, detailedRulesInfo, unit string, flowContent assessmentmodel.ScoreFlow, qualEvalCont assessmentmodel.QualitativeEvaluation, isTrue bool) { flowContent, isTrue = GetScoreFlow(orderId) if isTrue != true { return @@ -1872,7 +1872,7 @@ func StepAddDataEs(flowID, roleGroupId int64, nextStep, stepName, typeclass, sta } else { evalProCont.NextExecutor = "" } - + // evalProCont.AcceptDepartment = global.GVA_DB_Performanceappraisal.Create(&evalProCont) } else { @@ -3923,6 +3923,7 @@ func WriteReplyLog(orderId, acceptDepartment, launchDepartment, launchUser, stat @allPrizes 全奖值 @zeroPrizes 零奖值 @CappingVals 封顶值 +@typeClass 1:定性;2:定量;3:观察指标 返回说明 @scoreVal 计算得分 @@ -3931,21 +3932,28 @@ func WriteReplyLog(orderId, acceptDepartment, launchDepartment, launchUser, stat @CappingVal 封顶值 @achievement 达成率 */ -func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, CappingVals float64) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { +func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, CappingVals float64, typeClass int) (scoreVal, allPrize, zeroPrize, CappingVal, achievement float64) { allPrize = allPrizes / 100 zeroPrize = zeroPrizes / 100 CappingVal = CappingVals / 100 resultval = resultval / 100 + + // fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, allPrize, zeroPrize, CappingVal) + if allPrize == 0 && zeroPrize == 0 { //全奖值与零奖值都为0 那么达成率 100 和实际得分是 指标分 achievement = 100 scoreVal = float64(targetScore) + if typeClass == 2 { + scoreVal = 0 + } + // fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) } else { if allPrize > zeroPrize { //如果全奖值大于零奖值 执行一下操作 if resultval <= zeroPrize { //实际结算值小于零奖值 那么达成率和实际得分都是0 achievement = 0 scoreVal = 0 // } else if resultval > allPrize { //实际结算值大于全奖值 执行一下操作 - + // fmt.Printf("达成率--7-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) } else { //实际结算值在全奖值 与 零奖值之间 chuShu := resultval - float64(zeroPrize) beiChuShu := float64(allPrize) - float64(zeroPrize) @@ -3955,6 +3963,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping //如果在全奖值大于零件值的情况下出现达成率为0或负数,则达成率和实际得分都是0 achievement = 0 scoreVal = 0 + // fmt.Printf("达成率--8-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) } else { if achievement*100 >= CappingVal { //如果达成率大于等于封顶值 @@ -3962,12 +3971,14 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping } else { scoreVal = achievement * (float64(targetScore)) } + // fmt.Printf("达成率--9-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) } achievement = Decimal(achievement * 100) } else { //被除数为0时 那么达成率和实际得分都是0 achievement = 0 scoreVal = 0 + // fmt.Printf("达成率--10-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) } } @@ -4007,11 +4018,16 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping } } } + if typeClass == 3 { + scoreVal = float64(targetScore) + // fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) + } scoreVal = Decimal(scoreVal) allPrize = Decimal(allPrize) zeroPrize = Decimal(zeroPrize) CappingVal = Decimal(CappingVal) achievement = Decimal(achievement) + // fmt.Printf("达成率--12-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) return } diff --git a/gin_server_admin/initialize/internal/logger.go b/gin_server_admin/initialize/internal/logger.go index 6e7c081..0841a19 100644 --- a/gin_server_admin/initialize/internal/logger.go +++ b/gin_server_admin/initialize/internal/logger.go @@ -22,7 +22,7 @@ type config struct { var ( Discard = New(log.New(ioutil.Discard, "", log.LstdFlags), config{}) Default = New(log.New(os.Stdout, "\r\n", log.LstdFlags), config{ - SlowThreshold: 20000 * time.Millisecond, + SlowThreshold: 2000000 * time.Millisecond, LogLevel: logger.Warn, Colorful: true, }) diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go index dbbde80..a977b41 100644 --- a/gin_server_admin/model/assessmentmodel/dutyclass.go +++ b/gin_server_admin/model/assessmentmodel/dutyclass.go @@ -426,6 +426,7 @@ type FlowLog struct { 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:版本号"` + Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "` } func (FlowLog *FlowLog) TableName() string { @@ -449,6 +450,7 @@ type FlowLogData struct { Month int64 `json:"month" gorm:"column:fld_month;type:int(2) unsigned;default:0;not null;comment:月"` Week int64 `json:"week" gorm:"column:fld_week;type:int(5) unsigned;default:0;not null;comment:周"` ToDay int64 `json:"today" gorm:"column:fld_day;type:int(5) unsigned;default:0;not null;comment:天"` + TargetId int64 `json:"targetid" gorm:"column:fld_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` } func (FlowLogData *FlowLogData) TableName() string { @@ -554,3 +556,38 @@ type PositionPlanVersio struct { func (PositionPlanVersio *PositionPlanVersio) TableName() string { return "position_plan_version" } + +//审批流程视图 +type EvalProcess struct { + EvaluationProcess + ClassTitle string `json:"class_title" gorm:"column:class_title;type:varchar(255);comment:指标名称"` + TargetTitle string `json:"et_title" gorm:"column:target_title;type:varchar(255);comment:指标名称"` + DetartTitle string `json:"dt_title" gorm:"column:detart_title;type:varchar(255);comment:指标名称"` +} + +func (EvalProcess *EvalProcess) TableName() string { + return "evalprocess" +} + +//定量柳树视图 +type FlowDataLogType struct { + Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` + Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` + Score int64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:数据"` + ScoringMethod int `json:"scoringmethod" gorm:"column:method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` + ScoringScore float64 `json:"scoringscore" gorm:"column:scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` + EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` + DutyGroup int64 `json:"dutygroup" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` + DutyDepartment int64 `json:"dutydepartment" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` + Baseline string `json:"baseline" gorm:"column:baseline;type:longtext;comment:基准线 "` + Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年分"` + Quarter int64 `json:"quarter" gorm:"column:quarte;type:int(2) unsigned;default:0;not null;comment:季度"` + Month int64 `json:"month" gorm:"column:month;type:int(2) unsigned;default:0;not null;comment:月"` + Week int64 `json:"week" gorm:"column:week;type:int(5) unsigned;default:0;not null;comment:周"` + ToDay int64 `json:"today" gorm:"column:today;type:int(5) unsigned;default:0;not null;comment:天"` + TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` +} + +func (FlowDataLogType *FlowDataLogType) TableName() string { + return "flow_data_log" +} diff --git a/gin_server_admin/model/assessmentmodel/performance_appraisal.go b/gin_server_admin/model/assessmentmodel/performance_appraisal.go index 64b3840..6225ee4 100644 --- a/gin_server_admin/model/assessmentmodel/performance_appraisal.go +++ b/gin_server_admin/model/assessmentmodel/performance_appraisal.go @@ -33,6 +33,8 @@ type ScoreFlow struct { 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:版本号"` + TargetId int64 `json:"targetid" gorm:"column:sf_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` + DetailedId int64 `json:"detailedid" gorm:"column:sf_detailed_id;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` } func (ScoreFlow *ScoreFlow) TableName() string { @@ -64,19 +66,24 @@ func (DivisionResponsibilities *DivisionResponsibilities) TableName() string { //流程步进器 type EvaluationProcess struct { - Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` - OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` - Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` - Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` - NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` - Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` - State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:起草,2:审批中;3:通过;4:驳回"` - RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` - 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:下一步执行人"` + Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` + OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` + Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` + Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` + NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` + Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` + State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:起草,2:审批中;3:通过;4:驳回"` + RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` + 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:下一步执行人"` + SetupDepartment int64 `json:"setupdepartment" gorm:"column:ep_setup_department;type:bigint(20) unsigned;default:0;not null;comment:发起部门"` + Dimension string `json:"dimension" gorm:"column:sf_reason;type:mediumtext;comment:维度"` + Target string `json:"target" gorm:"column:sf_reason;type:mediumtext;comment:指标"` + DetailedTarget string `json:"detailedtarget" gorm:"column:sf_reason;type:mediumtext;comment:指标细则"` + AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;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 fe1c010..c1938f4 100644 --- a/gin_server_admin/router/assessment/assessmentrouter.go +++ b/gin_server_admin/router/assessment/assessmentrouter.go @@ -198,8 +198,9 @@ func (s *AssessmentRouter) InitEvaluationRouter(Router *gin.RouterGroup) { dutyIndexCodeRouter.POST("qualitativeevalration", authorityIndexApi.QualitativeEvalRation) // 定量考核列表 dutyIndexCodeRouter.POST("addflowrationlog", authorityIndexApi.AddFlowRationLog) // 添加定量考核列表 - dutyIndexCodeRouter.POST("lookdutkscoreflow", authorityIndexApi.LookDutkScoreFlow) // 查看定性考核审批列表 - dutyIndexCodeRouter.POST("lookrationkscoreflow", authorityIndexApi.LookRationkScoreFlow) // 查看定量考核审批列表 + dutyIndexCodeRouter.POST("lookdutkscoreflow", authorityIndexApi.LookDutkScoreFlow) // 查看定性考核审批列表 + dutyIndexCodeRouter.POST("newlookrationkscoreflow", authorityIndexApi.LookRationkScoreFlow) // 查看定量考核审批列表 + dutyIndexCodeRouter.POST("lookrationkscoreflow", authorityIndexApi.NewLookRationkScoreFlow) // 查看定量考核审批列表 dutyIndexCodeRouter.POST("lookquantitativeconfig", authorityIndexApi.LookQuantitativeConfig) // 查看定量考核目标设定 diff --git a/gin_server_admin/router/shiyan/sys_shiyan.go b/gin_server_admin/router/shiyan/sys_shiyan.go index 691431f..8aa88ae 100644 --- a/gin_server_admin/router/shiyan/sys_shiyan.go +++ b/gin_server_admin/router/shiyan/sys_shiyan.go @@ -36,7 +36,17 @@ func (s *ShiyanRouter) InitShiyanRouter(Router *gin.RouterGroup) { shiyanCodeRouter.POST("jiami", authorityApi.JiaMi) //比对文本 shiyanCodeRouter.POST("suntar", authorityApi.SunTar) - shiyanCodeRouter.POST("dataqianyi", authorityApi.DataQianyi) //数据迁移 + shiyanCodeRouter.POST("dataqianyi", authorityApi.DataQianyi) //数据迁移 + shiyanCodeRouter.POST("deletetarget", authorityApi.DeleteTarget) //删除指标提交数据 + shiyanCodeRouter.POST("basisman", authorityApi.BasisMan) //根据提交人删除定量数据 + + shiyanCodeRouter.POST("xiaozhengdingliang", authorityApi.XiaoZhengDingliang) //校正定量审核流水全奖值零奖值封顶值设置 + + shiyanCodeRouter.POST("evalprocesguidang", authorityApi.EvalProcesGuiDang) //归档审批流程 + + shiyanCodeRouter.POST("guidangdingliangkaohedata", authorityApi.GuiDangDingLiangKaoHeData) //归档定量考核数据 + + shiyanCodeRouter.POST("guidangdingxingkaohedata", authorityApi.GuiDangDingXingKaoHeData) //归档定性考核数据 } }