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