作者 tangxvhui

剔除 过期的api

  1 +package adapter
  2 +
  3 +type AssessAnalysisResp struct {
  4 + GroupList []string //评估指标项列表
  5 + Uncomplete []string // 未完成填写评估的员工
  6 + Complete map[string]AssessComplete //已完成填写的评估内容
  7 + UserCount map[string]int //各项员工数量
  8 +}
  9 +
  10 +type AssessComplete struct {
  11 + GroupKey string //评估指标项
  12 + Items []string //评估指标所有的评级
  13 + UserItem map[string][]string //每个评级下的员工名称
  14 + PercentItem map[string]string ///每个评级下的员工占比
  15 + CountItem map[string]int //每个评级下的员工数量
  16 + TotalUser int //填写该指标的员工数量
  17 +}
@@ -13,7 +13,6 @@ import ( @@ -13,7 +13,6 @@ import (
13 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" 13 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
14 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" 14 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 15 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
16 - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"  
17 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log" 16 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/log"
18 ) 17 )
19 18
@@ -27,195 +26,195 @@ func NewStaffAssessServeice() *StaffAssessServeice { @@ -27,195 +26,195 @@ func NewStaffAssessServeice() *StaffAssessServeice {
27 } 26 }
28 27
29 // 获取我参与过的评估任务列表 28 // 获取我参与过的评估任务列表
30 -func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {  
31 - transactionContext, err := factory.CreateTransactionContext(nil)  
32 - if err != nil {  
33 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
34 - }  
35 - if err := transactionContext.StartTransaction(); err != nil {  
36 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
37 - }  
38 - defer func() {  
39 - _ = transactionContext.RollbackTransaction()  
40 - }()  
41 -  
42 - staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{  
43 - "transactionContext": transactionContext,  
44 - })  
45 -  
46 - var limit int = 200  
47 - var offset int = 0  
48 - if param.PageSize > 0 {  
49 - limit = param.PageSize  
50 - }  
51 - offset = (param.PageNumber - 1) * param.PageSize  
52 - assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset)  
53 - if err != nil {  
54 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())  
55 - }  
56 - cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId)  
57 - if err != nil {  
58 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())  
59 - }  
60 -  
61 - if err := transactionContext.CommitTransaction(); err != nil {  
62 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
63 - }  
64 - listData := make([]adapter.SearchAssessMeResp, 0, len(assessTaskList))  
65 - var temp adapter.SearchAssessMeResp  
66 - for _, v := range assessTaskList {  
67 - temp = adapter.SearchAssessMeResp{  
68 - AssessTaskId: v.Id,  
69 - BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),  
70 - EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
71 - CycleId: v.CycleId,  
72 - CycleName: v.CycleName,  
73 - EvaluationProjectId: v.EvaluationProjectId,  
74 - EvaluationProjectName: v.EvaluationProjectName,  
75 - }  
76 - listData = append(listData, temp)  
77 - }  
78 - return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil  
79 -} 29 +// func (srv StaffAssessServeice) SearchAssessTaskMe(param *query.SearchAssessMeQuery) (map[string]interface{}, error) {
  30 +// transactionContext, err := factory.CreateTransactionContext(nil)
  31 +// if err != nil {
  32 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  33 +// }
  34 +// if err := transactionContext.StartTransaction(); err != nil {
  35 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  36 +// }
  37 +// defer func() {
  38 +// _ = transactionContext.RollbackTransaction()
  39 +// }()
  40 +
  41 +// staffAssessTaskRepo := dao.NewStaffAssessDao(map[string]interface{}{
  42 +// "transactionContext": transactionContext,
  43 +// })
  44 +
  45 +// var limit int = 200
  46 +// var offset int = 0
  47 +// if param.PageSize > 0 {
  48 +// limit = param.PageSize
  49 +// }
  50 +// offset = (param.PageNumber - 1) * param.PageSize
  51 +// assessTaskList, err := staffAssessTaskRepo.SearchAssessTaskMe(param.UserId, param.CompanyId, limit, offset)
  52 +// if err != nil {
  53 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
  54 +// }
  55 +// cnt, err := staffAssessTaskRepo.CountAssessTaskMe(param.UserId, param.CompanyId)
  56 +// if err != nil {
  57 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "查询评估任务"+err.Error())
  58 +// }
  59 +
  60 +// if err := transactionContext.CommitTransaction(); err != nil {
  61 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  62 +// }
  63 +// listData := make([]adapter.SearchAssessMeResp, 0, len(assessTaskList))
  64 +// var temp adapter.SearchAssessMeResp
  65 +// for _, v := range assessTaskList {
  66 +// temp = adapter.SearchAssessMeResp{
  67 +// AssessTaskId: v.Id,
  68 +// BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),
  69 +// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
  70 +// CycleId: v.CycleId,
  71 +// CycleName: v.CycleName,
  72 +// EvaluationProjectId: v.EvaluationProjectId,
  73 +// EvaluationProjectName: v.EvaluationProjectName,
  74 +// }
  75 +// listData = append(listData, temp)
  76 +// }
  77 +// return tool_funs.SimpleWrapGridMap(int64(cnt), listData), nil
  78 +// }
80 79
81 // 获取项目评估进度描述 80 // 获取项目评估进度描述
82 -func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) (*adapter.AssessTaskDescResp, error) {  
83 - transactionContext, err := factory.CreateTransactionContext(nil)  
84 - if err != nil {  
85 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
86 - }  
87 - if err := transactionContext.StartTransaction(); err != nil {  
88 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
89 - }  
90 - defer func() {  
91 - _ = transactionContext.RollbackTransaction()  
92 - }()  
93 - // 获取评估任务  
94 - staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
95 - "transactionContext": transactionContext,  
96 - })  
97 - //获取个人参与的评估流程  
98 - staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
99 - "transactionContext": transactionContext,  
100 - })  
101 - assessTaskData, err := staffAssessTaskRepo.FindOne(map[string]interface{}{  
102 - "id": param.AssessTaskId,  
103 - })  
104 - if err != nil {  
105 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error())  
106 - }  
107 - //返回的数据结果  
108 - result := adapter.AssessTaskDescResp{  
109 - AssessTaskId: assessTaskData.Id,  
110 - EvaluationProjectId: assessTaskData.EvaluationProjectId,  
111 - EvaluationProjectName: assessTaskData.EvaluationProjectName,  
112 - CycleName: assessTaskData.CycleName,  
113 - BeginTime: assessTaskData.BeginTime.Local().Format("2006-01-02 15:04-05"),  
114 - EndTime: assessTaskData.EndTime.Local().Format("2006-01-02 15:04-05"),  
115 - StepList: []adapter.AssessTaskStep{},  
116 - }  
117 -  
118 - for _, v := range assessTaskData.StepList {  
119 - stepItem := adapter.AssessTaskStep{  
120 - SortBy: v.SortBy,  
121 - LinkNodeName: v.LinkNodeName,  
122 - LinkNodeId: v.LinkNodeId,  
123 - BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),  
124 - EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
125 - LinkNodeType: v.LinkNodeType,  
126 - Desc: fmt.Sprintf("截止日期:%s", v.EndTime.Local().Format("2006-01-02 15:04:05")),  
127 - Status: "",  
128 - }  
129 - switch v.LinkNodeType {  
130 - case domain.LinkNodeSelfAssessment:  
131 - //个人自评完成情况  
132 - _, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{  
133 - "staffAssessTaskId": assessTaskData.Id,  
134 - "executorId": param.UserId,  
135 - "typesList": []string{string(domain.AssessSelf)},  
136 - })  
137 - if err != nil {  
138 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
139 - }  
140 - if len(assessSelfData) > 0 {  
141 - stepItem.Status = string(assessSelfData[0].Status)  
142 - }  
143 - stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
144 - case domain.LinkNodeAllInvite:  
145 - //邀请别人评估自己  
146 - _, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{  
147 - "staffAssessTaskId": assessTaskData.Id,  
148 - "targetUserId": param.UserId,  
149 - "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
150 - "limit": 5,  
151 - })  
152 - if err != nil {  
153 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
154 - }  
155 - if len(assessInviteData) > 0 {  
156 - stepItem.Status = string(domain.StaffAssessCompleted)  
157 - } else {  
158 - stepItem.Status = string(domain.StaffAssessUncompleted)  
159 - }  
160 - //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可  
161 - if len(assessInviteData) > 5 {  
162 - stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
163 - } else {  
164 - stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))  
165 - }  
166 - case domain.LinkNodeAllAssessment:  
167 - //我评估别人,被邀请评估  
168 - _, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{  
169 - "staffAssessTaskId": assessTaskData.Id,  
170 - "executorId": param.UserId,  
171 - "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
172 - })  
173 - if err != nil {  
174 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
175 - }  
176 -  
177 - if len(assessInviteList) > 0 {  
178 - stepItem.Status = string(domain.StaffAssessCompleted)  
179 - stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
180 - for _, v := range assessInviteList {  
181 - if v.Status == domain.StaffAssessUncompleted {  
182 - stepItem.Status = string(domain.StaffAssessUncompleted)  
183 - break  
184 - }  
185 - }  
186 - }  
187 - case domain.LinkNodeSuperiorAssessment:  
188 - //我评估别人,上级评估  
189 - _, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{  
190 - "staffAssessTaskId": assessTaskData.Id,  
191 - "executorId": param.UserId,  
192 - "typesList": []string{string(domain.AssessSuper)},  
193 - })  
194 - if err != nil {  
195 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
196 - }  
197 - if len(assessSupperList) > 0 {  
198 - stepItem.Status = string(domain.StaffAssessCompleted)  
199 - stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)  
200 - uncompletedNum := 0  
201 - for _, v := range assessSupperList {  
202 - if v.Status == domain.StaffAssessUncompleted {  
203 - uncompletedNum += 1  
204 - }  
205 - }  
206 - if uncompletedNum > 0 {  
207 - stepItem.Status = string(domain.StaffAssessUncompleted)  
208 - stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)  
209 - }  
210 - }  
211 - }  
212 - result.StepList = append(result.StepList, stepItem)  
213 - }  
214 - if err := transactionContext.CommitTransaction(); err != nil {  
215 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
216 - }  
217 - return &result, nil  
218 -} 81 +// func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) (*adapter.AssessTaskDescResp, error) {
  82 +// transactionContext, err := factory.CreateTransactionContext(nil)
  83 +// if err != nil {
  84 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  85 +// }
  86 +// if err := transactionContext.StartTransaction(); err != nil {
  87 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  88 +// }
  89 +// defer func() {
  90 +// _ = transactionContext.RollbackTransaction()
  91 +// }()
  92 +// // 获取评估任务
  93 +// staffAssessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  94 +// "transactionContext": transactionContext,
  95 +// })
  96 +// //获取个人参与的评估流程
  97 +// staffAssessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
  98 +// "transactionContext": transactionContext,
  99 +// })
  100 +// assessTaskData, err := staffAssessTaskRepo.FindOne(map[string]interface{}{
  101 +// "id": param.AssessTaskId,
  102 +// })
  103 +// if err != nil {
  104 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "评估任务不存在,"+err.Error())
  105 +// }
  106 +// //返回的数据结果
  107 +// result := adapter.AssessTaskDescResp{
  108 +// AssessTaskId: assessTaskData.Id,
  109 +// EvaluationProjectId: assessTaskData.EvaluationProjectId,
  110 +// EvaluationProjectName: assessTaskData.EvaluationProjectName,
  111 +// CycleName: assessTaskData.CycleName,
  112 +// BeginTime: assessTaskData.BeginTime.Local().Format("2006-01-02 15:04-05"),
  113 +// EndTime: assessTaskData.EndTime.Local().Format("2006-01-02 15:04-05"),
  114 +// StepList: []adapter.AssessTaskStep{},
  115 +// }
  116 +
  117 +// for _, v := range assessTaskData.StepList {
  118 +// stepItem := adapter.AssessTaskStep{
  119 +// SortBy: v.SortBy,
  120 +// LinkNodeName: v.LinkNodeName,
  121 +// LinkNodeId: v.LinkNodeId,
  122 +// BeginTime: v.BeginTime.Local().Format("2006-01-02 15:04:05"),
  123 +// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
  124 +// LinkNodeType: v.LinkNodeType,
  125 +// Desc: fmt.Sprintf("截止日期:%s", v.EndTime.Local().Format("2006-01-02 15:04:05")),
  126 +// Status: "",
  127 +// }
  128 +// switch v.LinkNodeType {
  129 +// case domain.LinkNodeSelfAssessment:
  130 +// //个人自评完成情况
  131 +// _, assessSelfData, err := staffAssessRepo.Find(map[string]interface{}{
  132 +// "staffAssessTaskId": assessTaskData.Id,
  133 +// "executorId": param.UserId,
  134 +// "typesList": []string{string(domain.AssessSelf)},
  135 +// })
  136 +// if err != nil {
  137 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  138 +// }
  139 +// if len(assessSelfData) > 0 {
  140 +// stepItem.Status = string(assessSelfData[0].Status)
  141 +// }
  142 +// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
  143 +// case domain.LinkNodeAllInvite:
  144 +// //邀请别人评估自己
  145 +// _, assessInviteData, err := staffAssessRepo.Find(map[string]interface{}{
  146 +// "staffAssessTaskId": assessTaskData.Id,
  147 +// "targetUserId": param.UserId,
  148 +// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  149 +// "limit": 5,
  150 +// })
  151 +// if err != nil {
  152 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  153 +// }
  154 +// if len(assessInviteData) > 0 {
  155 +// stepItem.Status = string(domain.StaffAssessCompleted)
  156 +// } else {
  157 +// stepItem.Status = string(domain.StaffAssessUncompleted)
  158 +// }
  159 +// //待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
  160 +// if len(assessInviteData) > 5 {
  161 +// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
  162 +// } else {
  163 +// stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
  164 +// }
  165 +// case domain.LinkNodeAllAssessment:
  166 +// //我评估别人,被邀请评估
  167 +// _, assessInviteList, err := staffAssessRepo.Find(map[string]interface{}{
  168 +// "staffAssessTaskId": assessTaskData.Id,
  169 +// "executorId": param.UserId,
  170 +// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  171 +// })
  172 +// if err != nil {
  173 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  174 +// }
  175 +
  176 +// if len(assessInviteList) > 0 {
  177 +// stepItem.Status = string(domain.StaffAssessCompleted)
  178 +// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
  179 +// for _, v := range assessInviteList {
  180 +// if v.Status == domain.StaffAssessUncompleted {
  181 +// stepItem.Status = string(domain.StaffAssessUncompleted)
  182 +// break
  183 +// }
  184 +// }
  185 +// }
  186 +// case domain.LinkNodeSuperiorAssessment:
  187 +// //我评估别人,上级评估
  188 +// _, assessSupperList, err := staffAssessRepo.Find(map[string]interface{}{
  189 +// "staffAssessTaskId": assessTaskData.Id,
  190 +// "executorId": param.UserId,
  191 +// "typesList": []string{string(domain.AssessSuper)},
  192 +// })
  193 +// if err != nil {
  194 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  195 +// }
  196 +// if len(assessSupperList) > 0 {
  197 +// stepItem.Status = string(domain.StaffAssessCompleted)
  198 +// stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
  199 +// uncompletedNum := 0
  200 +// for _, v := range assessSupperList {
  201 +// if v.Status == domain.StaffAssessUncompleted {
  202 +// uncompletedNum += 1
  203 +// }
  204 +// }
  205 +// if uncompletedNum > 0 {
  206 +// stepItem.Status = string(domain.StaffAssessUncompleted)
  207 +// stepItem.Desc = fmt.Sprintf("截止日期:%s 待评估%d人", stepItem.EndTime, uncompletedNum)
  208 +// }
  209 +// }
  210 +// }
  211 +// result.StepList = append(result.StepList, stepItem)
  212 +// }
  213 +// if err := transactionContext.CommitTransaction(); err != nil {
  214 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  215 +// }
  216 +// return &result, nil
  217 +// }
