作者 Your Name

添加调试接口

  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
  7 +)
  8 +
  9 +func (srv StaffAssessServeice) InvokCreateStaffAssessTask(param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
  10 + transactionContext, err := factory.CreateTransactionContext(nil)
  11 + if err != nil {
  12 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  13 + }
  14 + if err := transactionContext.StartTransaction(); err != nil {
  15 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  16 + }
  17 + defer func() {
  18 + _ = transactionContext.RollbackTransaction()
  19 + }()
  20 +
  21 + data, err := srv.CreateStaffAssessTask(transactionContext, param)
  22 + if err != nil {
  23 + return nil, err
  24 + }
  25 + if err := transactionContext.CommitTransaction(); err != nil {
  26 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  27 + }
  28 + return data, nil
  29 +}
@@ -67,19 +67,19 @@ func (c *StaffAssessController) AssessSelfMeList() { @@ -67,19 +67,19 @@ func (c *StaffAssessController) AssessSelfMeList() {
67 } 67 }
68 68
69 // 更具项目评估的配置,创建员工的评估任务,(调试用) 69 // 更具项目评估的配置,创建员工的评估任务,(调试用)
70 -// func (c *StaffAssessController) CreateStaffAssessTask() {  
71 -// srv := service.NewStaffAssessServeice()  
72 -// paramReq := &command.CreateStaffAssessTask{}  
73 -// err := c.BindJSON(paramReq)  
74 -// if err != nil {  
75 -// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())  
76 -// c.Response(nil, e)  
77 -// return  
78 -// }  
79 -// //服务调用,实际由定时任务触发  
80 -// data, err := srv.CreateStaffAssessTask(paramReq)  
81 -// c.Response(data, err)  
82 -// } 70 +func (c *StaffAssessController) CreateStaffAssessTask() {
  71 + srv := service.NewStaffAssessServeice()
  72 + paramReq := &command.CreateStaffAssessTask{}
  73 + err := c.BindJSON(paramReq)
  74 + if err != nil {
  75 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  76 + c.Response(nil, e)
  77 + return
  78 + }
  79 + //服务调用,实际由定时任务触发
  80 + data, err := srv.InvokCreateStaffAssessTask(paramReq)
  81 + c.Response(data, err)
  82 +}
83 83
84 // 获取当前登录员工自评详情 84 // 获取当前登录员工自评详情
85 func (c *StaffAssessController) GetAssessSelfMeInfo() { 85 func (c *StaffAssessController) GetAssessSelfMeInfo() {
@@ -12,7 +12,7 @@ func init() { @@ -12,7 +12,7 @@ func init() {
12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), 12 web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
13 web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表 13 web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
14 web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述 14 web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
15 - // web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务 15 + web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
16 ) 16 )
17 // /v1/staff-assess/self/me/list 17 // /v1/staff-assess/self/me/list
18 assessNS := web.NewNamespace("/v1/staff-assess", 18 assessNS := web.NewNamespace("/v1/staff-assess",