From bc0ca85a2cb201fa598292be633f7ae7c1244d5c Mon Sep 17 00:00:00 2001 From: 2210088963 <2210088963@qq.com> Date: Thu, 13 Feb 2025 17:59:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?hot=5Fspot=E5=92=8Cchannel=5Fdisplay=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4show=5Fapp=E5=AD=97=E6=AE=B5=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=A0=8F=E7=9B=AE=E7=AE=A1=E7=90=86=E7=9A=84=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E6=A0=8F=E7=9B=AE=E5=B1=95=E7=A4=BA=EF=BC=88app?= =?UTF-8?q?=E5=9C=A8=E6=88=90=E5=93=81=E7=8E=B0=E5=9C=BA=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=EF=BC=89=E5=92=8C=E6=9B=B4=E6=96=B0=E6=A0=8F=E7=9B=AE=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=96=B9=E6=B3=95=203.=E4=BF=AE=E6=94=B9=E7=83=AD?= =?UTF-8?q?=E7=82=B9=E6=A6=9C=E9=80=BB=E8=BE=91=E3=80=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E7=83=AD=E7=82=B9=E6=A6=9C=E5=92=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=83=AD=E7=82=B9=E6=A6=9C=E6=96=B9=E6=B3=95=204.?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0LiveSceneEntity=E3=80=81SceneEntityVo?= =?UTF-8?q?=E7=9A=84=E4=B8=A4=E4=B8=AAhot=5Fspot=E5=92=8Cchannel=5Fdisplay?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/add_new_db.sql | 2 +- .../live/controller/LiveSceneController.java | 1 - .../modules/live/dao/LiveChannelDao.java | 9 ++++++++ .../modules/live/dao/LiveSceneDao.java | 7 ++++++- .../platform/modules/live/dto/SceneDTO.java | 2 -- .../modules/live/entity/LiveSceneEntity.java | 21 +++++++++++++++++++ .../service/impl/LiveChannelServiceImpl.java | 11 ++++++++-- .../service/impl/LiveSceneServiceImpl.java | 7 ++++++- .../modules/live/vo/SceneEntityVo.java | 20 ++++++++++++++++++ 9 files changed, 72 insertions(+), 8 deletions(-) diff --git a/sql/add_new_db.sql b/sql/add_new_db.sql index e8aef4c..68bb225 100644 --- a/sql/add_new_db.sql +++ b/sql/add_new_db.sql @@ -37,7 +37,7 @@ VALUES alter table aijinan.live_scene ADD COLUMN hot_spot tinyint(1) DEFAULT '0' COMMENT '是否为热点', - ADD COLUMN tinyint(1) DEFAULT '0' COMMENT '是否为热点'; + ADD COLUMN channel_display tinyint(1) DEFAULT '0' COMMENT '是否为栏目展示'; alter table aijinan.live_scene drop COLUMN show_app; diff --git a/src/main/java/com/platform/modules/live/controller/LiveSceneController.java b/src/main/java/com/platform/modules/live/controller/LiveSceneController.java index e259989..51b5445 100644 --- a/src/main/java/com/platform/modules/live/controller/LiveSceneController.java +++ b/src/main/java/com/platform/modules/live/controller/LiveSceneController.java @@ -758,5 +758,4 @@ public class LiveSceneController extends AbstractController { } - } diff --git a/src/main/java/com/platform/modules/live/dao/LiveChannelDao.java b/src/main/java/com/platform/modules/live/dao/LiveChannelDao.java index 6fad986..0ab8614 100644 --- a/src/main/java/com/platform/modules/live/dao/LiveChannelDao.java +++ b/src/main/java/com/platform/modules/live/dao/LiveChannelDao.java @@ -2,6 +2,7 @@ package com.platform.modules.live.dao; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.baomidou.mybatisplus.plugins.Page; import com.platform.modules.live.entity.LiveChannelEntity; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; /** * 现场栏目信息 @@ -27,4 +29,11 @@ public interface LiveChannelDao extends BaseMapper { List getAllChannelByTenant(@Param("tenantId") Long tenantId); List queryPageMapAll(Page> page, Map params); + + @Update("update live_scene set channel_display = 0 where channels_name = #{channels_name}") + void resetChannelDisplay(String channelName); + + @Update("update live_scene set channel_display = 1 where id = #{sceneId}") + void updateChannelDisplay(Integer sceneId); + } diff --git a/src/main/java/com/platform/modules/live/dao/LiveSceneDao.java b/src/main/java/com/platform/modules/live/dao/LiveSceneDao.java index 0b03ca4..b50f6be 100644 --- a/src/main/java/com/platform/modules/live/dao/LiveSceneDao.java +++ b/src/main/java/com/platform/modules/live/dao/LiveSceneDao.java @@ -44,7 +44,12 @@ public interface LiveSceneDao extends BaseMapper { * */ List querySort(Page page, Map params); - @Select("select ls.id,ls.title,lsc.views_show,ls.show_app from live_scene ls left join live_scene_count lsc on ls.id = lsc.scene_id where ls.scene_state = 2 order by lsc.views_show desc limit #{count};") + @Select("select ls.id,ls.title,lsc.views_show from live_scene ls left join live_scene_count lsc on ls.id = lsc.scene_id where ls.scene_state = 2 order by lsc.views_show desc limit #{count};") List hotList(Integer count); + @Update("UPDATE live_scene SET hot_spot = 0") + void resetHotSpot(); + + @Update("update live_scene set hot_spot = 1 where id = #{id}") + void updateHotSpot(Long id); } diff --git a/src/main/java/com/platform/modules/live/dto/SceneDTO.java b/src/main/java/com/platform/modules/live/dto/SceneDTO.java index a1fe08e..ca6dbc3 100644 --- a/src/main/java/com/platform/modules/live/dto/SceneDTO.java +++ b/src/main/java/com/platform/modules/live/dto/SceneDTO.java @@ -10,14 +10,12 @@ public class SceneDTO implements Serializable { private Long id; // 现场 ID private String title; // 现场标题 private Integer viewsShow; // 展示的观看数量 - private Boolean showApp; // 是否在 APP 上显示 // 构造函数(可选) public SceneDTO(Long id, String title, Integer viewsShow, Boolean showApp) { this.id = id; this.title = title; this.viewsShow = viewsShow; - this.showApp = showApp; } public SceneDTO() { diff --git a/src/main/java/com/platform/modules/live/entity/LiveSceneEntity.java b/src/main/java/com/platform/modules/live/entity/LiveSceneEntity.java index 9492033..6272401 100644 --- a/src/main/java/com/platform/modules/live/entity/LiveSceneEntity.java +++ b/src/main/java/com/platform/modules/live/entity/LiveSceneEntity.java @@ -201,6 +201,27 @@ public class LiveSceneEntity implements Serializable { @ApiModelProperty(value = "VR直播") private Boolean vrLive; // VR直播 + @ApiModelProperty(value = "热点") + private Integer hotSpot; + @ApiModelProperty(value = "栏目展示") + private Integer channelDisplay; + + public Integer getHotSpot() { + return hotSpot; + } + + public void setHotSpot(Integer hotSpot) { + this.hotSpot = hotSpot; + } + + public Integer getChannelDisplay() { + return channelDisplay; + } + + public void setChannelDisplay(Integer channelDisplay) { + this.channelDisplay = channelDisplay; + } + public Boolean getCarouselImage() { return carouselImage; } diff --git a/src/main/java/com/platform/modules/live/service/impl/LiveChannelServiceImpl.java b/src/main/java/com/platform/modules/live/service/impl/LiveChannelServiceImpl.java index ebd44cd..4f614d5 100644 --- a/src/main/java/com/platform/modules/live/service/impl/LiveChannelServiceImpl.java +++ b/src/main/java/com/platform/modules/live/service/impl/LiveChannelServiceImpl.java @@ -380,7 +380,7 @@ private LiveChannelDao liveChannelDao; List collect = channelEntities.stream().map(this::convertToB).collect(Collectors.toList()); // 为每个 ChannelDTO 获取 liveScenes if(CollectionUtils.isNotEmpty(collect)){ - + //遍历查询到的所有现场 collect.forEach(channelDTO -> { // 获取当前频道的所有 LiveSceneChannelEntity List entityList = liveSceneChannelService.selectList( @@ -388,6 +388,7 @@ private LiveChannelDao liveChannelDao; .eq("channel_id", channelDTO.getChannelId()) ); + if(channelDTO.getComponentCount() == null) { LiveChannelComponentEntity channelComponentEntity = liveChannelComponentService.selectOne(new EntityWrapper() .eq("component_type", channelDTO.getComponentType())); @@ -399,7 +400,6 @@ private LiveChannelDao liveChannelDao; Set sceneIds = entityList.stream() .map(LiveSceneChannelEntity::getSceneId) .collect(Collectors.toSet()); - liveSceneEntities = liveSceneService.selectList(new EntityWrapper() .in("id", sceneIds) .eq("delete_flag", 0) @@ -408,6 +408,13 @@ private LiveChannelDao liveChannelDao; .last("limit " + channelDTO.getComponentCount()) ); + //1.重置当前栏目所有现场的channel_display字段为false + liveChannelDao.resetChannelDisplay(channelDTO.getChannelName()); + //2.将所有查询到的现场的channel_display字段设置为true + liveSceneEntities.forEach(liveSceneEntity -> { + liveChannelDao.updateChannelDisplay(liveSceneEntity.getId()); + }); + } // 将 LiveSceneEntity 转换为 LiveSceneDTO diff --git a/src/main/java/com/platform/modules/live/service/impl/LiveSceneServiceImpl.java b/src/main/java/com/platform/modules/live/service/impl/LiveSceneServiceImpl.java index c0664e3..d43823f 100644 --- a/src/main/java/com/platform/modules/live/service/impl/LiveSceneServiceImpl.java +++ b/src/main/java/com/platform/modules/live/service/impl/LiveSceneServiceImpl.java @@ -2903,7 +2903,12 @@ public class LiveSceneServiceImpl extends ServiceImpl hotList(Integer count) { sysConfigService.updateValueByKey("HOT_LIST_DISPLAY_COUNT", String.valueOf(count)); - return liveSceneDao.hotList(count); + List sceneDTOS = liveSceneDao.hotList(count); + liveSceneDao.resetHotSpot(); + sceneDTOS.forEach(sceneDTO -> { + liveSceneDao.updateHotSpot(sceneDTO.getId()); + }); + return sceneDTOS; } diff --git a/src/main/java/com/platform/modules/live/vo/SceneEntityVo.java b/src/main/java/com/platform/modules/live/vo/SceneEntityVo.java index 40840a5..2ccdde2 100644 --- a/src/main/java/com/platform/modules/live/vo/SceneEntityVo.java +++ b/src/main/java/com/platform/modules/live/vo/SceneEntityVo.java @@ -208,6 +208,26 @@ public class SceneEntityVo { /** VR直播 **/ @ApiModelProperty(value = "VR直播") private Boolean vrLive; // VR直播 + @ApiModelProperty(value = "热点") + private Integer hotSpot; + @ApiModelProperty(value = "栏目展示") + private Integer channelDisplay; + + public Integer getHotSpot() { + return hotSpot; + } + + public void setHotSpot(Integer hotSpot) { + this.hotSpot = hotSpot; + } + + public Integer getChannelDisplay() { + return channelDisplay; + } + + public void setChannelDisplay(Integer channelDisplay) { + this.channelDisplay = channelDisplay; + } public Boolean getCarouselImage() { return carouselImage;