/*     */ public void changeAdminTheme(Integer themeid) /*     */ {
   /* 455 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 456 */ String sql = "update eop_site set adminthemeid=? where userid=? and id=?";
   /*     */
   /* 458 */ this.daoSupport.execute(sql, new Object[] {themeid, site.getUserid(), site.getId()});
   /* 459 */ EopContext.getContext().getCurrentSite().setAdminthemeid(themeid);
   /*     */ }
  @Transactional(propagation = Propagation.REQUIRED)
  public void install(String productId, Node fragment) {
    boolean xmlData = true;
    String dataSqlPath = EopSetting.PRODUCTS_STORAGE_PATH + "/" + productId + "/example_data.xml";
    try {
      File xmlFile = new File(dataSqlPath);
      if (!xmlFile.exists()) { // 	如果example_data.xml不存在,执行旧版本
        xmlData = false;
        dataSqlPath = getDataSqlPath(productId);
      }

      loggerPrint("安装datasqlPath:" + dataSqlPath);

      if (!"base".equals(productId)) {
        InstallUtil.putMessaage(
            "正在安装示例数据,可能要花费较长时间,请稍后 <img src='resource/com/enation/app/saas/widget/product/loading.gif'");
      } else {
        InstallUtil.putMessaage("正在安装基础数据...");
      }

      if (xmlData) {
        anyDBInstall(dataSqlPath);
      } else {
        if (new File(dataSqlPath).exists()) {
          // 安装示例数据
          String content = FileUtil.read(dataSqlPath, "UTF-8");
          // 解析文件头部CONST和EOPSITE命令,CONST用于替换下面的文本内容,EOPSITE用于更新eop_site表
          content = parseConst(content);

          content = parseUserSiteID(content);
          content = this.filter(content);
          content = content + parseUserSiteID(eopsiteSQL);

          sqlFileExecutor.execute(content);

        } else {
          System.out.println(dataSqlPath + " not exist");
        }
      }
      loggerPrint("示例数据安装完毕");

      FileUtil.copyFolder(
          EopSetting.PRODUCTS_STORAGE_PATH + "/" + productId + "/attachment/",
          EopSetting.IMG_SERVER_PATH + EopContext.getContext().getContextPath() + "/attachment/");

      // 非base应用copy init.sql
      if (!"base".equals(productId)) {
        FileUtil.copyFile(
            EopSetting.PRODUCTS_STORAGE_PATH + "/" + productId + "/init.sql",
            EopSetting.EOP_PATH + EopContext.getContext().getContextPath() + "/init.sql");
      }

    } catch (Exception e) {
      e.printStackTrace();
      this.logger.debug(e.getMessage(), e);
      throw new RuntimeException("安装示例数据出错...");
    }
  }
