Example #1
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");
 }
Example #2
0
  /**
   * 获取FlashReport元数据 (柱状组合图)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4Group(Dto pDto) {
    pDto.put("fcfid", "6");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    pDto.put("product", "1");
    List alist = alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("56B9F9");
    pDto.put("product", "2");
    List blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);
    return dataList;
  }
Example #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);
 }
 /**
  * 修改当前登录用户信息
  *
  * @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);
 }
Example #5
0
 /** 标签开始 */
 public int doStartTag() throws JspException {
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   UserInfoVo userInfo = WebUtils.getSessionContainer(request).getUserInfo();
   String contextPath = request.getContextPath();
   request.setAttribute("webContext", contextPath);
   Dto dto = new BaseDto();
   PropertiesHelper pHelper = PropertiesFactory.getPropertiesHelper(PropertiesFile.G4);
   dto.put("title", WebUtils.getParamValue("SYS_TITLE", request));
   dto.put("contextPath", contextPath);
   String titleIcon = WebUtils.getParamValue("TITLE_ICON", request);
   dto.put("titleIcon", G4Utils.isEmpty(titleIcon) ? "G4Studio.ico" : titleIcon);
   Dto themeDto = new BaseDto();
   Dto resultDto = new BaseDto();
   if (G4Utils.isNotEmpty(userInfo)) {
     themeDto.put("userid", userInfo.getUserid());
     resultDto = armTagSupportService.getEauserSubInfo(themeDto);
   }
   String theme = null;
   if (G4Utils.isNotEmpty(resultDto)) theme = resultDto.getAsString("theme");
   String defaultTheme = WebUtils.getParamValue("SYS_DEFAULT_THEME", request);
   theme = G4Utils.isEmpty(theme) ? defaultTheme : theme;
   dto.put("theme", theme);
   String layout = null;
   if (G4Utils.isNotEmpty(resultDto)) layout = resultDto.getAsString("layout");
   String defaultLayout = WebUtils.getParamValue("APP_LAYOUT", request);
   layout = G4Utils.isEmpty(layout) ? defaultLayout : layout;
   dto.put("layout", layout);
   String background = null;
   if (G4Utils.isNotEmpty(resultDto)) background = resultDto.getAsString("background");
   String defaultBackfround = WebUtils.getParamValue("DESKTOP_BACKGROUND", request);
   background = G4Utils.isEmpty(background) ? defaultBackfround : background;
   dto.put("background", background);
   PropertiesHelper p = PropertiesFactory.getPropertiesHelper(PropertiesFile.G4);
   dto.put("extMode", p.getValue("extMode", TagConstant.Ext_Mode_Run));
   dto.put("runMode", p.getValue("runMode", TagConstant.RUN_MODE_NORMAL));
   dto.put("ajaxErrCode", G4Constants.Ajax_Timeout);
   String micolor = pHelper.getValue("micolor", "blue");
   dto.put("username", WebUtils.getSessionContainer(request).getUserInfo().getUsername());
   dto.put("account", WebUtils.getSessionContainer(request).getUserInfo().getAccount());
   Dto qDto = new BaseDto();
   qDto.put("deptid", WebUtils.getSessionContainer(request).getUserInfo().getDeptid());
   dto.put("deptname", armTagSupportService.getDepartmentInfo(qDto).getAsString("deptname"));
   dto.put("userInfo", userInfo);
   List menuList = getMenuList();
   dto.put("menuList", menuList);
   dto.put("paramList", WebUtils.getParamList(request));
   TemplateEngine engine = TemplateEngineFactory.getTemplateEngine(TemplateType.VELOCITY);
   DefaultTemplate template = new FileTemplate();
   template.setTemplateResource(TagHelper.getTemplatePath(getClass().getName()));
   StringWriter writer = engine.mergeTemplate(template, dto);
   try {
     pageContext.getOut().write(writer.toString());
   } catch (IOException e) {
     log.error(G4Constants.Exception_Head + e.getMessage());
     e.printStackTrace();
   }
   return super.SKIP_BODY;
 }
