Browse Source

修改关联部门

master
超级管理员 3 years ago
parent
commit
a7218e0f62
  1. 12
      api/admin/dutyassess/dutyhandle.go
  2. 9
      api/index/statistics/newstatistics.go
  3. 12
      api/index/statistics/tablestatistics.go
  4. 114
      api/statistics/quantification/summary_details.go
  5. 34
      commonus/publichaneld.go

12
api/admin/dutyassess/dutyhandle.go

@ -1448,6 +1448,10 @@ func (d *DutyAssessApi) NewEiteDetailedTarget(c *gin.Context) {
response.Result(105, errAssErr, "指标明细编辑失败!", c) response.Result(105, errAssErr, "指标明细编辑失败!", c)
return return
} }
WriteBackTargetDepartment(strconv.FormatInt(assCont.TargetId, 10), strings.Split(departmentStr, ","))
WriteBackSunTargetDepartment(strconv.FormatInt(assCont.SunTargetId, 10), strings.Split(departmentStr, ","))
//设定定性考核指标新增键对关系 //设定定性考核指标新增键对关系
var addOpentDetial DutyAssEssTarget var addOpentDetial DutyAssEssTarget
addOpentDetial.Id = detailedTargetInfo.Id addOpentDetial.Id = detailedTargetInfo.Id
@ -1487,8 +1491,8 @@ func (d *DutyAssessApi) NewEiteDetailedTarget(c *gin.Context) {
} }
eiteErring := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", assCont.Id).Updates(&eiteContIng).Error eiteErring := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", assCont.Id).Updates(&eiteContIng).Error
if eiteErring == nil { if eiteErring == nil {
WriteBackTargetDepartment(strconv.FormatInt(assCont.TargetId, 10), strings.Split(departmentStr, ",")) // WriteBackTargetDepartment(strconv.FormatInt(assCont.TargetId, 10), strings.Split(departmentStr, ","))
WriteBackSunTargetDepartment(strconv.FormatInt(assCont.SunTargetId, 10), strings.Split(departmentStr, ",")) // WriteBackSunTargetDepartment(strconv.FormatInt(assCont.SunTargetId, 10), strings.Split(departmentStr, ","))
response.Result(0, err, "处理成功!2", c) response.Result(0, err, "处理成功!2", c)
} else { } else {
response.Result(107, err, "请添加测评详情!", c) response.Result(107, err, "请添加测评详情!", c)
@ -1520,8 +1524,8 @@ func (d *DutyAssessApi) NewEiteDetailedTarget(c *gin.Context) {
} }
eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", assCont.Id).Updates(&eiteCont).Error eiteErr := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.Assesstarget{}).Where("`at_id` = ?", assCont.Id).Updates(&eiteCont).Error
if eiteErr == nil { if eiteErr == nil {
WriteBackTargetDepartment(strconv.FormatInt(assCont.TargetId, 10), strings.Split(departmentStr, ",")) // WriteBackTargetDepartment(strconv.FormatInt(assCont.TargetId, 10), strings.Split(departmentStr, ","))
WriteBackSunTargetDepartment(strconv.FormatInt(assCont.SunTargetId, 10), strings.Split(departmentStr, ",")) // WriteBackSunTargetDepartment(strconv.FormatInt(assCont.SunTargetId, 10), strings.Split(departmentStr, ","))
response.Result(0, err, "处理成功!1", c) response.Result(0, err, "处理成功!1", c)
} else { } else {
response.Result(107, err, "请添加测评详情!", c) response.Result(107, err, "请添加测评详情!", c)

9
api/index/statistics/newstatistics.go

@ -54,9 +54,9 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
} }
gormDb = gormDb.Order("`id` ASC").Find(&fldList) gormDb = gormDb.Order("`id` ASC").Find(&fldList)
jsCon, _ := json.Marshal(fldList) // jsCon, _ := json.Marshal(fldList)
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
@ -68,7 +68,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
// var realScore float64 = 0 // var realScore float64 = 0
if len(fldList) > 0 { if len(fldList) > 0 {
for _, v := range fldList { for _, v := range fldList {
// fmt.Printf("Key----------------->%v\n", v.Key) fmt.Printf("Key----------------->%v\n", v.Key)
if v.Key != 0 { if v.Key != 0 {
lastEvalId = v.Key lastEvalId = v.Key
} }
@ -91,6 +91,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
} }
} }
fmt.Printf("atScore--->%v\n", atScore)
tableScoreCont.ScoreVal = commonus.Decimal(atScore / 100) tableScoreCont.ScoreVal = commonus.Decimal(atScore / 100)
targetIdInt, _ := strconv.ParseInt(targetId, 10, 64) targetIdInt, _ := strconv.ParseInt(targetId, 10, 64)
groupId, _ := strconv.ParseInt(group, 10, 64) groupId, _ := strconv.ParseInt(group, 10, 64)
@ -106,7 +107,7 @@ func (t *tablePlanVersionStic) conditionStatisticsNew(group, department, dimensi
if status == 3 { if status == 3 {
tableScoreCont.ActualScore = float64(referenceScore) tableScoreCont.ActualScore = float64(referenceScore)
} }
tableScoreCont.ActualScore = tableScoreCont.ActualScore + commonus.Decimal(shouDongFenzhi/100) tableScoreCont.ActualScore = commonus.DecimalEs(tableScoreCont.ActualScore+commonus.Decimal(shouDongFenzhi/100), 2)
// tableScoreCont.ActualScore = commonus.Decimal(mtScore / 100) // tableScoreCont.ActualScore = commonus.Decimal(mtScore / 100)
t.TableScore = append(t.TableScore, tableScoreCont) t.TableScore = append(t.TableScore, tableScoreCont)
syncProcessDepartTarget.Done() syncProcessDepartTarget.Done()

12
api/index/statistics/tablestatistics.go

@ -64,6 +64,7 @@ func (a *ApiGroup) GetPlanVersionValid(c *gin.Context) {
response.Result(102, err, "没有查询到数据", c) response.Result(102, err, "没有查询到数据", c)
return return
} }
// yserInt, _ := strconv.ParseInt(requestData.Year, 10, 64) // yserInt, _ := strconv.ParseInt(requestData.Year, 10, 64)
// var outData []TargetContOutCont // var outData []TargetContOutCont
var xieCheng dataLockStatistics var xieCheng dataLockStatistics
@ -869,7 +870,7 @@ func (t *tablePlanVersionStic) SubjectiveAuxiliaryCalculationSumMethod(wherStr s
// } // }
} }
// fmt.Printf("referenceScore--4--->%v\n", referenceScore) fmt.Printf("referenceScore--4--->%v\n", referenceScore)
t.TableScore = append(t.TableScore, tableScoreCont) t.TableScore = append(t.TableScore, tableScoreCont)
syncProcessDepartTarget.Done() syncProcessDepartTarget.Done()
} }
@ -887,7 +888,8 @@ func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVe
//进行维度操作 //进行维度操作
for _, pv := range planInfo { for _, pv := range planInfo {
for _, pcv := range pv.Child { //指标列表 for _, pcv := range pv.Child { //指标列表
// if pcv.Id == "4" {
fmt.Printf("pcv.Id------------------->%v\n", pcv.Id)
if pcv.Status != 2 { //忽略掉禁用的指标 if pcv.Status != 2 { //忽略掉禁用的指标
var outCont TargetContOutCont var outCont TargetContOutCont
outCont.Id = strconv.FormatInt(pvInfo.Id, 10) outCont.Id = strconv.FormatInt(pvInfo.Id, 10)
@ -1349,8 +1351,8 @@ func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVe
sort.Slice(readStatisticsData, func(i int, j int) bool { sort.Slice(readStatisticsData, func(i int, j int) bool {
return readStatisticsData[i].Counter < readStatisticsData[j].Counter return readStatisticsData[i].Counter < readStatisticsData[j].Counter
}) })
// jsonVal, jsonErr := json.Marshal(readStatisticsData) jsonVal, jsonErr := json.Marshal(readStatisticsData)
// fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr) fmt.Printf("排序------%v--------》%v--------》%v\n", pvInfo.Id, string(jsonVal), jsonErr)
for _, rsdv := range readStatisticsData { for _, rsdv := range readStatisticsData {
var jiSuanZhi ScoreList var jiSuanZhi ScoreList
@ -1387,6 +1389,8 @@ func (d *dataLockStatistics) planVersiconProcessV1(pvInfo assessmentmodel.PlanVe
} }
} }
// }
} }
} }
} }

