作者 tangxvhui

调整 评估分数的计算方式

@@ -5,13 +5,13 @@ go 1.16 @@ -5,13 +5,13 @@ go 1.16
5 require ( 5 require (
6 github.com/Andrew-M-C/go.timeconv v0.4.0 6 github.com/Andrew-M-C/go.timeconv v0.4.0
7 github.com/Shopify/sarama v1.25.0 7 github.com/Shopify/sarama v1.25.0
8 - github.com/beego/beego/v2 v2.0.5 8 + github.com/beego/beego/v2 v2.1.1
9 github.com/bwmarrin/snowflake v0.3.0 9 github.com/bwmarrin/snowflake v0.3.0
10 github.com/dgrijalva/jwt-go v3.2.0+incompatible 10 github.com/dgrijalva/jwt-go v3.2.0+incompatible
11 - github.com/go-pg/pg/v10 v10.10.7 11 + github.com/go-pg/pg/v10 v10.11.1
12 github.com/go-redis/redis/v8 v8.11.5 12 github.com/go-redis/redis/v8 v8.11.5
13 github.com/go-redsync/redsync/v4 v4.8.1 13 github.com/go-redsync/redsync/v4 v4.8.1
14 github.com/linmadan/egglib-go v0.0.0-20210827085852-177fa745932d 14 github.com/linmadan/egglib-go v0.0.0-20210827085852-177fa745932d
15 - github.com/xuri/excelize/v2 v2.6.1  
16 - golang.org/x/text v0.3.7 15 + github.com/xuri/excelize/v2 v2.7.1
  16 + golang.org/x/text v0.12.0
17 ) 17 )
此 diff 太大无法显示。
@@ -26,9 +26,12 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface @@ -26,9 +26,12 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface
26 }() 26 }()
27 //统一用户中心登录 27 //统一用户中心登录
28 authCodeReply, err := factory.UCenterApi().AuthCode(loginCommand.Code) 28 authCodeReply, err := factory.UCenterApi().AuthCode(loginCommand.Code)
29 - if err != nil || !authCodeReply.IsOk() { 29 + if err != nil {
30 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "【统一用户中心认证失败】"+authCodeReply.Msg+err.Error()) 30 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "【统一用户中心认证失败】"+authCodeReply.Msg+err.Error())
31 } 31 }
  32 + if !authCodeReply.IsOk() {
  33 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "【统一用户中心认证失败】"+authCodeReply.Msg)
  34 + }
