|
@@ -131,10 +131,12 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
if (isInvalidGuaranteedParam(guaranteedParam)) {
|
|
|
return CommonResponse.create(500, "参数错误");
|
|
|
}
|
|
|
-
|
|
|
Set<Long> videoIds = new HashSet<>();
|
|
|
for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
|
|
|
- processVideoParam(videoParam, guaranteedParam.getDate(), videoIds);
|
|
|
+ CommonResponse<Void> voidCommonResponse = processVideoParam(videoParam, guaranteedParam.getDate(), videoIds);
|
|
|
+ if (voidCommonResponse != null) {
|
|
|
+ return voidCommonResponse;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Map<Long, VideoDetail> coverMap = getVideoDetail(videoIds);
|
|
@@ -156,9 +158,9 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void processVideoParam(VideoParam videoParam, String date, Set<Long> videoIds) {
|
|
|
+ private CommonResponse<Void> processVideoParam(VideoParam videoParam, String date, Set<Long> videoIds) {
|
|
|
if (CollectionUtils.isEmpty(videoParam.getVideoIds()) || videoParam.getVideoIds().size() < MAX_VIDEO_NUM) {
|
|
|
- LarkRobotUtil.sendMessage("保底视频数量异常,请查看" + date);
|
|
|
+ return CommonResponse.create(500, "保底视频数量异常,请查看" + date);
|
|
|
}
|
|
|
List<Long> staffIds = Optional.ofNullable(videoParam.getStaffIds()).orElseGet(() -> {
|
|
|
List<Long> newStaffIds = new ArrayList<>();
|
|
@@ -168,12 +170,16 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
return newStaffIds;
|
|
|
});
|
|
|
for (Long staffId : staffIds) {
|
|
|
- checkVideoSendTime(videoParam, staffId);
|
|
|
+ CommonResponse<Void> voidCommonResponse = checkVideoSendTime(videoParam, staffId);
|
|
|
+ if (voidCommonResponse != null) {
|
|
|
+ return voidCommonResponse;
|
|
|
+ }
|
|
|
videoIds.addAll(videoParam.getVideoIds());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
- private void checkVideoSendTime(VideoParam videoParam, Long staffId) {
|
|
|
+ private CommonResponse<Void> checkVideoSendTime(VideoParam videoParam, Long staffId) {
|
|
|
for (Long videoId : videoParam.getVideoIds()) {
|
|
|
MessageAttachmentExample example = new MessageAttachmentExample();
|
|
|
example.createCriteria().andMiniprogramVideoIdEqualTo(videoId).andStaffIdEqualTo(staffId);
|
|
@@ -184,10 +190,10 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
MessageAttachment messageAttachment = messageAttachmentList.get(0);
|
|
|
if (messageAttachment.getSendTime() != null &&
|
|
|
DateUtil.dateDifference(new Date(), messageAttachment.getSendTime()) < 30 * MILLISECOND_DAY) {
|
|
|
- LarkRobotUtil.sendMessage("保底视频90天内已发送,请查看videoId=" + videoId);
|
|
|
- throw new RuntimeException("保底视频90天内已发送,请查看videoId=" + videoId);
|
|
|
+ return CommonResponse.create(500, "保底视频30天内已发送,请查看videoId=" + videoId);
|
|
|
}
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
private Map<Long, MessageAttachment> createMessageAttachmentMap(Set<Long> videoIds, Map<Long, VideoDetail> coverMap) {
|