Beispiel #3
0
  @Transactional(propagation = Propagation.REQUIRED)
  public void add(MultiSite site) {

    /** 读取父* */
    MultiSite parent = this.get(site.getParentid());

    /** 读取本级最大code* */
    String sql = "select max(code) code from site where parentid=? ";
    int maxcode = this.baseDaoSupport.queryForInt(sql, site.getParentid()); // cat code
    maxcode = maxcode == 0 ? maxcode = parent.getCode() : maxcode;
    int level = parent.getLevel() + 1; // 级别
    site.setCode(this.createCode(maxcode, level));
    site.setLevel(level);

    this.baseDaoSupport.insert("site", site);
    int siteid = this.baseDaoSupport.getLastId("site");

    Integer userid = EopContext.getContext().getCurrentSite().getUserid();
    EopSiteDomain eopSiteDomain = new EopSiteDomain();
    eopSiteDomain.setUserid(userid);
    eopSiteDomain.setDomain(site.getDomain());
    eopSiteDomain.setSiteid(EopContext.getContext().getCurrentSite().getId());
    siteManager.addDomain(eopSiteDomain);
    try {
      /**
       * 此处逻辑:先取出所指定的theme信息,取得其对应的文件目录,<br>
       * 然后修改theme.path并插入theme,取得插入的themeid并写回到site
       */
      site.setSiteid(siteid);
      Theme theme = this.themeManager.getTheme(site.getThemeid());
      String contextPath = EopContext.getContext().getContextPath();

      // 复制资源到静态资源服务器
      String basePath = EopSetting.IMG_SERVER_PATH + contextPath + "/themes/" + theme.getPath();
      String targetPath =
          EopSetting.IMG_SERVER_PATH + contextPath + "/themes/" + theme.getPath() + "_" + siteid;
      FileUtil.copyFolder(basePath, targetPath);
      // 复制theme
      basePath = EopSetting.EOP_PATH + contextPath + "/themes/" + theme.getPath();
      targetPath = EopSetting.EOP_PATH + contextPath + "/themes/" + theme.getPath() + "_" + siteid;
      FileUtil.copyFolder(basePath, targetPath);

      theme.setPath(theme.getPath() + "_" + siteid);
      theme.setSiteid(siteid);
      theme.setId(null);
      this.baseDaoSupport.insert("theme", theme);
      int themeid = this.baseDaoSupport.getLastId("theme");
      site.setThemeid(themeid);
      this.update(site);
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("创建主题出错");
    }
  }
 /*    */ public String point() /*    */ {
   /* 33 */ this.site = EopContext.getContext().getCurrentSite();
   /* 34 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 35 */ long lastgetpoint = site.getLastgetpoint();
   /* 36 */ long now = System.currentTimeMillis() / 1000L;
   /* 37 */ int onemonth = 2592000;
   /* 38 */ if (now - lastgetpoint > onemonth) /* 39 */ this.canget = 1;
   /*    */ else {
     /* 41 */ this.canget = 0;
     /*    */ }
   /* 43 */ return "point";
   /*    */ }
 /*     */ public void initData() /*     */ {
   /*     */ String tablenameperfix;
   /*     */ Iterator i$;
   /* 513 */ if ("2".equals(EopSetting.RUNMODE))
   /*     */ {
     /* 515 */ EopSite site = EopContext.getContext().getCurrentSite();
     /* 516 */ String productId = site.getProductid();
     /* 517 */ org.dom4j.Document setupDoc = this.setupLoader.load(productId);
     /*     */
     /* 519 */ tablenameperfix = "";
     /*     */
     /* 521 */ tablenameperfix = "_" + site.getUserid() + "_" + site.getId();
     /*     */
     /* 523 */ List listClean = setupDoc.getRootElement().element("clean").elements();
     /*     */
     /* 525 */ for (i$ = listClean.iterator(); i$.hasNext(); ) {
       Object o = i$.next();
       /* 526 */ org.dom4j.Element table = (org.dom4j.Element) o;
       /* 527 */ this.daoSupport.execute(
           "truncate table " + table.getText() + tablenameperfix, new Object[0]);
       /*     */ }
     /*     */
     /*     */ }
   /*     */
   /* 532 */ String sqlPath =
       EopSetting.EOP_PATH + EopContext.getContext().getContextPath() + "/init.sql";
   /*     */
   /* 534 */ File file = new File(sqlPath);
   /* 535 */ if (file.exists()) {
     /* 536 */ String content = FileUtil.read(sqlPath, "UTF-8");
     /*     */
     /* 538 */ if ("2".equals(EopSetting.RUNMODE)) {
       /* 539 */ EopSite site = EopContext.getContext().getCurrentSite();
       /* 540 */ content = content.replaceAll("<userid>", String.valueOf(site.getUserid()));
       /*     */
       /* 542 */ content = content.replaceAll("<siteid>", String.valueOf(site.getId()));
       /*     */ }
     /*     */ else {
       /* 545 */ content = content.replaceAll("_<userid>", "");
       /* 546 */ content = content.replaceAll("_<siteid>", "");
       /* 547 */ content = content.replaceAll("/user/<userid>/<siteid>", "");
       /* 548 */ content = content.replaceAll("<userid>", "1");
       /* 549 */ content = content.replaceAll("<siteid>", "1");
       /*     */ }
     /* 551 */ this.sqlFileExecutor.execute(content);
     /*     */ } else {
     /* 553 */ throw new RuntimeException("本站点初始化脚本不存在");
     /*     */ }
   /*     */ }
 /*     */ private void fillSiteElement(Element site) /*     */ {
   /* 108 */ EopSite eopSite = EopContext.getContext().getCurrentSite();
   /* 109 */ addSiteElement(site, "sitename", eopSite.getSitename());
   /* 110 */ addSiteElement(site, "title", eopSite.getTitle());
   /* 111 */ addSiteElement(site, "keywords", eopSite.getKeywords());
   /* 112 */ addSiteElement(site, "descript", eopSite.getDescript());
   /* 113 */ addSiteElement(site, "copyright", eopSite.getCopyright());
   /* 114 */ addSiteElement(site, "logofile", eopSite.getLogofile());
   /* 115 */ addSiteElement(site, "bklogofile", eopSite.getBklogofile());
   /* 116 */ addSiteElement(site, "bkloginpicfile", eopSite.getBkloginpicfile());
   /* 117 */ addSiteElement(site, "icofile", eopSite.getIcofile());
   /* 118 */ addSiteElement(site, "username", eopSite.getUsername());
   /* 119 */ addSiteElement(
       site, "usersex", eopSite.getUsersex() == null ? null : eopSite.getUsersex().toString());
   /* 120 */ addSiteElement(site, "usertel", eopSite.getUsertel());
   /* 121 */ addSiteElement(site, "usermobile", eopSite.getUsermobile());
   /* 122 */ addSiteElement(site, "usertel1", eopSite.getUsertel1());
   /* 123 */ addSiteElement(site, "useremail", eopSite.getUseremail());
   /* 124 */ addSiteElement(
       site, "state", eopSite.getState() == null ? null : eopSite.getState().toString());
   /* 125 */ addSiteElement(site, "qqlist", eopSite.getQqlist());
   /* 126 */ addSiteElement(site, "msnlist", eopSite.getMsnlist());
   /* 127 */ addSiteElement(site, "wwlist", eopSite.getWwlist());
   /* 128 */ addSiteElement(site, "tellist", eopSite.getTellist());
   /* 129 */ addSiteElement(site, "worktime", eopSite.getWorktime());
   /* 130 */ addSiteElement(site, "address", eopSite.getAddress());
   /* 131 */ addSiteElement(site, "zipcode", eopSite.getZipcode());
   /* 132 */ addSiteElement(site, "linkman", eopSite.getLinkman());
   /* 133 */ addSiteElement(site, "email", eopSite.getEmail());
   /* 134 */ addSiteElement(
       site,
       "siteon",
       eopSite.getSiteon().toString() == null ? null : eopSite.getSiteon().toString());
   /* 135 */ addSiteElement(site, "closereson", eopSite.getClosereson());
   /*     */ }