114
api/statistics/quantification/summary_details.go

@ -58,53 +58,53 @@ 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 == "52" { // 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
groupCont.GetCont(map[string]interface{}{"`id`": planVersion.Group}, "name") groupCont.GetCont(map[string]interface{}{"`id`": planVersion.Group}, "name")
statisCont.GroupName = groupCont.Name //集团名称 statisCont.GroupName = groupCont.Name //集团名称
statisCont.DepartmentId = strconv.FormatInt(planVersion.Department, 10) //部门ID statisCont.DepartmentId = strconv.FormatInt(planVersion.Department, 10) //部门ID
var departCont hrsystem.AdministrativeOrganization var departCont hrsystem.AdministrativeOrganization
departCont.GetCont(map[string]interface{}{"`id`": planVersion.Department}, "name") departCont.GetCont(map[string]interface{}{"`id`": planVersion.Department}, "name")
statisCont.DepartmentName = departCont.Name //部门名称 statisCont.DepartmentName = departCont.Name //部门名称
statisCont.DimensionId = v.Id //维度Id statisCont.DimensionId = v.Id //维度Id
statisCont.DimensionName = v.Name //维度名称 statisCont.DimensionName = v.Name //维度名称
statisCont.DimensionWeight = int64(v.ZhiFraction) //维度权重 statisCont.DimensionWeight = int64(v.ZhiFraction) //维度权重
statisCont.TargetId = cv.Id //指标ID statisCont.TargetId = cv.Id //指标ID
statisCont.TargetName = cv.Name //指标名称 statisCont.TargetName = cv.Name //指标名称
statisCont.TargetCont = cv.Content //指标名称 statisCont.TargetCont = cv.Content //指标名称
statisCont.Targetweight = cv.ReferenceScore //指标权重 statisCont.Targetweight = cv.ReferenceScore //指标权重
var evalTargetCont assessmentmodel.EvaluationTarget var evalTargetCont assessmentmodel.EvaluationTarget
if cv.Id != "" && cv.Id != "0" { if cv.Id != "" && cv.Id != "0" {
targetErr := evalTargetCont.GetCont(map[string]interface{}{"`et_id`": cv.Id}, "et_type") targetErr := evalTargetCont.GetCont(map[string]interface{}{"`et_id`": cv.Id}, "et_type")
if targetErr == nil { if targetErr == nil {
if evalTargetCont.Type == 1 { if evalTargetCont.Type == 1 {
statisCont.Score, statisCont.ExecutiveDepartment = DingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status) statisCont.Score, statisCont.ExecutiveDepartment = DingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
sumScore = sumScore + statisCont.Score sumScore = sumScore + statisCont.Score
} else { } else {
statisCont.Score, statisCont.ExecutiveDepartment = DingLiangMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status) statisCont.Score, statisCont.ExecutiveDepartment = DingLiangMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id, cv.Cycles, cv.Status)
sumScore = sumScore + statisCont.Score sumScore = sumScore + statisCont.Score
}
} }
} }
statisCont.Type = evalTargetCont.Type //1:定性;2:定量
statisCont.Unit = cv.Unit //单位
statisCont.Cycle = cv.Cycles //周期
statisCont.Cycleattr = cv.CycleAttres //辅助参数
// statisCont.ExecutiveDepartment = //执行部门
// statisCont.Score = //得分
// if cv.Id != "" && cv.Id != "0" {
// // var targetCont assessmentmodel.EvaluationTarget
// // targetErr := global.GVA_DB_Performanceappraisal.Model(&targetCont).Select("et_type").Where("et_id = ?", cv.Id).First(&targetCont).Error
// if targetErr == nil {
// statisCont.Score, statisCont.ExecutiveDepartment = dingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id)
// }
// }
lookStatistics = append(lookStatistics, statisCont)
} }
statisCont.Type = evalTargetCont.Type //1:定性;2:定量
statisCont.Unit = cv.Unit //单位
statisCont.Cycle = cv.Cycles //周期
statisCont.Cycleattr = cv.CycleAttres //辅助参数
// statisCont.ExecutiveDepartment = //执行部门
// statisCont.Score = //得分
// if cv.Id != "" && cv.Id != "0" {
// // var targetCont assessmentmodel.EvaluationTarget
// // targetErr := global.GVA_DB_Performanceappraisal.Model(&targetCont).Select("et_type").Where("et_id = ?", cv.Id).First(&targetCont).Error
// if targetErr == nil {
// statisCont.Score, statisCont.ExecutiveDepartment = dingXingMonthSum(planVersion.Group, planVersion.Department, cv.ReferenceScore, requestData.Year, int64(requestData.Months), cv.Id)
// }
// }
lookStatistics = append(lookStatistics, statisCont)
// }
} }
} }
@ -348,7 +348,7 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
// fmt.Printf("%v----全奖--8-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement) // fmt.Printf("%v----全奖--8-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement)
} else { } else {
if achievement*100 >= CappingVal { if achievement*100 >= CappingVal {
scoreVal = (CappingVal / 100) * targetScore / 100 scoreVal = (CappingVal / 100) * targetScore
// fmt.Printf("%v----全奖--13-->%v--零奖------->%v----封顶值---->%v----指标---->%v----计算---->%v-----结果------->%v-----达成率------->%v\n", targetId, allPrize, zeroPrize, CappingVal, targetScore, settlementScore, scoreVal, achievement) // fmt.Printf("%v----全奖--13-->%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
@ -370,12 +370,12 @@ func analysisReward(targetId, rewardCont string, targetScore, settlementScore fl
} }
} }
if settlementScore == 0 { // if settlementScore == 0 {
scoreVal = 0 // scoreVal = 0
} else { // } else {
scoreVal = commonus.Decimal(scoreVal) // 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)
@ -438,11 +438,11 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
var listCont dingLiangKaoHe var listCont dingLiangKaoHe
var settlementScore float64 = 0 var settlementScore float64 = 0
if v.ScoringMethod == 1 { if v.ScoringMethod == 1 {
listCont.Actual = float64(v.Score) listCont.Actual = commonus.Decimal(float64(v.Score) / 100)
settlementScore = float64(v.Score) settlementScore = float64(v.Score)
listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) listCont.Score, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
} else { } else {
listCont.Actual = float64(v.ScoringScore) listCont.Actual = commonus.Decimal(float64(v.ScoringScore) / 100)
// settlementScore = float64(v.ScoringScore) // settlementScore = float64(v.ScoringScore)
_, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore) _, listCont.Allprize, listCont.Zeroprize, listCont.Capping, listCont.CompletionRate = analysisReward(strconv.FormatInt(v.TargetId, 10), v.Baseline, targetScore, settlementScore)
listCont.Score = float64(v.ScoringScore) listCont.Score = float64(v.ScoringScore)
@ -478,10 +478,10 @@ func (a *ApiGroup) SummaryDetailsLiangLog(c *gin.Context) {
} }
default: default:
} }
listCont.Allprize = commonus.Decimal(listCont.Allprize / 100) listCont.Allprize = commonus.Decimal(listCont.Allprize)
listCont.Zeroprize = commonus.Decimal(listCont.Zeroprize / 100) listCont.Zeroprize = commonus.Decimal(listCont.Zeroprize)
listCont.Capping = commonus.Decimal(listCont.Capping / 100) listCont.Capping = commonus.Decimal(listCont.Capping)
listCont.Actual = commonus.Decimal(listCont.Actual / 100) listCont.Actual = commonus.Decimal(listCont.Actual)
list = append(list, listCont) list = append(list, listCont)
} }

