作者 Your Name

更新

@@ -4,22 +4,31 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" @@ -4,22 +4,31 @@ import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
4 4
5 //评估内容详情 5 //评估内容详情
6 type AssessInfoResp struct { 6 type AssessInfoResp struct {
7 - CycleId int64 `json:"cycleId"` //周期id  
8 - CycleName string `json:"cycleName"` //周期名称  
9 - EvaluationProjectId int `json:"evaluationProjectId"` //项目id  
10 - EvaluationProjectName string `json:"evaluationProjectName"` //项目名称  
11 - BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05  
12 - EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05  
13 - Status string `json:"status"` //完成状态  
14 - TargetUserId int `json:"targetUser"` //  
15 - TargetUserName string `json:"targetUserName"` //  
16 - AssessContent []AssessContent `json:"assessContent"` //评估内容 7 + AssessId int `json:"assessId"`
  8 + CycleId int64 `json:"cycleId"` //周期id
  9 + CycleName string `json:"cycleName"` //周期名称
  10 + EvaluationProjectId int `json:"evaluationProjectId"` //项目id
  11 + EvaluationProjectName string `json:"evaluationProjectName"` //项目名称
  12 + BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05
  13 + EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05
  14 + Status string `json:"status"` //完成状态
  15 + TargetUserId int `json:"targetUser"` //
  16 + TargetUserName string `json:"targetUserName"` //
  17 + AssessContent []*domain.StaffAssessContent `json:"assessContent"` //评估内容
17 } 18 }
18 19
19 type AssessContent struct { 20 type AssessContent struct {
20 - Category string `json:"category" comment:"类别"`  
21 - Name string `json:"name" comment:"名称"`  
22 - PromptTitle string `json:"promptTitle" comment:"提示项标题"`  
23 - PromptText string `json:"promptText" comment:"提示项正文"`  
24 - EntryItems []*domain.EntryItem `json:"entryItems" comment:"填写项"` 21 + Category string `json:"category"` //comment:"类别"
  22 + Name string `json:"name"` // comment:"名称"
  23 + PromptTitle string `json:"promptTitle"` //comment:"提示项标题"
  24 + PromptText string `json:"promptText"` // comment:"提示项正文"
  25 + Rule AssessContentRule `json:"rules"` //评定规则
  26 + Value string `json:"value"` // 实际填写评定值
  27 + Remark []domain.AssessContemtRemark `json:"entryItems"` // comment:"填写反馈"
  28 +}
  29 +
  30 +type AssessContentRule struct {
  31 + Types int `json:"types"` //评估方式(0评级、1评分)
  32 + Rating domain.Rating `json:"rating"` //评级
  33 + Score domain.Score `json:"score"` //评分
25 } 34 }
@@ -2,6 +2,6 @@ package query @@ -2,6 +2,6 @@ package query
2 2
3 type GetAssessInviteUserQuery struct { 3 type GetAssessInviteUserQuery struct {
4 CompanyId int `json:"companyId"` //对公司 4 CompanyId int `json:"companyId"` //对公司
5 - UsrId int `json:"usrId"` //被评估的员工id 5 + UserId int `json:"userId"` //被评估的员工id
6 AssessTaskId int `json:"assessTaskId"` //评估任务的id 6 AssessTaskId int `json:"assessTaskId"` //评估任务的id
7 } 7 }
@@ -575,7 +575,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU @@ -575,7 +575,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU
575 _, assessList, err := assessReps.Find(map[string]interface{}{ 575 _, assessList, err := assessReps.Find(map[string]interface{}{
576 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)}, 576 "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
577 "staffAssessTaskId": param.AssessTaskId, 577 "staffAssessTaskId": param.AssessTaskId,
578 - "targetUserId": param.UsrId, 578 + "targetUserId": param.UserId,
579 }) 579 })
580 if err != nil { 580 if err != nil {
581 return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error()) 581 return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
@@ -585,7 +585,9 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU @@ -585,7 +585,9 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU
585 } 585 }
586 586
587 result := adapter.AssessInviteUserResp{ 587 result := adapter.AssessInviteUserResp{
588 - AssessTaskId: assessTaskData.Id, 588 + AssessTaskId: assessTaskData.Id,
  589 + InviteDiffSuper: []domain.StaffDesc{},
  590 + InviteSameSuper: []domain.StaffDesc{},
589 } 591 }
590 for _, v := range assessTaskData.StepList { 592 for _, v := range assessTaskData.StepList {
591 if v.LinkNodeType != domain.LinkNodeAllInvite { 593 if v.LinkNodeType != domain.LinkNodeAllInvite {
@@ -608,7 +610,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU @@ -608,7 +610,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU
608 return &result, nil 610 return &result, nil
609 } 611 }
610 612
611 -// 获取某个员工360邀请的人员 613 +// 保存某个员工360邀请的人员
612 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (*adapter.AssessInviteUserResp, error) { 614 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (*adapter.AssessInviteUserResp, error) {
613 inviteSameSuperId := []int{} 615 inviteSameSuperId := []int{}
614 InviteDiffSuperId := []int{} 616 InviteDiffSuperId := []int{}
@@ -713,19 +715,22 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv @@ -713,19 +715,22 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv
713 }) 715 })
714 } 716 }
715 } 717 }
716 - _ = assessReps 718 + //获取员工邀请的人
  719 + _, assessList, err := assessReps.Find(map[string]interface{}{
  720 + "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  721 + "staffAssessTaskId": param.AssessTaskId,
  722 + "targetUserId": param.TargetUserId,
  723 + })
  724 + if err != nil {
  725 + return nil, application.ThrowError(application.ARG_ERROR, "获取员工邀请的人"+err.Error())
  726 + }
  727 + //比对新旧数据
  728 +
  729 + _ = assessList
  730 + _ = targetUser
