正在显示
5 个修改的文件
包含
47 行增加
和
13 行删除
| @@ -604,13 +604,43 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | @@ -604,13 +604,43 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | ||
| 604 | 604 | ||
| 605 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { | 605 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { |
| 606 | 606 | ||
| 607 | - // var itemUsedList []*domain.EvaluationItemUsed | ||
| 608 | - // for _, v := range project.Template.LinkNodes { | ||
| 609 | - // for _, v2 := range v.NodeContents { | ||
| 610 | - | ||
| 611 | - // } | ||
| 612 | - // } | ||
| 613 | - | ||
| 614 | - // itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | 607 | + var itemUsedList []*domain.EvaluationItemUsed |
| 608 | + nowTime := time.Now() | ||
| 609 | + for _, v := range project.Template.LinkNodes { | ||
| 610 | + for i2, v2 := range v.NodeContents { | ||
| 611 | + item := domain.EvaluationItemUsed{ | ||
| 612 | + Id: 0, | ||
| 613 | + CompanyId: int(project.CompanyId), | ||
| 614 | + EvaluationProjectId: int(project.Id), | ||
| 615 | + NodeId: int(v.Id), | ||
| 616 | + NodeType: v.Type, | ||
| 617 | + SortBy: i2, | ||
| 618 | + Category: v2.Category, | ||
| 619 | + Name: v2.Name, | ||
| 620 | + PromptTitle: v2.PromptTitle, | ||
| 621 | + PromptText: v2.PromptText, | ||
| 622 | + EntryItems: v2.EntryItems, | ||
| 623 | + Weight: v2.Weight, | ||
| 624 | + Required: v2.Required, | ||
| 625 | + EvaluatorId: int(v2.EvaluatorId), | ||
| 626 | + CreatedAt: nowTime, | ||
| 627 | + UpdatedAt: nowTime, | ||
| 628 | + // RuleType: 0, | ||
| 629 | + // Rule: *v2.Rule, | ||
| 630 | + } | ||
| 631 | + if v2.Rule != nil { | ||
| 632 | + item.RuleType = v2.Rule.Type | ||
| 633 | + item.Rule = *v2.Rule | ||
| 634 | + } | ||
| 635 | + itemUsedList = append(itemUsedList, &item) | ||
| 636 | + } | ||
| 637 | + } | ||
| 638 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
| 639 | + "transactionContext": transactionContext, | ||
| 640 | + }) | ||
| 641 | + err := itemUsedRepo.BatchInsert(itemUsedList) | ||
| 642 | + if err != nil { | ||
| 643 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 644 | + } | ||
| 615 | return nil | 645 | return nil |
| 616 | } | 646 | } |
| @@ -22,7 +22,7 @@ type EvaluationItemAdapter struct { | @@ -22,7 +22,7 @@ type EvaluationItemAdapter struct { | ||
| 22 | Name string `json:"name"` //名称 | 22 | Name string `json:"name"` //名称 |
| 23 | PromptTitle string `json:"promptTitle"` //提示项标题 | 23 | PromptTitle string `json:"promptTitle"` //提示项标题 |
| 24 | PromptText string `json:"promptText"` //提示项正文 | 24 | PromptText string `json:"promptText"` //提示项正文 |
| 25 | - EntryItems []domain.EntryItem `json:"entryItems"` //填写的反馈 | 25 | + EntryItems []*domain.EntryItem `json:"entryItems"` //填写的反馈 |
| 26 | RuleType int `json:"ruleType"` //评估方式(0评级、1评分) | 26 | RuleType int `json:"ruleType"` //评估方式(0评级、1评分) |
| 27 | Rule domain.EvaluationRule `json:"rule"` //评估的选项规则 | 27 | Rule domain.EvaluationRule `json:"rule"` //评估的选项规则 |
| 28 | Weight float64 `json:"weight"` //"权重" | 28 | Weight float64 `json:"weight"` //"权重" |
| @@ -10,17 +10,18 @@ type EvaluationItemUsed struct { | @@ -10,17 +10,18 @@ type EvaluationItemUsed struct { | ||
| 10 | CompanyId int //公司id | 10 | CompanyId int //公司id |
| 11 | EvaluationProjectId int //对应的项目id | 11 | EvaluationProjectId int //对应的项目id |
| 12 | NodeId int //填写评估评估节点对应id | 12 | NodeId int //填写评估评估节点对应id |
| 13 | - NodeType string //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type, | 13 | + NodeType int //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type, |
| 14 | SortBy int //排序 | 14 | SortBy int //排序 |
| 15 | Category string //类别 | 15 | Category string //类别 |
| 16 | Name string //名称 | 16 | Name string //名称 |
| 17 | PromptTitle string //提示项标题 | 17 | PromptTitle string //提示项标题 |
| 18 | PromptText string //提示项正文 | 18 | PromptText string //提示项正文 |
| 19 | - EntryItems []EntryItem //填写的反馈 | 19 | + EntryItems []*EntryItem //填写的反馈 |
| 20 | RuleType int //评估方式(0评级、1评分) | 20 | RuleType int //评估方式(0评级、1评分) |
| 21 | Rule EvaluationRule //评估的选项规则 | 21 | Rule EvaluationRule //评估的选项规则 |
| 22 | Weight float64 //"权重" | 22 | Weight float64 //"权重" |
| 23 | Required int // 必填项 | 23 | Required int // 必填项 |
| 24 | + EvaluatorId int // 项目评估人ID ( 0=无评估人、-1=HRBP ) | ||
| 24 | CreatedAt time.Time //数据创建时间 | 25 | CreatedAt time.Time //数据创建时间 |
| 25 | UpdatedAt time.Time //数据更新时间 | 26 | UpdatedAt time.Time //数据更新时间 |
| 26 | } | 27 | } |
| @@ -13,15 +13,16 @@ type EvaluationItemUsed struct { | @@ -13,15 +13,16 @@ type EvaluationItemUsed struct { | ||
| 13 | CompanyId int //公司id | 13 | CompanyId int //公司id |
| 14 | EvaluationProjectId int //对应的项目id | 14 | EvaluationProjectId int //对应的项目id |
| 15 | NodeId int //填写评估评估节点对应id | 15 | NodeId int //填写评估评估节点对应id |
| 16 | - NodeType string //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type, | 16 | + NodeType int //填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type, |
| 17 | SortBy int //排序 | 17 | SortBy int //排序 |
| 18 | Category string //类别 | 18 | Category string //类别 |
| 19 | Name string //名称 | 19 | Name string //名称 |
| 20 | PromptTitle string //提示项标题 | 20 | PromptTitle string //提示项标题 |
| 21 | PromptText string //提示项正文 | 21 | PromptText string //提示项正文 |
| 22 | - EntryItems []domain.EntryItem //填写的反馈 | 22 | + EntryItems []*domain.EntryItem //填写的反馈 |
| 23 | RuleType int //评估方式(0评级、1评分) | 23 | RuleType int //评估方式(0评级、1评分) |
| 24 | Rule domain.EvaluationRule //评估的选项规则 | 24 | Rule domain.EvaluationRule //评估的选项规则 |
| 25 | + EvaluatorId int // 项目评估人ID ( 0=无评估人、-1=HRBP ) | ||
| 25 | Weight float64 //"权重" | 26 | Weight float64 //"权重" |
| 26 | Required int // 必填项 | 27 | Required int // 必填项 |
| 27 | CreatedAt time.Time //数据创建时间 | 28 | CreatedAt time.Time //数据创建时间 |
| @@ -35,6 +35,7 @@ func (repo *EvaluationItemUsedRepository) TransformToDomain(d *models.Evaluation | @@ -35,6 +35,7 @@ func (repo *EvaluationItemUsedRepository) TransformToDomain(d *models.Evaluation | ||
| 35 | Required: d.Required, | 35 | Required: d.Required, |
| 36 | CreatedAt: d.CreatedAt, | 36 | CreatedAt: d.CreatedAt, |
| 37 | UpdatedAt: d.UpdatedAt, | 37 | UpdatedAt: d.UpdatedAt, |
| 38 | + EvaluatorId: d.EvaluatorId, | ||
| 38 | } | 39 | } |
| 39 | } | 40 | } |
| 40 | 41 | ||
| @@ -59,6 +60,7 @@ func (repo *EvaluationItemUsedRepository) BatchInsert(items []*domain.Evaluation | @@ -59,6 +60,7 @@ func (repo *EvaluationItemUsedRepository) BatchInsert(items []*domain.Evaluation | ||
| 59 | Required: v.Required, | 60 | Required: v.Required, |
| 60 | CreatedAt: v.CreatedAt, | 61 | CreatedAt: v.CreatedAt, |
| 61 | UpdatedAt: v.UpdatedAt, | 62 | UpdatedAt: v.UpdatedAt, |
| 63 | + EvaluatorId: v.EvaluatorId, | ||
| 62 | } | 64 | } |
| 63 | mList = append(mList, &m) | 65 | mList = append(mList, &m) |
| 64 | } | 66 | } |
-
请 注册 或 登录 后发表评论