Explorar o código

Merge branch '20251119-wyp-weCom' into test

wangyunpeng hai 1 mes
pai
achega
a6cd033179
Modificáronse 31 ficheiros con 2411 adicións e 155 borrados
  1. 7 0
      api-module/src/main/java/com/tzld/piaoquan/api/controller/wecom/thirdpart/WeComThirdPartyAccountController.java
  2. 87 0
      api-module/src/main/java/com/tzld/piaoquan/api/controller/wecom/thirdpart/WeComThirdPartyJobController.java
  3. 1 1
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java
  4. 30 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ThirdPartWeComVideoMapper.java
  5. 1 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.java
  6. 27 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComVideoMapperExt.java
  7. 199 125
      api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComSendMsgJob.java
  8. 24 0
      api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComUserDetailJob.java
  9. 198 0
      api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComVideoJob.java
  10. 21 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/param/wecom/thirdpart/SendTextMsgResponse.java
  11. 4 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/param/wecom/thirdpart/ThirdPartyConfigGetParam.java
  12. 22 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComMsg.java
  13. 130 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComMsgExample.java
  14. 134 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComVideo.java
  15. 921 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComVideoExample.java
  16. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigTaskContentVO.java
  17. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigTaskVO.java
  18. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigVO.java
  19. 5 0
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyAccountService.java
  20. 12 0
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyRoomService.java
  21. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyService.java
  22. 78 1
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyAccountServiceImpl.java
  23. 67 5
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyRoomServiceImpl.java
  24. 17 0
      api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyServiceImpl.java
  25. 1 6
      api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml
  26. 51 15
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComMsgMapper.xml
  27. 309 0
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComVideoMapper.xml
  28. 9 0
      api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.xml
  29. 0 1
      api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComStaffMapperExt.xml
  30. 46 0
      api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComVideoMapperExt.xml
  31. 2 1
      api-module/src/main/resources/mybatis-api-wecomThirdpart-generator-config.xml

+ 7 - 0
api-module/src/main/java/com/tzld/piaoquan/api/controller/wecom/thirdpart/WeComThirdPartyAccountController.java

@@ -75,4 +75,11 @@ public class WeComThirdPartyAccountController {
         return CommonResponse.success();
     }
 
+    @ApiOperation(value = "初始化账号配置")
+    @PostMapping("/initAccountConfig")
+    public CommonResponse<Void> initAccountConfig() {
+        service.initAccountConfig();
+        return CommonResponse.success();
+    }
+
 }

+ 87 - 0
api-module/src/main/java/com/tzld/piaoquan/api/controller/wecom/thirdpart/WeComThirdPartyJobController.java

