| | |
| | | import com.google.common.base.Function; |
| | | import com.google.common.collect.Maps; |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | | import com.yeshi.buwan.domain.solr.SolrShortVideo; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.domain.video.VideoInfoExtra; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrShortVideoSearchFilter; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.exception.video.IqiyiVideoSolrException; |
| | | import com.yeshi.buwan.videos.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil2; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.juhe.Iqiyi2Service; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; |
| | | import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrInternetSearchVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.vo.video.VideoAdminInfoVO; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.acFun.AcFunUtil; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.service.imp.ClassService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoManager; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | |
| | | @Resource |
| | | private ClassService classService; |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | |
| | | @Resource |
| | | private IqiyiUtil iqiyiUtil; |
| | | |
| | | @Resource |
| | | private AcFunUtil acFunUtil; |
| | | |
| | | @Resource |
| | | private ThreadPoolTaskExecutor taskExecutor; |
| | |
| | | private SolrAlbumVideoDataManager solrAlbumDataManager; |
| | | |
| | | @Resource |
| | | private SolrInternetSearchVideoDataManager solrInternetSearchVideoDataManager; |
| | | |
| | | @Resource |
| | | private SolrShortVideoDataManager solrShortVideoDataManager; |
| | | |
| | | |
| | | @Resource |
| | | private VideoInfoExtraService videoInfoExtraService; |
| | | |
| | | @Resource |
| | | private Iqiyi2Service iqiyi2Service; |
| | | |
| | | @Resource |
| | | private IqiyiUtil2 iqiyiUtil2; |
| | | |
| | | @RequestMapping(value = "/changevideoshow", method = RequestMethod.POST) |
| | | public void changeVideoShow(String id, int show, PrintWriter out) { |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/videolist", method = RequestMethod.POST) |
| | | public void videoList(int videotype, int page, String key, String type, String resourceIds, int contenttype, String freeType, String area, PrintWriter out) { |
| | | public void videoList(int videotype, int page, String key, String type, String resourceIds, int fromtype, int contenttype, String freeType, String area, PrintWriter out) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(type)) { |
| | | type = "name"; |
| | |
| | | for (VideoResource vr : resourceList) { |
| | | resourceMap.put(Long.parseLong(vr.getId()), vr.getName()); |
| | | } |
| | | if (fromtype == HomeVideo.FROM_TYPE_LOCAL) { |
| | | SolrResultDTO dto = solrAlbumDataManager.find(filter, page, Constant.pageCount); |
| | | if (dto.getVideoList() != null) |
| | | for (SolrAlbumVideo videoInfo : (List<SolrAlbumVideo>) dto.getVideoList()) |
| | | voList.add(VideoAdminInfoVO.create(videoInfo, resourceMap)); |
| | | count = dto.getTotalCount(); |
| | | } else if (fromtype == HomeVideo.FROM_TYPE_INTERNET) { |
| | | SolrResultDTO dto = solrInternetSearchVideoDataManager.find(filter, page, Constant.pageCount); |
| | | if (dto.getVideoList() != null) |
| | | for (InternetSearchVideo videoInfo : (List<InternetSearchVideo>) dto.getVideoList()) |
| | | voList.add(VideoAdminInfoVO.create(videoInfo, resourceMap)); |
| | | count = dto.getTotalCount(); |
| | | } else if (fromtype == HomeVideo.FROM_TYPE_SHORT) { |
| | | SolrShortVideoSearchFilter shortFilter = new SolrShortVideoSearchFilter(); |
| | | shortFilter.setRootVideoType(filter.getVideoType()); |
| | | if (!StringUtil.isNullOrEmpty(key)) { |
| | | String[] keys = key.split(" "); |
| | | if (!StringUtil.isNullOrEmpty(keys[0])) |
| | | shortFilter.setTag(keys[0].trim()); |
| | | if (keys.length > 1) { |
| | | shortFilter.setKey(key.substring(key.indexOf(keys[0])).trim()); |
| | | } |
| | | } |
| | | |
| | | SolrResultDTO dto = solrAlbumDataManager.find(filter, page, Constant.pageCount); |
| | | if (dto.getVideoList() != null) |
| | | for (SolrAlbumVideo videoInfo : (List<SolrAlbumVideo>) dto.getVideoList()) |
| | | voList.add(VideoAdminInfoVO.create(videoInfo,resourceMap)); |
| | | count = dto.getTotalCount(); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(filter.getArea())) { |
| | | shortFilter.setAreas(Arrays.asList(new String[]{filter.getArea()})); |
| | | //某些短视频分类为日韩 |
| | | if (filter.getArea().equalsIgnoreCase("韩国")) { |
| | | shortFilter.getAreas().add("日韩"); |
| | | } |
| | | } |
| | | shortFilter.setFuzzy(true); |
| | | SolrResultDTO dto = solrShortVideoDataManager.find(shortFilter, page, Constant.pageCount); |
| | | if (dto.getVideoList() != null) |
| | | for (SolrShortVideo videoInfo : (List<SolrShortVideo>) dto.getVideoList()) |
| | | voList.add(VideoAdminInfoVO.create(videoInfo, resourceMap)); |
| | | count = dto.getTotalCount(); |
| | | } |
| | | } else { |
| | | list = classService.getTypeVideoListAdmin(videotype == 0 ? "" : videotype + "", page, key, |
| | | contenttype); |
| | |
| | | if (StringUtil.isNullOrEmpty(aid)) { |
| | | out.print(JsonUtil.loadFalseAdmin("未能获取到专辑")); |
| | | } else { |
| | | iqiyiUtil.updateAlbum(aid); |
| | | try { |
| | | iqiyi2Service.validAlbumSolrState(Long.parseLong(aid)); |
| | | iqiyiUtil2.syncByAid(Long.parseLong(aid),false); |
| | | } catch (IqiyiVideoSolrException e) { |
| | | if (e.getCode() == IqiyiVideoSolrException.CODE_ALBUM_NOT_SAVE || |
| | | e.getCode() == IqiyiVideoSolrException.CODE_ALBUM_NOT_EXIST || e.getCode() == IqiyiVideoSolrException.CODE_ALBUM_NOT_ADD_TO_VIDEO) { |
| | | iqiyiUtil2.syncByAid(Long.parseLong(aid),false); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMsg())); |
| | | return; |
| | | } |
| | | } |
| | | out.print(JsonUtil.loadTrueAdmin("专辑更新成功")); |
| | | } |
| | | } |