wangyunpeng 1 mês atrás
pai
commit
5ee19f13eb

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

@@ -0,0 +1,77 @@
+package com.tzld.piaoquan.api.controller.wecom.thirdpart;
+
+import com.tzld.piaoquan.api.job.wecom.thirdpart.WeComAccountJob;
+import com.tzld.piaoquan.api.job.wecom.thirdpart.WeComCreateRoomJob;
+import com.tzld.piaoquan.api.job.wecom.thirdpart.WeComSendMsgJob;
+import com.tzld.piaoquan.api.job.wecom.thirdpart.WeComUserDetailJob;
+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;
+
+    @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();
+    }
+
+
+}

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

@@ -48,7 +48,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);

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

@@ -64,9 +64,9 @@ 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;
 
     private final static ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.SECONDS,
@@ -121,7 +121,7 @@ public class WeComSendMsgJob {
                             }
                             contentList = contentList.stream().sorted(Comparator.comparing(ThirdPartWeComRoomConfigTaskContent::getSeq)).collect(Collectors.toList());
                             for (ThirdPartWeComRoomConfigTaskContent configTaskContent : contentList) {
-                                if (ConfigTaskContentTypeEnum.TEXT.getVal() != configTaskContent.getType()) {
+                                if (ConfigTaskContentTypeEnum.TEXT.getVal() == configTaskContent.getType()) {
                                     // build发送体
                                     SendTextMsgRequest request = buildSendTextMsgRequest(configTaskContent.getContent(), staff, room);
                                     // 发送消息
@@ -291,7 +291,7 @@ public class WeComSendMsgJob {
                         type, channel, "normal", videoMinScore, sentVideoIds, 0, 100, sort);
                 // 行业数量不足,按平台推荐top选取视频
                 sort = "video.score desc";
-                result.addAll(planMapperExt.getVideoMinScoreList(dt, videoMinScore, sentVideoIds, 0, 100, sort));
+                result.addAll(planMapperExt.getVideoMinScoreList(dt, videoMinScore, roomId, 0, 100, sort));
         }
         return result;
     }
@@ -311,7 +311,8 @@ 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());
     }

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

@@ -321,8 +321,10 @@ 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);
     }

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

@@ -131,12 +131,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>