219 218
220 // 获取个人的自评反馈历史记录列表 219 // 获取个人的自评反馈历史记录列表
221 func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) (map[string]interface{}, error) { 220 func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) (map[string]interface{}, error) {
@@ -601,68 +600,68 @@ func (srv StaffAssessServeice) createStaffAssessSupper( @@ -601,68 +600,68 @@ func (srv StaffAssessServeice) createStaffAssessSupper(
601 } 600 }
602 601
603 // 获取某个员工360评估邀请的人员 602 // 获取某个员工360评估邀请的人员
604 -func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {  
605 - transactionContext, err := factory.CreateTransactionContext(nil)  
606 - if err != nil {  
607 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
608 - }  
609 - if err := transactionContext.StartTransaction(); err != nil {  
610 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
611 - }  
612 - defer func() {  
613 - _ = transactionContext.RollbackTransaction()  
614 - }()  
615 -  
616 - assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{  
617 - "transactionContext": transactionContext,  
618 - })  
619 -  
620 - assessTaskReps := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
621 - "transactionContext": transactionContext,  
622 - })  
623 - assessTaskData, err := assessTaskReps.FindOne(map[string]interface{}{  
624 - "id": param.AssessTaskId,  
625 - })  
626 - if err != nil {  
627 - return nil, application.ThrowError(application.ARG_ERROR, "获取评估任务"+err.Error())  
628 - }  
629 - _, assessList, err := assessReps.Find(map[string]interface{}{  
630 - "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
631 - "staffAssessTaskId": param.AssessTaskId,  
632 - "targetUserId": param.UserId,  
633 - })  
634 - if err != nil {  
635 - return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())  
636 - }  
637 - if err := transactionContext.CommitTransaction(); err != nil {  
638 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
639 - }  
640 -  
641 - result := adapter.AssessInviteUserResp{  
642 - AssessTaskId: assessTaskData.Id,  
643 - InviteDiffSuper: []domain.StaffDesc{},  
644 - InviteSameSuper: []domain.StaffDesc{},  
645 - }  
646 - for _, v := range assessTaskData.StepList {  
647 - if v.LinkNodeType != domain.LinkNodeAllInvite {  
648 - continue  
649 - }  
650 - result.LinkNodeId = v.LinkNodeId  
651 - result.LinkNodeName = v.LinkNodeName  
652 - result.BeginTime = v.BeginTime.Local().Format("2006-01-02 15:04:05")  
653 - result.EndTime = v.EndTime.Local().Format("2006-01-02 15:04:05")  
654 - break  
655 - }  
656 - for _, v := range assessList {  
657 - if v.Types == domain.AssessInviteDiffSuper {  
658 - result.InviteDiffSuper = append(result.InviteDiffSuper, v.Executor)  
659 - }  
660 - if v.Types == domain.AssessInviteSameSuper {  
661 - result.InviteSameSuper = append(result.InviteSameSuper, v.Executor)  
662 - }  
663 - }  
664 - return &result, nil  
665 -} 603 +// func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteUserQuery) (*adapter.AssessInviteUserResp, error) {
  604 +// transactionContext, err := factory.CreateTransactionContext(nil)
  605 +// if err != nil {
  606 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  607 +// }
  608 +// if err := transactionContext.StartTransaction(); err != nil {
  609 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  610 +// }
  611 +// defer func() {
  612 +// _ = transactionContext.RollbackTransaction()
  613 +// }()
  614 +
  615 +// assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
  616 +// "transactionContext": transactionContext,
  617 +// })
  618 +
  619 +// assessTaskReps := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  620 +// "transactionContext": transactionContext,
  621 +// })
  622 +// assessTaskData, err := assessTaskReps.FindOne(map[string]interface{}{
  623 +// "id": param.AssessTaskId,
  624 +// })
  625 +// if err != nil {
  626 +// return nil, application.ThrowError(application.ARG_ERROR, "获取评估任务"+err.Error())
  627 +// }
  628 +// _, assessList, err := assessReps.Find(map[string]interface{}{
  629 +// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  630 +// "staffAssessTaskId": param.AssessTaskId,
  631 +// "targetUserId": param.UserId,
  632 +// })
  633 +// if err != nil {
  634 +// return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
  635 +// }
  636 +// if err := transactionContext.CommitTransaction(); err != nil {
  637 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  638 +// }
  639 +
  640 +// result := adapter.AssessInviteUserResp{
  641 +// AssessTaskId: assessTaskData.Id,
  642 +// InviteDiffSuper: []domain.StaffDesc{},
  643 +// InviteSameSuper: []domain.StaffDesc{},
  644 +// }
  645 +// for _, v := range assessTaskData.StepList {
  646 +// if v.LinkNodeType != domain.LinkNodeAllInvite {
  647 +// continue
  648 +// }
  649 +// result.LinkNodeId = v.LinkNodeId
  650 +// result.LinkNodeName = v.LinkNodeName
  651 +// result.BeginTime = v.BeginTime.Local().Format("2006-01-02 15:04:05")
  652 +// result.EndTime = v.EndTime.Local().Format("2006-01-02 15:04:05")
  653 +// break
  654 +// }
  655 +// for _, v := range assessList {
  656 +// if v.Types == domain.AssessInviteDiffSuper {
  657 +// result.InviteDiffSuper = append(result.InviteDiffSuper, v.Executor)
  658 +// }
  659 +// if v.Types == domain.AssessInviteSameSuper {
  660 +// result.InviteSameSuper = append(result.InviteSameSuper, v.Executor)
  661 +// }
  662 +// }
  663 +// return &result, nil
  664 +// }
