Ejemplo n.º 1
0
 /*     */ public Integer add(EopUser user, EopSite site, String domain) {
   /*  86 */ int userid = user.getId().intValue();
   /*  87 */ site.setUserid(Integer.valueOf(userid));
   /*     */
   /*  89 */ if (site.getIcofile() == null) {
     /*  90 */ site.setIcofile(EopSetting.IMG_SERVER_DOMAIN + "/images/default/favicon.ico");
     /*     */ }
   /*  92 */ if (site.getLogofile() == null) {
     /*  93 */ site.setLogofile(EopSetting.IMG_SERVER_DOMAIN + "/images/default/logo.gif");
     /*     */ }
   /*     */
   /*  96 */ site.setPoint(1000);
   /*     */
   /*  99 */ site.setCreatetime(Long.valueOf(DateUtil.getDateline()));
   /* 100 */ site.setLastlogin(Long.valueOf(0L));
   /* 101 */ site.setLastgetpoint(DateUtil.getDateline());
   /*     */
   /* 104 */ this.daoSupport.insert("eop_site", site);
   /* 105 */ Integer siteid = Integer.valueOf(this.daoSupport.getLastId("eop_site"));
   /*     */
   /* 107 */ EopSiteDomain eopSiteDomain = new EopSiteDomain();
   /* 108 */ eopSiteDomain.setDomain(domain);
   /* 109 */ eopSiteDomain.setSiteid(siteid);
   /* 110 */ eopSiteDomain.setUserid(Integer.valueOf(userid));
   /*     */
   /* 113 */ addDomain(eopSiteDomain);
   /*     */
   /* 115 */ return siteid;
   /*     */ }
Ejemplo n.º 2
0
 /*     */ @Transactional(propagation = Propagation.REQUIRED)
 /*     */ public int addDomain(EopSiteDomain eopSiteDomain) /*     */ {
   /*  66 */ if (checkInDomain(eopSiteDomain.getDomain()).booleanValue()) {
     /*  67 */ throw new IllegalArgumentException("域名[" + eopSiteDomain.getDomain() + "]已存在!");
     /*     */ }
   /*     */
   /*  70 */ this.daoSupport.insert("eop_sitedomain", eopSiteDomain);
   /*  71 */ return this.daoSupport.getLastId("eop_sitedomain");
   /*     */ }
Ejemplo n.º 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("创建主题出错");
    }
  }
Ejemplo n.º 4
0
 /*     */ @Transactional(propagation = Propagation.REQUIRED)
 /*     */ public void deleteDomain(Integer domainid) {
   /* 131 */ EopSiteDomain domain = this.domainManager.get(domainid);
   /* 132 */ UserUtil.validUser(domain.getUserid());
   /* 133 */ int domainCount = this.domainManager.getDomainCount(domain.getSiteid());
   /* 134 */ if (domainCount <= 1) {
     /* 135 */ throw new RuntimeException("此站点只有一个域名不可删除,删除后将不可访问");
     /*     */ }
   /* 137 */ String sql = "delete from eop_sitedomain where id=?";
   /* 138 */ this.daoSupport.execute(sql, new Object[] {domainid});
   /*     */ }
Ejemplo n.º 5
0
 /*     */ 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;
   /*     */ }
Ejemplo n.º 6
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;
  }
Ejemplo n.º 7
0
  public String editdomain() throws Exception {
    if (statusid == 0) {
      statusid = 1;
    } else {
      statusid = 0;
    }

    eopSiteDomain = new EopSiteDomain();
    eopSiteDomain.setStatus(statusid);
    eopSiteDomain.setId(domainid);

    try {
      this.domainManager.edit(eopSiteDomain);
      this.json = "{result:1,message:'修改成功'}";
    } catch (RuntimeException e) {
      //			this.logger.error(e.getStackTrace());
      this.json = "{result:0,message:'修改失败'}";
    }

    return this.JSON_MESSAGE;
  }