作者 tangxvhui

添加路由

... ... @@ -16,7 +16,7 @@ import (
type SummaryEvaluationServeice struct {
}
func NewStaffAssessServeice() *SummaryEvaluationServeice {
func NewSummaryEvaluationServeice() *SummaryEvaluationServeice {
newService := &SummaryEvaluationServeice{}
return newService
}
... ... @@ -411,7 +411,6 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEval
mValue.Id = v.Id
}
}
nowTime := time.Now()
for _, v := range param.EvaluationItems {
updatedData, ok := evaluationValueMap[v.EvaluationItemId]
... ... @@ -437,3 +436,5 @@ func (srv *SummaryEvaluationServeice) EditEvaluationSelf(param *command.EditEval
"EvaluationItems": itemValueAdapter,
}, nil
}
//
... ...
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) GetCycleList() {
srv := service.NewSummaryEvaluationServeice()
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.GetCycleList(paramReq)
c.Response(data, err)
}
func (c *SummaryEvaluationController) GetMenu() {
srv := service.NewSummaryEvaluationServeice()
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.NewSummaryEvaluationServeice()
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.NewSummaryEvaluationServeice()
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)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
func init() {
summaryNS := web.NewNamespace("/v1/summary-evaluation",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/cycle/list", (*controllers.SummaryEvaluationController).GetCycleList),
web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu),
web.NSCtrlPost("/self", (*controllers.SummaryEvaluationController).GetEvaluationSelf),
web.NSCtrlPost("/self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf),
)
web.AddNamespace(summaryNS)
}
... ...