666 665
667 // 保存某个员工360邀请的人员 666 // 保存某个员工360邀请的人员
668 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (map[string]interface{}, error) { 667 func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (map[string]interface{}, error) {
@@ -899,91 +898,91 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv @@ -899,91 +898,91 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv
899 } 898 }
900 899
901 // 获取员工自评的评估内容详情 900 // 获取员工自评的评估内容详情
902 -func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuery) (*adapter.AssessInfoResp, error) {  
903 - transactionContext, err := factory.CreateTransactionContext(nil)  
904 - if err != nil {  
905 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
906 - }  
907 - if err := transactionContext.StartTransaction(); err != nil {  
908 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
909 - }  
910 - defer func() {  
911 - _ = transactionContext.RollbackTransaction()  
912 - }()  
913 - assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{  
914 - "transactionContext": transactionContext,  
915 - })  
916 - //获取员工的评估  
917 - _, assessList, err := assessReps.Find(map[string]interface{}{  
918 - "companyId": param.CompanyId,  
919 - "staffAssessTaskId": param.AssessTaskId,  
920 - "targetUserId": param.TargetUserId,  
921 - "typesList": []string{string(domain.AssessSelf)},  
922 - })  
923 - if err != nil {  
924 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())  
925 - }  
926 - if len(assessList) == 0 {  
927 - return &adapter.AssessInfoResp{}, nil  
928 - }  
929 - assessData := assessList[0]  
930 -  
931 - assessContentList := []*domain.StaffAssessContent{}  
932 - if assessData.Status == domain.StaffAssessCompleted {  
933 - //已完成  
934 - assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{  
935 - "transactionContext": transactionContext,  
936 - })  
937 - _, assessContentList, err = assessContentRepo.Find(map[string]interface{}{  
938 - "staffAssessId": assessData.Id,  
939 - })  
940 - if err != nil {  
941 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())  
942 - }  
943 - } else if assessData.Status == domain.StaffAssessUncompleted {  
944 - //未完成  
945 - assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)  
946 - if err != nil {  
947 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())  
948 - }  
949 - }  
950 -  
951 - // 恢复缓存数据  
952 - if param.AcquireCache != 0 {  
953 - srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)  
954 - }  
955 -  
956 - //获取员工描述  
957 - staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))  
958 - if err := transactionContext.CommitTransaction(); err != nil {  
959 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
960 - }  
961 - result := adapter.AssessInfoResp{  
962 - AssessId: assessData.Id,  
963 - CycleId: assessData.CycleId,  
964 - CycleName: assessData.CycleName,  
965 - LinkNodeId: assessData.LinkNodeId,  
966 - LinkNodeName: assessData.LinkNodeName,  
967 - EvaluationProjectId: assessData.EvaluationProjectId,  
968 - EvaluationProjectName: assessData.EvaluationProjectName,  
969 - BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),  
970 - EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),  
971 - Status: string(assessData.Status),  
972 - TargetUserId: assessData.TargetUser.UserId,  
973 - TargetUserName: assessData.TargetUser.UserName,  
974 - CompanyId: assessData.CompanyId,  
975 - CompanyName: "",  
976 - SupperUser: "",  
977 - DutyTime: "",  
978 - AssessContent: assessContentList,  
979 - }  
980 - if staffDesc != nil {  
981 - result.CompanyName = staffDesc.CompanyName  
982 - result.SupperUser = staffDesc.SupperUserName  
983 - result.DutyTime = staffDesc.DutyTime  
984 - }  
985 - return &result, nil  
986 -} 901 +// func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessSelfInfoQuery) (*adapter.AssessInfoResp, error) {
  902 +// transactionContext, err := factory.CreateTransactionContext(nil)
  903 +// if err != nil {
  904 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  905 +// }
  906 +// if err := transactionContext.StartTransaction(); err != nil {
  907 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  908 +// }
  909 +// defer func() {
  910 +// _ = transactionContext.RollbackTransaction()
  911 +// }()
  912 +// assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
  913 +// "transactionContext": transactionContext,
  914 +// })
  915 +// //获取员工的评估
  916 +// _, assessList, err := assessReps.Find(map[string]interface{}{
  917 +// "companyId": param.CompanyId,
  918 +// "staffAssessTaskId": param.AssessTaskId,
  919 +// "targetUserId": param.TargetUserId,
  920 +// "typesList": []string{string(domain.AssessSelf)},
  921 +// })
  922 +// if err != nil {
  923 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
  924 +// }
  925 +// if len(assessList) == 0 {
  926 +// return &adapter.AssessInfoResp{}, nil
  927 +// }
  928 +// assessData := assessList[0]
  929 +
  930 +// assessContentList := []*domain.StaffAssessContent{}
  931 +// if assessData.Status == domain.StaffAssessCompleted {
  932 +// //已完成
  933 +// assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
  934 +// "transactionContext": transactionContext,
  935 +// })
  936 +// _, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
  937 +// "staffAssessId": assessData.Id,
  938 +// })
  939 +// if err != nil {
  940 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  941 +// }
  942 +// } else if assessData.Status == domain.StaffAssessUncompleted {
  943 +// //未完成
  944 +// assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)
  945 +// if err != nil {
  946 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
  947 +// }
  948 +// }
  949 +
  950 +// // 恢复缓存数据
  951 +// if param.AcquireCache != 0 {
  952 +// srv.recoverAssessCache(transactionContext, assessData.Id, assessContentList)
  953 +// }
  954 +
  955 +// //获取员工描述
  956 +// staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))
  957 +// if err := transactionContext.CommitTransaction(); err != nil {
  958 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  959 +// }
  960 +// result := adapter.AssessInfoResp{
  961 +// AssessId: assessData.Id,
  962 +// CycleId: assessData.CycleId,
  963 +// CycleName: assessData.CycleName,
  964 +// LinkNodeId: assessData.LinkNodeId,
  965 +// LinkNodeName: assessData.LinkNodeName,
  966 +// EvaluationProjectId: assessData.EvaluationProjectId,
  967 +// EvaluationProjectName: assessData.EvaluationProjectName,
  968 +// BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
  969 +// EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
  970 +// Status: string(assessData.Status),
  971 +// TargetUserId: assessData.TargetUser.UserId,
  972 +// TargetUserName: assessData.TargetUser.UserName,
  973 +// CompanyId: assessData.CompanyId,
  974 +// CompanyName: "",
  975 +// SupperUser: "",
  976 +// DutyTime: "",
  977 +// AssessContent: assessContentList,
  978 +// }
  979 +// if staffDesc != nil {
  980 +// result.CompanyName = staffDesc.CompanyName
  981 +// result.SupperUser = staffDesc.SupperUserName
  982 +// result.DutyTime = staffDesc.DutyTime
  983 +// }
  984 +// return &result, nil
  985 +// }
