作者 tangxvhui

检查操作人员是否为 超级角色

@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 "github.com/linmadan/egglib-go/core/application" 9 "github.com/linmadan/egglib-go/core/application"
10 "github.com/linmadan/egglib-go/utils/tool_funs" 10 "github.com/linmadan/egglib-go/utils/tool_funs"
11 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" 11 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
12 - service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role" 12 + roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
13 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" 13 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
14 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" 14 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
@@ -437,7 +437,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval @@ -437,7 +437,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval
437 }() 437 }()
438 438
439 // 必须是HRBP权限的人才能编辑操作 439 // 必须是HRBP权限的人才能编辑操作
440 - hrbp, err := service.GetHrBp(transactionContext, param.CompanyId, param.UserId) 440 + hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.UserId)
441 if err != nil { 441 if err != nil {
442 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 442 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
443 } 443 }
@@ -738,7 +738,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -738,7 +738,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
738 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) 738 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
739 739
740 // 必须是HRBP权限的人才能编辑操作 740 // 必须是HRBP权限的人才能编辑操作
741 - hrbp, err := service.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId) 741 + hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
742 if err != nil { 742 if err != nil {
743 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 743 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
744 } 744 }
@@ -823,8 +823,6 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu @@ -823,8 +823,6 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
823 823
824 // 修改周期考核的分数 824 // 修改周期考核的分数
825 func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error { 825 func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error {
826 - //TODO 只有超级管理员可以使用的功能  
827 -  
828 transactionContext, err := factory.CreateTransactionContext(nil) 826 transactionContext, err := factory.CreateTransactionContext(nil)
829 if err != nil { 827 if err != nil {
830 return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 828 return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -835,6 +833,15 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini @@ -835,6 +833,15 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
835 defer func() { 833 defer func() {
836 _ = transactionContext.RollbackTransaction() 834 _ = transactionContext.RollbackTransaction()
837 }() 835 }()
  836 + // 只有超级管理员可以使用的功能
  837 + superAdmin, err := roleService.GetSuperAdmin(transactionContext, param.CompanyId, param.UserId)
  838 + if err != nil {
  839 + return err
  840 + }
  841 + if superAdmin != domain.RoleTypeSuperAdmin {
  842 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
  843 + }
  844 +
838 //获取周期评估任务finish 845 //获取周期评估任务finish
839 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) 846 evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
840 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ 847 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{