作者 tangxvhui

Merge branch 'dev-tangxvhui' of http://gitlab.fjmaimaimai.com/allied-creation/pe…

…rformance into dev-tangxvhui
... ... @@ -847,10 +847,9 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex
Weight: v2.Weight,
Required: v2.Required,
EvaluatorId: int(v2.EvaluatorId),
IndicatorType: v2.IndicatorType,
CreatedAt: nowTime,
UpdatedAt: nowTime,
// RuleType: 0,
// Rule: *v2.Rule,
}
if v2.Rule != nil {
item.RuleType = v2.Rule.Type
... ...
... ... @@ -22,6 +22,7 @@ type EvaluationItemUsed struct {
Weight float64 //"权重"
Required int //必填项 同 NodeContent.Required
EvaluatorId int //项目评估人ID ( 0=无评估人、-1=HRBP、 >0 员工的id )
IndicatorType int //指标类型
CreatedAt time.Time //数据创建时间
UpdatedAt time.Time //数据更新时间
}
... ...
... ... @@ -24,6 +24,11 @@ const (
NodeRequiredNo int = 2 // 必填项-非必填
)
const (
IndicatorTypeDef int = 0 // 指标类型-指标
IndicatorTypeTask int = 1 // 指标类型-任务
)
type EntryItem struct {
Title string `json:"title" comment:"填写标题"`
HintText string `json:"hintText" comment:"文本内容提示"`
... ... @@ -32,16 +37,17 @@ type EntryItem struct {
// NodeContent 评估内容
type NodeContent struct {
Category string `json:"category" comment:"类别"`
Name string `json:"name" comment:"名称"`
RuleId int64 `json:"ruleId,string" comment:"评估规则ID"`
Rule *EvaluationRule `json:"rule" comment:"评估规则对象"`
Weight float64 `json:"weight" comment:"权重"`
PromptTitle string `json:"promptTitle" comment:"提示项标题"`
PromptText string `json:"promptText" comment:"提示项正文"`
EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
Required int `json:"required" comment:"必填项"`
EvaluatorId int64 `json:"evaluatorId,string" comment:"项目评估人ID ( 0=无评估人、-1=HRBP )"`
Category string `json:"category" comment:"类别"`
Name string `json:"name" comment:"名称"`
RuleId int64 `json:"ruleId,string" comment:"评估规则ID"`
Rule *EvaluationRule `json:"rule" comment:"评估规则对象"`
Weight float64 `json:"weight" comment:"权重"`
PromptTitle string `json:"promptTitle" comment:"提示项标题"`
PromptText string `json:"promptText" comment:"提示项正文"`
EntryItems []*EntryItem `json:"entryItems" comment:"填写项"`
Required int `json:"required" comment:"必填项"`
EvaluatorId int64 `json:"evaluatorId,string" comment:"项目评估人ID ( 0=无评估人、-1=HRBP、评估人ID)"`
IndicatorType int `json:"IndicatorType" comment:"指标类型(0指标、1任务)"`
}
// LinkNode 评估流程、环节
... ...
... ... @@ -14,6 +14,7 @@ type PerformanceApplicationForm struct {
Definition string // 定义
Required string // 是否必填 是 否
Evaluator string // 项目评估人
IndicatorType string // 指标类型(任务 )
}
type PerformanceDimension struct {
... ... @@ -22,12 +23,13 @@ type PerformanceDimension struct {
}
type PerformanceModule struct {
ModuleName string `json:"moduleName"` // 模块名称
Weight string `json:"weight"` // 权重
Standard string `json:"standard"` // 标准(结构化的成果描述)
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
Required int `json:"required"` // 是否必填
Evaluator string `json:"evaluator"` // 项目评估人
ModuleName string `json:"moduleName"` // 模块名称
Weight string `json:"weight"` // 权重
Standard string `json:"standard"` // 标准(结构化的成果描述)
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
Required int `json:"required"` // 是否必填
Evaluator string `json:"evaluator"` // 项目评估人
IndicatorType int `json:"indicatorType"` // 指标类型(任务 )
}
type PerformanceTarget struct {
... ... @@ -169,13 +171,19 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM
if err != nil {
return modules, err
}
indicatorType, err := getIndicatorType(item)
if err != nil {
return modules, err
}
module := &PerformanceModule{
ModuleName: moduleName,
Weight: weightName,
Standard: standardName,
Target: tasks,
Required: required,
Evaluator: evaluator,
ModuleName: moduleName,
Weight: weightName,
Standard: standardName,
Target: tasks,
Required: required,
Evaluator: evaluator,
IndicatorType: indicatorType,
}
modules = append(modules, module)
}
... ... @@ -260,7 +268,7 @@ func getEvaluator(items []*PerformanceApplicationForm) (string, error) {
prevName = item.Evaluator
}
if prevName != item.Evaluator {
return "", errors.New(item.ModuleName + " 对应的项目评估人填不一致")
return "", errors.New(item.ModuleName + " 对应的项目评估人填不一致")
}
}
if prevName == "/" {
... ... @@ -269,6 +277,27 @@ func getEvaluator(items []*PerformanceApplicationForm) (string, error) {
return prevName, nil
}
// 获取指标类型
func getIndicatorType(items []*PerformanceApplicationForm) (int, error) {
if len(items) <= 0 {
return IndicatorTypeDef, nil
}
var prevName string
for _, item := range items {
if prevName == "" {
prevName = item.IndicatorType
}
if prevName != item.IndicatorType {
return IndicatorTypeDef, errors.New(item.ModuleName + " 对应的指标类型填写不一致")
}
}
if prevName == "任务" {
return IndicatorTypeTask, nil
} else {
return IndicatorTypeDef, nil
}
}
// 获取任务
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
tasks := make([]*PerformanceTarget, 0)
... ...
... ... @@ -23,6 +23,7 @@ type EvaluationItemUsed struct {
RuleType int `pg:",use_zero"` //评估方式(0评级、1评分)
Rule domain.EvaluationRule //评估的选项规则
EvaluatorId int // 项目评估人ID ( 0=无评估人、-1=HRBP )
IndicatorType int `pg:",use_zero"` // 指标规则
Weight float64 `pg:",use_zero"` //"权重"
Required int // 必填项
CreatedAt time.Time //数据创建时间
... ...
... ... @@ -37,6 +37,7 @@ func (repo *EvaluationItemUsedRepository) TransformToDomain(d *models.Evaluation
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
EvaluatorId: d.EvaluatorId,
IndicatorType: d.IndicatorType,
}
}
... ... @@ -58,6 +59,7 @@ func (repo *EvaluationItemUsedRepository) BatchInsert(items []*domain.Evaluation
RuleType: v.RuleType,
Rule: v.Rule,
EvaluatorId: v.EvaluatorId,
IndicatorType: v.IndicatorType,
Weight: v.Weight,
Required: v.Required,
CreatedAt: v.CreatedAt,
... ...
... ... @@ -162,6 +162,8 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
evaluatorMap[nc.Category+nc.Name] = module.Evaluator // k,v = (类别+名称, 项目评估人名称)
}
}
// 指标类型(0指标、1任务)
nc.IndicatorType = module.IndicatorType
nodeContents = append(nodeContents, nc)
}
... ...
... ... @@ -3,5 +3,4 @@ DELETE FROM summary_evaluation_value
WHERE id IN (1720, 1721, 1708, 1723, 1724, 1711, 1712, 1727, 1728, 1715, 1730, 1717, 1732, 1719);
DELETE FROM summary_evaluation_value
WHERE id IN (2299, 2302, 2303, 2304, 2309, 2308, 2313, 2312, 2314, 2316, 2318, 2322, 2324, 2325);
WHERE id IN (2299, 2302, 2303, 2304, 2309, 2308, 2313, 2312, 2314, 2316, 2318, 2322, 2324, 2325);
\ No newline at end of file
... ...
-- 增加指标分类字段, 默认0
ALTER TABLE public.evaluation_item_used ADD indicator_type int4 NOT NULL DEFAULT 0;
... ...