Explorar o código

卓美马甲功能

yuhongqi hai 18 horas
pai
achega
2ce378d139

+ 2 - 2
fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java

@@ -1991,11 +1991,11 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                     createLiveWatchLogAndEnQueue(companyId,companyUserId,externalId, setting.getLiveId(),sysConfig.getAppId(),1,qwUserId,logVo.getCorpId());
                     break;
                 case "21"://短信看课
-                    boolean check = !Long.valueOf(0L).equals(sopLogs.getFsUserId());
+                    boolean check = sopLogs.getFsUserId() != null && !Long.valueOf(0L).equals(sopLogs.getFsUserId());
                     if ("济南联志健康".equals(signProjectName)) {
                         check = true;
                     }
-                    if (sopLogs.getFsUserId() != null && check) {
+                    if (check) {
                         addWatchLogIfNeeded(sopLogs, videoId, courseId, sendTime, qwUserId, companyUserId, companyId, externalId, logVo,2);
                         sortLink = generateSmsShortLink(setting, logVo, sendTime, courseId, videoId,
                                 qwUserId, companyUserId, companyId, externalId, isOfficial, sopLogs.getFsUserId());

+ 7 - 0
fs-service/src/main/java/com/fs/life/service/IFsLifeVideoService.java

@@ -27,6 +27,13 @@ public interface IFsLifeVideoService {
 
     List<LifeVideoCardVO> selectFeedVideos(LifeFeedParam param);
 
+    /** 进行中的公域直播卡片(含马甲信息),开播时间从早到晚 */
+    List<com.fs.life.vo.LifeLiveCardVO> selectPublicLivingCardList();
+
+    /** 公域直播卡片详情 */
+    com.fs.life.vo.LifeLiveCardVO selectPublicLivingCardById(Long liveId);
+
+    @Deprecated
     List<com.fs.live.domain.Live> selectPublicLivingList();
 
     LifeVideoCardVO detail(Long videoId, Long userId);

+ 29 - 7
fs-service/src/main/java/com/fs/life/service/impl/FsLifeVideoServiceImpl.java

@@ -150,8 +150,9 @@ public class FsLifeVideoServiceImpl implements IFsLifeVideoService {
         LifeFeedVO vo = new LifeFeedVO();
         String tab = StringUtils.isEmpty(param.getTab()) ? "all" : param.getTab();
         if ("all".equalsIgnoreCase(tab)) {
-            vo.setLives(selectPublicLivingList());
+            vo.setLives(selectPublicLivingCardList());
         } else {
+            // 今日主推等 Tab:不展示直播,仅视频
             vo.setLives(new ArrayList<>());
         }
         vo.setVideos(selectFeedVideos(param));
@@ -165,6 +166,24 @@ public class FsLifeVideoServiceImpl implements IFsLifeVideoService {
     }
 
     @Override
+    public List<com.fs.life.vo.LifeLiveCardVO> selectPublicLivingCardList() {
+        return liveMapper.selectPublicLivingCardList();
+    }
+
+    @Override
+    public com.fs.life.vo.LifeLiveCardVO selectPublicLivingCardById(Long liveId) {
+        if (liveId == null) {
+            throw new CustomException("直播间ID不能为空");
+        }
+        com.fs.life.vo.LifeLiveCardVO card = liveMapper.selectPublicLivingCardById(liveId);
+        if (card == null || card.getLiveId() == null) {
+            throw new CustomException("直播间不存在或非公域直播");
+        }
+        return card;
+    }
+
+    @Override
+    @Deprecated
     public List<Live> selectPublicLivingList() {
         return liveMapper.selectPublicLivingList();
     }
@@ -273,13 +292,16 @@ public class FsLifeVideoServiceImpl implements IFsLifeVideoService {
         if (create && video.getVestId() == null) {
             throw new CustomException("马甲号不能为空");
         }
-        if (StringUtils.isEmpty(video.getTitle())) {
-            throw new CustomException("视频标题不能为空");
-        }
-        if (video.getTitle().trim().length() > 20) {
-            throw new CustomException("视频标题不能超过20字");
+        // 新增必须有标题;修改仅在传入 title 时校验(上下架等部分更新不传 title)
+        if (create || video.getTitle() != null) {
+            if (StringUtils.isEmpty(video.getTitle())) {
+                throw new CustomException("视频标题不能为空");
+            }
+            if (video.getTitle().trim().length() > 20) {
+                throw new CustomException("视频标题不能超过20字");
+            }
+            video.setTitle(video.getTitle().trim());
         }
-        video.setTitle(video.getTitle().trim());
         if (create || video.getCoverUrl() != null) {
             if (StringUtils.isEmpty(video.getCoverUrl())) {
                 throw new CustomException("视频封面不能为空");

+ 2 - 3
fs-service/src/main/java/com/fs/life/vo/LifeFeedVO.java

@@ -1,14 +1,13 @@
 package com.fs.life.vo;
 
-import com.fs.live.domain.Live;
 import lombok.Data;
 
 import java.util.List;
 
 @Data
 public class LifeFeedVO {
-    /** 公域直播中列表(仅 tab=all 时填充) */
-    private List<Live> lives;
+    /** 公域直播中列表(仅 tab=all 时填充,含马甲昵称头像) */
+    private List<LifeLiveCardVO> lives;
     /** 短视频列表 */
     private List<LifeVideoCardVO> videos;
 }

+ 34 - 0
fs-service/src/main/java/com/fs/life/vo/LifeLiveCardVO.java

@@ -0,0 +1,34 @@
+package com.fs.life.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * 生活号公域直播卡片(Feed 置顶 / 直播列表)
+ */
+@Data
+public class LifeLiveCardVO {
+    private Long liveId;
+    private String liveName;
+    private String liveDesc;
+    /** 封面 */
+    private String liveImgUrl;
+    /** 2=直播中 */
+    private Integer status;
+    private Integer liveType;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime finishTime;
+    private Long vestId;
+    /** 可见范围 1公域 */
+    private Integer visibleScope;
+    private String flvHlsUrl;
+    private String rtmpUrl;
+    /** 马甲昵称(双列展示) */
+    private String vestNickName;
+    /** 马甲头像 */
+    private String vestAvatar;
+}

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

@@ -273,7 +273,17 @@ public interface LiveMapper
     int countLiveByTrainingPeriodId(@Param("periodId") Long periodId);
 
     /**
-     * 生活号:进行中的公域直播,按开播时间升序
+     * 生活号:进行中的公域直播,按开播时间从早到晚(含马甲昵称头像)
+     */
+    List<com.fs.life.vo.LifeLiveCardVO> selectPublicLivingCardList();
+
+    /**
+     * 生活号:公域直播卡片详情(仅公域且未删除)
+     */
+    com.fs.life.vo.LifeLiveCardVO selectPublicLivingCardById(@Param("liveId") Long liveId);
+
+    /**
+     * 生活号:进行中的公域直播(实体,兼容旧调用)
      */
     List<Live> selectPublicLivingList();
 }

+ 1 - 1
fs-service/src/main/java/com/fs/qw/mapper/QwUserMapper.java

@@ -343,7 +343,7 @@ public interface QwUserMapper extends BaseMapper<QwUser>
             "            <if test=\"nickName != null  and nickName != ''\"> and cu.nick_name like concat( '%',#{nickName}, '%') </if>\n" +
             "            <if test=\"qwUserName != null  and qwUserName != ''\"> and qu.qw_user_name like concat( '%',#{qwUserName}, '%') </if>\n" +
             "            <if test=\"corpId != null \"> and qu.corp_id = #{corpId}</if>\n" +
-            "            <if test=\"qwUserId != null \"> and qu.qw_user_id  like concat( #{qwUserId}, '%') </if>\n" +
+            "            <if test=\"qwUserId != null \"> and qu.qw_user_id  like concat('%' ,#{qwUserId}, '%') </if>\n" +
             "            <if test=\"status != null \"> and qu.status = #{status}</if>\n" +
             "            <if test=\"type != null and sendType !=null and type==2 and sendType==2 \"> and qu.app_key IS NOT NULL  </if>\n" +
             "</script>"})

+ 1 - 1
fs-service/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
 
         <if test="nickName != null and nickName != ''">
-            AND u.nick_name like concat( #{nickName}, '%')
+            AND u.nick_name like concat('%', #{nickName}, '%')
         </if>
 
         <if test="companyId != null and companyId != ''">

+ 48 - 0
fs-service/src/main/resources/mapper/live/LiveMapper.xml

@@ -474,4 +474,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by start_time asc, live_id asc
     </select>
 
+    <!-- 生活号公域直播卡片:进行中 + 马甲昵称/头像,开播时间从早到晚 -->
+    <select id="selectPublicLivingCardList" resultType="com.fs.life.vo.LifeLiveCardVO">
+        select l.live_id        as liveId,
+               l.live_name      as liveName,
+               l.live_desc      as liveDesc,
+               l.live_img_url   as liveImgUrl,
+               l.status         as status,
+               l.live_type      as liveType,
+               l.start_time     as startTime,
+               l.finish_time    as finishTime,
+               l.vest_id        as vestId,
+               l.visible_scope  as visibleScope,
+               l.flv_hls_url    as flvHlsUrl,
+               l.rtmp_url       as rtmpUrl,
+               v.nick_name      as vestNickName,
+               v.avatar         as vestAvatar
+        from live l
+        left join fs_life_vest v on v.id = l.vest_id and ifnull(v.is_del, 0) = 0
+        where l.is_del = 0
+          and l.is_show = 1
+          and l.status = 2
+          and l.visible_scope = 1
+        order by l.start_time asc, l.live_id asc
+    </select>
+
+    <select id="selectPublicLivingCardById" resultType="com.fs.life.vo.LifeLiveCardVO">
+        select l.live_id        as liveId,
+               l.live_name      as liveName,
+               l.live_desc      as liveDesc,
+               l.live_img_url   as liveImgUrl,
+               l.status         as status,
+               l.live_type      as liveType,
+               l.start_time     as startTime,
+               l.finish_time    as finishTime,
+               l.vest_id        as vestId,
+               l.visible_scope  as visibleScope,
+               l.flv_hls_url    as flvHlsUrl,
+               l.rtmp_url       as rtmpUrl,
+               v.nick_name      as vestNickName,
+               v.avatar         as vestAvatar
+        from live l
+        left join fs_life_vest v on v.id = l.vest_id and ifnull(v.is_del, 0) = 0
+        where l.live_id = #{liveId}
+          and l.is_del = 0
+          and l.visible_scope = 1
+        limit 1
+    </select>
+
 </mapper>

+ 11 - 4
fs-user-app/src/main/java/com/fs/app/controller/cacheLive/CacheLiveWatchUserController.java

@@ -2,18 +2,18 @@ package com.fs.app.controller.cacheLive;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.json.JSONUtil;
+import com.fs.app.annotation.Login;
 import com.fs.common.constant.LiveKeysConstant;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.live.domain.LiveWatchUser;
+import com.fs.live.param.LiveIsAddKfParam;
 import com.fs.live.service.ILiveWatchUserService;
 import com.fs.live.vo.LiveWatchUserVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Collections;
 import java.util.List;
@@ -67,4 +67,11 @@ public class CacheLiveWatchUserController extends CacheLiveBaseController {
                 () -> liveWatchUserService.selectLiveWatchUserById(id));
         return AjaxResult.success(user);
     }
+    @Login
+    @PostMapping("/liveIsAddKf")
+    public R liveIsAddKf(@RequestBody LiveIsAddKfParam param){
+        String userId = getUserId();
+        param.setUserId(Long.valueOf(userId));
+        return liveWatchUserService.liveIsAddKf(param);
+    }
 }

+ 37 - 10
fs-user-app/src/main/java/com/fs/app/controller/life/LifeController.java

@@ -6,8 +6,8 @@ import com.fs.common.core.domain.R;
 import com.fs.common.utils.StringUtils;
 import com.fs.life.param.LifeFeedParam;
 import com.fs.life.service.IFsLifeVideoService;
+import com.fs.life.vo.LifeLiveCardVO;
 import com.fs.life.vo.LifeVideoCardVO;
-import com.fs.live.domain.Live;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -22,6 +22,11 @@ import java.util.Map;
 
 /**
  * 生活号 C 端接口
+ * <p>
+ * 公域直播规则(对齐验收用例):
+ * - 「全部」:仅 status=2 且 visible_scope=1 的直播,按开播时间从早到晚,展示马甲昵称/头像,置于视频流上方
+ * - 「今日主推」:lives 为空,仅视频
+ * - 私域直播不上生活号(制单分享等内容入口另走)
  */
 @Api(tags = "生活号")
 @RestController
@@ -40,14 +45,16 @@ public class LifeController extends AppBaseController {
         if (param.getPageSize() == null || param.getPageSize() < 1) {
             param.setPageSize(10);
         }
-        if (StringUtils.isNotEmpty(getUserId())) {
-            param.setUserId(Long.parseLong(getUserId()));
+        Long userId = parseUserIdQuietly();
+        if (userId != null) {
+            param.setUserId(userId);
         }
 
         String tab = StringUtils.isEmpty(param.getTab()) ? "all" : param.getTab();
-        List<Live> lives = new ArrayList<>();
+        List<LifeLiveCardVO> lives = new ArrayList<>();
+        // 仅「全部」展示进行中公域直播;今日主推只有视频
         if ("all".equalsIgnoreCase(tab)) {
-            lives = fsLifeVideoService.selectPublicLivingList();
+            lives = fsLifeVideoService.selectPublicLivingCardList();
         }
 
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
@@ -60,14 +67,22 @@ public class LifeController extends AppBaseController {
         return R.ok().put("data", data);
     }
 
+    @ApiOperation("进行中的公域直播列表(双列置顶区,含马甲昵称头像)")
+    @GetMapping("/lives")
+    public R livingList() {
+        return R.ok().put("data", fsLifeVideoService.selectPublicLivingCardList());
+    }
+
+    @ApiOperation("公域直播卡片详情(含马甲信息;非公域或不存在报错)")
+    @GetMapping("/live/{liveId}")
+    public R liveDetail(@PathVariable("liveId") Long liveId) {
+        return R.ok().put("data", fsLifeVideoService.selectPublicLivingCardById(liveId));
+    }
+
     @ApiOperation("视频详情")
     @GetMapping("/video/{id}")
     public R detail(@PathVariable("id") Long id) {
-        Long userId = null;
-        if (StringUtils.isNotEmpty(getUserId())) {
-            userId = Long.parseLong(getUserId());
-        }
-        LifeVideoCardVO detail = fsLifeVideoService.detail(id, userId);
+        LifeVideoCardVO detail = fsLifeVideoService.detail(id, parseUserIdQuietly());
         return R.ok().put("data", detail);
     }
 
@@ -118,4 +133,16 @@ public class LifeController extends AppBaseController {
     public R products(@PathVariable("id") Long id) {
         return R.ok().put("data", fsLifeVideoService.listProducts(id));
     }
+
+    private Long parseUserIdQuietly() {
+        String uid = getUserId();
+        if (StringUtils.isEmpty(uid)) {
+            return null;
+        }
+        try {
+            return Long.parseLong(uid);
+        } catch (Exception e) {
+            return null;
+        }
+    }
 }