|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/web/beego"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
|
|
|
)
|
|
|
|
|
|
type StaffAssessController struct {
|
|
|
beego.BaseController
|
|
|
}
|
|
|
|
|
|
// 获取我的绩效任务列表
|
|
|
func (c *StaffAssessController) SearchAssessTaskMe() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.SearchAssessMeQuery{}
|
|
|
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.SearchAssessTaskMe(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我的绩效任务各环节完成情况
|
|
|
func (c *StaffAssessController) AssessTaskMeDesc() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessTaskDescQuery{}
|
|
|
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.AssessTaskDesc(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取个人的自评反馈历史记录列表
|
|
|
func (c *StaffAssessController) AssessSelfMeList() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfListQuery{}
|
|
|
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.AssessSelfList(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.InvokCreateStaffAssessTask(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取当前登录员工自评详情
|
|
|
func (c *StaffAssessController) GetAssessSelfMeInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfInfoQuery{}
|
|
|
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.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.GetAssessSelfInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我邀请的人
|
|
|
func (c *StaffAssessController) GetAssessMeInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.GetAssessInviteUserQuery{}
|
|
|
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.GetAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 保存我邀请的员工
|
|
|
func (c *StaffAssessController) SaveAssessMeInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &command.SaveAssessInvite{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//TODO 获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.UserId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.SaveAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 员工邀请的人选择列表
|
|
|
func (c *StaffAssessController) SelectAssessInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.SelectAssessInviteUser{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.TargetUserId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.SelectAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我要执行360评估,用户列表和评估填写的值
|
|
|
func (c *StaffAssessController) ListMeInviteUserAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListInviteUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.ExecutorId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.ExecutorId = int(userReq.UserId)
|
|
|
data, err := srv.ListExecutorInviteAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我要执行的上级评估成员列表
|
|
|
func (c *StaffAssessController) ListMeSupperAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListSupperAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//TODO 获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.ExecutorId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.ExecutorId = int(userReq.UserId)
|
|
|
data, err := srv.ListExecutorSupperAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取员工自评详情
|
|
|
func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfInfoQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.GetAssessSelfInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取评估内容详情
|
|
|
func (c *StaffAssessController) GetAssessInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessInfoQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.GetAssessInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 保存评估内容详情
|
|
|
func (c *StaffAssessController) SaveAssessInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &command.SaveAssessInfoCommand{}
|
|
|
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.ExecutorId = int(userReq.UserId)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.SaveAssessInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 被评估的员工的评估列表-360评估
|
|
|
func (c *StaffAssessController) ListTargetUserInviteAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListTargetUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
|
|
|
data, err := srv.ListTargetUserAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListTargetUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.Types = []string{string(domain.AssessSuper)}
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.ListTargetUserAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//获取周期列表
|
|
|
func (c *StaffAssessController) ListAssessCycle() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
data, err := srv.ListAllAssessCycle(int(userReq.CompanyId))
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//获取周期里的考核日期
|
|
|
func (c *StaffAssessController) ListAssessCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessCycleDay{}
|
|
|
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)
|
|
|
data, err := srv.ListAllAssessCycleDay(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//根据周期里的考核日期,获取员工填写评估内容列表
|
|
|
func (c *StaffAssessController) ListAssessContentCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessContentCycleDay{}
|
|
|
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.OperaterId = int(userReq.UserId)
|
|
|
data, err := srv.ListUserAssessContentCycleDay(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件
|
|
|
func (c *StaffAssessController) ExportAssessContentCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessContentCycleDay{}
|
|
|
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.OperaterId = int(userReq.UserId)
|
|
|
data, err := srv.ExportUserAssess(paramReq)
|
|
|
if err != nil {
|
|
|
c.Response(nil, err)
|
|
|
}
|
|
|
fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay)
|
|
|
c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName)
|
|
|
c.Ctx.Output.Header("Content-Description", "FileTransfer")
|
|
|
c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
|
|
c.Ctx.Output.Header("Content-Transfer-Encoding", "binary")
|
|
|
c.Ctx.Output.Header("Expires", "0")
|
|
|
data.Write(c.Ctx.ResponseWriter)
|
|
|
} |
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/web/beego"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
|
|
|
)
|
|
|
|
|
|
type StaffAssessController struct {
|
|
|
beego.BaseController
|
|
|
}
|
|
|
|
|
|
// 获取我的绩效任务列表
|
|
|
func (c *StaffAssessController) SearchAssessTaskMe() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.SearchAssessMeQuery{}
|
|
|
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.SearchAssessTaskMe(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我的绩效任务各环节完成情况
|
|
|
func (c *StaffAssessController) AssessTaskMeDesc() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessTaskDescQuery{}
|
|
|
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.AssessTaskDesc(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取个人的自评反馈历史记录列表
|
|
|
func (c *StaffAssessController) AssessSelfMeList() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfListQuery{}
|
|
|
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.AssessSelfList(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.InvokCreateStaffAssessTask(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取当前登录员工自评详情
|
|
|
func (c *StaffAssessController) GetAssessSelfMeInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfInfoQuery{}
|
|
|
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.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.GetAssessSelfInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我邀请的人
|
|
|
func (c *StaffAssessController) GetAssessMeInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.GetAssessInviteUserQuery{}
|
|
|
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.GetAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 保存我邀请的员工
|
|
|
func (c *StaffAssessController) SaveAssessMeInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &command.SaveAssessInvite{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//TODO 获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.UserId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.SaveAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 员工邀请的人选择列表
|
|
|
func (c *StaffAssessController) SelectAssessInviteUser() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.SelectAssessInviteUser{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.TargetUserId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.SelectAssessInviteUser(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我要执行360评估,用户列表和评估填写的值
|
|
|
func (c *StaffAssessController) ListMeInviteUserAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListInviteUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.ExecutorId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.ExecutorId = int(userReq.UserId)
|
|
|
data, err := srv.ListExecutorInviteAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取我要执行的上级评估成员列表
|
|
|
func (c *StaffAssessController) ListMeSupperAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListSupperAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
//TODO 获取当前用户信息
|
|
|
// paramReq.CompanyId = 1
|
|
|
// paramReq.ExecutorId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.ExecutorId = int(userReq.UserId)
|
|
|
data, err := srv.ListExecutorSupperAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取员工自评详情
|
|
|
func (c *StaffAssessController) GetAssessTargetUserSelfInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessSelfInfoQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.GetAssessSelfInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 获取评估内容详情
|
|
|
func (c *StaffAssessController) GetAssessInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.AssessInfoQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.GetAssessInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 保存评估内容详情
|
|
|
func (c *StaffAssessController) SaveAssessInfo() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &command.SaveAssessInfoCommand{}
|
|
|
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.ExecutorId = int(userReq.UserId)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
data, err := srv.SaveAssessInfo(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
// 被评估的员工的评估列表-360评估
|
|
|
func (c *StaffAssessController) ListTargetUserInviteAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListTargetUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.Types = []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}
|
|
|
data, err := srv.ListTargetUserAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
func (c *StaffAssessController) ListTargetUserMeSupperAssess() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListTargetUserAssessQuery{}
|
|
|
err := c.BindJSON(paramReq)
|
|
|
if err != nil {
|
|
|
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
|
|
|
c.Response(nil, e)
|
|
|
return
|
|
|
}
|
|
|
// paramReq.CompanyId = 1
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
paramReq.CompanyId = int(userReq.CompanyId)
|
|
|
paramReq.Types = []string{string(domain.AssessSuper)}
|
|
|
paramReq.TargetUserId = int(userReq.UserId)
|
|
|
data, err := srv.ListTargetUserAssess(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//获取周期列表
|
|
|
func (c *StaffAssessController) ListAssessCycle() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
userReq := middlewares.GetUser(c.Ctx)
|
|
|
data, err := srv.ListAllAssessCycle(int(userReq.CompanyId))
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//获取周期里的考核日期
|
|
|
func (c *StaffAssessController) ListAssessCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessCycleDay{}
|
|
|
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)
|
|
|
data, err := srv.ListAllAssessCycleDay(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//根据周期里的考核日期,获取员工填写评估内容列表
|
|
|
func (c *StaffAssessController) ListAssessContentCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessContentCycleDay{}
|
|
|
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.OperaterId = int(userReq.UserId)
|
|
|
data, err := srv.ListUserAssessContentCycleDay(paramReq)
|
|
|
c.Response(data, err)
|
|
|
}
|
|
|
|
|
|
//根据周期里的考核日期,获取员工填写评估内容列表,导出为xlsx文件
|
|
|
func (c *StaffAssessController) ExportAssessContentCycleDay() {
|
|
|
srv := service.NewStaffAssessServeice()
|
|
|
paramReq := &query.ListAssessContentCycleDay{}
|
|
|
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.OperaterId = int(userReq.UserId)
|
|
|
data, err := srv.ExportUserAssess(paramReq)
|
|
|
if err != nil {
|
|
|
c.Response(nil, err)
|
|
|
}
|
|
|
fileName := fmt.Sprintf("每日绩效汇总%s", paramReq.BeginDay)
|
|
|
c.Ctx.Output.Header("Content-Disposition", "attachment;filename="+fileName)
|
|
|
c.Ctx.Output.Header("Content-Description", "FileTransfer")
|
|
|
c.Ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
|
|
c.Ctx.Output.Header("Content-Transfer-Encoding", "binary")
|
|
|
c.Ctx.Output.Header("Expires", "0")
|
|
|
data.Write(c.Ctx.ResponseWriter)
|
|
|
}
|
|
|
|
|
|
// SaveAssessCache 保存评估内容(缓存)
|
|
|
func (c *StaffAssessController) SaveAssessCache() {
|
|
|
cacheService := service.NewStaffAssessCacheService()
|
|
|
in := &command.SaveAssessCacheCommand{}
|
|
|
if err := c.Unmarshal(in); err != nil {
|
|
|
c.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
|
|
|
} else {
|
|
|
c.Response(cacheService.SaveAssessCache(in))
|
|
|
}
|
|
|
} |
...
|
...
|
|