...
|
...
|
@@ -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]
|
|
|
}
|
...
|
...
|
@@ -313,6 +321,10 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
return tool_funs.SimpleWrapGridMap(total, cycles), nil
|
|
|
}
|
|
|
|
...
|
...
|
@@ -325,7 +337,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes")
|
|
|
_, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "template")
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -339,8 +351,8 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP |
|
|
userIdMap[userId] = userId
|
|
|
}
|
|
|
}
|
|
|
for _, v := range userIdMap {
|
|
|
userIds = append(userIds, v)
|
|
|
for k := range userIdMap {
|
|
|
userIds = append(userIds, k)
|
|
|
}
|
|
|
|
|
|
userTotal := 0
|
...
|
...
|
@@ -404,7 +416,7 @@ func (rs *EvaluationCycleService) CycleTemplate(in *command.CycleTemplateCommand |
|
|
}()
|
|
|
|
|
|
cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
cycleTemplate, err := cycleTemplateRepository.FindOne(map[string]interface{}{"id": in.TemplateId})
|
|
|
cycleTemplate, err := cycleTemplateRepository.FindOne(map[string]interface{}{"id": in.Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
|