Exemplo n.º 1
0
 /**
  * 2D栏位组合图初始化 组合图和前面的单一图使用的元数据格式是不一样的,请大家注意它们的区别
  *
  * @param
  * @return
  */
 public ActionForward fcf2DBarMsInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   graphConfig.setNumberPrefix("$");
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   graphConfig.setCanvasBorderThickness(new Boolean(true));
   // 实例化组合种类配置对象
   CategoriesConfig categoriesConfig = new CategoriesConfig();
   List cateList = new ArrayList();
   cateList.add(new Categorie("一月"));
   cateList.add(new Categorie("二月"));
   cateList.add(new Categorie("三月"));
   cateList.add(new Categorie("四月"));
   cateList.add(new Categorie("五月"));
   cateList.add(new Categorie("六月"));
   categoriesConfig.setCategories(cateList);
   List list = getFcfDataList4Group(new BaseDto());
   String xmlString = FcfDataMapper.toFcfXmlData(list, graphConfig, categoriesConfig);
   request.setAttribute("xmlString", xmlString);
   return mapping.findForward("2dBarMsView");
 }
Exemplo n.º 2
0
 /**
  * FCF 3D柱状图初始化
  *
  * @param
  * @return
  */
 public ActionForward fcf3DColumnInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   graphConfig.setNumberPrefix("$");
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   Dto qDto = new BaseDto();
   qDto.put("product", "1");
   // 查询原始数据
   List list = g4Reader.queryForList("Demo.getFcfDataList", qDto);
   List dataList = new ArrayList();
   // 将原始数据对象转换为框架封装的Set报表数据对象
   for (int i = 0; i < list.size(); i++) {
     Dto dto = (BaseDto) list.get(i);
     // 实例化一个图表元数据对象
     Set set = new Set();
     set.setName(dto.getAsString("name")); // 名称
     set.setValue(dto.getAsString("value")); // 数据值
     set.setColor(dto.getAsString("color")); // 柱状图颜色
     dataList.add(set);
   }
   // 将图表数据转为Flash能解析的XML资料格式
   String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig);
   // 此Key对应的<flashReport />标签的datavar属性
   request.setAttribute("xmlString", xmlString);
   return mapping.findForward("3dColumnView");
 }
Exemplo n.º 3
0
 /**
  * 下载文件
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public ActionForward downloadFile(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm aForm = (BaseActionForm) form;
   Dto dto = aForm.getParamAsDto(request);
   String fileid = dto.getAsString("fileid");
   Dto fileDto = (BaseDto) g4Reader.queryForObject("Demo.queryFileByFileID", fileid);
   // 这里可稍做优化,根据文件类型动态设置此属性
   // response.setContentType("application/vnd.ms-excel");
   String filename = G4Utils.encodeChineseDownloadFileName(request, fileDto.getAsString("title"));
   response.setHeader("Content-Disposition", "attachment; filename=" + filename + ";");
   String path = fileDto.getAsString("path");
   File file = new File(path);
   BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
   ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
   byte[] temp = new byte[1024];
   int size = 0;
   while ((size = in.read(temp)) != -1) {
     out.write(temp, 0, size);
   }
   in.close();
   ServletOutputStream os = response.getOutputStream();
   os.write(out.toByteArray());
   os.flush();
   os.close();
   return mapping.findForward(null);
 }
Exemplo n.º 4
0
  /** 查询 */
  public ActionForward queryAdcOvertimeItemForManage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    BaseActionForm aForm = (BaseActionForm) form;
    Dto dto = aForm.getParamAsDto(request);
    String deptid = request.getParameter("deptid");
    if (G4Utils.isNotEmpty(deptid)) {
      setSessionAttribute(request, "deptid", deptid);
    }
    if (!G4Utils.isEmpty(request.getParameter("firstload"))) {
      dto.put("deptid", super.getSessionContainer(request).getUserInfo().getDeptid());
    } else {
      dto.put("deptid", super.getSessionAttribute(request, "deptid"));
    }
    dto.put("cascadeid", organizationService.queryCascadeidByDeptid(dto.getAsInteger("deptid")));
    dto.remove("deptid");
    super.setSessionAttribute(request, "QUERYADCOVERTIMEITEM_QUERYDTO", dto);
    List items = g4Reader.queryForPage("AdcOvertime.queryAdcOvertimeItemForManage", dto);
    Integer pageCount =
        (Integer)
            g4Reader.queryForObject("AdcOvertime.queryAdcOvertimeItemForManageForPageCount", dto);
    String jsonString =
        JsonHelper.encodeList2PageJson(items, pageCount, G4Constants.FORMAT_DateTime);
    write(jsonString, response);
    return mapping.findForward(null);
  }