987 986
988 // 获取未完成的员工评估内容 987 // 获取未完成的员工评估内容
989 func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext, 988 func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext,
@@ -1169,322 +1168,322 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI @@ -1169,322 +1168,322 @@ func (srv StaffAssessServeice) SelectAssessInviteUser(param *query.SelectAssessI
1169 } 1168 }
1170 1169
1171 // 获取我要执行的的360评估,用户列表和评估填写的值 1170 // 获取我要执行的的360评估,用户列表和评估填写的值
1172 -func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteUserAssessQuery) (  
1173 - *adapter.ListInviteUserAssessResp, error) {  
1174 - transactionContext, err := factory.CreateTransactionContext(nil)  
1175 - if err != nil {  
1176 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1177 - }  
1178 - if err := transactionContext.StartTransaction(); err != nil {  
1179 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1180 - }  
1181 - defer func() {  
1182 - _ = transactionContext.RollbackTransaction()  
1183 - }()  
1184 - //获取对应的评估任务  
1185 - assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
1186 - "transactionContext": transactionContext,  
1187 - })  
1188 - assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
1189 - "transactionContext": transactionContext,  
1190 - })  
1191 -  
1192 - //获取 executorId 对应的360评估任务 用户  
1193 - condition := map[string]interface{}{  
1194 - "staffAssessTaskId": param.AssessTaskId,  
1195 - "executorId": param.ExecutorId,  
1196 - "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
1197 - "limit": 20,  
1198 - }  
1199 - if param.PageSize > 0 {  
1200 - condition["limit"] = param.PageSize  
1201 - }  
1202 - offset := (param.PageNumber - 1) * param.PageSize  
1203 - if offset > 0 {  
1204 - condition["offset"] = offset  
1205 - }  
1206 -  
1207 - cnt, assessList, err := assessRepo.Find(condition)  
1208 - if err != nil {  
1209 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1210 - }  
1211 - var assessContentList []*domain.StaffAssessContent  
1212 - if len(assessList) > 0 {  
1213 - //获取评估用的所有评估项  
1214 - assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessList[0])  
1215 - if err != nil {  
1216 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估任务"+err.Error())  
1217 - }  
1218 - }  
1219 - //可变的表格列  
1220 - changeableHeader := []adapter.ListTableHeader{}  
1221 - //列名与字段对应  
1222 - keyMap := map[string]string{}  
1223 - for i, v := range assessContentList {  
1224 - name := fmt.Sprintf("%s-%s", v.Category, v.Name)  
1225 - key := fmt.Sprintf("k%d", i)  
1226 - keyMap[name] = key  
1227 - changeableHeader = append(changeableHeader, adapter.ListTableHeader{  
1228 - Key: key,  
1229 - Name: name,  
1230 - })  
1231 - }  
1232 - assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{  
1233 - "transactionContext": transactionContext,  
1234 - })  
1235 - // 获取已经填报的内容  
1236 - changeableRows := map[int]map[string]string{}  
1237 - for _, v := range assessList {  
1238 - _, contentList, err := assessContentRepo.Find(map[string]interface{}{  
1239 - "staffAssessId": v.Id,  
1240 - })  
1241 - if err != nil {  
1242 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())  
1243 - }  
1244 - row := map[string]string{}  
1245 - for _, vv := range contentList {  
1246 - name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)  
1247 - if kk, ok := keyMap[name]; ok {  
1248 - row[kk] = vv.Value  
1249 - }  
1250 - }  
1251 - changeableRows[v.TargetUser.UserId] = row  
1252 - }  
1253 -  
1254 - //获取360邀请评估完成情况  
1255 - //我评估别人,被邀请评估  
1256 - cnnt, _, err := assessRepo.Find(map[string]interface{}{  
1257 - "staffAssessTaskId": param.AssessTaskId,  
1258 - "executorId": param.ExecutorId,  
1259 - "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},  
1260 - "status": domain.StaffAssessUncompleted,  
1261 - })  
1262 - if err != nil {  
1263 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
1264 - }  
1265 -  
1266 - assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{  
1267 - "id": param.AssessTaskId,  
1268 - })  
1269 - if err != nil {  
1270 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())  
1271 - }  
1272 - if err := transactionContext.CommitTransaction(); err != nil {  
1273 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1274 - }  
1275 -  
1276 - //评估填写数据行转列  
1277 - tableHeader := []adapter.ListTableHeader{  
1278 - {Key: "userName", Name: "姓名"},  
1279 - {Key: "status", Name: "状态"},  
1280 - {Key: "types", Name: "360°评估关系"},  
1281 - {Key: "endTime", Name: "360°评估截止日期"},  
1282 - }  
1283 - tableHeader = append(tableHeader, changeableHeader...)  
1284 - listData := []map[string]interface{}{}  
1285 - for _, v := range assessList {  
1286 - m := map[string]interface{}{  
1287 - "userName": v.TargetUser.UserName,  
1288 - "userId": strconv.Itoa(v.TargetUser.UserId),  
1289 - "status": string(v.Status),  
1290 - "types": string(v.Types),  
1291 - "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),  
1292 - "assessId": strconv.Itoa(v.Id),  
1293 - }  
1294 - switch v.Status {  
1295 - case domain.StaffAssessCompleted:  
1296 - m["status"] = "已经完成"  
1297 - case domain.StaffAssessUncompleted:  
1298 - m["status"] = "未完成"  
1299 - }  
1300 -  
1301 - switch v.Types {  
1302 - case domain.AssessInviteDiffSuper:  
1303 - m["types"] = "不同上级同事"  
1304 - case domain.AssessInviteSameSuper:  
1305 - m["types"] = "相同上级同事"  
1306 - }  
1307 - if row, ok := changeableRows[v.TargetUser.UserId]; ok {  
1308 - for k, v := range row {  
1309 - m[k] = v  
1310 - }  
1311 - } else {  
1312 - for _, v := range changeableHeader {  
1313 - m[v.Key] = ""  
1314 - }  
1315 - }  
1316 - listData = append(listData, m)  
1317 - }  
1318 - result := adapter.ListInviteUserAssessResp{  
1319 - TableHeader: tableHeader,  
1320 - List: listData,  
1321 - Total: cnt,  
1322 - }  
1323 - for _, v := range assessTaskData.StepList {  
1324 - if v.LinkNodeType == domain.LinkNodeAllAssessment {  
1325 - result.LinkNodeId = v.LinkNodeId  
1326 - result.LinkNodeName = v.LinkNodeName  
1327 - result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)  
1328 - }  
1329 - }  
1330 - return &result, nil  
1331 -} 1171 +// func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteUserAssessQuery) (
  1172 +// *adapter.ListInviteUserAssessResp, error) {
  1173 +// transactionContext, err := factory.CreateTransactionContext(nil)
  1174 +// if err != nil {
  1175 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1176 +// }
  1177 +// if err := transactionContext.StartTransaction(); err != nil {
  1178 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1179 +// }
  1180 +// defer func() {
  1181 +// _ = transactionContext.RollbackTransaction()
  1182 +// }()
  1183 +// //获取对应的评估任务
  1184 +// assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
  1185 +// "transactionContext": transactionContext,
  1186 +// })
  1187 +// assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  1188 +// "transactionContext": transactionContext,
  1189 +// })
  1190 +
  1191 +// //获取 executorId 对应的360评估任务 用户
  1192 +// condition := map[string]interface{}{
  1193 +// "staffAssessTaskId": param.AssessTaskId,
  1194 +// "executorId": param.ExecutorId,
  1195 +// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  1196 +// "limit": 20,
  1197 +// }
  1198 +// if param.PageSize > 0 {
  1199 +// condition["limit"] = param.PageSize
  1200 +// }
  1201 +// offset := (param.PageNumber - 1) * param.PageSize
  1202 +// if offset > 0 {
  1203 +// condition["offset"] = offset
  1204 +// }
  1205 +
  1206 +// cnt, assessList, err := assessRepo.Find(condition)
  1207 +// if err != nil {
  1208 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1209 +// }
  1210 +// var assessContentList []*domain.StaffAssessContent
  1211 +// if len(assessList) > 0 {
  1212 +// //获取评估用的所有评估项
  1213 +// assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessList[0])
  1214 +// if err != nil {
  1215 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估任务"+err.Error())
  1216 +// }
  1217 +// }
  1218 +// //可变的表格列
  1219 +// changeableHeader := []adapter.ListTableHeader{}
  1220 +// //列名与字段对应
  1221 +// keyMap := map[string]string{}
  1222 +// for i, v := range assessContentList {
  1223 +// name := fmt.Sprintf("%s-%s", v.Category, v.Name)
  1224 +// key := fmt.Sprintf("k%d", i)
  1225 +// keyMap[name] = key
  1226 +// changeableHeader = append(changeableHeader, adapter.ListTableHeader{
  1227 +// Key: key,
  1228 +// Name: name,
  1229 +// })
  1230 +// }
  1231 +// assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
  1232 +// "transactionContext": transactionContext,
  1233 +// })
  1234 +// // 获取已经填报的内容
  1235 +// changeableRows := map[int]map[string]string{}
  1236 +// for _, v := range assessList {
  1237 +// _, contentList, err := assessContentRepo.Find(map[string]interface{}{
  1238 +// "staffAssessId": v.Id,
  1239 +// })
  1240 +// if err != nil {
  1241 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())
  1242 +// }
  1243 +// row := map[string]string{}
  1244 +// for _, vv := range contentList {
  1245 +// name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)
  1246 +// if kk, ok := keyMap[name]; ok {
  1247 +// row[kk] = vv.Value
  1248 +// }
  1249 +// }
  1250 +// changeableRows[v.TargetUser.UserId] = row
  1251 +// }
  1252 +
  1253 +// //获取360邀请评估完成情况
  1254 +// //我评估别人,被邀请评估
  1255 +// cnnt, _, err := assessRepo.Find(map[string]interface{}{
  1256 +// "staffAssessTaskId": param.AssessTaskId,
  1257 +// "executorId": param.ExecutorId,
  1258 +// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
  1259 +// "status": domain.StaffAssessUncompleted,
  1260 +// })
  1261 +// if err != nil {
  1262 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  1263 +// }
  1264 +
  1265 +// assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
  1266 +// "id": param.AssessTaskId,
  1267 +// })
  1268 +// if err != nil {
  1269 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
  1270 +// }
  1271 +// if err := transactionContext.CommitTransaction(); err != nil {
  1272 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1273 +// }
  1274 +
  1275 +// //评估填写数据行转列
  1276 +// tableHeader := []adapter.ListTableHeader{
  1277 +// {Key: "userName", Name: "姓名"},
  1278 +// {Key: "status", Name: "状态"},
  1279 +// {Key: "types", Name: "360°评估关系"},
  1280 +// {Key: "endTime", Name: "360°评估截止日期"},
  1281 +// }
  1282 +// tableHeader = append(tableHeader, changeableHeader...)
  1283 +// listData := []map[string]interface{}{}
  1284 +// for _, v := range assessList {
  1285 +// m := map[string]interface{}{
  1286 +// "userName": v.TargetUser.UserName,
  1287 +// "userId": strconv.Itoa(v.TargetUser.UserId),
  1288 +// "status": string(v.Status),
  1289 +// "types": string(v.Types),
  1290 +// "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
  1291 +// "assessId": strconv.Itoa(v.Id),
  1292 +// }
  1293 +// switch v.Status {
  1294 +// case domain.StaffAssessCompleted:
  1295 +// m["status"] = "已经完成"
  1296 +// case domain.StaffAssessUncompleted:
  1297 +// m["status"] = "未完成"
  1298 +// }
  1299 +
  1300 +// switch v.Types {
  1301 +// case domain.AssessInviteDiffSuper:
  1302 +// m["types"] = "不同上级同事"
  1303 +// case domain.AssessInviteSameSuper:
  1304 +// m["types"] = "相同上级同事"
  1305 +// }
  1306 +// if row, ok := changeableRows[v.TargetUser.UserId]; ok {
  1307 +// for k, v := range row {
  1308 +// m[k] = v
  1309 +// }
  1310 +// } else {
  1311 +// for _, v := range changeableHeader {
  1312 +// m[v.Key] = ""
  1313 +// }
  1314 +// }
  1315 +// listData = append(listData, m)
  1316 +// }
  1317 +// result := adapter.ListInviteUserAssessResp{
  1318 +// TableHeader: tableHeader,
  1319 +// List: listData,
  1320 +// Total: cnt,
  1321 +// }
  1322 +// for _, v := range assessTaskData.StepList {
  1323 +// if v.LinkNodeType == domain.LinkNodeAllAssessment {
  1324 +// result.LinkNodeId = v.LinkNodeId
  1325 +// result.LinkNodeName = v.LinkNodeName
  1326 +// result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
  1327 +// }
  1328 +// }
  1329 +// return &result, nil
  1330 +// }