Beispiel #7
0
  @Transactional(propagation = Propagation.REQUIRED)
  public void delete(int id) {
    MultiSite childsite = this.get(id);
    List<Theme> list = themeManager.list(id); // 读取此站点的主题
    String contextPath = EopContext.getContext().getContextPath();
    for (Theme theme : list) {
      /** 删除模板静态资源文件* */
      String targetPath =
          EopSetting.IMG_SERVER_PATH + contextPath + "/themes/" + theme.getPath() + "_" + id;
      FileUtil.removeFile(new File(targetPath));

      /** 删除模板文件* */
      targetPath = EopSetting.EOP_PATH + contextPath + "/themes/" + theme.getPath() + "_" + id;
      FileUtil.removeFile(new File(targetPath));
    }

    /** 删除域名 */
    this.siteManager.deleteDomain(childsite.getDomain());

    /** 删除主题* */
    this.baseDaoSupport.execute("delete from theme where siteid = ?", id);

    /** 删除站点 */
    this.baseDaoSupport.execute("delete from site where siteid = ?", id);
  }
Beispiel #8
0
  @Transactional(propagation = Propagation.REQUIRED)
  public void open(String domain) {

    /** 如果已开启,则不操作* */
    EopSite site = EopContext.getContext().getCurrentSite();
    if (site.getMulti_site() == 1) return;

    /** 更新此站点为开启多站点* */
    Integer siteid = site.getId(); // 主站点的站点id
    String sql = "update eop_site set multi_site=1 where id=?";
    this.daoSupport.execute(sql, siteid);
    site.setMulti_site(1); // 更新缓存中的引用

    /** 曾经开启过不添加子站数据* */
    sql = "select count(0) from site";
    int count = this.baseDaoSupport.queryForInt(sql);
    if (count > 0) {
      sql = "update site set domain=? where code=?";
      this.baseDaoSupport.execute(sql, domain, 100000);
      return;
    }

    /** 为站点树添加子站点* */
    MultiSite mainChildSite = new MultiSite();
    mainChildSite.setCode(100000); // 站站代码100000
    mainChildSite.setLevel(1); // 主站为第一级
    mainChildSite.setDomain(domain);
    mainChildSite.setName(site.getSitename());
    mainChildSite.setParentid(0);
    mainChildSite.setThemeid(site.getThemeid()); // 设置主站的模板id为当前模板的id
    this.baseDaoSupport.insert("site", mainChildSite);
  }
 /*    */ public void onAfterOrderCreate(Order order, List<CartItem> itemList, String sessionid)
       /*    */ {
   /* 41 */ IUserService userService = UserServiceFactory.getUserService();
   /* 42 */ Member member = userService.getCurrentMember();
   /* 43 */ if (member != null)
   /*    */ {
     /* 46 */ EopSite site = EopContext.getContext().getCurrentSite();
     /*    */
     /* 48 */ HttpServletRequest request = ThreadContextHolder.getHttpRequest();
     /*    */
     /* 50 */ String domain = RequestUtil.getDomain();
     /*    */
     /* 52 */ EmailModel emailModel = new EmailModel();
     /* 53 */ emailModel.getData().put("username", member.getUname());
     /* 54 */ emailModel.getData().put("sn", order.getSn());
     /* 55 */ emailModel
         .getData()
         .put("createtime", DateUtil.toString(order.getCreate_time(), "yyyy-MM-dd HH:mm:ss"));
     /* 56 */ emailModel.getData().put("sitename", site.getSitename());
     /* 57 */ emailModel.getData().put("logo", site.getLogofile());
     /* 58 */ emailModel.getData().put("domain", domain);
     /*    */
     /* 60 */ emailModel.setTitle("订单提交成功--" + site.getSitename());
     /* 61 */ emailModel.setTo(member.getEmail());
     /* 62 */ emailModel.setTemplate("order_create_email_template.html");
     /* 63 */ this.mailMessageProducer.send(emailModel);
     /*    */ }
   /*    */ }
