@ -61,10 +61,11 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
var mtScore float64 = 0
var atScore float64 = 0
var lastEvalId int64
var scoreSum float64 = 0
// var scoreSum float64 = 0
var shouDongFenzhi float64 = 0
var zhidongDongLiang float64 = 0
// var realScore float64 = 0
if len ( fldList ) > 0 {
for _ , v := range fldList {
// fmt.Printf("Key----------------->%v\n", v.Key)
@ -78,16 +79,19 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
atScore = atScore + float64 ( v . ScoringScore )
shouDongFenzhi = shouDongFenzhi + float64 ( v . ScoringScore )
}
scoreSum = scoreSum + float64 ( v . Score )
// scoreSum = scoreSum + atScore
// scoreSum = scoreSum + float64(v.Score)
mtScore = mtScore + v . ScoringScore
if v . DutyDepartment != 0 {
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 )
tableScoreCont . ScoreVal = commonus . Decimal ( atScore / 100 )
targetIdInt , _ := strconv . ParseInt ( targetId , 10 , 64 )
groupId , _ := strconv . ParseInt ( group , 10 , 64 )
departmentId , _ := strconv . ParseInt ( department , 10 , 64 )
@ -96,8 +100,8 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
// 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)
tableScoreCont . ActualScore , tableScoreCont . AllPrize , tableScoreCont . ZeroPrize , tableScoreCont . CappingVal , tableScoreCont . Achievement = commonus . CalculateScore ( referenceScore , zhidongDongLiang , allPrize , zeroPrize , cappingPrize , typeClass )
tableScoreCont . ActualScore , tableScoreCont . AllPrize , tableScoreCont . ZeroPrize , tableScoreCont . CappingVal , tableScoreCont . Achievement = commonus . CalculateScore ( referenceScore , atScore , allPrize , zeroPrize , cappingPrize , typeClass )
// tableScoreCont.ActualScore, tableScoreCont.AllPrize, tableScoreCont.ZeroPrize, tableScoreCont.CappingVal, tableScoreCont.Achievement = commonus.CalculateScore(referenceScore, zhidongDongLiang, 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 )
@ -120,7 +124,9 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
@ timecopy 辅助计数
* /
func GetAllZreoCapp ( flKey , group , depart , dimen , targetId , year , timecopy , deaTarget int64 ) ( zeroPrize , allPrize , cappingPrize float64 ) {
if flKey == 0 {
return
}
var baseLineStr string
err := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . FlowLog { } ) . Select ( "fl_baseline" ) . Where ( "fl_key = ?" , flKey ) . First ( & baseLineStr ) . Error
if err != nil {
@ -183,7 +189,7 @@ func (a *ApiGroup) DepartmentTranscript(c *gin.Context) {
response . Result ( 101 , isTrue , "您的身份令牌已经失效!请重新登录获取身份令牌!" , c )
return
}
fmt . Printf ( "userCont------------------->%v\n" , userCont )
// fmt.Printf("userCont------------------->%v\n", userCont)
var requestData TranscriptTable
c . ShouldBindJSON ( & requestData )
var orgList [ ] hrsystem . AdministrativeOrganization
@ -209,21 +215,21 @@ func (a *ApiGroup) DepartmentTranscript(c *gin.Context) {
}
var orgAry [ ] hrsystem . AdministrativeOrganization
for _ , ov := range orgList {
if ov . Id == 281 || ov . Id == 280 {
orgAry = append ( orgAry , ov )
// if ov.Id == 281 || ov.Id == 280 {
var ovlist [ ] hrsystem . AdministrativeOrganization
ovErr := global . GVA_DB_HrDataBase . Where ( "state = 1" ) . Where ( "superior = ?" , ov . Id ) . Find ( & ovlist ) . Error
ovErr := global . GVA_DB_HrDataBase . Where ( "state = 1" ) . Where ( "ispower = 1 AND superior = ?" , ov . Id ) . Find ( & ovlist ) . Error
if ovErr == nil {
for _ , ovl := range ovlist {
// orgList = append(orgList, ovl)
orgAry = append ( orgAry , ovl )
}
}
} else {
orgAry = append ( orgAry , ov )
}
// } else {
// orgAry = append(orgAry, ov)
// }
}
currentYear := commonus . ComputingTime ( time . Now ( ) . Unix ( ) , 1 )
if requestData . Year != "" {
yearInt64 , _ := strconv . ParseInt ( requestData . Year , 10 , 64 )
@ -628,19 +634,20 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
for _ , v := range planVersionCont {
sumScore = sumScore + float64 ( v . ZhiFraction )
for _ , vc := range v . Child {
// if vc.Id == "6" {
var listggCont defenfenxi
listggCont . Title = vc . Name
sumScoreKS = sumScoreKS + float64 ( vc . ReferenceScore )
if vc . Status == 3 {
deScore = deScore + float64 ( vc . ReferenceScore )
listggCont . Stroce = float64 ( vc . ReferenceScore )
// fmt.Printf("Score---观察---ID--%v--->%v---->deScore---->%v\n", vc.Name, float64(vc.ReferenceScore), deScore)
fmt . Printf ( "Score---观察------指标--%v----指标分----->%v---->结算分---->%v\n" , vc . Name , float64 ( vc . ReferenceScore ) , deScore )
}
if vc . Status == 1 && vc . Status != 3 {
var targetInfo assessmentmodel . EvaluationTarget
targetInfo . GetCont ( map [ string ] interface { } { "et_id" : vc . Id } , "et_type,et_cycle,et_title" )
listggCont . Title = targetInfo . Title
// if targetInfo.Type == 1 {
// //定性考核
// gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.ScoreFlow{}).Where("`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_month` = ?", vc.Id, orgId, year, month)
@ -689,7 +696,8 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
if targetInfo . Type == 1 {
//定性考核
gormDb := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_quarter` = ?" , vc . Id , orgId , year , jidu )
fffff := calculationDingXingScore ( gormDb , float64 ( vc . ReferenceScore ) )
gormDbs := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_quarter` = ?" , vc . Id , orgId , year , jidu )
fffff := calculationDingXingScore ( gormDb , gormDbs , float64 ( vc . ReferenceScore ) )
deScore = deScore + fffff
listggCont . Stroce = fffff
listggCont . TimeClass = "1"
@ -715,7 +723,8 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
if targetInfo . Type == 1 {
//定性考核
gormDb := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ?" , vc . Id , orgId , year )
fffff := calculationDingXingScore ( gormDb , float64 ( vc . ReferenceScore ) )
gormDbs := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ?" , vc . Id , orgId , year )
fffff := calculationDingXingScore ( gormDb , gormDbs , float64 ( vc . ReferenceScore ) )
deScore = deScore + fffff
listggCont . Stroce = fffff
listggCont . TimeClass = "1"
@ -761,7 +770,8 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
if targetInfo . Type == 1 {
//定性考核
gormDb := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_month` IN ?" , vc . Id , orgId , year , monthAry )
fffff := calculationDingXingScore ( gormDb , float64 ( vc . ReferenceScore ) )
gormDbs := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_month` IN ?" , vc . Id , orgId , year , monthAry )
fffff := calculationDingXingScore ( gormDb , gormDbs , float64 ( vc . ReferenceScore ) )
deScore = deScore + fffff
listggCont . Stroce = fffff
@ -785,7 +795,8 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
if targetInfo . Type == 1 {
//定性考核
gormDb := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_month` = ?" , vc . Id , orgId , year , month )
fffff := calculationDingXingScore ( gormDb , float64 ( vc . ReferenceScore ) )
gormDbs := global . GVA_DB_Performanceappraisal . Model ( & assessmentmodel . ScoreFlow { } ) . Where ( "`sf_target_id` = ? AND `sf_duty_department` = ? AND `sf_year` = ? AND `sf_month` = ?" , vc . Id , orgId , year , month )
fffff := calculationDingXingScore ( gormDb , gormDbs , float64 ( vc . ReferenceScore ) )
deScore = deScore + fffff
listggCont . Stroce = fffff
listggCont . TimeClass = "1"
@ -803,10 +814,11 @@ func StatisVersionTable(group string, planVersionCont []AddDutyNewCont, orgId, y
}
// fmt.Printf("deScore--name:%v--->%v\n", vc.Name, deScore)
listgg = append ( listgg , listggCont )
// }
}
}
// jskd, _ := json.Marshal(listgg)
// fmt.Printf("listgg----->%v\n", string(jskd))
jskd , _ := json . Marshal ( listgg )
fmt . Printf ( "listgg----->%v\n" , string ( jskd ) )
// fmt.Printf("sumScore----->%v-----sumScoreKS---->%v---->deScore---->%v\n", sumScore, sumScoreKS, deScore)
return commonus . Decimal ( deScore )
@ -818,10 +830,11 @@ mm8888
@ gormDb 要查询得语句
@ referenceScore 指标权重
* /
func calculationDingXingScore ( gormDb * gorm . DB , referenceScore float64 ) float64 {
func calculationDingXingScore ( gormDbJia * gorm . DB , gormDbJian * gorm . DB , referenceScore float64 ) float64 {
// return 0
var jiaFenAry [ ] TongjiFenShu
gormDb . Select ( "sf_score,sf_count" ) . Where ( "sf_plus_reduce_score = 1" ) . Where ( "sf_reply IN (2,3)" ) . Find ( & jiaFenAry )
gormDbJia . Select ( "sf_score,sf_count" ) . Where ( "sf_plus_reduce_score = 1" ) . Where ( "sf_reply IN (2,3)" ) . Find ( & jiaFenAry )
//加分
var addSumScore float64 = 0
for _ , jiav := range jiaFenAry {
@ -830,12 +843,16 @@ func calculationDingXingScore(gormDb *gorm.DB, referenceScore float64) float64 {
//减分
var scoreReduction float64 = 0
var jianFenAry [ ] TongjiFenShu
gormDb . Select ( "sf_score,sf_count" ) . Where ( "sf_plus_reduce_score = 2" ) . Where ( "sf_reply IN (2,3)" ) . Find ( & jianFenAry )
gormDbJian . Select ( "sf_score,sf_count" ) . Where ( "sf_plus_reduce_score = 2" ) . Where ( "sf_reply IN (2,3)" ) . Find ( & jianFenAry )
for _ , jianv := range jianFenAry {
scoreReduction = scoreReduction + ( jianv . Score * jianv . Count )
// fmt.Printf("scoreReduction----->%v------->jianv.Score----->%v------->jianv.Count-------->%v\n", scoreReduction, jianv.Score, jianv.Count)
}
sumScore := scoreReduction - addSumScore
return referenceScore - commonus . Decimal ( sumScore / 100 )
shijiFEn := referenceScore - commonus . Decimal ( sumScore / 100 )
// fmt.Printf("定性分值---addSumScore----->%v---->scoreReduction----->%v---->sumScore----->%v---->shijiFEn----->%v---->referenceScore-->%v\n", addSumScore, scoreReduction, sumScore, shijiFEn, referenceScore)
return shijiFEn
}
//计算定量得分
@ -880,9 +897,13 @@ func calculationDingLiangScore(group, department, dimensionId, targetId string,
} else {
zeroprize , allprize , capping = GetPassRate ( groupId , departmentId , dimensionIdInt , targetIdInt , year , monthType , 0 )
}
if v . ScoringMethod == 1 {
actualScoreVal , _ , _ , _ , _ := commonus . CalculateScore ( referenceScore , float64 ( v . Score ) , allprize , zeroprize , capping , 2 )
actualScore = actualScore + actualScoreVal
} else {
actualScore = actualScore + ( float64 ( v . ScoringScore ) / 100 )
}
// fmt.Printf("actualScoreVal--actualScoreVal--->%v---referenceScore-->%v---Score-->%v---allprize-->%v---zeroprize-->%v----capping->%v\n", actualScoreVal, referenceScore, float64(v.Score), allprize, zeroprize, capping)
}
}