|
@@ -660,6 +660,9 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
@@ -660,6 +660,9 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
660
|
targetUser, err := userRepo.FindOne(map[string]interface{}{
|
660
|
targetUser, err := userRepo.FindOne(map[string]interface{}{
|
661
|
"id": param.TargetUserId,
|
661
|
"id": param.TargetUserId,
|
662
|
})
|
662
|
})
|
|
|
663
|
+ if err != nil {
|
|
|
664
|
+ return nil, application.ThrowError(application.ARG_ERROR, "获取被评估员工"+err.Error())
|
|
|
665
|
+ }
|
663
|
//被评估人的部门
|
666
|
//被评估人的部门
|
664
|
var targetUserDepartment []domain.StaffDepartment
|
667
|
var targetUserDepartment []domain.StaffDepartment
|
665
|
if len(targetUser.DepartmentId) > 0 {
|
668
|
if len(targetUser.DepartmentId) > 0 {
|
|
@@ -676,7 +679,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
@@ -676,7 +679,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
676
|
})
|
679
|
})
|
677
|
}
|
680
|
}
|
678
|
}
|
681
|
}
|
679
|
- //相同上级的员工
|
682
|
+ //邀请的相同上级的员工
|
680
|
var inviteSameSuper []domain.StaffDesc
|
683
|
var inviteSameSuper []domain.StaffDesc
|
681
|
if len(inviteSameSuperId) > 0 {
|
684
|
if len(inviteSameSuperId) > 0 {
|
682
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
685
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
|
@@ -693,22 +696,27 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
@@ -693,22 +696,27 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
693
|
})
|
696
|
})
|
694
|
}
|
697
|
}
|
695
|
}
|
698
|
}
|
|
|
699
|
+ //邀请的不同上级的员工
|
696
|
var inviteDiffSuper []domain.StaffDesc
|
700
|
var inviteDiffSuper []domain.StaffDesc
|
697
|
if len(InviteDiffSuperId) > 0 {
|
701
|
if len(InviteDiffSuperId) > 0 {
|
698
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
702
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
699
|
- "ids": inviteSameSuperId,
|
703
|
+ "ids": InviteDiffSuperId,
|
700
|
})
|
704
|
})
|
701
|
if err != nil {
|
705
|
if err != nil {
|
702
|
return nil, application.ThrowError(application.ARG_ERROR, "获取用户信息"+err.Error())
|
706
|
return nil, application.ThrowError(application.ARG_ERROR, "获取用户信息"+err.Error())
|
703
|
}
|
707
|
}
|
704
|
for _, v := range userList {
|
708
|
for _, v := range userList {
|
705
|
- inviteSameSuper = append(inviteSameSuper, domain.StaffDesc{
|
709
|
+ inviteDiffSuper = append(inviteDiffSuper, domain.StaffDesc{
|
706
|
UserId: int(v.Id),
|
710
|
UserId: int(v.Id),
|
707
|
UserName: v.Name,
|
711
|
UserName: v.Name,
|
708
|
Account: v.Account,
|
712
|
Account: v.Account,
|
709
|
})
|
713
|
})
|
710
|
}
|
714
|
}
|
711
|
}
|
715
|
}
|
|
|
716
|
+ _ = assessReps
|
|
|
717
|
+ _ = inviteSameSuper
|
|
|
718
|
+ _ = inviteDiffSuper
|
|
|
719
|
+ _ = targetUserDepartment
|
712
|
// _, assessList, err := assessReps.Find(map[string]interface{}{
|
720
|
// _, assessList, err := assessReps.Find(map[string]interface{}{
|
713
|
// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
721
|
// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
714
|
// "staffAssessTaskId": param.AssessTaskId,
|
722
|
// "staffAssessTaskId": param.AssessTaskId,
|
|
@@ -717,6 +725,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
@@ -717,6 +725,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
717
|
// if err != nil {
|
725
|
// if err != nil {
|
718
|
// return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
|
726
|
// return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
|
719
|
// }
|
727
|
// }
|
|
|
728
|
+ // TODO
|
720
|
|
729
|
|
721
|
if err := transactionContext.CommitTransaction(); err != nil {
|
730
|
if err := transactionContext.CommitTransaction(); err != nil {
|
722
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
731
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -745,3 +754,94 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
@@ -745,3 +754,94 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
745
|
// }
|
754
|
// }
|
746
|
return &result, nil
|
755
|
return &result, nil
|
747
|
}
|
756
|
}
|
|
|
757
|
+
|
|
|
758
|
+// 获取员工自评的评估内容详情
|
|
|
759
|
+func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
|
|
|
760
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
761
|
+ if err != nil {
|
|
|
762
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
763
|
+ }
|
|
|
764
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
765
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
766
|
+ }
|
|
|
767
|
+ defer func() {
|
|
|
768
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
769
|
+ }()
|
|
|
770
|
+ assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
771
|
+ "transactionContext": transactionContext,
|
|
|
772
|
+ })
|
|
|
773
|
+
|
|
|
774
|
+ //获取员工的评估
|
|
|
775
|
+ _, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
776
|
+ "companyId": param.CompanyId,
|
|
|
777
|
+ "staffAssessTaskId": param.AssessTaskId,
|
|
|
778
|
+ "targetUserId": param.TargetUserId,
|
|
|
779
|
+ "typesList": []string{string(domain.AssessSelf)},
|
|
|
780
|
+ })
|
|
|
781
|
+ if err != nil {
|
|
|
782
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
783
|
+ }
|
|
|
784
|
+ if len(assessList) == 0 {
|
|
|
785
|
+ return &adapter.AssessInfoResp{}, nil
|
|
|
786
|
+ }
|
|
|
787
|
+ assessData := assessList[0]
|
|
|
788
|
+ projectRepo := factory.CreateEvaluationProjectRepository(map[string]interface{}{
|
|
|
789
|
+ "transactionContext": transactionContext,
|
|
|
790
|
+ })
|
|
|
791
|
+ projectData, err := projectRepo.FindOne(map[string]interface{}{
|
|
|
792
|
+ "id": assessData.EvaluationProjectId,
|
|
|
793
|
+ })
|
|
|
794
|
+ if err != nil {
|
|
|
795
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目评估配置"+err.Error())
|
|
|
796
|
+ }
|
|
|
797
|
+ if projectData.Template == nil {
|
|
|
798
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获取到项目评估配置模板")
|
|
|
799
|
+ }
|
|
|
800
|
+ var selfLinkNode *domain.LinkNode
|
|
|
801
|
+ for _, v := range projectData.Template.LinkNodes {
|
|
|
802
|
+ if v.Type == domain.LinkNodeSelfAssessment {
|
|
|
803
|
+ selfLinkNode = v
|
|
|
804
|
+ break
|
|
|
805
|
+ }
|
|
|
806
|
+ }
|
|
|
807
|
+ if selfLinkNode == nil {
|
|
|
808
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获取到项目评估自评配置")
|
|
|
809
|
+ }
|
|
|
810
|
+ //获取员工评估的填写内容
|
|
|
811
|
+ // assessContentReps := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
812
|
+ // "transactionContext": transactionContext,
|
|
|
813
|
+ // })
|
|
|
814
|
+ // _, assessContentList, err := assessContentReps.Find(map[string]interface{}{
|
|
|
815
|
+ // "staffAssessId": assessData.Id,
|
|
|
816
|
+ // })
|
|
|
817
|
+ // if err != nil {
|
|
|
818
|
+ // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目评估员工填写的内容"+err.Error())
|
|
|
819
|
+ // }
|
|
|
820
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
821
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
822
|
+ }
|
|
|
823
|
+
|
|
|
824
|
+ result := adapter.AssessInfoResp{
|
|
|
825
|
+ CycleId: assessData.CycleId,
|
|
|
826
|
+ CycleName: assessData.CycleName,
|
|
|
827
|
+ EvaluationProjectId: assessData.EvaluationProjectId,
|
|
|
828
|
+ EvaluationProjectName: assessData.EvaluationProjectName,
|
|
|
829
|
+ BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
830
|
+ EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
831
|
+ Status: string(assessData.Status),
|
|
|
832
|
+ TargetUserId: assessData.TargetUser.UserId,
|
|
|
833
|
+ TargetUserName: assessData.TargetUser.UserName,
|
|
|
834
|
+ AssessContent: nil,
|
|
|
835
|
+ }
|
|
|
836
|
+ assessContent := make([]adapter.AssessContent, 0)
|
|
|
837
|
+ for _, v := range selfLinkNode.NodeContents {
|
|
|
838
|
+ assessContent = append(assessContent, adapter.AssessContent{
|
|
|
839
|
+ Category: v.Category,
|
|
|
840
|
+ Name: v.Name,
|
|
|
841
|
+ PromptTitle: v.PromptTitle,
|
|
|
842
|
+ PromptText: v.PromptText,
|
|
|
843
|
+ })
|
|
|
844
|
+ }
|
|
|
845
|
+ result.AssessContent = assessContent
|
|
|
846
|
+ return &result, nil
|
|
|
847
|
+} |