|
@@ -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();
|