/** * 根据Id获取成功故事详情 * * @return * @throws SQLException * @throws DataException * @throws IOException */ public String frontQuerySuccessStoryById() throws SQLException, DataException, IOException { Map<String, Object> jsonMap = new HashMap<String, Object>(); try { Map<String, String> infoMap = this.getAppInfoMap(); Long id = Convert.strToLong(infoMap.get("id"), -1); // 上一条 // previousDate=successStoryService.getSuccessStoryById(id-1); previousDate = publicModelService.getSuccessStoryById(id - 1); // 下一条 // lastDate=successStoryService.getSuccessStoryById(id+1); lastDate = publicModelService.getSuccessStoryById(id + 1); // paramMap=successStoryService.getSuccessStoryById(id); paramMap = publicModelService.getSuccessStoryById(id); // 浏览次数增加 // successStoryService.updateSuccessStory(id, null, null, null, null, null, // Convert.strToLong(paramMap.get("browseNum"),-1)+1, null); publicModelService.updateSuccessStory( id, null, null, null, null, null, Convert.strToLong(paramMap.get("browseNum"), -1) + 1, null); jsonMap.put("previousDate", previousDate); jsonMap.put("lastDate", lastDate); jsonMap.put("paramMap", paramMap); jsonMap.put("error", "-1"); jsonMap.put("msg", "成功"); JSONUtils.printObject(jsonMap); } catch (Exception e) { log.error(e); e.printStackTrace(); jsonMap.put("msg", "1"); jsonMap.put("msg", "未知异常"); JSONUtils.printObject(jsonMap); } return null; }
/** * 分页显示成功故事列表 * * @return * @throws SQLException * @throws DataException * @throws IOException */ public String frontQuerySuccessStoryListPage() throws SQLException, DataException, IOException { Map<String, Object> jsonMap = new HashMap<String, Object>(); try { // successStoryService.querySuccessStoryPage(pageBean); publicModelService.querySuccessStoryPage(pageBean); jsonMap.put("pageBean", pageBean); jsonMap.put("error", "-1"); jsonMap.put("msg", "成功"); JSONUtils.printObject(jsonMap); } catch (Exception e) { log.error(e); e.printStackTrace(); jsonMap.put("msg", "1"); jsonMap.put("msg", "未知异常"); JSONUtils.printObject(jsonMap); } return null; }
/** * 查询网站成功故事列表(每次显示二条) * * @return String * @throws SQLException * @throws DataException * @throws IOException * @throws UnsupportedEncodingException */ @SuppressWarnings("unchecked") public String frontQuerySuccessStoryList() throws SQLException, DataException, IOException { Map<String, Object> jsonMap = new HashMap<String, Object>(); try { List<Map<String, Object>> newsList = new ArrayList<Map<String, Object>>(); pageBean.setPageSize(2); // successStoryService.querySuccessStoryPage(pageBean); publicModelService.querySuccessStoryPage(pageBean); newsList = pageBean.getPage(); pageBean.setPage(null); // request().setAttribute("storyList", newsList); jsonMap.put("newsList", newsList); jsonMap.put("error", "-1"); jsonMap.put("msg", "成功"); JSONUtils.printObject(jsonMap); } catch (Exception e) { log.error(e); e.printStackTrace(); jsonMap.put("msg", "1"); jsonMap.put("msg", "未知异常"); JSONUtils.printObject(jsonMap); } return null; }