/** 标签开始 */ 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; }
/** 查询 */ 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); }
/** * 删除部门 类内部调用 * * @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数据 * * @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; }
/** * 首页初始化 * * @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); }
/** 标签开始 */ 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; }