فهرست منبع

直播 数据分为新旧数据,发送消息内容;直播数据

yuhongqi 6 روز پیش
والد
کامیت
02f55ca2ee
19فایلهای تغییر یافته به همراه134 افزوده شده و 47 حذف شده
  1. 1 1
      fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java
  2. 1 0
      fs-common/src/main/java/com/fs/common/constant/LiveKeysConstant.java
  3. 1 1
      fs-live-app/src/main/java/com/fs/live/controller/LiveController.java
  4. 1 0
      fs-live-app/src/main/java/com/fs/live/websocket/bean/SendMsgVo.java
  5. 5 0
      fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java
  6. 2 2
      fs-service/src/main/java/com/fs/live/domain/LiveCoupon.java
  7. 1 1
      fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java
  8. 1 1
      fs-service/src/main/java/com/fs/live/mapper/LiveMsgMapper.java
  9. 26 26
      fs-service/src/main/java/com/fs/live/service/impl/LiveDataServiceImpl.java
  10. 1 1
      fs-service/src/main/java/com/fs/live/service/impl/LiveRedConfServiceImpl.java
  11. 2 2
      fs-service/src/main/java/com/fs/live/vo/LiveDashBoardDataVo.java
  12. 59 0
      fs-service/src/main/java/com/fs/live/vo/LiveMsgVo.java
  13. 2 0
      fs-service/src/main/java/com/fs/live/vo/LiveVo.java
  14. 1 1
      fs-service/src/main/resources/application-config-druid-bjzm-test.yml
  15. 1 1
      fs-service/src/main/resources/application-config-druid-bjzm.yml
  16. 6 1
      fs-service/src/main/resources/mapper/live/LiveCouponMapper.xml
  17. 9 0
      fs-user-app/pom.xml
  18. 2 0
      fs-user-app/src/main/java/com/fs/app/controller/live/LiveMsgController.java
  19. 12 9
      fs-user-app/src/main/java/com/fs/app/facade/impl/LiveFacadeServiceImpl.java

+ 1 - 1
fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java

@@ -17,7 +17,7 @@ import java.util.Map;
 
 
 @RestController
