作者 tangxvhui

更新

@@ -72,7 +72,7 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl @@ -72,7 +72,7 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl
72 return result, nil 72 return result, nil
73 } 73 }
74 74
75 -// 根据周期id和日期获取 员工填写评估内容 75 +// 根据周期id和日期获取 员工填写评估内容;项目管理-成员列表
76 // 有过滤查看权限 76 // 有过滤查看权限
77 func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) { 77 func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) {
78 transactionContext, err := factory.CreateTransactionContext(nil) 78 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -579,3 +579,33 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten @@ -579,3 +579,33 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten
579 xlsxFile.MergeCell(sheetName, "A1", colName+"1") 579 xlsxFile.MergeCell(sheetName, "A1", colName+"1")
580 return xlsxFile, nil 580 return xlsxFile, nil
581 } 581 }
  582 +
  583 +// 根据周期id和日期获取 员工填写评估内容;项目管理-成员列表
  584 +// 有过滤查看权限
  585 +// func (srv StaffAssessServeice) ListUserAssessContentCycleDayV2(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) {
  586 +// transactionContext, err := factory.CreateTransactionContext(nil)
  587 +// if err != nil {
  588 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  589 +// }
  590 +// if err := transactionContext.StartTransaction(); err != nil {
  591 +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  592 +// }
  593 +// defer func() {
  594 +// _ = transactionContext.RollbackTransaction()
  595 +// }()
  596 +// hrbp, err := srv.getHRBP(transactionContext, param.CompanyId, param.OperaterId)
  597 +// if err != nil {
  598 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  599 +// }
  600 +
  601 +// assessDao := dao.NewStaffAssessDao(map[string]interface{}{
  602 +// "transactionContext": transactionContext,
  603 +// })
  604 +
  605 +// limit := param.PageSize
  606 +// offset := (param.PageNumber - 1) * limit
  607 +// if err := transactionContext.CommitTransaction(); err != nil {
  608 +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  609 +// }
  610 +// return nil, nil
  611 +// }
@@ -297,3 +297,54 @@ func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, begi @@ -297,3 +297,54 @@ func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, begi
297 _, err := tx.Query(&result, sqlStr, condition...) 297 _, err := tx.Query(&result, sqlStr, condition...)
298 return result, err 298 return result, err
299 } 299 }
  300 +
  301 +// 根据周期的id和日期获取员工评估的评估任务。有进行查看权限过滤
  302 +// companyId int 公司id
  303 +// cycleId int, 评估周期id
  304 +// userId int, 用户id,谁要查看数据
  305 +// beginDay string, 周期中执行项目的时间
  306 +// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
  307 +// limit int, 分页条数
  308 +// offset int 分页偏移
  309 +func (d *StaffAssessDao) SearchUserStaffAssess(param SearchConditin1) ([]UserAssessContent, error) {
  310 + withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
  311 + sqlStr := `select
  312 + staff_assess.cycle_id ,
  313 + staff_assess.id as assess_id,
  314 + staff_assess.target_user ->>'userId' as target_user_id,
  315 + staff_assess.target_user ->>'userName' as target_user_name,
  316 + staff_assess.evaluation_project_id ,
  317 + staff_assess.evaluation_project_name ,
  318 + staff_assess.company_id ,
  319 + staff_assess.begin_time
  320 + from staff_assess
  321 + join evaluation_project on staff_assess.evaluation_project_id =evaluation_project.id
  322 + where 1=1
  323 + and staff_assess.cycle_id =?
  324 + and staff_assess.deleted_at isnull
  325 + `
  326 + condition := []interface{}{param.CycleId}
  327 + if len(param.BeginDay) > 0 {
  328 + condition = append(condition, param.BeginDay)
  329 + sqlStr += ` and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')=? `
  330 + }
  331 + if len(param.TargetUserName) > 0 {
  332 + condition = append(condition, "%"+param.TargetUserName+"%")
  333 + sqlStr += ` and staff_assess.target_user ->>'userName' like ? `
  334 + }
  335 + if len(param.TargetUserId) > 0 {
  336 + condition = append(condition, pg.In(param.TargetUserId))
  337 + sqlStr += ` and staff_assess.target_user ->>'userId' in (?) `
  338 + }
  339 + condition = append(condition, param.Limit, param.Offset)
  340 + sqlStr += ` order by convert_to(staff_assess.target_user ->>'userName','GBK') limit ? offset ? `
  341 +
  342 + sqlStr2 := withSql + withSql
  343 + // and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')='2023-03-29'
  344 + _ = sqlStr2
  345 + // and staff_assess.cycle_id =1639084510698016768
  346 + // -- and staff_assess.target_user ->>'userName' like '%陈%'
  347 + // -- and staff_assess.target_user ->>'userId' in ('')
  348 + // order by convert_to(staff_assess.target_user ->>'userName','GBK')
  349 + return nil, nil
  350 +}