作者 郑周

1. 评估周期模型

2. 评估项目模型
3. 评估模板模型
4. 评估规则模型

定义数据模型
package domain
import (
"time"
)
type EvaluationCycle struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
TimeStart *time.Time `json:"timeStart" comment:"起始时间"`
TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"`
CompanyId int64 `json:"companyId,string" comment:"公司ID"`
CreatorId int64 `json:"creatorId,string" comment:"创建人ID"`
KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"`
Template []EvaluationTemplate `json:"template" comment:"周期使用模板"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
... ...
package domain
import (
"time"
)
type EvaluationProject struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
Describe string `json:"describe" comment:"描述"`
CompanyId int64 `json:"companyId,string" comment:"公司ID"`
CreatorId int64 `json:"creatorId,string" comment:"创建人ID"`
HrBp int `json:"hrBp" comment:"HR角色权限"`
Pms []string `json:"pms" comment:"项目管理员ID"`
Recipients []string `json:"recipients" comment:"被评估人ID"`
Template *EvaluationTemplate `json:"template" comment:"评估模板"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
... ...
package domain
import (
"time"
)
const (
EvaluationTypeRating int = 0 // 评估方式-评级
EvaluationTypeScore int = 1 // 评估方式-评分
)
type Rating struct {
Levels []RatingLevel `comment:"配置等级"`
}
type RatingLevel struct {
Code string `json:"code" comment:"等级代号"`
Name string `json:"name" comment:"等级名称"`
Color int `json:"color" comment:"等级颜色"`
QuantizedValue float64 `json:"quantizedValue" comment:"等级量化值"`
}
type Score struct {
Min float64 `json:"min" comment:"评分下限"`
Max float64 `json:"max" comment:"评分上限"`
IntervalState int `json:"intervalState" comment:"按分数子区间匹配等级(0关闭、1开启)"`
DecimalPlaces int `json:"decimalPlaces" comment:"保留小数点(0不保留、1保留一位、以此类推)"`
Levels []ScoreLevel `json:"levels" comment:"配置等级区间"`
}
type ScoreLevel struct {
Code string `json:"code" comment:"等级代号"`
Name string `json:"name" comment:"等级名称"`
Start float64 `json:"start" comment:"分数区间开始值"`
End float64 `json:"end" comment:"分数区间结束值"`
}
type EvaluationRule struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
Remark string `json:"remark" comment:"备注"`
CompanyId int64 `json:"companyId,string" comment:"公司ID"`
CreatorId int64 `json:"creatorId,string" comment:"创建人ID"`
Type int `json:"type" comment:"评估方式(0评级、1评分)"`
Rating *Rating `json:"rating" comment:"评级"`
Score *Score `json:"score" comment:"评分"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
... ...
package domain
import (
"time"
)
const (
TemplateStateWaitConfig int = 0 // 模板状态-待完成配置
TemplateStateWaitActive int = 1 // 模板状态-待启用
TemplateStateEnable int = 2 // 模板状态-启用
TemplateStateDisable int = 3 // 模板状态-停用
)
const (
LinkNodeSelfAssessment int = 1 // 环节-填写反馈自评
LinkNodeAllInvite int = 2 // 环节-360°邀请
LinkNodeAllAssessment int = 3 // 环节-360°评估
LinkNodeSuperiorAssessment int = 4 // 环节-上级评估
LinkNodeViewResult int = 5 // 环节-绩效结果查看
)
const (
KpiCycleDay int = 0 // 考核周期-日
KpiCycleWeek int = 1 // 考核周期-周
KpiCycleMonth int = 2 // 考核周期-月
)
type EntryItem struct {
Title string `json:"title" comment:"填写标题"`
HintText string `json:"hintText" comment:"文本内容提示"`
}
type EvaluationContent struct {
Category string `json:"category" comment:"类别"`
Name string `json:"name" comment:"名称"`
RuleId int64 `json:"ruleId" comment:"评估规则ID"`
PromptTitle string `json:"promptTitle" comment:"提示项标题"`
PromptText string `json:"promptText" comment:"提示项正文"`
EntryItems []EntryItem `json:"entryItems" comment:"填写项"`
}
type LinkNode struct {
Type int `json:"type" comment:"环节类型(1~5)"`
Name string `json:"name" comment:"环节名称"`
Describe string `json:"describe" comment:"环节描述"`
EvaluationContents []EvaluationContent `json:"evaluationContents" comment:"环节评估内容"`
TimeStart *time.Time `json:"timeStart" comment:"起始时间"`
TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"`
KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"`
}
//type EvaluationLink struct {
// NodeSelfAssessment *LinkNode `json:"nodeSelfAssessment" comment:"填写反馈自评"`
// NodeAllInvite *LinkNode `json:"nodeAllInvite" comment:"360°邀请"`
// NodeAllAssessment *LinkNode `json:"nodeAllAssessment" comment:"360°评估"`
// NodeSuperiorAssessment *LinkNode `json:"nodeSuperiorAssessment" comment:"上级评估"`
// NodeViewResult *LinkNode `json:"nodeViewResult" comment:"绩效结果查看"`
//}
type EvaluationTemplate struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
Describe string `json:"describe" comment:"描述"`
CompanyId int64 `json:"companyId,string" comment:"公司ID"`
CreatorId int64 `json:"creatorId,string" comment:"创建人ID"`
State int `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3停用)"`
Link []LinkNode `json:"links" comment:"评估流程"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
//Link EvaluationLink `json:"link" comment:"评估流程"`
}
... ...
package models
import (
"time"
)
type EvaluationCycle struct {
tableName struct{} `pg:"evaluation_cycle" comment:"评估周期"`
Id int64 `pg:"pk:id" comment:"周期ID"`
Name string `comment:"名称"`
TimeStart *time.Time `comment:"起始时间"`
TimeEnd *time.Time `comment:"截至时间"`
CompanyId int64 `comment:"公司ID"`
CreatorId int64 `comment:"创建人ID"`
KpiCycle int `comment:"考核周期(0日、1周、2月)"`
Template []EvaluationTemplate `comment:"周期使用模板"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...
package models
import (
"time"
)
type EvaluationProject struct {
tableName struct{} `pg:"evaluation_project" comment:"评估项目"`
Id int64 `pg:"pk:id" comment:"ID"`
Name string `comment:"名称"`
Describe string `comment:"描述"`
CompanyId int64 `comment:"公司ID"`
CreatorId int64 `comment:"创建人ID"`
HrBp int `comment:"HR角色权限"`
Pms []string `comment:"项目管理员ID"`
Recipients []string `comment:"被评估人ID"`
Template *EvaluationTemplate `comment:"评估模板"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...
package models
import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"time"
)
type EvaluationRule struct {
tableName struct{} `pg:"evaluation_rule" comment:"评估规则"`
Id int64 `pg:"pk:id" comment:"ID"`
Name string `comment:"名称"`
Remark string `comment:"备注"`
CompanyId int64 `comment:"公司ID"`
CreatorId int64 `comment:"创建人ID"`
Type int `comment:"评估方式(0评级、1评分)"`
Rating *domain.Rating `comment:"评级"`
Score *domain.Score `comment:"评分"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...
package models
import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"time"
)
type EvaluationTemplate struct {
tableName struct{} `pg:"evaluation_template" comment:"评估模板"`
Id int64 `comment:"ID"`
Name string `comment:"名称"`
Describe string `comment:"描述"`
CompanyId int64 `comment:"公司ID"`
CreatorId int64 `comment:"创建人ID"`
State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)"`
Link []domain.LinkNode `comment:"评估流程"`
CreatedAt time.Time `comment:"创建时间"`
UpdatedAt time.Time `comment:"更新时间"`
DeletedAt *time.Time `comment:"删除时间"`
}
... ...