审查视图

pkg/port/beego/controllers/staff_assess_controller_v2.go 5.9 KB
tangxvhui authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
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)
}
tangxvhui authored
50
// 获取我要执行的360评估,用户列表和评估填写的值
tangxvhui authored
51 52
func (c *StaffAssessControllerV2) ListMeInviteUserAssess() {
	srv := service.NewStaffAssessServeice()
tangxvhui authored
53
	paramReq := &query.ListExecutorAssessQuery{}
tangxvhui authored
54 55 56 57 58 59 60 61 62 63
	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)
tangxvhui authored
64
	data, err := srv.ListExecutorInviteAssessV2(paramReq)
tangxvhui authored
65 66 67 68 69 70
	c.Response(data, err)
}

// 获取我要执行的上级评估成员列表
func (c *StaffAssessControllerV2) ListMeSupperAssess() {
	srv := service.NewStaffAssessServeice()
tangxvhui authored
71
	paramReq := &query.ListExecutorAssessQuery{}
tangxvhui authored
72 73 74 75 76 77 78 79 80 81
	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)
tangxvhui authored
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
	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)
}
tangxvhui authored
103 104
// 获取当前登录员工自评详情
func (c *StaffAssessControllerV2) GetAssessSelfMeInfo() {
tangxvhui authored
105 106 107 108 109 110 111 112 113 114
	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)
tangxvhui authored
115
	paramReq.TargetUserId = int(userReq.UserId)
tangxvhui authored
116
	data, err := srv.GetAssessSelfInfoV2(paramReq)
tangxvhui authored
117 118
	c.Response(data, err)
}
tangxvhui authored
119
tangxvhui authored
120 121
// 被评估的员工的评估列表-360评估
func (c *StaffAssessControllerV2) ListTargetUserInviteAssess() {
tangxvhui authored
122
	srv := service.NewStaffAssessServeice()
tangxvhui authored
123
	paramReq := &query.ListTargetAssessQuery{}
tangxvhui authored
124 125 126 127 128 129
	err := c.BindJSON(paramReq)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
tangxvhui authored
130
tangxvhui authored
131 132
	userReq := middlewares.GetUser(c.Ctx)
	paramReq.CompanyId = int(userReq.CompanyId)
tangxvhui authored
133
	data, err := srv.ListTargetUserInviteAssess(paramReq)
tangxvhui authored
134 135
	c.Response(data, err)
}
tangxvhui authored
136
tangxvhui authored
137 138
// 被评估的员工的评估列表-当前登录用户-上级评估
func (c *StaffAssessControllerV2) ListTargetUserMeSupperAssess() {
tangxvhui authored
139 140 141 142 143 144 145 146
	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
	}
tangxvhui authored
147
	paramReq.CompanyId = 1
tangxvhui authored
148 149
	userReq := middlewares.GetUser(c.Ctx)
	paramReq.CompanyId = int(userReq.CompanyId)
tangxvhui authored
150 151
	paramReq.TargetUserId = int(userReq.UserId)
	data, err := srv.ListTargetUserSuperAssess(paramReq)
tangxvhui authored
152 153
	c.Response(data, err)
}
tangxvhui authored
154 155

// 被评估的员工的评估列表-上级评估
tangxvhui authored
156
func (c *StaffAssessControllerV2) ListTargetUserSupperAssess() {
tangxvhui authored
157 158 159 160 161 162 163 164 165 166 167 168 169 170
	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)
}
tangxvhui authored
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186

// 获取员工自评详情
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)
}