正在显示
7 个修改的文件
包含
152 行增加
和
43 行删除
@@ -3,32 +3,32 @@ package adapter | @@ -3,32 +3,32 @@ package adapter | ||
3 | import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 3 | import "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
4 | 4 | ||
5 | type EvaluationInfoAdapter struct { | 5 | type EvaluationInfoAdapter struct { |
6 | - SummaryEvaluationId int `json:"summaryEvaluationId"` // | ||
7 | - CycleId int `json:"cycleId,string"` //周期id | ||
8 | - CycleName string `json:"cycleName"` //周期名称 | ||
9 | - EvaluationProjectId int `json:"evaluationProjectId"` //项目id | ||
10 | - EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | ||
11 | - LinkNodeId int `json:"linkNodeId,string"` //评估环节id | ||
12 | - LinkNodeName string `json:"linkNodeName"` //评估环节名称 | ||
13 | - BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | ||
14 | - EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | ||
15 | - Status string `json:"status"` //完成状态 | ||
16 | - // Content | 6 | + SummaryEvaluationId int `json:"summaryEvaluationId"` // |
7 | + CycleId int `json:"cycleId,string"` //周期id | ||
8 | + CycleName string `json:"cycleName"` //周期名称 | ||
9 | + EvaluationProjectId int `json:"evaluationProjectId"` //项目id | ||
10 | + EvaluationProjectName string `json:"evaluationProjectName"` //项目名称 | ||
11 | + LinkNodeId int `json:"linkNodeId,string"` //评估环节id | ||
12 | + LinkNodeName string `json:"linkNodeName"` //评估环节名称 | ||
13 | + BeginTime string `json:"beginTime"` //开始时间 2006-01-02 15:04:05 | ||
14 | + EndTime string `json:"endTime"` //结束时间 2006-01-02 15:04:05 | ||
15 | + Status string `json:"status"` //完成状态 | ||
16 | + EvaluationItems []EvaluationItemAdapter `json:"assessContent"` | ||
17 | } | 17 | } |
18 | 18 | ||
19 | type EvaluationItemAdapter struct { | 19 | type EvaluationItemAdapter struct { |
20 | - SortBy int //排序 | ||
21 | - Category string //类别 | ||
22 | - Name string //名称 | ||
23 | - PromptTitle string //提示项标题 | ||
24 | - PromptText string //提示项正文 | ||
25 | - EntryItems []domain.EntryItem //填写的反馈 | ||
26 | - RuleType int //评估方式(0评级、1评分) | ||
27 | - Rule domain.EvaluationRule //评估的选项规则 | ||
28 | - Weight float64 //"权重" | ||
29 | - Required int // 必填项 | ||
30 | - Value string //评估填写的评分 | ||
31 | - Score string //评定得分 | ||
32 | - Types string //评估类型 | ||
33 | - Remark string //填写的内容反馈 | 20 | + EvaluationItemId int `json:"evaluationItemId,string"` //评估条目的id |
21 | + SortBy int `json:"sortBy"` //排序 | ||
22 | + Category string `json:"category"` //类别 | ||
23 | + Name string `json:"name"` //名称 | ||
24 | + PromptTitle string `json:"promptTitle"` //提示项标题 | ||
25 | + PromptText string `json:"promptText"` //提示项正文 | ||
26 | + EntryItems []domain.EntryItem `json:"entryItems"` //填写的反馈 | ||
27 | + RuleType int `json:"ruleType"` //评估方式(0评级、1评分) | ||
28 | + Rule domain.EvaluationRule `json:"rule"` //评估的选项规则 | ||
29 | + Weight float64 `json:"weight"` //"权重" | ||
30 | + Required int `json:"required"` // 必填项 | ||
31 | + Value string `json:"value"` //评估填写的评分 | ||
32 | + Score string `json:"score"` //评定得分 | ||
33 | + Remark string `json:"remark"` //填写的内容反馈 | ||
34 | } | 34 | } |
1 | package command | 1 | package command |
2 | 2 | ||
3 | type QueryEvaluationInfo struct { | 3 | type QueryEvaluationInfo struct { |
4 | - CycleId int `json:"cycleId,string"` | ||
5 | - CompanyId int `json:"-"` | 4 | + CycleId int `json:"cycleId,string"` //周期id |
5 | + ExecutorId int `json:"executorId,string"` //执行人id | ||
6 | + CompanyId int `json:"-"` //公司id | ||
6 | } | 7 | } |
@@ -239,8 +239,107 @@ func (srv *SummaryEvaluationServeice) GetMenu(param *command.QueryMenu) (map[str | @@ -239,8 +239,107 @@ func (srv *SummaryEvaluationServeice) GetMenu(param *command.QueryMenu) (map[str | ||
239 | return result, nil | 239 | return result, nil |
240 | } | 240 | } |
241 | 241 | ||
242 | +// buildSummaryItemValue 将填写值填充进评估项 | ||
243 | +func (srv *SummaryEvaluationServeice) buildSummaryItemValue(itemList []*domain.EvaluationItemUsed, valueList []*domain.SummaryEvaluationValue) ( | ||
244 | + itemValues []adapter.EvaluationItemAdapter) { | ||
245 | + itemValues = []adapter.EvaluationItemAdapter{} | ||
246 | + valueMap := map[int]*domain.SummaryEvaluationValue{} | ||
247 | + for _, v := range valueList { | ||
248 | + valueMap[v.EvaluationItemId] = v | ||
249 | + } | ||
250 | + for _, v := range itemList { | ||
251 | + item := adapter.EvaluationItemAdapter{ | ||
252 | + EvaluationItemId: v.Id, | ||
253 | + SortBy: v.SortBy, | ||
254 | + Category: v.Category, | ||
255 | + Name: v.Name, | ||
256 | + PromptTitle: v.PromptTitle, | ||
257 | + PromptText: v.PromptText, | ||
258 | + EntryItems: v.EntryItems, | ||
259 | + RuleType: v.RuleType, | ||
260 | + Rule: v.Rule, | ||
261 | + Weight: v.Weight, | ||
262 | + Required: v.Required, | ||
263 | + Value: "", | ||
264 | + Score: "", | ||
265 | + Remark: "", | ||
266 | + } | ||
267 | + value, ok := valueMap[v.Id] | ||
268 | + if !ok { | ||
269 | + continue | ||
270 | + } | ||
271 | + item.Score = value.Score | ||
272 | + item.Value = value.Value | ||
273 | + item.Remark = value.Remark | ||
274 | + itemValues = append(itemValues, item) | ||
275 | + } | ||
276 | + return itemValues | ||
277 | +} | ||
278 | + | ||
242 | // 获取综合自评详情 | 279 | // 获取综合自评详情 |
243 | -func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEvaluationInfo) {} | 280 | +func (srv *SummaryEvaluationServeice) GetEvaluationSelf(param *command.QueryEvaluationInfo) (*adapter.EvaluationInfoAdapter, error) { |
281 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
282 | + if err != nil { | ||
283 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
284 | + } | ||
285 | + if err := transactionContext.StartTransaction(); err != nil { | ||
286 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
287 | + } | ||
288 | + defer func() { | ||
289 | + _ = transactionContext.RollbackTransaction() | ||
290 | + }() | ||
291 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
292 | + "transactionContext": transactionContext, | ||
293 | + }) | ||
294 | + evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
295 | + "transactionContext": transactionContext, | ||
296 | + }) | ||
297 | + itemValueRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
298 | + "transactionContext": transactionContext, | ||
299 | + }) | ||
300 | + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
301 | + "limit": 1, | ||
302 | + "cycleId": param.CompanyId, | ||
303 | + "executorId": param.ExecutorId, | ||
304 | + "types": domain.EvaluationSelf, | ||
305 | + }) | ||
306 | + if err != nil { | ||
307 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
308 | + } | ||
309 | + if len(evaluationList) == 0 { | ||
310 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
311 | + } | ||
312 | + evaluationData := evaluationList[0] | ||
313 | + _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ | ||
314 | + "evaluationProjectId": evaluationData.EvaluationProjectId, | ||
315 | + "nodeType": int(domain.LinkNodeSelfAssessment), | ||
316 | + }) | ||
317 | + if err != nil { | ||
318 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
319 | + } | ||
320 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
321 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
322 | + } | ||
323 | + _ = itemList | ||
324 | + _ = itemValueRepo | ||
325 | + return nil, nil | ||
326 | +} | ||
244 | 327 | ||
245 | // 编辑综合自评详情 | 328 | // 编辑综合自评详情 |
246 | -func (srv *SummaryEvaluationServeice) EditEvaluationSelf() {} | 329 | +func (srv *SummaryEvaluationServeice) EditEvaluationSelf() (map[string][]adapter.EvaluationItemAdapter, error) { |
330 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
331 | + if err != nil { | ||
332 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
333 | + } | ||
334 | + if err := transactionContext.StartTransaction(); err != nil { | ||
335 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
336 | + } | ||
337 | + defer func() { | ||
338 | + _ = transactionContext.RollbackTransaction() | ||
339 | + }() | ||
340 | + | ||
341 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
342 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
343 | + } | ||
344 | + return nil, nil | ||
345 | +} |
@@ -31,10 +31,6 @@ const ( | @@ -31,10 +31,6 @@ const ( | ||
31 | Evaluation360 EvaluationType = 2 //360评估 | 31 | Evaluation360 EvaluationType = 2 //360评估 |
32 | EvaluationSuper EvaluationType = 3 //上级评估 | 32 | EvaluationSuper EvaluationType = 3 //上级评估 |
33 | EvaluationHrbp EvaluationType = 4 //人资评估 | 33 | EvaluationHrbp EvaluationType = 4 //人资评估 |
34 | - // EvaluationSelf EvaluationType = "self" | ||
35 | - // Evaluation360 EvaluationType = "360" | ||
36 | - // EvaluationSuper EvaluationType = "superior" | ||
37 | - // EvaluationHrbp EvaluationType = "hrbp" | ||
38 | ) | 34 | ) |
39 | 35 | ||
40 | // 评估的填写状态 | 36 | // 评估的填写状态 |
@@ -4,16 +4,16 @@ import "time" | @@ -4,16 +4,16 @@ import "time" | ||
4 | 4 | ||
5 | // 周期综合评估填写的内容 | 5 | // 周期综合评估填写的内容 |
6 | type SummaryEvaluationValue struct { | 6 | type SummaryEvaluationValue struct { |
7 | - Id int // | ||
8 | - EvaluationItemId int //评估条目的id | ||
9 | - SummaryEvaluationId int //综合评估任务(SummaryEvaluation)的id | ||
10 | - Value string //评估填写的评分 | ||
11 | - Score string //评定得分 | ||
12 | - Types EvaluationType //评估类型 | ||
13 | - Remark string //填写的内容反馈 | ||
14 | - CreatedAt time.Time //数据创建时间 | ||
15 | - UpdatedAt time.Time //数据更新时间 | ||
16 | - DeletedAt *time.Time //数据删除时间 | 7 | + Id int `json:"id"` // |
8 | + EvaluationItemId int `json:"evaluationItemId"` //评估条目的id | ||
9 | + SummaryEvaluationId int `json:"summaryEvaluationId"` //综合评估任务(SummaryEvaluation)的id | ||
10 | + Value string `json:"value"` //评估填写的评分 | ||
11 | + Score string `json:"score"` //评定得分 | ||
12 | + Types EvaluationType `json:"types"` //评估类型 | ||
13 | + Remark string `json:"remark"` //填写的内容反馈 | ||
14 | + CreatedAt time.Time `json:"createdAt"` //数据创建时间 | ||
15 | + UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 | ||
16 | + DeletedAt *time.Time `json:"deletedAt"` //数据删除时间 | ||
17 | } | 17 | } |
18 | 18 | ||
19 | type SummaryEvaluationValueRepository interface { | 19 | type SummaryEvaluationValueRepository interface { |
@@ -78,6 +78,15 @@ func (repo *EvaluationItemUsedRepository) Find(queryOptions map[string]interface | @@ -78,6 +78,15 @@ func (repo *EvaluationItemUsedRepository) Find(queryOptions map[string]interface | ||
78 | if v, ok := queryOptions["offset"].(int); ok { | 78 | if v, ok := queryOptions["offset"].(int); ok { |
79 | query.Offset(v) | 79 | query.Offset(v) |
80 | } | 80 | } |
81 | + | ||
82 | + if v, ok := queryOptions["evaluationProjectId"]; ok { | ||
83 | + query.Where("evaluation_project_id=?", v) | ||
84 | + } | ||
85 | + | ||
86 | + if v, ok := queryOptions["nodeType"]; ok { | ||
87 | + query.Where(" node_type=?", v) | ||
88 | + } | ||
89 | + | ||
81 | count, err := query.SelectAndCount() | 90 | count, err := query.SelectAndCount() |
82 | if err != nil { | 91 | if err != nil { |
83 | return 0, nil, err | 92 | return 0, nil, err |
@@ -129,6 +129,10 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{ | @@ -129,6 +129,10 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{ | ||
129 | query.Where("types=?", v) | 129 | query.Where("types=?", v) |
130 | } | 130 | } |
131 | 131 | ||
132 | + if v, ok := queryOptions["cycleId"]; ok { | ||
133 | + query.Where("cycle_id=?", v) | ||
134 | + } | ||
135 | + | ||
132 | if v, ok := queryOptions["status"]; ok { | 136 | if v, ok := queryOptions["status"]; ok { |
133 | query.Where("status=?", v) | 137 | query.Where("status=?", v) |
134 | } | 138 | } |
-
请 注册 或 登录 后发表评论