正在显示
4 个修改的文件
包含
52 行增加
和
9 行删除
| @@ -2,10 +2,10 @@ package query | @@ -2,10 +2,10 @@ package query | ||
| 2 | 2 | ||
| 3 | //获取员工被其他人评估的列表 | 3 | //获取员工被其他人评估的列表 |
| 4 | type ListTargetAssessQuery struct { | 4 | type ListTargetAssessQuery struct { |
| 5 | - PageNumber int `json:"pageNumber"` | ||
| 6 | - PageSize int `json:"pageSize"` | ||
| 7 | - CompanyId int `json:"companyId"` // | ||
| 8 | - ExecutorId int `json:"executorId,string"` //评估的执行人,必填 | ||
| 9 | - CycleId int `json:"cycleId"` //评估周期id 必填 | ||
| 10 | - BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 | 5 | + PageNumber int `json:"pageNumber"` |
| 6 | + PageSize int `json:"pageSize"` | ||
| 7 | + CompanyId int `json:"companyId"` // | ||
| 8 | + TargetUserId int `json:"targetUserId,string"` //评估的执行人,必填 | ||
| 9 | + CycleId int `json:"cycleId"` //评估周期id 必填 | ||
| 10 | + BeginDay string `json:"beginDay"` //评估任务的开始日期 2006-01-02 | ||
| 11 | } | 11 | } |
| @@ -693,7 +693,44 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | @@ -693,7 +693,44 @@ func (srv StaffAssessServeice) GetAssessSelfInfoV2(param *query.GetExecutorSelfA | ||
| 693 | return &result, nil | 693 | return &result, nil |
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | -//根据周期和日期。获取员工的被其他人360评估的列表, | 696 | +//根据周期和日期。获取360评估的列表,员工的被其他人评估 |
| 697 | func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { | 697 | func (srv StaffAssessServeice) ListTargetUserInviteAssess(param *query.ListTargetAssessQuery) (map[string]interface{}, error) { |
| 698 | - return nil, nil | 698 | + |
| 699 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 700 | + if err != nil { | ||
| 701 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 702 | + } | ||
| 703 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 704 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 705 | + } | ||
| 706 | + defer func() { | ||
| 707 | + _ = transactionContext.RollbackTransaction() | ||
| 708 | + }() | ||
| 709 | + assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{ | ||
| 710 | + "transactionContext": transactionContext, | ||
| 711 | + }) | ||
| 712 | + //获取员工的评估 | ||
| 713 | + cnt, assessList, err := assessReps.Find(map[string]interface{}{ | ||
| 714 | + "cycleId": param.CycleId, | ||
| 715 | + "beginDay": param.BeginDay, | ||
| 716 | + "companyId": param.CompanyId, | ||
| 717 | + "targetUserId": param.TargetUserId, | ||
| 718 | + "typesList": []string{string(domain.AssessInviteSameSuper), string(domain.AssessInviteDiffSuper)}, | ||
| 719 | + }) | ||
| 720 | + if err != nil { | ||
| 721 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error()) | ||
| 722 | + } | ||
| 723 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 724 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 725 | + } | ||
| 726 | + var resultList []map[string]interface{} | ||
| 727 | + for _, v := range assessList { | ||
| 728 | + item := map[string]interface{}{ | ||
| 729 | + "id": v.Id, | ||
| 730 | + "targetUser": v.TargetUser, | ||
| 731 | + "executor": v.Executor, | ||
| 732 | + } | ||
| 733 | + resultList = append(resultList, item) | ||
| 734 | + } | ||
| 735 | + return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil | ||
| 699 | } | 736 | } |
| @@ -297,16 +297,19 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -297,16 +297,19 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
| 297 | t_department as ( | 297 | t_department as ( |
| 298 | select department.id::text as depart_id from department where charge_user_ids @>'[%d]' | 298 | select department.id::text as depart_id from department where charge_user_ids @>'[%d]' |
| 299 | ), | 299 | ), |
| 300 | + -- 部门主管 | ||
| 300 | t_user_1 as ( | 301 | t_user_1 as ( |
| 301 | select t_user_department.user_id::text from t_user_department | 302 | select t_user_department.user_id::text from t_user_department |
| 302 | join t_department on t_user_department.depart_id = t_department.depart_id | 303 | join t_department on t_user_department.depart_id = t_department.depart_id |
| 303 | ), | 304 | ), |
| 305 | + -- 如果是hrbp | ||
| 304 | t_project_1 as( | 306 | t_project_1 as( |
| 305 | select evaluation_project.id as project_id | 307 | select evaluation_project.id as project_id |
| 306 | from evaluation_project | 308 | from evaluation_project |
| 307 | where evaluation_project.cycle_id =%d | 309 | where evaluation_project.cycle_id =%d |
| 308 | and evaluation_project.hr_bp = %d | 310 | and evaluation_project.hr_bp = %d |
| 309 | ), | 311 | ), |
| 312 | + -- 如果的项目管理员 | ||
| 310 | t_project_2 as( | 313 | t_project_2 as( |
| 311 | select evaluation_project.id as project_id | 314 | select evaluation_project.id as project_id |
| 312 | from evaluation_project | 315 | from evaluation_project |
| @@ -314,11 +317,13 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -314,11 +317,13 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
| 314 | and evaluation_project.pmp =1 | 317 | and evaluation_project.pmp =1 |
| 315 | and evaluation_project.pmp_ids @>'["%d"]' | 318 | and evaluation_project.pmp_ids @>'["%d"]' |
| 316 | ), | 319 | ), |
| 320 | + -- 合并数据 | ||
| 317 | t_project_3 as ( | 321 | t_project_3 as ( |
| 318 | select t_project_2.project_id from t_project_2 | 322 | select t_project_2.project_id from t_project_2 |
| 319 | union | 323 | union |
| 320 | select t_project_1.project_id from t_project_1 | 324 | select t_project_1.project_id from t_project_1 |
| 321 | ), | 325 | ), |
| 326 | + -- 初步过滤数据 | ||
| 322 | t_staff_assess_0 as ( | 327 | t_staff_assess_0 as ( |
| 323 | select staff_assess.id as assess_id, | 328 | select staff_assess.id as assess_id, |
| 324 | staff_assess.target_user->>'userId' as target_user_id, | 329 | staff_assess.target_user->>'userId' as target_user_id, |
| @@ -330,6 +335,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | @@ -330,6 +335,7 @@ func (d *StaffAssessDao) useTStaffAssess(companyId int, cycleId int, userId int, | ||
| 330 | and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s' | 335 | and to_char(staff_assess.begin_time,'YYYY-MM-DD')='%s' |
| 331 | and staff_assess."types" ='self' | 336 | and staff_assess."types" ='self' |
| 332 | ), | 337 | ), |
| 338 | + -- 根据查看权限过滤合并数据 | ||
| 333 | t_staff_assess_1 as ( | 339 | t_staff_assess_1 as ( |
| 334 | (select t_staff_assess_0.assess_id, | 340 | (select t_staff_assess_0.assess_id, |
| 335 | t_staff_assess_0.target_user_id, | 341 | t_staff_assess_0.target_user_id, |
| @@ -18,7 +18,7 @@ func init() { | @@ -18,7 +18,7 @@ func init() { | ||
| 18 | web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表 | 18 | web.NSCtrlPost("/cycle/day/content", (*controllers.StaffAssessController).ListAssessContentCycleDay), //根据周期里的考核日期,获取员工填写评估内容列表 |
| 19 | web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表 | 19 | web.NSCtrlPost("/cycle/day/content/export", (*controllers.StaffAssessController).ExportAssessContentCycleDay), //根据周期里的考核日期,导出员工填写评估内容列表 |
| 20 | ) | 20 | ) |
| 21 | - // /v1/staff-assess/self/me/list | 21 | + |
| 22 | assessNS := web.NewNamespace("/v1/staff-assess", | 22 | assessNS := web.NewNamespace("/v1/staff-assess", |
| 23 | web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | 23 | web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), |
| 24 | web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 | 24 | web.NSCtrlPost("/self/me/list", (*controllers.StaffAssessController).AssessSelfMeList), //获取我的自评反馈列表 |
-
请 注册 或 登录 后发表评论