From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 20 二月 2025 16:57:55 +0800 Subject: [PATCH] IOS广告增加区域屏蔽 --- src/main/java/com/yeshi/buwan/service/imp/CategoryVideoService.java | 35 +++++++++++++++++++++++++++++------ 1 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/CategoryVideoService.java b/src/main/java/com/yeshi/buwan/service/imp/CategoryVideoService.java index a0f4ac5..73029ed 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/CategoryVideoService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/CategoryVideoService.java @@ -1,15 +1,17 @@ package com.yeshi.buwan.service.imp; import com.yeshi.buwan.dao.CategoryVideoDao; -import com.yeshi.buwan.dao.ResourceVideoDao; -import com.yeshi.buwan.domain.*; -import org.hibernate.HibernateException; -import org.hibernate.Query; -import org.hibernate.Session; +import com.yeshi.buwan.domain.CategoryVideo; +import com.yeshi.buwan.domain.VideoInfo; +import com.yeshi.buwan.domain.VideoType; +import com.yeshi.buwan.dto.mq.VideoDataChangeMQMsg; +import com.yeshi.buwan.dto.mq.VideoExtraInfoChangeMQMsg; +import com.yeshi.buwan.util.mq.rabbit.RabbitmqManager; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; +import org.yeshi.utils.StringUtil; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; @@ -19,6 +21,9 @@ @Autowired private CategoryVideoDao categoryVideoDao; + @Resource + private RabbitmqManager rabbitmqManager; + public void addCategoryVideo(String videoId, long categoryId) { List<CategoryVideo> list = categoryVideoDao.listByVideoIdAndCategoryId(videoId, categoryId); if (list == null || list.size() == 0) { @@ -26,7 +31,25 @@ cv.setVideo(new VideoInfo(videoId)); cv.setVideoType(new VideoType(categoryId)); categoryVideoDao.save(cv); + rabbitmqManager.addVideoExtraInfoChanged(new VideoExtraInfoChangeMQMsg(VideoExtraInfoChangeMQMsg.TYPE_CATEGORY, videoId, VideoExtraInfoChangeMQMsg.ACTION_ADD)); + rabbitmqManager.addVideoDataChanged(new VideoDataChangeMQMsg(VideoDataChangeMQMsg.TYPE_VIDEO_CATEGORY, videoId, VideoDataChangeMQMsg.ACTION_ADD)); } } + public List<CategoryVideo> getCategoryList(List<VideoInfo> videoInfoList) { + String hql = "from CategoryVideo cv where "; + List<String> orList = new ArrayList<>(); + for (VideoInfo videoInfo : videoInfoList) { + orList.add("cv.video.id=" + videoInfo.getId()); + } + hql += StringUtil.concat(orList, " or "); + return categoryVideoDao.list(hql); + } + + public List<CategoryVideo> getCategoryList(String videoId) { + String hql = "from CategoryVideo cv where cv.video.id=" + videoId; + return categoryVideoDao.list(hql); + } + + } -- Gitblit v1.8.0