审查视图

pkg/port/beego/controllers/summary_evaluation_controller.go 12.5 KB
tangxvhui authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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/summary_evaluation/command"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/service"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)

type SummaryEvaluationController struct {
	beego.BaseController
}
15
func (c *SummaryEvaluationController) GetExecutorCycleList() {
郑周 authored
16
	srv := service.NewSummaryEvaluationService()
tangxvhui authored
17 18 19 20 21 22 23 24 25
	paramReq := &command.QueryCycleList{}
	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.UserId = int(userReq.UserId)
26
	paramReq.CompanyId = int(userReq.CompanyId)
27
	data, err := srv.GetExecutorCycleList(paramReq)
tangxvhui authored
28 29 30 31
	c.Response(data, err)
}

func (c *SummaryEvaluationController) GetMenu() {
郑周 authored
32
	srv := service.NewSummaryEvaluationService()
tangxvhui authored
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
	paramReq := &command.QueryMenu{}
	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.GetMenu(paramReq)
	c.Response(data, err)

}
tangxvhui authored
48
// 获取自评详情
tangxvhui authored
49
func (c *SummaryEvaluationController) GetEvaluationSelf() {
郑周 authored
50
	srv := service.NewSummaryEvaluationService()
tangxvhui authored
51
	paramReq := &command.QueryEvaluation{}
tangxvhui authored
52 53 54 55 56 57 58 59
	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
60
	data, err := srv.GetEvaluationSelfByCycle(paramReq)
tangxvhui authored
61 62 63 64
	c.Response(data, err)

}
tangxvhui authored
65
// EditEvaluationSelf 编辑综合自评
tangxvhui authored
66
func (c *SummaryEvaluationController) EditEvaluationSelf() {
郑周 authored
67
	srv := service.NewSummaryEvaluationService()
tangxvhui authored
68 69 70 71 72 73 74 75 76 77 78 79 80 81
	paramReq := &command.EditEvaluationValue{}
	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.EditEvaluationSelf(paramReq)
	c.Response(data, err)

}
82
tangxvhui authored
83
// GetTargetUserCycleList 根据被评估人获取周期列表
84
func (c *SummaryEvaluationController) GetTargetUserCycleList() {
郑周 authored
85
	srv := service.NewSummaryEvaluationService()
86 87 88 89 90 91 92 93 94 95
	paramReq := &command.QueryCycleList{}
	err := c.BindJSON(paramReq)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	data, err := srv.GetTargetUserCycleList(paramReq)
	c.Response(data, err)
}
96
97 98
// CountEvaluationSelfLevel 获取自评小结
func (c *SummaryEvaluationController) CountEvaluationSelfLevel() {
99
	srv := service.NewSummaryEvaluationService()
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
	paramReq := &command.QueryEvaluation{}
	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.CountEvaluationSelfLevel(paramReq)
	c.Response(data, err)
}

func (c *SummaryEvaluationController) Evaluation360List() {
	srv := service.NewSummaryEvaluationService()
	in := &command.QueryEvaluation360List{}
116 117 118 119 120 121 122
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
123
	in.CompanyId = int(userReq.CompanyId)
124
	in.UserId = int(userReq.UserId)
125
	data, err := srv.Evaluation360List(in)
126 127 128 129 130
	c.Response(data, err)
}