Example #6
0
  /**
   * 获取FlashReport元数据 (交叉图)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4JCT(Dto pDto) {
    pDto.put("fcfid", "12");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    dataSet1.setShowValues(new Boolean(false));
    pDto.put("product", "1");
    List alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    ;
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("44BC2F");
    dataSet2.setShowValues(new Boolean(false));
    pDto.put("product", "2");
    List blist = blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);

    DataSet dataSet3 = new DataSet();
    dataSet3.setSeriesname("合计");
    dataSet3.setColor("3CBBD7");
    dataSet3.setShowValues(new Boolean(false));
    dataSet3.setParentYAxis(G4Constants.REPORT2Y_SECOND);
    List sumlist = g4Reader.queryForList("Demo.getFcfSumDataList", pDto);
    List sumSetList = new ArrayList();
    for (int i = 0; i < sumlist.size(); i++) {
      Dto dto = (BaseDto) sumlist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      sumSetList.add(set);
    }
    dataSet3.setData(sumSetList);
    dataList.add(dataSet3);
    return dataList;
  }
Example #7
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);
 }
 /**
  * 查询部门信息生成部门树
  *
  * @param pDto
  * @return
  */
 public Dto queryDeptItems(Dto pDto) {
   Dto outDto = new BaseDto();
   List deptList = g4Dao.queryForList("Organization.queryDeptItemsByDto", pDto);
   Dto deptDto = new BaseDto();
   for (int i = 0; i < deptList.size(); i++) {
     deptDto = (BaseDto) deptList.get(i);
     if (deptDto.getAsString("leaf").equals(SystemConstants.LEAF_Y))
       deptDto.put("leaf", new Boolean(true));
     else deptDto.put("leaf", new Boolean(false));
     if (deptDto.getAsString("id").length() == 6) deptDto.put("expanded", new Boolean(true));
   }
   outDto.put("jsonString", JsonHelper.encodeObject2Json(deptList));
   return outDto;
 }
 /**
  * 修改部门
  *
  * @param pDto
  * @return
  */
 public Dto updateDeptItem(Dto pDto) {
   if (G4Utils.isEmpty(pDto.getAsString("sortno"))) {
     pDto.put("sortno", "0");
   }
   if (pDto.getAsString("parentid").equals(pDto.getAsString("parentid_old"))) {
     pDto.remove("parentid");
     g4Dao.update("Organization.updateDeptItem", pDto);
   } else {
     g4Dao.update("Organization.updateEadeptItem", pDto);
     saveDeptItem(pDto);
     pDto.put("parentid", pDto.getAsString("parentid_old"));
     updateLeafOfDeletedParent(pDto);
   }
   return null;
 }
Example #10
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");
 }
 /** 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);
 }
 /**
  * 删除部门项
  *
  * @param pDto
  * @return
  */
 public Dto deleteDeptItems(Dto pDto) {
   Dto dto = new BaseDto();
   if (pDto.getAsString("type").equals("1")) {
     // 列表复选删除
     String[] arrChecked = pDto.getAsString("strChecked").split(",");
     for (int i = 0; i < arrChecked.length; i++) {
       dto.put("deptid", arrChecked[i]);
       deleteDept(dto);
     }
   } else {
     // 部门树右键删除
     dto.put("deptid", pDto.getAsString("deptid"));
     deleteDept(dto);
   }
   return null;
 }
 /** 初始化 */
 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");
 }
 /**
  * 保存部门
  *
  * @param pDto
  * @return
  */
 public synchronized Dto saveDeptItem(Dto pDto) {
   String deptid = IdGenerator.getDeptIdGenerator(pDto.getAsString("parentid"));
   pDto.put("deptid", deptid);
   pDto.put("leaf", SystemConstants.LEAF_Y);
   // MYSQL下int类型字段不能插入空字符
   pDto.put(
       "sortno",
       G4Utils.isEmpty(pDto.getAsString("sortno"))
           ? Integer.valueOf("0")
           : pDto.getAsString("sortno"));
   pDto.put("enabled", SystemConstants.ENABLED_Y);
   g4Dao.insert("Organization.saveDeptItem", pDto);
   Dto updateDto = new BaseDto();
   updateDto.put("deptid", pDto.getAsString("parentid"));
   updateDto.put("leaf", SystemConstants.LEAF_N);
   g4Dao.update("Organization.updateLeafFieldInEaDept", updateDto);
   return null;
 }
