作者 郑周

添加、更新模板

@@ -34,41 +34,46 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) ( @@ -34,41 +34,46 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) (
34 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 34 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
35 } 35 }
36 if count > 0 { 36 if count > 0 {
37 - return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在") 37 + return nil, application.ThrowError(application.BUSINESS_ERROR, "已存在相同名称的评估模板")
38 } 38 }
39 39
40 linkNodes := make([]*domain.LinkNode, 0) 40 linkNodes := make([]*domain.LinkNode, 0)
41 41
42 sid, _ := utils.NewSnowflakeId() 42 sid, _ := utils.NewSnowflakeId()
43 linkNodes = append(linkNodes, &domain.LinkNode{ 43 linkNodes = append(linkNodes, &domain.LinkNode{
44 - Id: sid + 1,  
45 - Type: domain.LinkNodeSelfAssessment,  
46 - Name: "填写自评反馈",  
47 - KpiCycle: domain.KpiCycleDay, 44 + Id: sid + 1,
  45 + Type: domain.LinkNodeSelfAssessment,
  46 + Name: "填写自评反馈",
  47 + NodeContents: make([]*domain.NodeContent, 0),
  48 + KpiCycle: domain.KpiCycleDay,
48 }) 49 })
49 linkNodes = append(linkNodes, &domain.LinkNode{ 50 linkNodes = append(linkNodes, &domain.LinkNode{
50 - Id: sid + 2,  
51 - Type: domain.LinkNodeAllInvite,  
52 - Name: "360°邀请",  
53 - KpiCycle: domain.KpiCycleDay, 51 + Id: sid + 2,
  52 + Type: domain.LinkNodeAllInvite,
  53 + Name: "360°邀请",
  54 + NodeContents: make([]*domain.NodeContent, 0),
  55 + KpiCycle: domain.KpiCycleDay,
54 }) 56 })
55 linkNodes = append(linkNodes, &domain.LinkNode{ 57 linkNodes = append(linkNodes, &domain.LinkNode{
56 - Id: sid + 3,  
57 - Type: domain.LinkNodeAllAssessment,  
58 - Name: "360°评估",  
59 - KpiCycle: domain.KpiCycleDay, 58 + Id: sid + 3,
  59 + Type: domain.LinkNodeAllAssessment,
  60 + Name: "360°评估",
  61 + NodeContents: make([]*domain.NodeContent, 0),
  62 + KpiCycle: domain.KpiCycleDay,
60 }) 63 })
61 linkNodes = append(linkNodes, &domain.LinkNode{ 64 linkNodes = append(linkNodes, &domain.LinkNode{
62 - Id: sid + 4,  
63 - Type: domain.LinkNodeSuperiorAssessment,  
64 - Name: "上级评估",  
65 - KpiCycle: domain.KpiCycleDay, 65 + Id: sid + 4,
  66 + Type: domain.LinkNodeSuperiorAssessment,
  67 + Name: "上级评估",
  68 + NodeContents: make([]*domain.NodeContent, 0),
  69 + KpiCycle: domain.KpiCycleDay,
66 }) 70 })
67 linkNodes = append(linkNodes, &domain.LinkNode{ 71 linkNodes = append(linkNodes, &domain.LinkNode{
68 - Id: sid + 5,  
69 - Type: domain.LinkNodeViewResult,  
70 - Name: "绩效结果查看",  
71 - KpiCycle: domain.KpiCycleDay, 72 + Id: sid + 5,
  73 + Type: domain.LinkNodeViewResult,
  74 + Name: "绩效结果查看",
  75 + NodeContents: make([]*domain.NodeContent, 0),
  76 + KpiCycle: domain.KpiCycleDay,
72 }) 77 })
73 78
74 newTemplate := &domain.EvaluationTemplate{ 79 newTemplate := &domain.EvaluationTemplate{
@@ -33,7 +33,7 @@ type EntryItem struct { @@ -33,7 +33,7 @@ type EntryItem struct {
33 type NodeContent struct { 33 type NodeContent struct {
34 Category string `json:"category" comment:"类别"` 34 Category string `json:"category" comment:"类别"`
35 Name string `json:"name" comment:"名称"` 35 Name string `json:"name" comment:"名称"`
36 - RuleId int64 `json:"ruleId" comment:"评估规则ID"` 36 + RuleId int64 `json:"ruleId,string" comment:"评估规则ID"`
37 Rule *EvaluationRule `json:"rule" comment:"评估规则对象"` 37 Rule *EvaluationRule `json:"rule" comment:"评估规则对象"`
38 PromptTitle string `json:"promptTitle" comment:"提示项标题"` 38 PromptTitle string `json:"promptTitle" comment:"提示项标题"`
39 PromptText string `json:"promptText" comment:"提示项正文"` 39 PromptText string `json:"promptText" comment:"提示项正文"`
@@ -59,7 +59,7 @@ type LinkNode struct { @@ -59,7 +59,7 @@ type LinkNode struct {
59 NodeContents []*NodeContent `json:"nodeContents" comment:"环节-评估内容"` 59 NodeContents []*NodeContent `json:"nodeContents" comment:"环节-评估内容"`
60 TimeStart *time.Time `json:"timeStart" comment:"起始时间"` 60 TimeStart *time.Time `json:"timeStart" comment:"起始时间"`
61 TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` 61 TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"`
62 - KpiCycle int `json:"state" comment:"考核周期(1日、2周、3月)"` 62 + KpiCycle int `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
63 //NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"360°邀请人员"` 63 //NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"360°邀请人员"`
64 64
65 } 65 }