...
|
...
|
@@ -160,6 +160,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
// 检测名称重复(排除自己)
|
|
|
count, err := cycleRepository.Count(map[string]interface{}{"name": in.Name, "companyId": in.CompanyId, "notId": in.Id})
|
...
|
...
|
@@ -208,8 +209,49 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 获取所有模板中的规则对象数据
|
|
|
ruleMap := map[int64]*domain.EvaluationRule{}
|
|
|
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]
|
|
|
if nodeContent.RuleId != 0 {
|
|
|
ruleMap[nodeContent.RuleId] = nil
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ruleIds := make([]int64, 0)
|
|
|
for k := range ruleMap {
|
|
|
ruleIds = append(ruleIds, k)
|
|
|
}
|
|
|
if len(ruleIds) > 0 {
|
|
|
if _, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
for i := range rules {
|
|
|
ruleMap[rules[i].Id] = rules[i]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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]
|
|
|
if rule, ok := ruleMap[nodeContent.RuleId]; ok {
|
|
|
nodeContent.Rule = rule
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
cycleTemplate := &domain.EvaluationCycleTemplate{
|
|
|
Id: 0,
|
|
|
Name: v.Name,
|
...
|
...
|
|