作者 tangxvhui

暂存

1 package adapter 1 package adapter
2 2
3 type AssessCycleDayResp struct { 3 type AssessCycleDayResp struct {
4 - CycleId int `json:"cycleId"`  
5 - CycleName string `json:"cycleName"`  
6 - BeginDay string `json:"beginDay"`  
7 - AssessTaskId []int `json:"assessTaskId"` 4 + CycleId int `json:"cycleId"`
  5 + CycleName string `json:"cycleName"`
  6 + BeginDay string `json:"beginDay"`
8 } 7 }
1 package adapter 1 package adapter
2 2
3 type ListSupperAssessResp struct { 3 type ListSupperAssessResp struct {
4 - AssessId int `json:"assessId"` //  
5 - UsrId int `json:"userId,string"` 4 + AssessId int `json:"assessId"` //
  5 + CycleId int `json:"cycleId"` //周期id
  6 + BeginDay string `json:"beginDay"` //开始的日期
  7 + UserId int `json:"userId,string"` //用户id
6 UserName string `json:"userName"` //用户名称 8 UserName string `json:"userName"` //用户名称
7 EndTime string `json:"endTime"` //截止时间 9 EndTime string `json:"endTime"` //截止时间
8 InviteTotal int `json:"inviteTota"` //邀请总数 10 InviteTotal int `json:"inviteTota"` //邀请总数
@@ -8,7 +8,7 @@ type AssessTaskDescQuery struct { @@ -8,7 +8,7 @@ type AssessTaskDescQuery struct {
8 8
9 //获取我的项目周期进度描述 9 //获取我的项目周期进度描述
10 type AssessTaskDescV2Query struct { 10 type AssessTaskDescV2Query struct {
11 - CycleId int `json:"cycle"` 11 + CycleId int `json:"cycleId"`
12 BeginDay string `json:"beginDay"` 12 BeginDay string `json:"beginDay"`
13 UserId int `json:"userId"` //当前登录人的id 13 UserId int `json:"userId"` //当前登录人的id
14 CompanyId int `json:"companyId"` //当前登录的公司 14 CompanyId int `json:"companyId"` //当前登录的公司
@@ -2,8 +2,8 @@ package query @@ -2,8 +2,8 @@ package query
2 2
3 // 根据周期和日期,获取员工的自评内容 3 // 根据周期和日期,获取员工的自评内容
4 type GetExecutorSelfAssessQuery struct { 4 type GetExecutorSelfAssessQuery struct {
5 - CompanyId int `json:"companyId"` //  
6 - ExecutorId int `json:"executorId,string"` //评估的执行人,必填  
7 - CycleId int `json:"cycleId"` //评估周期id 必填  
8 - BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 5 + CompanyId int `json:"companyId"` //
  6 + TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填
  7 + CycleId int `json:"cycleId"` //评估周期id 必填
  8 + BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02
9 } 9 }
@@ -2,8 +2,8 @@ package query @@ -2,8 +2,8 @@ package query
2 2
3 //根据周期和日期,获取员工邀请评估的人员 3 //根据周期和日期,获取员工邀请评估的人员
4 type ListInviteUserQuery struct { 4 type ListInviteUserQuery struct {
5 - CompanyId int `json:"companyId"` //对公司  
6 - TargetUserId int `json:"userId,string"` //被评估的员工id  
7 - CycleId int `json:"CycleId"` //评估任务的周期id  
8 - BeginDay string `json:"beginDay"` //日期 5 + CompanyId int `json:"companyId"` //对公司
  6 + TargetUserId int `json:"targetUserId,string"` //被评估的员工id
  7 + CycleId int `json:"CycleId"` //评估任务的周期id
  8 + BeginDay string `json:"beginDay"` //日期
9 } 9 }
@@ -1454,7 +1454,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA @@ -1454,7 +1454,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA
1454 for _, v := range assessList { 1454 for _, v := range assessList {
1455 item := adapter.ListSupperAssessResp{ 1455 item := adapter.ListSupperAssessResp{
1456 AssessId: v.Id, 1456 AssessId: v.Id,
1457 - UsrId: v.TargetUser.UserId, 1457 + UserId: v.TargetUser.UserId,
1458 UserName: v.TargetUser.UserName, 1458 UserName: v.TargetUser.UserName,
1459 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), 1459 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
1460 InviteCompleted: 0, 1460 InviteCompleted: 0,
@@ -52,10 +52,9 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ @@ -52,10 +52,9 @@ func (srv StaffAssessServeice) SearchAssessTaskMeV2(param *query.SearchAssessMeQ
52 var temp adapter.AssessCycleDayResp 52 var temp adapter.AssessCycleDayResp
53 for _, v := range assessCycleList { 53 for _, v := range assessCycleList {
54 temp = adapter.AssessCycleDayResp{ 54 temp = adapter.AssessCycleDayResp{
55 - CycleId: v.CycleId,  
56 - CycleName: v.CycleName,  
57 - BeginDay: v.BeginDay,  
58 - AssessTaskId: v.AssessTaskId, 55 + CycleId: v.CycleId,
  56 + CycleName: v.CycleName,
  57 + BeginDay: v.BeginDay,
59 } 58 }
60 listData = append(listData, temp) 59 listData = append(listData, temp)
61 } 60 }
@@ -416,6 +415,8 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu @@ -416,6 +415,8 @@ func (srv StaffAssessServeice) ListExecutorInviteAssessV2(param *query.ListExecu
416 "userName": v.TargetUser.UserName, 415 "userName": v.TargetUser.UserName,
417 "userId": strconv.Itoa(v.TargetUser.UserId), 416 "userId": strconv.Itoa(v.TargetUser.UserId),
418 "status": string(v.Status), 417 "status": string(v.Status),
  418 + "cycleId": strconv.FormatInt(v.CycleId, 10),
  419 + "beginDay": v.BeginTime.Local().Format("2006-01-02"),
419 "types": string(v.Types), 420 "types": string(v.Types),
420 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), 421 "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
421 "assessId": strconv.Itoa(v.Id), 422 "assessId": strconv.Itoa(v.Id),
@@ -560,7 +561,9 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu @@ -560,7 +561,9 @@ func (srv StaffAssessServeice) ListExecutorSupperAssessV2(param *query.ListExecu
560 for _, v := range assessList { 561 for _, v := range assessList {
561 item := adapter.ListSupperAssessResp{ 562 item := adapter.ListSupperAssessResp{
562 AssessId: v.Id, 563 AssessId: v.Id,
563 - UsrId: v.TargetUser.UserId, 564 + CycleId: int(v.CycleId),
  565 + BeginDay: v.BeginTime.Local().Format("2006-01-02"),
  566 + UserId: v.TargetUser.UserId,
564 UserName: v.TargetUser.UserName, 567 UserName: v.TargetUser.UserName,
565 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"), 568 EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
566 InviteCompleted: 0, 569 InviteCompleted: 0,
@@ -624,7 +627,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA @@ -624,7 +627,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
624 // 获取员工的评估 627 // 获取员工的评估
625 _, assessList, err := assessReps.Find(map[string]interface{}{ 628 _, assessList, err := assessReps.Find(map[string]interface{}{
626 "companyId": param.CompanyId, 629 "companyId": param.CompanyId,
627 - "executorId": param.ExecutorId, 630 + "executorId": param.TargetUserId,
628 "cycleId": param.CycleId, 631 "cycleId": param.CycleId,
629 "beginDay": param.BeginDay, 632 "beginDay": param.BeginDay,
630 "typesList": []string{string(domain.AssessSelf)}, 633 "typesList": []string{string(domain.AssessSelf)},
@@ -634,7 +637,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA @@ -634,7 +637,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
634 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) 637 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
635 } 638 }
636 if len(assessList) == 0 { 639 if len(assessList) == 0 {
637 - return &adapter.AssessInfoResp{}, nil 640 + return nil, application.ThrowError(application.BUSINESS_ERROR, "不存在员工的自评内容")
638 } 641 }
639 assessData := assessList[0] 642 assessData := assessList[0]
640 643
@@ -659,7 +662,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA @@ -659,7 +662,7 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA
659 } 662 }
660 663
661 //获取员工描述 664 //获取员工描述
662 - staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.ExecutorId)) 665 + staffDesc, _ := srv.getStaffDescrip(transactionContext, int64(param.TargetUserId))
663 if err := transactionContext.CommitTransaction(); err != nil { 666 if err := transactionContext.CommitTransaction(); err != nil {
664 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 667 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
665 } 668 }
@@ -410,10 +410,9 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa @@ -410,10 +410,9 @@ func (d *StaffAssessDao) ExportDataUserAssess(param SearchConditin1) ([]ExportDa
410 } 410 }
411 411
412 type AssessCycleDayMe struct { 412 type AssessCycleDayMe struct {
413 - BeginDay string `json:"beginDay"`  
414 - CycleId int `json:"cycleId"`  
415 - CycleName string `json:"cycleName"`  
416 - AssessTaskId []int `json:"assessTaskId"` 413 + BeginDay string `json:"beginDay"`
  414 + CycleId int `json:"cycleId"`
  415 + CycleName string `json:"cycleName"`
417 } 416 }
418 417
419 // 根据评估的人执行人id,搜索 executorId参与的评估周期 418 // 根据评估的人执行人id,搜索 executorId参与的评估周期
@@ -426,7 +425,6 @@ func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limi @@ -426,7 +425,6 @@ func (d *StaffAssessDao) SearchAssessCycleMe(executorId int, companyId int, limi
426 } 425 }
427 sqlStr := ` 426 sqlStr := `
428 SELECT 427 SELECT
429 - jsonb_agg (staff_assess_task.id) as assess_task_id,  
430 staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day 428 staff_assess_task.cycle_id ,staff_assess_task.cycle_name ,staff_assess_task.begin_day
431 FROM staff_assess_task 429 FROM staff_assess_task
432 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id" 430 JOIN staff_assess ON staff_assess_task."id" = staff_assess."staff_assess_task_id"
  1 +package controllers
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "github.com/linmadan/egglib-go/web/beego"
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/staff_assess/service"
  8 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
  9 +)
  10 +
  11 +type StaffAssessControllerV2 struct {
  12 + beego.BaseController
  13 +}
  14 +
  15 +// 获取我的绩效任务列表
  16 +func (c *StaffAssessControllerV2) SearchAssessTaskMe() {
  17 + srv := service.NewStaffAssessServeice()
  18 + paramReq := &query.SearchAssessMeQuery{}
  19 + err := c.BindJSON(paramReq)
  20 + if err != nil {
  21 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  22 + c.Response(nil, e)
  23 + return
  24 + }
  25 + userReq := middlewares.GetUser(c.Ctx)
  26 + paramReq.CompanyId = int(userReq.CompanyId)
  27 + paramReq.UserId = int(userReq.UserId)
  28 +
  29 + data, err := srv.SearchAssessTaskMeV2(paramReq)
  30 + c.Response(data, err)
  31 +}
  32 +
  33 +// 获取我的绩效任务各环节完成情况
  34 +func (c *StaffAssessControllerV2) AssessTaskMeDesc() {
  35 + srv := service.NewStaffAssessServeice()
  36 + paramReq := &query.AssessTaskDescV2Query{}
  37 + err := c.BindJSON(paramReq)
  38 + if err != nil {
  39 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  40 + c.Response(nil, e)
  41 + return
  42 + }
  43 + userReq := middlewares.GetUser(c.Ctx)
  44 + paramReq.CompanyId = int(userReq.CompanyId)
  45 + paramReq.UserId = int(userReq.UserId)
  46 + data, err := srv.AssessTaskDescV2(paramReq)
  47 + c.Response(data, err)
  48 +}
  49 +
  50 +// 获取我要执行360评估,用户列表和评估填写的值
  51 +func (c *StaffAssessControllerV2) ListMeInviteUserAssess() {
  52 + srv := service.NewStaffAssessServeice()
  53 + paramReq := &query.ListInviteUserAssessQuery{}
  54 + err := c.BindJSON(paramReq)
  55 + if err != nil {
  56 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  57 + c.Response(nil, e)
  58 + return
  59 + }
  60 + //获取当前用户信息
  61 + userReq := middlewares.GetUser(c.Ctx)
  62 + paramReq.CompanyId = int(userReq.CompanyId)
  63 + paramReq.ExecutorId = int(userReq.UserId)
  64 + data, err := srv.ListExecutorInviteAssess(paramReq)
  65 + c.Response(data, err)
  66 +}
  67 +
  68 +// 获取我要执行的上级评估成员列表
  69 +func (c *StaffAssessControllerV2) ListMeSupperAssess() {
  70 + srv := service.NewStaffAssessServeice()
  71 + paramReq := &query.ListSupperAssessQuery{}
  72 + err := c.BindJSON(paramReq)
  73 + if err != nil {
  74 + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
  75 + c.Response(nil, e)
  76 + return
  77 + }
  78 + // 获取当前用户信息
  79 + userReq := middlewares.GetUser(c.Ctx)
  80 + paramReq.CompanyId = int(userReq.CompanyId)
  81 + paramReq.ExecutorId = int(userReq.UserId)
  82 + data, err := srv.ListExecutorSupperAssess(paramReq)
  83 + c.Response(data, err)
  84 +}