Procházet zdrojové kódy

修改保底视频上传方式

xueyiming před 4 měsíci
rodič
revize
402d12b756

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

@@ -154,7 +154,7 @@ public class WeComMessageDataJob {
                 MessageAttachment messageAttachment = messageAttachmentList.get(0);
                 if (messageAttachment.getSendTime() != null
                         && DateUtil.dateDifference(new Date(), messageAttachment.getSendTime()) < 90 * MILLISECOND_DAY) {
-                    LarkRobotUtil.sendMessage("保底视频半年内已发送,请查看videoId=" + videoId);
+                    LarkRobotUtil.sendMessage("保底视频90天内已发送,请查看videoId=" + videoId);
                 }
             }
             //重新组合视频id

+ 2 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/bo/VideoParam.java

@@ -9,6 +9,8 @@ public class VideoParam {
 
     private Long staffId;
 
+    private List<Long> staffIds;
+
     private List<Long> videoIds;
 
 }

+ 31 - 17
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageAttachmentServiceImpl.java

@@ -106,8 +106,8 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
                 MessageAttachment messageAttachment = messageAttachmentList.get(0);
                 if (messageAttachment.getSendTime() != null
                         && DateUtil.dateDifference(new Date(), messageAttachment.getSendTime()) < 90 * MILLISECOND_DAY) {
-                    LarkRobotUtil.sendMessage("保底视频半年内已发送,请查看videoId=" + videoId);
-                    return CommonResponse.create(500, "保底视频半年内已发送,请查看videoId=" + videoId);
+                    LarkRobotUtil.sendMessage("保底视频90天内已发送,请查看videoId=" + videoId);
+                    return CommonResponse.create(500, "保底视频90天内已发送,请查看videoId=" + videoId);
                 }
             }
             videoIds.addAll(videoParam.getVideoIds());
@@ -131,31 +131,45 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
         }
         List<MessageAttachment> messageAttachmentList = new ArrayList<>();
         for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
-            if (videoParam.getStaffId() == 0) {
+            if (CollectionUtils.isEmpty(videoParam.getStaffIds())) {
+                videoParam.setStaffIds(new ArrayList<>());
+                if (videoParam.getStaffId() != null) {
+                    videoParam.getStaffIds().add(videoParam.getStaffId());
+                }
+            }
+            if (CollectionUtils.isEmpty(videoParam.getStaffIds())) {
                 continue;
             }
-            for (Long videoId : videoParam.getVideoIds()) {
-                MessageAttachment messageAttachment = messageAttachmentMap.get(videoId);
-                if (messageAttachment == null) {
+            for (Long staffId : videoParam.getStaffIds()) {
+                if (staffId == 0) {
+                    addGuaranteesVideo(guaranteedParam.getDate(), staffId, videoParam.getVideoIds());
                     continue;
                 }
-                MessageAttachment newMessageAttachment = new MessageAttachment();
-                BeanUtils.copyProperties(messageAttachment, newMessageAttachment);
-                newMessageAttachment.setStaffId(videoParam.getStaffId());
-                messageAttachmentList.add(newMessageAttachment);
+                for (Long videoId : videoParam.getVideoIds()) {
+                    MessageAttachment messageAttachment = messageAttachmentMap.get(videoId);
+                    if (messageAttachment == null) {
+                        continue;
+                    }
+                    MessageAttachment newMessageAttachment = new MessageAttachment();
+                    BeanUtils.copyProperties(messageAttachment, newMessageAttachment);
+                    newMessageAttachment.setStaffId(staffId);
+                    messageAttachmentList.add(newMessageAttachment);
+                    addGuaranteesVideo(guaranteedParam.getDate(), staffId, videoParam.getVideoIds());
+                }
             }
         }
         addMiniProgram(messageAttachmentList, null);
-        for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
-            GuaranteesVideo guaranteesVideo = new GuaranteesVideo();
-            guaranteesVideo.setDate(guaranteedParam.getDate());
-            guaranteesVideo.setStaffId(videoParam.getStaffId());
-            guaranteesVideo.setVideoIds(JSONObject.toJSONString(videoParam.getVideoIds()));
-            guaranteesVideoMapper.insertSelective(guaranteesVideo);
-        }
         return CommonResponse.success();
     }
 
+    private void addGuaranteesVideo(String date, Long staffId, List<Long> videoIds) {
+        GuaranteesVideo guaranteesVideo = new GuaranteesVideo();
+        guaranteesVideo.setDate(date);
+        guaranteesVideo.setStaffId(staffId);
+        guaranteesVideo.setVideoIds(JSONObject.toJSONString(videoIds));
+        guaranteesVideoMapper.insertSelective(guaranteesVideo);
+    }
+
     @Override
     public GuaranteedParam getGuaranteedVideo(String date) {
         GuaranteesVideoExample example = new GuaranteesVideoExample();