| | |
| | |
|
| | | if (pageId == null)
|
| | | pageId = 0L;
|
| | | List<HelpCenter> resultList = new ArrayList<>();
|
| | |
|
| | | List<HelpCenter> list = helpCenterService.listValid(pageId, pageSize, key, cid);
|
| | | if (list == null) {
|
| | |
| | | } 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<>();
|
| | |
| | | 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--);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | 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("暂无数据"));
|
| | |
| | | @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);
|
| | | }
|
| | |
|
| | | // 版本过滤
|
| | |
| | | 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<>();
|
| | |
| | | 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("操作异常"));
|