作者 tangxvhui

调整 评估分数的计算方式

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