|
|
package service
|
|
|
|
|
|
import (
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_cycle/adapter"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_cycle/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type EvaluationCycleService struct {
|
...
|
...
|
@@ -356,7 +357,7 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf |
|
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
taskRepository := factory.CreateNodeTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
staffRepository := factory.CreateStaffAssessTaskRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
summaryEvaluationRepository := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// 删除周期
|
|
|
cycle, err := cycleRepository.FindOne(map[string]interface{}{"id": in.Id})
|
|
|
if err != nil {
|
...
|
...
|
@@ -380,11 +381,6 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf |
|
|
if _, err := projectRepository.Remove(projects[i]); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 删除项目已生成的周期评估数据
|
|
|
if err := staffRepository.RemoveByProjectId(int(projects[i].Id)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 删除周期下的所有定时任务
|
...
|
...
|
@@ -398,6 +394,14 @@ func (rs *EvaluationCycleService) Remove(in *command.DeleteCycleCommand) (interf |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
// 删除项目已生成的周期评估数据
|
|
|
if err := staffRepository.RemoveByCycleId(int(cycle.Id)); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//
|
|
|
if err := summaryEvaluationRepository.RemoveByCycleId(cycle.Id); 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())
|
...
|
...
|
|