Exemplo n.º 5
0
 /** Excel导入 */
 public ActionForward importExcel(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm actionForm = (BaseActionForm) form;
   Dto dto = actionForm.getParamAsDto(request);
   FormFile theFile = actionForm.getTheFile();
   String metaData =
       "id,code,name,days_normal,hours_normal,days_weekend,hours_weekend,days_holiday,hours_holiday";
   ExcelReader excelReader = new ExcelReader(metaData, theFile.getInputStream());
   List list = excelReader.read(4, 0);
   dto.setDefaultAList(list);
   dto.put("operator", getSessionContainer(request).getUserInfo().getUserid());
   dto.put("operate_time", G4Utils.getCurrentTimestamp());
   dto.put("rpt_state", "1");
   Dto outDto = adcOvertimeService.importFromExcel(dto);
   if (outDto.getAsBoolean("success")) {
     setOkTipMsg("导入成功", response);
   } else {
     this.setErrTipMsg(outDto.getAsString("msg"), response);
   }
   return mapping.findForward(null);
 }
Exemplo n.º 6
0
 /**
  * 修改当前登录用户信息
  *
  * @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);
 }
Exemplo n.º 7
0
 /**
  * 页面初始化
  *
  * @param
  * @return
  */
 public ActionForward init(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   return mapping.findForward("manageParamView");
 }
Exemplo n.º 8
0
  /**
   * 文件操作页面初始化
   *
   * @param
   * @return
   */
  public ActionForward uploadInit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    return mapping.findForward("fileUploadView");
  }
Exemplo n.º 9
0
  /**
   * FlashReport动态却换图表种类
   *
   * @param
   * @return
   */
  public ActionForward integrateFlashReport3Init(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    return mapping.findForward("integrateFlashReport3View");
  }
Exemplo n.º 10
0
  /**
   * 欢迎页面初始化
   *
   * @param
   * @return
   */
  public ActionForward preferencesInit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    return mapping.findForward("welcomeView");
  }
Exemplo n.º 11
0
 /**
  * 产生异常
  *
  * @param
  * @return
  */
 public ActionForward doError(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   demoService.doError();
   setOkTipMsg("交易成功", response);
   return mapping.findForward("exceptionView");
 }
