...
|
...
|
@@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if count > 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在")
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "已存在相同名称的周期")
|
|
|
}
|
|
|
|
|
|
_, 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 |
|
|
}
|
|
|
|
|
|
// 获取所有模板中的规则对象数据
|
|
|
ruleIds := make([]int64, 0)
|
|
|
ruleMap := map[int64]*domain.EvaluationRule{}
|
|
|
ruleIdsMap := map[int64]int64{}
|
|
|
for i := range templates {
|
|
|
v := templates[i]
|
|
|
for j := range v.LinkNodes {
|
|
|
node := v.LinkNodes[j]
|
|
|
for k := range node.NodeContents {
|
|
|
nodeContent := node.NodeContents[k]
|
|
|
ruleIds = append(ruleIds, nodeContent.RuleId)
|
|
|
if nodeContent.RuleId != 0 {
|
|
|
ruleIdsMap[nodeContent.RuleId] = nodeContent.RuleId
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ruleIds := make([]int64, 0)
|
|
|
for k := range ruleIdsMap {
|
|
|
ruleIds = append(ruleIds, k)
|
|
|
}
|
|
|
|
|
|
_, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId})
|
|
|
|
|
|
ruleMap := map[int64]*domain.EvaluationRule{}
|
|
|
for i := range rules {
|
|
|
ruleMap[rules[i].Id] = rules[i]
|
|
|
}
|
...
|
...
|
|