Example #15
0
 /**
  * 保存UI元素人员授权数据
  *
  * @param pDto
  * @return
  */
 public Dto savePartUserGrantDatas(Dto pDto) {
   List list = pDto.getDefaultAList();
   for (int i = 0; i < list.size(); i++) {
     Dto lDto = (BaseDto) list.get(i);
     if (G4Utils.isEmpty(lDto.getAsString("authorizeid"))) {
       if (!lDto.getAsString("partauthtype").equals(SystemConstants.PARTAUTHTYPE_NOGRANT)) {
         lDto.put("authorizeid", IDHelper.getAuthorizeid4Eauserauthorize());
         g4Dao.insert("Part.insertEausermenupartItem", lDto);
       }
     } else {
       if (lDto.getAsString("partauthtype").equals(SystemConstants.PARTAUTHTYPE_NOGRANT)) {
         g4Dao.delete("Part.deleteEausermenupartItem", lDto);
       } else {
         g4Dao.update("Part.updateEausermenupartItem", lDto);
       }
     }
   }
   return null;
 }
Example #16
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);
 }
Example #17
0
 /**
  * 删除文件
  *
  * @param mapping
  * @param form
  * @param request
  * @param response
  * @return
  * @throws Exception
  */
 public ActionForward delFiles(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   BaseActionForm aForm = (BaseActionForm) form;
   Dto dto = aForm.getParamAsDto(request);
   String[] strChecked = dto.getAsString("strChecked").split(",");
   for (int i = 0; i < strChecked.length; i++) {
     String fileid = strChecked[i];
     Dto fileDto = (BaseDto) g4Reader.queryForObject("Demo.queryFileByFileID", fileid);
     String path = fileDto.getAsString("path");
     File file = new File(path);
     file.delete();
     demoService.delFile(fileid);
   }
   setOkTipMsg("文件删除成功", response);
   return mapping.findForward(null);
 }
 /**
  * 调整被删除部门的直系父级部门的Leaf属性
  *
  * @param pDto
  */
 private void updateLeafOfDeletedParent(Dto pDto) {
   String parentid = pDto.getAsString("parentid");
   pDto.put("deptid", parentid);
   Integer countInteger =
       (Integer)
           g4Dao.queryForObject("Organization.prepareChangeLeafOfDeletedParentForEadept", pDto);
   if (countInteger.intValue() == 0) {
     pDto.put("leaf", SystemConstants.LEAF_Y);
   } else {
     pDto.put("leaf", SystemConstants.LEAF_N);
   }
   g4Dao.update("Organization.updateLeafFieldInEaDept", pDto);
 }
Example #19
0
 /**
  * 保存托管UI组件脏数据
  *
  * @param pDto
  * @return
  */
 public Dto saveDirtyDatas(Dto pDto) {
   Dto outDto = new BaseDto();
   List list = pDto.getDefaultAList();
   if (!checkUniqueIndex(list)) {
     outDto.setSuccess(G4Constants.FALSE);
     return outDto;
   }
   for (int i = 0; i < list.size(); i++) {
     Dto dto = (BaseDto) list.get(i);
     if (dto.getAsString("remark").equals("null")) {
       dto.put("remark", "");
     }
     if (dto.getAsString("dirtytype").equalsIgnoreCase("1")) {
       dto.put("partid", IDHelper.getPartID());
       g4Dao.insert("Part.savePartItem", dto);
     } else {
       g4Dao.update("Part.updatePartItem", dto);
     }
   }
   outDto.setSuccess(G4Constants.TRUE);
   return outDto;
 }
