admin
2024-10-30 010ef2a907e66efd4702443c06cdd18f8a7ffa5b
src/main/java/com/yeshi/buwan/service/imp/juhe/PPTVServiceImpl.java
@@ -2,7 +2,6 @@
import com.yeshi.buwan.dao.VideoInfoDao;
import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao;
import com.yeshi.buwan.dao.VideoTypeDao;
import com.yeshi.buwan.dao.juhe.pptv.PPTVProgramDao;
import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesDao;
import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesProgramMapDao;
@@ -13,17 +12,16 @@
import com.yeshi.buwan.domain.VideoType;
import com.yeshi.buwan.domain.video.AlbumVideoMap;
import com.yeshi.buwan.dto.mq.PPTVMQMsg;
import com.yeshi.buwan.pptv.PPTVApiUtil;
import com.yeshi.buwan.pptv.PPTVQuery;
import com.yeshi.buwan.pptv.PPTVUtil;
import com.yeshi.buwan.pptv.entity.*;
import com.yeshi.buwan.service.imp.CategoryVideoService;
import com.yeshi.buwan.service.imp.ResourceVideoService;
import com.yeshi.buwan.service.imp.VideoInfoService;
import com.yeshi.buwan.service.imp.VideoTypeService;
import com.yeshi.buwan.service.inter.juhe.PPTVService;
import com.yeshi.buwan.util.mq.CMQManager;
import com.yeshi.buwan.util.video.VideoConstant;
import com.yeshi.buwan.util.mq.rabbit.RabbitmqManager;
import com.yeshi.buwan.videos.pptv.PPTVApiUtil;
import com.yeshi.buwan.videos.pptv.PPTVQuery;
import com.yeshi.buwan.videos.pptv.PPTVUtil;
import com.yeshi.buwan.videos.pptv.entity.*;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
@@ -59,6 +57,9 @@
    @Resource
    private VideoResourceMapExtraInfoDao videoResourceMapExtraInfoDao;
    @Resource
    private RabbitmqManager rabbitmqManager;
    @Override
@@ -101,14 +102,14 @@
                    videoInfo.setVpicture(newVideoInfo.getVpicture());
                    videoInfo.setShow(newVideoInfo.getShow());
                    videoInfo.setVideoType(newVideoInfo.getVideoType());
                    videoInfoDao.update(videoInfo);
                    videoInfoService.update(videoInfo);
                }
            } else {//视频不存在
                //判断2个视频实体是否为同一视频
                VideoInfo oldVideo = videoInfoService.getExistSameVideoWithDirector(newVideoInfo);
                if (oldVideo == null) {
                    //添加视频
                    Serializable id = videoInfoDao.save(newVideoInfo);
                    Serializable id = videoInfoService.save(newVideoInfo);
                    newVideoInfo.setId(id + "");
                } else {//为同一视频
                    //更新tag
@@ -120,7 +121,7 @@
                    oldVideo.setVpicture(newVideoInfo.getVpicture());
                    oldVideo.setShow(newVideoInfo.getShow());
                    oldVideo.setVideoType(newVideoInfo.getVideoType());
                    videoInfoDao.update(oldVideo);
                    videoInfoService.update(oldVideo);
                }
                //加入专辑视频映射
@@ -159,7 +160,7 @@
            resourceVideoService.addVideoResource(newVideoInfo.getId(), PPTVUtil.RESOURCE_ID + "");
            //添加视频分类映射
            categoryVideoService.addCategoryVideo(newVideoInfo.getId(), videoType.getId());
            CMQManager.getInstance().addSolrMsg(newVideoInfo.getId());
            rabbitmqManager.addSolrMsg(newVideoInfo.getId());
        }
    }
@@ -239,7 +240,7 @@
                    series.setCreateTime(new Date());
                    pptvSeriesDao.save(series);
                    //处理新增/改变的剧集信息
                    CMQManager.getInstance().addPPTVSeriesUpdateMsg(new PPTVMQMsg(series.getInfoID(), PPTVMQMsg.TYPE_ADD_OR_UPDATE));
                    rabbitmqManager.addPPTVSeriesUpdateMsg(new PPTVMQMsg(series.getInfoID(), PPTVMQMsg.TYPE_ADD_OR_UPDATE));
                }
                System.out.println("addorupdate:" + series.getName());
@@ -263,7 +264,7 @@
        for (String id : infoIds) {
            //处理删除的剧集信息
            CMQManager.getInstance().addPPTVSeriesUpdateMsg(new PPTVMQMsg(id, PPTVMQMsg.TYPE_DELETE));
            rabbitmqManager.addPPTVSeriesUpdateMsg(new PPTVMQMsg(id, PPTVMQMsg.TYPE_DELETE));
        }