Beispiel #1
0
  private void loadUserHome(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    // 所有模块列表
    List<RockPower> list = systemMgm.getListedModules(Constant.DefaultModuleRootID, false);
    List<RockPower> allRockPowerList = new ArrayList<RockPower>();
    // 去除掉portal
    for (RockPower power : list) {
      if (!power.getModelflag().equals("3")) {
        allRockPowerList.add(power);
      }
    }

    // 用户可访问的模块列表
    List<RockPower> rockPowerList =
        systemMgm.getChildRockPowersByParentId(Constant.DefaultModuleRootID, request.getSession());
    Map<String, String> rockPowerMap = new HashMap<String, String>();
    for (RockPower rockPower : rockPowerList) {
      rockPowerMap.put(rockPower.getPowerpk(), rockPower.getPowername());
    }
    String unitType = request.getSession().getAttribute(Constant.UNITTYPE).toString();

    String posNum = PropertyCodeDAO.getInstence().getCodeValueByPropertyName("参建单位", "组织机构类型");
    if (posNum == null) {
      posNum = "2";
    } else if (posNum.equals("")) {
      posNum = "2";
    }

    // 参建单位不能点击“公司网站”和“OA”
    Boolean enableExtLink = false;
    if (!unitType.equals(posNum)) {
      enableExtLink = true;
      // 网站和OA的地址
      Map<String, String> externalLinkMap = new HashMap<String, String>();
      externalLinkMap.put("compWebUrl", Constant.companyWebUrl);
      externalLinkMap.put("compOAUrl", Constant.companyOAUrl);
      request.setAttribute("linkMap", externalLinkMap);
    }
    request.setAttribute("enableExtLink", enableExtLink);

    request.setAttribute("allRockPower", allRockPowerList);
    request.setAttribute("rockPowerMap", rockPowerMap);

    String userId = (String) request.getSession().getAttribute(Constant.USERID);

    // 用户待办消息数
    //		String taskSql = "select count(*) from task_view where tonode='" + userId + "' and
    // flag='0'";
    //		Integer taskNum = ((BigDecimal )baseMgm.getData(taskSql).get(0)).intValue();
    //		request.setAttribute("taskNum", taskNum);

    request.getRequestDispatcher("/" + Constant.APPTOPMENUPAGE).forward(request, response);
  }
Beispiel #2
0
  public void init(ServletConfig config) throws ServletException {
    ServletContext servletContext = config.getServletContext();
    this.wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
    this.baseMgm = (BaseMgmFacade) this.wac.getBean("baseMgm");
    this.systemMgm = (SystemMgmFacade) this.wac.getBean("systemMgm");
    this.modulesMap = this.systemMgm.getModulesMap();
    RockPower root =
        (RockPower)
            this.baseMgm.findBeanByProperty(
                BusinessConstants.SYS_PACKAGE.concat(BusinessConstants.SYS_MODULE),
                "parentid",
                "0");
    if (Constant.APPModuleRootID == null) Constant.APPModuleRootID = root.getPowerpk();

    /*SgccIniUnit temp = (SgccIniUnit) this.baseMgm
    		.findBeanByProperty(BusinessConstants.SYS_PACKAGE
    				.concat(BusinessConstants.SYS_ORG), "upunit", "0");
    if (Constant.APPOrgRootID == null) {
    	Constant.APPOrgRootID = temp.getUnitid();
    	Constant.APPOrgRootNAME = temp.getUnitname();
    }*/
  }
Beispiel #3
0
 private void loadmodule(HttpServletRequest request, HttpServletResponse response)
     throws IOException, ServletException {
   long s = System.currentTimeMillis();
   String modid = (String) request.getParameter("modid");
   this.modulesMap = this.systemMgm.getModulesMap();
   // modname = new String(modname.getBytes("ISO-8859-1"),
   // Constant.ENCODING);
   RockPower module = (RockPower) this.modulesMap.get(modid);
   HttpSession session = request.getSession();
   RockUser user = (RockUser) session.getAttribute(Constant.USER);
   StringBuffer url = new StringBuffer("/");
   if (module != null && user != null) {
     String id = module.getPowerpk();
     HashMap userModMap = (HashMap) session.getAttribute(Constant.USERMODULES);
     RockPower userMod = (RockPower) userModMap.get(id);
     if (userMod != null) {
       HashMap moduleActions = this.systemMgm.getUserModuleActions(userModMap, id);
       session.setAttribute(Constant.ModuleLVL, String.valueOf(userMod.getLvl()));
       session.setAttribute(Constant.ModuleActions, moduleActions);
       Map map = request.getParameterMap();
       String temp = userMod.getUrl();
       if (Constant.propsMap.get("IS_ADD_USEROPERATEMODULELOG") != null
           && Constant.propsMap.get("IS_ADD_USEROPERATEMODULELOG").equals("1")) {
         this.systemMgm.saveUserOperateModule(user.getUserid(), this.getIpAddr(request), id);
       }
       if (temp != null && (temp.startsWith("/") || temp.toLowerCase().startsWith("http"))) {
         String remoteURL = temp;
         if (temp.startsWith("/")) {
           remoteURL =
               request.getScheme()
                   + "://"
                   + request.getServerName()
                   + ":"
                   + request.getServerPort()
                   + temp;
         }
         response.setHeader("Location", remoteURL);
         response.sendRedirect(remoteURL);
       } else {
         temp = temp == null ? Constant.TODOPAGE : temp;
         url.append(temp);
         if (temp.indexOf("?") > -1) url.append("&modid=");
         else url.append("?modid=");
         url.append(id);
         Iterator itr = map.entrySet().iterator();
         while (itr.hasNext()) {
           Map.Entry entry = (Map.Entry) itr.next();
           url.append("&");
           url.append((String) entry.getKey());
           url.append("=");
           String vl = request.getParameter((String) entry.getKey());
           // vl = new String(vl.getBytes("ISO-8859-1"),
           // Constant.ENCODING);
           url.append(vl);
         }
         request.getRequestDispatcher(url.toString()).forward(request, response);
       }
     }
   } else {
     request.getRequestDispatcher(Constant.LOGINURL).forward(request, response);
   }
   long e = System.currentTimeMillis();
   log.info("------loadModule costs " + (e - s) + "ms");
 }