作者 tangxvhui

更新

... ... @@ -72,7 +72,7 @@ func (srv StaffAssessServeice) ListAllAssessCycleDay(param *query.ListAssessCycl
return result, nil
}
// 根据周期id和日期获取 员工填写评估内容
// 根据周期id和日期获取 员工填写评估内容;项目管理-成员列表
// 有过滤查看权限
func (srv StaffAssessServeice) ListUserAssessContentCycleDay(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
... ... @@ -579,3 +579,33 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten
xlsxFile.MergeCell(sheetName, "A1", colName+"1")
return xlsxFile, nil
}
// 根据周期id和日期获取 员工填写评估内容;项目管理-成员列表
// 有过滤查看权限
// func (srv StaffAssessServeice) ListUserAssessContentCycleDayV2(param *query.ListAssessContentCycleDay) (*adapter.ListUserAssessContent, error) {
// transactionContext, err := factory.CreateTransactionContext(nil)
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// if err := transactionContext.StartTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// defer func() {
// _ = transactionContext.RollbackTransaction()
// }()
// hrbp, err := srv.getHRBP(transactionContext, param.CompanyId, param.OperaterId)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// assessDao := dao.NewStaffAssessDao(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// limit := param.PageSize
// offset := (param.PageNumber - 1) * limit
// if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// return nil, nil
// }
... ...
... ... @@ -297,3 +297,54 @@ func (d *StaffAssessDao) ListTargetUserNoInvite(companyId int, cycleId int, begi
_, err := tx.Query(&result, sqlStr, condition...)
return result, err
}
// 根据周期的id和日期获取员工评估的评估任务。有进行查看权限过滤
// companyId int 公司id
// cycleId int, 评估周期id
// userId int, 用户id,谁要查看数据
// beginDay string, 周期中执行项目的时间
// hrbp 是否搜索HRBP角色的用户可以查看,1:是;-1:否
// limit int, 分页条数
// offset int 分页偏移
func (d *StaffAssessDao) SearchUserStaffAssess(param SearchConditin1) ([]UserAssessContent, error) {
withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp)
sqlStr := `select
staff_assess.cycle_id ,
staff_assess.id as assess_id,
staff_assess.target_user ->>'userId' as target_user_id,
staff_assess.target_user ->>'userName' as target_user_name,
staff_assess.evaluation_project_id ,
staff_assess.evaluation_project_name ,
staff_assess.company_id ,
staff_assess.begin_time
from staff_assess
join evaluation_project on staff_assess.evaluation_project_id =evaluation_project.id
where 1=1
and staff_assess.cycle_id =?
and staff_assess.deleted_at isnull
`
condition := []interface{}{param.CycleId}
if len(param.BeginDay) > 0 {
condition = append(condition, param.BeginDay)
sqlStr += ` and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')=? `
}
if len(param.TargetUserName) > 0 {
condition = append(condition, "%"+param.TargetUserName+"%")
sqlStr += ` and staff_assess.target_user ->>'userName' like ? `
}
if len(param.TargetUserId) > 0 {
condition = append(condition, pg.In(param.TargetUserId))
sqlStr += ` and staff_assess.target_user ->>'userId' in (?) `
}
condition = append(condition, param.Limit, param.Offset)
sqlStr += ` order by convert_to(staff_assess.target_user ->>'userName','GBK') limit ? offset ? `
sqlStr2 := withSql + withSql
// and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD')='2023-03-29'
_ = sqlStr2
// and staff_assess.cycle_id =1639084510698016768
// -- and staff_assess.target_user ->>'userName' like '%陈%'
// -- and staff_assess.target_user ->>'userId' in ('')
// order by convert_to(staff_assess.target_user ->>'userName','GBK')
return nil, nil
}
... ...