From 8b2c4df38c2ea983be4db3aa4e18830339537806 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 23 十月 2020 18:51:40 +0800
Subject: [PATCH] 爱奇艺资源优化

---
 src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java
index 5eff5fd..e89c12e 100644
--- a/src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java
+++ b/src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java
@@ -127,16 +127,17 @@
                 return;
         }
 
-        if (album.getChannelId() != 1) {
+
+        if (album.getChannelId() != 1 && !VideoConstant.iqiyiSpecialNames.contains(album.getName())) {
             //鏍囬涓彧鑳藉寘鍚腑鑻辨枃涓庢暟瀛�
-            String regx = "^[(\\u4e00-\\u9fa5)( )a-zA-Z0-9]+$";
+            String regx = "^[(\\u4e00-\\u9fa5)(锛�)( )a-zA-Z0-9]+$";
             if (!Pattern.matches(regx, album.getName())) {
                 return;
             }
         }
 
         //杩囨护鏌愪簺鐭墖涓庡奖璇�
-        if (album.getName().contains("銆�"))
+        if (album.getName().contains("銆�") && !VideoConstant.iqiyiSpecialNames.contains(album.getName()))
             return;
 
         //绌虹數瑙嗗墽鎴栬�呮槸绌哄姩婕垯杩斿洖
@@ -153,7 +154,7 @@
             if (videoInfo == null)
                 return;
             newVideoInfo.setId(videoInfo.getId());
-            if (!newVideoInfo.getTag().equalsIgnoreCase(videoInfo.getTag())) {
+            if (!newVideoInfo.getTag().equalsIgnoreCase(videoInfo.getTag()) || newVideoInfo.getVideocount() != videoInfo.getVideocount()) {
                 newVideoInfo.setCreatetime(videoInfo.getCreatetime());
                 //鏇存柊淇℃伅tag淇℃伅
                 videoInfo.setLatestHpicture(newVideoInfo.getLatestHpicture());
@@ -165,6 +166,7 @@
                 videoInfo.setVpicture(newVideoInfo.getVpicture());
                 videoInfo.setShow(newVideoInfo.getShow());
                 videoInfo.setVideoType(newVideoInfo.getVideoType());
+                videoInfo.setUpdatetime(newVideoInfo.getUpdatetime());
                 videoInfoDao.update(videoInfo);
             }
         } else {//瑙嗛涓嶅瓨鍦�
@@ -186,6 +188,7 @@
                 oldVideo.setVpicture(newVideoInfo.getVpicture());
                 oldVideo.setShow(newVideoInfo.getShow());
                 oldVideo.setVideoType(newVideoInfo.getVideoType());
+                oldVideo.setUpdatetime(newVideoInfo.getUpdatetime());
                 videoInfoDao.update(oldVideo);
             }
 
@@ -310,11 +313,11 @@
                 video.setLatestVpicture(IqiyiUtil.getVPicture(album2.getImageUrl()));
             }
         }
+        long videoCount = iqiyiAlbum2Dao.countVideoByAid(album.getId());
+        if (videoCount == 0L)
+            videoCount = 1;
 
-        if (album.getTvQipuIds() != null && album.getTvQipuIds().size() > 0)
-            video.setVideocount(album.getTvQipuIds().size());
-        else
-            video.setVideocount(1);
+        video.setVideocount((int) videoCount);
 
         video.setUpdatetime(System.currentTimeMillis() + "");
 
@@ -326,4 +329,9 @@
     public IqiyiAlbum2 selectAlbumById(Long id) {
         return iqiyiAlbum2Dao.get(id);
     }
+
+    @Override
+    public long countById(Long id) {
+        return iqiyiAlbum2Dao.countById(id);
+    }
 }

--
Gitblit v1.8.0