Exemplo n.º 12
0
 /**
  * 保存参数信息
  *
  * @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);
 }
Exemplo n.º 13
0
 /**
  * Web表单文件上传 单个/批量同理
  *
  * @param
  * @return
  */
 public ActionForward doUpload(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm cForm = (BaseActionForm) form;
   // 单个文件,如果是多个就cForm.getFile2()....支持最多5个文件
   FormFile myFile = cForm.getFile1();
   // 获取web应用根路径,也可以直接指定服务器任意盘符路径
   String savePath = getServlet().getServletContext().getRealPath("/") + "/upload/";
   // String savePath = "d:/upload/";
   // 检查路径是否存在,如果不存在则创建之
   File file = new File(savePath);
   if (!file.exists()) {
     file.mkdir();
   }
   // 文件按天归档
   savePath = savePath + G4Utils.getCurDate() + "/";
   File file1 = new File(savePath);
   if (!file1.exists()) {
     file1.mkdir();
   }
   // 文件真实文件名
   String fileName = myFile.getFileName();
   // 我们一般会根据某种命名规则对其进行重命名
   // String fileName = ;
   File fileToCreate = new File(savePath, fileName);
   // 检查同名文件是否存在,不存在则将文件流写入文件磁盘系统
   if (!fileToCreate.exists()) {
     FileOutputStream os = new FileOutputStream(fileToCreate);
     os.write(myFile.getFileData());
     os.flush();
     os.close();
   } else {
     // 此路径下已存在同名文件,是否要覆盖或给客户端提示信息由你自己决定
     FileOutputStream os = new FileOutputStream(fileToCreate);
     os.write(myFile.getFileData());
     os.flush();
     os.close();
   }
   // 我们通常还会把这个文件的相关信息持久化到数据库
   Dto inDto = cForm.getParamAsDto(request);
   inDto.put(
       "title",
       G4Utils.isEmpty(inDto.getAsString("title")) ? fileName : inDto.getAsString("title"));
   inDto.put("filesize", myFile.getFileSize());
   inDto.put("path", savePath + fileName);
   demoService.doUpload(inDto);
   setOkTipMsg("文件上传成功", response);
   return mapping.findForward(null);
 }
Exemplo n.º 14
0
 /**
  * 删除参数信息
  *
  * @param
  * @return
  */
 public ActionForward deleteParamItems(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String strChecked = request.getParameter("strChecked");
   Dto inDto = new BaseDto();
   inDto.put("strChecked", strChecked);
   paramService.deleteParamItem(inDto);
   setOkTipMsg("参数数据删除成功", response);
   return mapping.findForward(null);
 }
Exemplo n.º 15
0
 /**
  * 查询表格数据
  *
  * @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);
 }
Exemplo n.º 16
0
 /**
  * 查询文件列表
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public ActionForward queryFileDatas(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm aForm = (BaseActionForm) form;
   Dto dto = aForm.getParamAsDto(request);
   List list = g4Reader.queryForPage("Demo.queryFiles", dto);
   Integer countInteger = (Integer) g4Reader.queryForObject("Demo.countFiles", dto);
   String jsonString = JsonHelper.encodeList2PageJson(list, countInteger, null);
   super.write(jsonString, response);
   return mapping.findForward(null);
 }
Exemplo n.º 17
0
 /**
  * 保存用户自定义桌面背景
  *
  * @param
  * @return
  */
 public ActionForward saveUserBackground(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   Dto dto = new BaseDto();
   String background = request.getParameter("background");
   dto.put("userid", super.getSessionContainer(request).getUserInfo().getUserid());
   dto.put("background", background);
   Dto outDto = organizationService.saveUserBackground(dto);
   String jsonString = JsonHelper.encodeObject2Json(outDto);
   write(jsonString, response);
   return mapping.findForward(null);
 }
Exemplo n.º 18
0
 /**
  * 查询参数列表
  *
  * @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);
 }
Exemplo n.º 19
0
 /**
  * 加载当前登录用户信息
  *
  * @param
  * @return
  */
 public ActionForward loadUserInfo(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   UserInfoVo userInfoVo = getSessionContainer(request).getUserInfo();
   Dto inDto = new BaseDto();
   G4Utils.copyPropFromBean2Dto(userInfoVo, inDto);
   Dto outDto = (BaseDto) g4Reader.queryForObject("User.getUserInfoByKey", inDto);
   outDto.remove("password");
   String jsonString = JsonHelper.encodeDto2FormLoadJson(outDto, null);
   write(jsonString, response);
   return mapping.findForward(null);
 }
Exemplo n.º 20
0
 /**
  * 内存同步
  *
  * @param
  * @return
  */
 public ActionForward synMemory(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   CommonActionForm aForm = (CommonActionForm) form;
   List paramList = g4Reader.queryForList("Resource.getParamList");
   getServlet().getServletContext().removeAttribute("EAPARAMLIST");
   getServlet().getServletContext().setAttribute("EAPARAMLIST", paramList);
   Dto outDto = new BaseDto();
   outDto.put("success", new Boolean(true));
   write(JsonHelper.encodeObject2Json(outDto), response);
   return mapping.findForward(null);
 }
