Browse Source

判断得分是否为零

master
超级管理员 3 years ago
parent
commit
48a3f2a2b5
  1. 6
      api/index/statistics/newstatistics.go
  2. 35
      api/statistics/quantification/summary_details.go
  3. 15
      commonus/publichaneld.go

6
api/index/statistics/newstatistics.go

@ -58,7 +58,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
fmt.Printf("targetid------------->%v------------>%v---->%v\n", targetId, timeClass, string(jsCon)) fmt.Printf("targetid------------->%v------------>%v---->%v\n", targetId, timeClass, string(jsCon))
var mtScore float64 = 0 // var mtScore float64 = 0
var atScore float64 = 0 var atScore float64 = 0
var lastEvalId int64 var lastEvalId int64
// var scoreSum float64 = 0 // var scoreSum float64 = 0
@ -81,7 +81,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
} }
// scoreSum = scoreSum + atScore // scoreSum = scoreSum + atScore
// scoreSum = scoreSum + float64(v.Score) // scoreSum = scoreSum + float64(v.Score)
mtScore = mtScore + v.ScoringScore // mtScore = mtScore + v.ScoringScore
if v.DutyDepartment != 0 { if v.DutyDepartment != 0 {
whereDepart := commonus.MapOut() whereDepart := commonus.MapOut()
whereDepart["id"] = v.DutyDepartment whereDepart["id"] = v.DutyDepartment
@ -98,7 +98,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
dimensionIdInt, _ := strconv.ParseInt(dimensionId, 10, 64) dimensionIdInt, _ := strconv.ParseInt(dimensionId, 10, 64)
zeroPrize, allPrize, cappingPrize := GetAllZreoCapp(lastEvalId, groupId, departmentId, dimensionIdInt, targetIdInt, yserInt, int64(i), 0) 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) // fmt.Printf("atScore--->%v------->mtScore--->%v---->zeroPrize--->%v---->allPrize--->%v---->cappingPrize--->%v---->typeClass---->%v\n", atScore, mtScore, zeroPrize, allPrize, 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, atScore, 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, zhidongDongLiang, allPrize, zeroPrize, cappingPrize, typeClass)

35
api/statistics/quantification/summary_details.go

@ -58,7 +58,7 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
var lookStatistics []detailedResultsList var lookStatistics []detailedResultsList
for _, v := range planVersionCont { //维度 for _, v := range planVersionCont { //维度
for _, cv := range v.Child { //指标 for _, cv := range v.Child { //指标
// if cv.Id == "50" { if cv.Id == "52" {
var statisCont detailedResultsList var statisCont detailedResultsList
statisCont.GroupId = strconv.FormatInt(planVersion.Group, 10) //集团Id statisCont.GroupId = strconv.FormatInt(planVersion.Group, 10) //集团Id
var groupCont hrsystem.AdministrativeOrganization var groupCont hrsystem.AdministrativeOrganization
@ -104,7 +104,7 @@ func (a *ApiGroup) SummaryDetails(c *gin.Context) {
// } // }
lookStatistics = append(lookStatistics, statisCont) lookStatistics = append(lookStatistics, statisCont)
// } }
} }
} }
@ -192,7 +192,7 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI
var flowDataLog []assessmentmodel.FlowDataLogType var flowDataLog []assessmentmodel.FlowDataLogType
err := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `department` = ? AND `year` = ? AND `month` = ? AND `targetid` = ?", groupId, departmentId, year, month, targetId).Find(&flowDataLog).Error err := global.GVA_DB_Performanceappraisal.Where("`group` = ? AND `department` = ? AND `year` = ? AND `month` = ? AND `targetid` = ?", groupId, departmentId, year, month, targetId).Find(&flowDataLog).Error
fmt.Printf("err ------flowDataLog------>%v------>%v\n", err, flowDataLog) fmt.Printf("err ------flowDataLog------>err:%v------>status:%v------>flowDataLog:%v\n", err, status, flowDataLog)
if err != nil || len(flowDataLog) < 1 { if err != nil || len(flowDataLog) < 1 {
score = float64(weight) score = float64(weight)
@ -224,10 +224,12 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI
default: default:
} }
sumScoreEs = sumScoreEs + sumScoreGet sumScoreEs = sumScoreEs + sumScoreGet
fmt.Printf("sumScoreEs--1--->%v\n", v.Score)
} else { } else {
sumScoreEs = sumScoreEs + (float64(v.ScoringScore) / 100) sumScoreEs = sumScoreEs + (float64(v.ScoringScore) / 100)
// sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, float64(weight), float64(v.ScoringScore)) // sumScoreGet, _, _, _, _ := analysisReward(targetId, v.Baseline, float64(weight), float64(v.ScoringScore))
// sumScoreEs = sumScoreEs + sumScoreGet // sumScoreEs = sumScoreEs + sumScoreGet
fmt.Printf("sumScoreEs--2--->%v\n", sumScoreEs)
} }
} else { } else {
sumScoreEs = sumScoreEs + targetScore sumScoreEs = sumScoreEs + targetScore
@ -242,7 +244,7 @@ func DingLiangMonthSum(groupId, departmentId, weight, year, month int64, targetI
} }
} }
} }
// fmt.Printf("EvalDepartment--3--->%v\n", EvalDepartment) fmt.Printf("sumScoreEs--3--->%v\n", sumScoreEs)
score = sumScoreEs score = sumScoreEs
// if cycs != 4 { // if cycs != 4 {
// score = float64(weight) // score = float64(weight)
@ -277,12 +279,12 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
scoreVal = targetScore scoreVal = targetScore
return return
} }
settlementScore = settlementScore / 100
for _, v := range rewardAry { for _, v := range rewardAry {
if v.TargetId == targetId { if v.TargetId == targetId {
allPrize = v.Allprize allPrize = v.Allprize / 100
zeroPrize = v.Zeroprize zeroPrize = v.Zeroprize / 100
CappingVal = v.Capping CappingVal = v.Capping / 100
// fmt.Printf("%v----全奖--1-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement) // fmt.Printf("%v----全奖--1-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
@ -307,11 +309,19 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
// fmt.Printf("%v----全奖--4-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement) // fmt.Printf("%v----全奖--4-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
} else { } else {
if achievement*100 >= CappingVal/100 { if achievement*100 >= CappingVal/100 {
scoreVal = (CappingVal / 100) * targetScore / 100 if CappingVal > 0 {
scoreVal = (CappingVal / 100) * targetScore
// fmt.Printf("%v----全奖--6-1->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
} else {
scoreVal = targetScore
// fmt.Printf("%v----全奖--6-2->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
}
} else { } else {
scoreVal = (chuShu / beiChuShu) * targetScore scoreVal = (chuShu / beiChuShu) * targetScore
// fmt.Printf("%v----全奖--6-3->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
} }
// fmt.Printf("%v----全奖--6-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
} }
achievement = commonus.DecimalEs(achievement*100, 4) achievement = commonus.DecimalEs(achievement*100, 4)
// fmt.Printf("%v----全奖--6-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement) // fmt.Printf("%v----全奖--6-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
@ -360,7 +370,12 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
} }
} }
if settlementScore == 0 {
scoreVal = 0
} else {
scoreVal = commonus.Decimal(scoreVal) scoreVal = commonus.Decimal(scoreVal)
}
allPrize = commonus.Decimal(allPrize) allPrize = commonus.Decimal(allPrize)
zeroPrize = commonus.Decimal(zeroPrize) zeroPrize = commonus.Decimal(zeroPrize)
CappingVal = commonus.Decimal(CappingVal) CappingVal = commonus.Decimal(CappingVal)

