Sfoglia il codice sorgente

修改组装数据逻辑

xueyiming 5 mesi fa
parent
commit
5a077d757e

+ 6 - 10
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComMessageDataJob.java

@@ -216,23 +216,19 @@ public class WeComMessageDataJob {
         if (guaranteedParam == null || CollectionUtils.isEmpty(guaranteedParam.getVideoParamList())) {
             return;
         }
-        List<Long> videoIdList = new ArrayList<>();
+        Set<Long> videoIdSet = new HashSet<>();
         for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
             if (CollectionUtils.isEmpty(videoParam.getVideoIds())) {
                 continue;
             }
-            videoIdList.addAll(videoParam.getVideoIds());
+            videoIdSet.addAll(videoParam.getVideoIds());
         }
-
+        List<Long> videoIdList = new ArrayList<>(videoIdSet);
         MessageAttachmentExample example = new MessageAttachmentExample();
         example.createCriteria().andMiniprogramVideoIdIn(videoIdList);
-        List<MessageAttachment> messageAttachmentList = messageAttachmentMapper.selectByExample(example);
-        for (MessageAttachment messageAttachment : messageAttachmentList) {
-            MessageAttachment updateMessageAttachment = new MessageAttachment();
-            updateMessageAttachment.setId(messageAttachment.getId());
-            updateMessageAttachment.setSendTime(new Date());
-            messageAttachmentMapper.updateByPrimaryKeySelective(updateMessageAttachment);
-        }
+        MessageAttachment updateMessageAttachment = new MessageAttachment();
+        updateMessageAttachment.setSendTime(new Date());
+        messageAttachmentMapper.updateByExampleSelective(updateMessageAttachment, example);
         redisTemplate.delete(key);
     }