From afa0dbb4f54e7244835dd67ec33c3e545f122f71 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 17 一月 2025 16:40:43 +0800 Subject: [PATCH] bug修改 --- ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 48 insertions(+), 11 deletions(-) diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java index bb1426b..708299f 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java @@ -16,7 +16,6 @@ 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; @@ -88,11 +87,13 @@ //根据直播类型过滤平台和店铺直播 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; } @@ -129,6 +130,7 @@ 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")) { @@ -186,7 +188,10 @@ //当前商家创建的直播 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; } @@ -269,17 +274,26 @@ * @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; } @@ -294,4 +308,27 @@ 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; + } } -- Gitblit v1.7.1