...
|
...
|
@@ -234,14 +234,18 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估"+err.Error())
|
|
|
}
|
|
|
if evaluationData.Types != domain.EvaluationSelf {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
|
|
|
|
|
if evaluationData.Executor.UserId != param.ExecutorId {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
|
|
if evaluationData.CompanyId != param.CompanyId {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
|
|
// 检查是否逾期完成
|
|
|
if evaluationData.EndTime.Unix() < evaluationData.CompletedAt {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "已经逾期提交一次,不能再次编辑")
|
|
|
}
|
|
|
//按照 被评估人加锁
|
|
|
lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId)
|
...
|
...
|
@@ -252,6 +256,20 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva |
|
|
defer func() {
|
|
|
lock.UnLock()
|
|
|
}()
|
|
|
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationFinish)},
|
|
|
"cycleId": evaluationData.CycleId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// 如果目标员工已经确认考核结果,就不能在进行评估编辑
|
|
|
if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
|
|
|
}
|
|
|
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": evaluationData.EvaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
...
|
...
|
@@ -320,6 +338,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva |
|
|
|
|
|
if !param.IsTemporary {
|
|
|
evaluationData.Status = domain.EvaluationCompleted
|
|
|
evaluationData.CompletedAt = time.Now().Unix()
|
|
|
//删除旧的填写值,使用新的填写内容
|
|
|
err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationData.Id)
|
|
|
if err != nil {
|
...
|
...
|
|