| | |
| | | } |
| | | |
| | | |
| | | // 首页类型获取 |
| | | public void getHomeTypeNew(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | // 20170914 一级视频分类ID |
| | | String page = request.getParameter("Page"); |
| | | String pageSize = request.getParameter("PageSize"); |
| | | String dataKey = request.getParameter("DataKey"); |
| | | |
| | | long count = homeTypeService.countHomeType(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<HomeType> homeTypeList = homeTypeService.getHomeTypeList(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey, Integer.parseInt(page), Integer.parseInt(pageSize)); |
| | | |
| | | 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 videoCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | homeType.setCount((int) videoCount); |
| | | homeType.setHomeVideoList(homeVideoList); |
| | | } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | JSONArray array = new JSONArray(); |
| | | for (int i = 0; i < homeTypeList.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(homeTypeList.get(i))); |
| | | object.put("data", array); |
| | | object.put("count", count + ""); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } |
| | | |
| | | |
| | | public HomeType convertHomeVideoList(HomeType type) { |
| | | List<VideoInfo> vlist = new ArrayList<VideoInfo>(); |
| | | List<HomeVideo> list = type.getHomeVideoList(); |
| | |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | //查询大图 |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, 1, homeType.getNumber()); |
| | | List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, true, 1, homeType.getNumber()); |
| | | |
| | | |
| | | //大图需要每次都返回 |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ",")); |
| | | |
| | | Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceList, null); |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceList, false, page, homeType.getNumber()); |
| | | Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null); |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, false, page, homeType.getNumber()); |
| | | List<HomeVideo> list = new ArrayList<>(); |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | |
| | | //每天展示一次广告 |
| | | 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); |
| | | deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, null); |
| | | } |
| | | }); |
| | | return; |