1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| @Override public Page<SendRecordListDTO> sendRecordList(SendRecordListQueryDTO dto) { QueryWrapper<RoomReportStatisticsEntity> lqw = new QueryWrapper<>(); lqw.eq("rrs.wx_corp_id", dto.getWxCorpId()); if (StrUtil.isNotEmpty(dto.getRoomName())) { lqw.like("rrs.room_name", dto.getRoomName()); } if (StrUtil.isNotEmpty(dto.getPrincipalName())) { lqw.like("rrs.principal_user_name", dto.getPrincipalName()); } List<OrderItem> orders = dto.getOrders(); if (ObjUtil.isNotEmpty(orders)) { for (OrderItem order : orders) { if (order.isAsc()) { if ("sendCount".equals(order.getColumn())) { lqw.orderByAsc("rrs.have_send_total"); } else if ("pushTime".equals(order.getColumn())) { lqw.orderByAsc("rrs.last_push_time"); } else if ("sendDate".equals(order.getColumn())) { lqw.orderByAsc("rrs.last_send_time"); } } else { if ("sendCount".equals(order.getColumn())) { lqw.orderByDesc("rrs.have_send_total"); } else if ("pushTime".equals(order.getColumn())) { lqw.orderByDesc("rrs.last_push_time"); } else if ("sendDate".equals(order.getColumn())) { lqw.orderByDesc("rrs.last_send_time"); } } } } else { lqw.orderByDesc("rrs.last_push_time"); } Integer dateSearchType = dto.getDateSearchType(); String beginDate = dto.getBeginDate(); String endDate = dto.getEndDate(); if (ObjUtil.isNotNull(dateSearchType) && StrUtil.isNotEmpty(beginDate) && StrUtil.isNotEmpty(endDate)) { if (1 == dateSearchType) { lqw.gt("rrs.last_push_time", beginDate); lqw.lt("rrs.last_push_time", endDate); } else { lqw.gt("rrs.last_send_time", beginDate); lqw.lt("rrs.last_send_time", endDate); } } Page<RoomReportStatisticsEntity> page = new Page<>(dto.getCurrent(), dto.getSize()); List<SendRecordListDTO> resList = Lists.newArrayList();
Page<RoomReportStatisticsEntity> pageResult = roomReportStatisticsService.selectEntityPage( lqw, dateSearchType, beginDate, endDate, page ); log.info("pageResult -> {}", pageResult); if (ObjUtil.isNotEmpty(pageResult)) { List<RoomReportStatisticsEntity> records = pageResult.getRecords(); if (ObjUtil.isNotEmpty(records)) { records.forEach(r -> { SendRecordListDTO sendRecordListDTO = new SendRecordListDTO(); sendRecordListDTO.setRoomId(r.getRoomId()); sendRecordListDTO.setRoomName(r.getRoomName()); sendRecordListDTO.setProjectName(r.getSopName()); sendRecordListDTO.setStepTaskName(r.getSopCurrentStep()); sendRecordListDTO.setPrincipalUserId(r.getPrincipalUserId()); sendRecordListDTO.setPrincipalName(r.getPrincipalUserName()); sendRecordListDTO.setTemplateTypeCount(r.getNeedSendTotal()); sendRecordListDTO.setSendCount(r.getHaveSendTotal()); sendRecordListDTO.setPushTime(r.getLastPushTime()); sendRecordListDTO.setSendDate(r.getLastSendTime()); resList.add(sendRecordListDTO); }); } } Page<SendRecordListDTO> resPage = new Page<>(dto.getCurrent(), dto.getSize()); resPage.setTotal(pageResult.getTotal()); resPage.setRecords(resList); return resPage; }
|