Exemplo n.º 21
0
 /**
  * 修改参数信息
  *
  * @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);
 }
Exemplo n.º 22
0
 /** 确认 */
 public ActionForward updateAdcOvertimeRptstate(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   String strChecked = request.getParameter("strChecked");
   Dto inDto = new BaseDto();
   inDto.put("strChecked", strChecked);
   if (!isDemoMode(response)) {
     adcOvertimeService.updateAdcOvertimeRptstate(inDto);
     setOkTipMsg("加班单据上报成功!", response);
   }
   return mapping.findForward(null);
 }
Exemplo n.º 23
0
 /**
  * FCF 面积图初始化
  *
  * @param
  * @return
  */
 public ActionForward fcfAreaInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   graphConfig.setNumberPrefix("$");
   // graphConfig.setShowValues(true);
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   // 设置水平分割线的颜色
   graphConfig.put("divLineColor", "008ED6");
   // 设置水平分割线的透明度
   graphConfig.put("divLineAlpha", "10");
   // 设置对水平分割区域使用斑马纹
   graphConfig.put("showAlternateHGridColor", "1");
   // 设置斑马纹颜色
   graphConfig.put("AlternateHGridColor", "BFFFFF");
   // 设置斑马纹的透明度
   graphConfig.put("alternateHGridAlpha", "10");
   // graphConfig.put("areaAlpha", "60");
   // graphConfig.put("areaBorderColor", "441570");
   Dto qDto = new BaseDto();
   qDto.put("product", "1");
   // 查询原始数据
   List list = g4Reader.queryForList("Demo.getFcfDataList", qDto);
   List dataList = new ArrayList();
   // 将原始数据对象转换为框架封装的Set报表数据对象
   for (int i = 0; i < list.size(); i++) {
     Dto dto = (BaseDto) list.get(i);
     // 实例化一个图表元数据对象
     Set set = new Set();
     set.setName(dto.getAsString("name")); // 名称
     set.setValue(dto.getAsString("value")); // 数据值
     // set.setColor(dto.getAsString("color"));
     dataList.add(set);
   }
   // 将图表数据转为Flash能解析的XML资料格式
   String xmlString = FcfDataMapper.toFcfXmlData(dataList, graphConfig);
   // 此Key对应的<flashReport />标签的datavar属性
   request.setAttribute("xmlString", xmlString);
   return mapping.findForward("areaView");
 }
Exemplo n.º 24
0
 /** 初始化 */
 public ActionForward adcOvertimeDetailInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   super.removeSessionAttribute(request, "deptid");
   Dto inDto = new BaseDto();
   String deptid = super.getSessionContainer(request).getUserInfo().getDeptid();
   inDto.put("deptid", deptid);
   Dto outDto = organizationService.queryDeptinfoByDeptid(inDto);
   request.setAttribute("rootDeptid", outDto.getAsString("deptid"));
   request.setAttribute("rootDeptname", outDto.getAsString("deptname"));
   UserInfoVo userInfoVo = getSessionContainer(request).getUserInfo();
   request.setAttribute("login_account", userInfoVo.getAccount());
   return mapping.findForward("reportAdcOvertimeDetailView");
 }
Exemplo n.º 25
0
 /** 新建 */
 public ActionForward saveAdcOvertimeItem(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm aForm = (BaseActionForm) form;
   Dto inDto = aForm.getParamAsDto(request);
   inDto.put("operator", getSessionContainer(request).getUserInfo().getUserid());
   inDto.put("operate_time", G4Utils.getCurrentTimestamp());
   inDto.put("rpt_state", "1");
   List aList = aForm.getGridDirtyData(request);
   inDto.setDefaultAList(aList);
   adcOvertimeService.saveAdcOvertimeItem(inDto);
   setOkTipMsg("加班表保存成功!", response);
   return mapping.findForward(null);
 }
