| | |
| | | import com.ruoyi.goods.domain.pojo.live.XiaoeLiveRecord; |
| | | import com.ruoyi.goods.domain.vo.XiaoeLiveDetailVOV2; |
| | | import com.ruoyi.goods.domain.vo.XiaoeLiveVo; |
| | | import com.ruoyi.goods.domain.vo.XiaoeLiveVoV2; |
| | | import com.ruoyi.goods.service.live.IXiaoeLiveAppointmentService; |
| | | import com.ruoyi.goods.service.live.IXiaoeLiveRecordService; |
| | | import com.ruoyi.goods.utils.XiaoeUtils; |
| | |
| | | //根据直播类型过滤平台和店铺直播 |
| | | if (Objects.nonNull(dto.getLiveType())) { |
| | | List<XiaoeLiveRecord> liveRecordList = xiaoeLiveRecordService.lambdaQuery().eq(XiaoeLiveRecord::getType, dto.getLiveType()).list(); |
| | | if (CollUtil.isNotEmpty(liveRecordList)) { |
| | | List<String> liveIdList = liveRecordList.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toList()); |
| | | filteredRecords = filteredRecords.stream().filter(item -> liveIdList.contains(item.getId())).collect(Collectors.toList()); |
| | | if (CollUtil.isEmpty(liveRecordList)) { |
| | | return new Page<>(); |
| | | } |
| | | List<String> liveIdList = liveRecordList.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toList()); |
| | | filteredRecords = filteredRecords.stream().filter(item -> liveIdList.contains(item.getId())).collect(Collectors.toList()); |
| | | } |
| | | |
| | | livePageList.setRecords(filteredRecords); |
| | | return livePageList; |
| | | } |
| | |
| | | Date aliveStartAt = DateUtil.parse(liveDetail.getAliveStartAt(), DatePattern.NORM_DATETIME_PATTERN); |
| | | xiaoeLiveAppointment.setAliveStartAt(aliveStartAt); |
| | | xiaoeLiveAppointment.setCreateTime(DateUtils.getNowDate()); |
| | | xiaoeLiveAppointment.setTitle(liveDetail.getTitle()); |
| | | xiaoeLiveAppointmentService.save(xiaoeLiveAppointment); |
| | | /// 若为C端用户向 redis 添加预约记录 |
| | | if (sysUser.getUserType().equals("03")) { |
| | |
| | | //当前商家创建的直播 |
| | | Set<String> liveIdSet = xiaoeLiveRecordList.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toSet()); |
| | | //过滤数据 |
| | | List<XiaoeLiveVo> filteredRecords = livePageList.getRecords().stream().filter(item -> liveIdSet.contains(item.getId()) && !item.getAliveState().equals(2)).collect(Collectors.toList()); |
| | | List<XiaoeLiveVo> filteredRecords = livePageList.getRecords().stream() |
| | | .filter(item -> liveIdSet.contains(item.getId()) && !item.getAliveState().equals(2)) |
| | | // 按照直播状态排序 |
| | | .sorted(Comparator.comparing(XiaoeLiveVo::getAliveState).reversed()).collect(Collectors.toList()); |
| | | livePageList.setRecords(filteredRecords); |
| | | return livePageList; |
| | | } |
| | |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | public Page<XiaoeLiveVoV2> getMgtLivePage(XiaoeLiveQueryDto dto) { |
| | | Page<XiaoeLiveVoV2> livePageList = xiaoeUtils.getLivePageListV2(dto); |
| | | public Page<XiaoeLiveVo> getMgtLivePage(XiaoeLiveQueryDto dto) { |
| | | Page<XiaoeLiveVo> livePageList = xiaoeUtils.getLivePageList(dto); |
| | | Long shopId = dto.getShopId(); |
| | | if (Objects.nonNull(shopId)) { |
| | | List<XiaoeLiveRecord> xiaoeLiveRecords = xiaoeLiveRecordService.getListByShopId(shopId); |
| | | if (CollUtil.isNotEmpty(xiaoeLiveRecords)) { |
| | | List<String> liveIdList = xiaoeLiveRecords.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toList()); |
| | | List<XiaoeLiveVoV2> filteredList = livePageList.getRecords().stream().filter(item -> liveIdList.contains(item.getId())).collect(Collectors.toList()); |
| | | livePageList.setRecords(filteredList); |
| | | if (CollUtil.isEmpty(xiaoeLiveRecords)) { |
| | | return new Page<>(); |
| | | } |
| | | List<String> liveIdList = xiaoeLiveRecords.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toList()); |
| | | List<XiaoeLiveVo> filteredList = livePageList.getRecords().stream().filter(item -> liveIdList.contains(item.getId())).collect(Collectors.toList()); |
| | | livePageList.setRecords(filteredList); |
| | | } |
| | | List<XiaoeLiveRecord> shopRecordList = xiaoeLiveRecordService.lambdaQuery().eq(XiaoeLiveRecord::getType, 2).list(); |
| | | Map<String, String> shopNameMap = shopRecordList.stream().collect(Collectors.toMap(XiaoeLiveRecord::getLiveId, XiaoeLiveRecord::getShopName)); |
| | | livePageList.setRecords(livePageList.getRecords().stream().peek(item -> { |
| | | String name = shopNameMap.get(item.getId()); |
| | | if (StringUtils.isNotBlank(name)) { |
| | | item.setShopName(name); |
| | | } |
| | | }).collect(Collectors.toList())); |
| | | return livePageList; |
| | | } |
| | | |
| | |
| | | xiaoeLiveRecordService.lambdaUpdate().eq(XiaoeLiveRecord::getLiveId, id).remove(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 员工端直播列表 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | public Page<XiaoeLiveVo> getStaffLivePage(XiaoeLiveQueryDto dto) { |
| | | Page<XiaoeLiveVo> page = new Page<>(); |
| | | List<XiaoeLiveRecord> xiaoeLiveRecordList = xiaoeLiveRecordService.getMgtRecord(); |
| | | if (CollectionUtil.isEmpty(xiaoeLiveRecordList)) { |
| | | return page; |
| | | } |
| | | Page<XiaoeLiveVo> livePageList = xiaoeUtils.getLivePageList(dto); |
| | | if (CollectionUtil.isEmpty(livePageList.getRecords())) { |
| | | return page; |
| | | } |
| | | //筛选平台创建的直播 |
| | | Set<String> liveIdSet = xiaoeLiveRecordList.stream().map(XiaoeLiveRecord::getLiveId).collect(Collectors.toSet()); |
| | | //过滤数据 |
| | | List<XiaoeLiveVo> filteredRecords = livePageList.getRecords().stream().filter(item -> liveIdSet.contains(item.getId()) && !item.getAliveState().equals(2)).collect(Collectors.toList()); |
| | | livePageList.setRecords(filteredRecords); |
| | | return livePageList; |
| | | } |
| | | } |