...
|
...
|
@@ -68,6 +68,8 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm |
|
|
CompanyId: in.CompanyId,
|
|
|
OptHrScore: domain.PermissionOff,
|
|
|
OptEvalScore: domain.PermissionOff,
|
|
|
OptConfirmPerf: domain.PermissionOff,
|
|
|
CycleDeadLine: rs.defaultCycleDeadline(),
|
|
|
}
|
|
|
permission, err = permissionRepository.Insert(value)
|
|
|
if err != nil {
|
...
|
...
|
@@ -75,9 +77,59 @@ func (rs *PermissionService) Get(in *command.GetPermissionCommand) (*domain.Perm |
|
|
}
|
|
|
} else {
|
|
|
permission = permissions[0]
|
|
|
// 纠正数据
|
|
|
var isChange = false
|
|
|
if permission.OptHrScore == 0 {
|
|
|
isChange = true
|
|
|
permission.OptHrScore = domain.PermissionOff
|
|
|
}
|
|
|
if permission.OptEvalScore == 0 {
|
|
|
isChange = true
|
|
|
permission.OptEvalScore = domain.PermissionOff
|
|
|
}
|
|
|
if permission.OptConfirmPerf == 0 {
|
|
|
isChange = true
|
|
|
permission.OptConfirmPerf = domain.PermissionOff
|
|
|
}
|
|
|
if permission.CycleDeadLine == nil {
|
|
|
isChange = true
|
|
|
permission.CycleDeadLine = rs.defaultCycleDeadline()
|
|
|
}
|
|
|
if isChange {
|
|
|
permission, err = permissionRepository.Insert(permission)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return permission, nil
|
|
|
}
|
|
|
|
|
|
// 创建默认周期截止时间
|
|
|
func (rs *PermissionService) defaultCycleDeadline() *domain.CycleDeadline {
|
|
|
return &domain.CycleDeadline{
|
|
|
AssessmentSelf: domain.DeadlineTime{
|
|
|
Hour: 3 * 24,
|
|
|
Minute: 0,
|
|
|
},
|
|
|
AssessmentAll: domain.DeadlineTime{
|
|
|
Hour: 5 * 24,
|
|
|
Minute: 0,
|
|
|
},
|
|
|
AssessmentHr: domain.DeadlineTime{
|
|
|
Hour: 5 * 24,
|
|
|
Minute: 0,
|
|
|
},
|
|
|
AssessmentSuperior: domain.DeadlineTime{
|
|
|
Hour: 7 * 24,
|
|
|
Minute: 0,
|
|
|
},
|
|
|
ViewMyPerf: domain.DeadlineTime{
|
|
|
Hour: 9 * 24,
|
|
|
Minute: 0,
|
|
|
},
|
|
|
}
|
|
|
} |
...
|
...
|
|