|
|
|
1
|
+package controllers
|
|
|
|
2
|
+
|
|
|
|
3
|
+import (
|
|
|
|
4
|
+ "github.com/linmadan/egglib-go/core/application"
|
|
|
|
5
|
+ "github.com/linmadan/egglib-go/web/beego"
|
|
|
|
6
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
|
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/service"
|
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
|
|
|
|
9
|
+)
|
|
|
|
10
|
+
|
|
|
|
11
|
+type SummaryEvaluationController struct {
|
|
|
|
12
|
+ beego.BaseController
|
|
|
|
13
|
+}
|
|
|
|
14
|
+
|
|
|
|
15
|
+func (c *SummaryEvaluationController) GetCycleList() {
|
|
|
|
16
|
+ srv := service.NewSummaryEvaluationServeice()
|
|
|
|
17
|
+ paramReq := &command.QueryCycleList{}
|
|
|
|
18
|
+ err := c.BindJSON(paramReq)
|
|
|
|
19
|
+ if err != nil {
|
|
|
|
20
|
+ e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
|
21
|
+ c.Response(nil, e)
|
|
|
|
22
|
+ return
|
|
|
|
23
|
+ }
|
|
|
|
24
|
+ userReq := middlewares.GetUser(c.Ctx)
|
|
|
|
25
|
+
|
|
|
|
26
|
+ paramReq.UserId = int(userReq.UserId)
|
|
|
|
27
|
+ data, err := srv.GetCycleList(paramReq)
|
|
|
|
28
|
+ c.Response(data, err)
|
|
|
|
29
|
+}
|
|
|
|
30
|
+
|
|
|
|
31
|
+func (c *SummaryEvaluationController) GetMenu() {
|
|
|
|
32
|
+ srv := service.NewSummaryEvaluationServeice()
|
|
|
|
33
|
+ paramReq := &command.QueryMenu{}
|
|
|
|
34
|
+ err := c.BindJSON(paramReq)
|
|
|
|
35
|
+ if err != nil {
|
|
|
|
36
|
+ e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
|
37
|
+ c.Response(nil, e)
|
|
|
|
38
|
+ return
|
|
|
|
39
|
+ }
|
|
|
|
40
|
+ userReq := middlewares.GetUser(c.Ctx)
|
|
|
|
41
|
+ paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
|
42
|
+ paramReq.UserId = int(userReq.UserId)
|
|
|
|
43
|
+ data, err := srv.GetMenu(paramReq)
|
|
|
|
44
|
+ c.Response(data, err)
|
|
|
|
45
|
+
|
|
|
|
46
|
+}
|
|
|
|
47
|
+
|
|
|
|
48
|
+func (c *SummaryEvaluationController) GetEvaluationSelf() {
|
|
|
|
49
|
+ srv := service.NewSummaryEvaluationServeice()
|
|
|
|
50
|
+ paramReq := &command.QueryEvaluationInfo{}
|
|
|
|
51
|
+ err := c.BindJSON(paramReq)
|
|
|
|
52
|
+ if err != nil {
|
|
|
|
53
|
+ e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
|
54
|
+ c.Response(nil, e)
|
|
|
|
55
|
+ return
|
|
|
|
56
|
+ }
|
|
|
|
57
|
+ userReq := middlewares.GetUser(c.Ctx)
|
|
|
|
58
|
+ paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
|
59
|
+ paramReq.ExecutorId = int(userReq.UserId)
|
|
|
|
60
|
+ data, err := srv.GetEvaluationSelf(paramReq)
|
|
|
|
61
|
+ c.Response(data, err)
|
|
|
|
62
|
+
|
|
|
|
63
|
+}
|
|
|
|
64
|
+
|
|
|
|
65
|
+func (c *SummaryEvaluationController) EditEvaluationSelf() {
|
|
|
|
66
|
+ srv := service.NewSummaryEvaluationServeice()
|
|
|
|
67
|
+ paramReq := &command.EditEvaluationValue{}
|
|
|
|
68
|
+ err := c.BindJSON(paramReq)
|
|
|
|
69
|
+ if err != nil {
|
|
|
|
70
|
+ e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
|
71
|
+ c.Response(nil, e)
|
|
|
|
72
|
+ return
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ userReq := middlewares.GetUser(c.Ctx)
|
|
|
|
75
|
+ paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
|
76
|
+ paramReq.ExecutorId = int(userReq.UserId)
|
|
|
|
77
|
+ data, err := srv.EditEvaluationSelf(paramReq)
|
|
|
|
78
|
+ c.Response(data, err)
|
|
|
|
79
|
+
|
|
|
|
80
|
+} |