717 _ = inviteSameSuper 731 _ = inviteSameSuper
718 _ = inviteDiffSuper 732 _ = inviteDiffSuper
719 _ = targetUserDepartment 733 _ = targetUserDepartment
720 - // _, assessList, err := assessReps.Find(map[string]interface{}{  
721 - // "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
722 - // "staffAssessTaskId": param.AssessTaskId,  
723 - // "targetUserId": param.TargetUserId,  
724 - // })  
725 - // if err != nil {  
726 - // return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())  
727 - // }  
728 - // TODO  
729 734
730 if err := transactionContext.CommitTransaction(); err != nil { 735 if err := transactionContext.CommitTransaction(); err != nil {
731 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 736 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -770,7 +775,6 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( @@ -770,7 +775,6 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) (
770 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ 775 assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
771 "transactionContext": transactionContext, 776 "transactionContext": transactionContext,
772 }) 777 })
773 -  
774 //获取员工的评估 778 //获取员工的评估
775 _, assessList, err := assessReps.Find(map[string]interface{}{ 779 _, assessList, err := assessReps.Find(map[string]interface{}{
776 "companyId": param.CompanyId, 780 "companyId": param.CompanyId,
@@ -785,43 +789,32 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( @@ -785,43 +789,32 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) (
785 return &adapter.AssessInfoResp{}, nil 789 return &adapter.AssessInfoResp{}, nil
786 } 790 }
787 assessData := assessList[0] 791 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 792 +
  793 + assessContentList := []*domain.StaffAssessContent{}
  794 + if assessData.Status == domain.StaffAssessCompleted {
  795 + //已完成
  796 + assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
  797 + "transactionContext": transactionContext,
  798 + })
  799 + _, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
  800 + "staffAssessId": assessData.Id,
  801 + })
  802 + if err != nil {
  803 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  804 + }
  805 + } else if assessData.Status == domain.StaffAssessUncompleted {
  806 + //未完成
  807 + assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)
  808 + if err != nil {
  809 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
805 } 810 }
806 } 811 }
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 { 812 if err := transactionContext.CommitTransaction(); err != nil {
821 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 813 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
822 } 814 }
823 815
824 result := adapter.AssessInfoResp{ 816 result := adapter.AssessInfoResp{
  817 + AssessId: assessData.Id,
825 CycleId: assessData.CycleId, 818 CycleId: assessData.CycleId,
826 CycleName: assessData.CycleName, 819 CycleName: assessData.CycleName,
827 EvaluationProjectId: assessData.EvaluationProjectId, 820 EvaluationProjectId: assessData.EvaluationProjectId,
@@ -831,18 +824,83 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( @@ -831,18 +824,83 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) (
831 Status: string(assessData.Status), 824 Status: string(assessData.Status),
832 TargetUserId: assessData.TargetUser.UserId, 825 TargetUserId: assessData.TargetUser.UserId,
833 TargetUserName: assessData.TargetUser.UserName, 826 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 - EntryItems: v.EntryItems,  
844 - }) 827 + AssessContent: assessContentList,
845 } 828 }
846 - result.AssessContent = assessContent  
847 return &result, nil 829 return &result, nil
848 } 830 }
  831 +
  832 +// 获取未完成的员工评估内容
  833 +func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext,
  834 + assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) {
  835 + projectRepo := factory.CreateEvaluationProjectRepository(map[string]interface{}{
  836 + "transactionContext": transactionContext,
  837 + })
  838 + projectData, err := projectRepo.FindOne(map[string]interface{}{
  839 + "id": assess.EvaluationProjectId,
  840 + })
  841 + if err != nil {
  842 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  843 + }
  844 + var linkNode *domain.LinkNode
  845 + for _, v := range projectData.Template.LinkNodes {
  846 + if v.Id == int64(assess.LinkNodeId) {
  847 + linkNode = v
  848 + break
  849 + }
  850 + }
  851 + if linkNode == nil {
  852 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获得评估环节配置"+err.Error())
  853 + }
  854 + ruleRepo := factory.CreateEvaluationRuleRepository(map[string]interface{}{
  855 + "transactionContext": transactionContext,
  856 + })
  857 + ruleMap := map[string]*domain.EvaluationRule{}
  858 + for _, v := range linkNode.NodeContents {
  859 + if _, ok := ruleMap[v.RuleId]; ok {
  860 + continue
  861 + }
  862 + rid, _ := strconv.Atoi(v.RuleId)
  863 + ruleData, err := ruleRepo.FindOne(map[string]interface{}{
  864 + "id": rid,
  865 + })
  866 + if err == nil {
  867 + ruleMap[v.RuleId] = ruleData
  868 + }
  869 + }
  870 +
  871 + var contentList []*domain.StaffAssessContent
  872 + nowTime := time.Now()
  873 + for i, v := range linkNode.NodeContents {
  874 + item := &domain.StaffAssessContent{
  875 + Id: 0,
  876 + StaffAssessId: assess.Id,
  877 + SortBy: i + 1,
  878 + Category: v.Category,
  879 + Name: v.Name,
  880 + PromptTitle: v.PromptTitle,
  881 + PromptText: v.PromptText,
  882 + Remark: nil,
  883 + Value: "",
  884 + ReteResult: "",
  885 + CreatedAt: nowTime,
  886 + UpdatedAt: nowTime,
  887 + DeletedAt: nil,
  888 + // Rule: ,
  889 + }
  890 + if ruleVal, ok := ruleMap[v.RuleId]; ok {
  891 + item.Rule = *ruleVal
  892 + }
  893 + var remarks []domain.AssessContemtRemark
  894 + for _, vv := range v.EntryItems {
  895 + ritem := domain.AssessContemtRemark{
  896 + Title: vv.Title,
  897 + HintText: vv.HintText,
  898 + RemarkText: "",
  899 + }
  900 + remarks = append(remarks, ritem)
  901 + }
  902 + item.Remark = remarks
  903 + contentList = append(contentList, item)
  904 + }
  905 + return contentList, nil
  906 +}