Example #20
0
  /**
   * 获取FlashReport元数据 (折线组合图)(双Y轴)
   *
   * @param pDto
   * @return
   */
  private List getFcfDataList4LineGroup42Y(Dto pDto) {
    pDto.put("fcfid", "12");
    List dataList = new ArrayList();
    DataSet dataSet1 = new DataSet();
    dataSet1.setSeriesname("产品A");
    dataSet1.setColor("FDC12E");
    dataSet1.setParentYAxis(G4Constants.REPORT2Y_FIRST);
    dataSet1.setRenderAs("Line");
    pDto.put("product", "1");
    List alist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List aSetList = new ArrayList();
    for (int i = 0; i < alist.size(); i++) {
      Dto dto = (BaseDto) alist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      aSetList.add(set);
    }
    dataSet1.setData(aSetList);
    dataList.add(dataSet1);

    DataSet dataSet2 = new DataSet();
    dataSet2.setSeriesname("产品B");
    dataSet2.setColor("44BC2F");
    dataSet2.setParentYAxis(G4Constants.REPORT2Y_SECOND);
    pDto.put("product", "2");
    List blist = g4Reader.queryForList("Demo.getFcfDataList", pDto);
    List bSetList = new ArrayList();
    for (int i = 0; i < blist.size(); i++) {
      Dto dto = (BaseDto) blist.get(i);
      Set set = new Set();
      set.setValue(dto.getAsString("value"));
      bSetList.add(set);
    }
    dataSet2.setData(bSetList);
    dataList.add(dataSet2);
    return dataList;
  }
Example #21
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);
 }
 /**
  * 删除部门 类内部调用
  *
  * @param pDto
  */
 private void deleteDept(Dto pDto) {
   Dto changeLeafDto = new BaseDto();
   Dto tempDto = (BaseDto) g4Dao.queryForObject("Organization.queryDeptItemsByDto", pDto);
   if (G4Utils.isNotEmpty(tempDto)) {
     changeLeafDto.put("parentid", tempDto.getAsString("parentid"));
   }
   g4Dao.delete("Organization.deleteEaroleAuthorizeInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEaroleInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEauserauthorizeInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEauserauthorizeInDeptManage2", pDto);
   g4Dao.delete("Organization.deleteEausermenumapInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEausersubinfoInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEausermenumapInDeptManage", pDto);
   g4Dao.delete("Organization.deleteEarolemenumapInDeptManage", pDto);
   g4Dao.update("Organization.updateEauserInDeptManage", pDto);
   g4Dao.update("Organization.updateEadeptItem", pDto);
   if (G4Utils.isNotEmpty(tempDto)) {
     updateLeafOfDeletedParent(changeLeafDto);
   }
 }
  /** Excel导出 */
  public ActionForward exportDetailExcel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BaseActionForm actionForm = (BaseActionForm) form;
    Dto dto = (BaseDto) super.getSessionAttribute(request, "QUERYADCOVERTIMESUM_QUERYDTO");

    String deptid = dto.getAsString("deptid");
    List items = g4Reader.queryForList("AdcOvertime.queryAdcOvertimeDetailItem", dto);

    Dto parametersDto = new BaseDto();
    parametersDto.put("reportTitle", "部门加班明细表");
    parametersDto.put("jbr", super.getSessionContainer(request).getUserInfo().getUsername());
    parametersDto.put("jbsj", G4Utils.getCurrentTime());

    ExcelExporter excelExporter = new ExcelExporter();
    excelExporter.setTemplatePath("/report/excel/hr/adc/overtimeReportDetail.xls");
    excelExporter.setData(parametersDto, items);
    excelExporter.setFilename(deptid + ".xls");
    excelExporter.export(request, response);
    return mapping.findForward(null);
  }
