...
|
...
|
@@ -4,6 +4,7 @@ import ( |
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/permission/command"
|
|
|
service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -23,6 +24,7 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// 获取权限配置
|
|
|
_, permissions, err := permissionRepository.Find(map[string]interface{}{"companyId": in.CompanyId})
|
...
|
...
|
@@ -36,6 +38,45 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
|
|
permission.OptHrScore = in.OptHrScore
|
|
|
permission.OptEvalScore = in.OptEvalScore
|
|
|
|
|
|
// 超级管理员权限传参
|
|
|
if in.OptConfirmPerf > 0 || in.CycleDeadLine != nil {
|
|
|
superAdmin, err := service.GetSuperAdmin(transactionContext, int(in.CompanyId), int(in.UserId))
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
if superAdmin != domain.RoleTypeSuperAdmin {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
}
|
|
|
|
|
|
switch in.OptConfirmPerf {
|
|
|
case domain.PermissionOff, domain.PermissionOn:
|
|
|
default:
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "是否需要员工确认绩效参数错误")
|
|
|
}
|
|
|
var cycleDeadLine = in.CycleDeadLine
|
|
|
var allMinuteSelf = cycleDeadLine.AssessmentSelf.Hour*60 + cycleDeadLine.AssessmentSelf.Minute
|
|
|
var allMinute360 = cycleDeadLine.AssessmentAll.Hour*60 + cycleDeadLine.AssessmentAll.Minute
|
|
|
//var allMinuteHr = cycleDeadLine.AssessmentHr.Hour*60 + cycleDeadLine.AssessmentHr.Minute
|
|
|
var allMinuteSuperior = cycleDeadLine.AssessmentSuperior.Hour*60 + cycleDeadLine.AssessmentSuperior.Minute
|
|
|
var allMinuteMy = cycleDeadLine.ViewMyPerf.Hour*60 + cycleDeadLine.ViewMyPerf.Minute
|
|
|
|
|
|
// 注. 360和人资评估时间截止是相同的(前端只传递一个360评估参数)
|
|
|
cycleDeadLine.AssessmentHr.Hour = cycleDeadLine.AssessmentAll.Hour
|
|
|
cycleDeadLine.AssessmentHr.Minute = cycleDeadLine.AssessmentAll.Minute
|
|
|
|
|
|
if allMinuteSelf > allMinute360 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[360评估]不能小于[综合自评]")
|
|
|
}
|
|
|
if allMinute360 > allMinuteSuperior {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[上级评估]不能小于[360评估]")
|
|
|
}
|
|
|
if allMinuteSuperior > allMinuteMy {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[查看我的绩效]不能小于[上级评估]")
|
|
|
}
|
|
|
permission.OptConfirmPerf = in.OptConfirmPerf
|
|
|
permission.CycleDeadLine = in.CycleDeadLine
|
|
|
}
|
|
|
|
|
|
permission, err = permissionRepository.Insert(permission)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
|