staff_assess_controller_v2.go 5.9 KB
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/staff_assess/query"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)

type StaffAssessControllerV2 struct {
	beego.BaseController
}

// 获取我的绩效任务列表
func (c *StaffAssessControllerV2) 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.SearchAssessTaskMeV2(paramReq)
	c.Response(data, err)
}

// 获取我的绩效任务各环节完成情况
func (c *StaffAssessControllerV2) AssessTaskMeDesc() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.AssessTaskDescV2Query{}
	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.AssessTaskDescV2(paramReq)
	c.Response(data, err)
}

// 获取我要执行360评估,用户列表和评估填写的值
func (c *StaffAssessControllerV2) ListMeInviteUserAssess() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListExecutorAssessQuery{}
	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.ListExecutorInviteAssessV2(paramReq)
	c.Response(data, err)
}

// 获取我要执行的上级评估成员列表
func (c *StaffAssessControllerV2) ListMeSupperAssess() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListExecutorAssessQuery{}
	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.ListExecutorSupperAssessV2(paramReq)
	c.Response(data, err)
}

// 获取我邀请的人
func (c *StaffAssessControllerV2) GetAssessMeInviteUser() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListInviteUserQuery{}
	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.ListAssessInviteUserV2(paramReq)
	c.Response(data, err)
}

// 获取当前登录员工自评详情
func (c *StaffAssessControllerV2) GetAssessSelfMeInfo() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.GetExecutorSelfAssessQuery{}
	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.GetAssessSelfInfoV2(paramReq)
	c.Response(data, err)
}

// 被评估的员工的评估列表-360评估
func (c *StaffAssessControllerV2) ListTargetUserInviteAssess() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListTargetAssessQuery{}
	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.ListTargetUserInviteAssess(paramReq)
	c.Response(data, err)
}

// 被评估的员工的评估列表-当前登录用户-上级评估
func (c *StaffAssessControllerV2) ListTargetUserMeSupperAssess() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListTargetAssessQuery{}
	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.TargetUserId = int(userReq.UserId)
	data, err := srv.ListTargetUserSuperAssess(paramReq)
	c.Response(data, err)
}

// 被评估的员工的评估列表-上级评估
func (c *StaffAssessControllerV2) ListTargetUserSupperAssess() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.ListTargetAssessQuery{}
	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.ListTargetUserSuperAssess(paramReq)
	c.Response(data, err)
}

// 获取员工自评详情
func (c *StaffAssessControllerV2) GetAssessTargetUserSelfInfo() {
	srv := service.NewStaffAssessServeice()
	paramReq := &query.GetExecutorSelfAssessQuery{}
	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.GetAssessSelfInfoV2(paramReq)
	c.Response(data, err)
}