Beispiel #10
0
  private void copy(AdminTheme theme, boolean isCommon) throws Exception {

    EopSite site = EopContext.getContext().getCurrentSite();

    // 公用模板由common目录复制,非公用由产品目录复制
    String basePath =
        isCommon
            ? EopSetting.APP_DATA_STORAGE_PATH
            : EopSetting.PRODUCTS_STORAGE_PATH + "/" + theme.getProductId();
    basePath = basePath + "/adminthemes";

    String contextPath = EopContext.getContext().getContextPath();
    // 复制图片至静态资源服务器
    String targetPath =
        EopSetting.IMG_SERVER_PATH + contextPath + "/adminthemes/" + theme.getPath();
    FileUtil.copyFolder(basePath + "/" + theme.getPath() + "/images", targetPath + "/images");
    FileUtil.copyFile(
        basePath + "/" + theme.getPath() + "/preview.png", targetPath + "/preview.png");
    FileUtil.copyFolder(basePath + "/" + theme.getPath() + "/css", targetPath + "/css");
    FileUtil.copyFolder(basePath + "/" + theme.getPath() + "/js", targetPath + "/js");

    FileUtil.copyFolder(
        basePath + "/" + theme.getPath(),
        EopSetting.EOP_PATH + contextPath + "/adminthemes/" + theme.getPath());
    /*
     * 只考jsp到eop应用服务器中

    IOFileFilter txtSuffixFilter = FileFilterUtils.suffixFileFilter(".jsp");
    IOFileFilter txtFiles = FileFilterUtils.andFileFilter(FileFileFilter.FILE, txtSuffixFilter);


    FileUtils.copyDirectory(
    new File(basePath + "/" + theme.getPath() )
    ,

    new File(EopSetting.EOP_PATH
    + "/user/"
    + userid
    + "/"
    + siteid
    + "/adminthemes/" + theme.getPath())
    ,
    txtFiles
    );

     */
  }
