...
|
...
|
@@ -364,7 +364,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP |
|
|
return map[string]interface{}{"userTotal": userTotal, "departmentTotal": departmentTotal}, nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCommand) (interface{}, error) {
|
|
|
func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateListCommand) (interface{}, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
|
|
if err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -375,6 +375,9 @@ func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCom |
|
|
|
|
|
cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, cycleTemplates, err := cycleTemplateRepository.Find(map[string]interface{}{"cycleId": in.CycleId}, "template")
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
list := make([]*domain.TemplateSimple, 0)
|
|
|
for i := range cycleTemplates {
|
...
|
...
|
@@ -390,3 +393,23 @@ func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCom |
|
|
}
|
|
|
return map[string]interface{}{"list": list}, nil
|
|
|
}
|
|
|
|
|
|
func (rs *EvaluationCycleService) CycleTemplate(in *command.CycleTemplateCommand) (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})
|
|
|
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 cycleTemplate.Template, nil
|
|
|
} |
...
|
...
|
|