作者 郑周

1. 评估周期模型

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

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