15
commonus/publichaneld.go

@ -4265,7 +4265,8 @@ func IsLeapYear(year int64) bool { //y == 2000,2004
return false return false
} }
/*WriteReplyLog(orderId, acceptDepartment, launchDepartment, launchUser, state, title, content) /*
WriteReplyLog(orderId, acceptDepartment, launchDepartment, launchUser, state, title, content)
@orderId 审批单key @orderId 审批单key
@title 节点名称 @title 节点名称
@acceptDepartment 接受考核部门 @acceptDepartment 接受考核部门
@ -4312,7 +4313,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
CappingVal = CappingVals / 100 CappingVal = CappingVals / 100
resultval = resultval / 100 resultval = resultval / 100
fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, allPrize, zeroPrize, CappingVal) fmt.Printf("达成率--1-->targetScore:%v-->resultval:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v\n", targetScore, resultval, allPrize, zeroPrize, CappingVal)
//不修正精度的达成率 //不修正精度的达成率
var achievementAll float64 = 0 var achievementAll float64 = 0
@ -4348,12 +4349,18 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
} else { } else {
if achievement*100 >= CappingVal { if achievement*100 >= CappingVal {
//如果达成率大于等于封顶值 //如果达成率大于等于封顶值
scoreVal = CappingVal * float64(targetScore) / 100 if CappingVal > 0 {
scoreVal = CappingVal * float64(targetScore)
} else {
scoreVal = float64(targetScore)
}
} else { } else {
// scoreVal = achievement * (float64(targetScore)) // scoreVal = achievement * (float64(targetScore))
scoreVal = achievementAll * (float64(targetScore)) scoreVal = achievementAll * (float64(targetScore))
} }
fmt.Printf("达成率--9-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) fmt.Printf("达成率--9-->targetScore:%v-->resultval:%v-->scoreVal:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v-->achievement:%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} }
achievement = DecimalEs(achievement*100, 4) achievement = DecimalEs(achievement*100, 4)
} else { } else {

Loading…
Cancel
Save