/** * 保存投资计划的主记录信息 * * @param request * @param response * @author: Ivy * @throws IOException * @createDate: 2010-12-12 */ private void savePlanMaster(HttpServletRequest request, HttpServletResponse response) throws IOException { String rtn = "{success:"; String lsh = ""; try { String json = StringUtil.getInputStream(request.getInputStream(), Constant.ENCODING); String ITEMBEAN = PlanMaster.class.getName(); PlanMaster master = (PlanMaster) JSONObject.toBean(JSONObject.fromObject(json), Class.forName(ITEMBEAN)); String dateStr = master.getOperateTimeStr(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("GMT+8")); if (dateStr != null && !dateStr.equals("")) { master.setOperateTime(df.parse(dateStr)); } lsh = this.investmentPlanService.savePlanMaster(master); if (lsh != null) { rtn += "true,msg:'" + lsh + "'}"; } else { rtn += "false,msg:'保存失败!'}"; } } catch (Exception ex) { rtn += "false,msg:'" + ex.getMessage() + "'}"; ex.printStackTrace(); } outputStr(response, rtn); }
private void getVerifyImage(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("image/jpeg"); OutputStream out = response.getOutputStream(); int width = 46; int height = 18; int length = 4; boolean useCharacter = false; try { width = Integer.parseInt((String) request.getParameter("w")); } catch (Exception ex) { } try { height = Integer.parseInt((String) request.getParameter("h")); } catch (Exception ex) { } try { length = Integer.parseInt((String) request.getParameter("l")); } catch (Exception ex) { } try { useCharacter = Boolean.valueOf((String) request.getParameter("uc")); } catch (Exception ex) { } // System.out.println(useCharacter); List list = StringUtil.getVerifyImage(width, height, length, useCharacter); request.getSession().setAttribute("verifyCode", (String) list.get(0)); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode((BufferedImage) list.get(1)); out.close(); }
/** * 更新角色模块关系 * * @param request * @param response * @throws IOException */ private void saveRolemod(HttpServletRequest request, HttpServletResponse response) throws IOException { String msg = Constant.SUCCESS; String stackTrace = ""; int c = 0; try { String roleid = request.getParameter("roleid"); UpdateBeanInfo jab = parseJsonStr( StringUtil.getInputStream(request.getInputStream(), Constant.ENCODING), BusinessConstants.SYS_PACKAGE.concat(BusinessConstants.SYS_ROLEMOD), "uids"); this.systemMgm.saveRolemod(roleid, jab); } catch (Exception ex) { msg = getSQLErrorMsg(ex); stackTrace = getStackTrace(ex); } sendMsgResponse(msg, stackTrace, c, response); }