浏览代码

Merge branch 'dev-xym-update1' of Server/growth-manager into master

xueyiming 3 月之前
父节点
当前提交
f660a06761

+ 2 - 1
common-module/src/main/java/com/tzld/piaoquan/growth/common/dao/mapper/CgiReplyBucketDataMapper.java

@@ -6,6 +6,7 @@ import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketDataExample;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 @Mapper
@@ -32,5 +33,5 @@ public interface CgiReplyBucketDataMapper {
 
     int updateByPrimaryKey(CgiReplyBucketData row);
 
-    List<Long> selectVideoId();
+    List<Long> selectVideoId(@Param("createTime") Date createTime);
 }

+ 1 - 1
common-module/src/main/resources/mapper/CgiReplyBucketDataMapper.xml

@@ -402,6 +402,6 @@
   <select id="selectVideoId" resultType="java.lang.Long">
     select distinct mini_video_id
     from cgi_reply_bucket_data
-    where is_delete = 0;
+    where is_delete = 0 and create_time > #{createTime,jdbcType=TIMESTAMP};
   </select>
 </mapper>

+ 16 - 5
offline-module/src/main/java/com/tzld/piaoquan/offline/job/AutoReplyVideoDataJob.java

@@ -15,6 +15,7 @@ import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketData;
 import com.tzld.piaoquan.growth.common.model.po.CgiReplyBucketDataExample;
 import com.tzld.piaoquan.growth.common.model.po.GhDetail;
 import com.tzld.piaoquan.growth.common.model.po.GhDetailExample;
+import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import com.tzld.piaoquan.growth.common.utils.LarkRobotUtil;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -25,9 +26,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @Slf4j
@@ -107,7 +106,8 @@ public class AutoReplyVideoDataJob {
 
     @XxlJob("validateAutoReplyVideoAuditStatusJob")
     public ReturnT<String> validateAutoReplyVideoAuditStatus(String param) throws IOException {
-        List<Long> videoIds = cgiReplyBucketDataMapper.selectVideoId();
+        Long beforeDayStart = DateUtil.getBeforeDayStart(7);
+        List<Long> videoIds = cgiReplyBucketDataMapper.selectVideoId(new Date(beforeDayStart));
         if (CollectionUtils.isEmpty(videoIds)) {
             return ReturnT.SUCCESS;
         }
@@ -144,7 +144,8 @@ public class AutoReplyVideoDataJob {
 
         for (Long videoId : auditFailedVideoIds) {
             CgiReplyBucketDataExample example = new CgiReplyBucketDataExample();
-            example.createCriteria().andMiniVideoIdEqualTo(videoId).andIsDeleteEqualTo(0);
+            example.createCriteria().andMiniVideoIdEqualTo(videoId).andIsDeleteEqualTo(0)
+                    .andCreateTimeGreaterThan(new Date(beforeDayStart));
             List<CgiReplyBucketData> cgiReplyBucketDataList = cgiReplyBucketDataMapper.selectByExample(example);
 //            List<String> ghIds = new ArrayList<>();
 //            List<String> manualGhIds = new ArrayList<>();
@@ -183,6 +184,16 @@ public class AutoReplyVideoDataJob {
 
             }
         }
+
+        Map<String, JSONObject> collect = rows.stream()
+                .collect(Collectors.toMap(
+                        row -> row.getString("ghId") + "-" + row.getString("video"),
+                        row -> row,
+                        (existing, replacement) -> existing
+                ));
+        rows = new ArrayList<>(collect.values());
+
+
         FeishuTableDTO tableDTO = FeishuTableDTO.createTable("自动回复视频审核失败报警", columns, rows, false);
         JSONObject content = JSONObject.parseObject(JSONObject.toJSONString(tableDTO));
         JSONObject bodyParam = new JSONObject();