| | |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | 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.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.ad.DeviceAdStrategyService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | 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.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.service.manager.VideoPlayStatisticManager; |
| | | import com.yeshi.buwan.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | |
| | | |
| | | @Resource |
| | | private HomeRecommendSpecialService homeRecommendSpecialService; |
| | | |
| | | @Resource |
| | | private DeviceAdStrategyService deviceAdStrategyService; |
| | | |
| | | private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); |
| | | |
| | |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, page, homeType.getNumber()); |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, 1, homeType.getNumber()); |
| | | |
| | | |
| | | //大图需要每次都返回 |
| | |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | object.put("count", count); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | |
| | | if (page >= totalPage) { |
| | | page = 0; |
| | | } |
| | | data.put("page", page); |
| | | object.put("page", page); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } |
| | | |
| | |
| | | @Resource |
| | | private TencentVideoUtil tencentVideoUtil; |
| | | |
| | | @Resource |
| | | private VideoPlayStatisticManager videoPlayStatisticManager; |
| | | |
| | | |
| | | private String createVideoDetailSessionId(AcceptData acceptData, String uid, String videoName, String videoId, String resourceId) { |
| | | |
| | | try { |
| | | VideoDetailStatisticData data = new VideoDetailStatisticData(); |
| | | data.setDetailSystemId(acceptData.getDetailSystem().getId()); |
| | | data.setLoginUid(uid); |
| | | data.setResourceId(Integer.parseInt(resourceId)); |
| | | data.setUtdId(acceptData.getUtdId()); |
| | | data.setVersion(acceptData.getVersion()); |
| | | data.setVideoId(videoId); |
| | | data.setVideoName(videoName); |
| | | |
| | | return videoPlayStatisticManager.createVideoDetailSessionId(data); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public void getVideoDetailForInternetSearch(AcceptData acceptData, String videoId, HttpServletRequest request, PrintWriter out) { |
| | | String loginUid = request.getParameter("LoginUid"); |
| | |
| | | JSONObject obj = new JSONObject(); |
| | | |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), new VideoDetailVO.VideoAdInfo(true, false), null)), array.toString(), |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid), null, createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId))), array.toString(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | |
| | | |
| | | p = p >= series.getSeries().size() ? 0 : p; |
| | | |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, series.getName(), videoId, resourceId); |
| | | String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", series.getName()); |
| | | data.put("pptv", true); |
| | | data.put("sessionId", sessionId); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, series.getName(), from)); |
| | | |
| | | 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, showTime); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | UserInfo user = userService.getUserInfo(acceptData.getUid()); |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), new VideoDetailVO.VideoAdInfo(true, true), attention)), array.toString(), |
| | | 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(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |