1.数据库增加hot_spot和channel_display字段,删除show_app字段
2.修改栏目管理的业务逻辑,增加重置栏目展示(app在成品现场展示)和更新栏目展示方法 3.修改热点榜逻辑、增加重置热点榜和更新热点榜方法 4.增加LiveSceneEntity、SceneEntityVo的两个hot_spot和channel_display字段
This commit is contained in:
parent
2bd2b15685
commit
bc0ca85a2c
@ -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;
|
||||
|
||||
@ -758,5 +758,4 @@ public class LiveSceneController extends AbstractController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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<LiveChannelEntity> {
|
||||
List<LiveChannelEntity> getAllChannelByTenant(@Param("tenantId") Long tenantId);
|
||||
|
||||
List<LiveChannelEntity> queryPageMapAll(Page<Map<String, Object>> page, Map<String, Object> 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);
|
||||
|
||||
}
|
||||
|
||||
@ -44,7 +44,12 @@ public interface LiveSceneDao extends BaseMapper<LiveSceneEntity> {
|
||||
* */
|
||||
List<SceneSortEntityVo> querySort(Page<SceneSortEntityVo> page, Map<String, Object> 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<SceneDTO> 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);
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ private LiveChannelDao liveChannelDao;
|
||||
List<ChannelDTO> collect = channelEntities.stream().map(this::convertToB).collect(Collectors.toList());
|
||||
// 为每个 ChannelDTO 获取 liveScenes
|
||||
if(CollectionUtils.isNotEmpty(collect)){
|
||||
|
||||
//遍历查询到的所有现场
|
||||
collect.forEach(channelDTO -> {
|
||||
// 获取当前频道的所有 LiveSceneChannelEntity
|
||||
List<LiveSceneChannelEntity> 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<LiveChannelComponentEntity>()
|
||||
.eq("component_type", channelDTO.getComponentType()));
|
||||
@ -399,7 +400,6 @@ private LiveChannelDao liveChannelDao;
|
||||
Set<Integer> sceneIds = entityList.stream()
|
||||
.map(LiveSceneChannelEntity::getSceneId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
liveSceneEntities = liveSceneService.selectList(new EntityWrapper<LiveSceneEntity>()
|
||||
.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
|
||||
|
||||
@ -2903,7 +2903,12 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
|
||||
@Override
|
||||
public List<SceneDTO> hotList(Integer count) {
|
||||
sysConfigService.updateValueByKey("HOT_LIST_DISPLAY_COUNT", String.valueOf(count));
|
||||
return liveSceneDao.hotList(count);
|
||||
List<SceneDTO> sceneDTOS = liveSceneDao.hotList(count);
|
||||
liveSceneDao.resetHotSpot();
|
||||
sceneDTOS.forEach(sceneDTO -> {
|
||||
liveSceneDao.updateHotSpot(sceneDTO.getId());
|
||||
});
|
||||
return sceneDTOS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user