正在显示
1 个修改的文件
包含
28 行增加
和
10 行删除
@@ -391,16 +391,20 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA | @@ -391,16 +391,20 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA | ||
391 | assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ | 391 | assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{ |
392 | "transactionContext": transactionContext, | 392 | "transactionContext": transactionContext, |
393 | }) | 393 | }) |
394 | - _, err = assessTaskRepo.Save(&assessTask) | ||
395 | - if err != nil { | ||
396 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) | ||
397 | - } | ||
398 | - | ||
399 | assessList, err := srv.createStaffAssess(transactionContext, &assessTask) | 394 | assessList, err := srv.createStaffAssess(transactionContext, &assessTask) |
400 | if err != nil { | 395 | if err != nil { |
401 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error()) | 396 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error()) |
402 | } | 397 | } |
403 | 398 | ||
399 | + //评估的参与人 | ||
400 | + executorIds := []int{} | ||
401 | + executorIdMap := map[int]struct{}{} //过滤重复的用户 | ||
402 | + for _, v := range param.ExecutorId { | ||
403 | + if _, ok := executorIdMap[v]; ok { | ||
404 | + continue | ||
405 | + } | ||
406 | + executorIds = append(executorIds, v) | ||
407 | + } | ||
404 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ | 408 | assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{ |
405 | "transactionContext": transactionContext, | 409 | "transactionContext": transactionContext, |
406 | }) | 410 | }) |
@@ -411,6 +415,12 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA | @@ -411,6 +415,12 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA | ||
411 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error()) | 415 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error()) |
412 | } | 416 | } |
413 | } | 417 | } |
418 | + assessTask.ExecutorId = executorIds | ||
419 | + _, err = assessTaskRepo.Save(&assessTask) | ||
420 | + if err != nil { | ||
421 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error()) | ||
422 | + } | ||
423 | + | ||
414 | if err := transactionContext.CommitTransaction(); err != nil { | 424 | if err := transactionContext.CommitTransaction(); err != nil { |
415 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 425 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
416 | } | 426 | } |
@@ -550,7 +560,6 @@ func (srv StaffAssessServeice) createStaffAssessSupper( | @@ -550,7 +560,6 @@ func (srv StaffAssessServeice) createStaffAssessSupper( | ||
550 | if !ok { | 560 | if !ok { |
551 | continue | 561 | continue |
552 | } | 562 | } |
553 | - targetDepartment := []domain.StaffDepartment{} | ||
554 | for _, vv2 := range departmentList { | 563 | for _, vv2 := range departmentList { |
555 | if len(vv2.ChargeUserIds) == 0 { | 564 | if len(vv2.ChargeUserIds) == 0 { |
556 | continue | 565 | continue |
@@ -564,14 +573,23 @@ func (srv StaffAssessServeice) createStaffAssessSupper( | @@ -564,14 +573,23 @@ func (srv StaffAssessServeice) createStaffAssessSupper( | ||
564 | } | 573 | } |
565 | for _, vvv3 := range chargeUserList { | 574 | for _, vvv3 := range chargeUserList { |
566 | assessTemp.TargetDepartment = []domain.StaffDepartment{ | 575 | assessTemp.TargetDepartment = []domain.StaffDepartment{ |
567 | - domain.StaffDepartment{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name}, | 576 | + {DepartmentId: int(vv2.Id), DepartmentName: vv2.Name}, |
568 | } | 577 | } |
569 | - | 578 | + assessTemp.TargetUser = domain.StaffDesc{ |
579 | + UserId: int(v.Id), | ||
580 | + Account: v.Account, | ||
581 | + UserName: v.Name, | ||
582 | + } | ||
583 | + assessTemp.Executor = domain.StaffDesc{ | ||
584 | + UserId: int(vvv3.Id), | ||
585 | + Account: vvv3.Account, | ||
586 | + UserName: vvv3.Name, | ||
587 | + } | ||
588 | + assessList = append(assessList, assessTemp) | ||
570 | } | 589 | } |
571 | } | 590 | } |
572 | - | ||
573 | } | 591 | } |
574 | - return nil, nil | 592 | + return assessList, nil |
575 | } | 593 | } |
576 | 594 | ||
577 | // 获取某个员工360评估邀请的人员 | 595 | // 获取某个员工360评估邀请的人员 |
-
请 注册 或 登录 后发表评论