...
|
...
|
@@ -2,6 +2,7 @@ package service |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
...
|
...
|
@@ -501,6 +502,15 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter |
|
|
}
|
|
|
|
|
|
func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) (interface{}, error) {
|
|
|
lock := xredis.NewLockProjectId(int(in.Id))
|
|
|
err := lock.Lock()
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
lock.UnLock()
|
|
|
}()
|
|
|
|
|
|
transactionContext, err := factory.ValidateStartTransaction(in)
|
|
|
if err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -736,6 +746,9 @@ func (rs *EvaluationProjectService) Resume(in *command.ActivateProjectCommand) ( |
|
|
if project.State == domain.ProjectStateEnable {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "项目已启动")
|
|
|
}
|
|
|
if project.State == domain.ProjectStatePause {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "项目暂停中,先进行恢复")
|
|
|
}
|
|
|
|
|
|
// 周期内的所有项目,已启用的员工不能重复被评估
|
|
|
_, projects, err := projectRepository.Find(map[string]interface{}{"companyId": project.CompanyId, "cycleId": project.CycleId}, "template")
|
...
|
...
|
|