Example #24
0
  /**
   * 首页初始化
   *
   * @param
   * @return
   */
  public ActionForward indexInit(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    request.setAttribute("sysTitle", getParamValue("SYS_TITLE", request));
    request.setAttribute("westTitle", getParamValue("WEST_NAVIGATE_TITLE", request));
    String viewString = "indexView";
    String appLayout = getParamValue("APP_LAYOUT", request);
    if (appLayout.equals(G4Constants.APP_LAYOUT_DESKTOP)) {
      viewString = "desktopView";
    }
    String userLayout = getSessionContainer(request).getUserInfo().getLayout();
    if (G4Utils.isNotEmpty(userLayout)) {
      if (userLayout.equals(G4Constants.APP_LAYOUT_DESKTOP)) {
        viewString = "desktopView";
      } else {
        viewString = "indexView";
      }
    }

    List list = g4Reader.queryForList("Bus.querySiteName");
    Dto sites = new BaseDto();
    for (int i = 0; i < list.size(); i++) {
      Dto t = (Dto) list.get(i);
      sites.put(t.getAsString("id"), t.getAsString("name"));
    }
    getServlet().getServletContext().setAttribute("siteNameList", sites);

    Dto timesection = new BaseDto();
    //		for(int i=4;i<40;i++){
    //			if(i%2==0){
    //				timesection.put((i-3), i+":30-"+(i+1)+":00");
    //			}
    //			else{
    //
    //				timesection.put((i-3), i+":00-"+(i)+":30");
    //			}
    //
    //
    //		}
    //
    timesection.put("3T", "4:30-5:00");
    timesection.put("4T", "5:00-5:30");
    timesection.put("5T", "5:30-6:00");
    timesection.put("6T", "6:00-6:30");
    timesection.put("7T", "6:30-7:00");
    timesection.put("8T", "7:00-7:30");
    timesection.put("9T", "7:30-8:00");
    timesection.put("10T", "8:00-8:30");
    timesection.put("11T", "8:30-9:00");
    timesection.put("12T", "9:00-9:30");
    timesection.put("13T", "9:30-10:00");
    timesection.put("14T", "10:00-10:30");
    timesection.put("15T", "10:30-11:00");
    timesection.put("16T", "11:00-11:30");
    timesection.put("17T", "11:30-12:00");
    timesection.put("18T", "12:00-12:30");
    timesection.put("19T", "12:30-13:00");
    timesection.put("20T", "13:00-13:30");
    timesection.put("21T", "13:30-14:00");
    timesection.put("22T", "14:00-14:30");
    timesection.put("23T", "14:30-15:00");
    timesection.put("24T", "15:00-15:30");
    timesection.put("25T", "16:30-17:00");
    timesection.put("26T", "17:00-17:30");
    timesection.put("27T", "17:30-18:00");
    timesection.put("28T", "18:00-18:30");
    timesection.put("29T", "18:30-19:00");
    timesection.put("30T", "19:00-19:30");
    timesection.put("31T", "19:30-20:00");
    timesection.put("32T", "20:00-20:30");
    timesection.put("33T", "20:30-21:00");
    timesection.put("34T", "21:00-21:30");
    timesection.put("35T", "21:30-22:00");
    timesection.put("36T", "22:00-22:30");
    timesection.put("37T", "22:30-23:00");
    timesection.put("38T", "23:00-23:30");
    timesection.put("39T", "23:30-00:00");
    timesection.put("40T", "00:00-00:30");
    timesection.put("41T", "00:30-01:00");
    timesection.put("42T", "01:00-01:30");
    getServlet().getServletContext().setAttribute("timesection", timesection);
    return mapping.findForward(viewString);
  }
