作者 tangxvhui

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

... ... @@ -9,7 +9,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
... ... @@ -437,7 +437,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval
}()
// 必须是HRBP权限的人才能编辑操作
hrbp, err := service.GetHrBp(transactionContext, param.CompanyId, param.UserId)
hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -738,7 +738,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
// 必须是HRBP权限的人才能编辑操作
hrbp, err := service.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -823,8 +823,6 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu
// 修改周期考核的分数
func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error {
//TODO 只有超级管理员可以使用的功能
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -835,6 +833,15 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
defer func() {
_ = transactionContext.RollbackTransaction()
}()
// 只有超级管理员可以使用的功能
superAdmin, err := roleService.GetSuperAdmin(transactionContext, param.CompanyId, param.UserId)
if err != nil {
return err
}
if superAdmin != domain.RoleTypeSuperAdmin {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
//获取周期评估任务finish
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
... ...