|
1
|
package service
|
1
|
package service
|
|
2
|
|
2
|
|
|
|
|
3
|
+import (
|
|
|
|
4
|
+ "github.com/linmadan/egglib-go/core/application"
|
|
|
|
5
|
+ "github.com/linmadan/egglib-go/utils/tool_funs"
|
|
|
|
6
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
|
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
|
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
|
|
|
|
9
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
|
10
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
|
|
|
|
11
|
+)
|
|
|
|
12
|
+
|
|
3
|
type SummaryEvaluationServeice struct {
|
13
|
type SummaryEvaluationServeice struct {
|
|
4
|
}
|
14
|
}
|
|
5
|
|
15
|
|
|
@@ -8,9 +18,218 @@ func NewStaffAssessServeice() *SummaryEvaluationServeice { |
|
@@ -8,9 +18,218 @@ func NewStaffAssessServeice() *SummaryEvaluationServeice { |
|
8
|
return newService
|
18
|
return newService
|
|
9
|
}
|
19
|
}
|
|
10
|
|
20
|
|
|
|
|
21
|
+// GetCycleList
|
|
11
|
// 获取周期列表
|
22
|
// 获取周期列表
|
|
12
|
-func (srv SummaryEvaluationServeice) GetCycleList() (map[string]interface{}, error) {
|
|
|
|
13
|
- return nil, nil
|
23
|
+func (srv *SummaryEvaluationServeice) GetCycleList(param *command.QueryCycleList) (map[string]interface{}, error) {
|
|
|
|
24
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
|
25
|
+ if err != nil {
|
|
|
|
26
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
27
|
+ }
|
|
|
|
28
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
|
29
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
30
|
+ }
|
|
|
|
31
|
+ defer func() {
|
|
|
|
32
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
|
33
|
+ }()
|
|
|
|
34
|
+ evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
|
|
|
|
35
|
+ "transactionContext": transactionContext,
|
|
|
|
36
|
+ })
|
|
|
|
37
|
+ limit := 300
|
|
|
|
38
|
+ offset := 0
|
|
|
|
39
|
+ if param.PageSize > 0 {
|
|
|
|
40
|
+ limit = param.PageSize
|
|
|
|
41
|
+ }
|
|
|
|
42
|
+ if param.PageNumber > 0 {
|
|
|
|
43
|
+ offset = (param.PageNumber - 1) * param.PageSize
|
|
|
|
44
|
+ }
|
|
|
|
45
|
+
|
|
|
|
46
|
+ cycleData, err := evaluationDao.GetPersonalCycleList(param.UserId, offset, limit)
|
|
|
|
47
|
+ if err != nil {
|
|
|
|
48
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取周期列表"+err.Error())
|
|
|
|
49
|
+ }
|
|
|
|
50
|
+
|
|
|
|
51
|
+ cnt, err := evaluationDao.CountPersonalCycleList(param.UserId)
|
|
|
|
52
|
+ if err != nil {
|
|
|
|
53
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
54
|
+ }
|
|
|
|
55
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
56
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
57
|
+ }
|
|
|
|
58
|
+ cycleList := []adapter.CycleList{}
|
|
|
|
59
|
+ for _, v := range cycleData {
|
|
|
|
60
|
+ m := adapter.CycleList{
|
|
|
|
61
|
+ CycleId: v.CycleId,
|
|
|
|
62
|
+ CycleName: v.CycleName,
|
|
|
|
63
|
+ ExecutorId: v.ExecutorId,
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+ cycleList = append(cycleList, m)
|
|
|
|
66
|
+ }
|
|
|
|
67
|
+ return tool_funs.SimpleWrapGridMap(int64(cnt), cycleList), nil
|
|
14
|
}
|
68
|
}
|
|
15
|
|
69
|
|
|
16
|
-// 获取自评信息 |
70
|
+// GetMenu
|
|
|
|
71
|
+// 根据周期获取菜单显示
|
|
|
|
72
|
+func (srv *SummaryEvaluationServeice) GetMenu(param *command.QueryMenu) (map[string]interface{}, error) {
|
|
|
|
73
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
|
74
|
+ if err != nil {
|
|
|
|
75
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
76
|
+ }
|
|
|
|
77
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
|
78
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
|
79
|
+ }
|
|
|
|
80
|
+ defer func() {
|
|
|
|
81
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
|
82
|
+ }()
|
|
|
|
83
|
+ evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
|
|
|
84
|
+ "transactionContext": transactionContext,
|
|
|
|
85
|
+ })
|
|
|
|
86
|
+
|
|
|
|
87
|
+ //查找我的绩效
|
|
|
|
88
|
+ _, selfEvaluation, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
|
89
|
+ "types": int(domain.EvaluationSelf),
|
|
|
|
90
|
+ "executorId": param.UserId,
|
|
|
|
91
|
+ "limit": 1,
|
|
|
|
92
|
+ })
|
|
|
|
93
|
+ if err != nil {
|
|
|
|
94
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+ //查找360评估,统计未完成的
|
|
|
|
97
|
+ cnt360, _, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
|
98
|
+ "types": int(domain.Evaluation360),
|
|
|
|
99
|
+ "executorId": param.UserId,
|
|
|
|
100
|
+ "limit": 1,
|
|
|
|
101
|
+ "status": string(domain.EvaluationUncompleted),
|
|
|
|
102
|
+ })
|
|
|
|
103
|
+ if err != nil {
|
|
|
|
104
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
105
|
+ }
|
|
|
|
106
|
+ //查询上级评估,统计未完成
|
|
|
|
107
|
+ cntSuper, _, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
|
108
|
+ "types": int(domain.EvaluationSelf),
|
|
|
|
109
|
+ "executorId": param.UserId,
|
|
|
|
110
|
+ "limit": 1,
|
|
|
|
111
|
+ "status": string(domain.EvaluationUncompleted),
|
|
|
|
112
|
+ })
|
|
|
|
113
|
+ if err != nil {
|
|
|
|
114
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ //查询人资评估,统计未完成
|
|
|
|
117
|
+ cntHrbp, _, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
|
118
|
+ "types": int(domain.EvaluationHrbp),
|
|
|
|
119
|
+ "executorId": param.UserId,
|
|
|
|
120
|
+ "limit": 1,
|
|
|
|
121
|
+ "status": string(domain.EvaluationUncompleted),
|
|
|
|
122
|
+ })
|
|
|
|
123
|
+
|
|
|
|
124
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
|
125
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
|
126
|
+ }
|
|
|
|
127
|
+
|
|
|
|
128
|
+ menuList := []adapter.MenuList{}
|
|
|
|
129
|
+
|
|
|
|
130
|
+ //模块-我的绩效
|
|
|
|
131
|
+ menu1 := adapter.MenuList{
|
|
|
|
132
|
+ CycleId: 0,
|
|
|
|
133
|
+ NodeName: "我的绩效",
|
|
|
|
134
|
+ StatusName: "",
|
|
|
|
135
|
+ Types: "",
|
|
|
|
136
|
+ Child: []adapter.MenuList{},
|
|
|
|
137
|
+ }
|
|
|
|
138
|
+ menu1_1 := adapter.MenuList{
|
|
|
|
139
|
+ CycleId: param.CycleId,
|
|
|
|
140
|
+ NodeName: "填写综合自评",
|
|
|
|
141
|
+ StatusName: "",
|
|
|
|
142
|
+ Types: "填写综合自评",
|
|
|
|
143
|
+ }
|
|
|
|
144
|
+ menu1_2 := adapter.MenuList{
|
|
|
|
145
|
+ CycleId: param.CycleId,
|
|
|
|
146
|
+ NodeName: "查看综合自评",
|
|
|
|
147
|
+ StatusName: "",
|
|
|
|
148
|
+ Types: "查看综合自评",
|
|
|
|
149
|
+ }
|
|
|
|
150
|
+ if len(selfEvaluation) > 0 {
|
|
|
|
151
|
+ if selfEvaluation[0].Status == domain.EvaluationCompleted {
|
|
|
|
152
|
+ menu1_1.StatusName = "已完成"
|
|
|
|
153
|
+ } else {
|
|
|
|
154
|
+ menu1_1.StatusName = "未完成"
|
|
|
|
155
|
+ }
|
|
|
|
156
|
+ if selfEvaluation[0].CheckResult == domain.EvaluationCheckCompleted {
|
|
|
|
157
|
+ menu1_2.StatusName = "已完成"
|
|
|
|
158
|
+ } else {
|
|
|
|
159
|
+ menu1_2.StatusName = "未完成"
|
|
|
|
160
|
+ }
|
|
|
|
161
|
+ }
|
|
|
|
162
|
+ menu1.Child = append(menu1.Child, menu1_1, menu1_2)
|
|
|
|
163
|
+ menuList = append(menuList, menu1)
|
|
|
|
164
|
+ menu2 := adapter.MenuList{
|
|
|
|
165
|
+ CycleId: 0,
|
|
|
|
166
|
+ NodeName: "给他人评估",
|
|
|
|
167
|
+ StatusName: "",
|
|
|
|
168
|
+ Types: "",
|
|
|
|
169
|
+ Child: []adapter.MenuList{},
|
|
|
|
170
|
+ }
|
|
|
|
171
|
+ menu2_1 := adapter.MenuList{
|
|
|
|
172
|
+ CycleId: param.CycleId,
|
|
|
|
173
|
+ NodeName: "360综评",
|
|
|
|
174
|
+ StatusName: "",
|
|
|
|
175
|
+ Types: "360综评",
|
|
|
|
176
|
+ }
|
|
|
|
177
|
+ if cnt360 > 0 {
|
|
|
|
178
|
+ menu2_1.StatusName = "未完成"
|
|
|
|
179
|
+ } else {
|
|
|
|
180
|
+ menu2_1.StatusName = "已完成"
|
|
|
|
181
|
+ }
|
|
|
|
182
|
+ menu2.Child = append(menu2.Child, menu2_1)
|
|
|
|
183
|
+ menuList = append(menuList, menu2)
|
|
|
|
184
|
+ menu3 := adapter.MenuList{
|
|
|
|
185
|
+ CycleId: 0,
|
|
|
|
186
|
+ NodeName: "人资评估",
|
|
|
|
187
|
+ StatusName: "",
|
|
|
|
188
|
+ Types: "",
|
|
|
|
189
|
+ Child: []adapter.MenuList{},
|
|
|
|
190
|
+ }
|
|
|
|
191
|
+ menu3_1 := adapter.MenuList{
|
|
|
|
192
|
+ CycleId: param.CycleId,
|
|
|
|
193
|
+ NodeName: "上级综评",
|
|
|
|
194
|
+ StatusName: "",
|
|
|
|
195
|
+ Types: "上级综评",
|
|
|
|
196
|
+ }
|
|
|
|
197
|
+ if cntHrbp > 0 {
|
|
|
|
198
|
+ menu3_1.StatusName = "未完成"
|
|
|
|
199
|
+ } else {
|
|
|
|
200
|
+ menu3_1.StatusName = "已完成"
|
|
|
|
201
|
+ }
|
|
|
|
202
|
+ menu3.Child = append(menu3.Child, menu3_1)
|
|
|
|
203
|
+
|
|
|
|
204
|
+ menuList = append(menuList, menu3)
|
|
|
|
205
|
+ menu4 := adapter.MenuList{
|
|
|
|
206
|
+ CycleId: 0,
|
|
|
|
207
|
+ NodeName: "我的团队绩效",
|
|
|
|
208
|
+ StatusName: "",
|
|
|
|
209
|
+ Types: "",
|
|
|
|
210
|
+ Child: []adapter.MenuList{},
|
|
|
|
211
|
+ }
|
|
|
|
212
|
+ menu4_1 := adapter.MenuList{
|
|
|
|
213
|
+ CycleId: param.CycleId,
|
|
|
|
214
|
+ NodeName: "上级综评",
|
|
|
|
215
|
+ StatusName: "",
|
|
|
|
216
|
+ Types: "上级综评",
|
|
|
|
217
|
+ }
|
|
|
|
218
|
+ if cntSuper > 0 {
|
|
|
|
219
|
+ menu4_1.StatusName = "未完成"
|
|
|
|
220
|
+ } else {
|
|
|
|
221
|
+ menu4_1.StatusName = "已完成"
|
|
|
|
222
|
+ }
|
|
|
|
223
|
+ menu4.Child = append(menu4.Child, menu4_1)
|
|
|
|
224
|
+ menuList = append(menuList, menu4)
|
|
|
|
225
|
+ result := map[string]interface{}{
|
|
|
|
226
|
+ "menus": menuList,
|
|
|
|
227
|
+ }
|
|
|
|
228
|
+ return result, nil
|
|
|
|
229
|
+}
|
|
|
|
230
|
+
|
|
|
|
231
|
+// 获取综合自评详情
|
|
|
|
232
|
+func (srv *SummaryEvaluationServeice) GetEvaluationSelf() {}
|
|
|
|
233
|
+
|
|
|
|
234
|
+// 编辑综合自评详情
|
|
|
|
235
|
+func (srv *SummaryEvaluationServeice) EditEvaluationSelf() {} |