Bladeren bron

Merge branch 'master' into 20251105-wyp-videoCollect

# Conflicts:
#	api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java
#	api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java
wangyunpeng 5 dagen geleden
bovenliggende
commit
04cf7c042b

+ 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);

+ 35 - 5
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;
@@ -66,9 +69,13 @@ public class WeComSendMsgJob {
     private List<String> testRoomList;
     @ApolloJsonValue("${send.room.msg.video.source.staff.config:{}}")
     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());
 
@@ -171,7 +178,8 @@ public class WeComSendMsgJob {
             Staff staff = new Staff();
             staff.setCarrierId(String.valueOf(thirdPartWeComStaff.getThirdStaffId()));
             staff.setRemark(thirdPartWeComStaff.getName());
-            String page = messageAttachmentService.getPageNoCache(staff, video.getVideoId(), "企微", "社群");
+            String putScene = staffPutSceneConfig.getOrDefault(thirdPartWeComStaff.getThirdStaffId(), "touliu");
+            String page = messageAttachmentService.getPageNoCache(putScene, staff, video.getVideoId(), "企微", "社群");
 
             CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
             cgiReplyBucketData.setMiniVideoId(video.getVideoId());
@@ -246,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());
     }
 
@@ -269,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("");

+ 5 - 5
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/Impl/MessageAttachmentServiceImpl.java

@@ -398,7 +398,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             if (StringUtils.isNotEmpty(page)) {
                 return page;
             }
-            return insertPage(staff.getCarrierId(), videoId, staff.getRemark(), typeOne, typeTwo);
+            return insertPage("touliu", staff.getCarrierId(), videoId, staff.getRemark(), typeOne, typeTwo);
         } catch (IOException e) {
             log.error("MessageAttachmentService getPage error", e);
         }
@@ -406,24 +406,24 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     }
 
     @Override
-    public String getPageNoCache(Staff staff, Long videoId, String typeOne, String typeTwo) {
+    public String getPageNoCache(String putScene, Staff staff, Long videoId, String typeOne, String typeTwo) {
         try {
             if (staff == null || staff.getCarrierId() == null) {
                 return "";
             }
-            return insertPage(staff.getCarrierId(), videoId, staff.getRemark(), typeOne, typeTwo);
+            return insertPage(putScene, staff.getCarrierId(), videoId, staff.getRemark(), typeOne, typeTwo);
         } catch (IOException e) {
             log.error("MessageAttachmentService getPageNoCache error", e);
         }
         return null;
     }
 
-    private String insertPage(String carrierId, Long videoId, String remark, String typeOne, String typeTwo) throws IOException {
+    private String insertPage(String putScene, String carrierId, Long videoId, String remark, String typeOne, String typeTwo) throws IOException {
         AdPutFlowParam param = new AdPutFlowParam();
         param.setChannel("tencentqw");
         param.setPath("pages/category.html");
         param.setPutCarrierId(carrierId);
-        param.setPutScene("touliu");
+        param.setPutScene(putScene);
         param.setPutStartDate(DateUtil.getDayDateString("yyyy-MM-dd"));
         param.setPutTypeOne(typeOne);
         param.setPutTypeTwo(typeTwo);

+ 1 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/service/MessageAttachmentService.java

@@ -27,7 +27,7 @@ public interface MessageAttachmentService {
 
     String getPage(Staff staff, Long videoId, String typeOne, String typeTwo);
 
-    String getPageNoCache(Staff staff, Long videoId, String typeOne, String typeTwo);
+    String getPageNoCache(String putScene, Staff staff, Long videoId, String typeOne, String typeTwo);
 
     String getPage(String channel, String carrierId, String scene, String putTypeOne, String putTypeTwo, String putTypeThree, Long videoId);