summary_evaluation.go
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package domain
import (
"fmt"
"time"
)
// 周综合评估
type SummaryEvaluation struct {
Id int
CompanyId int //公司id
EvaluationProjectId int //对应的项目id
EvaluationProjectName string //对应的项目名称
CycleId int64 //对应的周期id
CycleName string //对应的周期名称
NodeId int
TargetUser StaffDesc //被评估的目标用户,被执行的
TargetDepartment []StaffDepartment //被评估的目标用户所在的部门
Executor StaffDesc //填写评估的用户,执行人
Types EvaluationType //评估类型
Status EvaluationStatus //评估的填写状态
CheckResult EvaluationCheckResult //被执行的人确认评估结果
BeginTime time.Time //开始时间
EndTime time.Time //截止时间
TotalScore string //最终上级评估得分.
CreatedAt time.Time //数据创建时间
UpdatedAt time.Time //数据更新时间
DeletedAt *time.Time //数据删除时间
}
type EvaluationType int //综合评估类型
const (
EvaluationSelf EvaluationType = 1 //自评
Evaluation360 EvaluationType = 2 //360评估
EvaluationSuper EvaluationType = 3 //上级评估
EvaluationHrbp EvaluationType = 4 //人资评估
)
// 评估的填写状态
type EvaluationStatus string
const (
EvaluationUncompleted EvaluationStatus = "uncompleted" //未提交填写的内容
EvaluationCompleted EvaluationStatus = "completed" //已提交填写的内容
)
// 被执行的人确认评估结果
type EvaluationCheckResult string
const (
EvaluationCheckUncompleted EvaluationCheckResult = "uncompleted" //未确认结果
EvaluationCheckCompleted EvaluationCheckResult = "completed" //已确认结果
)
type SummaryEvaluationRepository interface {
Save(param *SummaryEvaluation) error
Remove(id int) error
FindOne(queryOptions map[string]interface{}) (*SummaryEvaluation, error)
Find(queryOptions map[string]interface{}) (int, []*SummaryEvaluation, error)
}
// 计算总分。TotalScore 保留1位小数
func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEvaluationValue) error {
var totalScore float64
for _, v := range valueList {
score, err := v.SumScore(v.Weight, v.Value)
if err != nil {
return err
}
totalScore += score
}
evaluation.TotalScore = fmt.Sprintf("%.2f", totalScore)
return nil
}