瀏覽代碼

Merge branch '20251105-wyp-videoCollect' into test

wangyunpeng 1 周之前
父節點
當前提交
50952a7b14

+ 1 - 0
api-module/src/main/java/com/tzld/piaoquan/api/common/enums/ExceptionEnum.java

@@ -60,6 +60,7 @@ public enum ExceptionEnum {
     VIDEO_INFO_FAILED(6005, "视频信息获取失败"),
     PQ_ACCOUNT_NOT_BINDING(6006, "票圈账号未绑定"),
     VIDEO_CITED(6007, "视频已被引用,不能删除"),
+    VIDEO_GET_FAILED(6008, "视频获取失败"),
 
     // 用户收藏视频
     VIDEO_NOT_EXIST(7001, "视频不存在"),

+ 6 - 6
api-module/src/main/java/com/tzld/piaoquan/api/component/VideoApiService.java

@@ -198,13 +198,13 @@ public class VideoApiService {
                     uid, excludeVideoIds, pageNum, pageSize, e);
         }
         if (Objects.isNull(res)) {
-            throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED);
+            throw new CommonException(ExceptionEnum.VIDEO_GET_FAILED);
         }
         if (res.getInteger("code") != 0) {
             log.error("VideoApiService getUserVideoList error, uid={} excludeVideoIds={} pageNum={} pageSize={} res={}",
                     uid, excludeVideoIds, pageNum, pageSize, res);
-            throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED.getCode(),
-                    ExceptionEnum.VIDEO_DELETE_FAILED.getMsg() + "," + res.getString("msg"));
+            throw new CommonException(ExceptionEnum.VIDEO_GET_FAILED.getCode(),
+                    ExceptionEnum.VIDEO_GET_FAILED.getMsg() + "," + res.getString("msg"));
         }
         return res.getJSONArray("data").toJavaList(WxVideoV2VO.class);
     }
@@ -226,13 +226,13 @@ public class VideoApiService {
                     tagName, excludeVideoIds, pageNum, pageSize, e);
         }
         if (Objects.isNull(res)) {
-            throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED);
+            throw new CommonException(ExceptionEnum.VIDEO_GET_FAILED);
         }
         if (res.getInteger("code") != 0) {
             log.error("VideoApiService getTagVideoList error, tagName={} excludeVideoIds={} pageNum={} pageSize={} res={}",
                     tagName, excludeVideoIds, pageNum, pageSize, res);
-            throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED.getCode(),
-                    ExceptionEnum.VIDEO_DELETE_FAILED.getMsg() + "," + res.getString("msg"));
+            throw new CommonException(ExceptionEnum.VIDEO_GET_FAILED.getCode(),
+                    ExceptionEnum.VIDEO_GET_FAILED.getMsg() + "," + res.getString("msg"));
         }
         return res.getJSONArray("data").toJavaList(WxVideoV2VO.class);
     }

+ 2 - 2
api-module/src/main/java/com/tzld/piaoquan/api/controller/contentplatform/ContentPlatformPlanController.java