-@RequestMapping("/live/liveData")
+@RequestMapping("/liveData/liveData")
 public class LiveDataController extends BaseController {
 
     @Autowired

+ 1 - 0
fs-common/src/main/java/com/fs/common/constant/LiveKeysConstant.java

@@ -25,6 +25,7 @@ public class LiveKeysConstant {
     public static final String LIVE_HOME_PAGE_CONFIG_RED = "live:config:%s:red:%s"; //红包记录
     public static final String LIVE_HOME_PAGE_CONFIG_COUPON = "live:config:%s:coupon:%s"; //优惠券记录
     public static final String LIVE_HOME_PAGE_CONFIG_DRAW = "live:config:%s:draw:%s"; //抽奖记录
+    public static final String TOP_MSG = "topMsg"; //抽奖记录
 
 
 

+ 1 - 1
fs-live-app/src/main/java/com/fs/live/controller/LiveController.java

@@ -125,7 +125,7 @@ public class LiveController {
 
 		LinkedHashMap<String,Object> result = (LinkedHashMap<String,Object>) params.get("WorkflowExecution");
 		String string = result.get("Object").toString();
-		videoService.updateFinishStatus("https://fs-1319721001.cos.ap-chongqing.myqcloud.com/" + string.replace(".mp4", ".m3u8"));
+		videoService.updateFinishStatus("https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/" + string.replace(".mp4", ".m3u8"));
 
 		return R.ok();
 //		{app=200149.push.tlivecloud.com, appid=1319721001, appname=live, channel_id=673,

+ 1 - 0
fs-live-app/src/main/java/com/fs/live/websocket/bean/SendMsgVo.java

@@ -33,5 +33,6 @@ public class SendMsgVo {
     private String avatar;
     private boolean on = false;
     private Integer status;
+    private Integer duration;
 
 }

+ 5 - 0
fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java

@@ -346,10 +346,15 @@ public class WebSocketServer {
                     liveMsg.setNickName(msg.getNickName());
                     liveMsg.setAvatar(msg.getAvatar());
                     liveMsg.setMsg(msg.getMsg());
+                    liveMsg.setEndTime(DateUtils.addMinutes(new Date(),msg.getDuration()).toString());
                     msg.setOn(true);
                     msg.setData(JSONObject.toJSONString(liveMsg));
                     // 广播消息
                     broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
+                    // 放在当前活动里面
+                    redisCache.deleteObject(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG, liveId, TOP_MSG));
+                    redisCache.setCacheObject(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG, liveId, TOP_MSG), JSONObject.toJSONString(liveMsg));
+                    redisCache.expire(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG, liveId, TOP_MSG), msg.getDuration(), TimeUnit.MINUTES);
                     break;
                 case "globalVisible":
                     msg.setOn(true);

+ 2 - 2
fs-service/src/main/java/com/fs/live/domain/LiveCoupon.java

@@ -59,8 +59,8 @@ public class LiveCoupon extends BaseEntity
     @Excel(name = "套餐分类ids")
     private String packageCateIds;
 
-    /** 优惠券类型 0-通用 1-商品券 2-无门槛券 */
-    @Excel(name = "优惠券类型 0-通用 1-商品券 2-无门槛券")
+    /** 优惠券类型 0-普通 1-套餐 2-制单 3.无门槛 */
+    @Excel(name = "优惠券类型")
     private Long type;
 
     /** 是否删除 */

+ 1 - 1
fs-service/src/main/java/com/fs/live/mapper/LiveAfterSalesMapper.java

@@ -123,7 +123,7 @@ public interface LiveAfterSalesMapper {
             "</if>" +
             "order by create_time desc "+
             "</script>"})
-    List<LiveAfterSalesQueryVO> selectLiveAfterSalesListQuery(LiveAfterSalesQueryParam param);
+    List<LiveAfterSalesQueryVO> selectLiveAfterSalesListQuery(@Param("maps") LiveAfterSalesQueryParam param);
 
     @Select({"<script> " +
             "select ifnull(count(1),0) from live_after_sales   " +

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

@@ -81,7 +81,7 @@ public interface LiveMsgMapper
             "    SUM(CASE WHEN live_flag = 1 THEN 1 ELSE 0 END) AS liveCommentNum, " +
             "    SUM(CASE WHEN replay_flag = 1 THEN 1 ELSE 0 END) AS replayCommentNum " +
             "FROM live_msg WHERE live_id = #{liveId}")
-    Map<String, Long> selectDashboardCount(@Param("liveId") Long liveId);
+    Map<String, BigDecimal> selectDashboardCount(@Param("liveId") Long liveId);
 
     List<LiveMsg> selectLiveMsgSingleList(LiveMsg liveMsg);
 }

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

