正在显示
3 个修改的文件
包含
45 行增加
和
18 行删除
@@ -22,19 +22,3 @@ type AssessInfoResp struct { | @@ -22,19 +22,3 @@ type AssessInfoResp struct { | ||
22 | DutyTime string `json:"dutyTime"` //入职时间 // | 22 | DutyTime string `json:"dutyTime"` //入职时间 // |
23 | AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 | 23 | AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容 |
24 | } | 24 | } |
25 | - | ||
26 | -type AssessContent struct { | ||
27 | - Category string `json:"category"` //comment:"类别" | ||
28 | - Name string `json:"name"` // comment:"名称" | ||
29 | - PromptTitle string `json:"promptTitle"` //comment:"提示项标题" | ||
30 | - PromptText string `json:"promptText"` // comment:"提示项正文" | ||
31 | - Rule AssessContentRule `json:"rules"` //评定规则 | ||
32 | - Value string `json:"value"` // 实际填写评定值 | ||
33 | - Remark []domain.AssessContemtRemark `json:"entryItems"` // comment:"填写反馈" | ||
34 | -} | ||
35 | - | ||
36 | -type AssessContentRule struct { | ||
37 | - Types int `json:"types"` //评估方式(0评级、1评分) | ||
38 | - Rating domain.Rating `json:"rating"` //评级 | ||
39 | - Score domain.Score `json:"score"` //评分 | ||
40 | -} |
@@ -540,7 +540,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. | @@ -540,7 +540,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. | ||
540 | assessList = append(assessList, assessListTemp...) | 540 | assessList = append(assessList, assessListTemp...) |
541 | } | 541 | } |
542 | if v.LinkNodeType == domain.LinkNodeSuperiorAssessment { | 542 | if v.LinkNodeType == domain.LinkNodeSuperiorAssessment { |
543 | - // TODO | 543 | + // 创建上级评估 |
544 | stepSelfTemp.BeginTime = v.BeginTime | 544 | stepSelfTemp.BeginTime = v.BeginTime |
545 | stepSelfTemp.EndTime = v.EndTime | 545 | stepSelfTemp.EndTime = v.EndTime |
546 | stepSelfTemp.LinkNodeId = v.LinkNodeId | 546 | stepSelfTemp.LinkNodeId = v.LinkNodeId |
@@ -1623,7 +1623,7 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | @@ -1623,7 +1623,7 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T | ||
1623 | UserName: userData.Name, | 1623 | UserName: userData.Name, |
1624 | CompanyName: companyData.Name, | 1624 | CompanyName: companyData.Name, |
1625 | SupperUserName: "", | 1625 | SupperUserName: "", |
1626 | - DutyTime: userData.CreatedAt.Local().Format("2006-01-02 15:04:05"), | 1626 | + DutyTime: userData.EntryTime, |
1627 | } | 1627 | } |
1628 | for _, v := range supperUserList { | 1628 | for _, v := range supperUserList { |
1629 | userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " " | 1629 | userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " " |
1 | package domain | 1 | package domain |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "errors" | ||
4 | "time" | 5 | "time" |
5 | ) | 6 | ) |
6 | 7 | ||
@@ -55,6 +56,48 @@ type EvaluationRule struct { | @@ -55,6 +56,48 @@ type EvaluationRule struct { | ||
55 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | 56 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` |
56 | } | 57 | } |
57 | 58 | ||
59 | +//根据评估填写的值,得出等级名称, | ||
60 | +//如果 评估方式是评分,对评估填写的值 的小数点进行处理 | ||
61 | +//value 根据评估填写的值 | ||
62 | +func (rule *EvaluationRule) ScoreOrRating(value *string) (string, error) { | ||
63 | + switch rule.Type { | ||
64 | + case EvaluationTypeRating: | ||
65 | + return rule.RatingValue(value) | ||
66 | + case EvaluationTypeScore: | ||
67 | + return rule.ScoreValue(value) | ||
68 | + } | ||
69 | + return "", errors.New("rule.Type 错误") | ||
70 | +} | ||
71 | + | ||
72 | +//根据评估填写的值,得出等级名称, | ||
73 | +func (rule *EvaluationRule) ScoreValue(value *string) (string, error) { | ||
74 | + // valueFloat, err := strconv.ParseFloat(*value, 64) | ||
75 | + // if err != nil { | ||
76 | + // return "", errors.New("评分填写的值错误") | ||
77 | + // } | ||
78 | + // if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max { | ||
79 | + // return "", errors.New("评分填写的值超出限制") | ||
80 | + // } | ||
81 | + | ||
82 | + valueDescrip := "" | ||
83 | + // for _, v := range rule.Score.Levels { | ||
84 | + // if valueFloat >= v.Start && valueFloat <= v.End { | ||
85 | + // valueDescrip = v.Name | ||
86 | + // } | ||
87 | + // } | ||
88 | + return valueDescrip, nil | ||
89 | +} | ||
90 | + | ||
91 | +//根据评估填写的值,得出等级名称, | ||
92 | +func (rule *EvaluationRule) RatingValue(value *string) (string, error) { | ||
93 | + for _, v := range rule.Rating.Levels { | ||
94 | + if v.Code == *value { | ||
95 | + return v.Name, nil | ||
96 | + } | ||
97 | + } | ||
98 | + return "", errors.New("评估填写的值错误") | ||
99 | +} | ||
100 | + | ||
58 | // GenerateSysRule 当前公司下的生成默认规则 | 101 | // GenerateSysRule 当前公司下的生成默认规则 |
59 | func GenerateSysRule(companyId int64) *EvaluationRule { | 102 | func GenerateSysRule(companyId int64) *EvaluationRule { |
60 | levels := make([]*RatingLevel, 0) | 103 | levels := make([]*RatingLevel, 0) |
-
请 注册 或 登录 后发表评论