1332 1331
1333 // 获取我需要执行的上级评估成员列表 1332 // 获取我需要执行的上级评估成员列表
1334 -func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperAssessQuery) (map[string]interface{}, error) {  
1335 - transactionContext, err := factory.CreateTransactionContext(nil)  
1336 - if err != nil {  
1337 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1338 - }  
1339 - if err := transactionContext.StartTransaction(); err != nil {  
1340 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1341 - }  
1342 - defer func() {  
1343 - _ = transactionContext.RollbackTransaction()  
1344 - }()  
1345 - //获取对应的评估任务  
1346 - assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{  
1347 - "transactionContext": transactionContext,  
1348 - })  
1349 -  
1350 - limit := 20  
1351 - if param.PageSize > 0 {  
1352 - limit = param.PageSize  
1353 - }  
1354 - condition := map[string]interface{}{  
1355 - "staffAssessTaskId": param.AssessTaskId,  
1356 - "executorId": param.ExecutorId,  
1357 - "typesList": []string{string(domain.AssessSuper)},  
1358 - "limit": limit,  
1359 - "targetUserName": param.UserName,  
1360 - }  
1361 - offset := (param.PageNumber - 1) * param.PageSize  
1362 - if offset > 0 {  
1363 - condition["offset"] = offset  
1364 - }  
1365 - //获取 executorId 对应的上级评估列表  
1366 - cnt, assessList, err := assessRepo.Find(condition)  
1367 - if err != nil {  
1368 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1369 - }  
1370 -  
1371 - userIds := []int{}  
1372 - for _, v := range assessList {  
1373 - userIds = append(userIds, v.TargetUser.UserId)  
1374 - }  
1375 - //获取员工信息  
1376 - userRepo := factory.CreateUserRepository(map[string]interface{}{  
1377 - "transactionContext": transactionContext,  
1378 - })  
1379 - var targetUserList []*domain.User  
1380 - if len(userIds) > 0 {  
1381 - _, targetUserList, _ = userRepo.Find(map[string]interface{}{  
1382 - "ids": userIds,  
1383 - })  
1384 - }  
1385 - //获取职位信息  
1386 - positionRepo := factory.CreatePositionRepository(map[string]interface{}{  
1387 - "transactionContext": transactionContext,  
1388 - })  
1389 - //获取员工的职位  
1390 - userPositionMap := map[int64][]*domain.Position{}  
1391 - for _, v := range targetUserList {  
1392 - if len(v.PositionId) == 0 {  
1393 - continue  
1394 - }  
1395 - _, positionList, _ := positionRepo.Find(map[string]interface{}{  
1396 - "ids": v.PositionId,  
1397 - })  
1398 - userPositionMap[v.Id] = positionList  
1399 - }  
1400 -  
1401 - //获取员工邀请的人完成360评估的数量  
1402 - var inviteCompletedCount []dao.CountData  
1403 - if len(userIds) > 0 {  
1404 - d := dao.NewStaffAssessDao(map[string]interface{}{  
1405 - "transactionContext": transactionContext,  
1406 - })  
1407 - inviteCompletedCount, err = d.CountInviteAssessByTargetUser(userIds, param.AssessTaskId)  
1408 - if err != nil {  
1409 - log.Logger.Error("获取员工邀请的人完成情况" + err.Error())  
1410 - }  
1411 - }  
1412 - assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{  
1413 - "transactionContext": transactionContext,  
1414 - })  
1415 - assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{  
1416 - "id": param.AssessTaskId,  
1417 - })  
1418 - if err != nil {  
1419 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())  
1420 - }  
1421 - //我评估别人,被邀请评估  
1422 - cnnt, _, err := assessRepo.Find(map[string]interface{}{  
1423 - "staffAssessTaskId": param.AssessTaskId,  
1424 - "executorId": param.ExecutorId,  
1425 - "typesList": []string{string(domain.AssessSuper)},  
1426 - "status": string(domain.StaffAssessUncompleted),  
1427 - })  
1428 - if err != nil {  
1429 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())  
1430 - }  
1431 - if err := transactionContext.CommitTransaction(); err != nil {  
1432 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1433 - }  
1434 -  
1435 - resultList := []adapter.ListSupperAssessResp{}  
1436 - for _, v := range assessList {  
1437 - item := adapter.ListSupperAssessResp{  
1438 - AssessId: v.Id,  
1439 - UserId: v.TargetUser.UserId,  
1440 - UserName: v.TargetUser.UserName,  
1441 - EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),  
1442 - InviteCompleted: 0,  
1443 - Status: string(v.Status),  
1444 - InviteTotal: 5,  
1445 - Department: "",  
1446 - Position: "",  
1447 - DutyTime: "",  
1448 - }  
1449 - //填入部门  
1450 - for _, vv := range v.TargetDepartment {  
1451 - item.Department += vv.DepartmentName + " "  
1452 - }  
1453 - for _, vv := range targetUserList {  
1454 - if vv.Id != int64(v.TargetUser.UserId) {  
1455 - continue  
1456 - }  
1457 - //填入入职时间  
1458 - item.DutyTime = vv.CreatedAt.Local().Format("2006-01-02 15:04:05")  
1459 - //填入职位  
1460 - for _, vvv := range userPositionMap[vv.Id] {  
1461 - item.Position += vvv.Name + " "  
1462 - }  
1463 - break  
1464 - }  
1465 - //  
1466 - for _, vv := range inviteCompletedCount {  
1467 - if v.TargetUser.UserId == vv.TargetUserId {  
1468 - item.InviteCompleted = vv.InviteCompleted  
1469 - item.InviteTotal = vv.InviteTotal  
1470 - break  
1471 - }  
1472 - }  
1473 - resultList = append(resultList, item)  
1474 - }  
1475 - result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)  
1476 - result["linkNodeName"] = ""  
1477 - result["linkNodeId"] = ""  
1478 - result["lintNodeDesc"] = ""  
1479 - for _, v := range assessTaskData.StepList {  
1480 - if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {  
1481 - result["linkNodeName"] = v.LinkNodeName  
1482 - result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)  
1483 - result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)  
1484 - }  
1485 - }  
1486 - return result, nil  
1487 -} 1333 +// func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperAssessQuery) (map[string]interface{}, error) {
  1334 +// transactionContext, err := factory.CreateTransactionContext(nil)
  1335 +// if err != nil {
  1336 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1337 +// }
  1338 +// if err := transactionContext.StartTransaction(); err != nil {
  1339 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1340 +// }
  1341 +// defer func() {
  1342 +// _ = transactionContext.RollbackTransaction()
  1343 +// }()
  1344 +// //获取对应的评估任务
  1345 +// assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
  1346 +// "transactionContext": transactionContext,
  1347 +// })
  1348 +
  1349 +// limit := 20
  1350 +// if param.PageSize > 0 {
  1351 +// limit = param.PageSize
  1352 +// }
  1353 +// condition := map[string]interface{}{
  1354 +// "staffAssessTaskId": param.AssessTaskId,
  1355 +// "executorId": param.ExecutorId,
  1356 +// "typesList": []string{string(domain.AssessSuper)},
  1357 +// "limit": limit,
  1358 +// "targetUserName": param.UserName,
  1359 +// }
  1360 +// offset := (param.PageNumber - 1) * param.PageSize
  1361 +// if offset > 0 {
  1362 +// condition["offset"] = offset
  1363 +// }
  1364 +// //获取 executorId 对应的上级评估列表
  1365 +// cnt, assessList, err := assessRepo.Find(condition)
  1366 +// if err != nil {
  1367 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1368 +// }
  1369 +
  1370 +// userIds := []int{}
  1371 +// for _, v := range assessList {
  1372 +// userIds = append(userIds, v.TargetUser.UserId)
  1373 +// }
  1374 +// //获取员工信息
  1375 +// userRepo := factory.CreateUserRepository(map[string]interface{}{
  1376 +// "transactionContext": transactionContext,
  1377 +// })
  1378 +// var targetUserList []*domain.User
  1379 +// if len(userIds) > 0 {
  1380 +// _, targetUserList, _ = userRepo.Find(map[string]interface{}{
  1381 +// "ids": userIds,
  1382 +// })
  1383 +// }
  1384 +// //获取职位信息
  1385 +// positionRepo := factory.CreatePositionRepository(map[string]interface{}{
  1386 +// "transactionContext": transactionContext,
  1387 +// })
  1388 +// //获取员工的职位
  1389 +// userPositionMap := map[int64][]*domain.Position{}
  1390 +// for _, v := range targetUserList {
  1391 +// if len(v.PositionId) == 0 {
  1392 +// continue
  1393 +// }
  1394 +// _, positionList, _ := positionRepo.Find(map[string]interface{}{
  1395 +// "ids": v.PositionId,
  1396 +// })
  1397 +// userPositionMap[v.Id] = positionList
  1398 +// }
  1399 +
  1400 +// //获取员工邀请的人完成360评估的数量
  1401 +// var inviteCompletedCount []dao.CountData
  1402 +// if len(userIds) > 0 {
  1403 +// d := dao.NewStaffAssessDao(map[string]interface{}{
  1404 +// "transactionContext": transactionContext,
  1405 +// })
  1406 +// inviteCompletedCount, err = d.CountInviteAssessByTargetUser(userIds, param.AssessTaskId)
  1407 +// if err != nil {
  1408 +// log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
  1409 +// }
  1410 +// }
  1411 +// assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
  1412 +// "transactionContext": transactionContext,
  1413 +// })
  1414 +// assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
  1415 +// "id": param.AssessTaskId,
  1416 +// })
  1417 +// if err != nil {
  1418 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
  1419 +// }
  1420 +// //我评估别人,被邀请评估
  1421 +// cnnt, _, err := assessRepo.Find(map[string]interface{}{
  1422 +// "staffAssessTaskId": param.AssessTaskId,
  1423 +// "executorId": param.ExecutorId,
  1424 +// "typesList": []string{string(domain.AssessSuper)},
  1425 +// "status": string(domain.StaffAssessUncompleted),
  1426 +// })
  1427 +// if err != nil {
  1428 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
  1429 +// }
  1430 +// if err := transactionContext.CommitTransaction(); err != nil {
  1431 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1432 +// }
  1433 +
  1434 +// resultList := []adapter.ListSupperAssessResp{}
  1435 +// for _, v := range assessList {
  1436 +// item := adapter.ListSupperAssessResp{
  1437 +// AssessId: v.Id,
  1438 +// UserId: v.TargetUser.UserId,
  1439 +// UserName: v.TargetUser.UserName,
  1440 +// EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
  1441 +// InviteCompleted: 0,
  1442 +// Status: string(v.Status),
  1443 +// InviteTotal: 5,
  1444 +// Department: "",
  1445 +// Position: "",
  1446 +// DutyTime: "",
  1447 +// }
  1448 +// //填入部门
  1449 +// for _, vv := range v.TargetDepartment {
  1450 +// item.Department += vv.DepartmentName + " "
  1451 +// }
  1452 +// for _, vv := range targetUserList {
  1453 +// if vv.Id != int64(v.TargetUser.UserId) {
  1454 +// continue
  1455 +// }
  1456 +// //填入入职时间
  1457 +// item.DutyTime = vv.CreatedAt.Local().Format("2006-01-02 15:04:05")
  1458 +// //填入职位
  1459 +// for _, vvv := range userPositionMap[vv.Id] {
  1460 +// item.Position += vvv.Name + " "
  1461 +// }
  1462 +// break
  1463 +// }
  1464 +// //
  1465 +// for _, vv := range inviteCompletedCount {
  1466 +// if v.TargetUser.UserId == vv.TargetUserId {
  1467 +// item.InviteCompleted = vv.InviteCompleted
  1468 +// item.InviteTotal = vv.InviteTotal
  1469 +// break
  1470 +// }
  1471 +// }
  1472 +// resultList = append(resultList, item)
  1473 +// }
  1474 +// result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
  1475 +// result["linkNodeName"] = ""
  1476 +// result["linkNodeId"] = ""
  1477 +// result["lintNodeDesc"] = ""
  1478 +// for _, v := range assessTaskData.StepList {
  1479 +// if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
  1480 +// result["linkNodeName"] = v.LinkNodeName
  1481 +// result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)
  1482 +// result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
  1483 +// }
  1484 +// }
  1485 +// return result, nil
  1486 +// }
1488 1487
1489 // 根据staffAssessId 获取评估的填写信息 1488 // 根据staffAssessId 获取评估的填写信息
1490 func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) { 1489 func (srv StaffAssessServeice) GetAssessInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, error) {
@@ -1764,38 +1763,38 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1764,38 +1763,38 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1764 } 1763 }
1765 1764
1766 // 获取员工被评估的列表 1765 // 获取员工被评估的列表
1767 -func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserAssessQuery) (map[string]interface{}, error) {  
1768 - transactionContext, err := factory.CreateTransactionContext(nil)  
1769 - if err != nil {  
1770 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1771 - }  
1772 - if err := transactionContext.StartTransaction(); err != nil {  
1773 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
1774 - }  
1775 - defer func() {  
1776 - _ = transactionContext.RollbackTransaction()  
1777 - }()  
1778 - assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{  
1779 - "transactionContext": transactionContext,  
1780 - })  
1781 - //获取员工的评估  
1782 - cnt, assessList, err := assessReps.Find(map[string]interface{}{  
1783 - "staffAssessTaskId": param.AssessTaskId,  
1784 - "companyId": param.CompanyId,  
1785 - "targetUserId": param.TargetUserId,  
1786 - "typesList": param.Types,  
1787 - })  
1788 - if err != nil {  
1789 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())  
1790 - }  
1791 - if err := transactionContext.CommitTransaction(); err != nil {  
1792 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
1793 - }  
1794 -  
1795 - return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil  
1796 -}  
1797 -  
1798 -//获取员工的上级是谁 ,TODO 1766 +// func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserAssessQuery) (map[string]interface{}, error) {
  1767 +// transactionContext, err := factory.CreateTransactionContext(nil)
  1768 +// if err != nil {
  1769 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1770 +// }
  1771 +// if err := transactionContext.StartTransaction(); err != nil {
  1772 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  1773 +// }
  1774 +// defer func() {
  1775 +// _ = transactionContext.RollbackTransaction()
  1776 +// }()
  1777 +// assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
  1778 +// "transactionContext": transactionContext,
  1779 +// })
  1780 +// //获取员工的评估
  1781 +// cnt, assessList, err := assessReps.Find(map[string]interface{}{
  1782 +// "staffAssessTaskId": param.AssessTaskId,
  1783 +// "companyId": param.CompanyId,
  1784 +// "targetUserId": param.TargetUserId,
  1785 +// "typesList": param.Types,
  1786 +// })
  1787 +// if err != nil {
  1788 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
  1789 +// }
  1790 +// if err := transactionContext.CommitTransaction(); err != nil {
  1791 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1792 +// }
  1793 +
  1794 +// return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
  1795 +// }
  1796 +
  1797 +// 获取员工的上级是谁 ,TODO