func (c *SummaryEvaluationController) GetEvaluation360() {
	srv := service.NewSummaryEvaluationService()
郑周 authored
131
	in := &command.QueryEvaluation360My{}
132 133 134 135 136 137 138
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
139
	in.CompanyId = int(userReq.CompanyId)
140 141 142 143 144
	in.UserId = int(userReq.UserId)
	data, err := srv.GetEvaluation360(in)
	c.Response(data, err)
}
145
func (c *SummaryEvaluationController) GetEvaluation360Complete() {
tangxvhui authored
146
	srv := service.NewSummaryEvaluationService()
147 148
	in := &command.QueryEvaluation360{}
	err := c.BindJSON(in)
tangxvhui authored
149 150 151 152 153 154
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
155
	in.CompanyId = int(userReq.CompanyId)
156
	data, err := srv.GetEvaluation360Complete(in)
tangxvhui authored
157
	c.Response(data, err)
158 159
}
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
func (c *SummaryEvaluationController) EditEvaluation360() {
	srv := service.NewSummaryEvaluationService()
	in := &command.EditEvaluationValue{}
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	in.CompanyId = int(userReq.CompanyId)
	in.ExecutorId = int(userReq.UserId)
	data, err := srv.EditEvaluation360(in)
	c.Response(data, err)
}
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
func (c *SummaryEvaluationController) EvaluationHRBPList() {
	srv := service.NewSummaryEvaluationService()
	in := &command.QueryEvaluationHRList{}
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	in.CompanyId = int(userReq.CompanyId)
	in.UserId = int(userReq.UserId)
	data, err := srv.EvaluationHRBPList(in)
	c.Response(data, err)
}
192 193
func (c *SummaryEvaluationController) GetEvaluationHRBP() {
	srv := service.NewSummaryEvaluationService()
194
	in := &command.QueryEvaluationHRBPMy{}
195 196 197 198 199 200 201
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
202
	in.CompanyId = int(userReq.CompanyId)
203 204 205 206
	data, err := srv.GetEvaluationHRBP(in)
	c.Response(data, err)
}
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
func (c *SummaryEvaluationController) GetEvaluationHRBPComplete() {
	srv := service.NewSummaryEvaluationService()
	in := &command.QueryEvaluationHRBP{}
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	in.CompanyId = int(userReq.CompanyId)
	data, err := srv.GetEvaluationHRBPComplete(in)
	c.Response(data, err)
}
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
func (c *SummaryEvaluationController) EditEvaluationHRBP() {
	srv := service.NewSummaryEvaluationService()
	in := &command.EditEvaluationValue{}
	err := c.BindJSON(in)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	in.CompanyId = int(userReq.CompanyId)
	in.ExecutorId = int(userReq.UserId)
	data, err := srv.EditEvaluationHRBP(in)
	c.Response(data, err)
}
tangxvhui authored
237
tangxvhui authored
238
// 获取上级评估
tangxvhui authored
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
func (c *SummaryEvaluationController) GetEvaluationSuper() {
	srv := service.NewSummaryEvaluationService()
	param := &command.QueryEvaluationSuper{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	param.CompanyId = int(userReq.CompanyId)
	data, err := srv.GetEvaluationSuper(param)
	c.Response(data, err)
}
tangxvhui authored
254
// 编辑上级评估
tangxvhui authored
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
func (c *SummaryEvaluationController) EditEvaluationSuper() {
	srv := service.NewSummaryEvaluationService()
	param := &command.EditEvaluationValue{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	param.CompanyId = int(userReq.CompanyId)
	param.ExecutorId = int(userReq.UserId)
	data, err := srv.EditEvaluationSuper(param)
	c.Response(data, err)
}
270
271 272
// 执行人的上级评估列表
func (c *SummaryEvaluationController) ListExecutorEvaluationSuper() {
273
	srv := service.NewSummaryEvaluationService()
274
	param := &command.QueryExecutorEvaluationList{}
275 276 277 278 279 280 281 282 283
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	param.CompanyId = int(userReq.CompanyId)
	param.ExecutorId = int(userReq.UserId)
284
	data, err := srv.ListExecutorEvaluationSuper(param)
285 286
	c.Response(data, err)
}
tangxvhui authored
287
288 289
// ConfirmScoreEvaluation 员工确认评估分数
func (c *SummaryEvaluationController) ConfirmScoreEvaluation() {
tangxvhui authored
290 291 292 293 294 295 296 297 298 299
	srv := service.NewSummaryEvaluationService()
	param := &command.ConfirmScore{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	param.UserId = int(userReq.UserId)
300
	err = srv.ConfirmScoreEvaluation(param)
tangxvhui authored
301 302
	c.Response(nil, err)
}
tangxvhui authored
303
郑周 authored
304 305
// GetTargetEvaluationResult 按照周期和被评估的人 获取考核结果
func (c *SummaryEvaluationController) GetTargetEvaluationResult() {
tangxvhui authored
306 307 308 309 310 311 312 313
	srv := service.NewSummaryEvaluationService()
	paramReq := &command.QueryEvaluation{}
	err := c.BindJSON(paramReq)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
tangxvhui authored
314 315
	userReq := middlewares.GetUser(c.Ctx)
	paramReq.CompanyId = int(userReq.CompanyId)
郑周 authored
316
	data, err := srv.GetTargetEvaluationResult(paramReq)
tangxvhui authored
317 318
	c.Response(data, err)
}
319 320

// 按周期获取上级评估列表
tangxvhui authored
321
func (c *SummaryEvaluationController) ListAllEvaluationFinish() {
322 323 324 325 326 327 328 329 330 331
	srv := service.NewSummaryEvaluationService()
	param := &command.QueryEvaluationList{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
	param.CompanyId = int(userReq.CompanyId)
tangxvhui authored
332
	param.UserId = int(userReq.UserId)
tangxvhui authored
333
	data, err := srv.ListAllEvaluationFinish(param)
334 335
	c.Response(data, err)
}
tangxvhui authored
336 337

// 按周期 导出上级评估列表
tangxvhui authored
338
func (c *SummaryEvaluationController) ExportAllEvaluationFinish() {
tangxvhui authored
339 340 341 342 343 344 345 346 347
	srv := service.NewSummaryEvaluationService()
	param := &command.QueryEvaluationList{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	userReq := middlewares.GetUser(c.Ctx)
tangxvhui authored
348
	param.UserId = int(userReq.UserId)
tangxvhui authored
349
	param.CompanyId = int(userReq.CompanyId)
tangxvhui authored
350
	data, err := srv.ExportAllEvaluationFinish(param)
tangxvhui authored
351 352 353 354
	if err != nil {
		c.Response(nil, err)
		return
	}
355
	c.Ctx.Output.Header("Content-Disposition", "attachment;filename=周期评估")
tangxvhui authored
356 357 358 359 360 361
	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)
}
tangxvhui authored
362
tangxvhui authored
363
// 获取现在待执行的综合自评
tangxvhui authored
364 365 366 367 368 369 370 371 372
func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() {
	srv := service.NewSummaryEvaluationService()
	param := &command.QueryExecutorEvaluationList{}
	userReq := middlewares.GetUser(c.Ctx)
	param.CompanyId = int(userReq.CompanyId)
	param.ExecutorId = int(userReq.UserId)
	data, err := srv.ListExecutorNowEvaluationSelf(param)
	c.Response(data, err)
}
Your Name authored
373 374 375 376 377 378 379 380 381 382 383 384 385 386

// 获取现在待执行的综合自评
func (c *SummaryEvaluationController) SearchAssessRemark() {
	srv := service.NewSummaryEvaluationService()
	param := &command.QueryAssessRemark{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
	data, err := srv.SearchAssessRemark(param)
	c.Response(data, err)
}
387 388 389 390 391 392 393 394 395 396 397

// 修改周期考核结果的分数
func (c *SummaryEvaluationController) ModifyFinishScore() {
	srv := service.NewSummaryEvaluationService()
	param := &command.ModifyFinishScore{}
	err := c.BindJSON(param)
	if err != nil {
		e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
		c.Response(nil, e)
		return
	}
tangxvhui authored
398 399 400
	userReq := middlewares.GetUser(c.Ctx)
	param.UserId = int(userReq.UserId)
	param.CompanyId = int(userReq.CompanyId)
401 402 403
	err = srv.ModifyFinishScore(param)
	c.Response(nil, err)
}