1.修改新建现场的save方法,只现场栏目存在只取第一个

2.livesceneEntity设置默认值ViewerCount、LikeDisplay为false
This commit is contained in:
2210088963 2025-02-07 18:18:25 +08:00
parent 5b5b314166
commit d1a0d75733
2 changed files with 10 additions and 5 deletions

View File

@ -335,10 +335,10 @@ public class LiveSceneEntity implements Serializable {
this.setCarouselImage(false); // 默认 false
}
if (this.getViewerCount() == null) {
this.setViewerCount(true); // 默认 true
this.setViewerCount(false); // 默认 false
}
if (this.getLikeDisplay() == null) {
this.setLikeDisplay(true); // 默认 true
this.setLikeDisplay(false); // 默认 false
}
if (this.getVrLive() == null) {
this.setVrLive(false); // 默认 false

View File

@ -305,7 +305,10 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
entity.setSceneState(SceneConstants.SCENE_ONE);
entity.setSubmitDate(currDate);
}
entity.setChannelsName((liveScene.getChannelNameList()==null || liveScene.getChannelNameList().size()==0) ? null : StringUtils.join(liveScene.getChannelNameList().toArray(), ","));
entity.setChannelsName(Optional.ofNullable(liveScene.getChannelNameList())
.filter(list -> !list.isEmpty())
.map(list -> list.get(0))
.orElse(null));
this.baseMapper.insert(entity);
LiveSceneCountEntity liveSceneCountEntity = new LiveSceneCountEntity();
@ -2838,7 +2841,7 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
EntityWrapper<LiveSceneEntity> wrapper = new EntityWrapper<>();
// 添加查询条件scene_state = 2
wrapper.eq("scene_state", SceneConstants.SCENE_PROD.intValue());
wrapper.eq("scene_state", SceneConstants.SCENE_PROD);
// 调用 selectCount 方法统计符合条件的行数
Long count = (long) selectCount(wrapper);
@ -2854,7 +2857,9 @@ public class LiveSceneServiceImpl extends ServiceImpl<LiveSceneDao, LiveSceneEnt
result.add(sum);
//3.统计总观看人数
List<LiveSceneCountEntity> countEntities = liveSceneCountService.selectList(null);
EntityWrapper<LiveSceneCountEntity> countWrapper = new EntityWrapper<>();
countWrapper.eq("scene_state", SceneConstants.SCENE_PROD);
List<LiveSceneCountEntity> countEntities = liveSceneCountService.selectList(countWrapper);
long sumViews = countEntities.stream().mapToLong(LiveSceneCountEntity::getViewsShow).sum();
result.add(sumViews);
return result;