作者 tangxvhui

调整 人资稽查的详情获取

... ... @@ -38,6 +38,9 @@ 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.INTERNAL_SERVER_ERROR, "该人员缺少考评评估结果")
}
if len(evaluationList) > 0 {
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList[0].Id})
if err != nil {
... ... @@ -46,7 +49,7 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu
}
//如果没有评估考核结果,就获取上级评估的内容
if len(evaluationValueList) == 0 {
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
_, evaluationList2, err := evaluationRepo.Find(map[string]interface{}{
"limit": 1,
"companyId": param.CompanyId,
"cycleId": param.CycleId,
... ... @@ -56,38 +59,38 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu
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 len(evaluationList2) > 0 {
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList2[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,
"companyId": param.CompanyId,
"cycleId": param.CycleId,
"targetUserId": param.TargetUserId,
"typesList": []int{int(domain.EvaluationHrbp), int(domain.Evaluation360)},
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
evaluationIds := []int{}
for _, val := range evaluationList {
evaluationIds = append(evaluationIds, val.Id)
}
_, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// 如果没有评估考核结果的填写内容
// 也没有上级评估
// 就查找 360 或人资评估数据
if len(evaluationList2) == 0 {
_, evaluationList3, err := evaluationRepo.Find(map[string]interface{}{
"limit": 500,
"companyId": param.CompanyId,
"cycleId": param.CycleId,
"targetUserId": param.TargetUserId,
"typesList": []int{int(domain.EvaluationHrbp), int(domain.Evaluation360)},
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
evaluationIds := []int{}
for _, val := range evaluationList3 {
evaluationIds = append(evaluationIds, val.Id)
}
if len(evaluationIds) > 0 {
_, 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{}{
... ...