1799 func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) { 1798 func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]*domain.User, error) {
1800 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{ 1799 departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
1801 "transactionContext": transactionContext, 1800 "transactionContext": transactionContext,
@@ -442,3 +442,138 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy @@ -442,3 +442,138 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy
442 } 442 }
443 return xlsxFile, nil 443 return xlsxFile, nil
444 } 444 }
  445 +
  446 +//员工绩效-项目管理-矩阵分析
  447 +
  448 +func (srv StaffAssessServeice) AnalysisData(param *query.ListAssessContentCycleDay) (*adapter.AssessAnalysisResp, error) {
  449 + transactionContext, err := factory.CreateTransactionContext(nil)
  450 + if err != nil {
  451 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  452 + }
  453 + if err := transactionContext.StartTransaction(); err != nil {
  454 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  455 + }
  456 + defer func() {
  457 + _ = transactionContext.RollbackTransaction()
  458 + }()
  459 +
  460 + roleRepo := factory.CreateRoleRepository(map[string]interface{}{
  461 + "transactionContext": transactionContext,
  462 + })
  463 + roleUserRepo := factory.CreateRoleUserRepository(map[string]interface{}{
  464 + "transactionContext": transactionContext,
  465 + })
  466 + _, roleList, err := roleRepo.Find(map[string]interface{}{
  467 + "type": domain.RoleTypeSystem,
  468 + "companyId": param.CompanyId,
  469 + })
  470 + if err != nil {
  471 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取角色信息列表"+err.Error())
  472 + }
  473 + _, userRoleList, err := roleUserRepo.Find(map[string]interface{}{
  474 + "companyId": param.CompanyId,
  475 + "userId": param.OperaterId,
  476 + })
  477 + if err != nil {
  478 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取用户的角色信息列表"+err.Error())
  479 + }
  480 + hrbp := -1
  481 + for _, v := range userRoleList {
  482 + for _, v2 := range roleList {
  483 + if v.RoleId == v2.Id {
  484 + hrbp = 1
  485 + break
  486 + }
  487 + }
  488 + if hrbp == 1 {
  489 + break
  490 + }
  491 + }
  492 + assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  493 + "transactionContext": transactionContext,
  494 + })
  495 + contentList, err := assessDao.SearchUserAssessContent(dao.SearchConditin1{
  496 + CompanyId: param.CompanyId,
  497 + CycleId: param.CycleId,
  498 + BeginDay: param.BeginDay,
  499 + TargetUserName: param.TargetUserName,
  500 + Limit: 9000,
  501 + Offset: 0,
  502 + OperaterId: param.OperaterId,
  503 + Hrbp: hrbp,
  504 + })
  505 + if err != nil {
  506 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取数据列表"+err.Error())
  507 + }
  508 + if err := transactionContext.CommitTransaction(); err != nil {
  509 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  510 + }
  511 + log.Logger.Debug(fmt.Sprintf("获取到的数据列表%d", len(contentList)))
  512 +
  513 + var groupList []string //评估指标项列表
  514 + var uncompleteItems []string //未完成填写评估的员工
  515 + completeUser := map[string]struct{}{} //完成填写评估的员工
  516 + completeItems := map[string]adapter.AssessComplete{} //已完成填写的评估内容
  517 +
  518 + for _, v := range contentList {
  519 + if v.ContentId == 0 {
  520 + uncompleteItems = append(uncompleteItems, v.TargetUserName)
  521 + continue
  522 + }
  523 + completeUser[v.TargetUserId] = struct{}{}
  524 + key := v.Category + "-" + v.ContentName
  525 +
  526 + if _, ok := completeItems[key]; !ok {
  527 + groupList = append(groupList, key)
  528 + //初始化数据结构
  529 + completeItems[key] = adapter.AssessComplete{
  530 + GroupKey: key,
  531 + Items: []string{},
  532 + UserItem: map[string][]string{},
  533 + PercentItem: map[string]string{},
  534 + CountItem: map[string]int{},
  535 + }
  536 + }
  537 + completeItem := completeItems[key]
  538 + if v.Rule.Type == domain.EvaluationTypeRating {
  539 + //提取出所有可选的评级
  540 + for _, v2 := range v.Rule.Rating.Levels {
  541 + if _, ok := completeItem.CountItem[v2.Code]; !ok {
  542 + completeItem.CountItem[v2.Code] = 0
  543 + completeItem.PercentItem[v2.Code] = ""
  544 + completeItem.UserItem[v2.Code] = []string{}
  545 + completeItem.Items = append(completeItem.Items, v2.Code)
  546 + }
  547 + }
  548 + }
  549 + if v.Rule.Type == domain.EvaluationTypeScore {
  550 + for _, v2 := range v.Rule.Score.Levels {
  551 + //提取出所有可选的评级
  552 + if _, ok := completeItem.CountItem[v2.Code]; !ok {
  553 + completeItem.CountItem[v2.Code] = 0
  554 + completeItem.PercentItem[v2.Code] = ""
  555 + completeItem.UserItem[v2.Code] = []string{}
  556 + completeItem.Items = append(completeItem.Items, v2.Code)
  557 + }
  558 + }
  559 + }
  560 + //根据填写的评级填充数据
  561 + completeItem.TotalUser = completeItem.TotalUser + 1
  562 + completeItem.CountItem[v.LevelValue] = completeItem.CountItem[v.LevelValue] + 1
  563 + percentSum := float64(completeItem.CountItem[v.LevelValue]) / float64(completeItem.TotalUser) * 100
  564 + completeItem.PercentItem[v.LevelValue] = fmt.Sprintf("%.2f %%", percentSum)
  565 + completeItem.UserItem[v.LevelValue] = append(completeItem.UserItem[v.LevelValue], v.TargetUserName)
  566 + completeItems[key] = completeItem
  567 + }
  568 + result := adapter.AssessAnalysisResp{
  569 + GroupList: groupList,
  570 + Uncomplete: uncompleteItems,
  571 + Complete: completeItems,
  572 + UserCount: map[string]int{
  573 + "total": len(uncompleteItems) + len(completeUser),
  574 + "uncomplete": len(uncompleteItems),
  575 + "complete": len(completeUser),
  576 + },
  577 + }
  578 + return &result, nil
  579 +}
