|
@@ -4,6 +4,7 @@ import ( |
|
@@ -4,6 +4,7 @@ import ( |
4
|
"github.com/linmadan/egglib-go/core/application"
|
4
|
"github.com/linmadan/egglib-go/core/application"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
5
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/permission/command"
|
6
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/permission/command"
|
|
|
7
|
+ service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
|
7
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
8
|
)
|
9
|
)
|
9
|
|
10
|
|
|
@@ -23,6 +24,7 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
|
@@ -23,6 +24,7 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
23
|
defer func() {
|
24
|
defer func() {
|
24
|
transactionContext.RollbackTransaction()
|
25
|
transactionContext.RollbackTransaction()
|
25
|
}()
|
26
|
}()
|
|
|
27
|
+
|
26
|
permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
|
28
|
permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
|
27
|
// 获取权限配置
|
29
|
// 获取权限配置
|
28
|
_, permissions, err := permissionRepository.Find(map[string]interface{}{"companyId": in.CompanyId})
|
30
|
_, permissions, err := permissionRepository.Find(map[string]interface{}{"companyId": in.CompanyId})
|
|
@@ -36,6 +38,45 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
|
@@ -36,6 +38,45 @@ func (rs *PermissionService) Update(in *command.UpdatePermissionCommand) (interf |
36
|
permission.OptHrScore = in.OptHrScore
|
38
|
permission.OptHrScore = in.OptHrScore
|
37
|
permission.OptEvalScore = in.OptEvalScore
|
39
|
permission.OptEvalScore = in.OptEvalScore
|
38
|
|
40
|
|
|
|
41
|
+ // 超级管理员权限传参
|
|
|
42
|
+ if in.OptConfirmPerf > 0 || in.CycleDeadLine != nil {
|
|
|
43
|
+ superAdmin, err := service.GetSuperAdmin(transactionContext, int(in.CompanyId), int(in.UserId))
|
|
|
44
|
+ if err != nil {
|
|
|
45
|
+ return nil, err
|
|
|
46
|
+ }
|
|
|
47
|
+ if superAdmin != domain.RoleTypeSuperAdmin {
|
|
|
48
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
49
|
+ }
|
|
|
50
|
+
|
|
|
51
|
+ switch in.OptConfirmPerf {
|
|
|
52
|
+ case domain.PermissionOff, domain.PermissionOn:
|
|
|
53
|
+ default:
|
|
|
54
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "是否需要员工确认绩效参数错误")
|
|
|
55
|
+ }
|
|
|
56
|
+ var cycleDeadLine = in.CycleDeadLine
|
|
|
57
|
+ var allMinuteSelf = cycleDeadLine.AssessmentSelf.Hour*60 + cycleDeadLine.AssessmentSelf.Minute
|
|
|
58
|
+ var allMinute360 = cycleDeadLine.AssessmentAll.Hour*60 + cycleDeadLine.AssessmentAll.Minute
|
|
|
59
|
+ //var allMinuteHr = cycleDeadLine.AssessmentHr.Hour*60 + cycleDeadLine.AssessmentHr.Minute
|
|
|
60
|
+ var allMinuteSuperior = cycleDeadLine.AssessmentSuperior.Hour*60 + cycleDeadLine.AssessmentSuperior.Minute
|
|
|
61
|
+ var allMinuteMy = cycleDeadLine.ViewMyPerf.Hour*60 + cycleDeadLine.ViewMyPerf.Minute
|
|
|
62
|
+
|
|
|
63
|
+ // 注. 360和人资评估时间截止是相同的(前端只传递一个360评估参数)
|
|
|
64
|
+ cycleDeadLine.AssessmentHr.Hour = cycleDeadLine.AssessmentAll.Hour
|
|
|
65
|
+ cycleDeadLine.AssessmentHr.Minute = cycleDeadLine.AssessmentAll.Minute
|
|
|
66
|
+
|
|
|
67
|
+ if allMinuteSelf > allMinute360 {
|
|
|
68
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[360评估]不能小于[综合自评]")
|
|
|
69
|
+ }
|
|
|
70
|
+ if allMinute360 > allMinuteSuperior {
|
|
|
71
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[上级评估]不能小于[360评估]")
|
|
|
72
|
+ }
|
|
|
73
|
+ if allMinuteSuperior > allMinuteMy {
|
|
|
74
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "截止时间:[查看我的绩效]不能小于[上级评估]")
|
|
|
75
|
+ }
|
|
|
76
|
+ permission.OptConfirmPerf = in.OptConfirmPerf
|
|
|
77
|
+ permission.CycleDeadLine = in.CycleDeadLine
|
|
|
78
|
+ }
|
|
|
79
|
+
|
39
|
permission, err = permissionRepository.Insert(permission)
|
80
|
permission, err = permissionRepository.Insert(permission)
|
40
|
if err != nil {
|
81
|
if err != nil {
|
41
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
82
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|