@@ -4,22 +4,26 @@ import "time" @@ -4,22 +4,26 @@ import "time"
4 4
5 //填写的评估内容 5 //填写的评估内容
6 type StaffAssessContent struct { 6 type StaffAssessContent struct {
7 - Id int `json:"id"` //id  
8 - StaffAssessId int `json:"staffAssessId"` //用户需要的评估项id  
9 - SortBy int `json:"sortBy"` //排序  
10 - Category string `json:"category"` //类别  
11 - Title string `json:"title"` //问题标题  
12 - Remark string `json:"remark"` //填写的反馈  
13 - Rate string `json:"rate"` //评估填写的值  
14 - ReteResult string `json:"reteResult"` //评估的结果  
15 - CreatedAt time.Time `json:"createdAt"` //数据创建时间  
16 - UpdatedAt time.Time `json:"updatedAt"` //数据更新时间  
17 - //TODO 7 + Id int `json:"id"` //id
  8 + StaffAssessId int `json:"staffAssessId"` //用户需要的评估项id
  9 + SortBy int `json:"sortBy"` //排序
  10 + Category string `json:"category"` //类别
  11 + Name string `json:"name"` //名称
  12 + PromptTitle string `json:"promptTitle"` //提示项标题
  13 + PromptText string `json:"promptText"` //提示项正文
  14 + Remark []AssessContemtRemark `json:"remark"` //填写的反馈
  15 + Value string `json:"value"` //评估填写的值
  16 + ReteResult string `json:"reteResult"` //评估的结果
  17 + Rule EvaluationRule `json:"rule"` //评估的选项规则
  18 + CreatedAt time.Time `json:"createdAt"` //数据创建时间
  19 + UpdatedAt time.Time `json:"updatedAt"` //数据更新时间
  20 + DeletedAt *time.Time `json:"deletedAt"`
18 } 21 }
19 22
20 type AssessContemtRemark struct { 23 type AssessContemtRemark struct {
21 - Title string `json:"title"` //comment:"填写标题"  
22 - RemarkText string `json:"hintText"` // comment:"填写文本内容" 24 + Title string `json:"title"` //comment:"填写标题"
  25 + HintText string `json:"hintText"` // comment:"文本内容提示"
  26 + RemarkText string `json:"remarkText"` // comment:"填写文本内容"
23 } 27 }
24 28
25 type StaffAssessContentRepository interface { 29 type StaffAssessContentRepository interface {
@@ -42,6 +42,7 @@ func init() { @@ -42,6 +42,7 @@ func init() {
42 &models.EvaluationProject{}, 42 &models.EvaluationProject{},
43 &models.StaffAssess{}, 43 &models.StaffAssess{},
44 &models.StaffAssessTask{}, 44 &models.StaffAssessTask{},
  45 + &models.StaffAssessContent{},
45 } 46 }
46 for _, model := range tables { 47 for _, model := range tables {
47 err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ 48 err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
1 package models 1 package models
2 2
3 -import "time" 3 +import (
  4 + "time"
4 5
5 -//填写的评估内容 6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
  7 +)
  8 +
  9 +// 填写的评估内容
6 type StaffAssessContent struct { 10 type StaffAssessContent struct {
7 - tableName struct{} `pg:"staff_assess_content" comment:"填写的评估项"`  
8 - Id int `pg:",pk"` //id  
9 - StaffAssessId int //用户需要的评估项id  
10 - SortBy int //排序  
11 - Category string //类别  
12 - Title string //问题标题  
13 - Remark string //填写的反馈  
14 - Rate string //评估填写的值  
15 - ReteResult string //评估的结果 11 + tableName struct{} `pg:"staff_assess_content" comment:"填写的评估项"`
  12 + Id int `pg:",pk"` //id
  13 + StaffAssessId int //用户需要的评估项id
  14 + SortBy int //排序
  15 + Category string //类别
  16 + Name string //名称
  17 + PromptTitle string //问题标题
  18 + PromptText string //提示项正文
  19 + Value string //评估填写的值
  20 + ReteResult string //评估的结果
  21 + Rule domain.EvaluationRule
  22 + Remark []domain.AssessContemtRemark
16 CreatedAt time.Time //数据创建时间 23 CreatedAt time.Time //数据创建时间
17 UpdatedAt time.Time //数据更新时间 24 UpdatedAt time.Time //数据更新时间
  25 + DeletedAt *time.Time
18 } 26 }
19 27
20 type StaffAssessContentRepository interface { 28 type StaffAssessContentRepository interface {
@@ -22,12 +22,40 @@ func NewStaffAssessContentRepository(transactionContext *pgTransaction.Transacti @@ -22,12 +22,40 @@ func NewStaffAssessContentRepository(transactionContext *pgTransaction.Transacti
22 } 22 }
23 23
24 func (repo *StaffAssessContentRepository) TransformToDomain(d *models.StaffAssessContent) *domain.StaffAssessContent { 24 func (repo *StaffAssessContentRepository) TransformToDomain(d *models.StaffAssessContent) *domain.StaffAssessContent {
25 - return &domain.StaffAssessContent{} 25 + return &domain.StaffAssessContent{
  26 + Id: d.Id,
  27 + StaffAssessId: d.StaffAssessId,
  28 + SortBy: d.SortBy,
  29 + Category: d.Category,
  30 + Name: d.Name,
  31 + PromptTitle: d.PromptTitle,
  32 + PromptText: d.PromptText,
  33 + Remark: d.Remark,
  34 + Value: d.Value,
  35 + ReteResult: d.ReteResult,
  36 + Rule: d.Rule,
  37 + CreatedAt: d.CreatedAt,
  38 + UpdatedAt: d.UpdatedAt,
  39 + DeletedAt: nil,
  40 + }
26 } 41 }
27 42
28 func (repo *StaffAssessContentRepository) Save(d *domain.StaffAssessContent) (*domain.StaffAssessContent, error) { 43 func (repo *StaffAssessContentRepository) Save(d *domain.StaffAssessContent) (*domain.StaffAssessContent, error) {
29 - saveModel := models.StaffAssess{  
30 - Id: d.Id, 44 + saveModel := models.StaffAssessContent{
  45 + Id: d.Id,
  46 + StaffAssessId: d.StaffAssessId,
  47 + SortBy: d.SortBy,
  48 + Category: d.Category,
  49 + Name: d.Name,
  50 + PromptTitle: d.PromptTitle,
  51 + PromptText: d.PromptText,
  52 + Remark: d.Remark,
  53 + Value: d.Value,
  54 + ReteResult: d.ReteResult,
  55 + Rule: d.Rule,
  56 + CreatedAt: d.CreatedAt,
  57 + UpdatedAt: d.UpdatedAt,
  58 + DeletedAt: nil,
31 } 59 }
32 tx := repo.transactionContext.PgTx 60 tx := repo.transactionContext.PgTx
33 var err error 61 var err error
@@ -79,7 +107,7 @@ func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface @@ -79,7 +107,7 @@ func (repo *StaffAssessContentRepository) Find(queryOptions map[string]interface
79 tx := repo.transactionContext.PgTx 107 tx := repo.transactionContext.PgTx
80 var m []*models.StaffAssessContent 108 var m []*models.StaffAssessContent
81 query := tx.Model(&m). 109 query := tx.Model(&m).
82 - Where("deleted_at isnull").Limit(20) 110 + Where("deleted_at isnull")
83 if companyId, ok := queryOptions["companyId"]; ok { 111 if companyId, ok := queryOptions["companyId"]; ok {
84 query.Where("company_id = ?", companyId) 112 query.Where("company_id = ?", companyId)
85 } 113 }
@@ -78,10 +78,40 @@ func (c *StaffAssessController) CreateStaffAssessTask() { @@ -78,10 +78,40 @@ func (c *StaffAssessController) CreateStaffAssessTask() {
78 c.Response(data, err) 78 c.Response(data, err)
79 } 79 }
80 80
81 -//获取员工自评详情 81 +// 获取员工自评详情
  82 +func (c *StaffAssessController) GetAssessSelfInfo() {
  83 + srv := service.NewStaffAssessServeice()
  84 + paramReq := &query.AssessInfoQuery{}
  85 + err := c.BindJSON(paramReq)
  86 + if err != nil {
  87 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  88 + c.Response(nil, e)
  89 + return
  90 + }
  91 + //TODO 获取当前用户信息
  92 + paramReq.CompanyId = 1
  93 + paramReq.TargetUserId = 1
  94 + data, err := srv.GetAssessSelfInfo(paramReq)
  95 + c.Response(data, err)
  96 +}
82 97
83 //保存员工自评填写内容 98 //保存员工自评填写内容
84 99
85 -//获取员工邀请的人 100 +// 获取员工邀请的人
  101 +func (c *StaffAssessController) GetAssessInviteUser() {
  102 + srv := service.NewStaffAssessServeice()
  103 + paramReq := &query.GetAssessInviteUserQuery{}
  104 + err := c.BindJSON(paramReq)
  105 + if err != nil {
  106 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  107 + c.Response(nil, e)
  108 + return
  109 + }
  110 + //TODO 获取当前用户信息
  111 + paramReq.CompanyId = 1
  112 + paramReq.UserId = 1
  113 + data, err := srv.GetAssessInviteUser(paramReq)
  114 + c.Response(data, err)
  115 +}
86 116
87 //保持员工邀请的人 117 //保持员工邀请的人
@@ -15,8 +15,9 @@ func init() { @@ -15,8 +15,9 @@ func init() {
15 // /v1/staff-assess/self/me/list 15 // /v1/staff-assess/self/me/list
16 assessNS := web.NewNamespace("/v1/staff-assess", 16 assessNS := web.NewNamespace("/v1/staff-assess",
17 // web.NSBefore(filters.AllowCors(), middlewares.CheckToken()), 17 // web.NSBefore(filters.AllowCors(), middlewares.CheckToken()),
18 - web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表  
19 - // web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).AssessSelfMeList), 18 + web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
  19 + web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfInfo), //获取我的自评反馈详情
  20 + web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessInviteUser),
20 ) 21 )
21 web.AddNamespace(assessTaskNS) 22 web.AddNamespace(assessTaskNS)
22 web.AddNamespace(assessNS) 23 web.AddNamespace(assessNS)