Ver Fonte

直播代码提交

yuhongqi há 1 semana atrás
pai
commit
8abe9e59d8
31 ficheiros alterados com 395 adições e 45 exclusões
  1. 10 0
      fs-admin/src/main/java/com/fs/live/controller/LiveAutoTaskController.java
  2. 8 0
      fs-admin/src/main/java/com/fs/live/controller/LiveMsgController.java
  3. 10 0
      fs-company/src/main/java/com/fs/company/controller/live/LiveAutoTaskController.java
  4. 13 0
      fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java
  5. 8 0
      fs-company/src/main/java/com/fs/company/controller/live/LiveMsgController.java
  6. 12 6
      fs-live-app/src/main/java/com/fs/live/task/Task.java
  7. 52 3
      fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java
  8. 1 0
      fs-service/src/main/java/com/fs/live/domain/Live.java
  9. 5 1
      fs-service/src/main/java/com/fs/live/domain/LiveMsg.java
  10. 4 0
      fs-service/src/main/java/com/fs/live/domain/LiveWatchUser.java
  11. 4 0
      fs-service/src/main/java/com/fs/live/mapper/LiveAutoTaskMapper.java
  12. 6 0
      fs-service/src/main/java/com/fs/live/mapper/LiveMapper.java
  13. 2 0
      fs-service/src/main/java/com/fs/live/mapper/LiveMsgMapper.java
  14. 12 5
      fs-service/src/main/java/com/fs/live/mapper/LiveWatchUserMapper.java
  15. 93 0
      fs-service/src/main/java/com/fs/live/param/LiveDataParam.java
  16. 4 0
      fs-service/src/main/java/com/fs/live/service/ILiveAutoTaskService.java
  17. 3 0
      fs-service/src/main/java/com/fs/live/service/ILiveDataService.java
  18. 3 1
      fs-service/src/main/java/com/fs/live/service/ILiveMsgService.java
  19. 2 0
      fs-service/src/main/java/com/fs/live/service/ILiveService.java
  20. 4 0
      fs-service/src/main/java/com/fs/live/service/ILiveWatchUserService.java
  21. 15 1
      fs-service/src/main/java/com/fs/live/service/impl/LiveAutoTaskServiceImpl.java
  22. 21 16
      fs-service/src/main/java/com/fs/live/service/impl/LiveDataServiceImpl.java
  23. 5 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveMsgServiceImpl.java
  24. 10 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java
  25. 13 0
      fs-service/src/main/java/com/fs/live/service/impl/LiveWatchUserServiceImpl.java
  26. 6 0
      fs-service/src/main/java/com/fs/live/vo/LiveWatchUserVO.java
  27. 16 0
      fs-service/src/main/resources/mapper/live/LiveAutoTaskMapper.xml
  28. 9 4
      fs-service/src/main/resources/mapper/live/LiveMapper.xml
  29. 10 0
      fs-service/src/main/resources/mapper/live/LiveMsgMapper.xml
  30. 22 8
      fs-service/src/main/resources/mapper/live/LiveWatchUserMapper.xml
  31. 12 0
      fs-user-app/src/main/java/com/fs/app/controller/live/LiveMsgController.java

+ 10 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveAutoTaskController.java

@@ -66,6 +66,16 @@ public class LiveAutoTaskController extends BaseController
         return getDataTable(list);
     }
 
+    @PreAuthorize("@ss.hasPermi('live:task:list')")
+    @GetMapping("/consoleList")
+    public TableDataInfo consoleList(LiveAutoTask liveAutoTask)
+    {
+        startPage();
+        // 大屏查询后面20条数据
+        List<LiveAutoTask> list = liveAutoTaskService.consoleList(liveAutoTask.getLiveId());
+        return getDataTable(list);
+    }
+
     /**
      * 导出直播间自动化任务配置列表
      */

+ 8 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveMsgController.java

@@ -39,6 +39,14 @@ public class LiveMsgController extends BaseController
         return getDataTable(list);
     }
 
+    @GetMapping("/singleList")
+    public TableDataInfo singleList(LiveMsg liveMsg)
+    {
+        startPage();
+        List<LiveMsg> list = liveMsgService.selectLiveMsgSingleList(liveMsg);
+        return getDataTable(list);
+    }
+
     /**
      * 导出直播讨论列表
      */

+ 10 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveAutoTaskController.java

@@ -54,6 +54,16 @@ public class LiveAutoTaskController extends BaseController
         List<LiveAutoTask> list = liveAutoTaskService.selectLiveAutoTaskList(liveAutoTask);
         return getDataTable(list);
     }
+
+    @PreAuthorize("@ss.hasPermi('live:task:list')")
+    @GetMapping("/consoleList")
+    public TableDataInfo consoleList(LiveAutoTask liveAutoTask)
+    {
+        startPage();
+        // 大屏查询后面20条数据
+        List<LiveAutoTask> list = liveAutoTaskService.consoleList(liveAutoTask.getLiveId());
+        return getDataTable(list);
+    }
     /**
      * 查询直播间自动化任务配置列表
      */

+ 13 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveDataController.java

@@ -11,6 +11,7 @@ import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.framework.service.TokenService;
 import com.fs.live.domain.LiveData;
+import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.vo.ColumnsConfigVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -58,6 +59,18 @@ public class LiveDataController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询新直播数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:list')")
+    @PostMapping("/listLiveData")
+    public R listLiveData(@RequestBody LiveDataParam param, HttpServletRequest request)
+    {
+        param.setCompanyId(tokenService.getLoginUser(request).getUser().getCompanyId());
+        startPage();
+        return liveDataService.listLiveData(param);
+    }
+
     /**
      * 导出直播数据列表
      */

+ 8 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveMsgController.java

@@ -40,6 +40,14 @@ public class LiveMsgController extends BaseController
         return getDataTable(list);
     }
 
+    @GetMapping("/singleList")
+    public TableDataInfo singleList(LiveMsg liveMsg)
+    {
+        startPage();
+        List<LiveMsg> list = liveMsgService.selectLiveMsgSingleList(liveMsg);
+        return getDataTable(list);
+    }
+
     /**
      * 导出直播讨论列表
      */

