| | |
| | | import com.yeshi.buwan.dto.log.BaseLog; |
| | | import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData; |
| | | import com.yeshi.buwan.mogotv.MogoTVUtil; |
| | | import com.yeshi.buwan.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.ad.DeviceAdStrategyService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | |
| | | if (homeTypeList != null) |
| | | for (HomeType homeType : homeTypeList) { |
| | | String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ",")); |
| | | List<HomeVideo> homeVideoList = homeTypeService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber()); |
| | | |
| | | 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); |
| | | if (bigPictureCount > 0 && homeVideoList.size() > 0) { |
| | | homeVideoList.get(0).setBigPicture(true); |
| | | } |
| | | long videoCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | long bigPictureCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, true); |
| | | |
| | | if (videoCount - bigPictureCount > homeType.getNumber()) { |
| | | while ((videoCount - bigPictureCount) % homeType.getNumber() != 0) { |
| | | videoCount--; |
| | |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, true, 1, homeType.getNumber()); |
| | | List<HomeVideo> bigPictureVideos = new ArrayList<>(); |
| | | |
| | | if (homeType.isBigPicture()) { |
| | | bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, null, 1, 1); |
| | | if (bigPictureVideos != null && bigPictureVideos.size() > 0) |
| | | bigPictureVideos.get(0).setBigPicture(true); |
| | | } |
| | | |
| | | //大图需要每次都返回 |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, false, page, homeType.getNumber()); |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, homeType.isBigPicture(), page, homeType.getNumber()); |
| | | List<HomeVideo> list = new ArrayList<>(); |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | |
| | | public void getVideoDetail(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String videoId = request.getParameter("VideoId"); |
| | | if (!NumberUtil.isNumeric(videoId)) { |
| | | String[] cidVid = PPTVUtil.parseCidAndVidFromVisualVideoId(videoId); |
| | | if (cidVid == null) { |
| | | getVideoDetailForInternetSearch(acceptData, videoId, request, out); |
| | | return; |
| | | } |
| | | String cid = cidVid[0]; |
| | | String vid = cidVid[1]; |
| | | |
| | | PPTVSeries series = pptvService.getSeriesDetail(cid); |
| | | if (series == null) { |
| | | series = PPTVApiUtil.getDetail(cid); |
| | | } |
| | | |
| | | if (series != null) { |
| | | JSONObject data = new JSONObject(); |
| | | String playUrl = PPTVUtil.getPlayUrl(series, pptvService.selectProgramById(vid)); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", series.getName()); |
| | | data.put("pptv", true); |
| | | data.put("vip", PPTVUtil.isVIPVideo(series.getFree())); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseJson("已下线")); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | |
| | | //PPTV网页播放 |
| | | if (resourceId != null && Integer.parseInt(resourceId) == PPTVUtil.RESOURCE_ID) { |
| | | JSONObject data = new JSONObject(); |
| | | PPTVSeries series = pptvService.getSeriesDetailByVideoId(videoId); |
| | | VideoPPTVMap map = pptvService.getVideoPPTVMapByVideoId(videoId); |
| | | int p = 0; |
| | | if (!StringUtil.isNullOrEmpty(position)) { |
| | | p = Integer.parseInt(position); |
| | |
| | | } |
| | | } |
| | | |
| | | p = p >= series.getSeries().size() ? 0 : p; |
| | | String videoName = ""; |
| | | String playUrl = null; |
| | | |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, series.getName(), videoId, resourceId); |
| | | String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); |
| | | PPTVSeries series = pptvService.getSeriesDetail(map.getInfoId()); |
| | | |
| | | if (map.getProgramCode() != null) { |
| | | PPTVProgram program = pptvService.selectProgramById(map.getProgramCode()); |
| | | videoName = program.getProgramSetTiltle(); |
| | | playUrl = PPTVUtil.getPlayUrl(series, program); |
| | | } else { |
| | | videoName = series.getName(); |
| | | p = p >= series.getSeries().size() ? 0 : p; |
| | | playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); |
| | | } |
| | | |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, videoName, videoId, resourceId); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", series.getName()); |
| | | data.put("name", videoName); |
| | | data.put("pptv", true); |
| | | data.put("vip", "1".equalsIgnoreCase(series.getFree())); |
| | | data.put("sessionId", sessionId); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, series.getName(), from)); |