From 2d538eff0cfe0eadff3cb9d9c1db9e45f6109ab1 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 03 一月 2020 17:25:56 +0800 Subject: [PATCH] 帮助中心版本区分 --- fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java | 34 +++++++++++++++++++++------------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java b/fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java index eea312b..e9100bb 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/apph5/AppH5HelpCenterController.java @@ -67,6 +67,7 @@ if (pageId == null) pageId = 0L; + List<HelpCenter> resultList = new ArrayList<>(); List<HelpCenter> list = helpCenterService.listValid(pageId, pageSize, key, cid); if (list == null) { @@ -75,17 +76,20 @@ } else if (list.size() == 0) { pageId = 0L; } else { - pageId = list.get(list.size()-1).getId(); + // 娣诲姞鍒楄〃 + resultList.addAll(list); + + pageId = resultList.get(resultList.size()-1).getId(); // 鐗堟湰杩囨护 int version = Integer.parseInt(acceptData.getVersion()); String platform = acceptData.getPlatform().toLowerCase(); List<AppVersionInfo> versionList = appVersionService.listByPlatformAndMinVersionCode(platform,version); if (versionList == null || versionList.size() <= 0) { - list.clear(); + resultList.clear(); } else { List<Long> sourceIdList = new ArrayList<>(); - for (HelpCenter record : list) { + for (HelpCenter record : resultList) { sourceIdList.add(record.getId()); } List<Long> versionIdList = new ArrayList<>(); @@ -94,9 +98,9 @@ Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList, AdActivityType.helpCenter, versionIdList); - for (int i = 0; i < list.size(); i++) { - if (!sets.contains(list.get(i).getId())) { - list.remove(i--); + for (int i = 0; i < resultList.size(); i++) { + if (!sets.contains(resultList.get(i).getId())) { + resultList.remove(i--); } } } @@ -104,7 +108,7 @@ JSONObject data = new JSONObject(); data.put("pageId", pageId); - data.put("result_list", JsonUtil.getApiCommonGson().toJson(list)); + data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); @@ -158,9 +162,13 @@ @RequestMapping(value = "getClass") public void getClass(String callback, AcceptData acceptData, PrintWriter out) { try { + List<HelpClass> resultList = new ArrayList<>(); + List<HelpClass> list = helpClassService.getClassByState(1); if (list == null || list.size() == 0) { list = new ArrayList<>(); + } else { + resultList.addAll(list); } // 鐗堟湰杩囨护 @@ -168,10 +176,10 @@ String platform = acceptData.getPlatform().toLowerCase(); List<AppVersionInfo> versionList = appVersionService.listByPlatformAndMinVersionCode(platform,version); if (versionList == null || versionList.size() <= 0) { - list.clear(); + resultList.clear(); } else { List<Long> sourceIdList = new ArrayList<>(); - for (HelpClass record : list) { + for (HelpClass record : resultList) { sourceIdList.add(record.getId()); } List<Long> versionIdList = new ArrayList<>(); @@ -180,15 +188,15 @@ Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList, AdActivityType.helpClass, versionIdList); - for (int i = 0; i < list.size(); i++) { - if (!sets.contains(list.get(i).getId())) { - list.remove(i--); + for (int i = 0; i < resultList.size(); i++) { + if (!sets.contains(resultList.get(i).getId())) { + resultList.remove(i--); } } } JSONObject data = new JSONObject(); - data.put("class_list", JsonUtil.getApiCommonGson().toJson(list)); + data.put("class_list", JsonUtil.getApiCommonGson().toJson(resultList)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); -- Gitblit v1.8.0