From 58577bae968f2a10232bc8b3c04910b93ea3c69a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 19 二月 2021 11:55:52 +0800 Subject: [PATCH] 系统资源配置由原有的代码形式改为数据库形式 --- src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java | 1590 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 795 insertions(+), 795 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java index b4721e7..b1813cf 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java @@ -64,924 +64,924 @@ @Controller public class WebHomeParser { - @Resource - private SystemService systemService; - @Resource - private HomeAdService homeAdService; - @Resource - private HomeTypeService homeTypeService; - @Resource - private ConfigService configService; - @Resource - private AdService adService; - @Resource - private VideoDetailUtil videoDeailUtil; - @Resource - private StatisticsService statisticsService; - @Resource - private CommentService commentService; - @Resource - private CollectionService collectionService; - @Resource - private UserService userService; - @Resource - private VideoResourceUtil videoResouceUtil; - @Resource - private MeiNvZhiBoUtil meiNvZhiBoUtil; - @Resource - private AttentionService attentionService; - @Resource - private ClassService classService; - @Resource - private VideoManager videoManager; + @Resource + private SystemService systemService; + @Resource + private HomeAdService homeAdService; + @Resource + private HomeTypeService homeTypeService; + @Resource + private ConfigService configService; + @Resource + private AdService adService; + @Resource + private VideoDetailUtil videoDeailUtil; + @Resource + private StatisticsService statisticsService; + @Resource + private CommentService commentService; + @Resource + private CollectionService collectionService; + @Resource + private UserService userService; + @Resource + private VideoResourceUtil videoResouceUtil; + @Resource + private MeiNvZhiBoUtil meiNvZhiBoUtil; + @Resource + private AttentionService attentionService; + @Resource + private ClassService classService; + @Resource + private VideoManager videoManager; - @Resource - private CategoryRecommendVideoService categoryRecommendVideoService; + @Resource + private CategoryRecommendVideoService categoryRecommendVideoService; - @Resource - private RecommendService recommendService; + @Resource + private RecommendService recommendService; - @Resource - private BanQuanService banQuanService; + @Resource + private BanQuanService banQuanService; - @Resource - private SearchService searchService; + @Resource + private SearchService searchService; - @Resource - private CategoryAreaService categoryAreaService; + @Resource + private CategoryAreaService categoryAreaService; - @Resource - private StarService starService; + @Resource + private StarService starService; - @Resource - private SpecialService specialService; + @Resource + private SpecialService specialService; - // 棣栭〉 - public void getHomePage(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + // 棣栭〉 + public void getHomePage(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - JSONObject object = new JSONObject(); + JSONObject object = new JSONObject(); - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - List<HomeAd> list = homeAdService.getHomeAdList(detailSystem); + List<HomeAd> list = homeAdService.getHomeAdList(detailSystem); - for (HomeAd ad : list) { - if (ad.getVideo() != null) { - ad.getVideo().setIntroduction(""); - ad.getVideo().setMainActor(""); - } - if (!StringUtil.isNullOrEmpty(ad.getParams())) { - ad.setParams(ad.getParams().replace("\"", "\\" + "\"")); - } - } - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); + for (HomeAd ad : list) { + if (ad.getVideo() != null) { + ad.getVideo().setIntroduction(""); + ad.getVideo().setMainActor(""); + } + if (!StringUtil.isNullOrEmpty(ad.getParams())) { + ad.setParams(ad.getParams().replace("\"", "\\" + "\"")); + } + } + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); - object.put("homeAdList", array); - object.put("homeTypeList", getHomeType(uid, platform, detailSystem.getId())); + object.put("homeAdList", array); + object.put("homeTypeList", getHomeType(uid, platform, detailSystem.getId())); - // 鎺掕 - JSONObject rank = new JSONObject(); - rank.put("tv", getRank(detailSystem.getId(), platform, "150")); - rank.put("movie", getRank(detailSystem.getId(), platform, "151")); - rank.put("show", getRank(detailSystem.getId(), platform, "152")); - rank.put("cartoon", getRank(detailSystem.getId(), platform, "153")); + // 鎺掕 + JSONObject rank = new JSONObject(); + rank.put("tv", getRank(detailSystem.getId(), platform, "150")); + rank.put("movie", getRank(detailSystem.getId(), platform, "151")); + rank.put("show", getRank(detailSystem.getId(), platform, "152")); + rank.put("cartoon", getRank(detailSystem.getId(), platform, "153")); - rank.put("entertainment", getRank(detailSystem.getId(), platform, "155")); - rank.put("live", getRank(detailSystem.getId(), platform, "157")); - rank.put("game", getRank(detailSystem.getId(), platform, "154")); - rank.put("science", getRank(detailSystem.getId(), platform, "156")); - rank.put("dance", getRank(detailSystem.getId(), platform, "274")); - rank.put("sports", getRank(detailSystem.getId(), platform, "158")); + rank.put("entertainment", getRank(detailSystem.getId(), platform, "155")); + rank.put("live", getRank(detailSystem.getId(), platform, "157")); + rank.put("game", getRank(detailSystem.getId(), platform, "154")); + rank.put("science", getRank(detailSystem.getId(), platform, "156")); + rank.put("dance", getRank(detailSystem.getId(), platform, "274")); + rank.put("sports", getRank(detailSystem.getId(), platform, "158")); - object.put("rank", rank); + object.put("rank", rank); - // 鑾峰彇homeType + // 鑾峰彇homeType - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } - // 棣栭〉绫诲瀷鑾峰彇 - private JSONArray getHomeType(String uid, String platform, String detailsystemid) { + // 棣栭〉绫诲瀷鑾峰彇 + private JSONArray getHomeType(String uid, String platform, String detailsystemid) { - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, 0); - List<HomeType> list1 = homeTypeService.getHomeType(detailsystemid, resourceList, - CacheUtil.getMD5Long(resourceList),10,309); - List<HomeType> list = new ArrayList<>(); - for (HomeType ht : list1) - list.add(ht); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(new DetailSystem("44"), 1); + List<HomeType> list1 = homeTypeService.getHomeType(detailsystemid, resourceList, + CacheUtil.getMD5Long(resourceList), 10, 309); + List<HomeType> list = new ArrayList<>(); + for (HomeType ht : list1) + list.add(ht); - JSONArray array = new JSONArray(); + JSONArray array = new JSONArray(); - for (HomeType ht : list) { - for (int i = 0; i < ht.getHomeVideoList().size(); i++) { - if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailsystemid)) { - ht.getHomeVideoList().remove(i); - i--; - } - } - } + for (HomeType ht : list) { + for (int i = 0; i < ht.getHomeVideoList().size(); i++) { + if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailsystemid)) { + ht.getHomeVideoList().remove(i); + i--; + } + } + } - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); - return array; - } + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); + return array; + } - private JSONArray getRank(String detailsystemid, String platform, String typeid) { - int count = categoryRecommendVideoService.getRankVideoNumber(Integer.parseInt(typeid)); - List<VideoInfo> list = recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid), count); + private JSONArray getRank(String detailsystemid, String platform, String typeid) { + int count = categoryRecommendVideoService.getRankVideoNumber(Integer.parseInt(typeid)); + List<VideoInfo> list = recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid), count); - list = banQuanService.getBanQuanVideo(list, detailsystemid, CacheUtil.getMD5VideoInfo(list)); - for (VideoInfo vi : list) {// 娓呴櫎鏃犵敤鏁版嵁,闃叉娴垂甯﹀ - vi.setIntroduction(""); - vi.setMainActor(""); - vi.setPicture(VideoPictureUtil.getShowPicture(vi, platform, "0")); - } - JSONObject object = new JSONObject(); - object.put("count", list.size()); - if (list.size() > 10) - list = list.subList(0, 10); + list = banQuanService.getBanQuanVideo(list, detailsystemid, CacheUtil.getMD5VideoInfo(list)); + for (VideoInfo vi : list) {// 娓呴櫎鏃犵敤鏁版嵁,闃叉娴垂甯﹀ + vi.setIntroduction(""); + vi.setMainActor(""); + vi.setPicture(VideoPictureUtil.getShowPicture(vi, platform, "0")); + } + JSONObject object = new JSONObject(); + object.put("count", list.size()); + if (list.size() > 10) + list = list.subList(0, 10); - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); - return array; - } + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); + return array; + } - public void getClass(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String version = request.getParameter("Version"); - String packageName = request.getParameter("Package"); + public void getClass(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String version = request.getParameter("Version"); + String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - List<SuperVideoType> clist = classService.getSuperVideoTypeList(detailSystem.getId()); - List<SuperVideoType> list = new ArrayList<>(); - list.addAll(clist); + List<SuperVideoType> clist = classService.getSuperVideoTypeList(detailSystem.getId()); + List<SuperVideoType> list = new ArrayList<>(); + list.addAll(clist); - List<VideoType> typelist = new ArrayList<>(); - for (SuperVideoType sv : list) { - if (!StringUtil.isNullOrEmpty(sv.getPicture())) { - sv.getType().setIcon(sv.getPicture()); - } - List<VideoType> childList = getFirstType(sv.getType().getId() + ""); - sv.getType().setChildTypeList(childList); - typelist.add(sv.getType()); - } + List<VideoType> typelist = new ArrayList<>(); + for (SuperVideoType sv : list) { + if (!StringUtil.isNullOrEmpty(sv.getPicture())) { + sv.getType().setIcon(sv.getPicture()); + } + List<VideoType> childList = getFirstType(sv.getType().getId() + ""); + sv.getType().setChildTypeList(childList); + typelist.add(sv.getType()); + } - JSONObject object = new JSONObject(); - object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); - JSONArray array = new JSONArray(); - for (int j = 0; j < typelist.size(); j++) { - JSONObject obj = JSONObject.fromObject(StringUtil.outPutResultJson(typelist.get(j))); - if (typelist.get(j).getChildTypeList() != null) { - JSONArray ca = new JSONArray(); - for (VideoType child : typelist.get(j).getChildTypeList()) { - ca.add(StringUtil.outPutResultJson(child)); - } - obj.put("ChildList", ca); - } - array.add(obj); - } - object.put("data", array); - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } + JSONObject object = new JSONObject(); + object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); + JSONArray array = new JSONArray(); + for (int j = 0; j < typelist.size(); j++) { + JSONObject obj = JSONObject.fromObject(StringUtil.outPutResultJson(typelist.get(j))); + if (typelist.get(j).getChildTypeList() != null) { + JSONArray ca = new JSONArray(); + for (VideoType child : typelist.get(j).getChildTypeList()) { + ca.add(StringUtil.outPutResultJson(child)); + } + obj.put("ChildList", ca); + } + array.add(obj); + } + object.put("data", array); + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } - public void getCategoryRecommend(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String version = request.getParameter("Version"); - String packageName = request.getParameter("Package"); - String pid = request.getParameter("Pid"); + public void getCategoryRecommend(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String version = request.getParameter("Version"); + String packageName = request.getParameter("Package"); + String pid = request.getParameter("Pid"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } - if (StringUtil.isNullOrEmpty(pid)) { - out.print(JsonUtil.loadFalseJson("Pid")); - return; - } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + if (StringUtil.isNullOrEmpty(pid)) { + out.print(JsonUtil.loadFalseJson("Pid")); + return; + } + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - JSONObject object = new JSONObject(); - object.put("banner", getCategoryRecommendBanner(detailSystem.getId(), pid)); - object.put("videos", getCategoryRecommendVideos(detailSystem.getId(), pid, platform)); + JSONObject object = new JSONObject(); + object.put("banner", getCategoryRecommendBanner(detailSystem.getId(), pid)); + object.put("videos", getCategoryRecommendVideos(detailSystem.getId(), pid, platform)); - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } - public void getTopHotStars(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); + public void getTopHotStars(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } - List<HotStar> list = starService.getHotStarList(1, 20); - JSONArray array = new JSONArray(); - for (HotStar hs : list) - array.add(StringUtil.outPutResultJson(hs)); + List<HotStar> list = starService.getHotStarList(1, 20); + JSONArray array = new JSONArray(); + for (HotStar hs : list) + array.add(StringUtil.outPutResultJson(hs)); - out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); - } + out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); + } - public void getTopTypePlayVideos(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String pid = request.getParameter("Pid"); - String packageName = request.getParameter("Package"); + public void getTopTypePlayVideos(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String pid = request.getParameter("Pid"); + String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } - if (StringUtil.isNullOrEmpty(pid)) { - out.print(JsonUtil.loadFalseJson("Pid")); - return; - } + if (StringUtil.isNullOrEmpty(pid)) { + out.print(JsonUtil.loadFalseJson("Pid")); + return; + } - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, 0); - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(new DetailSystem("44"), 1); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - List<VideoType> typeList = getFirstType(pid); - JSONArray data = new JSONArray(); - for (VideoType vt : typeList) { - List<VideoInfo> list = new ArrayList<>(); - if (StringUtil.isNullOrEmpty(vt.getCategoryType()) || "genre".equalsIgnoreCase(vt.getCategoryType())) {// 鎸夊垎绫绘绱㈡暟鎹� - Long startTime = System.currentTimeMillis(); - List<VideoInfo> list1 = classService.getTypeVideoList(vt.getId() + "", detailSystem, 1, 20, 2, - resourceList, CacheUtil.getMD5Long(resourceList)); - list = new ArrayList<>(); - if (list1 != null) - for (VideoInfo info : list1) - list.add(info); - System.out.println("鍒楄〃鑾峰彇鏃堕棿:" + (System.currentTimeMillis() - startTime)); - } else {// 鎸夊湴鍖烘绱㈡暟鎹� - String areaId = vt.getId() + "";// 鍥界睄ID - CategoryContry cc = categoryAreaService.getCategoryArea(areaId); - String country = cc.getName(); - long typeid = cc.getParent().getCid(); + List<VideoType> typeList = getFirstType(pid); + JSONArray data = new JSONArray(); + for (VideoType vt : typeList) { + List<VideoInfo> list = new ArrayList<>(); + if (StringUtil.isNullOrEmpty(vt.getCategoryType()) || "genre".equalsIgnoreCase(vt.getCategoryType())) {// 鎸夊垎绫绘绱㈡暟鎹� + Long startTime = System.currentTimeMillis(); + List<VideoInfo> list1 = classService.getTypeVideoList(vt.getId() + "", detailSystem, 1, 20, 2, + resourceList, CacheUtil.getMD5Long(resourceList)); + list = new ArrayList<>(); + if (list1 != null) + for (VideoInfo info : list1) + list.add(info); + System.out.println("鍒楄〃鑾峰彇鏃堕棿:" + (System.currentTimeMillis() - startTime)); + } else {// 鎸夊湴鍖烘绱㈡暟鎹� + String areaId = vt.getId() + "";// 鍥界睄ID + CategoryContry cc = categoryAreaService.getCategoryArea(areaId); + String country = cc.getName(); + long typeid = cc.getParent().getCid(); - list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, 1, 20, 2, resourceList, - country, StringUtil.Md5(typeid + "-" + detailSystem + "-" + 1 + "-" + 2 + "-" + country + "-" - + CacheUtil.getMD5Long(resourceList))); - } - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - list.get(i).setPicture(VideoPictureUtil.getShowPicture(list.get(i), platform, 33 + "")); - array.add(StringUtil.outPutResultJson(list.get(i))); - } - data.add(array); - } - out.print(JsonUtil.loadTrueJsonNoencript(data.toString())); - } + list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, 1, 20, 2, resourceList, + country, StringUtil.Md5(typeid + "-" + detailSystem + "-" + 1 + "-" + 2 + "-" + country + "-" + + CacheUtil.getMD5Long(resourceList))); + } + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) { + list.get(i).setPicture(VideoPictureUtil.getShowPicture(list.get(i), platform, 33 + "")); + array.add(StringUtil.outPutResultJson(list.get(i))); + } + data.add(array); + } + out.print(JsonUtil.loadTrueJsonNoencript(data.toString())); + } - public void getHotStarList(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); + public void getHotStarList(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } - List<HotStar> list = starService.getHotStarList(1, 100); - JSONArray array = new JSONArray(); - for (HotStar hs : list) - array.add(StringUtil.outPutResultJson(hs)); + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } + List<HotStar> list = starService.getHotStarList(1, 100); + JSONArray array = new JSONArray(); + for (HotStar hs : list) + array.add(StringUtil.outPutResultJson(hs)); - out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); - } + out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); + } - public void getSpecialList(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); + public void getSpecialList(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("Uid")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("System")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("Sign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("Platform")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("Uid")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("System")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("Sign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("Platform")); + return; + } - DetailSystem ds = systemService.getDetailSystemByPackage(packageName); + DetailSystem ds = systemService.getDetailSystemByPackage(packageName); - List<Special> list = specialService.getSpecialList(ds.getId()); - JSONArray array = new JSONArray(); - for (Special s : list) - array.add(StringUtil.outPutResultJson(s)); + List<Special> list = specialService.getSpecialList(ds.getId()); + JSONArray array = new JSONArray(); + for (Special s : list) + array.add(StringUtil.outPutResultJson(s)); - out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); - } + out.print(JsonUtil.loadTrueJsonNoencript(array.toString())); + } - private JSONArray getCategoryRecommendBanner(String detailsystemid, String typeid) { - List<CategoryRecommendVideo> crvList = categoryRecommendVideoService - .getCategoryRecommendVideoBannerList(detailsystemid, Integer.parseInt(typeid)); - JSONArray array = new JSONArray(); - for (int i = 0; i < crvList.size(); i++) - array.add(StringUtil.outPutResultJson(crvList.get(i))); - return array; - } + private JSONArray getCategoryRecommendBanner(String detailsystemid, String typeid) { + List<CategoryRecommendVideo> crvList = categoryRecommendVideoService + .getCategoryRecommendVideoBannerList(detailsystemid, Integer.parseInt(typeid)); + JSONArray array = new JSONArray(); + for (int i = 0; i < crvList.size(); i++) + array.add(StringUtil.outPutResultJson(crvList.get(i))); + return array; + } - private JSONArray getCategoryRecommendVideos(String detailsystemid, String typeid, String platform) { - List<VideoInfo> list = recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid), 10); + private JSONArray getCategoryRecommendVideos(String detailsystemid, String typeid, String platform) { + List<VideoInfo> list = recommendService.getCategoryRecommendVideoList(Integer.parseInt(typeid), 10); - list = banQuanService.getBanQuanVideo(list, detailsystemid, CacheUtil.getMD5VideoInfo(list)); - for (VideoInfo vi : list) {// 娓呴櫎鏃犵敤鏁版嵁,闃叉娴垂甯﹀ - vi.setIntroduction(""); - vi.setMainActor(""); - vi.setPicture(VideoPictureUtil.getShowPicture(vi, platform, 0 + "")); - } + list = banQuanService.getBanQuanVideo(list, detailsystemid, CacheUtil.getMD5VideoInfo(list)); + for (VideoInfo vi : list) {// 娓呴櫎鏃犵敤鏁版嵁,闃叉娴垂甯﹀ + vi.setIntroduction(""); + vi.setMainActor(""); + vi.setPicture(VideoPictureUtil.getShowPicture(vi, platform, 0 + "")); + } - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); - return array; - } + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); + return array; + } - private List<VideoType> getFirstType(String parentId) { - List<VideoType> list = new ArrayList<>(); + private List<VideoType> getFirstType(String parentId) { + List<VideoType> list = new ArrayList<>(); - if ("150".equalsIgnoreCase(parentId) || "151".equalsIgnoreCase(parentId) || "152".equalsIgnoreCase(parentId) - || "153".equalsIgnoreCase(parentId)) { + if ("150".equalsIgnoreCase(parentId) || "151".equalsIgnoreCase(parentId) || "152".equalsIgnoreCase(parentId) + || "153".equalsIgnoreCase(parentId)) { - List<CategoryContry> clist = categoryAreaService.getCategoryContryListByCid(parentId); + List<CategoryContry> clist = categoryAreaService.getCategoryContryListByCid(parentId); - List<CategoryContry> areaList = categoryAreaService.categoryContryList(clist.get(0).getId() + ""); + List<CategoryContry> areaList = categoryAreaService.categoryContryList(clist.get(0).getId() + ""); - if ("150".equalsIgnoreCase(parentId)) { - VideoType vt = classService.getType(282); - vt.setParent(null); - vt.setCategoryType("genre"); - list.add(vt); - } else if ("151".equalsIgnoreCase(parentId)) { - VideoType vt = classService.getType(281); - vt.setParent(null); - vt.setCategoryType("genre"); - list.add(vt); - } else if ("153".equalsIgnoreCase(parentId)) { - VideoType vt = classService.getType(283); - vt.setParent(null); - vt.setCategoryType("genre"); - list.add(vt); - } + if ("150".equalsIgnoreCase(parentId)) { + VideoType vt = classService.getType(282); + vt.setParent(null); + vt.setCategoryType("genre"); + list.add(vt); + } else if ("151".equalsIgnoreCase(parentId)) { + VideoType vt = classService.getType(281); + vt.setParent(null); + vt.setCategoryType("genre"); + list.add(vt); + } else if ("153".equalsIgnoreCase(parentId)) { + VideoType vt = classService.getType(283); + vt.setParent(null); + vt.setCategoryType("genre"); + list.add(vt); + } - for (CategoryContry cc : areaList) { - VideoType type = new VideoType(cc.getId()); - type.setName(cc.getName()); - type.setShow("1"); - type.setCategoryType("area"); - list.add(type); - } + for (CategoryContry cc : areaList) { + VideoType type = new VideoType(cc.getId()); + type.setName(cc.getName()); + type.setShow("1"); + type.setCategoryType("area"); + list.add(type); + } - } else { - List<VideoType> clist = classService.getFirstTypeList(parentId); - list = new ArrayList<>(); - if (clist != null) - for (VideoType vt : clist) { - vt.setCategoryType("genre"); - list.add(vt); - } - } - return list; - } + } else { + List<VideoType> clist = classService.getFirstTypeList(parentId); + list = new ArrayList<>(); + if (clist != null) + for (VideoType vt : clist) { + vt.setCategoryType("genre"); + list.add(vt); + } + } + return list; + } - public void getHotSearch(String uid, HttpServletRequest request, PrintWriter out) { - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); + public void getHotSearch(String uid, HttpServletRequest request, PrintWriter out) { + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - List<String> list = searchService.getHotSearchList(detailSystem.getId()); - JSONObject object = new JSONObject(); - object.put("count", list.size() + ""); - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - array.add(StringUtil.outPutResultJson(list.get(i))); - } + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + List<String> list = searchService.getHotSearchList(detailSystem.getId()); + JSONObject object = new JSONObject(); + object.put("count", list.size() + ""); + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) { + array.add(StringUtil.outPutResultJson(list.get(i))); + } - object.put("data", array); - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } + object.put("data", array); + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } - public HomeType convertHomeVideoList(HomeType type) { - List<VideoInfo> vlist = new ArrayList<>(); - List<HomeVideo> list = type.getHomeVideoList(); - if (list != null) - for (HomeVideo hv : list) { - vlist.add(hv.getVideo()); - } - type.setVideoList(vlist); - return type; - } + public HomeType convertHomeVideoList(HomeType type) { + List<VideoInfo> vlist = new ArrayList<>(); + List<HomeVideo> list = type.getHomeVideoList(); + if (list != null) + for (HomeVideo hv : list) { + vlist.add(hv.getVideo()); + } + type.setVideoList(vlist); + return type; + } - public void getMoreVideo(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); + public void getMoreVideo(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); - String type = request.getParameter("Type"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String page = request.getParameter("Page"); - String platform = request.getParameter("Platform"); - String version = request.getParameter("Version"); - String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(page)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩age")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + String type = request.getParameter("Type"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String page = request.getParameter("Page"); + String platform = request.getParameter("Platform"); + String version = request.getParameter("Version"); + String packageName = request.getParameter("Package"); + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(page)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩age")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - int pageIndex = 0; - try { - pageIndex = Integer.parseInt(page); - } catch (Exception e) { - out.print(JsonUtil.loadFalseJson("Page\u683C\u5F0F\u6709\u8BEF")); - return; - } + int pageIndex = 0; + try { + pageIndex = Integer.parseInt(page); + } catch (Exception e) { + out.print(JsonUtil.loadFalseJson("Page\u683C\u5F0F\u6709\u8BEF")); + return; + } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - UserInfo user = userService.getUserInfo(uid); - if (Utils.isTest(request, user, detailSystem.getId())) - detailSystem = systemService.getDetailSystemById(40 + ""); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + UserInfo user = userService.getUserInfo(uid); + if (Utils.isTest(request, user, detailSystem.getId())) + detailSystem = systemService.getDetailSystemById(40 + ""); - List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(type, pageIndex, detailSystem); + List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(type, pageIndex, detailSystem); - List<VideoInfo> list = new ArrayList<>(); - for (int i = 0; i < homeVideoList.size(); i++) { - HomeVideo hv = (HomeVideo) homeVideoList.get(i); - if (detailSystem.getPackageName().contains("doudou")) { - if (!StringUtil.isNullOrEmpty(hv.getPicture())) - hv.getVideo().setPicture(hv.getPicture()); - } - list.add(hv.getVideo()); - } + List<VideoInfo> list = new ArrayList<>(); + for (int i = 0; i < homeVideoList.size(); i++) { + HomeVideo hv = (HomeVideo) homeVideoList.get(i); + if (detailSystem.getPackageName().contains("doudou")) { + if (!StringUtil.isNullOrEmpty(hv.getPicture())) + hv.getVideo().setPicture(hv.getPicture()); + } + list.add(hv.getVideo()); + } - JSONObject object = new JSONObject(); - object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); - JSONArray array = new JSONArray(); - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); + JSONObject object = new JSONObject(); + object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); + JSONArray array = new JSONArray(); + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); - object.put("data", array); - object.put("Column", 2); - out.print(JsonUtil.loadTrueJson(object.toString())); + object.put("data", array); + object.put("Column", 2); + out.print(JsonUtil.loadTrueJson(object.toString())); - } + } - public void getAdList(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); + public void getAdList(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - List<RecommendAd> list = adService.getRecommendAdList(detailSystem.getId()); - if (list == null) - list = new ArrayList<>(); - JSONObject object = new JSONObject(); + List<RecommendAd> list = adService.getRecommendAdList(detailSystem.getId()); + if (list == null) + list = new ArrayList<>(); + JSONObject object = new JSONObject(); - JSONArray array = new JSONArray(); + JSONArray array = new JSONArray(); - object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); - for (int i = 0; i < list.size(); i++) - array.add(StringUtil.outPutResultJson(list.get(i))); + object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); + for (int i = 0; i < list.size(); i++) + array.add(StringUtil.outPutResultJson(list.get(i))); - object.put("data", array); - out.print(JsonUtil.loadTrueJson(object.toString())); - } + object.put("data", array); + out.print(JsonUtil.loadTrueJson(object.toString())); + } - public void getVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); + public void getVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String videoId = request.getParameter("VideoId"); - String resourceId = request.getParameter("ResourceId"); - String thirdType = request.getParameter("Type"); - String platform = request.getParameter("Platform"); - String version = request.getParameter("Version"); - String packageName = request.getParameter("Package"); - String loginUid = request.getParameter("LoginUid"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(videoId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } - if (StringUtil.isNullOrEmpty(thirdType)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燭ype")); - return; - } + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String videoId = request.getParameter("VideoId"); + String resourceId = request.getParameter("ResourceId"); + String thirdType = request.getParameter("Type"); + String platform = request.getParameter("Platform"); + String version = request.getParameter("Version"); + String packageName = request.getParameter("Package"); + String loginUid = request.getParameter("LoginUid"); + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(videoId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } + if (StringUtil.isNullOrEmpty(thirdType)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燭ype")); + return; + } - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, Integer.parseInt(version)); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(new DetailSystem("44"), Integer.parseInt(version)); - VideoInfo info = (videoDeailUtil.getVideoInfo(null,videoId, resourceId, resourceList, - CacheUtil.getMD5Long(resourceList))); + VideoInfo info = (videoDeailUtil.getVideoInfo(null, videoId, resourceId, resourceList, + CacheUtil.getMD5Long(resourceList))); - List<VideoType> typeList = classService.getVideoTypeList(info.getId()); - if (typeList != null && typeList.size() > 0) { - VideoType type = typeList.get(0); - while (type.getParent() != null) - type = type.getParent(); - info.setVideoType(type); - } + List<VideoType> typeList = classService.getVideoTypeList(info.getId()); + if (typeList != null && typeList.size() > 0) { + VideoType type = typeList.get(0); + while (type.getParent() != null) + type = type.getParent(); + info.setVideoType(type); + } - info.setPlayPicture(VideoPictureUtil.getShowPicture(info, platform, version)); + info.setPlayPicture(VideoPictureUtil.getShowPicture(info, platform, version)); - for (VideoDetailInfo vd : info.getVideoDetailList()) { - if (StringUtil.isNullOrEmpty(vd.getExtraId())) - vd.setExtraId(vd.getId() + ""); - } - System.out.println(info.getPlayPicture()); - // info.setPicture(VideoPictureUtil.getShowPicture(info, platform, - // version)); + for (VideoDetailInfo vd : info.getVideoDetailList()) { + if (StringUtil.isNullOrEmpty(vd.getExtraId())) + vd.setExtraId(vd.getId() + ""); + } + System.out.println(info.getPlayPicture()); + // info.setPicture(VideoPictureUtil.getShowPicture(info, platform, + // version)); - // 杩囨护鐗堟潈瑙嗛鍏抽敭瀛� - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - // 缁熻娣诲姞 - // statisticsService.addStatistics(detailSystem.getId(), videoId); + // 杩囨护鐗堟潈瑙嗛鍏抽敭瀛� + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + // 缁熻娣诲姞 + // statisticsService.addStatistics(detailSystem.getId(), videoId); - JSONArray array = new JSONArray(); - array.add("http://cloud.letv.com"); - if ((platform.equalsIgnoreCase("android") && !StringUtil.isNullOrEmpty(version) - && Integer.parseInt(version) > 12) || platform.equalsIgnoreCase("ios")) { - for (String st : Constant.POJIE_LIST) - array.add(st); - } + JSONArray array = new JSONArray(); + array.add("http://cloud.letv.com"); + if ((platform.equalsIgnoreCase("android") && !StringUtil.isNullOrEmpty(version) + && Integer.parseInt(version) > 12) || platform.equalsIgnoreCase("ios")) { + for (String st : Constant.POJIE_LIST) + array.add(st); + } - long count = commentService.getComment2ListCount(videoId, thirdType); - if (info != null) - info.setCommentCount((int) count); + long count = commentService.getComment2ListCount(videoId, thirdType); + if (info != null) + info.setCommentCount((int) count); - JSONObject obj = new JSONObject(); - if (info.getVideoDetailList().size() > 1) {// 澶氶泦,鍙叧娉� - boolean isAttention = false; - if (!StringUtil.isNullOrEmpty(loginUid)) { - isAttention = attentionService.isAddAttention(loginUid, info.getId()); - } - JSONObject attentionInfo = new JSONObject(); - attentionInfo.put("Name", info.getName()); - attentionInfo.put("Picture", info.getPicture()); - attentionInfo.put("UpdateInfo", "鏇存柊:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); - attentionInfo.put("IsAttention", isAttention); - obj.put("Attention", attentionInfo); - } - UserInfo user = userService.getUserInfo(uid); - if (Utils.isTest(request, user, detailSystem.getId())) - out.print(JsonUtil.loadTrueJson("")); - else - out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), - obj.toString())); - } + JSONObject obj = new JSONObject(); + if (info.getVideoDetailList().size() > 1) {// 澶氶泦,鍙叧娉� + boolean isAttention = false; + if (!StringUtil.isNullOrEmpty(loginUid)) { + isAttention = attentionService.isAddAttention(loginUid, info.getId()); + } + JSONObject attentionInfo = new JSONObject(); + attentionInfo.put("Name", info.getName()); + attentionInfo.put("Picture", info.getPicture()); + attentionInfo.put("UpdateInfo", "鏇存柊:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); + attentionInfo.put("IsAttention", isAttention); + obj.put("Attention", attentionInfo); + } + UserInfo user = userService.getUserInfo(uid); + if (Utils.isTest(request, user, detailSystem.getId())) + out.print(JsonUtil.loadTrueJson("")); + else + out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), + obj.toString())); + } - public void getNewVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { - getVideoDetail(uid, request, out); - } + public void getNewVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { + getVideoDetail(uid, request, out); + } - public void isCollected(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); + public void isCollected(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String detailId = request.getParameter("Id"); - String platform = request.getParameter("Platform"); - String thirdType = request.getParameter("ThirdType"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(detailId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼營d")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String detailId = request.getParameter("Id"); + String platform = request.getParameter("Platform"); + String thirdType = request.getParameter("ThirdType"); + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(detailId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼營d")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - boolean collect = collectionService.isCollect(uid, detailId, thirdType); - if (collect) - out.print(JsonUtil.loadTrueJson("")); - else - out.print(JsonUtil.loadFalseJson("")); + boolean collect = collectionService.isCollect(uid, detailId, thirdType); + if (collect) + out.print(JsonUtil.loadTrueJson("")); + else + out.print(JsonUtil.loadFalseJson("")); - } + } - public void getPlayUrl(String uid, HttpServletRequest request, PrintWriter out) { + public void getPlayUrl(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); + String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String version = request.getParameter("Version"); - String resourceId = request.getParameter("ResourceId"); - String id = request.getParameter("Id"); - String eid = request.getParameter("EId"); - String type = request.getParameter("Type"); - String packageName = request.getParameter("Package"); - String videoId = request.getParameter("VideoId"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String version = request.getParameter("Version"); + String resourceId = request.getParameter("ResourceId"); + String id = request.getParameter("Id"); + String eid = request.getParameter("EId"); + String type = request.getParameter("Type"); + String packageName = request.getParameter("Package"); + String videoId = request.getParameter("VideoId"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(resourceId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燫esourceId")); - return; - } + if (StringUtil.isNullOrEmpty(resourceId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燫esourceId")); + return; + } - if (StringUtil.isNullOrEmpty(id) && StringUtil.isNullOrEmpty(eid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼爄d")); - return; - } + if (StringUtil.isNullOrEmpty(id) && StringUtil.isNullOrEmpty(eid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼爄d")); + return; + } - if (StringUtil.isNullOrEmpty(type)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼爐ype")); - return; - } + if (StringUtil.isNullOrEmpty(type)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼爐ype")); + return; + } - if (StringUtil.isNullOrEmpty(id)) - id = eid; + if (StringUtil.isNullOrEmpty(id)) + id = eid; - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); - if (pu != null) { - if (!StringUtil.isNullOrEmpty(pu.getUrl())) - pu.setUrl(pu.getUrl()); - JSONObject object = JSONObject.fromObject(StringUtil.outPutResultJson(pu)); - out.print(JsonUtil.loadTrueJson(object.toString())); - } else { - out.print(JsonUtil.loadFalseJson("鎵句笉鍒拌瑙嗛")); - } + if (pu != null) { + if (!StringUtil.isNullOrEmpty(pu.getUrl())) + pu.setUrl(pu.getUrl()); + JSONObject object = JSONObject.fromObject(StringUtil.outPutResultJson(pu)); + out.print(JsonUtil.loadTrueJson(object.toString())); + } else { + out.print(JsonUtil.loadFalseJson("鎵句笉鍒拌瑙嗛")); + } - } + } - public List<HomeVideo> getZhiBoVideoList() throws Exception { - List<HomeVideo> list = new ArrayList<>(); - String result = get("http://www.kktv1.com/CDN/output/M/3/I/10002002/P/start-0_offset-6_platform-2/json.js"); - JSONObject object = JSONObject.fromObject(result); - JSONArray array = object.optJSONArray("roomList"); - for (int i = 0; i < array.size(); i++) { - VideoInfo info = new VideoInfo(); - JSONObject obj = array.optJSONObject(i); - info.setId(obj.optString("roomId")); - info.setName(obj.optString("nickname")); - info.setTag("鍦ㄧ嚎:" + obj.optString("onlineCount")); - info.setPicture(obj.optString("poster_path_272")); - HomeVideo hv = new HomeVideo(); - hv.setPicture(info.getPicture()); - hv.setVideo(info); - list.add(hv); - } - return list; - } + public List<HomeVideo> getZhiBoVideoList() throws Exception { + List<HomeVideo> list = new ArrayList<>(); + String result = get("http://www.kktv1.com/CDN/output/M/3/I/10002002/P/start-0_offset-6_platform-2/json.js"); + JSONObject object = JSONObject.fromObject(result); + JSONArray array = object.optJSONArray("roomList"); + for (int i = 0; i < array.size(); i++) { + VideoInfo info = new VideoInfo(); + JSONObject obj = array.optJSONObject(i); + info.setId(obj.optString("roomId")); + info.setName(obj.optString("nickname")); + info.setTag("鍦ㄧ嚎:" + obj.optString("onlineCount")); + info.setPicture(obj.optString("poster_path_272")); + HomeVideo hv = new HomeVideo(); + hv.setPicture(info.getPicture()); + hv.setVideo(info); + list.add(hv); + } + return list; + } - public String get(String url) { + public String get(String url) { - HttpClient client = new HttpClient(); - GetMethod method = new GetMethod(url); - method.getParams().setContentCharset("UTF-8"); - try { - client.executeMethod(method); - String responseBodyAsString = method.getResponseBodyAsString(); - // LogUtil.i(responseBodyAsString); - return responseBodyAsString; - } catch (HttpException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return ""; - } + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(url); + method.getParams().setContentCharset("UTF-8"); + try { + client.executeMethod(method); + String responseBodyAsString = method.getResponseBodyAsString(); + // LogUtil.i(responseBodyAsString); + return responseBodyAsString; + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return ""; + } } -- Gitblit v1.8.0