|
@@ -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,
|