...
|
...
|
@@ -185,8 +185,8 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu |
|
|
return grid, nil
|
|
|
}
|
|
|
|
|
|
// GetEvaluation360 获取360综评详情(登录人作为评估人,评估内容)
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
// GetEvaluation360 获取360综评详情(我评估目标用户)
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360My) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -199,31 +199,19 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
//sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
_, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"types": domain.Evaluation360},
|
|
|
)
|
|
|
sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluations) == 0 { // 数据不存在
|
|
|
result := adapter.EvaluationInfoAdapter{}
|
|
|
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
return &result, nil
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
// 360评估内容(自评模板、筛选项目评估人)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
"companyId": param.CompanyId,
|
|
|
"evaluatorId": param.UserId,
|
|
|
})
|
|
|
if err != nil {
|
...
|
...
|
@@ -259,7 +247,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
|
}
|
|
|
|
|
|
// GetEvaluation360All 获取360综评详情-上级综评(所有的评估人,评估内容)
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*[]adapter.EvaluationItemAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -268,7 +256,6 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
...
|
...
|
@@ -282,17 +269,25 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
if len(evaluations) == 0 {
|
|
|
result := adapter.EvaluationInfoAdapter{}
|
|
|
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
return &result, nil
|
|
|
//return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
list := make([]adapter.EvaluationItemAdapter, 0)
|
|
|
return &list, nil
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
executorMap := map[int]domain.StaffDesc{} // 执行人
|
|
|
evaluationIds := make([]int, 0) // 评估周期ID
|
|
|
for i := range evaluations {
|
|
|
executor := evaluations[i].Executor
|
|
|
executorMap[executor.UserId] = executor
|
|
|
|
|
|
evaluationIds = append(evaluationIds, evaluations[i].Id)
|
|
|
}
|
|
|
// 得到项目ID
|
|
|
evaluationProjectId := evaluations[0].EvaluationProjectId
|
|
|
// 360评估内容(自评模板)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
"evaluationProjectId": evaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
})
|
|
|
if err != nil {
|
...
|
...
|
@@ -300,28 +295,18 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
|
}
|
|
|
|
|
|
// 评估内容对应的分数
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{
|
|
|
"summaryEvaluationIdList": evaluationIds,
|
|
|
"types": domain.Evaluation360,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 评估人ID -> User
|
|
|
evaluatorMap := map[int]*domain.User{}
|
|
|
evaluatorIds := make([]int, 0)
|
|
|
filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容
|
|
|
for i := range itemList {
|
|
|
if itemList[i].EvaluatorId > 0 {
|
|
|
filterItemList = append(filterItemList, itemList[i])
|
|
|
evaluatorIds = append(evaluatorIds, itemList[i].EvaluatorId)
|
|
|
}
|
|
|
}
|
|
|
if len(evaluatorIds) > 0 {
|
|
|
_, users, err := userRepo.Find(map[string]interface{}{"ids": evaluatorIds})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i := range users {
|
|
|
evaluatorMap[int(users[i].Id)] = users[i]
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -331,26 +316,26 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
|
|
|
|
itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues)
|
|
|
for i := range itemValuesAdapter { // 评估人名称赋值
|
|
|
if user, ok := evaluatorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
itemValuesAdapter[i].EvaluatorName = user.Name
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result := adapter.EvaluationInfoAdapter{
|
|
|
SummaryEvaluationId: sEvaluation.Id,
|
|
|
CycleId: int(sEvaluation.CycleId),
|
|
|
CycleName: sEvaluation.CycleName,
|
|
|
EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
LinkNodeId: sEvaluation.NodeId,
|
|
|
BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
Status: string(sEvaluation.Status),
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
}
|
|
|
return &result, nil
|
|
|
if executor, ok := executorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
itemValuesAdapter[i].EvaluatorName = executor.UserName
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//result := adapter.EvaluationInfoAdapter{
|
|
|
// SummaryEvaluationId: sEvaluation.Id,
|
|
|
// CycleId: int(sEvaluation.CycleId),
|
|
|
// CycleName: sEvaluation.CycleName,
|
|
|
// EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
// EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
// LinkNodeId: sEvaluation.NodeId,
|
|
|
// BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
// EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
// TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
// TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
// Status: string(sEvaluation.Status),
|
|
|
// EvaluationItems: itemValuesAdapter,
|
|
|
//}
|
|
|
return &itemValuesAdapter, nil
|
|
|
}
|
|
|
|
|
|
// EditEvaluation360 编辑提交360综评
|
...
|
...
|
@@ -595,7 +580,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval |
|
|
}
|
|
|
|
|
|
// GetEvaluationHRBP 获取人资综评详情
|
|
|
func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvaluationHRBP) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvaluationHRBP) (*[]adapter.EvaluationItemAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
...
|
...
|
@@ -619,17 +604,26 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluations) == 0 { // 数据不存在
|
|
|
result := adapter.EvaluationInfoAdapter{}
|
|
|
result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
return &result, nil
|
|
|
//return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
|
|
|
if len(evaluations) == 0 {
|
|
|
list := make([]adapter.EvaluationItemAdapter, 0)
|
|
|
return &list, nil
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
executorMap := map[int]domain.StaffDesc{} // 执行人
|
|
|
evaluationIds := make([]int, 0) // 评估周期ID
|
|
|
for i := range evaluations {
|
|
|
executor := evaluations[i].Executor
|
|
|
executorMap[executor.UserId] = executor
|
|
|
|
|
|
evaluationIds = append(evaluationIds, evaluations[i].Id)
|
|
|
}
|
|
|
// 得到项目ID
|
|
|
evaluationProjectId := evaluations[0].EvaluationProjectId
|
|
|
|
|
|
// 自评评估内容(自评模板、筛选项目评估人)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
"evaluationProjectId": evaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
"evaluatorId": -1,
|
|
|
})
|
...
|
...
|
@@ -638,7 +632,10 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
|
}
|
|
|
|
|
|
// 评估内容对应的分数
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{
|
|
|
"summaryEvaluationIdList": evaluationIds,
|
|
|
"types": domain.EvaluationHrbp,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -648,21 +645,21 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
|
}
|
|
|
|
|
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
|
|
result := adapter.EvaluationInfoAdapter{
|
|
|
SummaryEvaluationId: sEvaluation.Id,
|
|
|
CycleId: int(sEvaluation.CycleId),
|
|
|
CycleName: sEvaluation.CycleName,
|
|
|
EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
LinkNodeId: sEvaluation.NodeId,
|
|
|
BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
Status: string(sEvaluation.Status),
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
}
|
|
|
return &result, nil
|
|
|
//result := adapter.EvaluationInfoAdapter{
|
|
|
// SummaryEvaluationId: sEvaluation.Id,
|
|
|
// CycleId: int(sEvaluation.CycleId),
|
|
|
// CycleName: sEvaluation.CycleName,
|
|
|
// EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
// EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
// LinkNodeId: sEvaluation.NodeId,
|
|
|
// BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
// EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
// TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
// TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
// Status: string(sEvaluation.Status),
|
|
|
// EvaluationItems: itemValuesAdapter,
|
|
|
//}
|
|
|
return &itemValuesAdapter, nil
|
|
|
}
|
|
|
|
|
|
// EditEvaluationHRBP 编辑提交人资综评
|
...
|
...
|
|