| | |
| | | |
| | | import com.yeshi.buwan.domain.SolrVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.util.VideoTypeUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class SolrVideoFactory { |
| | | |
| | | |
| | | public static SolrVideo create(VideoInfo videoInfo) { |
| | | public static SolrVideo create(VideoInfo videoInfo, List<VideoResource> videoResources) { |
| | | SolrVideo solrVideo = new SolrVideo(); |
| | | solrVideo.setMainactor(videoInfo.getMainActor()); |
| | | solrVideo.setShow(Integer.parseInt(videoInfo.getShow())); |
| | |
| | | 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()); |
| | | else |
| | | solrVideo.setRootVideoType(0); |
| | | |
| | | 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; |
| | | } |
| | | } |