From 7804263c6061aef813f0db27cb3046f746572606 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 06 三月 2021 16:07:26 +0800
Subject: [PATCH] 后台管理优化

---
 src/main/java/com/yeshi/buwan/util/factory/SolrVideoFactory.java |   70 +++++++++++++++++++++++++++++++++--
 1 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/util/factory/SolrVideoFactory.java b/src/main/java/com/yeshi/buwan/util/factory/SolrVideoFactory.java
index 2007f0c..15753d8 100644
--- a/src/main/java/com/yeshi/buwan/util/factory/SolrVideoFactory.java
+++ b/src/main/java/com/yeshi/buwan/util/factory/SolrVideoFactory.java
@@ -1,9 +1,11 @@
 package com.yeshi.buwan.util.factory;
 
-import com.yeshi.buwan.domain.SolrVideo;
+import com.yeshi.buwan.domain.CategoryVideo;
+import com.yeshi.buwan.domain.VideoType;
+import com.yeshi.buwan.domain.solr.SolrAlbumVideo;
 import com.yeshi.buwan.domain.VideoInfo;
 import com.yeshi.buwan.domain.VideoResource;
-import com.yeshi.buwan.util.VideoTypeUtil;
+import com.yeshi.buwan.domain.solr.SolrCommonVideo;
 import org.yeshi.utils.StringUtil;
 
 import java.util.ArrayList;
@@ -13,8 +15,8 @@
 public class SolrVideoFactory {
 
 
-    public static SolrVideo create(VideoInfo videoInfo, List<VideoResource> videoResources) {
-        SolrVideo solrVideo = new SolrVideo();
+    public static SolrAlbumVideo createAlbum(VideoInfo videoInfo, List<VideoResource> videoResources) {
+        SolrAlbumVideo solrVideo = new SolrAlbumVideo();
         solrVideo.setMainactor(videoInfo.getMainActor());
         solrVideo.setShow(Integer.parseInt(videoInfo.getShow()));
         solrVideo.setLatestHpicture(videoInfo.getLatestHpicture());
@@ -53,6 +55,66 @@
             solrVideo.setResourceIds(StringUtil.concat(resourceIds, ","));
         }
 
+        solrVideo.setFreeType(videoInfo.getFree());
+
         return solrVideo;
     }
+
+
+    public static SolrCommonVideo createCommon(VideoInfo videoInfo, List<VideoType> typeList, List<VideoResource> videoResources) {
+        SolrCommonVideo solrVideo = new SolrCommonVideo();
+        solrVideo.setMainactor(videoInfo.getMainActor());
+        solrVideo.setShow(Integer.parseInt(videoInfo.getShow()));
+        solrVideo.setLatestHpicture(videoInfo.getLatestHpicture());
+        solrVideo.setDuration(videoInfo.getDuration());
+        solrVideo.setScore(videoInfo.getScore());
+        solrVideo.setVpicture(videoInfo.getVpicture());
+        solrVideo.setLatestVpicture(videoInfo.getLatestVpicture());
+        solrVideo.setId(videoInfo.getId());
+        solrVideo.setTag(videoInfo.getTag());
+        solrVideo.setHpicture(videoInfo.getHpicture());
+        solrVideo.setArea(videoInfo.getArea());
+        solrVideo.setCreatetime(videoInfo.getCreatetime() + "");
+        solrVideo.setWatchcount(Integer.parseInt(videoInfo.getWatchCount()));
+        solrVideo.setDirector(videoInfo.getDirector());
+        solrVideo.setPicture(videoInfo.getPicture());
+        solrVideo.setContenttype(videoInfo.getContentType());
+        solrVideo.setSolrTime(new Date());
+        solrVideo.setCommentcount(videoInfo.getCommentCount());
+        solrVideo.setVideocount(videoInfo.getVideocount());
+        solrVideo.setName(videoInfo.getName());
+        solrVideo.setUpdatetime(videoInfo.getUpdatetime());
+        if (videoInfo.getUpdatetime() != null)
+            solrVideo.setUpdateTime(Long.parseLong(videoInfo.getUpdatetime()));
+        if (videoInfo.getVideoType() != null)
+            solrVideo.setRootVideoType(videoInfo.getVideoType().getId());
+
+        if (typeList != null && typeList.size() > 0) {
+            VideoType videoType = typeList.get(0);
+            if (videoType.getParent() != null) {
+                solrVideo.setRootVideoType(videoType.getParent().getId());
+            } else {
+                solrVideo.setRootVideoType(videoType.getId());
+            }
+            List<Long> ids = new ArrayList<>();
+            for (VideoType cv : typeList) {
+                ids.add(cv.getId());
+            }
+            solrVideo.setVideoTypes(StringUtil.concat(ids, ","));
+        }
+
+        solrVideo.setYear(videoInfo.getYear());
+
+        if (videoResources != null && videoResources.size() > 0) {
+            List<String> resourceIds = new ArrayList<>();
+            for (VideoResource vr : videoResources) {
+                resourceIds.add(vr.getId());
+            }
+            solrVideo.setResourceIds(StringUtil.concat(resourceIds, ","));
+        }
+
+        return solrVideo;
+    }
+
+
 }

--
Gitblit v1.8.0