@@ -55,55 +55,6 @@ type EvaluationRule struct { @@ -55,55 +55,6 @@ type EvaluationRule struct {
55 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` 55 DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
56 } 56 }
57 57
58 -// // 根据评估填写的值,得出等级名称和填写的值量化值  
59 -// // 如果 评估方式是评分,对评估填写的值的小数点后的位数进行处理,  
60 -// // value 根据评估填写的值  
61 -// func (rule *EvaluationRule) ScoreOrRating(value *string) (string, error) {  
62 -// switch rule.Type {  
63 -// case EvaluationTypeRating:  
64 -// return rule.RatingValue(value)  
65 -// case EvaluationTypeScore:  
66 -// return rule.ScoreValue(value)  
67 -// }  
68 -// return "", errors.New("rule.Type 错误")  
69 -// }  
70 -  
71 -// //根据评估填写的值,得出等级名称和填写的值量化值  
72 -// func (rule *EvaluationRule) ScoreValue(value *string) (string, error) {  
73 -// valueFloat, err := strconv.ParseFloat(*value, 64)  
74 -// if err != nil {  
75 -// return "", errors.New("评分填写的值错误")  
76 -// }  
77 -// if valueFloat < rule.Score.Min || valueFloat > rule.Score.Max {  
78 -// return "", fmt.Errorf("评分填写的值超出限制,>=%f且<=%f", rule.Score.Min, rule.Score.Max)  
79 -// }  
80 -// //保留小数处理  
81 -// fStr := fmt.Sprintf("%%.%df", rule.Score.DecimalPlaces)  
82 -// valueStr := fmt.Sprintf(fStr, valueFloat)  
83 -// *value = valueStr  
84 -// if rule.Score.IntervalState == 0 {  
85 -// // 未开启按分数子区间匹配等级  
86 -// return "", nil  
87 -// }  
88 -// valueDescrip := ""  
89 -// for _, v := range rule.Score.Levels {  
90 -// if valueFloat >= v.Start && valueFloat <= v.End {  
91 -// valueDescrip = v.Name  
92 -// }  
93 -// }  
94 -// return valueDescrip, nil  
95 -// }  
96 -  
97 -// //根据评估填写的值,得出等级名称,  
98 -// func (rule *EvaluationRule) RatingValue(value *string) (string, error) {  
99 -// for _, v := range rule.Rating.Levels {  
100 -// if v.Code == *value {  
101 -// return v.Name, nil  
102 -// }  
103 -// }  
104 -// return "", errors.New("评估填写的值错误")  
105 -// }  
106 -  
107 // GenerateSysRule 当前公司下的生成默认规则 58 // GenerateSysRule 当前公司下的生成默认规则
108 func GenerateSysRule(companyId int64) *EvaluationRule { 59 func GenerateSysRule(companyId int64) *EvaluationRule {
109 levels := make([]*RatingLevel, 0) 60 levels := make([]*RatingLevel, 0)
@@ -197,6 +197,8 @@ type UserAssessContent struct { @@ -197,6 +197,8 @@ type UserAssessContent struct {
197 BeginDay string `json:"beginDay"` //评估的日期 197 BeginDay string `json:"beginDay"` //评估的日期
198 EvaluationProjectId string `json:"evaluationProjectId"` //项目id 198 EvaluationProjectId string `json:"evaluationProjectId"` //项目id
199 Value string `json:"value"` //评估填写的值 199 Value string `json:"value"` //评估填写的值
  200 + LevelValue string `json:"levelValue"` //评级的值
  201 + Rule domain.EvaluationRule `json:"rule"` //规则
200 SortBy int `json:"sortBy"` //评估项顺序 202 SortBy int `json:"sortBy"` //评估项顺序
201 Category string `json:"category"` //评估项分类 203 Category string `json:"category"` //评估项分类
202 ContentName string `json:"contentName"` //评估项名称 204 ContentName string `json:"contentName"` //评估项名称
@@ -237,7 +239,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -237,7 +239,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
237 t_staff_assess_1.assess_id,staff_assess_content.id as content_id, 239 t_staff_assess_1.assess_id,staff_assess_content.id as content_id,
238 staff_assess_content.value ,staff_assess_content.sort_by ,t_staff_assess_1.cycle_id, 240 staff_assess_content.value ,staff_assess_content.sort_by ,t_staff_assess_1.cycle_id,
239 staff_assess_content.category ,staff_assess_content."name" as content_name , 241 staff_assess_content.category ,staff_assess_content."name" as content_name ,
240 - staff_assess_content.weight 242 + staff_assess_content.weight,staff_assess_content.level_value,staff_assess_content."rule"
241 from t_staff_assess_1 243 from t_staff_assess_1
242 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id 244 left join staff_assess_content on t_staff_assess_1.assess_id = staff_assess_content.staff_assess_id
243 where 1=1 245 where 1=1
@@ -250,7 +252,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA @@ -250,7 +252,7 @@ func (d *StaffAssessDao) SearchUserAssessContent(param SearchConditin1) ([]UserA
250 //加入排序 252 //加入排序
251 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by ` 253 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
252 //获取前置sql语句 254 //获取前置sql语句
253 - sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset) 255 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset, string(domain.AssessSelf))
254 sqlStr = sqlStr0 + sqlStr 256 sqlStr = sqlStr0 + sqlStr
255 tx := d.transactionContext.PgTx 257 tx := d.transactionContext.PgTx
256 result := []UserAssessContent{} 258 result := []UserAssessContent{}
@@ -277,7 +279,7 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { @@ -277,7 +279,7 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
277 condition = append(condition, "%"+param.TargetUserName+"%") 279 condition = append(condition, "%"+param.TargetUserName+"%")
278 } 280 }
279 //获取前置sql语句 281 //获取前置sql语句
280 - sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, 5000, 0) 282 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, 5000, 0, string(domain.AssessSelf))
281 sqlStr = sqlStr0 + sqlStr 283 sqlStr = sqlStr0 + sqlStr
282 tx := d.transactionContext.PgTx 284 tx := d.transactionContext.PgTx
283 var result int 285 var result int
@@ -293,7 +295,8 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) { @@ -293,7 +295,8 @@ func (d *StaffAssessDao) CountUserAssess(param SearchConditin1) (int, error) {
293 // hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否 295 // hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
294 // limit int, 分页条数 296 // limit int, 分页条数
295 // offset int 分页偏移 297 // offset int 分页偏移
296 -func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int) string { 298 +// assessType string 评估的类型
  299 +func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, beginDay string, hrbp int, limit int, offset int, assessType string) string {
297 sqlstr := ` 300 sqlstr := `
298 set time zone 'PRC'; 301 set time zone 'PRC';
299 with t_user_department as ( 302 with t_user_department as (
@@ -345,7 +348,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, @@ -345,7 +348,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
345 and staff_assess_task.deleted_at isnull 348 and staff_assess_task.deleted_at isnull
346 where staff_assess.cycle_id = %d 349 where staff_assess.cycle_id = %d
347 and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s' 350 and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s'
348 - and staff_assess."types" ='self' 351 + and staff_assess."types" ='%s'
349 ), 352 ),
350 -- 根据查看权限过滤合并数据 353 -- 根据查看权限过滤合并数据
351 t_staff_assess_1 as ( 354 t_staff_assess_1 as (
@@ -368,7 +371,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, @@ -368,7 +371,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int,
368 ) 371 )
369 ` 372 `
370 params := []interface{}{ 373 params := []interface{}{
371 - companyId, userId, cycleId, hrbp, cycleId, userId, cycleId, beginDay, limit, offset, 374 + companyId, userId, cycleId, hrbp, cycleId, userId, cycleId, beginDay, assessType, limit, offset,
372 } 375 }
373 376
374 sqlstr = fmt.Sprintf(sqlstr, params...) 377 sqlstr = fmt.Sprintf(sqlstr, params...)
@@ -421,7 +424,7 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa @@ -421,7 +424,7 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa
421 //加入排序 424 //加入排序
422 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by ` 425 sqlStr += ` order by convert_to(t_staff_assess_1.target_user_name,'GBK'),staff_assess_content.sort_by `
423 //获取前置sql语句 426 //获取前置sql语句
424 - sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset) 427 + sqlStr0 := d.useTStaffAssess(param.CompanyId, param.CycleId, param.OperaterId, param.BeginDay, param.Hrbp, param.Limit, param.Offset, string(domain.AssessSelf))
425 sqlStr = sqlStr0 + sqlStr 428 sqlStr = sqlStr0 + sqlStr
426 tx := d.transactionContext.PgTx 429 tx := d.transactionContext.PgTx
427 var result []ExportData1 430 var result []ExportData1
@@ -8,7 +8,6 @@ import ( @@ -8,7 +8,6 @@ import (
8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
9 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query" 9 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
10 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service" 10 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
11 - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"  
12 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" 11 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
13 ) 12 )
14 13
@@ -17,39 +16,39 @@ type StaffAssessController struct { @@ -17,39 +16,39 @@ type StaffAssessController struct {
17 } 16 }
18 17
19 // 获取我的绩效任务列表 18 // 获取我的绩效任务列表
20 -func (c *StaffAssessController) SearchAssessTaskMe() {  
21 - srv := service.NewStaffAssessServeice()  
22 - paramReq := &query.SearchAssessMeQuery{}  
23 - err := c.BindJSON(paramReq)  
24 - if err != nil {  
25 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
26 - c.Response(nil, e)  
27 - return  
28 - }  
29 - userReq := middlewares.GetUser(c.Ctx)  
30 - paramReq.CompanyId = int(userReq.CompanyId)  
31 - paramReq.UserId = int(userReq.UserId) 19 +// func (c *StaffAssessController) SearchAssessTaskMe() {
  20 +// srv := service.NewStaffAssessServeice()
  21 +// paramReq := &query.SearchAssessMeQuery{}
  22 +// err := c.BindJSON(paramReq)
  23 +// if err != nil {
  24 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  25 +// c.Response(nil, e)
  26 +// return
  27 +// }
  28 +// userReq := middlewares.GetUser(c.Ctx)
  29 +// paramReq.CompanyId = int(userReq.CompanyId)
  30 +// paramReq.UserId = int(userReq.UserId)
32 31
33 - data, err := srv.SearchAssessTaskMe(paramReq)  
34 - c.Response(data, err)  
35 -} 32 +// data, err := srv.SearchAssessTaskMe(paramReq)
  33 +// c.Response(data, err)
  34 +// }
36 35
37 // 获取我的绩效任务各环节完成情况 36 // 获取我的绩效任务各环节完成情况
38 -func (c *StaffAssessController) AssessTaskMeDesc() {  
39 - srv := service.NewStaffAssessServeice()  
40 - paramReq := &query.AssessTaskDescQuery{}  
41 - err := c.BindJSON(paramReq)  
42 - if err != nil {  
43 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
44 - c.Response(nil, e)  
45 - return  
46 - }  
47 - userReq := middlewares.GetUser(c.Ctx)  
48 - paramReq.CompanyId = int(userReq.CompanyId)  
49 - paramReq.UserId = int(userReq.UserId)  
50 - data, err := srv.AssessTaskDesc(paramReq)  
51 - c.Response(data, err)  
52 -} 37 +// func (c *StaffAssessController) AssessTaskMeDesc() {
  38 +// srv := service.NewStaffAssessServeice()
  39 +// paramReq := &query.AssessTaskDescQuery{}
  40 +// err := c.BindJSON(paramReq)
  41 +// if err != nil {
  42 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  43 +// c.Response(nil, e)
  44 +// return
  45 +// }
  46 +// userReq := middlewares.GetUser(c.Ctx)
  47 +// paramReq.CompanyId = int(userReq.CompanyId)
  48 +// paramReq.UserId = int(userReq.UserId)
  49 +// data, err := srv.AssessTaskDesc(paramReq)
  50 +// c.Response(data, err)
  51 +// }
53 52
54 // 获取个人的自评反馈历史记录列表 53 // 获取个人的自评反馈历史记录列表
55 func (c *StaffAssessController) AssessSelfMeList() { 54 func (c *StaffAssessController) AssessSelfMeList() {
@@ -84,38 +83,38 @@ func (c *StaffAssessController) CreateStaffAssessTask() { @@ -84,38 +83,38 @@ func (c *StaffAssessController) CreateStaffAssessTask() {
84 } 83 }
85 84
86 // 获取当前登录员工自评详情 85 // 获取当前登录员工自评详情
87 -func (c *StaffAssessController) GetAssessSelfMeInfo() {  
88 - srv := service.NewStaffAssessServeice()  
89 - paramReq := &query.AssessSelfInfoQuery{}  
90 - err := c.BindJSON(paramReq)  
91 - if err != nil {  
92 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
93 - c.Response(nil, e)  
94 - return  
95 - }  
96 - userReq := middlewares.GetUser(c.Ctx)  
97 - paramReq.CompanyId = int(userReq.CompanyId)  
98 - paramReq.TargetUserId = int(userReq.UserId)  
99 - data, err := srv.GetAssessSelfInfo(paramReq)  
100 - c.Response(data, err)  
101 -} 86 +// func (c *StaffAssessController) GetAssessSelfMeInfo() {
  87 +// srv := service.NewStaffAssessServeice()
  88 +// paramReq := &query.AssessSelfInfoQuery{}
  89 +// err := c.BindJSON(paramReq)
  90 +// if err != nil {
  91 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  92 +// c.Response(nil, e)
  93 +// return
  94 +// }
  95 +// userReq := middlewares.GetUser(c.Ctx)
  96 +// paramReq.CompanyId = int(userReq.CompanyId)
  97 +// paramReq.TargetUserId = int(userReq.UserId)
  98 +// data, err := srv.GetAssessSelfInfo(paramReq)
  99 +// c.Response(data, err)
  100 +// }
102 101
103 // 获取我邀请的人 102 // 获取我邀请的人
104 -func (c *StaffAssessController) GetAssessMeInviteUser() {  
105 - srv := service.NewStaffAssessServeice()  
106 - paramReq := &query.GetAssessInviteUserQuery{}  
107 - err := c.BindJSON(paramReq)  
108 - if err != nil {  
109 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
110 - c.Response(nil, e)  
111 - return  
112 - }  
113 - userReq := middlewares.GetUser(c.Ctx)  
114 - paramReq.CompanyId = int(userReq.CompanyId)  
115 - paramReq.UserId = int(userReq.UserId)  
116 - data, err := srv.GetAssessInviteUser(paramReq)  
117 - c.Response(data, err)  
118 -} 103 +// func (c *StaffAssessController) GetAssessMeInviteUser() {
  104 +// srv := service.NewStaffAssessServeice()
  105 +// paramReq := &query.GetAssessInviteUserQuery{}
  106 +// err := c.BindJSON(paramReq)
  107 +// if err != nil {
  108 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  109 +// c.Response(nil, e)
  110 +// return
  111 +// }
  112 +// userReq := middlewares.GetUser(c.Ctx)
  113 +// paramReq.CompanyId = int(userReq.CompanyId)
  114 +// paramReq.UserId = int(userReq.UserId)
  115 +// data, err := srv.GetAssessInviteUser(paramReq)
  116 +// c.Response(data, err)
  117 +// }
119 118
120 // 保存我邀请的员工 119 // 保存我邀请的员工
121 func (c *StaffAssessController) SaveAssessMeInviteUser() { 120 func (c *StaffAssessController) SaveAssessMeInviteUser() {
@@ -156,61 +155,61 @@ func (c *StaffAssessController) SelectAssessInviteUser() { @@ -156,61 +155,61 @@ func (c *StaffAssessController) SelectAssessInviteUser() {
156 } 155 }
157 156
158 // 获取我要执行360评估,用户列表和评估填写的值 157 // 获取我要执行360评估,用户列表和评估填写的值
159 -func (c *StaffAssessController) ListMeInviteUserAssess() {  
160 - srv := service.NewStaffAssessServeice()  
161 - paramReq := &query.ListInviteUserAssessQuery{}  
162 - err := c.BindJSON(paramReq)  
163 - if err != nil {  
164 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
165 - c.Response(nil, e)  
166 - return  
167 - }  
168 - //获取当前用户信息  
169 - // paramReq.CompanyId = 1  
170 - // paramReq.ExecutorId = 1  
171 - userReq := middlewares.GetUser(c.Ctx)  
172 - paramReq.CompanyId = int(userReq.CompanyId)  
173 - paramReq.ExecutorId = int(userReq.UserId)  
174 - data, err := srv.ListExecutorInviteAssess(paramReq)  
175 - c.Response(data, err)  
176 -} 158 +// func (c *StaffAssessController) ListMeInviteUserAssess() {
  159 +// srv := service.NewStaffAssessServeice()
  160 +// paramReq := &query.ListInviteUserAssessQuery{}
  161 +// err := c.BindJSON(paramReq)
  162 +// if err != nil {
  163 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  164 +// c.Response(nil, e)
  165 +// return
  166 +// }
  167 +// //获取当前用户信息
  168 +// // paramReq.CompanyId = 1
  169 +// // paramReq.ExecutorId = 1
  170 +// userReq := middlewares.GetUser(c.Ctx)
  171 +// paramReq.CompanyId = int(userReq.CompanyId)
  172 +// paramReq.ExecutorId = int(userReq.UserId)
  173 +// data, err := srv.ListExecutorInviteAssess(paramReq)
  174 +// c.Response(data, err)
  175 +// }
177 176
178 // 获取我要执行的上级评估成员列表 177 // 获取我要执行的上级评估成员列表
179 -func (c *StaffAssessController) ListMeSupperAssess() {  
180 - srv := service.NewStaffAssessServeice()  
181 - paramReq := &query.ListSupperAssessQuery{}  
182 - err := c.BindJSON(paramReq)  
183 - if err != nil {  
184 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
185 - c.Response(nil, e)  
186 - return  
187 - }  
188 - //TODO 获取当前用户信息  
189 - // paramReq.CompanyId = 1  
190 - // paramReq.ExecutorId = 1  
191 - userReq := middlewares.GetUser(c.Ctx)  
192 - paramReq.CompanyId = int(userReq.CompanyId)  
193 - paramReq.ExecutorId = int(userReq.UserId)  
194 - data, err := srv.ListExecutorSupperAssess(paramReq)  
195 - c.Response(data, err)  
196 -} 178 +// func (c *StaffAssessController) ListMeSupperAssess() {
  179 +// srv := service.NewStaffAssessServeice()
  180 +// paramReq := &query.ListSupperAssessQuery{}
  181 +// err := c.BindJSON(paramReq)
  182 +// if err != nil {
  183 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  184 +// c.Response(nil, e)
  185 +// return
  186 +// }
  187 +// //TODO 获取当前用户信息
  188 +// // paramReq.CompanyId = 1
  189 +// // paramReq.ExecutorId = 1
  190 +// userReq := middlewares.GetUser(c.Ctx)
  191 +// paramReq.CompanyId = int(userReq.CompanyId)
  192 +// paramReq.ExecutorId = int(userReq.UserId)
  193 +// data, err := srv.ListExecutorSupperAssess(paramReq)
  194 +// c.Response(data, err)
  195 +// }
197 196
198 // 获取员工自评详情 197 // 获取员工自评详情
199 -func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {  
200 - srv := service.NewStaffAssessServeice()  
201 - paramReq := &query.AssessSelfInfoQuery{}  
202 - err := c.BindJSON(paramReq)  
203 - if err != nil {  
204 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
205 - c.Response(nil, e)  
206 - return  
207 - }  
208 - // paramReq.CompanyId = 1  
209 - userReq := middlewares.GetUser(c.Ctx)  
210 - paramReq.CompanyId = int(userReq.CompanyId)  
211 - data, err := srv.GetAssessSelfInfo(paramReq)  
212 - c.Response(data, err)  
213 -} 198 +// func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
  199 +// srv := service.NewStaffAssessServeice()
  200 +// paramReq := &query.AssessSelfInfoQuery{}
  201 +// err := c.BindJSON(paramReq)
  202 +// if err != nil {
  203 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  204 +// c.Response(nil, e)
  205 +// return
  206 +// }
  207 +// // paramReq.CompanyId = 1
  208 +// userReq := middlewares.GetUser(c.Ctx)
  209 +// paramReq.CompanyId = int(userReq.CompanyId)
  210 +// data, err := srv.GetAssessSelfInfo(paramReq)
  211 +// c.Response(data, err)
  212 +// }
214 213
215 // 获取评估内容详情 214 // 获取评估内容详情
216 func (c *StaffAssessController) GetAssessInfo() { 215 func (c *StaffAssessController) GetAssessInfo() {
@@ -247,42 +246,42 @@ func (c *StaffAssessController) SaveAssessInfo() { @@ -247,42 +246,42 @@ func (c *StaffAssessController) SaveAssessInfo() {
247 } 246 }
248 247
249 // 被评估的员工的评估列表-360评估 248 // 被评估的员工的评估列表-360评估
250 -func (c *StaffAssessController) ListTargetUserInviteAssess() {  
251 - srv := service.NewStaffAssessServeice()  
252 - paramReq := &query.ListTargetUserAssessQuery{}  
253 - err := c.BindJSON(paramReq)  
254 - if err != nil {  
255 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
256 - c.Response(nil, e)  
257 - return  
258 - }  
259 - // paramReq.CompanyId = 1  
260 - userReq := middlewares.GetUser(c.Ctx)  
261 - paramReq.CompanyId = int(userReq.CompanyId)  
262 - paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}  
263 - data, err := srv.ListTargetUserAssess(paramReq)  
264 - c.Response(data, err)  
265 -} 249 +// func (c *StaffAssessController) ListTargetUserInviteAssess() {
  250 +// srv := service.NewStaffAssessServeice()
  251 +// paramReq := &query.ListTargetUserAssessQuery{}
  252 +// err := c.BindJSON(paramReq)
  253 +// if err != nil {
  254 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  255 +// c.Response(nil, e)
  256 +// return
  257 +// }
  258 +// // paramReq.CompanyId = 1
  259 +// userReq := middlewares.GetUser(c.Ctx)
  260 +// paramReq.CompanyId = int(userReq.CompanyId)
  261 +// paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
  262 +// data, err := srv.ListTargetUserAssess(paramReq)
  263 +// c.Response(data, err)
  264 +// }
266 265
267 -func (c *StaffAssessController) ListTargetUserMeSupperAssess() {  
268 - srv := service.NewStaffAssessServeice()  
269 - paramReq := &query.ListTargetUserAssessQuery{}  
270 - err := c.BindJSON(paramReq)  
271 - if err != nil {  
272 - e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
273 - c.Response(nil, e)  
274 - return  
275 - }  
276 - // paramReq.CompanyId = 1  
277 - userReq := middlewares.GetUser(c.Ctx)  
278 - paramReq.CompanyId = int(userReq.CompanyId)  
279 - paramReq.Types = []string{string(domain.AssessSuper)}  
280 - paramReq.TargetUserId = int(userReq.UserId)  
281 - data, err := srv.ListTargetUserAssess(paramReq)  
282 - c.Response(data, err)  
283 -} 266 +// func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
  267 +// srv := service.NewStaffAssessServeice()
  268 +// paramReq := &query.ListTargetUserAssessQuery{}
  269 +// err := c.BindJSON(paramReq)
  270 +// if err != nil {
  271 +// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  272 +// c.Response(nil, e)
  273 +// return
  274 +// }
  275 +// // paramReq.CompanyId = 1
  276 +// userReq := middlewares.GetUser(c.Ctx)
  277 +// paramReq.CompanyId = int(userReq.CompanyId)
  278 +// paramReq.Types = []string{string(domain.AssessSuper)}
  279 +// paramReq.TargetUserId = int(userReq.UserId)
  280 +// data, err := srv.ListTargetUserAssess(paramReq)
  281 +// c.Response(data, err)
  282 +// }
284 283
285 -//获取周期列表 284 +// 获取周期列表
286 func (c *StaffAssessController) ListAssessCycle() { 285 func (c *StaffAssessController) ListAssessCycle() {
287 srv := service.NewStaffAssessServeice() 286 srv := service.NewStaffAssessServeice()
288 userReq := middlewares.GetUser(c.Ctx) 287 userReq := middlewares.GetUser(c.Ctx)
@@ -290,7 +289,7 @@ func (c *StaffAssessController) ListAssessCycle() { @@ -290,7 +289,7 @@ func (c *StaffAssessController) ListAssessCycle() {
290 c.Response(data, err) 289 c.Response(data, err)
291 } 290 }
292 291
293 -//获取周期里的考核日期 292 +// 获取周期里的考核日期
294 func (c *StaffAssessController) ListAssessCycleDay() { 293 func (c *StaffAssessController) ListAssessCycleDay() {
295 srv := service.NewStaffAssessServeice() 294 srv := service.NewStaffAssessServeice()
296 paramReq := &query.ListAssessCycleDay{} 295 paramReq := &query.ListAssessCycleDay{}
@@ -306,7 +305,7 @@ func (c *StaffAssessController) ListAssessCycleDay() { @@ -306,7 +305,7 @@ func (c *StaffAssessController) ListAssessCycleDay() {
306 c.Response(data, err) 305 c.Response(data, err)
307 } 306 }
308 307
309 -//根据周期里的考核日期,获取员工填写评估内容列表 308 +// 根据周期里的考核日期,获取员工填写评估内容列表
310 func (c *StaffAssessController) ListAssessContentCycleDay() { 309 func (c *StaffAssessController) ListAssessContentCycleDay() {
311 srv := service.NewStaffAssessServeice() 310 srv := service.NewStaffAssessServeice()
312 paramReq := &query.ListAssessContentCycleDay{} 311 paramReq := &query.ListAssessContentCycleDay{}
@@ -323,7 +322,7 @@ func (c *StaffAssessController) ListAssessContentCycleDay() { @@ -323,7 +322,7 @@ func (c *StaffAssessController) ListAssessContentCycleDay() {
323 c.Response(data, err) 322 c.Response(data, err)
324 } 323 }
325 324
326 -//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件 325 +// 根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件
327 func (c *StaffAssessController) ExportAssessContentCycleDay() { 326 func (c *StaffAssessController) ExportAssessContentCycleDay() {
328 srv := service.NewStaffAssessServeice() 327 srv := service.NewStaffAssessServeice()
329 paramReq := &query.ListAssessContentCycleDay{} 328 paramReq := &query.ListAssessContentCycleDay{}
@@ -10,8 +10,8 @@ import ( @@ -10,8 +10,8 @@ import (
10 func init() { 10 func init() {
11 assessTaskNS := web.NewNamespace("/v1/staff-assess-task", 11 assessTaskNS := web.NewNamespace("/v1/staff-assess-task",
12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
13 - web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表  
14 - web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述 13 + //web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
  14 + //web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
15 //web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务 15 //web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
16 web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表 16 web.NSCtrlGet("/cycle", (*controllers.StaffAssessController).ListAssessCycle), //获取周期列表
17 web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期 17 web.NSCtrlPost("/cycle/day", (*controllers.StaffAssessController).ListAssessCycleDay), //获取周期中的考核日期
@@ -22,18 +22,18 @@ func init() { @@ -22,18 +22,18 @@ func init() {
22 assessNS := web.NewNamespace("/v1/staff-assess", 22 assessNS := web.NewNamespace("/v1/staff-assess",
23 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 23 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
24 web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 24 web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表
25 - web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情  
26 - web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工 25 + //web.NSCtrlPost("/self/me/info", (*controllers.StaffAssessController).GetAssessSelfMeInfo), //获取我的自评反馈详情
  26 + // web.NSCtrlPost("/me/invite-user", (*controllers.StaffAssessController).GetAssessMeInviteUser), //获取邀请的员工
27 web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工 27 web.NSCtrlPost("/me/save-invite-user", (*controllers.StaffAssessController).SaveAssessMeInviteUser), //保存我邀请的员工
28 web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工 28 web.NSCtrlPost("/me/invite-user/select", (*controllers.StaffAssessController).SelectAssessInviteUser), //选择我邀请的员工
29 - web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表  
30 - web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表 29 + //web.NSCtrlPost("/me/execute/invite/list", (*controllers.StaffAssessController).ListMeInviteUserAssess), //我要执行的360评估的用户列表
  30 + //web.NSCtrlPost("/me/execute/supper/list", (*controllers.StaffAssessController).ListMeSupperAssess), //我要执行的360评估的用户列表
31 web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情 31 web.NSCtrlPost("/info", (*controllers.StaffAssessController).GetAssessInfo), //通用获取员工评估的详情
32 web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情 32 web.NSCtrlPut("/info", (*controllers.StaffAssessController).SaveAssessInfo), //通用保存员工评估的详情
33 web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存) 33 web.NSCtrlPut("/info-cache", (*controllers.StaffAssessController).SaveAssessCache), //通用保存员工评估的详情(缓存)
34 - web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表  
35 - web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我被上级评估的列表  
36 - web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情 34 + // web.NSCtrlPost("/target-user/invite/list", (*controllers.StaffAssessController).ListTargetUserInviteAssess), //获取被评估员工360评估的列表
  35 + //web.NSCtrlPost("/me/target-user/supper/list", (*controllers.StaffAssessController).ListTargetUserMeSupperAssess), //获取我被上级评估的列表
  36 + // web.NSCtrlPost("/target-user/self/info", (*controllers.StaffAssessController).GetAssessTargetUserSelfInfo), //获取被评估员工的自评反馈详情
37 ) 37 )
38 //v2 改版 38 //v2 改版
39 assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task", 39 assessTaskV2NS := web.NewNamespace("/v2/staff-assess-task",