Beispiel #11
0
  @Transactional(propagation = Propagation.REQUIRED)
  public void close() {
    EopSite site = EopContext.getContext().getCurrentSite();
    Integer siteid = site.getId(); // 主站点的站点id
    String sql = "update eop_site set multi_site=0 where id=?";
    this.daoSupport.execute(sql, siteid);

    site.setMulti_site(0); // 更新缓存中的引用
  }
 /*     */ public void changeTheme(Integer themeid) /*     */ {
   /* 464 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 465 */ Theme theme = this.themeManager.getTheme(themeid);
   /* 466 */ String sql = "update eop_site set themeid=?,themepath=? where userid=? and id=?";
   /* 467 */ this.daoSupport.execute(
       sql, new Object[] {themeid, theme.getPath(), site.getUserid(), site.getId()});
   /*     */
   /* 469 */ site.setThemeid(themeid);
   /* 470 */ site.setThemepath(theme.getPath());
   /* 471 */ ResourceStateManager.setDisplayState(1);
   /*     */ }
 // 流量历史
 public String history() {
   linkList = new ArrayList<Link>();
   String target =
       EopSetting.IMG_SERVER_PATH + EopContext.getContext().getContextPath() + "/access";
   File file = new File(target);
   if (file.exists()) {
     String[] reportList = file.list();
     for (String name : reportList) {
       Link link = new Link();
       link.setLink(
           EopSetting.IMG_SERVER_DOMAIN
               + EopContext.getContext().getContextPath()
               + "/access/"
               + name);
       link.setText(name);
       linkList.add(link);
     }
   }
   return "history";
 }
Beispiel #14
0
  /**
   * 检测操作的“属主”合法性
   *
   * @param userid
   */
  protected void checkIsOwner(final Integer userid) {
    if (userid == null) {
      throw new PermssionRuntimeException();
    }

    Integer suserid = EopContext.getContext().getCurrentSite().getUserid();

    if (suserid.intValue() != userid.intValue()) {
      throw new PermssionRuntimeException();
    }
  }
 /*     */ private void fillThemesElement(Element parentEl) /*     */ {
   /* 206 */ List themeList = this.themeManager.list();
   /* 207 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 208 */ for (Theme theme : themeList) {
     /* 209 */ Element themeEl = new Element("theme");
     /* 210 */ themeEl.setAttribute("id", theme.getPath());
     /* 211 */ themeEl.setAttribute("name", theme.getThemename());
     /* 212 */ if (site.getThemeid().intValue() == theme.getId().intValue()) {
       /* 213 */ themeEl.setAttribute("default", "yes");
       /*     */ }
     /* 215 */ parentEl.addContent(themeEl);
     /*     */ }
   /*     */ }
 protected String parseUserSiteID(String content) {
   if ("2".equals(EopSetting.RUNMODE)) {
     EopSite site = EopContext.getContext().getCurrentSite();
     content = content.replaceAll("<userid>", String.valueOf(site.getUserid()));
     content = content.replaceAll("<siteid>", String.valueOf(site.getId()));
   } else {
     content = content.replaceAll("_<userid>", "");
     content = content.replaceAll("_<siteid>", "");
     content = content.replaceAll("/user/<userid>/<siteid>", "");
     content = content.replaceAll("<userid>", "1");
     content = content.replaceAll("<siteid>", "1");
   }
   return content;
 }
 /**
  * 覆写数据保存事件默认响应<br>
  * 逻辑为以name为字段为字段名,值为request.getParameter(fieldname);
  */
 @Override
 public void onSave(Map article, DataField field) {
   HttpServletRequest request = ThreadContextHolder.getHttpRequest();
   String value = request.getParameter(field.getEnglish_name());
   if (value != null) {
     // 替换静态服务器域名为本地标识串(fs:)
     value =
         value.replaceAll(
             EopSetting.IMG_SERVER_DOMAIN
                 + EopContext.getContext().getContextPath()
                 + "/attachment/",
             EopSetting.FILE_STORE_PREFIX + "/attachment/");
   }
   article.put(field.getEnglish_name(), value);
 }
Beispiel #18
0
  public String imported() {
    try {
      String productid = "temp_" + System.currentTimeMillis();

      String zipPath = UploadUtil.upload(zip, zipFileName, "solution");
      zipPath =
          zipPath.replaceAll(
              EopSetting.FILE_STORE_PREFIX,
              EopSetting.IMG_SERVER_PATH + EopContext.getContext().getContextPath());
      this.solutionImporter.imported(productid, zipPath, true);
      this.json = "{result:1}";

    } catch (Exception e) {
      e.printStackTrace();
      this.json = "{result:0}";
    }
    return this.JSON_MESSAGE;
  }
