mitao
2025-01-12 0f9fdb03e866a21b9242d5ad8d65ca9359e1950f
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/biz/XiaoeLiveService.java
@@ -1,5 +1,6 @@
package com.ruoyi.goods.service.biz;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
@@ -81,6 +82,14 @@
        return livePageList;
    }
    /**
     * 直播详情
     * @param id
     * @return
     */
    public XiaoeLiveVo getLiveDetail(String id) {
        return xiaoeUtils.getLiveDetail(id);
    }
    /**
     * 预约直播
     * @param id
@@ -245,5 +254,34 @@
        return xiaoeUtils.editLive(dto);
    }
    /**
     * 管理后台直播分页列表
     * @param dto
     * @return
     */
    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<XiaoeLiveVo> filteredList = livePageList.getRecords().stream().filter(item -> liveIdList.contains(item.getId())).collect(Collectors.toList());
                livePageList.setRecords(filteredList);
            }
        }
        return livePageList;
    }
    /**
     * 删除直播
     * @param id
     */
    public void deleteLive(String id) {
        Boolean flag = xiaoeUtils.deleteLive(id);
        if (flag) {
            //删除直播添加记录
            xiaoeLiveRecordService.lambdaUpdate().eq(XiaoeLiveRecord::getLiveId, id).remove();
        }
    }
}