/** * 修改当前登录用户信息 * * @param * @return */ public ActionForward updateUserInfo( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm cForm = (CommonActionForm) form; UserInfoVo userInfoVo = getSessionContainer(request).getUserInfo(); UserService service = (UserService) getService("userService"); Dto indDto = cForm.getParamAsDto(request); Dto outDto = new BaseDto(G4Constants.TRUE); outDto.put("flag", G4Constants.SUCCESS); String password = G4Utils.encryptBasedDes(indDto.getAsString("password2")); if (password.equals(userInfoVo.getPassword())) { service.updateUserItem4IndexPage(indDto); outDto.put("flag", G4Constants.SUCCESS); userInfoVo.setPassword(G4Utils.encryptBasedDes(indDto.getAsString("password1"))); getSessionContainer(request).setUserInfo(userInfoVo); } else { outDto.setSuccess(G4Constants.FALSE); outDto.put("flag", G4Constants.FAILURE); } write(outDto.toJson(), response); return mapping.findForward(null); }
/** * 保存参数信息 * * @param * @return */ public ActionForward saveParamItem( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm aForm = (CommonActionForm) form; Dto inDto = aForm.getParamAsDto(request); paramService.saveParamItem(inDto); setOkTipMsg("参数数据新增成功", response); return mapping.findForward(null); }
/** * 查询表格数据 * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward queryXsyjDatas( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm aForm = (CommonActionForm) form; Dto dto = aForm.getParamAsDto(request); List list = g4Reader.queryForPage("Demo.getFcfDataList", dto); String jsonString = JsonHelper.encodeList2PageJson(list, new Integer(12), G4Constants.FORMAT_Date); super.write(jsonString, response); return mapping.findForward(null); }
/** * 查询参数列表 * * @param * @return */ public ActionForward queryParamsForManage( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm aForm = (CommonActionForm) form; Dto dto = aForm.getParamAsDto(request); List paramList = g4Reader.queryForPage("Param.queryParamsForManage", dto); Integer pageCount = (Integer) g4Reader.queryForObject("Param.queryParamsForManageForPageCount", dto); String jsonString = JsonHelper.encodeList2PageJson(paramList, pageCount, null); write(jsonString, response); return mapping.findForward(null); }
/** * 修改参数信息 * * @param * @return */ public ActionForward updateParamItem( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm aForm = (CommonActionForm) form; Dto inDto = aForm.getParamAsDto(request); paramService.updateParamItem(inDto); Dto outDto = new BaseDto(); outDto.put("success", new Boolean(true)); outDto.put("msg", "参数数据修改成功!"); write(outDto.toJson(), response); return mapping.findForward(null); }
/** * 解锁系统 * * @param * @return */ public ActionForward unlockSystem( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm cForm = (CommonActionForm) form; UserInfoVo userInfoVo = getSessionContainer(request).getUserInfo(); Dto indDto = cForm.getParamAsDto(request); String password = G4Utils.encryptBasedDes(indDto.getAsString("password")); Dto outDto = new BaseDto(G4Constants.TRUE); if (password.equals(userInfoVo.getPassword())) { outDto.put("flag", G4Constants.SUCCESS); } else { outDto.put("flag", G4Constants.FAILURE); } write(outDto.toJson(), response); return mapping.findForward(null); }
/** * 查询数据报表XML格式串 * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward queryReportXmlDatas( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CommonActionForm aForm = (CommonActionForm) form; Dto dto = aForm.getParamAsDto(request); String product = "(产品一)"; if (dto.getAsString("product").equals("2")) { product = "(产品二)"; } List list = g4Reader.queryForList("Demo.getFcfDataList", dto); // 实例化一个图形配置对象 GraphConfig graphConfig = new GraphConfig(); // 主标题 graphConfig.setCaption("Google软件2010年月度销售业绩图表" + product); // X坐标轴名称 graphConfig.setXAxisName("月度"); // 数字值前缀 graphConfig.setNumberPrefix("$"); // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《G4Studio开发指南》的相关章节 // graphConfig.put("propertyName", "value"); List dataList = new ArrayList(); // 将原始数据对象转换为框架封装的Set报表数据对象 for (int i = 0; i < list.size(); i++) { Dto dto1 = (BaseDto) list.get(i); // 实例化一个图表元数据对象 Set set = new Set(); set.setName(dto1.getAsString("name")); // 名称 set.setValue(dto1.getAsString("value")); // 数据值 set.setColor(dto1.getAsString("color")); // 柱状图颜色 dataList.add(set); } // 将图表数据转为Flash能解析的XML资料格式 String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig); Dto outDto = new BaseDto(); outDto.put("success", new Boolean(true)); outDto.put("xmlstring", xmlString); write(JsonHelper.encodeObject2Json(outDto), response); return mapping.findForward(null); }