Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/performance into test
正在显示
1 个修改的文件
包含
42 行增加
和
0 行删除
| @@ -160,6 +160,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf | @@ -160,6 +160,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf | ||
| 160 | cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext}) | 160 | cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 161 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 161 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 162 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 162 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 163 | + ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
| 163 | 164 | ||
| 164 | // 检测名称重复(排除自己) | 165 | // 检测名称重复(排除自己) |
| 165 | count, err := cycleRepository.Count(map[string]interface{}{"name": in.Name, "companyId": in.CompanyId, "notId": in.Id}) | 166 | 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 | @@ -208,8 +209,49 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf | ||
| 208 | if err != nil { | 209 | if err != nil { |
| 209 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 210 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 210 | } | 211 | } |
| 212 | + | ||
| 213 | + // 获取所有模板中的规则对象数据 | ||
| 214 | + ruleMap := map[int64]*domain.EvaluationRule{} | ||
| 215 | + for i := range templates { | ||
| 216 | + v := templates[i] | ||
| 217 | + for j := range v.LinkNodes { | ||
| 218 | + node := v.LinkNodes[j] | ||
| 219 | + for k := range node.NodeContents { | ||
| 220 | + nodeContent := node.NodeContents[k] | ||
| 221 | + if nodeContent.RuleId != 0 { | ||
| 222 | + ruleMap[nodeContent.RuleId] = nil | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + ruleIds := make([]int64, 0) | ||
| 228 | + for k := range ruleMap { | ||
| 229 | + ruleIds = append(ruleIds, k) | ||
| 230 | + } | ||
| 231 | + if len(ruleIds) > 0 { | ||
| 232 | + if _, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId}); err != nil { | ||
| 233 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 234 | + } else { | ||
| 235 | + for i := range rules { | ||
| 236 | + ruleMap[rules[i].Id] = rules[i] | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 211 | for i := range templates { | 241 | for i := range templates { |
| 212 | v := templates[i] | 242 | v := templates[i] |
| 243 | + | ||
| 244 | + // 对评估模板中的评估规则进行数据赋值 | ||
| 245 | + for j := range v.LinkNodes { | ||
| 246 | + node := v.LinkNodes[j] | ||
| 247 | + for k := range node.NodeContents { | ||
| 248 | + nodeContent := node.NodeContents[k] | ||
| 249 | + if rule, ok := ruleMap[nodeContent.RuleId]; ok { | ||
| 250 | + nodeContent.Rule = rule | ||
| 251 | + } | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + | ||
| 213 | cycleTemplate := &domain.EvaluationCycleTemplate{ | 255 | cycleTemplate := &domain.EvaluationCycleTemplate{ |
| 214 | Id: 0, | 256 | Id: 0, |
| 215 | Name: v.Name, | 257 | Name: v.Name, |
-
请 注册 或 登录 后发表评论