Beispiel #19
0
 public String export() {
   try {
     this.solutionExporter.export(
         name, exportData == 1, exportTheme == 1, exportProfile == 1, exportAttr == 1);
     this.json =
         "{result:1,path:'"
             + EopSetting.IMG_SERVER_DOMAIN
             + EopContext.getContext().getContextPath()
             + "/backup/"
             + name
             + ".zip"
             + "'}";
   } catch (RuntimeException e) {
     e.printStackTrace();
     this.json = "{result:0,message:'" + e.getMessage() + "'}";
   }
   return this.JSON_MESSAGE;
 }
 /*    */ public List<SiteMenu> list(Integer parentid) /*    */ {
   /* 51 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 52 */ List menuList =
       (List) this.cache.get("siteMenuList_" + site.getUserid() + "_" + site.getId());
   /*    */
   /* 55 */ if (menuList == null) {
     /* 56 */ menuList = this.siteMenuManager.list(parentid);
     /* 57 */ this.cache.put("siteMenuList_" + site.getUserid() + "_" + site.getId(), menuList);
     /* 58 */ if (this.logger.isDebugEnabled()) {
       /* 59 */ this.logger.debug("load sitemenu from database");
       /*    */ }
     /*    */ }
   /* 62 */ else if (this.logger.isDebugEnabled()) {
     /* 63 */ this.logger.debug("load sitemenu from cache");
     /*    */ }
   /*    */
   /* 67 */ return menuList;
   /*    */ }
 /*     */ public Page list(int pageNo, int pageSize, String order, String search) {
   /* 404 */ Integer userid = EopContext.getContext().getCurrentSite().getUserid();
   /* 405 */ List listdomain = this.domainManager.listUserDomain();
   /* 406 */ if (search == null) /* 407 */ search = "";
   /*     */ else /* 409 */ search = " and sitename like '%" + search + "%'";
   /* 410 */ if (order == null) /* 411 */ order = "";
   /*     */ else {
     /* 413 */ order = " order by " + order.replace(":", " ");
     /*     */ }
   /* 415 */ Page page =
       this.daoSupport.queryForPage(
           "select * from eop_site where deleteflag = 0 and userid = " + userid + search + order,
           pageNo,
           pageSize,
           new Object[0]);
   /*     */
   /* 419 */ List listsite = (List) (List) page.getResult();
   /*     */
   /* 421 */ for (Map site : listsite) {
     /* 422 */ List domainList = new ArrayList();
     /* 423 */ String logofile = site.get("logofile").toString();
     /* 424 */ if (logofile != null) {
       /* 425 */ logofile =
           logofile.replaceAll(
               EopSetting.FILE_STORE_PREFIX,
               EopSetting.IMG_SERVER_DOMAIN
                   + "/user/"
                   + site.get("userid").toString()
                   + "/"
                   + site.get("id").toString());
       /*     */ }
     /*     */
     /* 429 */ site.put("logofile", logofile);
     /* 430 */ for (EopSiteDomain siteDomain : listdomain) {
       /* 431 */ if (site.get("id").toString().equals(siteDomain.getSiteid().toString()))
       /*     */ {
         /* 433 */ domainList.add(siteDomain);
         /*     */ }
       /*     */ }
     /* 436 */ site.put("eopSiteDomainList", domainList);
     /*     */ }
   /*     */
   /* 439 */ return page;
   /*     */ }
