...
|
...
|
@@ -131,7 +131,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if !param.IsTemporary {
|
|
|
err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation)
|
|
|
err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation, itemValueList)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
...
|
...
|
@@ -152,6 +152,7 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu |
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(
|
|
|
transactionContext application.TransactionContext,
|
|
|
evaluationData *domain.SummaryEvaluation,
|
|
|
evaluationValue []*domain.SummaryEvaluationValue,
|
|
|
) error {
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
...
|
...
|
@@ -160,7 +161,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp( |
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
|
|
|
"cycleId": evaluationData.CycleId,
|
|
|
"limit": 1000,
|
|
|
"limit": 500,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -172,9 +173,6 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp( |
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if !allCompleted {
|
|
|
return nil
|
|
|
}
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationSuper)},
|
...
|
...
|
@@ -184,6 +182,30 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp( |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
noSuper := (len(evaluationList) == 0)
|
|
|
|
|
|
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationFinish)},
|
|
|
"cycleId": evaluationData.CycleId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if !allCompleted {
|
|
|
//仅同步评估内容到考核结果
|
|
|
if noSuper && len(evaluationFinishList) > 0 {
|
|
|
//不存在上级评估
|
|
|
err = srv.syncEvaluationFinishValue(transactionContext, evaluationFinishList[0], evaluationValue)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
nowTime := time.Now()
|
|
|
updatedId := []int{}
|
|
|
// 变更上级评估的开始时间
|
...
|
...
|
@@ -203,31 +225,29 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp( |
|
|
if len(evaluationList) == 0 {
|
|
|
//没有上级评估
|
|
|
//直接进入考核结果阶段
|
|
|
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": evaluationData.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationFinish)},
|
|
|
"cycleId": evaluationData.CycleId,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationFinishList) > 0 {
|
|
|
if evaluationFinishList[0].BeginTime.After(nowTime) {
|
|
|
evaluationFinishList[0].BeginTime = nowTime
|
|
|
}
|
|
|
evaluationFinishList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationFinishList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
|
|
//添加确认绩效成绩提醒短信提醒
|
|
|
err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if noSuper && len(evaluationFinishList) > 0 {
|
|
|
//不存在上级评估
|
|
|
err = srv.syncEvaluationFinishValue(transactionContext, evaluationFinishList[0], evaluationValue)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
} else if len(evaluationList) == 0 && len(evaluationFinishList) > 0 {
|
|
|
err = evaluationRepo.Save(evaluationFinishList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
} |
...
|
...
|
|