32 //用户权限校验 35 //用户权限校验
33 userAuthReply, err := factory.BusinessAdminApi().GetUserAuth(authCodeReply.Data.MUid, loginCommand.PlatformId) 36 userAuthReply, err := factory.BusinessAdminApi().GetUserAuth(authCodeReply.Data.MUid, loginCommand.PlatformId)
34 if err != nil { 37 if err != nil {
@@ -127,26 +127,26 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -127,26 +127,26 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
127 if err := transactionContext.CommitTransaction(); err != nil { 127 if err := transactionContext.CommitTransaction(); err != nil {
128 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 128 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
129 } 129 }
130 - ratingHeader := []string{} //动态列,评级内容  
131 - ratingMap := map[string]struct{}{} //过滤重复code  
132 - evaluationRatingMap := map[int]map[string]int{}  
133 - for _, v := range evaluationList {  
134 - evaluationRatingMap[v.Id] = map[string]int{}  
135 - for _, v2 := range v.TotalRating {  
136 - if _, ok := ratingMap[v2.Code]; !ok {  
137 - ratingMap[v2.Code] = struct{}{}  
138 - ratingHeader = append(ratingHeader, v2.Code)  
139 - }  
140 - evaluationRatingMap[v.Id][v2.Code] = v2.Number  
141 - }  
142 - } 130 + // ratingHeader := []string{} //动态列,评级内容
  131 + // ratingMap := map[string]struct{}{} //过滤重复code
  132 + // evaluationRatingMap := map[int]map[string]int{}
  133 + // for _, v := range evaluationList {
  134 + // evaluationRatingMap[v.Id] = map[string]int{}
  135 + // for _, v2 := range v.TotalRating {
  136 + // if _, ok := ratingMap[v2.Code]; !ok {
  137 + // ratingMap[v2.Code] = struct{}{}
  138 + // ratingHeader = append(ratingHeader, v2.Code)
  139 + // }
  140 + // evaluationRatingMap[v.Id][v2.Code] = v2.Number
  141 + // }
  142 + // }
143 143
144 xlsxFile := excelize.NewFile() 144 xlsxFile := excelize.NewFile()
145 //设置默认的第一个sheet 145 //设置默认的第一个sheet
146 sheetIndex := xlsxFile.GetActiveSheetIndex() 146 sheetIndex := xlsxFile.GetActiveSheetIndex()
147 firstSheetName := xlsxFile.GetSheetName(sheetIndex) 147 firstSheetName := xlsxFile.GetSheetName(sheetIndex)
148 tableHead := []string{"姓名", "部门", "职位", "最终绩效得分"} 148 tableHead := []string{"姓名", "部门", "职位", "最终绩效得分"}
149 - tableHead = append(tableHead, ratingHeader...) 149 + // tableHead = append(tableHead, ratingHeader...)
150 // 最后一列 150 // 最后一列
151 tableHead = append(tableHead, "备注") 151 tableHead = append(tableHead, "备注")
152 if len(evaluationList) > 0 { 152 if len(evaluationList) > 0 {
@@ -179,13 +179,13 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu @@ -179,13 +179,13 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationFinish(param *command.Qu
179 positinName, 179 positinName,
180 v.TotalScore, 180 v.TotalScore,
181 } 181 }
182 - for _, v2 := range ratingHeader {  
183 - if num, ok := evaluationRatingMap[v.Id][v2]; ok {  
184 - dataRow = append(dataRow, fmt.Sprintf("%d", num))  
185 - } else {  
186 - dataRow = append(dataRow, "0")  
187 - }  
188 - } 182 + // for _, v2 := range ratingHeader {
  183 + // if num, ok := evaluationRatingMap[v.Id][v2]; ok {
  184 + // dataRow = append(dataRow, fmt.Sprintf("%d", num))
  185 + // } else {
  186 + // dataRow = append(dataRow, "0")
  187 + // }
  188 + // }
189 if v.CheckResult == domain.EvaluationCheckCompleted { 189 if v.CheckResult == domain.EvaluationCheckCompleted {
190 dataRow = append(dataRow, "已确认") 190 dataRow = append(dataRow, "已确认")
191 } else { 191 } else {
@@ -82,11 +82,11 @@ func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEv @@ -82,11 +82,11 @@ func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEv
82 for _, v := range valueList { 82 for _, v := range valueList {
83 if v.Weight == 0 { 83 if v.Weight == 0 {
84 evaluation.SumRatingCode(v.Rating.Code) 84 evaluation.SumRatingCode(v.Rating.Code)
85 - } else {  
86 - score, _ := strconv.ParseFloat(v.Score, 64)  
87 - totalScore += score  
88 } 85 }
  86 + score, _ := strconv.ParseFloat(v.Score, 64)
  87 + totalScore += score
89 } 88 }
  89 +
90 evaluation.TotalScore = fmt.Sprintf("%.1f", totalScore) 90 evaluation.TotalScore = fmt.Sprintf("%.1f", totalScore)
91 return nil 91 return nil
92 } 92 }
@@ -9,8 +9,8 @@ import ( @@ -9,8 +9,8 @@ import (
9 func TestGenerateToken(t *testing.T) { 9 func TestGenerateToken(t *testing.T) {
10 ut := UserAuth{ 10 ut := UserAuth{
11 CompanyId: 8, 11 CompanyId: 8,
12 - UserId: 3245763369805568,  
13 - Phone: "13066667710", 12 + UserId: 3422174102828544,
  13 + Phone: "17708397664",
14 PlatformId: 29, 14 PlatformId: 29,
15 AdminType: 1, 15 AdminType: 1,
16 } 16 }
@@ -385,6 +385,7 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() { @@ -385,6 +385,7 @@ func (c *SummaryEvaluationController) GetTargetEvaluationResult() {
385 c.Response(data, err) 385 c.Response(data, err)
386 } 386 }
387 387
  388 +// 按周期获取所有员工的评估考核结果
388 func (c *SummaryEvaluationController) ListAllEvaluationFinish() { 389 func (c *SummaryEvaluationController) ListAllEvaluationFinish() {
389 srv := service.NewSummaryEvaluationService() 390 srv := service.NewSummaryEvaluationService()
390 param := &command.QueryEvaluationList{} 391 param := &command.QueryEvaluationList{}