作者 tangxvhui

暂存

... ... @@ -22,19 +22,3 @@ type AssessInfoResp struct {
DutyTime string `json:"dutyTime"` //入职时间 //
AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容
}
type AssessContent struct {
Category string `json:"category"` //comment:"类别"
Name string `json:"name"` // comment:"名称"
PromptTitle string `json:"promptTitle"` //comment:"提示项标题"
PromptText string `json:"promptText"` // comment:"提示项正文"
Rule AssessContentRule `json:"rules"` //评定规则
Value string `json:"value"` // 实际填写评定值
Remark []domain.AssessContemtRemark `json:"entryItems"` // comment:"填写反馈"
}
type AssessContentRule struct {
Types int `json:"types"` //评估方式(0评级、1评分)
Rating domain.Rating `json:"rating"` //评级
Score domain.Score `json:"score"` //评分
}
... ...
... ... @@ -540,7 +540,7 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application.
assessList = append(assessList, assessListTemp...)
}
if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
// TODO
// 创建上级评估
stepSelfTemp.BeginTime = v.BeginTime
stepSelfTemp.EndTime = v.EndTime
stepSelfTemp.LinkNodeId = v.LinkNodeId
... ... @@ -1623,7 +1623,7 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T
UserName: userData.Name,
CompanyName: companyData.Name,
SupperUserName: "",
DutyTime: userData.CreatedAt.Local().Format("2006-01-02 15:04:05"),
DutyTime: userData.EntryTime,
}
for _, v := range supperUserList {
userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " "
... ...
package domain
import (
"errors"
"time"
)
... ... @@ -55,6 +56,48 @@ type EvaluationRule struct {
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
//根据评估填写的值,得出等级名称,
//如果 评估方式是评分,对评估填写的值 的小数点进行处理
//value 根据评估填写的值
func (rule *EvaluationRule) ScoreOrRating(value *string) (string, error) {
switch rule.Type {
case EvaluationTypeRating:
return rule.RatingValue(value)
case EvaluationTypeScore:
return rule.ScoreValue(value)
}
return "", errors.New("rule.Type 错误")
}
//根据评估填写的值,得出等级名称,
func (rule *EvaluationRule) ScoreValue(value *string) (string, error) {
// valueFloat, err := strconv.ParseFloat(*value, 64)
// if err != nil {
// return "", errors.New("评分填写的值错误")
// }
// if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max {
// return "", errors.New("评分填写的值超出限制")
// }
valueDescrip := ""
// for _, v := range rule.Score.Levels {
// if valueFloat >= v.Start && valueFloat <= v.End {
// valueDescrip = v.Name
// }
// }
return valueDescrip, nil
}
//根据评估填写的值,得出等级名称,
func (rule *EvaluationRule) RatingValue(value *string) (string, error) {
for _, v := range rule.Rating.Levels {
if v.Code == *value {
return v.Name, nil
}
}
return "", errors.New("评估填写的值错误")
}
// GenerateSysRule 当前公司下的生成默认规则
func GenerateSysRule(companyId int64) *EvaluationRule {
levels := make([]*RatingLevel, 0)
... ...