|
@@ -990,8 +990,8 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
|
@@ -990,8 +990,8 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
990
|
return result, nil
|
990
|
return result, nil
|
991
|
}
|
991
|
}
|
992
|
|
992
|
|
993
|
-// 获取上级评估的列表
|
|
|
994
|
-func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
993
|
+// 获取执行人的上级评估的列表
|
|
|
994
|
+func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.QueryExecutorEvaluationList) (map[string]interface{}, error) {
|
995
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
995
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
996
|
if err != nil {
|
996
|
if err != nil {
|
997
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
997
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -1011,9 +1011,6 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
@@ -1011,9 +1011,6 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
1011
|
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
1011
|
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
1012
|
"transactionContext": transactionContext,
|
1012
|
"transactionContext": transactionContext,
|
1013
|
})
|
1013
|
})
|
1014
|
- departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
1015
|
- "transactionContext": transactionContext,
|
|
|
1016
|
- })
|
|
|
1017
|
limit := param.PageSize
|
1014
|
limit := param.PageSize
|
1018
|
offset := (param.PageNumber - 1) * param.PageSize
|
1015
|
offset := (param.PageNumber - 1) * param.PageSize
|
1019
|
|
1016
|
|
|
@@ -1080,28 +1077,15 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
@@ -1080,28 +1077,15 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
1080
|
userMap[v.Id] = v
|
1077
|
userMap[v.Id] = v
|
1081
|
}
|
1078
|
}
|
1082
|
}
|
1079
|
}
|
1083
|
- var departmentIds []int
|
|
|
1084
|
- //获取部门
|
|
|
1085
|
- departmentMap := map[int64]*domain.Department{}
|
|
|
1086
|
var positionIds []int
|
1080
|
var positionIds []int
|
1087
|
//获取职位列表
|
1081
|
//获取职位列表
|
1088
|
positionMap := map[int64]*domain.Position{}
|
1082
|
positionMap := map[int64]*domain.Position{}
|
1089
|
for _, v := range userMap {
|
1083
|
for _, v := range userMap {
|
1090
|
- departmentIds = append(departmentIds, v.DepartmentId...)
|
|
|
1091
|
positionIds = append(positionIds, v.PositionId...)
|
1084
|
positionIds = append(positionIds, v.PositionId...)
|
1092
|
}
|
1085
|
}
|
1093
|
- if len(departmentIds) > 0 {
|
|
|
1094
|
- _, departmentList, err := departmentRepo.Find(map[string]interface{}{"ids": departmentIds})
|
|
|
1095
|
- if err != nil {
|
|
|
1096
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
|
|
1097
|
- }
|
|
|
1098
|
- for _, v := range departmentList {
|
|
|
1099
|
- departmentMap[v.Id] = v
|
|
|
1100
|
- }
|
|
|
1101
|
- }
|
|
|
1102
|
|
1086
|
|
1103
|
if len(positionIds) > 0 {
|
1087
|
if len(positionIds) > 0 {
|
1104
|
- _, positionList, err := positionRepo.Find(map[string]interface{}{"ids": departmentIds})
|
1088
|
+ _, positionList, err := positionRepo.Find(map[string]interface{}{"ids": positionIds})
|
1105
|
if err != nil {
|
1089
|
if err != nil {
|
1106
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
1090
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
1107
|
}
|
1091
|
}
|
|
@@ -1124,14 +1108,11 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
@@ -1124,14 +1108,11 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
1124
|
Position: "",
|
1108
|
Position: "",
|
1125
|
EntryTime: "",
|
1109
|
EntryTime: "",
|
1126
|
}
|
1110
|
}
|
|
|
1111
|
+ for _, dep := range v.TargetDepartment {
|
|
|
1112
|
+ item.Department += dep.DepartmentName + " "
|
|
|
1113
|
+ }
|
1127
|
//填充员工信息
|
1114
|
//填充员工信息
|
1128
|
if targetUser, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
1115
|
if targetUser, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
1129
|
- //填充部门信息
|
|
|
1130
|
- for _, departId := range targetUser.DepartmentId {
|
|
|
1131
|
- if depart, ok := departmentMap[int64(departId)]; ok {
|
|
|
1132
|
- item.Department += depart.Name + " "
|
|
|
1133
|
- }
|
|
|
1134
|
- }
|
|
|
1135
|
//填充职位信息
|
1116
|
//填充职位信息
|
1136
|
for _, positionId := range targetUser.PositionId {
|
1117
|
for _, positionId := range targetUser.PositionId {
|
1137
|
if position, ok := positionMap[int64(positionId)]; ok {
|
1118
|
if position, ok := positionMap[int64(positionId)]; ok {
|
|
@@ -1310,7 +1291,107 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
@@ -1310,7 +1291,107 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
1310
|
}
|
1291
|
}
|
1311
|
|
1292
|
|
1312
|
// 获取周期综合评估下,周期评估列表
|
1293
|
// 获取周期综合评估下,周期评估列表
|
1313
|
-func (srv *SummaryEvaluationService) ListEvalationSuper() (map[int]interface{}, error) {
|
1294
|
+func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
1295
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
1296
|
+ if err != nil {
|
|
|
1297
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
1298
|
+ }
|
|
|
1299
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
1300
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
1301
|
+ }
|
|
|
1302
|
+ defer func() {
|
|
|
1303
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
1304
|
+ }()
|
|
|
1305
|
+ evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
1306
|
+ "transactionContext": transactionContext,
|
|
|
1307
|
+ })
|
|
|
1308
|
+ userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
1309
|
+ "transactionContext": transactionContext,
|
|
|
1310
|
+ })
|
|
|
1311
|
+ positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
|
|
1312
|
+ "transactionContext": transactionContext,
|
|
|
1313
|
+ })
|
|
|
1314
|
+ limit := param.PageSize
|
|
|
1315
|
+ offset := (param.PageNumber - 1) * param.PageSize
|
|
|
1316
|
+
|
|
|
1317
|
+ //获取评估列表信息
|
|
|
1318
|
+ condition1 := map[string]interface{}{
|
|
|
1319
|
+ "cycleId": param.CycleId,
|
|
|
1320
|
+ "types": int(domain.EvaluationSuper),
|
|
|
1321
|
+ "limit": limit,
|
|
|
1322
|
+ }
|
|
|
1323
|
+ if offset > 0 {
|
|
|
1324
|
+ condition1["offset"] = offset
|
|
|
1325
|
+ }
|
|
|
1326
|
+ if len(param.TargetUserName) == 0 {
|
|
|
1327
|
+ condition1["targetUserName"] = "%" + param.TargetUserName + "%"
|
|
|
1328
|
+ }
|
|
|
1329
|
+ //获取评估列表信息
|
|
|
1330
|
+ cnt, evaluationList, err := evaluationRepo.Find(condition1)
|
|
|
1331
|
+ if err != nil {
|
|
|
1332
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
1333
|
+ }
|
|
|
1334
|
+ targetUserIds := []int{}
|
|
|
1335
|
+ for _, v := range evaluationList {
|
|
|
1336
|
+ targetUserIds = append(targetUserIds, v.TargetUser.UserId)
|
|
|
1337
|
+ }
|
1314
|
|
1338
|
|
1315
|
- return nil, nil
|
1339
|
+ //获取员工信息
|
|
|
1340
|
+ userMap := map[int64]*domain.User{}
|
|
|
1341
|
+ if len(targetUserIds) > 0 {
|
|
|
1342
|
+ _, userList, err := userRepo.Find(map[string]interface{}{
|
|
|
1343
|
+ "ids": targetUserIds,
|
|
|
1344
|
+ })
|
|
|
1345
|
+ if err != nil {
|
|
|
1346
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
1347
|
+ }
|
|
|
1348
|
+ for _, v := range userList {
|
|
|
1349
|
+ userMap[v.Id] = v
|
|
|
1350
|
+ }
|
|
|
1351
|
+ }
|
|
|
1352
|
+ var positionIds []int
|
|
|
1353
|
+ //获取职位列表
|
|
|
1354
|
+ positionMap := map[int64]*domain.Position{}
|
|
|
1355
|
+ for _, v := range userMap {
|
|
|
1356
|
+ positionIds = append(positionIds, v.PositionId...)
|
|
|
1357
|
+ }
|
|
|
1358
|
+ if len(positionIds) > 0 {
|
|
|
1359
|
+ _, positionList, err := positionRepo.Find(map[string]interface{}{"ids": positionIds})
|
|
|
1360
|
+ if err != nil {
|
|
|
1361
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
|
|
1362
|
+ }
|
|
|
1363
|
+ for _, v := range positionList {
|
|
|
1364
|
+ positionMap[v.Id] = v
|
|
|
1365
|
+ }
|
|
|
1366
|
+ }
|
|
|
1367
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
1368
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
1369
|
+ }
|
|
|
1370
|
+ evaluationListAdapter := []*adapter.EvaluationSuperItemAdapter{}
|
|
|
1371
|
+ for _, v := range evaluationList {
|
|
|
1372
|
+ item := adapter.EvaluationSuperItemAdapter{
|
|
|
1373
|
+ SummaryEvaluationId: v.Id,
|
|
|
1374
|
+ TargetUserName: v.TargetUser.UserName,
|
|
|
1375
|
+ TargetUserId: v.TargetUser.UserId,
|
|
|
1376
|
+ CycleId: v.CycleId,
|
|
|
1377
|
+ TotalScore: v.TotalScore,
|
|
|
1378
|
+ Department: "",
|
|
|
1379
|
+ Position: "",
|
|
|
1380
|
+ }
|
|
|
1381
|
+ for _, dep := range v.TargetDepartment {
|
|
|
1382
|
+ item.Department += dep.DepartmentName + " "
|
|
|
1383
|
+ }
|
|
|
1384
|
+ //填充员工信息
|
|
|
1385
|
+ if targetUser, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
|
|
1386
|
+ //填充职位信息
|
|
|
1387
|
+ for _, positionId := range targetUser.PositionId {
|
|
|
1388
|
+ if position, ok := positionMap[int64(positionId)]; ok {
|
|
|
1389
|
+ item.Position += position.Name + " "
|
|
|
1390
|
+ }
|
|
|
1391
|
+ }
|
|
|
1392
|
+ }
|
|
|
1393
|
+ evaluationListAdapter = append(evaluationListAdapter, &item)
|
|
|
1394
|
+ }
|
|
|
1395
|
+ result := tool_funs.SimpleWrapGridMap(int64(cnt), evaluationListAdapter)
|
|
|
1396
|
+ return result, nil
|
1316
|
} |
1397
|
} |