|
@@ -994,10 +994,40 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
@@ -994,10 +994,40 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
994
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
994
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
995
|
"transactionContext": transactionContext,
|
995
|
"transactionContext": transactionContext,
|
996
|
})
|
996
|
})
|
997
|
- cnt, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
997
|
+ positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
|
|
998
|
+ "transactionContext": transactionContext,
|
|
|
999
|
+ })
|
|
|
1000
|
+ departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
1001
|
+ "transactionContext": transactionContext,
|
|
|
1002
|
+ })
|
|
|
1003
|
+ limit := param.PageSize
|
|
|
1004
|
+ offset := (param.PageNumber - 1) * param.PageSize
|
|
|
1005
|
+
|
|
|
1006
|
+ //获取评估列表信息
|
|
|
1007
|
+ condition1 := map[string]interface{}{
|
|
|
1008
|
+ "cycleId": param.CycleId,
|
|
|
1009
|
+ "executorId": param.ExecutorId,
|
|
|
1010
|
+ "types": int(domain.EvaluationSuper),
|
|
|
1011
|
+ "limit": limit,
|
|
|
1012
|
+ }
|
|
|
1013
|
+ if offset > 0 {
|
|
|
1014
|
+ condition1["offset"] = offset
|
|
|
1015
|
+ }
|
|
|
1016
|
+ if len(param.TargetUserName) == 0 {
|
|
|
1017
|
+ condition1["targetUserName"] = "%" + param.TargetUserName + "%"
|
|
|
1018
|
+ }
|
|
|
1019
|
+ //获取评估列表信息
|
|
|
1020
|
+ cnt, evaluationList, err := evaluationRepo.Find(condition1)
|
|
|
1021
|
+ if err != nil {
|
|
|
1022
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
1023
|
+ }
|
|
|
1024
|
+ //获取未完成上级评估的数量
|
|
|
1025
|
+ cntUn, _, err := evaluationRepo.Find(map[string]interface{}{
|
998
|
"cycleId": param.CycleId,
|
1026
|
"cycleId": param.CycleId,
|
999
|
"executorId": param.ExecutorId,
|
1027
|
"executorId": param.ExecutorId,
|
1000
|
"types": int(domain.EvaluationSuper),
|
1028
|
"types": int(domain.EvaluationSuper),
|
|
|
1029
|
+ "status": domain.EvaluationUncompleted,
|
|
|
1030
|
+ "limit": 1,
|
1001
|
})
|
1031
|
})
|
1002
|
if err != nil {
|
1032
|
if err != nil {
|
1003
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1033
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -1006,21 +1036,109 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
@@ -1006,21 +1036,109 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
1006
|
for _, v := range evaluationList {
|
1036
|
for _, v := range evaluationList {
|
1007
|
targetUserIds = append(targetUserIds, v.TargetUser.UserId)
|
1037
|
targetUserIds = append(targetUserIds, v.TargetUser.UserId)
|
1008
|
}
|
1038
|
}
|
1009
|
- var userList []*domain.User
|
1039
|
+ //获取员工的综合自评
|
|
|
1040
|
+ evaluationSelfMap := map[int]*domain.SummaryEvaluation{}
|
|
|
1041
|
+ for _, v := range evaluationList {
|
|
|
1042
|
+ _, evaluationSelfList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
1043
|
+ "cycleId": param.CycleId,
|
|
|
1044
|
+ "executorId": v.TargetUser.UserId,
|
|
|
1045
|
+ "types": int(domain.EvaluationSelf),
|
|
|
1046
|
+ "limit": 1,
|
|
|
1047
|
+ })
|
|
|
1048
|
+ if err != nil {
|
|
|
1049
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取综合自评"+err.Error())
|
|
|
1050
|
+ }
|
|
|
1051
|
+ if len(evaluationSelfList) > 0 {
|
|
|
1052
|
+ evaluationSelfMap[v.TargetUser.UserId] = evaluationSelfList[0]
|
|
|
1053
|
+ }
|
|
|
1054
|
+ }
|
|
|
1055
|
+
|
|
|
1056
|
+ //获取员工信息
|
|
|
1057
|
+ userMap := map[int64]*domain.User{}
|
1010
|
if len(targetUserIds) > 0 {
|
1058
|
if len(targetUserIds) > 0 {
|
1011
|
- _, userList, err = userRepo.Find(map[string]interface{}{
|
1059
|
+ _, userList, err := userRepo.Find(map[string]interface{}{
|
1012
|
"ids": targetUserIds,
|
1060
|
"ids": targetUserIds,
|
1013
|
})
|
1061
|
})
|
1014
|
if err != nil {
|
1062
|
if err != nil {
|
1015
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1063
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1016
|
}
|
1064
|
}
|
|
|
1065
|
+ for _, v := range userList {
|
|
|
1066
|
+ userMap[v.Id] = v
|
|
|
1067
|
+ }
|
|
|
1068
|
+ }
|
|
|
1069
|
+ var departmentIds []int
|
|
|
1070
|
+ //获取部门
|
|
|
1071
|
+ departmentMap := map[int64]*domain.Department{}
|
|
|
1072
|
+ var positionIds []int
|
|
|
1073
|
+ //获取职位列表
|
|
|
1074
|
+ positionMap := map[int64]*domain.Position{}
|
|
|
1075
|
+ for _, v := range userMap {
|
|
|
1076
|
+ departmentIds = append(departmentIds, v.DepartmentId...)
|
|
|
1077
|
+ positionIds = append(positionIds, v.PositionId...)
|
|
|
1078
|
+ }
|
|
|
1079
|
+ if len(departmentIds) > 0 {
|
|
|
1080
|
+ _, departmentList, err := departmentRepo.Find(map[string]interface{}{"ids": departmentIds})
|
|
|
1081
|
+ if err != nil {
|
|
|
1082
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
|
|
1083
|
+ }
|
|
|
1084
|
+ for _, v := range departmentList {
|
|
|
1085
|
+ departmentMap[v.Id] = v
|
|
|
1086
|
+ }
|
1017
|
}
|
1087
|
}
|
1018
|
|
1088
|
|
1019
|
- _ = userList
|
|
|
1020
|
- _ = evaluationList
|
|
|
1021
|
- _ = cnt
|
1089
|
+ if len(positionIds) > 0 {
|
|
|
1090
|
+ _, positionList, err := positionRepo.Find(map[string]interface{}{"ids": departmentIds})
|
|
|
1091
|
+ if err != nil {
|
|
|
1092
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
|
|
1093
|
+ }
|
|
|
1094
|
+ for _, v := range positionList {
|
|
|
1095
|
+ positionMap[v.Id] = v
|
|
|
1096
|
+ }
|
|
|
1097
|
+ }
|
1022
|
if err := transactionContext.CommitTransaction(); err != nil {
|
1098
|
if err := transactionContext.CommitTransaction(); err != nil {
|
1023
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1099
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1024
|
}
|
1100
|
}
|
1025
|
- return nil, nil
|
1101
|
+ evaluationListAdapter := []*adapter.EvaluationSuperListAdapter{}
|
|
|
1102
|
+ for _, v := range evaluationList {
|
|
|
1103
|
+ item := adapter.EvaluationSuperListAdapter{
|
|
|
1104
|
+ SummaryEvaluationId: v.Id,
|
|
|
1105
|
+ TargetUserName: v.TargetUser.UserName,
|
|
|
1106
|
+ EvaluationStatus: string(v.Status),
|
|
|
1107
|
+ EndTime: v.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
1108
|
+ TotalScoreSelf: "",
|
|
|
1109
|
+ Department: "",
|
|
|
1110
|
+ Position: "",
|
|
|
1111
|
+ EntryTime: "",
|
|
|
1112
|
+ }
|
|
|
1113
|
+ //填充员工信息
|
|
|
1114
|
+ if targetUser, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
|
|
1115
|
+ //填充部门信息
|
|
|
1116
|
+ for _, departId := range targetUser.DepartmentId {
|
|
|
1117
|
+ if depart, ok := departmentMap[int64(departId)]; ok {
|
|
|
1118
|
+ item.Department += depart.Name + " "
|
|
|
1119
|
+ }
|
|
|
1120
|
+ }
|
|
|
1121
|
+ //填充职位信息
|
|
|
1122
|
+ for _, positionId := range targetUser.PositionId {
|
|
|
1123
|
+ if position, ok := positionMap[int64(positionId)]; ok {
|
|
|
1124
|
+ item.Position += position.Name + " "
|
|
|
1125
|
+ }
|
|
|
1126
|
+ }
|
|
|
1127
|
+ //填充入职时间
|
|
|
1128
|
+ item.EntryTime = targetUser.EntryTime
|
|
|
1129
|
+ }
|
|
|
1130
|
+ //填充自评总分
|
|
|
1131
|
+ if evaluationSelf, ok := evaluationSelfMap[v.TargetUser.UserId]; ok {
|
|
|
1132
|
+ item.TotalScoreSelf = evaluationSelf.TotalScore
|
|
|
1133
|
+ }
|
|
|
1134
|
+ evaluationListAdapter = append(evaluationListAdapter, &item)
|
|
|
1135
|
+ }
|
|
|
1136
|
+ result := tool_funs.SimpleWrapGridMap(int64(cnt), evaluationListAdapter)
|
|
|
1137
|
+ result["endTime"] = ""
|
|
|
1138
|
+ result["uncompleted_number"] = 0
|
|
|
1139
|
+ if len(evaluationList) > 0 {
|
|
|
1140
|
+ result["endTime"] = evaluationList[0].EndTime.Format("2006-01-02 15:04:05")
|
|
|
1141
|
+ result["uncompleted_number"] = cntUn
|
|
|
1142
|
+ }
|
|
|
1143
|
+ return result, nil
|
1026
|
} |
1144
|
} |