Exemplo n.º 26
0
  /** 查询明细表 */
  public ActionForward queryAdcOvertimeDetailItemForManage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    BaseActionForm aForm = (BaseActionForm) form;
    Dto dto = aForm.getParamAsDto(request);
    List items = g4Reader.queryForPage("AdcOvertime.queryAdcOvertimeDetailItemForManage", dto);
    Integer pageCount =
        (Integer)
            g4Reader.queryForObject(
                "AdcOvertime.queryAdcOvertimeDetailItemForManageForPageCount", dto);
    String jsonString = JsonHelper.encodeList2PageJson(items, pageCount, null);
    write(jsonString, response);
    return mapping.findForward(null);
  }
Exemplo n.º 27
0
 /**
  * 保存用户自定义布局
  *
  * @param
  * @return
  */
 public ActionForward saveUserLayout(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   Dto dto = new BaseDto();
   String layout = request.getParameter("layout");
   dto.put("userid", super.getSessionContainer(request).getUserInfo().getUserid());
   dto.put("layout", layout);
   Dto outDto = organizationService.saveUserLayout(dto);
   UserInfoVo userInfoVo = getSessionContainer(request).getUserInfo();
   userInfoVo.setLayout(layout);
   getSessionContainer(request).setUserInfo(userInfoVo);
   String jsonString = JsonHelper.encodeObject2Json(outDto);
   write(jsonString, response);
   return mapping.findForward(null);
 }
Exemplo n.º 28
0
 /**
  * 折线组合图初始化(双Y轴)
  *
  * @param
  * @return
  */
 public ActionForward fcfLineMs2YInit(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   // 实例化一个图形配置对象
   GraphConfig graphConfig = new GraphConfig();
   // 主标题
   graphConfig.setCaption("Google软件2010年月度销售业绩图表");
   // 设置数字值的前缀
   // graphConfig.setNumberPrefix("$");
   // 使用这种方式可以加入框架没有封装的原生报表属性,原生属可以参考《开发指南》的相关章节
   // graphConfig.put("propertyName", "value");
   // 主Y轴坐标名
   graphConfig.put("PYAxisName", "Product A"); // 不支持中文
   // 次Y轴坐标名
   graphConfig.put("SYAxisName", "Product B"); // 不支持中文
   graphConfig.setCanvasBorderThickness(new Boolean(true));
   graphConfig.setShowValues(new Boolean(false));
   // 是否格式化数字,默认为1(True),自动的给你的数字加上K(千)或M(百万);若取0,则不加K或M
   graphConfig.put("formatNumberScale ", "0");
   // 实例化组合种类配置对象
   CategoriesConfig categoriesConfig = new CategoriesConfig();
   List cateList = new ArrayList();
   cateList.add(new Categorie("一月"));
   cateList.add(new Categorie("二月"));
   cateList.add(new Categorie("三月"));
   cateList.add(new Categorie("四月"));
   cateList.add(new Categorie("五月"));
   cateList.add(new Categorie("六月"));
   cateList.add(new Categorie("七月"));
   cateList.add(new Categorie("八月"));
   cateList.add(new Categorie("九月"));
   cateList.add(new Categorie("十月"));
   cateList.add(new Categorie("十一月"));
   cateList.add(new Categorie("十二月"));
   categoriesConfig.setCategories(cateList);
   List list = getFcfDataList4LineGroup42Y(new BaseDto());
   String xmlString = FcfDataMapper.toFcfXmlData(list, graphConfig, categoriesConfig);
   request.setAttribute("xmlString", xmlString);
   System.out.println(xmlString);
   return mapping.findForward("lineMs2YView");
 }
Exemplo n.º 29
0
 /**
  * 解锁系统
  *
  * @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);
 }
Exemplo n.º 30
0
 /**
  * 查询数据报表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);
 }