@@ -77,56 +77,56 @@ public class LiveDataServiceImpl implements ILiveDataService {
         // 查询观看和点赞数据(直播和回放)
         Map<String, Integer> liveDataMap = baseMapper.selectDashboardCount(liveId);
         // 查询评论数据(直播和回放)
-        Map<String, Long> msgMap = liveMsgMapper.selectDashboardCount(liveId);
+        Map<String, BigDecimal> msgMap = liveMsgMapper.selectDashboardCount(liveId);
         // 查询分享和直接访问数据
         Map<String, BigDecimal> firstEntryMap = liveUserFirstEntryMapper.selectDashboardCount(liveId);
-        
+
         LiveDashBoardDataVo result = new LiveDashBoardDataVo();
-        
+
         // 在线人数
-        result.setOnlineNum(watchUserMap == null ? BigDecimal.valueOf(0) : 
+        result.setOnlineNum(watchUserMap == null ? BigDecimal.valueOf(0) :
             watchUserMap.getOrDefault("onlineNum", BigDecimal.valueOf(0)));
-        
+
         // 直播用户数据
-        result.setLiveNewUserNum(watchUserMap == null ? BigDecimal.valueOf(0) : 
+        result.setLiveNewUserNum(watchUserMap == null ? BigDecimal.valueOf(0) :
             watchUserMap.getOrDefault("liveNewUserNum", BigDecimal.valueOf(0)));
-        result.setLiveOldUserNum(watchUserMap == null ? BigDecimal.valueOf(0) : 
+        result.setLiveOldUserNum(watchUserMap == null ? BigDecimal.valueOf(0) :
             watchUserMap.getOrDefault("liveOldUserNum", BigDecimal.valueOf(0)));
-        
+
         // 回放用户数据
-        result.setReplayNewUserNum(watchUserMap == null ? BigDecimal.valueOf(0) : 
+        result.setReplayNewUserNum(watchUserMap == null ? BigDecimal.valueOf(0) :
             watchUserMap.getOrDefault("replayNewUserNum", BigDecimal.valueOf(0)));
-        result.setReplayOldUserNum(watchUserMap == null ? BigDecimal.valueOf(0) : 
+        result.setReplayOldUserNum(watchUserMap == null ? BigDecimal.valueOf(0) :
             watchUserMap.getOrDefault("replayOldUserNum", BigDecimal.valueOf(0)));
-        
+
         // 直播观看和点赞数据
-        result.setLiveViewNum(liveDataMap == null ? 0 : 
+        result.setLiveViewNum(liveDataMap == null ? 0 :
             liveDataMap.getOrDefault("liveViewNum", 0));
-        result.setLiveLikeNum(liveDataMap == null ? 0 : 
+        result.setLiveLikeNum(liveDataMap == null ? 0 :
             liveDataMap.getOrDefault("liveLikeNum", 0));
-        
+
         // 回放观看和点赞数据
-        result.setReplayViewNum(liveDataMap == null ? 0 : 
+        result.setReplayViewNum(liveDataMap == null ? 0 :
             liveDataMap.getOrDefault("replayViewNum", 0));
-        result.setReplayLikeNum(liveDataMap == null ? 0 : 
+        result.setReplayLikeNum(liveDataMap == null ? 0 :
             liveDataMap.getOrDefault("replayLikeNum", 0));
-        
+
         // 直播和回放评论数据
-        result.setLiveCommentNum(msgMap == null ? 0L : 
-            msgMap.getOrDefault("liveCommentNum", 0L));
-        result.setReplayCommentNum(msgMap == null ? 0L : 
-            msgMap.getOrDefault("replayCommentNum", 0L));
-        
+        result.setLiveCommentNum(msgMap == null ? BigDecimal.valueOf(0) :
+            msgMap.getOrDefault("liveCommentNum", BigDecimal.valueOf(0)));
+        result.setReplayCommentNum(msgMap == null ? BigDecimal.valueOf(0) :
+            msgMap.getOrDefault("replayCommentNum", BigDecimal.valueOf(0)));
+
         // 分享和直接访问数据
-        result.setShareUrlNum(firstEntryMap == null ? BigDecimal.valueOf(0) : 
+        result.setShareUrlNum(firstEntryMap == null ? BigDecimal.valueOf(0) :
             firstEntryMap.getOrDefault("shareUrlNum", BigDecimal.valueOf(0)));
-        result.setDirectAccessNum(firstEntryMap == null ? BigDecimal.valueOf(0) : 
+        result.setDirectAccessNum(firstEntryMap == null ? BigDecimal.valueOf(0) :
             firstEntryMap.getOrDefault("directAccessNum", BigDecimal.valueOf(0)));
-        
+
         // 邀请用户列表
         List<LiveUserFirstVo> liveUserFirstVos = liveUserFirstEntryMapper.selectDashboardInviteCount(liveId);
         result.setInviteUserList(liveUserFirstVos);
-        
+
         return R.ok().put("data", result);
     }
 

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

@@ -192,7 +192,7 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
             return R.error("您已经领取过红包了!");
         }
         /*try {*/
-/*            //获取红包锁
+/*            //获取红包锁w
             if (!tryLock(claimKey, red.getUserId().toString(), 5)) {
                 return R.error("您已经领取过红包了!");
             }*/

+ 2 - 2
fs-service/src/main/java/com/fs/live/vo/LiveDashBoardDataVo.java

@@ -24,10 +24,10 @@ public class LiveDashBoardDataVo {
     private Integer replayLikeNum;
 
     // 直播评论数量 liveMsg
-    private Long liveCommentNum;
+    private BigDecimal liveCommentNum;
 
     // 回放评论数量 liveMsg
-    private Long replayCommentNum;
+    private BigDecimal replayCommentNum;
 
     // 直播新用户数量 liveWatchUser
     private BigDecimal liveNewUserNum;

+ 59 - 0
fs-service/src/main/java/com/fs/live/vo/LiveMsgVo.java

@@ -0,0 +1,59 @@
+package com.fs.live.vo;
+
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 直播讨论对象 live_msg
+ *
+ * @author fs
+ * @date 2025-01-17
+ */
+@Data
+public class LiveMsgVo {
+
+    /** id */
+
+    private Long msgId;
+
+    /** 直播ID */
+    @Excel(name = "直播ID")
+    private Long liveId;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private Long userId;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private String nickName;
+
+    /** 用户ID */
+    @Excel(name = "用户ID")
+    private String avatar;
+
+    /** 消息 */
+    @Excel(name = "消息")
+    private String msg;
+
+    @TableField(exist = false)
+    private Integer singleVisible;
+
+    /** 直播消息标记:0-否 1-是 */
+    @Excel(name = "直播消息标记")
+    private Integer liveFlag = 0;
+
+    /** 回放消息标记:0-否 1-是 */
+    @Excel(name = "回放消息标记")
+    private Integer replayFlag = 0;
+
+    private String endTime;
+}

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

@@ -2,6 +2,7 @@ package com.fs.live.vo;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.models.auth.In;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -51,4 +52,5 @@ public class LiveVo {
     private String previewUrl;
     private Integer previewVideoType;
     private Long previewVideoId;
+    private Integer globalVisible;
 }

+ 1 - 1
fs-service/src/main/resources/application-config-druid-bjzm-test.yml

@@ -73,7 +73,7 @@ tencent_cloud_config:
   secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
   bucket: bjzm-1323137866
   app_id: 1323137866
-  region: ap-guangzhou
+  region: ap-chongqing
   proxy: bjzm
 tmp_secret_config:
   secret_id: AKIDCj7NSNAovtqeJpBau8GZ4CGB71thXIxX

+ 1 - 1
fs-service/src/main/resources/application-config-druid-bjzm.yml

@@ -73,7 +73,7 @@ tencent_cloud_config:
   secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
   bucket: bjzmky-1323137866
   app_id: 1323137866
-  region: ap-guangzhou
+  region: ap-chongqing
   proxy: bjzm
 tmp_secret_config:
   secret_id: AKIDCj7NSNAovtqeJpBau8GZ4CGB71thXIxX

+ 6 - 1
fs-service/src/main/resources/mapper/live/LiveCouponMapper.xml

@@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="isDel"    column="is_del"    />
+        <result property="limitReceiveCount"    column="limit_receive_count"    />
     </resultMap>
 
     <sql id="selectLiveCouponVo">
-        select coupon_id, title, integral, coupon_price, use_min_price, coupon_time, sort, status, product_ids, package_cate_ids, type, create_time, update_time, is_del from live_coupon
+        select coupon_id, title, integral, coupon_price, use_min_price, coupon_time, sort, status, product_ids, package_cate_ids, type, create_time, update_time, is_del,limit_receive_count from live_coupon
     </sql>
 
     <select id="selectLiveCouponList" parameterType="LiveCoupon" resultMap="LiveCouponResult">
@@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="packageCateIds != null  and packageCateIds != ''"> and package_cate_ids = #{packageCateIds}</if>
             <if test="type != null "> and type = #{type}</if>
             <if test="isDel != null "> and is_del = #{isDel}</if>
+            <if test="limitReceiveCount != null "> and limit_receive_count = #{limitReceiveCount}</if>
         </where>
     </select>
 
@@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="isDel != null">is_del,</if>
+            <if test="limitReceiveCount != null">limit_receive_count,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="title != null and title != ''">#{title},</if>
@@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="isDel != null">#{isDel},</if>
+            <if test="limitReceiveCount != null">#{limitReceiveCount},</if>
          </trim>
     </insert>
 
@@ -97,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="isDel != null">is_del = #{isDel},</if>
+            <if test="limitReceiveCount != null">limit_receive_count = #{limitReceiveCount},</if>
         </trim>
         where coupon_id = #{couponId}
     </update>

+ 9 - 0
fs-user-app/pom.xml

@@ -136,6 +136,15 @@
                     <warName>${project.artifactId}</warName>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <compilerArgs>
+                        <arg>-parameters</arg>
+                    </compilerArgs>
+                </configuration>
+            </plugin>
         </plugins>
         <finalName>${project.artifactId}</finalName>
     </build>

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

@@ -1,5 +1,6 @@
 package com.fs.app.controller.live;
 
+import com.fs.app.annotation.Login;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -40,6 +41,7 @@ public class LiveMsgController extends BaseController
     /**
      * 查询直播讨论列表
      */
+    @Login
     @GetMapping("/myList")
     public TableDataInfo myList(LiveMsg liveMsg)
     {

+ 12 - 9
fs-user-app/src/main/java/com/fs/app/facade/impl/LiveFacadeServiceImpl.java

@@ -11,19 +11,13 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.PageRequest;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.redis.RedisCache;
-import com.fs.live.domain.Live;
-import com.fs.live.domain.LiveLotteryRegistration;
+import com.fs.live.domain.*;
 import com.fs.framework.aspectj.lock.DistributeLock;
-import com.fs.live.domain.LiveRedConf;
-import com.fs.live.domain.LiveWatchUser;
 import com.fs.live.param.CouponPO;
 import com.fs.live.param.LotteryPO;
 import com.fs.live.param.RedPO;
 import com.fs.live.service.*;
-import com.fs.live.vo.LiveConfigVo;
-import com.fs.live.vo.LiveLotteryConfVo;
-import com.fs.live.vo.LiveVo;
-import com.fs.live.vo.LiveWatchUserVO;
+import com.fs.live.vo.*;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -153,10 +147,19 @@ public class LiveFacadeServiceImpl extends BaseController implements LiveFacadeS
                 .stream()
                 .filter(item -> ObjectUtil.isEmpty(redisCache.hashGet(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG_RED, liveId, item.getLotteryId()), userId)))
                 .collect(Collectors.toList());
+        Object cacheObject = redisCache.getCacheObject(String.format(LiveKeysConstant.LIVE_HOME_PAGE_CONFIG, liveId, LiveKeysConstant.TOP_MSG));
+        LiveMsgVo liveMsg;
+        if (ObjectUtil.isNotEmpty(cacheObject)) {
+            liveMsg = JSON.parseObject(cacheObject.toString(), LiveMsgVo.class);
+        } else {
+            liveMsg = null;
+        }
+
         return R.ok()
                 .put("red", redConfs)
                 .put("lottery", lotteryConfs)
-                .put("goods", liveConfigVo.getLiveGoodsVo());
+                .put("goods", liveConfigVo.getLiveGoodsVo())
+                .put("topMsg", liveMsg);
     }
 
     @Override