正在显示
1 个修改的文件
包含
17 行增加
和
6 行删除
@@ -525,7 +525,9 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -525,7 +525,9 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
525 | if project.State == domain.ProjectStateEnable { | 525 | if project.State == domain.ProjectStateEnable { |
526 | return nil, application.ThrowError(application.BUSINESS_ERROR, "项目已启动") | 526 | return nil, application.ThrowError(application.BUSINESS_ERROR, "项目已启动") |
527 | } | 527 | } |
528 | - | 528 | + if project.State == domain.ProjectStatePause { |
529 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "项目暂停中,先进行恢复") | ||
530 | + } | ||
529 | // 周期内的所有项目,已启用的员工不能重复被评估 | 531 | // 周期内的所有项目,已启用的员工不能重复被评估 |
530 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": project.CompanyId, "cycleId": project.CycleId}, "template") | 532 | _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": project.CompanyId, "cycleId": project.CycleId}, "template") |
531 | if err != nil { | 533 | if err != nil { |
@@ -625,7 +627,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | @@ -625,7 +627,7 @@ func (rs *EvaluationProjectService) Activate(in *command.ActivateProjectCommand) | ||
625 | task.NextSentAt = nil | 627 | task.NextSentAt = nil |
626 | } | 628 | } |
627 | 629 | ||
628 | - task, err := taskRepository.Insert(task) | 630 | + _, err := taskRepository.Insert(task) |
629 | if err != nil { | 631 | if err != nil { |
630 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 632 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
631 | } | 633 | } |
@@ -871,6 +873,17 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | @@ -871,6 +873,17 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | ||
871 | } | 873 | } |
872 | 874 | ||
873 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { | 875 | func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error { |
876 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
877 | + "transactionContext": transactionContext, | ||
878 | + }) | ||
879 | + var err error | ||
880 | + cnt, _, err := itemUsedRepo.Find(map[string]interface{}{"projectId": project.Id}) | ||
881 | + if err != nil { | ||
882 | + return application.ThrowError(application.TRANSACTION_ERROR, "检查评估选项"+err.Error()) | ||
883 | + } | ||
884 | + if cnt > 0 { | ||
885 | + return nil | ||
886 | + } | ||
874 | var itemUsedList []*domain.EvaluationItemUsed | 887 | var itemUsedList []*domain.EvaluationItemUsed |
875 | nowTime := time.Now() | 888 | nowTime := time.Now() |
876 | for _, v := range project.Template.LinkNodes { | 889 | for _, v := range project.Template.LinkNodes { |
@@ -901,10 +914,8 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex | @@ -901,10 +914,8 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex | ||
901 | itemUsedList = append(itemUsedList, &item) | 914 | itemUsedList = append(itemUsedList, &item) |
902 | } | 915 | } |
903 | } | 916 | } |
904 | - itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
905 | - "transactionContext": transactionContext, | ||
906 | - }) | ||
907 | - err := itemUsedRepo.BatchInsert(itemUsedList) | 917 | + |
918 | + err = itemUsedRepo.BatchInsert(itemUsedList) | ||
908 | if err != nil { | 919 | if err != nil { |
909 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 920 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
910 | } | 921 | } |
-
请 注册 或 登录 后发表评论