...
|
...
|
@@ -910,3 +910,41 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex |
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationProjectService) CheckTaskTemplate(in *command.CheckTaskTemplateCommand) (interface{}, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
cycleTemplate, err := cycleTemplateRepository.FindOne(map[string]interface{}{"id": in.TemplateId, "includeDeleted": true})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if cycleTemplate == nil || cycleTemplate.Template == nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "未找到模板")
|
|
|
}
|
|
|
|
|
|
// 指标任务的项目(存在一项类型为任务指标),必须添加项目负责人
|
|
|
var indicatorTypeTask = 0
|
|
|
outerLoop:
|
|
|
for i := range cycleTemplate.Template.LinkNodes {
|
|
|
var node = cycleTemplate.Template.LinkNodes[i]
|
|
|
for j := range node.NodeContents {
|
|
|
if node.NodeContents[j].IndicatorType == domain.IndicatorTypeTask {
|
|
|
indicatorTypeTask = 1
|
|
|
break outerLoop
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
return map[string]interface{}{"indicatorTypeTask": indicatorTypeTask}, nil
|
|
|
} |
...
|
...
|
|