admin
2021-03-02 4011b8d0b377af33e2bc435f7726329630d706cb
src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.buwan.iqiyi.entity.VideoIqiyi2;
import com.yeshi.buwan.iqiyi.util.IqiyiUtil;
import com.yeshi.buwan.iqiyi.util.IqiyiUtil2;
import com.yeshi.buwan.query.Iqiyi2AlbumQuery;
import com.yeshi.buwan.service.imp.CategoryVideoService;
import com.yeshi.buwan.service.imp.ResourceVideoService;
import com.yeshi.buwan.service.imp.VideoInfoService;
@@ -19,8 +20,11 @@
import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.TimeUtil;
import com.yeshi.buwan.util.log.VideoLogFactory;
import com.yeshi.buwan.util.mq.CMQManager;
import com.yeshi.buwan.util.video.VideoConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -33,6 +37,9 @@
@Service
public class Iqiyi2ServiceImpl implements Iqiyi2Service {
    private final Logger logger = LoggerFactory.getLogger("videoUpdate");
    @Resource
    private VideoIqiyi2Dao videoIqiyi2Dao;
@@ -70,7 +77,10 @@
        } else {//专辑
            //判断period字段是否为空
            int sort = album.isSourceAlbum() ? IqiyiAlbum2.SORT_PERIOD : IqiyiAlbum2.SORT_ORDER;
            List<IqiyiAlbum2> list = iqiyiAlbum2Dao.listByAid(album.getId(), sort, (page - 1) * pageSize, pageSize);
            Iqiyi2AlbumQuery query = new Iqiyi2AlbumQuery();
            query.setFeatureAlbumId(album.getId());
            query.setContentType(1);
            List<IqiyiAlbum2> list = iqiyiAlbum2Dao.listByAid(query, sort, (page - 1) * pageSize, pageSize);
            if (list != null)
                album2List.addAll(list);
        }
@@ -146,6 +156,7 @@
                return;
        }
        logger.info(VideoLogFactory.createAddToVideoLog(album));
        VideoInfo newVideoInfo = convertAlbumToVideoInfo(album);
        VideoIqiyi2 videoIqiyi2 = videoIqiyi2Dao.selectByIqiyiId(album.getId());
@@ -334,4 +345,24 @@
    public long countById(Long id) {
        return iqiyiAlbum2Dao.countById(id);
    }
    @Override
    public void deleteByAid(long id) {
        long count = iqiyiAlbum2Dao.countById(id);
        if (count > 0) {
            iqiyiAlbum2Dao.delete(id);
        }
        VideoIqiyi2 bean = videoIqiyi2Dao.selectByIqiyiId(id);
        if (bean != null) {
            videoIqiyi2Dao.delete(bean.getVideoId());
            //删除资源
            resourceVideoService.delete(bean.getVideoId() + "", IqiyiUtil2.RESOURCE_ID + "");
        }
    }
    @Override
    public List<IqiyiAlbum2> listByIds(List<Long> idsList) {
        return iqiyiAlbum2Dao.listByIds(idsList);
    }
}