+ 12 - 6
fs-live-app/src/main/java/com/fs/live/task/Task.java

@@ -145,7 +145,6 @@ public class Task {
         String key = "live:auto_task:";
         if (!startLiveList.isEmpty()) {
             for (Live live : startLiveList) {
-                redisCache.zSetAdd(LiveKeysConstant.LIVE_HOME_PAGE_LIST, JSON.toJSONString(live), live.getCreateTime().getTime());
                 SendMsgVo sendMsgVo = new SendMsgVo();
                 sendMsgVo.setMsg("开始直播");
                 sendMsgVo.setCmd("live_start");
@@ -160,6 +159,8 @@ public class Task {
                     });
                 }
             }
+            // 重新更新所有在直播的缓存
+            liveService.asyncToCache();
         }
         if (!endLiveList.isEmpty()) {
             for (Live live : endLiveList) {
@@ -169,6 +170,7 @@ public class Task {
                 webSocketServer.broadcastMessage(live.getLiveId(), JSONObject.toJSONString(R.ok().put("data",sendMsgVo)));
                 List<LiveAutoTask> collect = liveAutoTasks.stream().filter(liveAutoTask -> liveAutoTask.getLiveId().equals(live.getLiveId())).collect(Collectors.toList());
                 if (!collect.isEmpty()) {
+                    redisCache.redisTemplate.delete(key + live.getLiveId());
                     collect.forEach(liveAutoTask -> {
                         liveAutoTask.setCreateTime(null);
                         liveAutoTask.setUpdateTime(null);
@@ -177,6 +179,8 @@ public class Task {
                 }
                 webSocketServer.removeLikeCountCache(live.getLiveId());
             }
+            // 重新更新所有在直播的缓存
+            liveService.asyncToCache();
         }
         if(!liveList.isEmpty()){
             for (Live live : liveList) {
@@ -222,6 +226,7 @@ public class Task {
                 sendMsgVo.setLiveId(Long.valueOf(liveKey));
                 sendMsgVo.setCmd("red");
                 sendMsgVo.setStatus(-1);
+                liveService.asyncToCacheLiveConfig(Long.parseLong(liveKey));
                 webSocketServer.broadcastMessage(Long.valueOf(liveKey), JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
             } catch (Exception e) {
                 log.error("更新红包状态异常", e);
@@ -304,6 +309,7 @@ public class Task {
             sendMsgVo.setData(JSON.toJSONString(lotteryVos));
             webSocketServer.broadcastMessage(liveLottery.getLiveId(), JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
 
+            liveService.asyncToCacheLiveConfig(liveLottery.getLiveId());
             // 删除缓存 同步抽奖记录
             redisCache.deleteObject(hashKey);
         }
@@ -470,27 +476,27 @@ public class Task {
 
             // 从 redis 获取数据,并提供默认值,避免 NPE
             liveData.setPageViews(
-                    liveData.getPageViews() + Optional.ofNullable(redisCache.incr(PAGE_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L)
+                    Math.max( liveData.getPageViews(), Optional.ofNullable(redisCache.incr(PAGE_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L))
             );
             liveData.setTotalViews(
-                    liveData.getTotalViews() + Optional.ofNullable(redisCache.incr(TOTAL_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L)
+                    Math.max( liveData.getTotalViews(), Optional.ofNullable(redisCache.incr(TOTAL_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L))
             );
             liveData.setUniqueVisitors(
                     /*Optional.ofNullable(redisCache.getCacheSet(UNIQUE_VISITORS_KEY + liveId))
                             .map(Set::size)  // 获取集合大小
                             .map(Long::valueOf)  // 转换为 Long 类型
                             .orElse(0L)*/
-                    liveData.getUniqueVisitors() + Optional.ofNullable(redisCache.incr(UNIQUE_VISITORS_KEY + liveData.getLiveId(),0)).orElse(0L)
+                    Math.max( liveData.getUniqueVisitors(), Optional.ofNullable(redisCache.incr(UNIQUE_VISITORS_KEY + liveData.getLiveId(),0)).orElse(0L))
             );
             liveData.setUniqueViewers(
                     /*Optional.ofNullable(redisCache.getCacheSet(UNIQUE_VIEWERS_KEY + liveId))
                             .map(Set::size)  // 获取集合大小
                             .map(Long::valueOf)  // 转换为 Long 类型
                             .orElse(0L)*/
-                    liveData.getUniqueViewers() + Optional.ofNullable(redisCache.incr(UNIQUE_VIEWERS_KEY + liveData.getLiveId(),0)).orElse(0L)
+                    Math.max( liveData.getUniqueViewers(), Optional.ofNullable(redisCache.incr(UNIQUE_VIEWERS_KEY + liveData.getLiveId(),0)).orElse(0L))
             );
             liveData.setPeakConcurrentViewers(
-                    liveData.getPeakConcurrentViewers() + Optional.ofNullable(redisCache.incr(MAX_ONLINE_USERS_KEY + liveData.getLiveId(),0)).orElse(0L)
+                    Math.max( liveData.getPeakConcurrentViewers(), Optional.ofNullable(redisCache.incr(MAX_ONLINE_USERS_KEY + liveData.getLiveId(),0)).orElse(0L))
             );
         });
         if(!liveDatas.isEmpty())

+ 52 - 3
fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -111,9 +111,8 @@ public class WebSocketServer {
             }
 
             // 判断是否是该直播间的首次访客(独立访客统计)
-            boolean isFirstVisit = redisCache.setIfAbsent(USER_VISIT_KEY + userId, 1, 1, TimeUnit.DAYS);
+            boolean isFirstVisit = redisCache.setIfAbsent(USER_VISIT_KEY + liveId + ":" + userId, 1, 1, TimeUnit.DAYS);
             if (isFirstVisit) {
-
                 redisCache.incr(UNIQUE_VISITORS_KEY + liveId, 1);
             }
 
@@ -227,6 +226,7 @@ public class WebSocketServer {
 
         SendMsgVo msg = JSONObject.parseObject(message, SendMsgVo.class);
         if(msg.isOn()) return;
+        LiveMsg liveMsg;
         try {
             switch (msg.getCmd()) {
                 case "heartbeat":
@@ -235,7 +235,7 @@ public class WebSocketServer {
                 case "sendMsg":
                     msg.setMsg(productionWordFilter.filter(msg.getMsg()).getFilteredText());
                     if(StringUtils.isEmpty(msg.getMsg())) return;
-                    LiveMsg liveMsg = new LiveMsg();
+                    liveMsg = new LiveMsg();
                     liveMsg.setLiveId(msg.getLiveId());
                     liveMsg.setUserId(msg.getUserId());
                     liveMsg.setNickName(msg.getNickName());
@@ -256,6 +256,49 @@ public class WebSocketServer {
                     msg.setOn(true);
                     msg.setData(JSONObject.toJSONString(liveMsg));
 
+                    // 广播消息
+                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
+                    break;
+                case "sendNormalMsg":
+                    msg.setMsg(productionWordFilter.filter(msg.getMsg()).getFilteredText());
+                    if(StringUtils.isEmpty(msg.getMsg())) return;
+                    liveMsg = new LiveMsg();
+                    liveMsg.setLiveId(msg.getLiveId());
+                    liveMsg.setUserId(msg.getUserId());
+                    liveMsg.setNickName(msg.getNickName());
+                    liveMsg.setAvatar(msg.getAvatar());
+                    liveMsg.setMsg(msg.getMsg());
+                    liveMsg.setCreateTime(new Date());
+                    liveMsgService.insertLiveMsg(liveMsg);
+                    msg.setOn(true);
+                    msg.setData(JSONObject.toJSONString(liveMsg));
+                    msg.setCmd("sendMsg");
+                    // 广播消息
+                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
+                    break;
+                case "sendPopMsg":
+                    msg.setMsg(productionWordFilter.filter(msg.getMsg()).getFilteredText());
+                    if(StringUtils.isEmpty(msg.getMsg())) return;
+                    liveMsg = new LiveMsg();
+                    liveMsg.setLiveId(msg.getLiveId());
+                    liveMsg.setUserId(msg.getUserId());
+                    liveMsg.setNickName(msg.getNickName());
+                    liveMsg.setAvatar(msg.getAvatar());
+                    liveMsg.setMsg(msg.getMsg());
+                    msg.setOn(true);
+                    msg.setData(JSONObject.toJSONString(liveMsg));
+                    // 广播消息
+                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
+                    break;
+                case "globalVisible":
+                    msg.setOn(true);
+                    liveWatchUserService.updateGlobalVisible(liveId, msg.getStatus());
+                    liveService.updateGlobalVisible(liveId, msg.getStatus());
+                    // 广播消息
+                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
+                    break;
+                case "singleVisible":
+                    liveWatchUserService.updateSingleVisible(liveId, msg.getStatus(),msg.getUserId());
                     // 广播消息
                     broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
                     break;
@@ -316,6 +359,7 @@ public class WebSocketServer {
         msg.setStatus(status);
         LiveGoodsVo liveGoods = liveGoodsService.selectLiveGoodsVoByGoodsId(goodsId);
         if(liveGoods == null) return;
+        liveService.asyncToCacheLiveConfig(liveId);
         msg.setLiveId(liveId);
         msg.setData(JSONObject.toJSONString(liveGoods));
         broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
@@ -331,6 +375,7 @@ public class WebSocketServer {
         msg.setStatus( status);
         LiveRedConf liveRedConf = liveRedConfService.selectLiveRedConfByRedId(jsonObject.getLong("redId"));
         if (Objects.nonNull(liveRedConf)) {
+            liveService.asyncToCacheLiveConfig(liveId);
             msg.setData(JSONObject.toJSONString(liveRedConf));
             broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
         }
@@ -346,6 +391,7 @@ public class WebSocketServer {
         msg.setStatus( status);
         LiveLotteryConf liveLotteryConf = liveLotteryConfService.selectLiveLotteryConfByLotteryId(jsonObject.getLong("lotteryId"));
         if (Objects.nonNull(liveLotteryConf)) {
+            liveService.asyncToCacheLiveConfig(liveId);
             msg.setData(JSONObject.toJSONString(liveLotteryConf));
             broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
         }
@@ -513,6 +559,7 @@ public class WebSocketServer {
                 msg.setCmd("goods");
                 LiveGoodsVo liveGoodsVo = JSON.parseObject(task.getContent(), LiveGoodsVo.class);
                 liveGoodsService.updateLiveIsShow(liveGoodsVo.getGoodsId(), task.getLiveId());
+                liveService.asyncToCacheLiveConfig(task.getLiveId());
             }else if (task.getTaskType() == 2L) {
                 msg.setCmd("red");
                 LiveRedConf liveRedConf = JSON.parseObject(task.getContent(), LiveRedConf.class);
@@ -524,6 +571,7 @@ public class WebSocketServer {
                 liveRedConf.setUpdateTime( now);
                 msg.setData(JSON.toJSONString(liveRedConf));
                 liveRedConfService.updateLiveRedConf(liveRedConf);
+                liveService.asyncToCacheLiveConfig(task.getLiveId());
             }else if (task.getTaskType() == 4L) {
                 msg.setCmd("lottery");
                 LiveLotteryConf liveLotteryConf = JSON.parseObject(task.getContent(), LiveLotteryConf.class);
@@ -535,6 +583,7 @@ public class WebSocketServer {
                 liveLotteryConf.setUpdateTime( now);
                 msg.setData(JSON.toJSONString(liveLotteryConf));
                 liveLotteryConfService.updateLiveLotteryConf(liveLotteryConf);
+                liveService.asyncToCacheLiveConfig(task.getLiveId());
             }else if (task.getTaskType() == 3L) {
                 msg.setCmd("sendMsg");
                 msg.setMsg(task.getContent());

+ 1 - 0
fs-service/src/main/java/com/fs/live/domain/Live.java

@@ -124,4 +124,5 @@ public class   Live extends BaseEntity {
     private Date createTime;
     private String companyName;
     private Long fileSize;
+    private Integer globalVisible;
 }

+ 5 - 1
fs-service/src/main/java/com/fs/live/domain/LiveMsg.java

@@ -2,6 +2,7 @@ package com.fs.live.domain;
 
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
@@ -18,7 +19,7 @@ import lombok.EqualsAndHashCode;
 public class LiveMsg extends BaseEntity {
 
     /** id */
-    
+
     private Long msgId;
 
     /** 直播ID */
@@ -40,4 +41,7 @@ public class LiveMsg extends BaseEntity {
     /** 消息 */
     @Excel(name = "消息")
     private String msg;
+
+    @TableField(exist = false)
+    private Integer singleVisible;
 }

+ 4 - 0
fs-service/src/main/java/com/fs/live/domain/LiveWatchUser.java

@@ -38,6 +38,10 @@ public class LiveWatchUser extends BaseEntity {
     /** 在线状态;0在线1离线 */
     @Excel(name = "在线状态;0在线1离线")
     private Integer online = 0;
+    /** 全局用户自见 */
+    private Integer globalVisible = 0;
+    /** 用户自见 */
+    private Integer singleVisible = 0;
 
     private Long onlineSeconds;
 

+ 4 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveAutoTaskMapper.java

@@ -87,4 +87,8 @@ public interface LiveAutoTaskMapper {
 
     void batchUpdateLiveAutoTask(@Param("list")  List<LiveAutoTask> updateList);
 
+    List<LiveAutoTask> selectLiveAutoTaskConsoleList(LiveAutoTask liveAutoTask);
+
+    @Select("select * from live_auto_task where live_id= #{liveId} and abs_value > #{nowDate} and task_type in (1,2,4) and finish_status = 1 order by abs_value ")
+    List<LiveAutoTask> consoleList(@Param("liveId") Long liveId,@Param("nowDate") Date nowDate);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveMapper.java

@@ -129,4 +129,10 @@ public interface LiveMapper
     Integer updateLiveIsAudit(Live live);
 
     List<Live> selectReadyStartLiveList();
+
+    @Update("update live set global_visible = #{status} where live_id = #{liveId}")
+    void updateGlobalVisible(@Param("liveId")Long liveId,@Param("status") Integer status);
+
+    @Select("select * from live where company_id = #{companyId} and live_type IN (1,2, 3) AND status IN (3, 4) AND is_del = 0")
+    List<Live> listLiveData(@Param("companyId")Long companyId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveMsgMapper.java

@@ -79,4 +79,6 @@ public interface LiveMsgMapper
 
     @Select("SELECT count(1) as commentNum from live_msg where live_id = #{liveId}")
     Map<String, Long> selectDashboardCount(@Param("liveId") Long liveId);
+
+    List<LiveMsg> selectLiveMsgSingleList(LiveMsg liveMsg);
 }

+ 12 - 5
fs-service/src/main/java/com/fs/live/mapper/LiveWatchUserMapper.java

@@ -7,6 +7,7 @@ import com.fs.live.vo.LiveWatchUserStatistics;
 import com.fs.live.vo.LiveWatchUserVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -107,12 +108,12 @@ public interface LiveWatchUserMapper {
     LiveWatchUser selectUserByLiveIdAndUserId(@Param("liveId") long liveId,@Param("userId")  long userId);
 
     @Select("SELECT " +
-            "    SUM(CASE WHEN online = 0 and msg_status = 0 THEN 1 ELSE 0 END) AS online, " +
-            "    SUM(CASE WHEN online = 1 and msg_status = 0 THEN 1 ELSE 0 END) AS offline, " +
-            "    SUM(CASE WHEN msg_status = 1 THEN 1 ELSE 0 END) AS silenced, " +
-            "    SUM(CASE WHEN user_id > 0 THEN 1 ELSE 0 END) AS al " +
+            "    SUM(CASE WHEN lwu.online = 0 and lwu.msg_status = 0 THEN 1 ELSE 0 END) AS online, " +
+            "    SUM(CASE WHEN lwu.online = 1 and lwu.msg_status = 0 THEN 1 ELSE 0 END) AS offline, " +
+            "    SUM(CASE WHEN lwu.msg_status = 1 THEN 1 ELSE 0 END) AS silenced, " +
+            "    SUM(CASE WHEN lwu.user_id > 0 THEN 1 ELSE 0 END) AS al " +
             "FROM " +
-            "    live_watch_user where live_id=#{liveId}")
+            "    live_watch_user lwu left join fs_user fu on lwu.user_id=fu.user_id  where fu.status=1 and  live_id=#{liveId}")
     LiveWatchUserStatistics liveUserTotals(LiveWatchUser liveWatchUser);
 
     List<LiveWatchUserVO> selectWatchUserListAllByLiveId(@Param("params") Map<String, Object> param);
@@ -125,4 +126,10 @@ public interface LiveWatchUserMapper {
             "    live_watch_user where live_id=#{liveId}"
     )
     Map<String, BigDecimal> selectDashboardCount(Long liveId);
+
+    @Update("update live_watch_user set global_visible = #{status} where live_id = #{liveId}")
+    void updateGlobalVisible(@Param("liveId") long liveId,@Param("status") int status);
+
+    @Update("update live_watch_user set single_visible = #{status} where live_id = #{liveId} and user_id=#{userId}")
+    void updateSingleVisible(@Param("liveId") long liveId,@Param("status") int status,@Param("userId") long userId);
 }

+ 93 - 0
fs-service/src/main/java/com/fs/live/param/LiveDataParam.java

@@ -0,0 +1,93 @@
+package com.fs.live.param;
+
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 直播数据对象 live_data
+ *
+ * @author fs
+ * @date 2025-03-05
+ */
+@Data
+public class LiveDataParam {
+
+    /** 直播id */
+
+    private Long liveId;
+
+   /* *//** 直播名称 *//*
+    @Excel(name = "直播名称")
+    private String liveName;
+
+    *//** 直播封面 *//*
+    @Excel(name = "直播封面")
+    private String liveImgUrl;
+
+    *//** 1待直播 2直播中 3已结束 *//*
+    @Excel(name = "1待直播 2直播中 3已结束")
+    private Integer status;
+
+    *//** 开始时间 *//*
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startTime;
+
+    *//** 结束时间 *//*
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date finishTime;
+
+    *//** 直播地址 *//*
+    @Excel(name = "直播地址")
+    private String rtmpUrl;*/
+
+    /** 浏览量 */
+    @Excel(name = "浏览量")
+    private Long pageViews;
+
+    /** 访客数 */
+    @Excel(name = "访客数")
+    private Long uniqueVisitors;
+
+    /** 累计观看人次 */
+    @Excel(name = "累计观看人次")
+    private Long totalViews;
+
+    /** 累计观看人数 */
+    @Excel(name = "累计观看人数")
+    private Long uniqueViewers;
+
+    /** 最高在线人数 */
+    @Excel(name = "最高在线人数")
+    private Long peakConcurrentViewers;
+
+
+    /** 点赞数 */
+    @Excel(name = "点赞数")
+    private Long likes;
+
+    /** 收藏数*/
+    @Excel(name = "收藏数")
+    private Long favouriteNum;
+
+    /** 关注数*/
+    @Excel(name = "关注数")
+    private Long followNum;
+
+    private Long companyId;
+    /** 完课状态 */
+    private Integer completeStatus;
+
+    /** 观看时长 */
+    private Integer watchDuration;
+    /** 开始时间 */
+    private Date startTime;
+    /** 结束时间 */
+    private Date endTime;
+
+
+}

+ 4 - 0
fs-service/src/main/java/com/fs/live/service/ILiveAutoTaskService.java

@@ -85,4 +85,8 @@ public interface ILiveAutoTaskService {
     void directInsertLiveAutoTask(LiveAutoTask liveAutoTask);
 
     void batchInsertLiveAutoTask(List<LiveAutoTask> addList);
+
+    List<LiveAutoTask> selectLiveAutoTaskConsoleList(LiveAutoTask liveAutoTask);
+
+    List<LiveAutoTask> consoleList(Long liveId);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/live/service/ILiveDataService.java

@@ -3,6 +3,7 @@ package com.fs.live.service;
 
 import com.fs.common.core.domain.R;
 import com.fs.live.domain.LiveData;
+import com.fs.live.param.LiveDataParam;
 import com.fs.live.vo.ColumnsConfigVo;
 import com.fs.live.vo.LiveUserFirstVo;
 import com.fs.live.vo.RecentLiveDataVo;
@@ -132,4 +133,6 @@ public interface ILiveDataService {
     R dashboardData(Long liveId);
 
     List<LiveUserFirstVo> inviteList(Long liveId);
+
+    R listLiveData(LiveDataParam param);
 }

+ 3 - 1
fs-service/src/main/java/com/fs/live/service/ILiveMsgService.java

@@ -11,7 +11,7 @@ import java.util.List;
  * @author fs
  * @date 2025-01-17
  */
-public interface ILiveMsgService 
+public interface ILiveMsgService
 {
     /**
      * 查询直播讨论
@@ -67,4 +67,6 @@ public interface ILiveMsgService
      * @return
      */
     List<LiveMsg> listRecentMsg(Long id);
+
+    List<LiveMsg> selectLiveMsgSingleList(LiveMsg liveMsg);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/live/service/ILiveService.java

@@ -185,4 +185,6 @@ public interface ILiveService
     Integer updateLiveIsAudit(Live live);
 
     int updateLiveEntity(Live live);
+
+    void updateGlobalVisible(long liveId, Integer status);
 }

+ 4 - 0
fs-service/src/main/java/com/fs/live/service/ILiveWatchUserService.java

@@ -116,4 +116,8 @@ public interface ILiveWatchUserService {
     R liveUserTotals(LiveWatchUser liveWatchUser);
 
     List<LiveWatchUserVO> dashBoardWatchUserList(Map<String, Object> param);
+
+    void updateGlobalVisible(long liveId, int i);
+
+    void updateSingleVisible(long liveId, Integer status,long userId);
 }

+ 15 - 1
fs-service/src/main/java/com/fs/live/service/impl/LiveAutoTaskServiceImpl.java

@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
 
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.common.utils.DateUtils;
 import com.fs.live.domain.Live;
 import com.fs.live.domain.LiveAutoTask;
 import com.fs.live.domain.LiveLotteryConf;
@@ -21,6 +22,7 @@ import com.fs.live.param.LiveLotteryProduct;
 import com.fs.live.service.ILiveAutoTaskService;
 import com.fs.live.service.ILiveGoodsService;
 import com.fs.live.vo.LiveGoodsVo;
+import com.fs.live.vo.LiveLotteryProductListVo;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -126,7 +128,9 @@ public class LiveAutoTaskServiceImpl implements ILiveAutoTaskService {
             LiveLotteryConf liveLotteryConf = liveLotteryConfMapper.selectLiveLotteryConfByLotteryId(Long.valueOf(liveAutoTask.getContent()));
             if(liveLotteryConf == null) return R.error("抽奖配置不存在");
             if(!"0".equals(liveLotteryConf.getLotteryStatus())) return R.error("抽奖状态应该为:未开始");
-            List<LiveLotteryProduct> prizes = lotteryProductConfMapper.selectLiveLotteryProductConfByLotteryId(liveLotteryConf.getLotteryId());
+            List<Long> lotteryIds = new ArrayList<>();
+            lotteryIds.add(liveLotteryConf.getLotteryId());
+            List<LiveLotteryProductListVo> prizes = lotteryProductConfMapper.selectLiveLotteryProductConfByLotteryIds(lotteryIds);
             if (prizes == null || prizes.isEmpty()) {
                 return R.error("抽奖配置请先添加奖品");
             }
@@ -321,4 +325,14 @@ public class LiveAutoTaskServiceImpl implements ILiveAutoTaskService {
     public void batchInsertLiveAutoTask(List<LiveAutoTask> addList) {
         baseMapper.batchInsertLiveAutoTask(addList);
     }
+
+    @Override
+    public List<LiveAutoTask> selectLiveAutoTaskConsoleList(LiveAutoTask liveAutoTask) {
+        return baseMapper.selectLiveAutoTaskConsoleList(liveAutoTask);
+    }
+
+    @Override
+    public List<LiveAutoTask> consoleList(Long liveId) {
+        return baseMapper.consoleList(liveId, DateUtils.getNowDate());
+    }
 }

+ 21 - 16
fs-service/src/main/java/com/fs/live/service/impl/LiveDataServiceImpl.java

@@ -5,14 +5,9 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.spring.SpringUtils;
-import com.fs.live.domain.LiveData;
-import com.fs.live.domain.LiveUserFavorite;
-import com.fs.live.domain.LiveUserFollow;
-import com.fs.live.domain.LiveUserLike;
-import com.fs.live.mapper.LiveDataMapper;
-import com.fs.live.mapper.LiveMsgMapper;
-import com.fs.live.mapper.LiveUserFirstEntryMapper;
-import com.fs.live.mapper.LiveWatchUserMapper;
+import com.fs.live.domain.*;
+import com.fs.live.mapper.*;
+import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.service.ILiveUserFavoriteService;
 import com.fs.live.service.ILiveUserFollowService;
@@ -69,6 +64,8 @@ public class LiveDataServiceImpl implements ILiveDataService {
     private LiveWatchUserMapper liveWatchUserMapper;
     @Autowired
     private LiveMsgMapper liveMsgMapper;
+    @Autowired
+    private LiveMapper liveMapper;
 
 
     /* 直播大屏展示 数据接口 */
@@ -79,14 +76,14 @@ public class LiveDataServiceImpl implements ILiveDataService {
         Map<String, Long> map3 = liveMsgMapper.selectDashboardCount(liveId);
         Map<String,BigDecimal> map4 = liveUserFirstEntryMapper.selectDashboardCount(liveId);
         LiveDashBoardDataVo result = new LiveDashBoardDataVo();
-        result.setOnlineNum(map1.getOrDefault("onlineNum", BigDecimal.valueOf(0)));
-        result.setOldUserNum(map1.getOrDefault("oldUserNum", BigDecimal.valueOf(0)));
-        result.setNewUserNum(map1.getOrDefault("newUserNum", BigDecimal.valueOf(0)));
-        result.setViewNum(map2.getOrDefault("viewNum", 0));
-        result.setLikeNum(map2.getOrDefault("likeNum", 0));
-        result.setCommentNum(map3.getOrDefault("commentNum", 0L));
-        result.setShareUrlNum(map4.getOrDefault("shareUrlNum", BigDecimal.valueOf(0)));
-        result.setDirectAccessNum(map4.getOrDefault("directAccessNum", BigDecimal.valueOf(0)));
+        result.setOnlineNum(map1 == null ? BigDecimal.valueOf(0) : map1.getOrDefault("onlineNum", BigDecimal.valueOf(0)));
+        result.setOldUserNum(map1 == null ? BigDecimal.valueOf(0) :map1.getOrDefault("oldUserNum", BigDecimal.valueOf(0)));
+        result.setNewUserNum(map1 == null ? BigDecimal.valueOf(0) :map1.getOrDefault("newUserNum", BigDecimal.valueOf(0)));
+        result.setViewNum(map2 == null ? 0 :map2.getOrDefault("viewNum", 0));
+        result.setLikeNum(map2 == null ? 0 :map2.getOrDefault("likeNum", 0));
+        result.setCommentNum(map3 == null ? 0L :map3.getOrDefault("commentNum", 0L));
+        result.setShareUrlNum(map4 == null ? BigDecimal.valueOf(0) :map4.getOrDefault("shareUrlNum", BigDecimal.valueOf(0)));
+        result.setDirectAccessNum(map4 == null ? BigDecimal.valueOf(0) :map4.getOrDefault("directAccessNum", BigDecimal.valueOf(0)));
         List<LiveUserFirstVo> liveUserFirstVos = liveUserFirstEntryMapper.selectDashboardInviteCount(liveId);
         result.setInviteUserList(liveUserFirstVos);
         return R.ok().put("data", result);
@@ -97,6 +94,14 @@ public class LiveDataServiceImpl implements ILiveDataService {
         return liveUserFirstEntryMapper.inviteList(liveId);
     }
 
+    @Override
+    public R listLiveData(LiveDataParam param) {
+        // 直播类型 只展示已结束和直播回放的数据 录播展示直播中和已结束的直播数据
+        List<Live> lives = liveMapper.listLiveData(param.getCompanyId());
+        String b = "123";
+        return null;
+    }
+
     /**
      * 查询直播数据
      *

+ 5 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveMsgServiceImpl.java

@@ -103,4 +103,9 @@ public class LiveMsgServiceImpl implements ILiveMsgService
     public List<LiveMsg> listRecentMsg(Long liveId) {
         return liveMsgMapper.listRecentMsg(liveId);
     }
+
+    @Override
+    public List<LiveMsg> selectLiveMsgSingleList(LiveMsg liveMsg) {
+        return liveMsgMapper.selectLiveMsgSingleList(liveMsg);
+    }
 }

+ 10 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -265,6 +265,10 @@ public class LiveServiceImpl implements ILiveService
     public Live selectLiveByLiveIdAndCompanyIdAndCompanyUserId(Long liveId, Long companyId, Long companyUserId){
 //        Live byId = baseMapper.selectLiveByLiveIdAndCompanyIdAndCompanyUserId(liveId, companyId, companyUserId);
         Live byId = baseMapper.selectLiveByLiveIdAndCompanyId(liveId, companyId);
+        if(byId == null){
+            log.error("查询直播失败,未找到该直播ID :{}  companyId :{}  companyUserId :{}", liveId, companyId, companyUserId);
+            return null ;
+        }
         List<LiveVideo> videos = liveVideoService.listByLiveId(liveId, 1);
         if(!videos.isEmpty()){
             LiveVideo liveVideo = videos.get(0);
@@ -348,6 +352,11 @@ public class LiveServiceImpl implements ILiveService
         return baseMapper.updateLive( live);
     }
 
+    @Override
+    public void updateGlobalVisible(long liveId, Integer status) {
+        baseMapper.updateGlobalVisible(liveId, status);
+    }
+
     /**
      * 修改直播
      *
@@ -794,6 +803,7 @@ public class LiveServiceImpl implements ILiveService
                 liveLotteryConfEntity.setLiveId(newLiveId);
                 liveLotteryConfEntity.setLotteryStatus(String.valueOf(0));
                 liveLotteryConfEntity.setCreateTime(now);
+                liveLotteryConfEntity.setUpdateTime(now);
                 liveLotteryConfService.insertLiveLotteryConf(liveLotteryConfEntity);
                 products.stream().filter(product -> product.getLotteryId().equals(liveLotteryConf.getLotteryId()))
                         .forEach(product -> {

+ 13 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveWatchUserServiceImpl.java

@@ -305,8 +305,21 @@ public class LiveWatchUserServiceImpl implements ILiveWatchUserService {
         if (param != null && param.containsKey("all") && "1".equals(param.get("all"))) {
             return baseMapper.selectWatchUserListAllByLiveId(param);
         } else {
+            if(param != null && param.containsKey("msgStatus") && "1".equals(param.get("msgStatus")) && param.containsKey("online") ){
+                param.remove("online");
+            }
             return baseMapper.selectWatchUserListByLiveId(param);
         }
     }
 
+    @Override
+    public void updateGlobalVisible(long liveId, int status) {
+        baseMapper.updateGlobalVisible(liveId, status);
+    }
+
+    @Override
+    public void updateSingleVisible(long liveId, Integer status, long userId) {
+        baseMapper.updateSingleVisible(liveId, status,userId);
+    }
+
 }

+ 6 - 0
fs-service/src/main/java/com/fs/live/vo/LiveWatchUserVO.java

@@ -28,4 +28,10 @@ public class LiveWatchUserVO {
      * 用户状态 0在线 1离线
      */
     private Integer online;
+
+    /** 全局用户自见 */
+    private Integer globalVisible = 0;
+    /** 用户自见 */
+    private Integer singleVisible = 0;
+
 }

+ 16 - 0
fs-service/src/main/resources/mapper/live/LiveAutoTaskMapper.xml

@@ -40,6 +40,22 @@
             <if test="finishStatus != null "> and finish_status = #{finishStatus}</if>
         </where>
     </select>
+    <select id="selectLiveAutoTaskConsoleList" parameterType="LiveAutoTask" resultMap="LiveAutoTaskResult">
+        <include refid="selectLiveAutoTaskVo"/>
+        <where>
+            <if test="liveId != null "> and live_id = #{liveId}</if>
+            <if test="taskName != null  and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
+
+            <if test="triggerType != null "> and trigger_type = #{triggerType}</if>
+            <if test="triggerValue != null"> and trigger_value = #{triggerValue}</if>
+            <if test="absValue != null"> and abs_value = #{absValue}</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="finishStatus != null "> and finish_status = #{finishStatus}</if>
+        </where>
+    </select>
 
     <select id="selectLiveAutoTaskById" parameterType="Long" resultMap="LiveAutoTaskResult">
         <include refid="selectLiveAutoTaskVo"/>

+ 9 - 4
fs-service/src/main/resources/mapper/live/LiveMapper.xml

@@ -32,18 +32,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isAudit"    column="is_audit"    />
         <result property="idCardUrl"    column="id_card_url"    />
         <result property="liveCodeUrl"    column="live_code_url"    />
+        <result property="globalVisible"    column="global_visible"    />
     </resultMap>
 
     <sql id="selectLiveVo">
         select live_id, company_id, company_user_id,talent_id, live_name, is_audit, live_desc, show_type, status, anchor_id, live_type, start_time, finish_time,
                live_img_url, live_config, id_card_url, is_show, is_del, qw_qr_code, rtmp_url, flv_hls_url,
-               create_time, create_by, update_by, update_time, remark,config_json from live
+               create_time, create_by, update_by, update_time, remark,config_json,global_visible from live
     </sql>
 
     <select id="liveList" parameterType="Live" resultMap="LiveResult">
         select a.live_id, a.company_id, a.company_user_id,talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
         a.live_type, a.start_time, a.finish_time, a.live_img_url, a.live_config, a.id_card_url, a.is_show, a.is_del, a.qw_qr_code, a.rtmp_url,
-        a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size
+        a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size,a.global_visible
         from live
         a
         left join live_video b on a.live_id = b.live_id
@@ -55,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectReadyStartLiveList" parameterType="Live" resultMap="LiveResult">
         select a.live_id, a.company_id, a.company_user_id,talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
         a.live_type, a.start_time, a.finish_time, a.live_img_url, a.live_config, a.id_card_url, a.is_show, a.is_del, a.qw_qr_code, a.rtmp_url,
-        a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size
+        a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size,a.global_visible
         from live
         a
         left join live_video b on a.live_id = b.live_id
@@ -69,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectLiveList" parameterType="com.fs.live.domain.Live" resultMap="LiveResult">
         select a.live_id, a.company_id, a.company_user_id,talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
                a.live_type, a.start_time, a.finish_time, a.live_img_url, a.live_config, a.id_card_url, a.is_show, a.is_del, a.qw_qr_code, a.rtmp_url,
-               a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url
+               a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,a.global_visible
                 ,c.live_code_url,IFNULL(d.company_name, '总台') AS company_name,b.file_size
 
         from live a
@@ -159,6 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="flvHlsUrl != null">flv_hls_url,</if>
             <if test="isAudit != null">is_audit,</if>
             <if test="idCardUrl != null">id_card_url,</if>
+            <if test="globalVisible != null">global_visible,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="companyId != null">#{companyId},</if>
@@ -187,6 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="flvHlsUrl != null">#{flvHlsUrl},</if>
             <if test="isAudit != null">#{isAudit},</if>
             <if test="idCardUrl != null">#{idCardUrl},</if>
+            <if test="globalVisible != null">#{globalVisible},</if>
          </trim>
     </insert>
 
@@ -218,6 +221,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="flvHlsUrl != null">flv_hls_url = #{flvHlsUrl},</if>
             <if test="isAudit != null">is_audit = #{isAudit},</if>
             <if test="idCardUrl != null">id_card_url = #{idCardUrl},</if>
+            <if test="globalVisible != null">global_visible = #{globalVisible},</if>
         </trim>
         where live_id = #{liveId}
     </update>
@@ -283,6 +287,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="live.isDel != null">is_del = #{live.isDel},</if>
                 <if test="live.liveConfig != null and live.liveConfig != ''">live_config = #{live.liveConfig},</if>
                 <if test="live.remark != null and live.remark != ''">remark = #{live.remark},</if>
+                <if test="live.globalVisible != null and live.globalVisible != ''">global_visible = #{live.globalVisible},</if>
                 update_time = NOW()
             </set>
             WHERE live_id = #{live.liveId}

+ 10 - 0
fs-service/src/main/resources/mapper/live/LiveMsgMapper.xml

@@ -30,6 +30,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by create_time desc
     </select>
+    <select id="selectLiveMsgSingleList" parameterType="LiveMsg" resultMap="LiveMsgResult">
+        select lm.msg_id, lm.live_id,lm.user_id, lm.nick_name, lm.avatar, lm.msg, lm.create_time, lm.create_by, lm.update_by, lm.update_time, lm.remark,lwu.single_visible from live_msg lm
+        left join live_watch_user lwu on lwu.user_id = lm.user_id
+        <where>
+            <if test="liveId != null "> and lm.live_id = #{liveId}</if>
+            <if test="userId != null "> and lm.user_id = #{userId}</if>
+            <if test="msg != null  and msg != ''"> and lm.msg = #{msg}</if>
+        </where>
+        order by create_time desc
+    </select>
 
     <select id="selectLiveMsgByMsgId" parameterType="Long" resultMap="LiveMsgResult">
         <include refid="selectLiveMsgVo"/>

+ 22 - 8
fs-service/src/main/resources/mapper/live/LiveWatchUserMapper.xml

@@ -16,10 +16,12 @@
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
         <result property="onlineSeconds"    column="online_seconds"    />
+        <result property="globalVisible"    column="global_visible"    />
+        <result property="singleVisible"    column="single_visible"    />
     </resultMap>
 
     <sql id="selectLiveWatchUserVo">
-        select id, live_id,user_id, msg_status, online, create_time, create_by, update_by, update_time, remark,online_seconds from live_watch_user
+        select id, live_id,user_id, msg_status, online, create_time, create_by, update_by, update_time, remark,online_seconds,global_visible,single_visible from live_watch_user
     </sql>
 
     <select id="selectLiveWatchUserList" parameterType="LiveWatchUser" resultMap="LiveWatchUserResult">
@@ -45,13 +47,15 @@
         lwu.msg_status  msgStatus,
         lwu.online      online,
         fu.nick_name    nickName,
-        fu.avatar       avatar
+        fu.avatar       avatar,
+        lwu.global_visible  globalVisible,
+        lwu.single_visible  singleVisible
         from live_watch_user lwu
         left join fs_user fu on lwu.user_id = fu.user_id
-        where lwu.live_id = #{params.liveId}
+        where lwu.live_id = #{params.liveId} and fu.status = 1
         <if test="params.msgStatus != null "> and msg_status = #{params.msgStatus}</if>
         <if test="params.online != null "> and online = #{params.online}</if>
-        <if test="params.userName != null and params.userName != ''"> and fs.nickname like concat('%',#{params.userName},'%')</if>
+        <if test="params.userName != null and params.userName != ''"> and fu.nick_name like concat('%',#{params.userName},'%')</if>
         order by lwu.create_time desc
 
     </select>
@@ -62,11 +66,13 @@
         lwu.msg_status  msgStatus,
         lwu.online      online,
         fu.nick_name    nickName,
-        fu.avatar       avatar
+        fu.avatar       avatar,
+        lwu.global_visible  globalVisible,
+        lwu.single_visible  singleVisible
         from live_watch_user lwu
         left join fs_user fu on lwu.user_id = fu.user_id
-        where lwu.live_id = #{params.liveId}
-        <if test="params.userName != null and params.userName != ''"> and fs.nickname like concat('%',#{params.userName},'%')</if>
+        where lwu.live_id = #{params.liveId} and fu.status = 1
+        <if test="params.userName != null and params.userName != ''"> and fu.nick_name like concat('%',#{params.userName},'%')</if>
         order by lwu.create_time desc
 
     </select>
@@ -83,7 +89,9 @@
             lwu.msg_status  msgStatus,
             lwu.online      online,
             fu.nickname    nickName,
-            fu.avatar       avatar
+            fu.avatar       avatar,
+            lwu.global_visible  globalVisible,
+            lwu.single_visible  singleVisible
         from live_watch_user lwu
                  left join fs_user fu on lwu.user_id = fu.user_id
         where lwu.live_id = #{liveId} and lwu.user_id = #{userId}
@@ -115,6 +123,8 @@
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
             <if test="onlineSeconds != null">online_seconds,</if>
+            <if test="globalVisible != null">global_visible,</if>
+            <if test="singleVisible != null">single_visible,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="liveId != null">#{liveId},</if>
@@ -127,6 +137,8 @@
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
             <if test="onlineSeconds != null">#{onlineSeconds},</if>
+            <if test="globalVisible != null">#{globalVisible},</if>
+            <if test="singleVisible != null">#{singleVisible},</if>
         </trim>
     </insert>
 
@@ -143,6 +155,8 @@
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="onlineSeconds != null">online_seconds = #{onlineSeconds},</if>
+            <if test="globalVisible != null">global_visible = #{globalVisible},</if>
+            <if test="singleVisible != null">single_visible = #{singleVisible},</if>
         </trim>
         where id = #{id}
     </update>

+ 12 - 0
fs-user-app/src/main/java/com/fs/app/controller/live/LiveMsgController.java

@@ -37,6 +37,18 @@ public class LiveMsgController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询直播讨论列表
+     */
+    @GetMapping("/myList")
+    public TableDataInfo myList(LiveMsg liveMsg)
+    {
+        startPage();
+        liveMsg.setUserId(getUserId());
+        List<LiveMsg> list = liveMsgService.selectLiveMsgList(liveMsg);
+        return getDataTable(list);
+    }
+
     /**
      * 导出直播讨论列表
      */