...
|
...
|
@@ -25,8 +25,27 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu |
|
|
evaluationValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
//评估用到的题目
|
|
|
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
//获取 评估考核结果
|
|
|
var evaluationList []*domain.SummaryEvaluation
|
|
|
var evaluationValueList []*domain.SummaryEvaluationValue
|
|
|
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"types": domain.EvaluationFinish,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) > 0 {
|
|
|
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList[0].Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
//如果没有评估考核结果,就获取上级评估的内容
|
|
|
if len(evaluationValueList) == 0 {
|
|
|
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
...
|
...
|
@@ -37,8 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// 查找上级评估数据
|
|
|
// 如果没有就查找 360 或人资评估数据
|
|
|
if len(evaluationList) > 0 {
|
|
|
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList[0].Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 如果没有评估考核结果也没有上级评估的内容
|
|
|
// 就查找 360 或人资评估数据
|
|
|
if len(evaluationList) == 0 {
|
|
|
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 500,
|
...
|
...
|
@@ -50,19 +76,18 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。")
|
|
|
}
|
|
|
|
|
|
var evaluationIds []int64
|
|
|
evaluationIds := []int{}
|
|
|
for _, val := range evaluationList {
|
|
|
evaluationIds = append(evaluationIds, int64(val.Id))
|
|
|
evaluationIds = append(evaluationIds, val.Id)
|
|
|
}
|
|
|
_, evaluationValueList, err := evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
|
|
|
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。")
|
|
|
}
|
|
|
evaluationProjectId := evaluationList[0].EvaluationProjectId
|
|
|
//获取所有题目
|
|
|
_, itemUsedList, err := itemUsedRepo.Find(map[string]interface{}{
|
...
|
...
|
|