正在显示
2 个修改的文件
包含
58 行增加
和
19 行删除
@@ -478,14 +478,12 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | @@ -478,14 +478,12 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | ||
478 | assessDao := dao.NewStaffAssessDao(map[string]interface{}{ | 478 | assessDao := dao.NewStaffAssessDao(map[string]interface{}{ |
479 | "transactionContext": transactionContext, | 479 | "transactionContext": transactionContext, |
480 | }) | 480 | }) |
481 | - contentList, err := assessDao.ExportDataUserAssess(dao.SearchConditin1{ | 481 | + contentList, err := assessDao.ExportDataUserAssessV2(dao.SearchConditin2{ |
482 | CompanyId: param.CompanyId, | 482 | CompanyId: param.CompanyId, |
483 | CycleId: param.CycleId, | 483 | CycleId: param.CycleId, |
484 | - BeginDay: "", | 484 | + BeginDayList: param.BeginDayList, |
485 | TargetUserName: param.TargetUserName, | 485 | TargetUserName: param.TargetUserName, |
486 | TargetUserId: param.TargetUserId, | 486 | TargetUserId: param.TargetUserId, |
487 | - Limit: 5000, | ||
488 | - Offset: 0, | ||
489 | OperaterId: param.OperaterId, | 487 | OperaterId: param.OperaterId, |
490 | Hrbp: hrbp, | 488 | Hrbp: hrbp, |
491 | }) | 489 | }) |
@@ -501,11 +499,7 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | @@ -501,11 +499,7 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | ||
501 | for _, v := range param.ExportItems { | 499 | for _, v := range param.ExportItems { |
502 | includeCol[v.Category+"+"+v.Name] = struct{}{} | 500 | includeCol[v.Category+"+"+v.Name] = struct{}{} |
503 | } | 501 | } |
504 | - includeBeginDay := map[string]struct{}{} | ||
505 | - for _, v := range param.BeginDayList { | ||
506 | - includeBeginDay[v] = struct{}{} | ||
507 | - } | ||
508 | - | 502 | + //过滤日期 |
509 | eData := newExportData2() | 503 | eData := newExportData2() |
510 | eData.setData(contentList) | 504 | eData.setData(contentList) |
511 | //将数据写入xlsx | 505 | //将数据写入xlsx |
@@ -523,11 +517,6 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | @@ -523,11 +517,6 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | ||
523 | rowNum := 0 | 517 | rowNum := 0 |
524 | for _, v := range eData.rowSort.Child { | 518 | for _, v := range eData.rowSort.Child { |
525 | //纵向-索引-第一列-日期 | 519 | //纵向-索引-第一列-日期 |
526 | - if len(includeBeginDay) > 0 { | ||
527 | - if _, ok := includeBeginDay[v.Name]; !ok { | ||
528 | - continue | ||
529 | - } | ||
530 | - } | ||
531 | for _, v2 := range v.Child { | 520 | for _, v2 := range v.Child { |
532 | //纵向-索引-第二列-员工id | 521 | //纵向-索引-第二列-员工id |
533 | //填充1,2 列 | 522 | //填充1,2 列 |
@@ -572,11 +561,6 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | @@ -572,11 +561,6 @@ func (srv *StaffAssessServeice) ExportUserAssess(param *query.ExportAssessConten | ||
572 | rowNum = 0 | 561 | rowNum = 0 |
573 | for _, v4 := range eData.rowSort.Child { | 562 | for _, v4 := range eData.rowSort.Child { |
574 | //纵向-索引-第一列-日期 | 563 | //纵向-索引-第一列-日期 |
575 | - if len(includeBeginDay) > 0 { | ||
576 | - if _, ok := includeBeginDay[v4.Name]; !ok { | ||
577 | - continue | ||
578 | - } | ||
579 | - } | ||
580 | for _, v5 := range v4.Child { | 564 | for _, v5 := range v4.Child { |
581 | //纵向-索引-第二列-员工id | 565 | //纵向-索引-第二列-员工id |
582 | rowNum++ | 566 | rowNum++ |
@@ -205,3 +205,58 @@ func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserI | @@ -205,3 +205,58 @@ func (d *StaffAssessDao) SearchTargetUserCycleProject(companyId int, targetUserI | ||
205 | _, err := tx.Query(&result, sqlStr, condition...) | 205 | _, err := tx.Query(&result, sqlStr, condition...) |
206 | return result, err | 206 | return result, err |
207 | } | 207 | } |
208 | + | ||
209 | +type SearchConditin2 struct { | ||
210 | + CompanyId int //公司id | ||
211 | + CycleId int //周期id | ||
212 | + BeginDayList []string //评估的日期 | ||
213 | + TargetUserName string //被评估人的名称 | ||
214 | + TargetUserId []string //查询指定的人 | ||
215 | + OperaterId int //用户的id是谁在搜索数据 | ||
216 | + Hrbp int // | ||
217 | +} | ||
218 | + | ||
219 | +// 项目管理-成员列表 导出数据 | ||
220 | +func (d *StaffAssessDao) ExportDataUserAssessV2(param SearchConditin2) ([]ExportData1, error) { | ||
221 | + withSql := d.catchProjectIdByPermission(param.CompanyId, param.CycleId, param.OperaterId, param.Hrbp) | ||
222 | + sqlStr := `select | ||
223 | + staff_assess.target_user->>'userId' as target_user_id , | ||
224 | + staff_assess.target_user->>'userName' as target_user_name , | ||
225 | + to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') as begin_day, | ||
226 | + staff_assess.id as assess_id, | ||
227 | + staff_assess.cycle_id, | ||
228 | + staff_assess.cycle_name, | ||
229 | + staff_assess_content.id as content_id, | ||
230 | + staff_assess_content.value , | ||
231 | + staff_assess_content.sort_by , | ||
232 | + staff_assess_content.category , | ||
233 | + staff_assess_content."name" as content_name , | ||
234 | + staff_assess_content.weight, | ||
235 | + staff_assess_content.prompt_text , | ||
236 | + staff_assess_content.remark | ||
237 | +from staff_assess | ||
238 | +join t_project_4 on staff_assess.evaluation_project_id =t_project_4.project_id | ||
239 | +left join staff_assess_content on staff_assess.id = staff_assess_content.staff_assess_id | ||
240 | +where 1=1 | ||
241 | +and staff_assess."types" ='self' | ||
242 | +` | ||
243 | + condition := []interface{}{} | ||
244 | + if len(param.TargetUserName) > 0 { | ||
245 | + condition = append(condition, "%"+param.TargetUserName+"%") | ||
246 | + sqlStr += ` and staff_assess.target_user->>'userName' like ? ` | ||
247 | + } | ||
248 | + if len(param.BeginDayList) > 0 { | ||
249 | + condition = append(condition, pg.In(param.BeginDayList)) | ||
250 | + sqlStr += ` and to_char(staff_assess.begin_time at time zone 'PRC','YYYY-MM-DD') in(?) ` | ||
251 | + } | ||
252 | + if len(param.TargetUserId) > 0 { | ||
253 | + condition = append(condition, pg.In(param.TargetUserId)) | ||
254 | + sqlStr += ` and staff_assess.target_user->>'userId' in (?) ` | ||
255 | + } | ||
256 | + | ||
257 | + sqlStr = withSql + sqlStr + ` order by convert_to(staff_assess.target_user->>'userName','GBK'),begin_day,staff_assess_content.sort_by ` | ||
258 | + tx := d.transactionContext.PgTx | ||
259 | + var result []ExportData1 | ||
260 | + _, err := tx.Query(&result, sqlStr, condition...) | ||
261 | + return result, err | ||
262 | +} |
-
请 注册 或 登录 后发表评论