@@ -0,0 +1,87 @@
+package com.tzld.piaoquan.api.controller.wecom.thirdpart;
+
+import com.tzld.piaoquan.api.job.wecom.thirdpart.*;
+import com.tzld.piaoquan.growth.common.common.base.CommonResponse;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@RequestMapping("/wecom/thirdpart/job")
+public class WeComThirdPartyJobController {
+
+    @Autowired
+    WeComSendMsgJob weComSendMsgJob;
+    @Autowired
+    WeComAccountJob weComAccountJob;
+    @Autowired
+    WeComUserDetailJob weComUserDetailJob;
+    @Autowired
+    WeComCreateRoomJob weComCreateRoomJob;
+    @Autowired
+    WeComVideoJob weComVideoJob;
+
+    @GetMapping("/autoSendAppMsg")
+    public CommonResponse<Void> autoSendAppMsg() {
+        weComSendMsgJob.autoSendAppMsg(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/autoOpenSendStatusJob")
+    public CommonResponse<Void> autoOpenSendStatusJob() {
+        weComSendMsgJob.autoOpenSendStatusJob(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/randomRoomSendTimeJob")
+    public CommonResponse<Void> randomRoomSendTimeJob() {
+        weComSendMsgJob.randomRoomSendTimeJob(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/checkAccountOnline")
+    public CommonResponse<Void> checkAccountOnline() {
+        weComAccountJob.checkAccountOnline(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/syncUserDetail")
+    public CommonResponse<Void> syncUserDetail() {
+        weComUserDetailJob.syncUserDetail(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/syncRoomDetail")
+    public CommonResponse<Void> syncRoomDetail() {
+        weComUserDetailJob.syncRoomDetail(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/autoCreateRoom")
+    public CommonResponse<Void> autoCreateRoom() {
+        weComCreateRoomJob.autoCreateRoomJob(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/autoAddRoomUser")
+    public CommonResponse<Void> autoAddRoomUser() {
+        weComCreateRoomJob.autoAddRoomUserJob(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/syncThirdPartWeComVideoJob")
+    public CommonResponse<Void> syncThirdPartWeComVideoJob() {
+        weComVideoJob.syncThirdPartWeComVideoJob(null);
+        return CommonResponse.success();
+    }
+
+    @GetMapping("/checkThirdPartWeComVideoStatusJob")
+    public CommonResponse<Void> checkThirdPartWeComVideoStatusJob() {
+        weComVideoJob.checkThirdPartWeComVideoStatusJob(null);
+        return CommonResponse.success();
+    }
+
+}

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

@@ -73,7 +73,7 @@ public interface ContentPlatformPlanMapperExt {
 
     List<ContentPlatformVideo> getVideoMinScoreList(@Param("dt") String dt,
                                                     @Param("minScore") Double minScore,
-                                                    @Param("excludeVideoIds") List<Long> excludeVideoIds,
+                                                    @Param("roomId") String roomId,
                                                     @Param("offset") int offset,
                                                     @Param("pageSize") Integer pageSize,
                                                     @Param("sort") String sort);

+ 30 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ThirdPartWeComVideoMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart;
+
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideoExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface ThirdPartWeComVideoMapper {
+    long countByExample(ThirdPartWeComVideoExample example);
+
+    int deleteByExample(ThirdPartWeComVideoExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(ThirdPartWeComVideo record);
+
+    int insertSelective(ThirdPartWeComVideo record);
+
+    List<ThirdPartWeComVideo> selectByExample(ThirdPartWeComVideoExample example);
+
+    ThirdPartWeComVideo selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") ThirdPartWeComVideo record, @Param("example") ThirdPartWeComVideoExample example);
+
+    int updateByExample(@Param("record") ThirdPartWeComVideo record, @Param("example") ThirdPartWeComVideoExample example);
+
+    int updateByPrimaryKeySelective(ThirdPartWeComVideo record);
+
+    int updateByPrimaryKey(ThirdPartWeComVideo record);
+}

+ 1 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.java

@@ -14,4 +14,5 @@ public interface ThirdPartWeComRoomMapperExt {
                                          @Param("pushAccountId") Long pushAccountId,
                                          @Param("offset") int offset, @Param("pageSize") Integer pageSize);
 
+    List<ThirdPartWeComRoom> getNoConfigRoomList(@Param("staffId") Long id);
 }

+ 27 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComVideoMapperExt.java

@@ -0,0 +1,27 @@
+package com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext;
+
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ThirdPartWeComVideoMapperExt {
+
+    String getVideoMaxDt();
+
+    void updateOtherVideoStatus(@Param("dt") String dt, @Param("videoIdList") List<Long> videoIdList, @Param("now") Long now);
+
+    void batchInsertThirdPartWeComVideo(@Param("records") List<ThirdPartWeComVideo> saveList);
+
+    void updateVideoStatusWithOldStatus(@Param("videoId") Long videoId,
+                                        @Param("status") Integer status,
+                                        @Param("oldStatus") Integer oldStatus,
+                                        @Param("now") Long now);
+
+    List<ContentPlatformVideo> getVideoMinScoreList(@Param("videoMinScore") Double videoMinScore,
+                                                    @Param("roomId") String roomId,
+                                                    @Param("offset") int offset,
+                                                    @Param("limit") int limit,
+                                                    @Param("sort") String sort);
+}

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

@@ -1,20 +1,20 @@
 package com.tzld.piaoquan.api.job.wecom.thirdpart;
 
 import com.alibaba.fastjson.JSONObject;
-import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.tzld.piaoquan.api.common.enums.wecom.ConfigTaskContentTypeEnum;
 import com.tzld.piaoquan.api.common.enums.wecom.MsgSendStatusEnum;
 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.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComVideoMapperExt;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo;
-import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComMsg;
-import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComMsgExample;
-import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom;
-import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaff;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.vo.contentplatform.WxVideoV2VO;
+import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyAccountService;
+import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyRoomService;
 import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyService;
 import com.tzld.piaoquan.api.util.CdnUtil;
 import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData;
@@ -38,6 +38,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -47,12 +48,18 @@ public class WeComSendMsgJob {
     @Autowired
     WeComThirdPartyService weComThirdPartyService;
     @Autowired
+    WeComThirdPartyAccountService weComThirdPartyAccountService;
+    @Autowired
+    WeComThirdPartyRoomService weComThirdPartyRoomService;
+    @Autowired
     MessageAttachmentService messageAttachmentService;
     @Autowired
     VideoApiService videoApiService;
     @Autowired
     ContentPlatformPlanMapperExt planMapperExt;
     @Autowired
+    ThirdPartWeComVideoMapperExt videoMapperExt;
+    @Autowired
     ThirdPartWeComRoomMapper roomMapper;
     @Autowired
     ThirdPartWeComMsgMapper msgMapper;
@@ -60,24 +67,10 @@ public class WeComSendMsgJob {
     @Autowired
     RedisUtils redisUtils;
 
-    @Value("${send.room.msg.video.min.score:3}")
+    @Value("${send.room.msg.video.min.score:1}")
     private Double videoMinScore;
-    @Value("${send.room.msg.duplicate.days:7}")
+    @Value("${send.room.msg.duplicate.days:30}")
     private Integer duplicateDays;
-    @Value("${send.room.msg.video.num:2}")
-    private Integer videoNum;
-    @ApolloJsonValue("${send.room.msg.test.roomList:[]}")
-    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.staff.channel.config:{}}")
-    private Map<Long, String> staffChannelConfig;
-    @ApolloJsonValue("${send.room.msg.auto.open.staff:[]}")
-    private List<Long> autoOpenStaffList;
-    @Value("${send.room.msg.random.time:20}")
-    private Integer randomTimeRange;
 
     private final static ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.SECONDS,
             new LinkedBlockingQueue<>(),
@@ -88,24 +81,68 @@ public class WeComSendMsgJob {
     public ReturnT<String> autoSendAppMsg(String param) {
         List<ThirdPartWeComStaff> activeStaffList = weComThirdPartyService.getActiveStaffList();
         String time = DateUtil.getCurrentDateStr("HH:mm");
+        List<Long> staffIdList = activeStaffList.stream().map(ThirdPartWeComStaff::getId).collect(Collectors.toList());
+        List<ThirdPartWeComStaffConfig> staffConfigList = weComThirdPartyAccountService.getStaffConfigListByStaffIds(staffIdList);
+        Map<Long, ThirdPartWeComStaffConfig> staffConfigMap = staffConfigList.stream().collect(Collectors.toMap(ThirdPartWeComStaffConfig::getStaffId, a -> a));
         for (ThirdPartWeComStaff staff : activeStaffList) {
+            ThirdPartWeComStaffConfig staffConfig = staffConfigMap.get(staff.getId());
+            if (Objects.isNull(staffConfig) || staffConfig.getSwitchFlag() != 1) {
+                continue;
+            }
             List<ThirdPartWeComRoom> roomList = weComThirdPartyService.getStaffRoomList(staff.getId());
+            List<Long> roomIds = roomList.stream().map(ThirdPartWeComRoom::getId).collect(Collectors.toList());
+            List<ThirdPartWeComRoomConfig> roomConfigList = weComThirdPartyRoomService.getRoomConfigListByRoomIds(roomIds);
+            Map<Long, ThirdPartWeComRoomConfig> roomConfigMap = roomConfigList.stream().collect(Collectors.toMap(ThirdPartWeComRoomConfig::getRoomId, a -> a));
+            List<String> configIds = roomConfigList.stream().map(ThirdPartWeComRoomConfig::getId).map(String::valueOf).collect(Collectors.toList());
+            List<ThirdPartWeComRoomConfigTask> roomConfigTaskList = weComThirdPartyRoomService.getRoomConfigTasks(configIds);
+            Map<String, List<ThirdPartWeComRoomConfigTask>> roomConfigTaskMap = roomConfigTaskList.stream()
+                    .filter(o -> o.getSwitchFlag() == 1).collect(Collectors.groupingBy(ThirdPartWeComRoomConfigTask::getConfigId));
             for (ThirdPartWeComRoom room : roomList) {
                 if (room.getSendStatus() != 1) {
                     continue;
                 }
                 pool.execute(() -> {
-                    List<String> timeList = getRoomSendTime(room);
-                    if (timeList.contains(time)) {
-                        // 选取视频
-                        List<CgiReplyBucketData> cgiReplyBucketDataList = getCgiReplyBucketData(room.getThirdRoomId(), staff);
-                        for (CgiReplyBucketData cgiReplyBucketData : cgiReplyBucketDataList) {
-                            // build发送体
-                            SendAppMsgRequest request = buildSendAppMsgRequest(cgiReplyBucketData, staff, room);
-                            // 发送消息
-                            CommonResponse<SendAppMsgResponse> response = weComThirdPartyService.sendAppMsg(staff, room, request);
-                            // 存储消息
-                            saveWeComMsg(staff.getId(), cgiReplyBucketData.getMiniVideoId(), request, response);
+                    ThirdPartWeComRoomConfig roomConfig = roomConfigMap.get(room.getId());
+                    if (roomConfig == null) {
+                        return;
+                    }
+                    List<ThirdPartWeComRoomConfigTask> taskList = roomConfigTaskMap.getOrDefault(roomConfig.getId(), new ArrayList<>());
+                    if (taskList.isEmpty()) {
+                        return;
+                    }
+                    List<String> configTaskIds = taskList.stream().map(ThirdPartWeComRoomConfigTask::getId).collect(Collectors.toList());
+                    List<ThirdPartWeComRoomConfigTaskContent> taskContentList = weComThirdPartyRoomService.getRoomConfigTaskContents(configTaskIds);
+                    Map<String, List<ThirdPartWeComRoomConfigTaskContent>> taskContentMap = taskContentList.stream()
+                            .collect(Collectors.groupingBy(ThirdPartWeComRoomConfigTaskContent::getTaskId));
+                    for (ThirdPartWeComRoomConfigTask configTask : taskList) {
+                        List<String> timeList = getRoomSendTime(room, roomConfig, configTask);
+                        if (timeList.contains(time)) {
+                            // 选取视频
+                            List<ThirdPartWeComRoomConfigTaskContent> contentList = taskContentMap.get(configTask.getId());
+                            if (Objects.isNull(contentList) || contentList.isEmpty()) {
+                                continue;
+                            }
+                            contentList = contentList.stream().sorted(Comparator.comparing(ThirdPartWeComRoomConfigTaskContent::getSeq)).collect(Collectors.toList());
+                            for (ThirdPartWeComRoomConfigTaskContent configTaskContent : contentList) {
+                                if (ConfigTaskContentTypeEnum.TEXT.getVal() == configTaskContent.getType()) {
+                                    // build发送体
+                                    SendTextMsgRequest request = buildSendTextMsgRequest(configTaskContent.getContent(), staff, room);
+                                    // 发送消息
+                                    CommonResponse<SendTextMsgResponse> response = weComThirdPartyService.sendTextMsg(staff, room, request);
+                                    // 存储消息
+                                    saveTextWeComMsg(staff.getId(), configTaskContent.getContent(), request, response);
+                                } else if (ConfigTaskContentTypeEnum.MINI_PROGRAM.getVal() == configTaskContent.getType()) {
+                                    List<CgiReplyBucketData> cgiReplyBucketDataList = getCgiReplyBucketData(room.getThirdRoomId(), staff, roomConfig, configTaskContent);
+                                    for (CgiReplyBucketData cgiReplyBucketData : cgiReplyBucketDataList) {
+                                        // build发送体
+                                        SendAppMsgRequest request = buildSendAppMsgRequest(cgiReplyBucketData, staff, room);
+                                        // 发送消息
+                                        CommonResponse<SendAppMsgResponse> response = weComThirdPartyService.sendAppMsg(staff, room, request);
+                                        // 存储消息
+                                        saveAppWeComMsg(staff.getId(), cgiReplyBucketData.getMiniVideoId(), request, response);
+                                    }
+                                }
+                            }
                         }
                     }
                 });
@@ -114,14 +151,29 @@ public class WeComSendMsgJob {
         return ReturnT.SUCCESS;
     }
 
-    private List<String> getRoomSendTime(ThirdPartWeComRoom room) {
-        String timeStr = redisUtils.get("wecom:room:send:time:" + room.getThirdRoomId());
+    private List<String> getRoomSendTime(ThirdPartWeComRoom room,
+                                         ThirdPartWeComRoomConfig roomConfig,
+                                         ThirdPartWeComRoomConfigTask configTask) {
+        String key = "wecom:room:send:time:" + room.getThirdRoomId() + ":" + roomConfig.getId() + ":" + configTask.getId();
+        String timeStr = redisUtils.get(key);
         if (StringUtils.isBlank(timeStr)) {
             return JSONObject.parseArray(room.getSendTime()).toJavaList(String.class);
         }
         return JSONObject.parseArray(timeStr).toJavaList(String.class);
     }
 
+    private SendTextMsgRequest buildSendTextMsgRequest(String content,
+                                                       ThirdPartWeComStaff staff,
+                                                       ThirdPartWeComRoom room) {
+        String thirdRoomId = room.getThirdRoomId();
+        SendTextMsgRequest request = new SendTextMsgRequest();
+        request.setUuid(staff.getThirdUuid());
+        request.setSend_userid(Long.valueOf(thirdRoomId));
+        request.setIsRoom(true);
+        request.setContent(content);
+        return request;
+    }
+
     private SendAppMsgRequest buildSendAppMsgRequest(CgiReplyBucketData cgiReplyBucketData,
                                                      ThirdPartWeComStaff staff,
                                                      ThirdPartWeComRoom room) {
@@ -136,11 +188,8 @@ public class WeComSendMsgJob {
         request.setTitle(cgiReplyBucketData.getTitle());
         request.setWeappIconUrl("http://rescdn.yishihui.com/temp/1755515422185_%E7%A5%A8%E5%9C%88Vlog_logo.jpg");
         // 填充视频信息
-        String coverUrl = cgiReplyBucketData.getCoverUrl();
-        // 实验 封面添加播放按钮水印
-        if (!testRoomList.contains(thirdRoomId)) {
-            coverUrl = addPlayWatermark(cgiReplyBucketData.getCoverUrl());
-        }
+        // 封面添加播放按钮水印
+        String coverUrl = addPlayWatermark(cgiReplyBucketData.getCoverUrl());
         request.setDesc(cgiReplyBucketData.getTitle());
         request.setPagepath(cgiReplyBucketData.getMiniPagePath());
         CdnUploadImgLinkRequest cdnUploadImgLinkRequest = new CdnUploadImgLinkRequest();
@@ -165,67 +214,53 @@ public class WeComSendMsgJob {
         return coverUrl + waterMark;
     }
 
-    private List<CgiReplyBucketData> getCgiReplyBucketData(String roomId, ThirdPartWeComStaff thirdPartWeComStaff) {
-        String dt = planMapperExt.getVideoMaxDt();
-        String datastatDt = planMapperExt.getVideoDatastatMaxDt();
+    private List<CgiReplyBucketData> getCgiReplyBucketData(String roomId,
+                                                           ThirdPartWeComStaff thirdPartWeComStaff,
+                                                           ThirdPartWeComRoomConfig roomConfig,
+                                                           ThirdPartWeComRoomConfigTaskContent configTaskContent) {
         // 排除最近发送过的视频
         List<Long> sentVideoIds = getSentVideoIds(Long.valueOf(roomId));
-        // 按行业获取视频
-        String sort = "datastat.fission_rate desc, video.score desc";
-        String type = "企微-社群";
-        String channel = "sum";
-        List<ContentPlatformVideo> videoList = getVideoByStrategy(thirdPartWeComStaff.getThirdStaffId(), roomId, dt, datastatDt, type, channel, videoMinScore,
-                sentVideoIds, 1, 100, sort);
+        List<ContentPlatformVideo> videoList = getVideoByStrategy(roomId, videoMinScore, sentVideoIds,
+                configTaskContent, 1, 100);
         if (CollectionUtils.isEmpty(videoList)) {
             LarkRobotUtil.sendWeComThirdPartMessage(
                     "【账号发送群消息,视频数量不足通知】\n" +
                             "账号名称:" + thirdPartWeComStaff.getName() + "\n" +
                             "账号VID:" + thirdPartWeComStaff.getThirdStaffId() + "\n" +
                             "群ID:" + roomId + "\n" +
-                            "账号配置:" + videoSourceStaffConfig.get(thirdPartWeComStaff.getId()));
+                            "账号配置:" + JSONObject.toJSONString(configTaskContent));
             return Collections.emptyList();
         }
         List<CgiReplyBucketData> result = new ArrayList<>();
-        for (int i = 0; i < videoNum; i++) {
-            ContentPlatformVideo video = videoList.get(i);
-            Staff staff = new Staff();
-            staff.setCarrierId(String.valueOf(thirdPartWeComStaff.getThirdStaffId()));
-            staff.setRemark(thirdPartWeComStaff.getName());
-            String putScene = staffPutSceneConfig.getOrDefault(thirdPartWeComStaff.getThirdStaffId(), "touliu");
-            String pageChannel = staffChannelConfig.getOrDefault(thirdPartWeComStaff.getThirdStaffId(), "tencentqw");
-            String page = messageAttachmentService.getPageNoCache(putScene, pageChannel, staff, video.getVideoId(), "企微", "社群");
+        ContentPlatformVideo video = videoList.get(0);
+        Staff staff = new Staff();
+        staff.setCarrierId(String.valueOf(thirdPartWeComStaff.getThirdStaffId()));
+        staff.setRemark(thirdPartWeComStaff.getName());
+        String putScene = StringUtils.isNotBlank(roomConfig.getPutScene()) ? roomConfig.getPutScene() : "touliu";
+        String pageChannel = StringUtils.isNotBlank(roomConfig.getChannel()) ? roomConfig.getChannel() : "tencentqw";
+        String page = messageAttachmentService.getPageNoCache(putScene, pageChannel, staff, video.getVideoId(), "企微", "社群");
 
-            CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
-            cgiReplyBucketData.setMiniVideoId(video.getVideoId());
-            cgiReplyBucketData.setTitle(video.getTitle());
-            cgiReplyBucketData.setCoverUrl(video.getCover());
-            cgiReplyBucketData.setMiniPagePath(page);
-            result.add(cgiReplyBucketData);
-        }
+        CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
+        cgiReplyBucketData.setMiniVideoId(video.getVideoId());
+        cgiReplyBucketData.setTitle(video.getTitle());
+        cgiReplyBucketData.setCoverUrl(video.getCover());
+        cgiReplyBucketData.setMiniPagePath(page);
+        result.add(cgiReplyBucketData);
         return result;
     }
 
-    private List<ContentPlatformVideo> getVideoByStrategy(Long staffId,
-                                                          String roomId,
-                                                          String dt,
-                                                          String datastatDt,
-                                                          String type,
-                                                          String channel,
+    private List<ContentPlatformVideo> getVideoByStrategy(String roomId,
                                                           Double videoMinScore,
                                                           List<Long> sentVideoIds,
+                                                          ThirdPartWeComRoomConfigTaskContent configTaskContent,
                                                           int pageNum,
-                                                          int pageSize,
-                                                          String sort) {
+                                                          int pageSize) {
         List<ContentPlatformVideo> result = new ArrayList<>();
-        JSONObject staffConfig = videoSourceStaffConfig.get(staffId);
-        if (staffConfig == null) {
-            staffConfig = new JSONObject();
-        }
         List<ContentPlatformVideo> videoList;
-        String source = (String) staffConfig.getOrDefault("source", "");
-        switch (source) {
-            case "user":
-                Long uid = staffConfig.getLong("uid");
+        // 0-热榜 1-标签 2-账号
+        switch (configTaskContent.getSource()) {
+            case 2:
+                Long uid = Long.valueOf(configTaskContent.getSourceContent());
                 List<WxVideoV2VO> list = videoApiService.getUserVideoList(uid, sentVideoIds, pageNum, pageSize);
                 if (CollectionUtils.isEmpty(list)) {
                     break;
@@ -233,8 +268,8 @@ public class WeComSendMsgJob {
                 videoList = convertWxVideoV2VOToVideo(list);
                 result.addAll(videoList);
                 break;
-            case "tag":
-                String tagName = staffConfig.getString("tagName");
+            case 1:
+                String tagName = configTaskContent.getSourceContent();
                 list = videoApiService.getTagVideoList(tagName, roomId, sentVideoIds, pageNum, pageSize);
                 if (CollectionUtils.isEmpty(list)) {
                     break;
@@ -243,11 +278,8 @@ public class WeComSendMsgJob {
                 result.addAll(videoList);
                 break;
             default:
-                result = planMapperExt.getVideoMinDatastatScoreList(dt, datastatDt,
-                        type, channel, "normal", videoMinScore, sentVideoIds, 0, 100, sort);
-                // 行业数量不足,按平台推荐top选取视频
-                sort = "video.score desc";
-                result.addAll(planMapperExt.getVideoMinScoreList(dt, videoMinScore, sentVideoIds, 0, 100, sort));
+                // 按平台推荐top选取视频
+                result.addAll(videoMapperExt.getVideoMinScoreList(videoMinScore, roomId, 0, 100, "video.score desc"));
         }
         return result;
     }
@@ -267,17 +299,19 @@ public class WeComSendMsgJob {
     private List<Long> getSentVideoIds(Long roomId) {
         ThirdPartWeComMsgExample msgExample = new ThirdPartWeComMsgExample();
         msgExample.createCriteria().andSendUseridEqualTo(roomId)
-                .andCreateTimeGreaterThan(DateUtil.getDaysAgoDate(duplicateDays));
+                .andCreateTimeGreaterThan(DateUtil.getDaysAgoDate(duplicateDays))
+                .andVideoIdIsNotNull();
         List<ThirdPartWeComMsg> msgList = msgMapper.selectByExample(msgExample);
         return msgList.stream().map(ThirdPartWeComMsg::getVideoId).collect(Collectors.toList());
     }
 
-    private void saveWeComMsg(Long staffId, Long videoId, SendAppMsgRequest request, CommonResponse<SendAppMsgResponse> response) {
+    private void saveAppWeComMsg(Long staffId, Long videoId, SendAppMsgRequest request, CommonResponse<SendAppMsgResponse> response) {
         ThirdPartWeComMsg msg = new ThirdPartWeComMsg();
         msg.setStaffId(staffId);
         msg.setVideoId(videoId);
         msg.setUuid(request.getUuid());
         msg.setSendUserid(request.getSend_userid());
+        msg.setSendType(ConfigTaskContentTypeEnum.MINI_PROGRAM.getVal());
         msg.setIsroom(request.getIsRoom());
         msg.setAppid(request.getAppid());
         msg.setUsername(request.getUsername());
@@ -299,11 +333,31 @@ public class WeComSendMsgJob {
         msgMapper.insertSelective(msg);
     }
 
+    private void saveTextWeComMsg(Long staffId, String content, SendTextMsgRequest request, CommonResponse<SendTextMsgResponse> response) {
+        ThirdPartWeComMsg msg = new ThirdPartWeComMsg();
+        msg.setStaffId(staffId);
+        msg.setUuid(request.getUuid());
+        msg.setSendUserid(request.getSend_userid());
+        msg.setSendType(ConfigTaskContentTypeEnum.TEXT.getVal());
+        msg.setContent(content);
+        msg.setIsroom(request.getIsRoom());
+        if (response.getErrcode() == 0) {
+            msg.setStatus(MsgSendStatusEnum.NORMAL.getVal());
+        } else {
+            msg.setStatus(MsgSendStatusEnum.FAIL.getVal());
+        }
+        msgMapper.insertSelective(msg);
+    }
+
     @XxlJob("autoOpenSendStatusJob")
     public ReturnT<String> autoOpenSendStatusJob(String param) {
         List<ThirdPartWeComStaff> activeStaffList = weComThirdPartyService.getActiveStaffList();
+        List<Long> staffIdList = activeStaffList.stream().map(ThirdPartWeComStaff::getId).collect(Collectors.toList());
+        List<ThirdPartWeComStaffConfig> staffConfigList = weComThirdPartyAccountService.getStaffConfigListByStaffIds(staffIdList);
+        Map<Long, ThirdPartWeComStaffConfig> staffConfigMap = staffConfigList.stream().collect(Collectors.toMap(ThirdPartWeComStaffConfig::getStaffId, a -> a));
         for (ThirdPartWeComStaff staff : activeStaffList) {
-            if (!autoOpenStaffList.contains(staff.getThirdStaffId())) {
+            ThirdPartWeComStaffConfig staffConfig = staffConfigMap.get(staff.getId());
+            if (Objects.isNull(staffConfig) || staffConfig.getSwitchFlag() != 1 || Objects.isNull(staffConfig.getOpenRoomSendSwitchNum())) {
                 continue;
             }
             List<ThirdPartWeComRoom> roomList = weComThirdPartyService.getStaffRoomList(staff.getId());
@@ -311,7 +365,7 @@ public class WeComSendMsgJob {
                 if (room.getSendStatus() == 1) {
                     continue;
                 }
-                if (room.getMemberCount() > 20) {
+                if (room.getMemberCount() > staffConfig.getOpenRoomSendSwitchNum()) {
                     room.setSendStatus(1);
                     roomMapper.updateByPrimaryKeySelective(room);
                 }
@@ -326,47 +380,67 @@ public class WeComSendMsgJob {
         String now = DateUtil.getCurrentDateStr("HH:mm");
         for (ThirdPartWeComStaff staff : activeStaffList) {
             List<ThirdPartWeComRoom> roomList = weComThirdPartyService.getStaffRoomList(staff.getId());
+            List<ThirdPartWeComRoomConfig> roomConfigList = weComThirdPartyRoomService.getRoomConfigListByRoomIds(roomList.stream().map(ThirdPartWeComRoom::getId).collect(Collectors.toList()));
+            Map<Long, ThirdPartWeComRoomConfig> roomConfigMap = roomConfigList.stream().collect(Collectors.toMap(ThirdPartWeComRoomConfig::getRoomId, Function.identity()));
+            List<String> configIds = roomConfigList.stream().map(ThirdPartWeComRoomConfig::getId).map(String::valueOf).collect(Collectors.toList());
+            List<ThirdPartWeComRoomConfigTask> roomConfigTaskList = weComThirdPartyRoomService.getRoomConfigTasks(configIds);
+            Map<String, List<ThirdPartWeComRoomConfigTask>> roomConfigTaskMap = roomConfigTaskList.stream().collect(Collectors.groupingBy(ThirdPartWeComRoomConfigTask::getConfigId));
             for (ThirdPartWeComRoom room : roomList) {
-                if (room.getSendStatus() != 1) {
+                ThirdPartWeComRoomConfig roomConfig = roomConfigMap.get(room.getId());
+                if (roomConfig == null) {
                     continue;
                 }
-                String key = "wecom:room:send:time:" + room.getThirdRoomId();
-                if (redisUtils.containsKey(key)) {
+                List<ThirdPartWeComRoomConfigTask> taskList = roomConfigTaskMap.getOrDefault(roomConfig.getId(), new ArrayList<>());
+                if (taskList.isEmpty()) {
                     continue;
                 }
-                List<String> timeList = JSONObject.parseArray(room.getSendTime()).toJavaList(String.class);
-                // 判断timeList中在now之后的时间,随机增加或减少20以内的分钟数
-                List<String> newTimeList = new ArrayList<>();
-                for (String time : timeList) {
-                    // time与now比较,判断是否在now之后
-                    int hour = Integer.parseInt(time.substring(0, 2));
-                    int minute = Integer.parseInt(time.substring(3, 5));
-                    int nowHour = Integer.parseInt(now.substring(0, 2));
-                    int nowMinute = Integer.parseInt(now.substring(3, 5));
-                    if (hour < nowHour || (hour == nowHour && minute <= nowMinute)) {
-                        newTimeList.add(time);
-                        continue;
-                    }
-                    // 增加或减少20以内的分钟数 -20~20
-                    int randomMinute = new Random().nextInt(randomTimeRange * 2) - randomTimeRange;
-                    minute += randomMinute;
-                    if (minute < 0) {
-                        hour--;
-                        minute += 60;
-                    } else if (minute >= 60) {
-                        hour++;
-                        minute -= 60;
-                    }
-                    // 确保时间在now之后
-                    if (hour < nowHour || (hour == nowHour && minute <= nowMinute)) {
-                        newTimeList.add(time);
-                        continue;
-                    }
-                    newTimeList.add(String.format("%02d:%02d", hour, minute));
-                }
-                redisUtils.set(key, JSONObject.toJSONString(newTimeList), 18 * 60 * 60);
+                randomRoomSendTime(room, roomConfig, taskList, now);
             }
         }
         return ReturnT.SUCCESS;
     }
+
+    public void randomRoomSendTime(ThirdPartWeComRoom room,
+                                   ThirdPartWeComRoomConfig roomConfig,
+                                   List<ThirdPartWeComRoomConfigTask> taskList,
+                                   String now) {
+        for (ThirdPartWeComRoomConfigTask configTask : taskList) {
+            String key = "wecom:room:send:time:" + room.getThirdRoomId() + ":" + roomConfig.getId() + ":" + configTask.getId();
+            if (redisUtils.containsKey(key)) {
+                continue;
+            }
+            List<String> timeList = JSONObject.parseArray(room.getSendTime()).toJavaList(String.class);
+            // 判断timeList中在now之后的时间,随机增加或减少20以内的分钟数
+            List<String> newTimeList = new ArrayList<>();
+            for (String time : timeList) {
+                // time与now比较,判断是否在now之后
+                int hour = Integer.parseInt(time.substring(0, 2));
+                int minute = Integer.parseInt(time.substring(3, 5));
+                int nowHour = Integer.parseInt(now.substring(0, 2));
+                int nowMinute = Integer.parseInt(now.substring(3, 5));
+                if (hour < nowHour || (hour == nowHour && minute <= nowMinute)) {
+                    newTimeList.add(time);
+                    continue;
+                }
+                // 增加或减少20以内的分钟数 -20~20
+                int randomTimeRange = Objects.isNull(configTask.getRandomMin()) ? 0 : configTask.getRandomMin();
+                int randomMinute = new Random().nextInt(randomTimeRange * 2) - randomTimeRange;
+                minute += randomMinute;
+                if (minute < 0) {
+                    hour--;
+                    minute += 60;
+                } else if (minute >= 60) {
+                    hour++;
+                    minute -= 60;
+                }
+                // 确保时间在now之后
+                if (hour < nowHour || (hour == nowHour && minute <= nowMinute)) {
+                    newTimeList.add(time);
+                    continue;
+                }
+                newTimeList.add(String.format("%02d:%02d", hour, minute));
+            }
+            redisUtils.set(key, JSONObject.toJSONString(newTimeList), 18 * 60 * 60);
+        }
+    }
 }

+ 24 - 0
api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComUserDetailJob.java

@@ -10,8 +10,12 @@ import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomUserMa
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffUserMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComMapperExt;
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComRoomMapperExt;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.po.wecom.thirdpart.*;
+import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyAccountConfigVO;
+import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyAccountService;
+import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyRoomService;
 import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyService;
 import com.tzld.piaoquan.growth.common.utils.RedisUtils;
 import com.xxl.job.core.biz.model.ReturnT;
@@ -33,6 +37,10 @@ public class WeComUserDetailJob {
     @Autowired
     WeComThirdPartyService thirdPartyService;
     @Autowired
+    WeComThirdPartyAccountService thirdPartyAccountService;
+    @Autowired
+    WeComThirdPartyRoomService thirdPartyRoomService;
+    @Autowired
     WeComThirdPartyApiClient apiClient;
     @Autowired
     ThirdPartWeComStaffMapper staffMapper;
@@ -44,6 +52,8 @@ public class WeComUserDetailJob {
     ThirdPartWeComRoomUserMapper roomUserMapper;
     @Autowired
     ThirdPartWeComMapperExt thirdPartWeComMapperExt;
+    @Autowired
+    ThirdPartWeComRoomMapperExt thirdPartWeComRoomMapperExt;
 
     @Autowired
     private RedisUtils redisUtils;
@@ -278,6 +288,7 @@ public class WeComUserDetailJob {
             for (List<ThirdPartWeComRoom> partition : partitionList) {
                 thirdPartWeComMapperExt.batchInsertThirdPartWeComRoom(partition);
             }
+            new Thread(() -> batchSaveRoomConfig(staff)).start();
         }
         if (CollectionUtils.isNotEmpty(updateList)) {
             List<List<ThirdPartWeComRoom>> partitionList = Lists.partition(updateList, 200);
@@ -299,6 +310,19 @@ public class WeComUserDetailJob {
         }
     }
 
+    private void batchSaveRoomConfig(ThirdPartWeComStaff staff) {
+        ThirdPartyAccountConfigVO accountConfig = thirdPartyAccountService.getAccountConfig(new ThirdPartyConfigGetParam(staff.getId()));
+        if (Objects.isNull(accountConfig)) {
+            return;
+        }
+        List<ThirdPartWeComRoom> noConfigRoomList = thirdPartWeComRoomMapperExt.getNoConfigRoomList(staff.getId());
+        if (CollectionUtils.isNotEmpty(noConfigRoomList)) {
+            for (ThirdPartWeComRoom room : noConfigRoomList) {
+                thirdPartyRoomService.saveRoomConfig(room, accountConfig.getId(), accountConfig);
+            }
+        }
+    }
+
     public void syncRoomUserList(String uuid, String thirdRoomId) {
         GetRoomUserListRequest request = new GetRoomUserListRequest(uuid, Long.valueOf(thirdRoomId));
         List<GetRoomUserListResponse.Member> userList = thirdPartyService.getRoomUserList(request);

+ 198 - 0
api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComVideoJob.java

@@ -0,0 +1,198 @@
+package com.tzld.piaoquan.api.job.wecom.thirdpart;
+
+import com.aliyun.odps.data.Record;
+import com.google.common.collect.Lists;
+import com.tzld.piaoquan.api.dao.mapper.contentplatform.ContentPlatformIllegalVideoMapper;
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComVideoMapper;
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComVideoMapperExt;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformIllegalVideo;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformIllegalVideoExample;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideoExample;
+import com.tzld.piaoquan.api.util.CdnUtil;
+import com.tzld.piaoquan.growth.common.model.bo.VideoDetail;
+import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
+import com.tzld.piaoquan.growth.common.utils.DateUtil;
+import com.tzld.piaoquan.growth.common.utils.OdpsUtil;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Component
+public class WeComVideoJob {
+
+    @Autowired
+    private ThirdPartWeComVideoMapperExt videoMapperExt;
+    @Autowired
+    private ThirdPartWeComVideoMapper videoMapper;
+    @Autowired
+    private ContentPlatformIllegalVideoMapper illegalVideoMapper;
+    @Autowired
+    private MessageAttachmentService messageAttachmentService;
+
+
+    @XxlJob("syncThirdPartWeComVideoJob")
+    public ReturnT<String> syncThirdPartWeComVideoJob(String param) {
+        String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
+        if (StringUtils.hasText(param)) {
+            dt = param;
+        }
+
+        String sql = String.format("SELECT * FROM loghubods.wecom_cooperation_video_candidate_pool WHERE dt=%s;", dt);
+        List<Record> dataList = OdpsUtil.getOdpsData(sql);
+        Long now = System.currentTimeMillis();
+        if (CollectionUtils.isNotEmpty(dataList)) {
+            List<ThirdPartWeComVideo> saveList = new ArrayList<>();
+            List<Long> existVideoIds = new ArrayList<>();
+            for (Record record : dataList) {
+                ThirdPartWeComVideo item = new ThirdPartWeComVideo();
+                Long videoId = Long.parseLong((String) record.get(0));
+                if (existVideoIds.contains(videoId)) {
+                    continue;
+                }
+                existVideoIds.add(videoId);
+                String category = (String) record.get(1);
+                String title = (String) record.get(2);
+                String videoUrl = (String) record.get(3);
+                Double score = Double.parseDouble((String) record.get(4));
+                item.setDt(dt);
+                item.setVideoId(videoId);
+                item.setCategory(category);
+                item.setTitle(title);
+                item.setVideo(videoUrl);
+                item.setScore(score);
+                item.setCreateTimestamp(now);
+                saveList.add(item);
+            }
+            // 获取视频封面
+            for (List<ThirdPartWeComVideo> partition : Lists.partition(saveList, 20)) {
+                List<Long> videoIds = partition.stream().map(ThirdPartWeComVideo::getVideoId).distinct().collect(Collectors.toList());
+                Map<Long, VideoDetail> coverMap = messageAttachmentService.getVideoDetail(new HashSet<>(videoIds));
+                for (ThirdPartWeComVideo item : partition) {
+                    VideoDetail detail = coverMap.get(item.getVideoId());
+                    if (Objects.nonNull(detail)) {
+                        String cover = detail.getCover().substring(0, detail.getCover().indexOf("/watermark"));
+                        item.setCover(cover);
+                        if (detail.getAuditStatus() != 5) {
+                            item.setStatus(0);
+                        }
+                    }
+                }
+            }
+            // save
+            if (CollectionUtils.isNotEmpty(saveList)) {
+                List<ThirdPartWeComVideo> videoList = getVideoList(dt);
+                List<ContentPlatformIllegalVideo> illegalVideoList = getAllIllegalVideoList();
+                List<Long> illegalVideoIds = illegalVideoList.stream().map(ContentPlatformIllegalVideo::getVideoId).collect(Collectors.toList());
+                if (CollectionUtils.isNotEmpty(illegalVideoIds)) {
+                    saveList = saveList.stream().filter(item -> !illegalVideoIds.contains(item.getVideoId())).collect(Collectors.toList());
+                }
+                if (CollectionUtils.isNotEmpty(videoList)) {
+                    List<Long> tempExistVideoIds = videoList.stream().map(ThirdPartWeComVideo::getVideoId).collect(Collectors.toList());
+                    List<Long> videoIdList = saveList.stream().map(ThirdPartWeComVideo::getVideoId).collect(Collectors.toList());
+                    videoMapperExt.updateOtherVideoStatus(dt, videoIdList, now);
+                    saveList = saveList.stream().filter(item -> !tempExistVideoIds.contains(item.getVideoId())).collect(Collectors.toList());
+                    if (CollectionUtils.isNotEmpty(saveList)) {
+                        videoMapperExt.batchInsertThirdPartWeComVideo(saveList);
+                    }
+                } else {
+                    videoMapperExt.batchInsertThirdPartWeComVideo(saveList);
+                }
+            }
+        }
+        // 更新封面
+        List<ThirdPartWeComVideo> nullCoverVideoList = getVideoNullCover();
+        if (CollectionUtils.isNotEmpty(nullCoverVideoList)) {
+            for (List<ThirdPartWeComVideo> partition : Lists.partition(nullCoverVideoList, 20)) {
+                List<Long> videoIds = partition.stream().map(ThirdPartWeComVideo::getVideoId).distinct().collect(Collectors.toList());
+                Map<Long, VideoDetail> coverMap = messageAttachmentService.getVideoDetail(new HashSet<>(videoIds));
+                for (ThirdPartWeComVideo item : partition) {
+                    VideoDetail detail = coverMap.get(item.getVideoId());
+                    if (Objects.isNull(detail)) {
+                        continue;
+                    }
+                    String cover = detail.getCover().substring(0, detail.getCover().indexOf("/watermark"));
+                    if (!cover.startsWith(CdnUtil.VIDEO_CDN_URL_HOST)
+                            && StringUtils.hasText(detail.getVideoCoverSnapshotPath())
+                            && detail.getVideoCoverSnapshotPath().startsWith(CdnUtil.VIDEO_CDN_URL_HOST)) {
+                        cover = detail.getVideoCoverSnapshotPath() + cover.substring(cover.indexOf("?"));
+                    }
+                    item.setCover(cover);
+                    if (detail.getAuditStatus() != 5) {
+                        item.setStatus(0);
+                    }
+                    videoMapper.updateByPrimaryKeySelective(item);
+                }
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    private List<ContentPlatformIllegalVideo> getAllIllegalVideoList() {
+        ContentPlatformIllegalVideoExample example = new ContentPlatformIllegalVideoExample();
+        return illegalVideoMapper.selectByExample(example);
+    }
+
+    private List<ThirdPartWeComVideo> getVideoNullCover() {
+        ThirdPartWeComVideoExample example = new ThirdPartWeComVideoExample();
+        example.createCriteria().andCoverIsNull();
+        return videoMapper.selectByExample(example);
+    }
+
+    private List<ThirdPartWeComVideo> getVideoList(String dt) {
+        ThirdPartWeComVideoExample example = new ThirdPartWeComVideoExample();
+        example.createCriteria().andDtEqualTo(dt);
+        return videoMapper.selectByExample(example);
+    }
+
+    private List<ThirdPartWeComVideo> getVideoListByDt(String dt) {
+        ThirdPartWeComVideoExample example = new ThirdPartWeComVideoExample();
+        example.createCriteria().andDtEqualTo(dt);
+        return videoMapper.selectByExample(example);
+    }
+
+    @XxlJob("checkThirdPartWeComVideoStatusJob")
+    public ReturnT<String> checkThirdPartWeComVideoStatusJob(String param) {
+        String dt = videoMapperExt.getVideoMaxDt();
+        if (StringUtils.hasText(param)) {
+            dt = param;
+        }
+        List<ThirdPartWeComVideo> videoList = getVideoListByDt(dt);
+        Long now = System.currentTimeMillis();
+        for (List<ThirdPartWeComVideo> partition : Lists.partition(videoList, 20)) {
+            List<Long> videoIds = partition.stream().map(ThirdPartWeComVideo::getVideoId).collect(Collectors.toList());
+            Map<Long, VideoDetail> videoDetailMap = messageAttachmentService.getVideoDetail(new HashSet<>(videoIds));
+            for (ThirdPartWeComVideo video : partition) {
+                VideoDetail videoDetail = videoDetailMap.get(video.getVideoId());
+                if (videoDetail == null
+                        || videoDetail.getAuditStatus() != 5) {
+                    updateVideoStatusWithOldStatus(video.getVideoId(), 0, 1, now);
+                } else if (videoDetail.getRecommendStatus() == -6 && video.getStatus() == 0) {
+                    updateVideoStatusWithOldStatus(video.getVideoId(), 1, 0, now);
+                }
+            }
+        }
+        // 检查视频是否违规
+        List<ContentPlatformIllegalVideo> illegalVideoList = getAllIllegalVideoList();
+        List<Long> illegalVideoIds = illegalVideoList.stream().map(ContentPlatformIllegalVideo::getVideoId).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(illegalVideoIds)) {
+            for (Long illegalVideoId : illegalVideoIds) {
+                updateVideoStatusWithOldStatus(illegalVideoId, 0, 1, now);
+            }
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    private void updateVideoStatusWithOldStatus(Long videoId, Integer status, Integer oldStatus, Long now) {
+        videoMapperExt.updateVideoStatusWithOldStatus(videoId, status, oldStatus, now);
+    }
+
+}

+ 21 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/wecom/thirdpart/SendTextMsgResponse.java

@@ -0,0 +1,21 @@
+package com.tzld.piaoquan.api.model.param.wecom.thirdpart;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SendTextMsgResponse {
+    private Long receiver;
+    private Long sender;
+    private List<Long> atList;
+    private String senderName;
+    private String app_info;
+    private Integer isRoom;
+    private Long sendtime;
+    private Long msgId;
+    private Long serverId;
+    private Integer msgtype;
+    private String content;
+
+}

+ 4 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/wecom/thirdpart/ThirdPartyConfigGetParam.java

@@ -1,9 +1,13 @@
 package com.tzld.piaoquan.api.model.param.wecom.thirdpart;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 @Data
+@AllArgsConstructor
+@NoArgsConstructor
 public class ThirdPartyConfigGetParam {
     @ApiModelProperty(value = "id")
     private Long id;

+ 22 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComMsg.java

@@ -9,6 +9,10 @@ public class ThirdPartWeComMsg {
 
     private Long sendUserid;
 
+    private Integer sendType;
+
+    private String content;
+
     private Long staffId;
 
     private Long videoId;
@@ -67,6 +71,22 @@ public class ThirdPartWeComMsg {
         this.sendUserid = sendUserid;
     }
 
+    public Integer getSendType() {
+        return sendType;
+    }
+
+    public void setSendType(Integer sendType) {
+        this.sendType = sendType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
     public Long getStaffId() {
         return staffId;
     }
@@ -212,6 +232,8 @@ public class ThirdPartWeComMsg {
         sb.append(", id=").append(id);
         sb.append(", uuid=").append(uuid);
         sb.append(", sendUserid=").append(sendUserid);
+        sb.append(", sendType=").append(sendType);
+        sb.append(", content=").append(content);
         sb.append(", staffId=").append(staffId);
         sb.append(", videoId=").append(videoId);
         sb.append(", appname=").append(appname);

+ 130 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComMsgExample.java

@@ -306,6 +306,136 @@ public class ThirdPartWeComMsgExample {
             return (Criteria) this;
         }
 
+        public Criteria andSendTypeIsNull() {
+            addCriterion("send_type is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeIsNotNull() {
+            addCriterion("send_type is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeEqualTo(Integer value) {
+            addCriterion("send_type =", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeNotEqualTo(Integer value) {
+            addCriterion("send_type <>", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeGreaterThan(Integer value) {
+            addCriterion("send_type >", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeGreaterThanOrEqualTo(Integer value) {
+            addCriterion("send_type >=", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeLessThan(Integer value) {
+            addCriterion("send_type <", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeLessThanOrEqualTo(Integer value) {
+            addCriterion("send_type <=", value, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeIn(List<Integer> values) {
+            addCriterion("send_type in", values, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeNotIn(List<Integer> values) {
+            addCriterion("send_type not in", values, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeBetween(Integer value1, Integer value2) {
+            addCriterion("send_type between", value1, value2, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andSendTypeNotBetween(Integer value1, Integer value2) {
+            addCriterion("send_type not between", value1, value2, "sendType");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIsNull() {
+            addCriterion("content is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIsNotNull() {
+            addCriterion("content is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentEqualTo(String value) {
+            addCriterion("content =", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotEqualTo(String value) {
+            addCriterion("content <>", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentGreaterThan(String value) {
+            addCriterion("content >", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentGreaterThanOrEqualTo(String value) {
+            addCriterion("content >=", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLessThan(String value) {
+            addCriterion("content <", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLessThanOrEqualTo(String value) {
+            addCriterion("content <=", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentLike(String value) {
+            addCriterion("content like", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotLike(String value) {
+            addCriterion("content not like", value, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentIn(List<String> values) {
+            addCriterion("content in", values, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotIn(List<String> values) {
+            addCriterion("content not in", values, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentBetween(String value1, String value2) {
+            addCriterion("content between", value1, value2, "content");
+            return (Criteria) this;
+        }
+
+        public Criteria andContentNotBetween(String value1, String value2) {
+            addCriterion("content not between", value1, value2, "content");
+            return (Criteria) this;
+        }
+
         public Criteria andStaffIdIsNull() {
             addCriterion("staff_id is null");
             return (Criteria) this;

+ 134 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComVideo.java

@@ -0,0 +1,134 @@
+package com.tzld.piaoquan.api.model.po.wecom.thirdpart;
+
+public class ThirdPartWeComVideo {
+    private Long id;
+
+    private String dt;
+
+    private Long videoId;
+
+    private String category;
+
+    private String title;
+
+    private String cover;
+
+    private String video;
+
+    private Double score;
+
+    private Integer status;
+
+    private Long createTimestamp;
+
+    private Long updateTimestamp;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDt() {
+        return dt;
+    }
+
+    public void setDt(String dt) {
+        this.dt = dt;
+    }
+
+    public Long getVideoId() {
+        return videoId;
+    }
+
+    public void setVideoId(Long videoId) {
+        this.videoId = videoId;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getCover() {
+        return cover;
+    }
+
+    public void setCover(String cover) {
+        this.cover = cover;
+    }
+
+    public String getVideo() {
+        return video;
+    }
+
+    public void setVideo(String video) {
+        this.video = video;
+    }
+
+    public Double getScore() {
+        return score;
+    }
+
+    public void setScore(Double score) {
+        this.score = score;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getCreateTimestamp() {
+        return createTimestamp;
+    }
+
+    public void setCreateTimestamp(Long createTimestamp) {
+        this.createTimestamp = createTimestamp;
+    }
+
+    public Long getUpdateTimestamp() {
+        return updateTimestamp;
+    }
+
+    public void setUpdateTimestamp(Long updateTimestamp) {
+        this.updateTimestamp = updateTimestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", dt=").append(dt);
+        sb.append(", videoId=").append(videoId);
+        sb.append(", category=").append(category);
+        sb.append(", title=").append(title);
+        sb.append(", cover=").append(cover);
+        sb.append(", video=").append(video);
+        sb.append(", score=").append(score);
+        sb.append(", status=").append(status);
+        sb.append(", createTimestamp=").append(createTimestamp);
+        sb.append(", updateTimestamp=").append(updateTimestamp);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 921 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComVideoExample.java

@@ -0,0 +1,921 @@
+package com.tzld.piaoquan.api.model.po.wecom.thirdpart;
+
+import com.tzld.piaoquan.growth.common.utils.page.Page;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ThirdPartWeComVideoExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public ThirdPartWeComVideoExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNull() {
+            addCriterion("dt is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIsNotNull() {
+            addCriterion("dt is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtEqualTo(String value) {
+            addCriterion("dt =", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotEqualTo(String value) {
+            addCriterion("dt <>", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThan(String value) {
+            addCriterion("dt >", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtGreaterThanOrEqualTo(String value) {
+            addCriterion("dt >=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThan(String value) {
+            addCriterion("dt <", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLessThanOrEqualTo(String value) {
+            addCriterion("dt <=", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtLike(String value) {
+            addCriterion("dt like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotLike(String value) {
+            addCriterion("dt not like", value, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtIn(List<String> values) {
+            addCriterion("dt in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotIn(List<String> values) {
+            addCriterion("dt not in", values, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtBetween(String value1, String value2) {
+            addCriterion("dt between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andDtNotBetween(String value1, String value2) {
+            addCriterion("dt not between", value1, value2, "dt");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNull() {
+            addCriterion("video_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIsNotNull() {
+            addCriterion("video_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdEqualTo(Long value) {
+            addCriterion("video_id =", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotEqualTo(Long value) {
+            addCriterion("video_id <>", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThan(Long value) {
+            addCriterion("video_id >", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("video_id >=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThan(Long value) {
+            addCriterion("video_id <", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdLessThanOrEqualTo(Long value) {
+            addCriterion("video_id <=", value, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdIn(List<Long> values) {
+            addCriterion("video_id in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotIn(List<Long> values) {
+            addCriterion("video_id not in", values, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdBetween(Long value1, Long value2) {
+            addCriterion("video_id between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdNotBetween(Long value1, Long value2) {
+            addCriterion("video_id not between", value1, value2, "videoId");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryIsNull() {
+            addCriterion("category is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryIsNotNull() {
+            addCriterion("category is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryEqualTo(String value) {
+            addCriterion("category =", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryNotEqualTo(String value) {
+            addCriterion("category <>", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryGreaterThan(String value) {
+            addCriterion("category >", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryGreaterThanOrEqualTo(String value) {
+            addCriterion("category >=", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryLessThan(String value) {
+            addCriterion("category <", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryLessThanOrEqualTo(String value) {
+            addCriterion("category <=", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryLike(String value) {
+            addCriterion("category like", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryNotLike(String value) {
+            addCriterion("category not like", value, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryIn(List<String> values) {
+            addCriterion("category in", values, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryNotIn(List<String> values) {
+            addCriterion("category not in", values, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryBetween(String value1, String value2) {
+            addCriterion("category between", value1, value2, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andCategoryNotBetween(String value1, String value2) {
+            addCriterion("category not between", value1, value2, "category");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIsNull() {
+            addCriterion("title is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIsNotNull() {
+            addCriterion("title is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleEqualTo(String value) {
+            addCriterion("title =", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotEqualTo(String value) {
+            addCriterion("title <>", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleGreaterThan(String value) {
+            addCriterion("title >", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleGreaterThanOrEqualTo(String value) {
+            addCriterion("title >=", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLessThan(String value) {
+            addCriterion("title <", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLessThanOrEqualTo(String value) {
+            addCriterion("title <=", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleLike(String value) {
+            addCriterion("title like", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotLike(String value) {
+            addCriterion("title not like", value, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleIn(List<String> values) {
+            addCriterion("title in", values, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotIn(List<String> values) {
+            addCriterion("title not in", values, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleBetween(String value1, String value2) {
+            addCriterion("title between", value1, value2, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andTitleNotBetween(String value1, String value2) {
+            addCriterion("title not between", value1, value2, "title");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverIsNull() {
+            addCriterion("cover is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverIsNotNull() {
+            addCriterion("cover is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverEqualTo(String value) {
+            addCriterion("cover =", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverNotEqualTo(String value) {
+            addCriterion("cover <>", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverGreaterThan(String value) {
+            addCriterion("cover >", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverGreaterThanOrEqualTo(String value) {
+            addCriterion("cover >=", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverLessThan(String value) {
+            addCriterion("cover <", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverLessThanOrEqualTo(String value) {
+            addCriterion("cover <=", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverLike(String value) {
+            addCriterion("cover like", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverNotLike(String value) {
+            addCriterion("cover not like", value, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverIn(List<String> values) {
+            addCriterion("cover in", values, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverNotIn(List<String> values) {
+            addCriterion("cover not in", values, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverBetween(String value1, String value2) {
+            addCriterion("cover between", value1, value2, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andCoverNotBetween(String value1, String value2) {
+            addCriterion("cover not between", value1, value2, "cover");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIsNull() {
+            addCriterion("video is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIsNotNull() {
+            addCriterion("video is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoEqualTo(String value) {
+            addCriterion("video =", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoNotEqualTo(String value) {
+            addCriterion("video <>", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoGreaterThan(String value) {
+            addCriterion("video >", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoGreaterThanOrEqualTo(String value) {
+            addCriterion("video >=", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoLessThan(String value) {
+            addCriterion("video <", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoLessThanOrEqualTo(String value) {
+            addCriterion("video <=", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoLike(String value) {
+            addCriterion("video like", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoNotLike(String value) {
+            addCriterion("video not like", value, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIn(List<String> values) {
+            addCriterion("video in", values, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoNotIn(List<String> values) {
+            addCriterion("video not in", values, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoBetween(String value1, String value2) {
+            addCriterion("video between", value1, value2, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoNotBetween(String value1, String value2) {
+            addCriterion("video not between", value1, value2, "video");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreIsNull() {
+            addCriterion("score is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreIsNotNull() {
+            addCriterion("score is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreEqualTo(Double value) {
+            addCriterion("score =", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreNotEqualTo(Double value) {
+            addCriterion("score <>", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreGreaterThan(Double value) {
+            addCriterion("score >", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreGreaterThanOrEqualTo(Double value) {
+            addCriterion("score >=", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreLessThan(Double value) {
+            addCriterion("score <", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreLessThanOrEqualTo(Double value) {
+            addCriterion("score <=", value, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreIn(List<Double> values) {
+            addCriterion("score in", values, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreNotIn(List<Double> values) {
+            addCriterion("score not in", values, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreBetween(Double value1, Double value2) {
+            addCriterion("score between", value1, value2, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andScoreNotBetween(Double value1, Double value2) {
+            addCriterion("score not between", value1, value2, "score");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNull() {
+            addCriterion("`status` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIsNotNull() {
+            addCriterion("`status` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusEqualTo(Integer value) {
+            addCriterion("`status` =", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotEqualTo(Integer value) {
+            addCriterion("`status` <>", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThan(Integer value) {
+            addCriterion("`status` >", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
+            addCriterion("`status` >=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThan(Integer value) {
+            addCriterion("`status` <", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusLessThanOrEqualTo(Integer value) {
+            addCriterion("`status` <=", value, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusIn(List<Integer> values) {
+            addCriterion("`status` in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotIn(List<Integer> values) {
+            addCriterion("`status` not in", values, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusBetween(Integer value1, Integer value2) {
+            addCriterion("`status` between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andStatusNotBetween(Integer value1, Integer value2) {
+            addCriterion("`status` not between", value1, value2, "status");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNull() {
+            addCriterion("create_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIsNotNull() {
+            addCriterion("create_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampEqualTo(Long value) {
+            addCriterion("create_timestamp =", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotEqualTo(Long value) {
+            addCriterion("create_timestamp <>", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThan(Long value) {
+            addCriterion("create_timestamp >", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp >=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThan(Long value) {
+            addCriterion("create_timestamp <", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("create_timestamp <=", value, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampIn(List<Long> values) {
+            addCriterion("create_timestamp in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotIn(List<Long> values) {
+            addCriterion("create_timestamp not in", values, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("create_timestamp not between", value1, value2, "createTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampIsNull() {
+            addCriterion("update_timestamp is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampIsNotNull() {
+            addCriterion("update_timestamp is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampEqualTo(Long value) {
+            addCriterion("update_timestamp =", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampNotEqualTo(Long value) {
+            addCriterion("update_timestamp <>", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampGreaterThan(Long value) {
+            addCriterion("update_timestamp >", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampGreaterThanOrEqualTo(Long value) {
+            addCriterion("update_timestamp >=", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampLessThan(Long value) {
+            addCriterion("update_timestamp <", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampLessThanOrEqualTo(Long value) {
+            addCriterion("update_timestamp <=", value, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampIn(List<Long> values) {
+            addCriterion("update_timestamp in", values, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampNotIn(List<Long> values) {
+            addCriterion("update_timestamp not in", values, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampBetween(Long value1, Long value2) {
+            addCriterion("update_timestamp between", value1, value2, "updateTimestamp");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimestampNotBetween(Long value1, Long value2) {
+            addCriterion("update_timestamp not between", value1, value2, "updateTimestamp");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigTaskContentVO.java

@@ -6,6 +6,8 @@ import lombok.Data;
 @Data
 public class ThirdPartyAccountConfigTaskContentVO {
 
+    @ApiModelProperty(value = "id")
+    private String id;
     @ApiModelProperty(value = "类型 0-文案 1-小程序")
     private Integer type;
     @ApiModelProperty(value = "文案内容")

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigTaskVO.java

@@ -8,6 +8,8 @@ import java.util.List;
 @Data
 public class ThirdPartyAccountConfigTaskVO {
 
+    @ApiModelProperty(value = "id")
+    private String id;
     @ApiModelProperty(value = "投放场景")
     private Integer switchFlag;
     @ApiModelProperty(value = "发送时间")

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/wecom/thirdpart/ThirdPartyAccountConfigVO.java

@@ -8,6 +8,8 @@ import java.util.List;
 @Data
 public class ThirdPartyAccountConfigVO {
 
+    @ApiModelProperty(value = "id")
+    private String id;
     @ApiModelProperty(value = "投放场景")
     private String putScene;
     @ApiModelProperty(value = "渠道")

+ 5 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyAccountService.java

@@ -1,6 +1,7 @@
 package com.tzld.piaoquan.api.service.wecom.thirdparty;
 
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.*;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffConfig;
 import com.tzld.piaoquan.api.model.vo.IdNameVO;
 import com.tzld.piaoquan.api.model.vo.contentplatform.AccountQrCodeVO;
 import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyAccountConfigVO;
@@ -26,4 +27,8 @@ public interface WeComThirdPartyAccountService {
     void saveAccountConfig(ThirdPartyAccountConfigParam param);
 
     void logout(ThirdPartyAccountLogOutParam param);
+
+    List<ThirdPartWeComStaffConfig> getStaffConfigListByStaffIds(List<Long> staffIdList);
+
+    void initAccountConfig();
 }

+ 12 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyRoomService.java

@@ -5,7 +5,11 @@ import com.tzld.piaoquan.api.model.param.wecom.thirdpart.ThirdPartyConfigGetPara
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.ThirdPartyRoomConfigParam;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.ThirdPartyRoomListParam;
 import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomConfig;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomConfigTask;
+import com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomConfigTaskContent;
 import com.tzld.piaoquan.api.model.vo.IdNameVO;
+import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyAccountConfigVO;
 import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomConfigVO;
 import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomVO;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
@@ -20,7 +24,15 @@ public interface WeComThirdPartyRoomService {
 
     ThirdPartyRoomConfigVO getRoomConfig(ThirdPartyConfigGetParam param);
 
+    List<ThirdPartWeComRoomConfigTask> getRoomConfigTasks(List<String> configIds);
+
+    List<ThirdPartWeComRoomConfigTaskContent> getRoomConfigTaskContents(List<String> taskIds);
+
     void saveRoomConfig(ThirdPartyRoomConfigParam param, String accountConfigId);
 
     void saveRoomConfig(ThirdPartWeComRoom room, String accountConfigId, ThirdPartyAccountConfigParam param);
+
+    void saveRoomConfig(ThirdPartWeComRoom room, String accountConfigId, ThirdPartyAccountConfigVO configVO);
+
+    List<ThirdPartWeComRoomConfig> getRoomConfigListByRoomIds(List<Long> roomIds);
 }

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/WeComThirdPartyService.java

@@ -35,6 +35,8 @@ public interface WeComThirdPartyService {
 
     CommonResponse<SendAppMsgResponse> sendAppMsg(ThirdPartWeComStaff staff, ThirdPartWeComRoom room, SendAppMsgRequest request);
 
+    CommonResponse<SendTextMsgResponse> sendTextMsg(ThirdPartWeComStaff staff, ThirdPartWeComRoom room, SendTextMsgRequest request);
+
     List<ThirdPartWeComStaff> getActiveStaffList();
 
     List<ThirdPartWeComRoom> getAllStaffRoomList(Long staffId);

+ 78 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyAccountServiceImpl.java

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.api.service.wecom.thirdparty.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.piaoquan.api.common.Constant;
 import com.tzld.piaoquan.api.common.enums.ExceptionEnum;
 import com.tzld.piaoquan.api.common.enums.wecom.ConfigSyncEnum;
@@ -14,6 +15,7 @@ import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffConfi
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffConfigTaskContentMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffConfigTaskMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffMapper;
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComRoomMapperExt;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComStaffMapperExt;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.po.wecom.thirdpart.*;
@@ -59,12 +61,20 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
     private ThirdPartWeComStaffConfigTaskContentMapper staffConfigTaskContentMapper;
     @Autowired
     private ThirdPartWeComStaffMapperExt staffMapperExt;
+    @Autowired
+    private ThirdPartWeComRoomMapperExt roomMapperExt;
 
     @Autowired
     private RedisUtils redisUtils;
 
     @Value("${wecom.thirdpart.callback.url:https://test-tp-open.piaoquantv.com/wecom/thirdparty/callback}")
     private String callbackUrl;
+    @ApolloJsonValue("${send.room.msg.staff.put.scene.config:{}}")
+    private Map<Long, String> staffPutSceneConfig;
+    @ApolloJsonValue("${send.room.msg.staff.channel.config:{}}")
+    private Map<Long, String> staffChannelConfig;
+    @ApolloJsonValue("${send.room.msg.auto.open.staff:[]}")
+    private List<Long> autoOpenStaffList;
 
     @Override
     public AccountQrCodeVO getQrCode(Long id) {
@@ -166,7 +176,14 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
     @Override
     public List<IdNameVO<Long>> getPushAccountList(Long accountId, String name) {
         List<ThirdPartWeComStaff> pushStaffList = staffMapperExt.getPushStaffList(accountId, null, name);
-        return pushStaffList.stream().map(staff -> new IdNameVO<>(staff.getThirdStaffId(), staff.getName())).collect(Collectors.toList());
+        List<Long> staffIds = new ArrayList<>();
+        return pushStaffList.stream().map(staff -> new IdNameVO<>(staff.getThirdStaffId(), staff.getName()))
+                .filter(staff -> {
+                    boolean res = !staffIds.contains(staff.getId());
+                    staffIds.add(staff.getId());
+                    return res;
+                })
+                .collect(Collectors.toList());
     }
 
     @Override
@@ -184,6 +201,7 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
         Map<String, List<ThirdPartWeComStaffConfigTaskContent>> taskContentMap = contentList.stream()
                 .collect(Collectors.groupingBy(ThirdPartWeComStaffConfigTaskContent::getTaskId));
         ThirdPartyAccountConfigVO result = new ThirdPartyAccountConfigVO();
+        result.setId(config.getId());
         result.setPutScene(config.getPutScene());
         result.setChannel(config.getChannel());
         result.setSwitchFlag(config.getSwitchFlag());
@@ -198,6 +216,7 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
         }
         result.setTaskList(taskList.stream().map(task -> {
             ThirdPartyAccountConfigTaskVO vo = new ThirdPartyAccountConfigTaskVO();
+            vo.setId(task.getId());
             vo.setSwitchFlag(task.getSwitchFlag());
             vo.setSendTime(JSONObject.parseArray(task.getSendTime(), String.class));
             vo.setRandomMin(task.getRandomMin());
@@ -205,6 +224,7 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
             List<ThirdPartWeComStaffConfigTaskContent> contents = taskContentMap.get(task.getId());
             vo.setContentList(contents.stream().map(content -> {
                 ThirdPartyAccountConfigTaskContentVO contentVO = new ThirdPartyAccountConfigTaskContentVO();
+                contentVO.setId(content.getId());
                 contentVO.setType(content.getType());
                 contentVO.setContent(content.getContent());
                 contentVO.setSource(content.getSource());
@@ -315,6 +335,11 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
         } else {
             roomList = new ArrayList<>();
         }
+        List<Long> roomIds = roomList.stream().map(ThirdPartWeComRoom::getId).collect(Collectors.toList());
+        // 未配置群生效
+        List<ThirdPartWeComRoom> noConfigRoomList = roomMapperExt.getNoConfigRoomList(param.getAccountId());
+        noConfigRoomList.removeIf(room -> roomIds.contains(room.getId()));
+        roomList.addAll(noConfigRoomList);
         syncConfig(param, accountConfigId, roomList);
     }
 
@@ -388,4 +413,56 @@ public class WeComThirdPartyAccountServiceImpl implements WeComThirdPartyAccount
         staffMapper.updateByPrimaryKey(staff);
     }
 
+    @Override
+    public List<ThirdPartWeComStaffConfig> getStaffConfigListByStaffIds(List<Long> staffIdList) {
+        ThirdPartWeComStaffConfigExample example = new ThirdPartWeComStaffConfigExample();
+        example.createCriteria().andStaffIdIn(staffIdList).andStatusEqualTo(1);
+        return staffConfigMapper.selectByExample(example);
+    }
+
+    @Override
+    public void initAccountConfig() {
+        List<ThirdPartWeComStaff> staffList = staffMapper.selectByExample(new ThirdPartWeComStaffExample());
+        if (CollectionUtils.isEmpty(staffList)) {
+            return;
+        }
+        for (ThirdPartWeComStaff staff : staffList) {
+            ThirdPartyAccountConfigParam configParam = buildThirdPartyAccountConfigParam(staff);
+            saveAccountConfig(configParam);
+        }
+    }
+
+    private ThirdPartyAccountConfigParam buildThirdPartyAccountConfigParam(ThirdPartWeComStaff staff) {
+        ThirdPartyAccountConfigParam newConfig = new ThirdPartyAccountConfigParam();
+        newConfig.setAccountId(staff.getId());
+        newConfig.setPutScene(staffPutSceneConfig.getOrDefault(staff.getThirdStaffId(), "touliu"));
+        newConfig.setChannel(staffChannelConfig.getOrDefault(staff.getThirdStaffId(), "tencentqw"));
+        newConfig.setSwitchFlag(1);
+        if (autoOpenStaffList.contains(staff.getThirdStaffId())) {
+            newConfig.setOpenRoomSendSwitchNum(20);
+        }
+        newConfig.setPrimaryThirdStaffId(staff.getThirdStaffId());
+        newConfig.setConfigSync(1);
+
+        ThirdPartyAccountConfigTaskParam newTask = new ThirdPartyAccountConfigTaskParam();
+        newTask.setSwitchFlag(1);
+        List<String> sendTime = JSONObject.parseArray("[\"08:00\",\"11:00\",\"16:00\",\"21:00\"]", String.class);
+        newTask.setSendTime(sendTime);
+        newTask.setRandomMin(20);
+        newTask.setSeq(0);
+        newConfig.setTaskList(Collections.singletonList(newTask));
+
+        List<ThirdPartyAccountConfigTaskContentParam> contentList = new ArrayList<>();
+        for (int i = 0; i < 2; i++) {
+            ThirdPartyAccountConfigTaskContentParam newContent = new ThirdPartyAccountConfigTaskContentParam();
+            newContent.setType(1);
+            newContent.setSource(0);
+            newContent.setSeq(i);
+            contentList.add(newContent);
+        }
+        newTask.setContentList(contentList);
+
+        return newConfig;
+    }
+
 }

+ 67 - 5
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyRoomServiceImpl.java

@@ -9,15 +9,14 @@ import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomConfig
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomConfigTaskMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComRoomMapperExt;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComStaffMapperExt;
+import com.tzld.piaoquan.api.job.wecom.thirdpart.WeComSendMsgJob;
 import com.tzld.piaoquan.api.model.param.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.po.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.model.vo.IdNameVO;
-import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomConfigTaskContentVO;
-import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomConfigTaskVO;
-import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomConfigVO;
-import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.ThirdPartyRoomVO;
+import com.tzld.piaoquan.api.model.vo.wecom.thirdpart.*;
 import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyRoomService;
 import com.tzld.piaoquan.api.service.wecom.thirdparty.WeComThirdPartyService;
+import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.DistributedIdGenerator;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
 import lombok.extern.slf4j.Slf4j;
@@ -36,6 +35,8 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
     @Autowired
     private WeComThirdPartyService weComThirdPartyService;
     @Autowired
+    private WeComSendMsgJob weComSendMsgJob;
+    @Autowired
     private ThirdPartWeComRoomConfigMapper roomConfigMapper;
     @Autowired
     private ThirdPartWeComRoomConfigTaskMapper roomConfigTaskMapper;
@@ -197,7 +198,15 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
         return roomConfigTaskMapper.selectByExample(example);
     }
 
-    private List<ThirdPartWeComRoomConfigTaskContent> getRoomConfigTaskContents(List<String> taskIds) {
+    @Override
+    public List<ThirdPartWeComRoomConfigTask> getRoomConfigTasks(List<String> configIds) {
+        ThirdPartWeComRoomConfigTaskExample example = new ThirdPartWeComRoomConfigTaskExample();
+        example.createCriteria().andConfigIdIn(configIds);
+        return roomConfigTaskMapper.selectByExample(example);
+    }
+
+    @Override
+    public List<ThirdPartWeComRoomConfigTaskContent> getRoomConfigTaskContents(List<String> taskIds) {
         ThirdPartWeComRoomConfigTaskContentExample example = new ThirdPartWeComRoomConfigTaskContentExample();
         example.createCriteria().andTaskIdIn(taskIds);
         return roomConfigTaskContentMapper.selectByExample(example);
@@ -213,6 +222,7 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
             config.setUpdateTime(new Date());
             roomConfigMapper.updateByPrimaryKey(config);
         }
+        ThirdPartWeComRoom room = weComThirdPartyService.getRoomById(param.getRoomId());
         ThirdPartWeComRoomConfig newConfig = new ThirdPartWeComRoomConfig();
         newConfig.setId(DistributedIdGenerator.generate());
         newConfig.setAccountConfigId(accountConfigId);
@@ -225,6 +235,7 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
         newConfig.setCreateTime(new Date());
         newConfig.setUpdateTime(new Date());
         roomConfigMapper.insert(newConfig);
+        List<ThirdPartWeComRoomConfigTask> taskList = new ArrayList<>();
         for (ThirdPartyRoomConfigTaskParam taskParam : param.getTaskList()) {
             ThirdPartWeComRoomConfigTask newTask = new ThirdPartWeComRoomConfigTask();
             newTask.setId(DistributedIdGenerator.generate());
@@ -236,6 +247,7 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
             newTask.setCreateTime(new Date());
             newTask.setUpdateTime(new Date());
             roomConfigTaskMapper.insert(newTask);
+            taskList.add(newTask);
             for (ThirdPartyRoomConfigTaskContentParam taskContentParam : taskParam.getContentList()) {
                 ThirdPartWeComRoomConfigTaskContent newContent = new ThirdPartWeComRoomConfigTaskContent();
                 newContent.setId(DistributedIdGenerator.generate());
@@ -250,6 +262,8 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
                 roomConfigTaskContentMapper.insert(newContent);
             }
         }
+        String now = DateUtil.getCurrentDateStr("HH:mm");
+        weComSendMsgJob.randomRoomSendTime(room, newConfig, taskList, now);
     }
 
     private void checkRoomConfigParam(ThirdPartyRoomConfigParam param) {
@@ -332,4 +346,52 @@ public class WeComThirdPartyRoomServiceImpl implements WeComThirdPartyRoomServic
         roomConfigParam.setTaskList(taskList);
         return roomConfigParam;
     }
+
+    @Override
+    public void saveRoomConfig(ThirdPartWeComRoom room, String accountConfigId, ThirdPartyAccountConfigVO configVO) {
+        ThirdPartyRoomConfigParam roomConfigParam = buildRoomConfigParam(room, configVO);
+        saveRoomConfig(roomConfigParam, accountConfigId);
+    }
+
+    private ThirdPartyRoomConfigParam buildRoomConfigParam(ThirdPartWeComRoom room, ThirdPartyAccountConfigVO configVO) {
+        ThirdPartyRoomConfigParam roomConfigParam = new ThirdPartyRoomConfigParam();
+        roomConfigParam.setRoomId(room.getId());
+        roomConfigParam.setPutScene(configVO.getPutScene());
+        roomConfigParam.setChannel(configVO.getChannel());
+        roomConfigParam.setSwitchFlag(configVO.getSwitchFlag());
+        roomConfigParam.setOpenRoomSendSwitchNum(configVO.getOpenRoomSendSwitchNum());
+        roomConfigParam.setPrimaryThirdStaffId(configVO.getPrimaryThirdStaffId());
+        roomConfigParam.setPrimaryThirdStaffName(configVO.getPrimaryThirdStaffName());
+        roomConfigParam.setSecondThirdStaffId(configVO.getSecondThirdStaffId());
+        roomConfigParam.setSecondThirdStaffName(configVO.getSecondThirdStaffName());
+        List<ThirdPartyRoomConfigTaskParam> taskList = new ArrayList<>();
+        for (ThirdPartyAccountConfigTaskVO taskVO : configVO.getTaskList()) {
+            ThirdPartyRoomConfigTaskParam task = new ThirdPartyRoomConfigTaskParam();
+            task.setSwitchFlag(taskVO.getSwitchFlag());
+            task.setSendTime(taskVO.getSendTime());
+            task.setRandomMin(taskVO.getRandomMin());
+            task.setSeq(taskVO.getSeq());
+            List<ThirdPartyRoomConfigTaskContentParam> contentList = new ArrayList<>();
+            for (ThirdPartyAccountConfigTaskContentVO taskContentVO : taskVO.getContentList()) {
+                ThirdPartyRoomConfigTaskContentParam content = new ThirdPartyRoomConfigTaskContentParam();
+                content.setType(taskContentVO.getType());
+                content.setContent(taskContentVO.getContent());
+                content.setSource(taskContentVO.getSource());
+                content.setSourceContent(taskContentVO.getSourceContent());
+                content.setSeq(taskContentVO.getSeq());
+                contentList.add(content);
+            }
+            task.setContentList(contentList);
+            taskList.add(task);
+        }
+        roomConfigParam.setTaskList(taskList);
+        return roomConfigParam;
+    }
+
+    @Override
+    public List<ThirdPartWeComRoomConfig> getRoomConfigListByRoomIds(List<Long> roomIds) {
+        ThirdPartWeComRoomConfigExample example = new ThirdPartWeComRoomConfigExample();
+        example.createCriteria().andRoomIdIn(roomIds).andStatusEqualTo(1);
+        return roomConfigMapper.selectByExample(example);
+    }
 }

+ 17 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/wecom/thirdparty/impl/WeComThirdPartyServiceImpl.java

@@ -348,6 +348,23 @@ public class WeComThirdPartyServiceImpl implements WeComThirdPartyService {
         return commonResponse;
     }
 
+    @Override
+    public CommonResponse<SendTextMsgResponse> sendTextMsg(ThirdPartWeComStaff staff, ThirdPartWeComRoom room, SendTextMsgRequest request) {
+        String response = apiClient.sendTextMsg(request);
+        CommonResponse<SendTextMsgResponse> commonResponse =
+                JSONObject.parseObject(response, new TypeReference<CommonResponse<SendTextMsgResponse>>() {});
+        if (commonResponse.getErrcode() != 0) {
+            LarkRobotUtil.sendWeComThirdPartMessage(
+                    "【发送应用消息失败通知】\n" +
+                            "账号名称:" + staff.getName() + "\n" +
+                            "群名:" + room.getName() + "\n" +
+                            "错误码:" + commonResponse.getErrcode() + "\n" +
+                            "错误信息:" + commonResponse.getErrmsg());
+            log.error("WeComThirdPartyService send text msg failed, request: {}, response: {}", request, response);
+        }
+        return commonResponse;
+    }
+
     @Override
     public List<ThirdPartWeComStaff> getActiveStaffList() {
         ThirdPartWeComStaffExample example = new ThirdPartWeComStaffExample();

+ 1 - 6
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -208,12 +208,7 @@
         select *
         from content_platform_video_agg video
         where video.dt = #{dt} and video.status = 1 and video.score > #{minScore}
-        <if test="excludeVideoIds != null and excludeVideoIds.size() > 0">
-            and video.video_id not in
-            <foreach collection="excludeVideoIds" item="item" open="(" close=")" separator=",">
-                #{item}
-            </foreach>
-        </if>
+        and video.video_id not in (select video_id from third_part_we_com_msg where send_userid = #{roomId} and video_id is not null)
         order by ${sort}
         limit #{offset}, #{pageSize}
     </select>

+ 51 - 15
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComMsgMapper.xml

@@ -5,6 +5,8 @@
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="uuid" jdbcType="VARCHAR" property="uuid" />
     <result column="send_userid" jdbcType="BIGINT" property="sendUserid" />
+    <result column="send_type" jdbcType="INTEGER" property="sendType" />
+    <result column="content" jdbcType="VARCHAR" property="content" />
     <result column="staff_id" jdbcType="BIGINT" property="staffId" />
     <result column="video_id" jdbcType="BIGINT" property="videoId" />
     <result column="appName" jdbcType="VARCHAR" property="appname" />
@@ -84,9 +86,9 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, uuid, send_userid, staff_id, video_id, appName, title, weappIconUrl, pagepath, 
-    root_source_id, username, appid, cdnkey, md5, aeskey, fileSize, isRoom, `status`, 
-    create_time
+    id, uuid, send_userid, send_type, content, staff_id, video_id, appName, title, weappIconUrl, 
+    pagepath, root_source_id, username, appid, cdnkey, md5, aeskey, fileSize, isRoom, 
+    `status`, create_time
   </sql>
   <sql id="Blob_Column_List">
     `desc`
@@ -147,19 +149,21 @@
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComMsg">
     insert into third_part_we_com_msg (id, uuid, send_userid, 
-      staff_id, video_id, appName, 
-      title, weappIconUrl, pagepath, 
-      root_source_id, username, appid, 
-      cdnkey, md5, aeskey, 
-      fileSize, isRoom, `status`, 
-      create_time, `desc`)
+      send_type, content, staff_id, 
+      video_id, appName, title, 
+      weappIconUrl, pagepath, root_source_id, 
+      username, appid, cdnkey, 
+      md5, aeskey, fileSize, 
+      isRoom, `status`, create_time, 
+      `desc`)
     values (#{id,jdbcType=BIGINT}, #{uuid,jdbcType=VARCHAR}, #{sendUserid,jdbcType=BIGINT}, 
-      #{staffId,jdbcType=BIGINT}, #{videoId,jdbcType=BIGINT}, #{appname,jdbcType=VARCHAR}, 
-      #{title,jdbcType=VARCHAR}, #{weappiconurl,jdbcType=VARCHAR}, #{pagepath,jdbcType=VARCHAR}, 
-      #{rootSourceId,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{appid,jdbcType=VARCHAR}, 
-      #{cdnkey,jdbcType=VARCHAR}, #{md5,jdbcType=VARCHAR}, #{aeskey,jdbcType=VARCHAR}, 
-      #{filesize,jdbcType=INTEGER}, #{isroom,jdbcType=BIT}, #{status,jdbcType=INTEGER}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{desc,jdbcType=LONGVARCHAR})
+      #{sendType,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{staffId,jdbcType=BIGINT}, 
+      #{videoId,jdbcType=BIGINT}, #{appname,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, 
+      #{weappiconurl,jdbcType=VARCHAR}, #{pagepath,jdbcType=VARCHAR}, #{rootSourceId,jdbcType=VARCHAR}, 
+      #{username,jdbcType=VARCHAR}, #{appid,jdbcType=VARCHAR}, #{cdnkey,jdbcType=VARCHAR}, 
+      #{md5,jdbcType=VARCHAR}, #{aeskey,jdbcType=VARCHAR}, #{filesize,jdbcType=INTEGER}, 
+      #{isroom,jdbcType=BIT}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{desc,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComMsg">
     insert into third_part_we_com_msg
@@ -173,6 +177,12 @@
       <if test="sendUserid != null">
         send_userid,
       </if>
+      <if test="sendType != null">
+        send_type,
+      </if>
+      <if test="content != null">
+        content,
+      </if>
       <if test="staffId != null">
         staff_id,
       </if>
@@ -235,6 +245,12 @@
       <if test="sendUserid != null">
         #{sendUserid,jdbcType=BIGINT},
       </if>
+      <if test="sendType != null">
+        #{sendType,jdbcType=INTEGER},
+      </if>
+      <if test="content != null">
+        #{content,jdbcType=VARCHAR},
+      </if>
       <if test="staffId != null">
         #{staffId,jdbcType=BIGINT},
       </if>
@@ -306,6 +322,12 @@
       <if test="record.sendUserid != null">
         send_userid = #{record.sendUserid,jdbcType=BIGINT},
       </if>
+      <if test="record.sendType != null">
+        send_type = #{record.sendType,jdbcType=INTEGER},
+      </if>
+      <if test="record.content != null">
+        content = #{record.content,jdbcType=VARCHAR},
+      </if>
       <if test="record.staffId != null">
         staff_id = #{record.staffId,jdbcType=BIGINT},
       </if>
@@ -367,6 +389,8 @@
     set id = #{record.id,jdbcType=BIGINT},
       uuid = #{record.uuid,jdbcType=VARCHAR},
       send_userid = #{record.sendUserid,jdbcType=BIGINT},
+      send_type = #{record.sendType,jdbcType=INTEGER},
+      content = #{record.content,jdbcType=VARCHAR},
       staff_id = #{record.staffId,jdbcType=BIGINT},
       video_id = #{record.videoId,jdbcType=BIGINT},
       appName = #{record.appname,jdbcType=VARCHAR},
@@ -393,6 +417,8 @@
     set id = #{record.id,jdbcType=BIGINT},
       uuid = #{record.uuid,jdbcType=VARCHAR},
       send_userid = #{record.sendUserid,jdbcType=BIGINT},
+      send_type = #{record.sendType,jdbcType=INTEGER},
+      content = #{record.content,jdbcType=VARCHAR},
       staff_id = #{record.staffId,jdbcType=BIGINT},
       video_id = #{record.videoId,jdbcType=BIGINT},
       appName = #{record.appname,jdbcType=VARCHAR},
@@ -422,6 +448,12 @@
       <if test="sendUserid != null">
         send_userid = #{sendUserid,jdbcType=BIGINT},
       </if>
+      <if test="sendType != null">
+        send_type = #{sendType,jdbcType=INTEGER},
+      </if>
+      <if test="content != null">
+        content = #{content,jdbcType=VARCHAR},
+      </if>
       <if test="staffId != null">
         staff_id = #{staffId,jdbcType=BIGINT},
       </if>
@@ -480,6 +512,8 @@
     update third_part_we_com_msg
     set uuid = #{uuid,jdbcType=VARCHAR},
       send_userid = #{sendUserid,jdbcType=BIGINT},
+      send_type = #{sendType,jdbcType=INTEGER},
+      content = #{content,jdbcType=VARCHAR},
       staff_id = #{staffId,jdbcType=BIGINT},
       video_id = #{videoId,jdbcType=BIGINT},
       appName = #{appname,jdbcType=VARCHAR},
@@ -503,6 +537,8 @@
     update third_part_we_com_msg
     set uuid = #{uuid,jdbcType=VARCHAR},
       send_userid = #{sendUserid,jdbcType=BIGINT},
+      send_type = #{sendType,jdbcType=INTEGER},
+      content = #{content,jdbcType=VARCHAR},
       staff_id = #{staffId,jdbcType=BIGINT},
       video_id = #{videoId,jdbcType=BIGINT},
       appName = #{appname,jdbcType=VARCHAR},

+ 309 - 0
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComVideoMapper.xml

@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComVideoMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="dt" jdbcType="VARCHAR" property="dt" />
+    <result column="video_id" jdbcType="BIGINT" property="videoId" />
+    <result column="category" jdbcType="VARCHAR" property="category" />
+    <result column="title" jdbcType="VARCHAR" property="title" />
+    <result column="cover" jdbcType="VARCHAR" property="cover" />
+    <result column="video" jdbcType="VARCHAR" property="video" />
+    <result column="score" jdbcType="DOUBLE" property="score" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="create_timestamp" jdbcType="BIGINT" property="createTimestamp" />
+    <result column="update_timestamp" jdbcType="BIGINT" property="updateTimestamp" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, dt, video_id, category, title, cover, video, score, `status`, create_timestamp, 
+    update_timestamp
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideoExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from third_part_we_com_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="page != null">
+      limit #{page.offset} , #{page.pageSize}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from third_part_we_com_video
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from third_part_we_com_video
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideoExample">
+    delete from third_part_we_com_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo">
+    insert into third_part_we_com_video (id, dt, video_id, 
+      category, title, cover, 
+      video, score, `status`, 
+      create_timestamp, update_timestamp)
+    values (#{id,jdbcType=BIGINT}, #{dt,jdbcType=VARCHAR}, #{videoId,jdbcType=BIGINT}, 
+      #{category,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{cover,jdbcType=VARCHAR}, 
+      #{video,jdbcType=VARCHAR}, #{score,jdbcType=DOUBLE}, #{status,jdbcType=INTEGER}, 
+      #{createTimestamp,jdbcType=BIGINT}, #{updateTimestamp,jdbcType=BIGINT})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo">
+    insert into third_part_we_com_video
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="dt != null">
+        dt,
+      </if>
+      <if test="videoId != null">
+        video_id,
+      </if>
+      <if test="category != null">
+        category,
+      </if>
+      <if test="title != null">
+        title,
+      </if>
+      <if test="cover != null">
+        cover,
+      </if>
+      <if test="video != null">
+        video,
+      </if>
+      <if test="score != null">
+        score,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp,
+      </if>
+      <if test="updateTimestamp != null">
+        update_timestamp,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="dt != null">
+        #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="category != null">
+        #{category,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="cover != null">
+        #{cover,jdbcType=VARCHAR},
+      </if>
+      <if test="video != null">
+        #{video,jdbcType=VARCHAR},
+      </if>
+      <if test="score != null">
+        #{score,jdbcType=DOUBLE},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        #{createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="updateTimestamp != null">
+        #{updateTimestamp,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideoExample" resultType="java.lang.Long">
+    select count(*) from third_part_we_com_video
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update third_part_we_com_video
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.dt != null">
+        dt = #{record.dt,jdbcType=VARCHAR},
+      </if>
+      <if test="record.videoId != null">
+        video_id = #{record.videoId,jdbcType=BIGINT},
+      </if>
+      <if test="record.category != null">
+        category = #{record.category,jdbcType=VARCHAR},
+      </if>
+      <if test="record.title != null">
+        title = #{record.title,jdbcType=VARCHAR},
+      </if>
+      <if test="record.cover != null">
+        cover = #{record.cover,jdbcType=VARCHAR},
+      </if>
+      <if test="record.video != null">
+        video = #{record.video,jdbcType=VARCHAR},
+      </if>
+      <if test="record.score != null">
+        score = #{record.score,jdbcType=DOUBLE},
+      </if>
+      <if test="record.status != null">
+        `status` = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.createTimestamp != null">
+        create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="record.updateTimestamp != null">
+        update_timestamp = #{record.updateTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update third_part_we_com_video
+    set id = #{record.id,jdbcType=BIGINT},
+      dt = #{record.dt,jdbcType=VARCHAR},
+      video_id = #{record.videoId,jdbcType=BIGINT},
+      category = #{record.category,jdbcType=VARCHAR},
+      title = #{record.title,jdbcType=VARCHAR},
+      cover = #{record.cover,jdbcType=VARCHAR},
+      video = #{record.video,jdbcType=VARCHAR},
+      score = #{record.score,jdbcType=DOUBLE},
+      `status` = #{record.status,jdbcType=INTEGER},
+      create_timestamp = #{record.createTimestamp,jdbcType=BIGINT},
+      update_timestamp = #{record.updateTimestamp,jdbcType=BIGINT}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo">
+    update third_part_we_com_video
+    <set>
+      <if test="dt != null">
+        dt = #{dt,jdbcType=VARCHAR},
+      </if>
+      <if test="videoId != null">
+        video_id = #{videoId,jdbcType=BIGINT},
+      </if>
+      <if test="category != null">
+        category = #{category,jdbcType=VARCHAR},
+      </if>
+      <if test="title != null">
+        title = #{title,jdbcType=VARCHAR},
+      </if>
+      <if test="cover != null">
+        cover = #{cover,jdbcType=VARCHAR},
+      </if>
+      <if test="video != null">
+        video = #{video,jdbcType=VARCHAR},
+      </if>
+      <if test="score != null">
+        score = #{score,jdbcType=DOUBLE},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTimestamp != null">
+        create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      </if>
+      <if test="updateTimestamp != null">
+        update_timestamp = #{updateTimestamp,jdbcType=BIGINT},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComVideo">
+    update third_part_we_com_video
+    set dt = #{dt,jdbcType=VARCHAR},
+      video_id = #{videoId,jdbcType=BIGINT},
+      category = #{category,jdbcType=VARCHAR},
+      title = #{title,jdbcType=VARCHAR},
+      cover = #{cover,jdbcType=VARCHAR},
+      video = #{video,jdbcType=VARCHAR},
+      score = #{score,jdbcType=DOUBLE},
+      `status` = #{status,jdbcType=INTEGER},
+      create_timestamp = #{createTimestamp,jdbcType=BIGINT},
+      update_timestamp = #{updateTimestamp,jdbcType=BIGINT}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 9 - 0
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComRoomMapperExt.xml

@@ -46,4 +46,13 @@
         limit #{offset}, #{pageSize}
     </select>
 
+    <select id="getNoConfigRoomList"
+            resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom">
+        select room.*
+        from third_part_we_com_room room
+        join third_part_we_com_staff staff on room.staff_id = staff.id
+        left join third_part_we_com_room_config room_config on room.id = room_config.room_id and room_config.status = 1
+        where room.is_delete = 0 and staff.id = #{staffId} and room_config.id is null
+    </select>
+
 </mapper>

+ 0 - 1
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComStaffMapperExt.xml

@@ -58,7 +58,6 @@
             </if>
         ) t2 on staff.id = t2.id
         where staff.status = 0
-        and staff.id != #{accountId}
         <if test="name != null and name != ''">
             and staff.name like concat('%', #{name}, '%')
         </if>

+ 46 - 0
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComVideoMapperExt.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComVideoMapperExt">
+
+    <insert id="batchInsertThirdPartWeComVideo">
+        insert into third_part_we_com_video (dt, video_id, category, title, cover, video, score, create_timestamp)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.dt}, #{item.videoId}, #{item.category}, #{item.title}, #{item.cover}, #{item.video}, #{item.score},
+            #{item.createTimestamp})
+        </foreach>
+    </insert>
+
+    <select id="getVideoMaxDt" resultType="java.lang.String">
+        select max(dt)
+        from third_part_we_com_video
+    </select>
+
+    <update id="updateOtherVideoStatus">
+        update third_part_we_com_video
+        set status = 0,
+            update_timestamp = #{now}
+        where dt = #{dt} and video_id not in
+        <foreach collection="videoIdList" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+
+    <update id="updateVideoStatusWithOldStatus">
+        update third_part_we_com_video
+        set status = #{status},
+            update_timestamp = #{now}
+        where video_id = #{videoId}
+          and status = #{oldStatus}
+    </update>
+
+    <select id="getVideoMinScoreList" resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideo">
+        select *
+        from third_part_we_com_video video
+        where video.dt = #{dt} and video.status = 1 and video.score > #{minScore}
+          and video.video_id not in (select video_id from third_part_we_com_msg where send_userid = #{roomId} and video_id is not null)
+        order by ${sort}
+        limit #{offset}, #{pageSize}
+    </select>
+
+</mapper>

+ 2 - 1
api-module/src/main/resources/mybatis-api-wecomThirdpart-generator-config.xml

@@ -53,7 +53,7 @@
 <!--        <table tableName="third_part_we_com_corp" domainObjectName="ThirdPartWeComCorp" alias=""/>-->
 <!--        <table tableName="third_part_we_com_room" domainObjectName="ThirdPartWeComRoom" alias=""/>-->
 <!--        <table tableName="third_part_we_com_room_user" domainObjectName="ThirdPartWeComRoomUser" alias=""/>-->
-        <table tableName="third_part_we_com_room_config" domainObjectName="ThirdPartWeComRoomConfig" alias=""/>
+<!--        <table tableName="third_part_we_com_room_config" domainObjectName="ThirdPartWeComRoomConfig" alias=""/>-->
 <!--        <table tableName="third_part_we_com_room_config_task" domainObjectName="ThirdPartWeComRoomConfigTask" alias=""/>-->
 <!--        <table tableName="third_part_we_com_room_config_task_content" domainObjectName="ThirdPartWeComRoomConfigTaskContent" alias=""/>-->
 <!--        <table tableName="third_part_we_com_staff" domainObjectName="ThirdPartWeComStaff" alias=""/>-->
@@ -62,6 +62,7 @@
 <!--        <table tableName="third_part_we_com_staff_config_task" domainObjectName="ThirdPartWeComStaffConfigTask" alias=""/>-->
 <!--        <table tableName="third_part_we_com_staff_config_task_content" domainObjectName="ThirdPartWeComStaffConfigTaskContent" alias=""/>-->
 <!--        <table tableName="third_part_we_com_msg" domainObjectName="ThirdPartWeComMsg" alias=""/>-->
+        <table tableName="third_part_we_com_video" domainObjectName="ThirdPartWeComVideo" alias=""/>
     </context>
 
 </generatorConfiguration>