@@ -74,8 +74,8 @@ public class ContentPlatformPlanController {
 
     @ApiOperation(value = "发布内容视频品类列表")
     @GetMapping("/videoContentCategoryList")
-    public CommonResponse<List<String>> getVideoContentCategoryList() {
-        return CommonResponse.success(planService.getVideoContentCategoryList());
+    public CommonResponse<List<String>> getVideoContentCategoryList(String category) {
+        return CommonResponse.success(planService.getVideoContentCategoryList(category));
     }
 
     @ApiOperation(value = "发布内容视频封面截帧列表")

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java

@@ -30,7 +30,7 @@ public interface ContentPlatformPlanMapperExt {
 
     String getVideoDatastatMaxDt();
 
-    List<String> getVideoCategoryList(@Param("dt") String dt);
+    List<String> getVideoCategoryList(@Param("dt") String dt, @Param("category") String category);
 
     int getApiVideoCount(@Param("param") VideoContentListParam param, @Param("dt") String dt,
                          @Param("minScore") Double minScore);

+ 31 - 4
api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComSendMsgJob.java

@@ -6,6 +6,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.piaoquan.api.component.VideoApiService;
 import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComMsgMapper;
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomMapper;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.CdnUploadImgLinkRequest;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.CdnUploadImgLinkResponse;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.SendAppMsgRequest;
@@ -54,7 +55,9 @@ public class WeComSendMsgJob {
     @Autowired
     ContentPlatformPlanMapperExt planMapperExt;
     @Autowired
-    ThirdPartWeComMsgMapper thirdPartWeComMsgMapper;
+    ThirdPartWeComRoomMapper roomMapper;
+    @Autowired
+    ThirdPartWeComMsgMapper msgMapper;
 
     @Value("${send.room.msg.video.min.score:3}")
     private Double videoMinScore;
@@ -68,9 +71,11 @@ public class WeComSendMsgJob {
     private Map<Long, JSONObject> videoSourceStaffConfig;
     @ApolloJsonValue("${send.room.msg.staff.put.scene.config:{}}")
     private Map<Long, String> staffPutSceneConfig;
+    @ApolloJsonValue("${send.room.msg.auto.open.staff:[]}")
+    private List<Long> autoOpenStaffList;
 
     private final static ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.SECONDS,
-            new LinkedBlockingQueue<>(1000),
+            new LinkedBlockingQueue<>(),
             new ThreadFactoryBuilder().setNameFormat("WeComSendMsgJob-%d").build(),
             new ThreadPoolExecutor.AbortPolicy());
 
@@ -249,7 +254,7 @@ public class WeComSendMsgJob {
         ThirdPartWeComMsgExample msgExample = new ThirdPartWeComMsgExample();
         msgExample.createCriteria().andSendUseridEqualTo(roomId)
                 .andCreateTimeGreaterThan(DateUtil.getDaysAgoDate(duplicateDays));
-        List<ThirdPartWeComMsg> msgList = thirdPartWeComMsgMapper.selectByExample(msgExample);
+        List<ThirdPartWeComMsg> msgList = msgMapper.selectByExample(msgExample);
         return msgList.stream().map(ThirdPartWeComMsg::getVideoId).collect(Collectors.toList());
     }
 
@@ -272,6 +277,28 @@ public class WeComSendMsgJob {
         msg.setMd5(request.getMd5());
         msg.setAeskey(request.getAeskey());
         msg.setFilesize(request.getFileSize());
-        thirdPartWeComMsgMapper.insertSelective(msg);
+        msgMapper.insertSelective(msg);
+    }
+
+
+    @XxlJob("autoOpenSendStatusJob")
+    public ReturnT<String> autoOpenSendStatusJob(String param) {
+        List<ThirdPartWeComStaff> activeStaffList = weComThirdPartyService.getActiveStaffList();
+        for (ThirdPartWeComStaff staff : activeStaffList) {
+            if (!autoOpenStaffList.contains(staff.getThirdStaffId())) {
+                continue;
+            }
+            List<ThirdPartWeComRoom> roomList = weComThirdPartyService.getStaffRoomList(staff.getId());
+            for (ThirdPartWeComRoom room : roomList) {
+                if (room.getSendStatus() == 1) {
+                    continue;
+                }
+                if (room.getMemberCount() > 20) {
+                    room.setSendStatus(1);
+                    roomMapper.updateByPrimaryKeySelective(room);
+                }
+            }
+        }
+        return ReturnT.SUCCESS;
     }
 }

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -44,7 +44,7 @@ public interface ContentPlatformPlanService {
 
     Page<VideoContentItemVO> getCollectVideoContentList(VideoContentListParam param);
 
-    List<String> getVideoContentCategoryList();
+    List<String> getVideoContentCategoryList(String category);
 
     List<String> getVideoContentCoverFrameList(VideoContentCoverFrameParam param);
 

+ 2 - 2
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -754,9 +754,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     }
 
     @Override
-    public List<String> getVideoContentCategoryList() {
+    public List<String> getVideoContentCategoryList(String category) {
         String dt = planMapperExt.getVideoMaxDt();
-        return planMapperExt.getVideoCategoryList(dt);
+        return planMapperExt.getVideoCategoryList(dt, category);
     }
 
     @Override

+ 3 - 0
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -239,6 +239,9 @@
         select distinct category
         from content_platform_video_agg
         where dt = #{dt} and status = 1
+        <if test="category != null and category != ''">
+            and category like concat('%', #{category}, '%')
+        </if>
     </select>
 
     <insert id="batchInsertContentPlatformVideo">

+ 5 - 0
api-module/src/test/java/com/tzld/piaoquan/api/WeComThirdPartTest.java

@@ -56,6 +56,11 @@ public class WeComThirdPartTest {
         weComSendMsgJob.autoSendAppMsg("");
     }
 
+    @Test
+    public void autoOpenSendStatusJob() {
+        weComSendMsgJob.autoOpenSendStatusJob("");
+    }
+
     @Test
     public void autoCreateRoomJob() {
         weComCreateRoomJob.autoCreateRoomJob("");