...
|
...
|
@@ -874,14 +874,9 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"id": param.AssessId,
|
|
|
})
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{"companyId": param.CompanyId, "id": param.AssessId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
...
|
...
|
@@ -890,34 +885,52 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada |
|
|
}
|
|
|
assessData := assessList[0]
|
|
|
var assessContentList []*domain.StaffAssessContent
|
|
|
|
|
|
//已完成
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
|
|
|
"staffAssessId": assessData.Id,
|
|
|
})
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, assessContentList, err = assessContentRepo.Find(map[string]interface{}{"staffAssessId": assessData.Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
if len(assessContentList) == 0 {
|
|
|
// 未完成
|
|
|
if len(assessContentList) == 0 { // 未完成
|
|
|
assessContentList, err = srv.getAssessInfoUncompletedV2(transactionContext, assessData)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId))
|
|
|
if err != nil {
|
|
|
log.Logger.Error("获取员工描述" + err.Error())
|
|
|
}
|
|
|
|
|
|
// 恢复缓存数据
|
|
|
if param.AcquireCache != 0 {
|
|
|
srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
|
|
|
}
|
|
|
|
|
|
targetUserDesc, err := srv.getStaffDescrip(transactionContext, int64(assessData.TargetUser.UserId))
|
|
|
// 获取项目信息
|
|
|
projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
project, err := projectRepository.FindOne(map[string]interface{}{"id": assessData.EvaluationProjectId})
|
|
|
if err != nil {
|
|
|
log.Logger.Error("获取员工描述" + err.Error())
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目错误:"+err.Error())
|
|
|
}
|
|
|
|
|
|
taskRecords := make([]*domain.TaskRecord, 0)
|
|
|
// 任务负责人才能显示里程碑数据
|
|
|
if project.PrincipalId == strconv.Itoa(assessData.TargetUser.UserId) {
|
|
|
// 获取里程碑数据
|
|
|
taskRecordRepository := factory.CreateTaskRecordRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, taskRecords, err = taskRecordRepository.Find(map[string]interface{}{"staffAssessId": assessData.Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取里程碑数据:"+err.Error())
|
|
|
}
|
|
|
|
|
|
//// 恢复缓存数据(里程碑记录)这里可以不用恢复任务里程碑数据
|
|
|
//if param.AcquireCache != 0 {
|
|
|
// srv.recoverCacheWithTaskRecord(cache, taskRecords)
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -940,6 +953,7 @@ func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*ada |
|
|
SupperUser: "",
|
|
|
DutyTime: "",
|
|
|
AssessContent: assessContentList,
|
|
|
TaskRecords: taskRecords,
|
|
|
}
|
|
|
if len(assessContentList) == 0 {
|
|
|
result.AssessContent = []*domain.StaffAssessContent{}
|
...
|
...
|
|