// 添加 @RequestMapping(value = "/addfwjdBean", method = RequestMethod.POST) public void addfwjd(HttpServletRequest request, PrintWriter out, HttpSession session) { try { Operator sessionOperator = (Operator) session.getAttribute("obj_login_operator"); fwjd fwjd = new fwjd(); // 编号 String fwjdbh = request.getParameter("fwjdbh"); fwjd.setFwjdbh(fwjdbh); // 名称 String fwjdmc = request.getParameter("fwjdmc"); fwjd.setFwjdmc(fwjdmc); // 状态 String fwjdzt = request.getParameter("fwjdzt"); Long fwjdzt1 = Long.parseLong(fwjdzt); fwjd.setFwjdzt(fwjdzt1); // 备注 String fwjdbz = request.getParameter("fwjdbz"); fwjd.setFwjdbz(fwjdbz); dailyLog.LogInfomation( sessionOperator.getEmployeeId(), sessionOperator.getOperatorId(), "服务阶段", "3"); fwjdService.addfwjd(fwjd); out.println("{success:true}"); } catch (Exception e) { e.printStackTrace(); } out.close(); }
@RequestMapping(value = "/jsonListfwjd", method = RequestMethod.POST) public void jsonList( PrintWriter out, HttpServletResponse response, HttpServletRequest request, HttpSession session, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "rows", required = false) Integer size) { Operator sessionOperator = (Operator) session.getAttribute("obj_login_operator"); fwjd fwjd = new fwjd(); Integer iSizeNo = size == null ? 10 : size.intValue(); Integer iPageNo = 0; page = page == null ? 0 : page; if (page > 0) { iPageNo = page; } String strJson = "{\"total\":\"0\",\"rows\":[]}"; try { String strQuerySel = request.getParameter("sys_fwjd_serch_roleType") == null ? "" : request.getParameter("sys_fwjd_serch_roleType").toString(); String strQueryKey = request.getParameter("sys_fwjd_serch_roleCondition") == null ? "" : request.getParameter("sys_fwjd_serch_roleCondition").toString(); if ("1".equals(strQuerySel.trim())) { fwjd.setFwjdmc(strQueryKey); } if ("2".equals(strQuerySel.trim())) { fwjd.setFwjdbh(strQueryKey); } List<Object[]> lstDaily = fwjdService.fwjdfindfwjdByCondition(fwjd, iPageNo, iSizeNo); Long totalCount = fwjdService.countfwjdByCondition(fwjd); List<Map<String, Object>> lstMap = new ArrayList<Map<String, Object>>(); if (null != lstDaily && lstDaily.size() > 0) { for (Object[] obj : lstDaily) { Map<String, Object> map = new HashMap<String, Object>(); // 服务id map.put("fwjdid", obj[0]); // 服务编号 map.put("fwjdbh", obj[1]); // 服务名称 map.put("fwjdmc", obj[2]); // 服务状态 map.put("fwjdzt", obj[3]); // 备注 map.put("fwjdbz", obj[4]); lstMap.add(map); } response.setContentType("text/json; charset=utf-8"); response.setCharacterEncoding("UTF-8"); String json = JSONUtils.toJson(lstMap); strJson = "{\"total\":\"" + totalCount + "\",\"rows\":" + json + "}"; if ("4".equals(strQuerySel.trim())) { strJson = json; } } out.println(strJson); } catch (Exception e) { e.printStackTrace(); } out.close(); dailyLog.LogInfomation( sessionOperator.getEmployeeId(), sessionOperator.getOperatorId(), "服务阶段", "6"); System.out.println(strJson); }