| | |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), acceptData.getPlatform(), acceptData.getVersion() + "")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | object.put("data", array); |
| | | |
| | | if (pageIndex == 1) {//返回导航栏 |
| | | List<VideoType> typeList = new ArrayList<>(); |
| | | VideoType vt = new VideoType(); |
| | | vt.setId(0); |
| | | vt.setName("全部"); |
| | | typeList.add(vt); |
| | | Set<Long> set = new HashSet<>(); |
| | | for (VideoInfo videoInfo : list) { |
| | | if (videoInfo.getShowType() == 1 && videoInfo.getVideoType() != null) |
| | | set.add(videoInfo.getVideoType().getId()); |
| | | List<Long> set = new ArrayList<>(); |
| | | //将视频内容分类并排序 |
| | | Map<Long, List<VideoInfo>> videoMap = new HashMap<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | VideoInfo videoInfo = list.get(i); |
| | | if (videoInfo.getShowType() == 1 && videoInfo.getVideoType() != null) { |
| | | if (videoMap.get(videoInfo.getVideoType().getId()) == null) |
| | | videoMap.put(videoInfo.getVideoType().getId(), new ArrayList<>()); |
| | | videoMap.get(videoInfo.getVideoType().getId()).add(videoInfo); |
| | | if (!set.contains(videoInfo.getVideoType().getId())) |
| | | set.add(videoInfo.getVideoType().getId()); |
| | | |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion()) && (StringUtil.isNullOrEmpty(type) || type.equalsIgnoreCase("0"))) { |
| | | list.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Iterator<Long> its = set.iterator(); its.hasNext(); ) { |
| | | Long typeId = its.next(); |
| | | //重新组织数据 |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion()) && (StringUtil.isNullOrEmpty(type) || type.equalsIgnoreCase("0"))) { |
| | | List<VideoInfo> albumVideoList = new ArrayList<>(); |
| | | for (int i = 0; i < set.size(); i++) { |
| | | Long typeId = set.get(i); |
| | | String typeName = VideoConstant.getMainCategoryName(typeId); |
| | | if (!StringUtil.isNullOrEmpty(typeName)) { |
| | | videoMap.get(typeId).get(0).setAlbumMoreInfo(new VideoInfo.VideoAlbumMoreInfo(typeName, i + 1)); |
| | | albumVideoList.addAll(videoMap.get(typeId)); |
| | | } |
| | | } |
| | | list.addAll(0, albumVideoList); |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < set.size(); i++) { |
| | | Long typeId = set.get(i); |
| | | String typeName = VideoConstant.getMainCategoryName(typeId); |
| | | if (!StringUtil.isNullOrEmpty(typeName)) { |
| | | vt = new VideoType(); |
| | |
| | | typeList.add(vt); |
| | | } |
| | | } |
| | | |
| | | |
| | | vt = new VideoType(); |
| | | vt.setId(Constant.SEARCH_RESULT_TYPE_HIGH_DEFINITION); |
| | |
| | | object.put("typeList", array1); |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ((VideoInfo) list.get(i)) |
| | | .setPicture(VideoPictureUtil.getShowPicture((VideoInfo) list.get(i), acceptData.getPlatform(), acceptData.getVersion() + "")); |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | } |
| | | object.put("data", array); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | |
| | | } |