|
@@ -172,7 +172,7 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu |
|
@@ -172,7 +172,7 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu |
172
|
return result, nil
|
172
|
return result, nil
|
173
|
}
|
173
|
}
|
174
|
|
174
|
|
175
|
-// GetEvaluation360 获取360综评详情
|
175
|
+// GetEvaluation360 获取360综评详情(登录人作为评估人,评估内容)
|
176
|
func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
176
|
func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
177
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
177
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
178
|
if err != nil {
|
178
|
if err != nil {
|
|
@@ -205,7 +205,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
@@ -205,7 +205,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
205
|
}
|
205
|
}
|
206
|
sEvaluation := evaluations[0]
|
206
|
sEvaluation := evaluations[0]
|
207
|
|
207
|
|
208
|
- // 自评评估内容(自评模板、筛选项目评估人)
|
208
|
+ // 360评估内容(自评模板、筛选项目评估人)
|
209
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
209
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
210
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
210
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
211
|
"nodeType": domain.LinkNodeSelfAssessment,
|
211
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
@@ -243,6 +243,98 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
@@ -243,6 +243,98 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
243
|
return &result, nil
|
243
|
return &result, nil
|
244
|
}
|
244
|
}
|
245
|
|
245
|
|
|
|
246
|
+// GetEvaluation360All 获取360综评详情-上级综评(所有的评估人,评估内容)
|
|
|
247
|
+func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
248
|
+ transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
249
|
+ if err != nil {
|
|
|
250
|
+ return nil, err
|
|
|
251
|
+ }
|
|
|
252
|
+ defer func() {
|
|
|
253
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
254
|
+ }()
|
|
|
255
|
+
|
|
|
256
|
+ userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
257
|
+ evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
258
|
+ evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
259
|
+ itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
260
|
+ _, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
261
|
+ "limit": 1,
|
|
|
262
|
+ "companyId": param.CompanyId,
|
|
|
263
|
+ "cycleId": param.CycleId,
|
|
|
264
|
+ "targetUserId": param.TargetUserId,
|
|
|
265
|
+ "types": domain.Evaluation360},
|
|
|
266
|
+ )
|
|
|
267
|
+ if err != nil {
|
|
|
268
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
269
|
+ }
|
|
|
270
|
+ if len(evaluations) == 0 {
|
|
|
271
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
272
|
+ }
|
|
|
273
|
+ sEvaluation := evaluations[0]
|
|
|
274
|
+
|
|
|
275
|
+ // 360评估内容(自评模板)
|
|
|
276
|
+ _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
277
|
+ "evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
278
|
+ "nodeType": domain.LinkNodeSelfAssessment,
|
|
|
279
|
+ })
|
|
|
280
|
+ if err != nil {
|
|
|
281
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
282
|
+ }
|
|
|
283
|
+
|
|
|
284
|
+ // 评估内容对应的分数
|
|
|
285
|
+ _, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
|
|
286
|
+ if err != nil {
|
|
|
287
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
288
|
+ }
|
|
|
289
|
+
|
|
|
290
|
+ // 评估人ID -> User
|
|
|
291
|
+ evaluatorMap := map[int]*domain.User{}
|
|
|
292
|
+ evaluatorIds := make([]int, 0)
|
|
|
293
|
+ filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容
|
|
|
294
|
+ for i := range itemList {
|
|
|
295
|
+ if itemList[i].EvaluatorId > 0 {
|
|
|
296
|
+ filterItemList = append(filterItemList, itemList[i])
|
|
|
297
|
+ evaluatorIds = append(evaluatorIds, itemList[i].EvaluatorId)
|
|
|
298
|
+ }
|
|
|
299
|
+ }
|
|
|
300
|
+ if len(evaluatorIds) > 0 {
|
|
|
301
|
+ _, users, err := userRepo.Find(map[string]interface{}{"ids": evaluatorIds})
|
|
|
302
|
+ if err != nil {
|
|
|
303
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
304
|
+ }
|
|
|
305
|
+ for i := range users {
|
|
|
306
|
+ evaluatorMap[int(users[i].Id)] = users[i]
|
|
|
307
|
+ }
|
|
|
308
|
+ }
|
|
|
309
|
+
|
|
|
310
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
311
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
312
|
+ }
|
|
|
313
|
+
|
|
|
314
|
+ itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues)
|
|
|
315
|
+ for i := range itemValuesAdapter { // 评估人名称赋值
|
|
|
316
|
+ if user, ok := evaluatorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
317
|
+ itemValuesAdapter[i].EvaluatorName = user.Name
|
|
|
318
|
+ }
|
|
|
319
|
+ }
|
|
|
320
|
+
|
|
|
321
|
+ result := adapter.EvaluationInfoAdapter{
|
|
|
322
|
+ SummaryEvaluationId: sEvaluation.Id,
|
|
|
323
|
+ CycleId: int(sEvaluation.CycleId),
|
|
|
324
|
+ CycleName: sEvaluation.CycleName,
|
|
|
325
|
+ EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
326
|
+ EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
327
|
+ LinkNodeId: sEvaluation.NodeId,
|
|
|
328
|
+ BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
329
|
+ EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
330
|
+ TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
331
|
+ TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
332
|
+ Status: string(sEvaluation.Status),
|
|
|
333
|
+ EvaluationItems: itemValuesAdapter,
|
|
|
334
|
+ }
|
|
|
335
|
+ return &result, nil
|
|
|
336
|
+}
|
|
|
337
|
+
|
246
|
// EditEvaluation360 编辑提交360综评
|
338
|
// EditEvaluation360 编辑提交360综评
|
247
|
func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
|
339
|
func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
|
248
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
340
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
@@ -352,6 +444,12 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval |
|
@@ -352,6 +444,12 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval |
352
|
_ = transactionContext.RollbackTransaction()
|
444
|
_ = transactionContext.RollbackTransaction()
|
353
|
}()
|
445
|
}()
|
354
|
|
446
|
|
|
|
447
|
+ // 必须是HRBP权限的人才能编辑操作
|
|
|
448
|
+ hrbp, err := service.GetHRBP(transactionContext, param.CompanyId, param.UserId)
|
|
|
449
|
+ if hrbp != 1 {
|
|
|
450
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
451
|
+ }
|
|
|
452
|
+
|
355
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
453
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
356
|
staffAssessDaoRepo := dao.NewStaffAssessDao(map[string]interface{}{"transactionContext": transactionContext})
|
454
|
staffAssessDaoRepo := dao.NewStaffAssessDao(map[string]interface{}{"transactionContext": transactionContext})
|
357
|
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
455
|
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|