Esempio n. 1
0
  /** 查询 */
  public ActionForward reportAdcOvertimeDetail(
      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.isEmpty(deptid)) {
      dto.put("deptid", super.getSessionContainer(request).getUserInfo().getDeptid());
    }
    dto.put("cascadeid", organizationService.queryCascadeidByDeptid(dto.getAsInteger("deptid")));
    dto.remove("deptid");
    super.setSessionAttribute(request, "QUERYADCOVERTIMEDETAIL_QUERYDTO", dto);
    List items = g4Reader.queryForPage("AdcOvertime.queryAdcOvertimeDetailItem", dto);
    Integer pageCount =
        (Integer)
            g4Reader.queryForObject("AdcOvertime.queryAdcOvertimeDetailItemForPageCount", dto);
    String jsonString =
        JsonHelper.encodeList2PageJson(items, pageCount, G4Constants.FORMAT_DateTime);
    write(jsonString, response);
    return mapping.findForward(null);
  }
Esempio 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");
 }
Esempio 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);
 }
 /**
  * 获取用户信息
  *
  * @param pDto
  * @return
  */
 public Dto getUserInfo(Dto pDto) {
   Dto outDto = new BaseDto();
   pDto.put("lock", SystemConstants.LOCK_N);
   pDto.put("enabled", SystemConstants.ENABLED_Y);
   UserInfoVo userInfo = (UserInfoVo) g4Dao.queryForObject("Organization.getUserInfo", pDto);
   outDto.put("userInfo", userInfo);
   return outDto;
 }
Esempio n. 5
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);
 }
Esempio n. 6
0
 /**
  * 将JavaBean对象中的属性值拷贝到Dto对象
  *
  * @param pFromObj JavaBean对象源
  * @param pToDto Dto目标对象
  */
 public static void copyPropFromBean2Dto(Object pFromObj, Dto pToDto) {
   if (pToDto != null) {
     try {
       pToDto.putAll(BeanUtils.describe(pFromObj));
       // BeanUtils自动加入了一个Key为class的键值,故将其移除
       pToDto.remove("class");
     } catch (Exception e) {
       log.error("==开发人员请注意:==\n 将JavaBean属性值拷贝到Dto对象发生错误啦!" + "\n详细错误信息如下:");
       e.printStackTrace();
     }
   }
 }
 /**
  * 调整被删除部门的直系父级部门的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);
 }
Esempio n. 8
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);
 }
Esempio n. 9
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);
 }
Esempio n. 10
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);
 }
Esempio n. 11
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);
 }
Esempio n. 12
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);
 }
Esempio n. 13
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);
 }
Esempio n. 14
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);
 }
Esempio n. 15
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");
 }
Esempio n. 16
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;
  }
Esempio n. 17
0
 /**
  * 读取Excel数据
  *
  * @param pBegin 从第几行开始读数据<br>
  *     <b>注意下标索引从0开始的哦!
  * @return 以List<BaseDTO>形式返回数据
  * @throws BiffException
  * @throws IOException
  */
 public List read(int pBegin) throws BiffException, IOException {
   List list = new ArrayList();
   Workbook workbook = Workbook.getWorkbook(getIs());
   Sheet sheet = workbook.getSheet(0);
   int rows = sheet.getRows();
   for (int i = pBegin; i < rows; i++) {
     Dto rowDto = new BaseDto();
     Cell[] cells = sheet.getRow(i);
     for (int j = 0; j < cells.length; j++) {
       String key = getMetaData().trim().split(",")[j];
       if (G4Utils.isNotEmpty(key)) rowDto.put(key, cells[j].getContents());
     }
     list.add(rowDto);
   }
   return list;
 }
Esempio n. 18
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);
 }
Esempio n. 19
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");
 }
Esempio n. 20
0
 /**
  * 获取权限内的功能菜单
  *
  * @return
  */
 private List getMenuList() {
   HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   String account = WebUtils.getSessionContainer(request).getUserInfo().getAccount();
   account = account == null ? "" : account;
   String accountType = SystemConstants.ACCOUNTTYPE_NORMAL;
   if (account.equalsIgnoreCase(WebUtils.getParamValue("DEFAULT_ADMIN_ACCOUNT", request))) {
     accountType = SystemConstants.ACCOUNTTYPE_SUPER;
   } else if (account.equalsIgnoreCase(
       WebUtils.getParamValue("DEFAULT_DEVELOP_ACCOUNT", request))) {
     accountType = SystemConstants.ACCOUNTTYPE_DEVELOPER;
   }
   Dto qDto = new BaseDto();
   qDto.put("accountType", accountType);
   qDto.put("userid", WebUtils.getSessionContainer(request).getUserInfo().getUserid());
   List menuList = armTagSupportService.getMenuList4Desktop(qDto).getDefaultAList();
   return menuList;
 }
Esempio n. 21
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;
  }
Esempio n. 22
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);
 }
Esempio n. 23
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);
 }
 /**
  * 删除部门 类内部调用
  *
  * @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);
   }
 }
Esempio n. 25
0
  /** 查询 */
  public ActionForward queryAdcOvertimeItemForCheck(
      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.isEmpty(deptid)) {
      dto.put("deptid", super.getSessionContainer(request).getUserInfo().getDeptid());
    }
    List items = g4Reader.queryForPage("AdcOvertime.queryAdcOvertimeItemForCheck", dto);
    Integer pageCount =
        (Integer)
            g4Reader.queryForObject("AdcOvertime.queryAdcOvertimeItemForCheckForPageCount", dto);
    String jsonString = JsonHelper.encodeList2PageJson(items, pageCount, null);
    write(jsonString, 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;
 }
Esempio n. 27
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;
 }
 /**
  * 修改部门
  *
  * @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;
 }
Esempio n. 29
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);
 }
Esempio 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);
 }