Exemplo n.º 1
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.º 2
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.º 3
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.º 4
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;
 }
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 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.º 7
0
 /**
  * 返回指定格式的字符型日期
  *
  * @param date
  * @param formatString
  * @return
  */
 public static String Date2String(Date date, String formatString) {
   if (G4Utils.isEmpty(date)) {
     return null;
   }
   SimpleDateFormat simpledateformat = new SimpleDateFormat(formatString);
   String strDate = simpledateformat.format(date);
   return strDate;
 }
 /**
  * 删除部门 类内部调用
  *
  * @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);
   }
 }
 /**
  * 修改部门
  *
  * @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;
 }
Exemplo 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);
 }
Exemplo n.º 11
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;
 }
Exemplo n.º 12
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);
 }
 /**
  * 保存部门
  *
  * @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;
 }
Exemplo n.º 14
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;
 }
Exemplo n.º 15
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.º 16
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);
  }
Exemplo n.º 17
0
  /** 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);
  }
Exemplo n.º 18
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;
 }
Exemplo n.º 19
0
 /** 应用平台启动 */
 private void systemStartup(ServletContext servletContext) {
   PropertiesHelper pHelper = PropertiesFactory.getPropertiesHelper(PropertiesFile.G4);
   String forceLoad = pHelper.getValue("forceLoad", SystemConstants.FORCELOAD_N);
   long start = System.currentTimeMillis();
   if (forceLoad.equalsIgnoreCase(SystemConstants.FORCELOAD_N)) {
     log.info("*******************************************************");
     log.info("G4系统集成与应用开发平台[G4Studio]开始启动...");
     log.info("*******************************************************");
   }
   try {
     wac = SpringBeanLoader.getApplicationContext();
   } catch (Exception e) {
     success = false;
     e.printStackTrace();
   }
   if (success) {
     MonitorService monitorService =
         (MonitorService) SpringBeanLoader.getSpringBean("monitorService");
     monitorService.deleteHttpSession(new BaseDto());
     try {
       initDbType();
     } catch (SQLException e) {
       e.printStackTrace();
     }
   }
   if (success) {
     log.info("系统开始启动字典装载程序...");
     log.info("开始加载字典...");
     Reader g4Reader = (Reader) SpringBeanLoader.getSpringBean("g4Reader");
     List codeList = null;
     try {
       codeList = g4Reader.queryForList("Resource.getCodeViewList");
       log.info("字典加载成功!");
     } catch (Exception e) {
       success = false;
       log.error("字典加载失败!");
       e.printStackTrace();
     }
     servletContext.setAttribute("EACODELIST", codeList);
   }
   if (success) {
     log.info("系统开始启动全局参数表装载程序...");
     log.info("开始加载全局参数表...");
     List paramList = null;
     try {
       Reader g4Reader = (Reader) SpringBeanLoader.getSpringBean("g4Reader");
       paramList = g4Reader.queryForList("Resource.getParamList");
       log.info("全局参数表加载成功!");
     } catch (Exception e) {
       success = false;
       log.error("全局参数表加载失败!");
       e.printStackTrace();
     }
     servletContext.setAttribute("EAPARAMLIST", paramList);
   }
   long timeSec = (System.currentTimeMillis() - start) / 1000;
   log.info("********************************************");
   if (success) {
     log.info("G4系统集成与应用开发平台[G4Studio]启动成功[" + G4Utils.getCurrentTime() + "]");
     log.info("启动总耗时: " + timeSec / 60 + "分 " + timeSec % 60 + "秒 ");
   } else {
     log.error("G4系统集成与应用开发平台[G4Studio]启动失败[" + G4Utils.getCurrentTime() + "]");
     log.error("启动总耗时: " + timeSec / 60 + "分" + timeSec % 60 + "秒");
   }
   log.info("********************************************");
 }
Exemplo n.º 20
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);
  }