|
@@ -84,102 +84,6 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public CommonResponse<Void> createGuaranteedMiniProgram(GuaranteedParam guaranteedParam) {
|
|
|
-// if (guaranteedParam == null
|
|
|
-// || StringUtils.isEmpty(guaranteedParam.getDate())
|
|
|
-// || CollectionUtils.isEmpty(guaranteedParam.getVideoParamList())) {
|
|
|
-// return CommonResponse.create(500, "参数错误");
|
|
|
-// }
|
|
|
-// Set<Long> videoIds = new HashSet<>();
|
|
|
-// for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
|
|
|
-// if (CollectionUtils.isEmpty(videoParam.getVideoIds()) || videoParam.getVideoIds().size() < MAX_VIDEO_NUM) {
|
|
|
-// LarkRobotUtil.sendMessage("保底视频数量异常,请查看" + guaranteedParam.getDate());
|
|
|
-// }
|
|
|
-// 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 staffId : videoParam.getStaffIds()) {
|
|
|
-// for (Long videoId : videoParam.getVideoIds()) {
|
|
|
-// MessageAttachmentExample example = new MessageAttachmentExample();
|
|
|
-// example.createCriteria().andMiniprogramVideoIdEqualTo(videoId).andStaffIdEqualTo(videoParam.getStaffId());
|
|
|
-// List<MessageAttachment> messageAttachmentList = messageAttachmentMapper.selectByExample(example);
|
|
|
-// if (CollectionUtils.isEmpty(messageAttachmentList)) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// MessageAttachment messageAttachment = messageAttachmentList.get(0);
|
|
|
-// if (messageAttachment.getSendTime() != null
|
|
|
-// && DateUtil.dateDifference(new Date(), messageAttachment.getSendTime()) < 90 * MILLISECOND_DAY) {
|
|
|
-// LarkRobotUtil.sendMessage("保底视频90天内已发送,请查看videoId=" + videoId);
|
|
|
-// return CommonResponse.create(500, "保底视频90天内已发送,请查看videoId=" + videoId);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// videoIds.addAll(videoParam.getVideoIds());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// Map<Long, VideoDetail> coverMap = getVideoDetail(videoIds);
|
|
|
-// Map<Long, MessageAttachment> messageAttachmentMap = new HashMap<>();
|
|
|
-//
|
|
|
-// for (Long videoId : videoIds) {
|
|
|
-// MessageAttachment messageAttachment = new MessageAttachment();
|
|
|
-// VideoDetail videoDetail = coverMap.get(videoId);
|
|
|
-// if (videoDetail == null || StringUtils.isEmpty(videoDetail.getCover()) || StringUtils.isEmpty(videoDetail.getTitle())) {
|
|
|
-// LarkRobotUtil.sendMessage("获取视频详情异常,请查看" + videoId);
|
|
|
-// throw new RuntimeException("获取视频详情异常");
|
|
|
-// }
|
|
|
-// messageAttachment.setMiniprogramVideoId(videoId);
|
|
|
-// messageAttachment.setType(MessageAttachmentTypeEnum.MINI_PROGRAM.getType());
|
|
|
-// messageAttachment.setCover(videoDetail.getCover());
|
|
|
-// messageAttachment.setTitle(videoDetail.getTitle());
|
|
|
-// messageAttachment.setAppid(appid);
|
|
|
-// messageAttachmentMap.put(videoId, messageAttachment);
|
|
|
-// }
|
|
|
-// List<MessageAttachment> messageAttachmentList = new ArrayList<>();
|
|
|
-// for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
|
|
|
-// 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 staffId : videoParam.getStaffIds()) {
|
|
|
-// if (staffId == 0) {
|
|
|
-// addGuaranteesVideo(guaranteedParam.getDate(), staffId, videoParam.getVideoIds());
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// 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);
|
|
|
-// 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);
|
|
|
-// }
|
|
|
|
|
|
public CommonResponse<Void> createGuaranteedMiniProgram(GuaranteedParam guaranteedParam) {
|
|
|
if (isInvalidGuaranteedParam(guaranteedParam)) {
|
|
@@ -294,6 +198,13 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
}
|
|
|
|
|
|
private void addGuaranteesVideo(String date, Long staffId, List<Long> videoIds) {
|
|
|
+ GuaranteesVideoExample example = new GuaranteesVideoExample();
|
|
|
+ example.createCriteria().andIsDeleteEqualTo(0).andDateEqualTo(date).andStaffIdEqualTo(staffId);
|
|
|
+ List<GuaranteesVideo> guaranteesVideos = guaranteesVideoMapper.selectByExample(example);
|
|
|
+ for (GuaranteesVideo guaranteesVideo : guaranteesVideos) {
|
|
|
+ guaranteesVideo.setIsDelete(1);
|
|
|
+ guaranteesVideoMapper.updateByPrimaryKeySelective(guaranteesVideo);
|
|
|
+ }
|
|
|
GuaranteesVideo guaranteesVideo = new GuaranteesVideo();
|
|
|
guaranteesVideo.setDate(date);
|
|
|
guaranteesVideo.setStaffId(staffId);
|
|
@@ -304,7 +215,7 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
@Override
|
|
|
public GuaranteedParam getGuaranteedVideo(String date) {
|
|
|
GuaranteesVideoExample example = new GuaranteesVideoExample();
|
|
|
- example.createCriteria().andDateEqualTo(date);
|
|
|
+ example.createCriteria().andDateEqualTo(date).andIsDeleteEqualTo(0);
|
|
|
List<GuaranteesVideo> guaranteesVideos = guaranteesVideoMapper.selectByExample(example);
|
|
|
if (CollectionUtils.isEmpty(guaranteesVideos)) {
|
|
|
LarkRobotUtil.sendMessage("获保底视频空,@薛一鸣");
|