34
commonus/publichaneld.go

@ -4313,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-->targetScore:%v-->resultval:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%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
@ -4325,7 +4325,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
scoreVal = 0 scoreVal = 0
} }
achievementAll = 100 achievementAll = 100
fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
if allPrize > zeroPrize { //如果全奖值大于零奖值 执行一下操作 if allPrize > zeroPrize { //如果全奖值大于零奖值 执行一下操作
if resultval <= zeroPrize { //实际结算值小于零奖值 那么达成率和实际得分都是0 if resultval <= zeroPrize { //实际结算值小于零奖值 那么达成率和实际得分都是0
@ -4333,7 +4333,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
// } else if resultval > allPrize { //实际结算值大于全奖值 执行一下操作 // } else if resultval > allPrize { //实际结算值大于全奖值 执行一下操作
fmt.Printf("达成率--7-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--7-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { //实际结算值在全奖值 与 零奖值之间 } else { //实际结算值在全奖值 与 零奖值之间
chuShu := resultval - float64(zeroPrize) chuShu := resultval - float64(zeroPrize)
beiChuShu := float64(allPrize) - float64(zeroPrize) beiChuShu := float64(allPrize) - float64(zeroPrize)
@ -4345,22 +4345,26 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
achievement = 0 achievement = 0
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
fmt.Printf("达成率--8-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--8-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
//fmt.Printf("达成率--9-1->targetScore:%v-->resultval:%v-->scoreVal:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v-->achievement:%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
if achievement*100 >= CappingVal { if achievement*100 >= CappingVal {
//如果达成率大于等于封顶值 //如果达成率大于等于封顶值
if CappingVal > 0 { if CappingVal > 0 {
scoreVal = CappingVal * float64(targetScore) scoreVal = (CappingVal / 100) * float64(targetScore)
//fmt.Printf("达成率--9-2->targetScore:%v-->resultval:%v-->scoreVal:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v-->achievement:%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
//fmt.Printf("达成率--9-3->targetScore:%v-->resultval:%v-->scoreVal:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v-->achievement:%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
scoreVal = float64(targetScore) scoreVal = float64(targetScore)
} }
} else { } else {
// scoreVal = achievement * (float64(targetScore)) // scoreVal = achievement * (float64(targetScore))
scoreVal = achievementAll * (float64(targetScore)) scoreVal = achievementAll * (float64(targetScore))
//fmt.Printf("达成率--9-4->targetScore:%v-->resultval:%v-->scoreVal:%v-->allPrize:%v-->zeroPrize:%v-->CappingVal:%v-->achievement:%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) //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 {
@ -4368,7 +4372,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
achievement = 0 achievement = 0
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
fmt.Printf("达成率--10-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--10-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} }
} }
@ -4377,7 +4381,7 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
achievement = 0 achievement = 0
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--1-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
chuShu := resultval - float64(zeroPrize) chuShu := resultval - float64(zeroPrize)
beiChuShu := float64(allPrize) - float64(zeroPrize) beiChuShu := float64(allPrize) - float64(zeroPrize)
@ -4389,40 +4393,40 @@ func CalculateScore(targetScore int64, resultval, allPrizes, zeroPrizes, Capping
achievement = 0 achievement = 0
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
fmt.Printf("达成率--2-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--2-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
if achievement*100 >= CappingVal { if achievement*100 >= CappingVal {
//如果达成率大于等于封顶值 //如果达成率大于等于封顶值
scoreVal = CappingVal * float64(targetScore) / 100 scoreVal = CappingVal * float64(targetScore) / 100
fmt.Printf("达成率--3-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--3-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
// scoreVal = achievement * (float64(targetScore)) // scoreVal = achievement * (float64(targetScore))
scoreVal = achievementAll * (float64(targetScore)) scoreVal = achievementAll * (float64(targetScore))
fmt.Printf("达成率--4-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--4-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} }
} }
achievement = DecimalEs(achievement*100, 4) achievement = DecimalEs(achievement*100, 4)
fmt.Printf("达成率--6-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--6-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} else { } else {
//被除数为0时 那么达成率和实际得分都是0 //被除数为0时 那么达成率和实际得分都是0
achievement = 0 achievement = 0
scoreVal = 0 scoreVal = 0
achievementAll = 0 achievementAll = 0
fmt.Printf("达成率--5-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--5-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} }
} }
} }
} }
if typeClass == 3 { if typeClass == 3 {
scoreVal = float64(targetScore) scoreVal = float64(targetScore)
fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--11-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
} }
scoreVal = Decimal(scoreVal) scoreVal = Decimal(scoreVal)
allPrize = Decimal(allPrize) allPrize = Decimal(allPrize)
zeroPrize = Decimal(zeroPrize) zeroPrize = Decimal(zeroPrize)
CappingVal = Decimal(CappingVal) CappingVal = Decimal(CappingVal)
achievement = DecimalEs(achievement, 4) achievement = DecimalEs(achievement, 4)
fmt.Printf("达成率--12-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement) //fmt.Printf("达成率--12-->%v-->%v-->%v-->%v-->%v-->%v-->%v\n", targetScore, resultval, scoreVal, allPrize, zeroPrize, CappingVal, achievement)
return return
} }

Loading…
Cancel
Save