|
@@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
@@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
38
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
38
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
39
|
}
|
39
|
}
|
40
|
if count > 0 {
|
40
|
if count > 0 {
|
41
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在")
|
41
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "已存在相同名称的周期")
|
42
|
}
|
42
|
}
|
43
|
|
43
|
|
44
|
_, templates, err := templateRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "ids": in.TemplateIds})
|
44
|
_, templates, err := templateRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "ids": in.TemplateIds})
|
|
@@ -65,19 +65,27 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
@@ -65,19 +65,27 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
65
|
}
|
65
|
}
|
66
|
|
66
|
|
67
|
// 获取所有模板中的规则对象数据
|
67
|
// 获取所有模板中的规则对象数据
|
68
|
- ruleIds := make([]int64, 0)
|
|
|
69
|
- ruleMap := map[int64]*domain.EvaluationRule{}
|
68
|
+ ruleIdsMap := map[int64]int64{}
|
70
|
for i := range templates {
|
69
|
for i := range templates {
|
71
|
v := templates[i]
|
70
|
v := templates[i]
|
72
|
for j := range v.LinkNodes {
|
71
|
for j := range v.LinkNodes {
|
73
|
node := v.LinkNodes[j]
|
72
|
node := v.LinkNodes[j]
|
74
|
for k := range node.NodeContents {
|
73
|
for k := range node.NodeContents {
|
75
|
nodeContent := node.NodeContents[k]
|
74
|
nodeContent := node.NodeContents[k]
|
76
|
- ruleIds = append(ruleIds, nodeContent.RuleId)
|
75
|
+ if nodeContent.RuleId != 0 {
|
|
|
76
|
+ ruleIdsMap[nodeContent.RuleId] = nodeContent.RuleId
|
|
|
77
|
+ }
|
77
|
}
|
78
|
}
|
78
|
}
|
79
|
}
|
79
|
}
|
80
|
}
|
|
|
81
|
+ ruleIds := make([]int64, 0)
|
|
|
82
|
+ for k := range ruleIdsMap {
|
|
|
83
|
+ ruleIds = append(ruleIds, k)
|
|
|
84
|
+ }
|
|
|
85
|
+
|
80
|
_, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId})
|
86
|
_, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId})
|
|
|
87
|
+
|
|
|
88
|
+ ruleMap := map[int64]*domain.EvaluationRule{}
|
81
|
for i := range rules {
|
89
|
for i := range rules {
|
82
|
ruleMap[rules[i].Id] = rules[i]
|
90
|
ruleMap[rules[i].Id] = rules[i]
|
83
|
}
|
91
|
}
|