作者 Your Name

更新

... ... @@ -330,17 +330,17 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
}
// 根据项目评估的配置,创建员工的评估任务
func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
// transactionContext, err := factory.CreateTransactionContext(nil)
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// if err := transactionContext.StartTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// defer func() {
// _ = transactionContext.RollbackTransaction()
// }()
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
... ... @@ -449,9 +449,9 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
return map[string]interface{}{
"assessTaskId": assessTaskData.Id,
}, nil
... ...
... ... @@ -67,19 +67,19 @@ func (c *StaffAssessController) AssessSelfMeList() {
}
// 更具项目评估的配置,创建员工的评估任务,(调试用)
func (c *StaffAssessController) CreateStaffAssessTask() {
srv := service.NewStaffAssessServeice()
paramReq := &command.CreateStaffAssessTask{}
err := c.BindJSON(paramReq)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
//服务调用,实际由定时任务触发
data, err := srv.CreateStaffAssessTask(paramReq)
c.Response(data, err)
}
// func (c *StaffAssessController) CreateStaffAssessTask() {
// srv := service.NewStaffAssessServeice()
// paramReq := &command.CreateStaffAssessTask{}
// err := c.BindJSON(paramReq)
// if err != nil {
// e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
// c.Response(nil, e)
// return
// }
// //服务调用,实际由定时任务触发
// data, err := srv.CreateStaffAssessTask(paramReq)
// c.Response(data, err)
// }
// 获取当前登录员工自评详情
func (c *StaffAssessController) GetAssessSelfMeInfo() {
... ...
... ... @@ -10,7 +10,7 @@ func init() {
// web.NSBefore(filters.AllowCors(), middlewares.CheckToken()),
web.NSCtrlPost("/search/me", (*controllers.StaffAssessController).SearchAssessTaskMe), //获取我参与过的评估项目列表
web.NSCtrlPost("/desc/me", (*controllers.StaffAssessController).AssessTaskMeDesc), //获取我的项目评估进度描述
web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
// web.NSCtrlPost("/", (*controllers.StaffAssessController).CreateStaffAssessTask), //创建员工的评估任务
)
// /v1/staff-assess/self/me/list
assessNS := web.NewNamespace("/v1/staff-assess",
... ...