Example #25
0
 /** 标签开始 */
 public int doStartTag() throws JspException {
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   UserInfoVo userInfo = WebUtils.getSessionContainer(request).getUserInfo();
   String contextPath = request.getContextPath();
   request.setAttribute("webContext", contextPath);
   Dto dto = new BaseDto();
   PropertiesHelper pHelper = PropertiesFactory.getPropertiesHelper(PropertiesFile.G4);
   String micolor = pHelper.getValue("micolor", "blue");
   dto.put("micolor", micolor);
   String urlSecurity = pHelper.getValue("urlSecurity", "1");
   dto.put("urlSecurity", urlSecurity);
   dto.put("urlSecurity2", urlSecurity2);
   dto.put("userInfo", userInfo);
   dto.put("ajaxErrCode", G4Constants.Ajax_Timeout);
   dto.put("requestURL", request.getRequestURL());
   dto.put("contextPath", contextPath);
   dto.put("doctypeEnable", doctypeEnable);
   dto.put("extDisabled", G4Utils.isEmpty(extDisabled) ? "false" : extDisabled);
   dto.put("title", G4Utils.isEmpty(title) ? "G4Studio" : title);
   dto.put("jqueryEnabled", G4Utils.isEmpty(jqueryEnabled) ? "false" : jqueryEnabled);
   dto.put("showLoading", G4Utils.isEmpty(showLoading) ? "true" : showLoading);
   dto.put("uxEnabled", uxEnabled);
   dto.put("exportExceptionWindow", exportExceptionWindow);
   dto.put("fcfEnabled", fcfEnabled);
   dto.put("exportParams", exportParams);
   dto.put("exportUserinfo", exportUserinfo);
   dto.put("isSubPage", isSubPage);
   dto.put("pageLoadMsg", WebUtils.getParamValue("PAGE_LOAD_MSG", request));
   String titleIcon = WebUtils.getParamValue("TITLE_ICON", request);
   dto.put("titleIcon", G4Utils.isEmpty(titleIcon) ? "G4Studio.ico" : titleIcon);
   if (exportParams.equals("true")) {
     dto.put("paramList", WebUtils.getParamList(request));
   }
   // String agent = request.getHeader("user-agent");
   // dto.put("firefox", agent.indexOf("Firefox") == -1 ? "false" : "true");
   PropertiesHelper p = PropertiesFactory.getPropertiesHelper(PropertiesFile.G4);
   dto.put("extMode", p.getValue("extMode", TagConstant.Ext_Mode_Run));
   dto.put("runMode", p.getValue("runMode", TagConstant.RUN_MODE_NORMAL));
   Dto themeDto = new BaseDto();
   Dto resultDto = new BaseDto();
   if (G4Utils.isNotEmpty(userInfo)) {
     themeDto.put("userid", userInfo.getUserid());
     resultDto = armTagSupportService.getEauserSubInfo(themeDto);
   }
   String theme = null;
   if (G4Utils.isNotEmpty(resultDto)) theme = resultDto.getAsString("theme");
   String defaultTheme = WebUtils.getParamValue("SYS_DEFAULT_THEME", request);
   theme = G4Utils.isEmpty(theme) ? defaultTheme : theme;
   dto.put("theme", theme);
   TemplateEngine engine = TemplateEngineFactory.getTemplateEngine(TemplateType.VELOCITY);
   DefaultTemplate template = new FileTemplate();
   template.setTemplateResource(TagHelper.getTemplatePath(getClass().getName()));
   StringWriter writer = engine.mergeTemplate(template, dto);
   try {
     pageContext.getOut().write(writer.toString());
   } catch (IOException e) {
     log.error(G4Constants.Exception_Head + e.getMessage());
     e.printStackTrace();
   }
   return super.EVAL_BODY_INCLUDE;
 }