作者 tangxvhui

字段类型变更

... ... @@ -604,13 +604,43 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo
func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error {
// var itemUsedList []*domain.EvaluationItemUsed
// for _, v := range project.Template.LinkNodes {
// for _, v2 := range v.NodeContents {
// }
// }
// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
var itemUsedList []*domain.EvaluationItemUsed
nowTime := time.Now()
for _, v := range project.Template.LinkNodes {
for i2, v2 := range v.NodeContents {
item := domain.EvaluationItemUsed{
Id: 0,
CompanyId: int(project.CompanyId),
EvaluationProjectId: int(project.Id),
NodeId: int(v.Id),
NodeType: v.Type,
SortBy: i2,
Category: v2.Category,
Name: v2.Name,
PromptTitle: v2.PromptTitle,
PromptText: v2.PromptText,
EntryItems: v2.EntryItems,
Weight: v2.Weight,
Required: v2.Required,
EvaluatorId: int(v2.EvaluatorId),
CreatedAt: nowTime,
UpdatedAt: nowTime,
// RuleType: 0,
// Rule: *v2.Rule,
}
if v2.Rule != nil {
item.RuleType = v2.Rule.Type
item.Rule = *v2.Rule
}
itemUsedList = append(itemUsedList, &item)
}
}
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
err := itemUsedRepo.BatchInsert(itemUsedList)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
return nil
}
... ...
... ... @@ -22,7 +22,7 @@ type EvaluationItemAdapter struct {
Name string `json:"name"` //名称
PromptTitle string `json:"promptTitle"` //提示项标题
PromptText string `json:"promptText"` //提示项正文
EntryItems []domain.EntryItem `json:"entryItems"` //填写的反馈
EntryItems []*domain.EntryItem `json:"entryItems"` //填写的反馈
RuleType int `json:"ruleType"` //评估方式(0评级、1评分)
Rule domain.EvaluationRule `json:"rule"` //评估的选项规则
Weight float64 `json:"weight"` //"权重"
... ...
... ... @@ -10,17 +10,18 @@ type EvaluationItemUsed struct {
CompanyId int //公司id
EvaluationProjectId int //对应的项目id
NodeId int //填写评估评估节点对应id
NodeType string //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type,
NodeType int //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type,
SortBy int //排序
Category string //类别
Name string //名称
PromptTitle string //提示项标题
PromptText string //提示项正文
EntryItems []EntryItem //填写的反馈
EntryItems []*EntryItem //填写的反馈
RuleType int //评估方式(0评级、1评分)
Rule EvaluationRule //评估的选项规则
Weight float64 //"权重"
Required int // 必填项
EvaluatorId int // 项目评估人ID ( 0=无评估人、-1=HRBP )
CreatedAt time.Time //数据创建时间
UpdatedAt time.Time //数据更新时间
}
... ...
... ... @@ -13,15 +13,16 @@ type EvaluationItemUsed struct {
CompanyId int //公司id
EvaluationProjectId int //对应的项目id
NodeId int //填写评估评估节点对应id
NodeType string //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type,
NodeType int //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type,
SortBy int //排序
Category string //类别
Name string //名称
PromptTitle string //提示项标题
PromptText string //提示项正文
EntryItems []domain.EntryItem //填写的反馈
EntryItems []*domain.EntryItem //填写的反馈
RuleType int //评估方式(0评级、1评分)
Rule domain.EvaluationRule //评估的选项规则
EvaluatorId int // 项目评估人ID ( 0=无评估人、-1=HRBP )
Weight float64 //"权重"
Required int // 必填项
CreatedAt time.Time //数据创建时间
... ...
... ... @@ -35,6 +35,7 @@ func (repo *EvaluationItemUsedRepository) TransformToDomain(d *models.Evaluation
Required: d.Required,
CreatedAt: d.CreatedAt,
UpdatedAt: d.UpdatedAt,
EvaluatorId: d.EvaluatorId,
}
}
... ... @@ -59,6 +60,7 @@ func (repo *EvaluationItemUsedRepository) BatchInsert(items []*domain.Evaluation
Required: v.Required,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
EvaluatorId: v.EvaluatorId,
}
mList = append(mList, &m)
}
... ...