| | |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.juhe.YouKuService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.service.manager.VideoPlayStatisticManager; |
| | | import com.yeshi.buwan.tencent.TencentVideoUtil; |
| | |
| | | import com.yeshi.buwan.util.log.LoggerUtil; |
| | | import com.yeshi.buwan.util.log.UserActiveLogFactory; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.videos.bilibili.BilibiliUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.VideoDetailVO; |
| | | import com.yeshi.buwan.youku.YouKuUtil; |
| | |
| | | private HomeAdService homeAdService; |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | |
| | | @Resource |
| | | private HomeVideoService homeVideoService; |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService configService; |
| | | @Resource |
| | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); |
| | | List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion(), resourceList, |
| | | CacheUtil.getMD5Long(resourceList), -1, special != null ? special.getDataKey() : null); |
| | | List<HomeType> list = new ArrayList<>(); |
| | |
| | | |
| | | long count = homeTypeService.countHomeType(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); |
| | | List<HomeType> homeTypeList = homeTypeService.getHomeTypeList(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey, Integer.parseInt(page), Integer.parseInt(pageSize)); |
| | | |
| | | if (homeTypeList != null) |
| | |
| | | |
| | | long bigPictureCount = homeType.isBigPicture() ? 1 : 0;// homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, true); |
| | | |
| | | List<HomeVideo> homeVideoList = homeTypeService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber() + (int) bigPictureCount); |
| | | List<HomeVideo> homeVideoList = homeVideoService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber() + (int) bigPictureCount); |
| | | if (bigPictureCount > 0 && homeVideoList.size() > 0) { |
| | | homeVideoList.get(0).setBigPicture(true); |
| | | } |
| | | long videoCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | long videoCount = homeVideoService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | |
| | | if (videoCount - bigPictureCount > homeType.getNumber()) { |
| | | while ((videoCount - bigPictureCount) % homeType.getNumber() != 0) { |
| | |
| | | homeType.setCount((int) videoCount); |
| | | List<HomeVideo> tempHomeVideoList = new ArrayList<>(); |
| | | tempHomeVideoList.addAll(homeVideoList); |
| | | while (tempHomeVideoList != null && (tempHomeVideoList.size() - bigPictureCount) % homeType.getColumns() != 0) |
| | | while (tempHomeVideoList != null && tempHomeVideoList.size() > 0 && (tempHomeVideoList.size() - bigPictureCount) % homeType.getColumns() != 0) |
| | | tempHomeVideoList.remove(tempHomeVideoList.size() - 1); |
| | | |
| | | homeType.setHomeVideoList(tempHomeVideoList); |
| | | } |
| | | |
| | | try { |
| | | if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion()) && dataKey.equalsIgnoreCase("recommend")) { |
| | | DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | if (adContent != null && adPosition != null) { |
| | | HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); |
| | | int adP = Integer.parseInt(adPosition.getValue()); |
| | | if (adP < homeTypeList.size() && adP > -1) { |
| | | HomeType homeType = new HomeType(); |
| | | homeType.setAd(ad); |
| | | if ("1".equalsIgnoreCase(page)) { |
| | | homeTypeList.add(adP, homeType); |
| | | } |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | JSONArray array = new JSONArray(); |
| | |
| | | return; |
| | | } |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = new ArrayList<>(); |
| | | |
| | | if (homeType.isBigPicture()) { |
| | | bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, null, 1, 1); |
| | | bigPictureVideos = homeVideoService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, null, 1, 1); |
| | | if (bigPictureVideos != null && bigPictureVideos.size() > 0) |
| | | bigPictureVideos.get(0).setBigPicture(true); |
| | | } |
| | |
| | | JSONObject object = new JSONObject(); |
| | | String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ",")); |
| | | |
| | | Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null); |
| | | Long count = homeVideoService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null); |
| | | if (count - bigPictureVideos.size() > homeType.getNumber()) { |
| | | |
| | | while ((count - bigPictureVideos.size()) % homeType.getNumber() != 0) { |
| | |
| | | } |
| | | |
| | | |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, homeType.isBigPicture(), page, homeType.getNumber()); |
| | | List<HomeVideo> list1 = homeVideoService.getHomeVideoList(homeTypeId, resourceKey, resourceList, homeType.isBigPicture(), page, homeType.getNumber()); |
| | | List<HomeVideo> list = new ArrayList<>(); |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | |
| | | |
| | | List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(type, pageIndex, detailSystem); |
| | | |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | for (int i = 0; i < homeVideoList.size(); i++) { |
| | | HomeVideo hv = (HomeVideo) homeVideoList.get(i); |
| | | if (acceptData.getPackageName().contains("doudou")) { |
| | |
| | | |
| | | @Resource |
| | | private TencentVideoUtil tencentVideoUtil; |
| | | |
| | | @Resource |
| | | private BilibiliUtil bilibiliUtil; |
| | | |
| | | @Resource |
| | | private VideoPlayStatisticManager videoPlayStatisticManager; |
| | |
| | | } else if (Integer.parseInt(resourceId) == TencentVideoUtil.RESOURCE_ID) { |
| | | try { |
| | | info = tencentVideoUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | } else if (Integer.parseInt(resourceId) == BilibiliUtil.RESOURCE_ID) { |
| | | try { |
| | | info = bilibiliUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel()); |
| | | |
| | | //获取优先展示的渠道 |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //每天展示一次广告 |
| | | long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | |
| | | deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, null); |
| | | //看PP视频 |
| | | deviceAdStrategyService.watchPPTVVideo(acceptData.getUtdId(), acceptData.getDetailSystem().getId()); |
| | | } |
| | | }); |
| | | return; |
| | |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid), attention, sessionId)), array.toString(), |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid, videoId, from), attention, sessionId)), array.toString(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | deviceAdStrategyService.setShortVideoAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), videoId, from, showTime, null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |