| | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | |
| | | out.print(JsonUtil.loadFalseJson("页码错误")); |
| | | return; |
| | | } |
| | | int pageIndex = Integer.parseInt(page); |
| | | switch (key) { |
| | | case "3#hanju-bagua": |
| | | pageIndex++; |
| | | break; |
| | | case "3#hanju-news": |
| | | pageIndex += 2; |
| | | break; |
| | | case "3#hanju-stars": |
| | | pageIndex += 3; |
| | | break; |
| | | case "3#hanju-hots": |
| | | pageIndex += 4; |
| | | |
| | | case "3#hanju-music": |
| | | pageIndex += 5; |
| | | break; |
| | | } |
| | | |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | |
| | | int pageSize = Constant.pageCount; |
| | | boolean hasNextPage = false; |
| | | if (searchSpecial.getAlbumQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrAlbumVideoDataManager.find(searchSpecial.getAlbumQuery(), Integer.parseInt(page), pageSize); |
| | | |
| | | //获取搜索条件 |
| | | SearchSpecial.QueryConditions conditions = null; |
| | | |
| | | if (searchSpecial.getContainerList() != null) { |
| | | //按version排序 |
| | | Comparator<SearchSpecial.QueryConditionsContainer> cm = (o1, o2) -> o1.getMinVersion() - o2.getMinVersion(); |
| | | Collections.sort(searchSpecial.getContainerList(), cm); |
| | | |
| | | |
| | | for (SearchSpecial.QueryConditionsContainer container : searchSpecial.getContainerList()) { |
| | | if (acceptData.getDetailSystem().getId().equalsIgnoreCase(container.getDetailSystemId())) { |
| | | if (acceptData.getVersion() >= container.getMinVersion()) { |
| | | if (acceptData.getChannel().equalsIgnoreCase(container.getChannel())) { |
| | | conditions = container.getQueryConditions(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (conditions == null) { |
| | | for (SearchSpecial.QueryConditionsContainer container : searchSpecial.getContainerList()) { |
| | | if (acceptData.getDetailSystem().getId().equalsIgnoreCase(container.getDetailSystemId())) { |
| | | if (acceptData.getVersion() >= container.getMinVersion()) { |
| | | conditions = container.getQueryConditions(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (conditions.getAlbumQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrAlbumVideoDataManager.find(conditions.getAlbumQuery(), pageIndex, pageSize); |
| | | if (solrResultDTO != null) { |
| | | List<SolrAlbumVideo> list = solrResultDTO.getVideoList(); |
| | | if (list != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (searchSpecial.getInternetQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrInternetSearchVideoDataManager.find(searchSpecial.getInternetQuery(), Integer.parseInt(page), pageSize); |
| | | if (conditions.getInternetQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrInternetSearchVideoDataManager.find(conditions.getInternetQuery(), pageIndex, pageSize); |
| | | if (solrResultDTO != null) { |
| | | List<InternetSearchVideo> list = solrResultDTO.getVideoList(); |
| | | if (list != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (searchSpecial.getShortQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrShortVideoDataManager.find(searchSpecial.getShortQuery(), Integer.parseInt(page), pageSize); |
| | | if (conditions.getShortQuery() != null) { |
| | | SolrResultDTO solrResultDTO = solrShortVideoDataManager.find(conditions.getShortQuery(), pageIndex, pageSize); |
| | | if (solrResultDTO != null) { |
| | | List<SolrShortVideo> list = solrResultDTO.getVideoList(); |
| | | if (list != null) { |
| | |
| | | item.put("name", StringUtil.isNullOrEmpty(map.getShowName()) ? map.getSpecial().getName() : map.getShowName()); |
| | | item.put("id", map.getSpecialId()); |
| | | item.put("icon", map.getIcon()); |
| | | array.add(item); |
| | | String name = item.optString("name"); |
| | | //魅族和小米不添加 |
| | | if (("xiaomi" .equalsIgnoreCase(acceptData.getChannel())) && "hanju-video-types" .equalsIgnoreCase(pid)) { |
| | | if (name.contains("电视剧") || name.contains("电影") || name.contains("综艺") || name.contains("少儿")) { |
| | | array.add(item); |
| | | } |
| | | } else { |
| | | array.add(item); |
| | | } |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", array); |