Beispiel #22
0
  /**
   * 还原
   *
   * @return
   */
  public String restore() {
    try {
      String productid = "temp_" + System.currentTimeMillis();

      String zipPath =
          EopSetting.IMG_SERVER_PATH
              + EopContext.getContext().getContextPath()
              + "/backup/"
              + name
              + ".zip";

      this.solutionImporter.imported(productid, zipPath, true);
      this.json = "{result:1}";
    } catch (Exception e) {
      e.printStackTrace();
      this.json = "{result:0}";
    }
    return this.JSON_MESSAGE;
  }
 /*     */ public int getPoint(Integer id, int point) /*     */ {
   /* 489 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 490 */ long lastgetpoint = site.getLastgetpoint();
   /* 491 */ long now = (int) (System.currentTimeMillis() / 1000L);
   /* 492 */ int onemonth = 2592000;
   /* 493 */ if (now - lastgetpoint > onemonth) {
     /* 494 */ this.daoSupport.execute(
         "update eop_site set point=point+? where id=?",
         new Object[] {Integer.valueOf(point), id});
     /*     */
     /* 496 */ site.setPoint(site.getPoint() + point);
     /* 497 */ site.setLastgetpoint(DateUtil.getDateline());
     /* 498 */ this.daoSupport.execute(
         "update eop_site set lastgetpoint=? where id=?",
         new Object[] {Integer.valueOf(DateUtil.getDateline()), id});
     /*     */
     /* 502 */ return 1;
     /*     */ }
   /* 504 */ return 0;
   /*     */ }
Beispiel #24
0
  public String addDomainSave() throws Exception {
    Integer userid = EopContext.getContext().getCurrentSite().getUserid();
    eopSiteDomain = new EopSiteDomain();
    eopSiteDomain.setUserid(userid);
    eopSiteDomain.setDomain(sitedomain);
    eopSiteDomain.setSiteid(siteid);
    int result = -1;
    try {
      result = siteManager.addDomain(eopSiteDomain);
    } catch (RuntimeException e) {
      this.json = "{result:0,message:'" + e.getMessage() + "'}";
      return this.JSON_MESSAGE;
    }

    if (result > 0) {
      this.json = "{result:1,message:'增加成功'}";
    } else {
      this.json = "{result:0,message:'新增域名失败'}";
    }
    return JSON_MESSAGE;
  }
 /*     */ private List<EopApp> listSaasApp() /*     */ {
   /* 602 */ List appList = new ArrayList();
   /*     */
   /* 604 */ String xmlFile =
       EopSetting.EOP_PATH + EopContext.getContext().getContextPath() + "/profile.xml";
   /* 605 */ if (new File(xmlFile).exists()) {
     /*     */ try
     /*     */ {
       /* 608 */ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
       /*     */
       /* 610 */ DocumentBuilder builder = factory.newDocumentBuilder();
       /* 611 */ org.w3c.dom.Document document = builder.parse(xmlFile);
       /* 612 */ NodeList nodeList = document.getElementsByTagName("apps");
       /* 613 */ if (nodeList != null)
       /*     */ {
         /* 615 */ Node appsNode = nodeList.item(0);
         /* 616 */ NodeList appNodeList = appsNode.getChildNodes();
         /*     */
         /* 619 */ int i = 0;
         for (int len = appNodeList.getLength(); i < len; i++) {
           /* 620 */ Node node = appNodeList.item(i);
           /* 621 */ if (node.getNodeType() == 1) {
             /* 622 */ org.w3c.dom.Element appNode = (org.w3c.dom.Element) node;
             /* 623 */ EopApp eopApp = new EopApp();
             /* 624 */ eopApp.setAppid(appNode.getAttribute("id"));
             /* 625 */ eopApp.setVersion(appNode.getAttribute("version"));
             /* 626 */ appList.add(eopApp);
             /*     */ }
           /*     */ }
         /*     */ }
       /*     */
       /* 631 */ return appList;
       /*     */ }
     /*     */ catch (Exception e) {
       /* 634 */ e.printStackTrace();
       /* 635 */ throw new RuntimeException("加载本站点根目录的profile.xml失败,不能导出。");
       /*     */ }
     /*     */ }
   /* 638 */ throw new RuntimeException("本站点根目录下未含有profile.xml,不能导出。");
   /*     */ }
Beispiel #26
0
  public String changeDefaultSite() throws Exception {
    Integer userid = EopContext.getContext().getCurrentSite().getUserid();
    userManager.changeDefaultSite(userid, managerid, id);

    return this.MESSAGE;
  }
 /*    */ public String base() /*    */ {
   /* 22 */ this.site = EopContext.getContext().getCurrentSite();
   /* 23 */ return "base";
   /*    */ }
 /*    */ private void cleanCache() /*    */ {
   /* 21 */ EopSite site = EopContext.getContext().getCurrentSite();
   /* 22 */ this.cache.remove("siteMenuList_" + site.getUserid() + "_" + site.getId());
   /*    */ }