public void findDefaultAllTemplateset() {
   int currentPage = page;
   int lineSize = rp;
   total = this.getTemplatesetTService().countfindAllTemplatesetT(BaseTools.adminCreateId());
   List<TemplatesetT> list =
       this.getTemplatesetTService()
           .findAllTemplatesetT(currentPage, lineSize, BaseTools.adminCreateId());
   if (!list.isEmpty()) {
     this.ProcessTemplatesetTlist(list);
   }
 }
 /**
  * 增加虚拟评论
  *
  * @return
  */
 @Action(
     value = "addvirtualGoodsComment",
     results = {@Result(name = "json", type = "json")})
 public String addvirtualGoodsComment() {
   if (StringUtils.isBlank(this.getGoodsid())) {
     return "json";
   }
   GoodsCommentT gct = new GoodsCommentT();
   gct.setCommentid(this.getSerial().Serialid(Serial.GOODSCOMMENT));
   gct.setGoodsid(this.getGoodsid().trim());
   gct.setGoodsname(this.getGoodsname().trim());
   gct.setReplyorcommentusername(this.getReplyorcommentusername());
   gct.setReplyorcommentuserid(BaseTools.adminCreateId());
   gct.setPosttime(BaseTools.systemtime());
   gct.setCommentcontent(this.getCommentcontent());
   gct.setScore(this.getScore());
   gct.setState(StaticKey.COMMENT_STATE_ONE_NUM);
   gct.setReplyorcomment(StaticKey.COMMENT_REPLY_TWO_NUM);
   gct.setReplyid(StaticKey.COMMENT_DEFAULT_REPLYID);
   gct.setEmailable(StaticKey.COMMENT_EMAILABLE_ONE_NUM);
   gct.setVirtualadd(StaticKey.COMMENT_VIRTUALADD_ONE_NUM);
   this.getGoodsCommentTService().save(gct);
   this.setSucflag(true);
   return "json";
 }
  /**
   * 更新模板文件和系统内容设定
   *
   * @return
   */
  @Action(
      value = "updateTemplatesetT",
      results = {@Result(name = "json", type = "json")})
  public String updateTemplatesetT() {

    TemplatesetT tst = new TemplatesetT();
    tst.setTsid(this.getTsid());
    tst.setTemplateurl(this.getTemplateurl());
    tst.setSystemcontent(this.getSystemcontent().trim());
    tst.setBuildhtmlpath(this.getBuildhtmlpath());
    tst.setCreatetime(BaseTools.systemtime());
    tst.setCreatorid(BaseTools.adminCreateId());
    tst.setSign(this.getSign());
    // 获取模板主题和状态
    TemplateT tt = new TemplateT();
    tt = this.getTemplateTService().findTemplateBysign(this.getSign(), "1");
    if (tt != null) {
      tst.setThemeid(tt.getThemeid());
      tst.setThemename(tt.getThemename());
      tst.setStatus(tt.getStatus());
    }
    if (this.getTemplatesetTService().updateTemplatesetT(tst) > 0) {
      this.setSucflag(true);
      return "json";
    }
    this.setSucflag(false);
    return "json";
  }
 public void findDefaultAllSiteNavigation() {
   int currentPage = page;
   int lineSize = rp;
   total = this.getSiteNavigationTService().countfindAllSiteNavigationT(BaseTools.adminCreateId());
   if (Validate.StrNotNull(getSortname()) && Validate.StrNotNull(getSortorder())) {
     String queryString =
         "from SiteNavigationT as st where st.creatorid=:creatorid order by "
             + getSortname()
             + " "
             + getSortorder()
             + "";
     List<SiteNavigationT> list =
         this.getSiteNavigationTService()
             .sortAllSiteNavigationT(
                 currentPage, lineSize, BaseTools.adminCreateId(), queryString);
     if (list != null) {
       this.ProcessSiteNavigationList(list);
     }
   }
 }
 /**
  * 更新商品类型
  *
  * @return
  */
 @Action(
     value = "updateGoodsTypeTN",
     results = {@Result(name = "json", type = "json")})
 public String updateGoodsTypeTN() {
   GoodsTypeTN gtn = new GoodsTypeTN();
   gtn.setGoodsTypeId(this.getGoodsTypeId().trim());
   gtn.setName(this.getName());
   gtn.setCreatetime(BaseTools.systemtime());
   gtn.setCreatorid(BaseTools.adminCreateId());
   gtn.setGoodsParameter(this.getGoodsParameter());
   @SuppressWarnings("unused")
   int i = this.getGoodsTypeTNService().updateGoodsTypeTN(gtn);
   this.setSucflag(true);
   return "json";
 }
 /**
  * 更新商品评论
  *
  * @return
  */
 @Action(
     value = "updateGoodsComment",
     results = {@Result(name = "json", type = "json")})
 public String updateGoodsComment() {
   if (StringUtils.isBlank(this.getCommentid())) {
     return "json";
   }
   bean = this.getGoodsCommentTService().findGoodsCommentById(this.getCommentid());
   bean.setReplyorcommentusername(this.getReplyorcommentusername());
   bean.setReplyorcommentuserid(BaseTools.adminCreateId());
   bean.setCommentcontent(this.getCommentcontent());
   bean.setScore(this.getScore());
   this.getGoodsCommentTService().updateGoodsComment(bean);
   // this.setSucflag(true);
   return "json";
 }
 /** 获取所有模板文件路径 */
 @Action(
     value = "getAllTemplate",
     results = {@Result(name = "json", type = "json")})
 public String getAllTemplate() {
   List<TemplateT> list =
       this.getTemplateTService().findAllTemplateWithNoParam(BaseTools.adminCreateId(), "1");
   if (list != null) {
     this.setTemplatestrs("");
     this.setTemplatestrs("<option value='-1'>---请选择---</option>");
     for (Iterator<TemplateT> it = list.iterator(); it.hasNext(); ) {
       TemplateT tt = (TemplateT) it.next();
       this.templatestrs +=
           "<option value='" + tt.getUrl() + "," + tt.getSign() + "'>" + tt.getUrl() + "</option>";
     }
     this.setSucflag(true);
     return "json";
   }
   this.setSucflag(false);
   return "json";
 }
  /**
   * 增加导航
   *
   * @return
   */
  @Action(
      value = "addSiteNavigationT",
      results = {@Result(name = "json", type = "json")})
  public String addSiteNavigationT() {

    SiteNavigationT sn = new SiteNavigationT();
    sn.setSnid(this.getSerial().Serialid(Serial.SITENAVIGATION));
    sn.setIsTargetBlank(this.getIsTargetBlank());
    sn.setIsVisible(this.getIsVisible());
    sn.setName(this.getName());
    sn.setPosition(this.getPosition());
    sn.setCreatetime(BaseTools.systemtime());
    sn.setCreatorid(BaseTools.adminCreateId());
    sn.setHtmlPath(this.getHtmlPath());
    sn.setSort(Integer.parseInt(this.getSort()));
    sn.setSign(this.getSign());
    this.getSiteNavigationTService().save(sn);
    // 这里需要对应模板生成静态页面
    this.setSucflag(true);
    return "json";
  }
 /**
  * 增加商品类型
  *
  * @return
  */
 @Action(
     value = "addGoodsTypeTN",
     results = {@Result(name = "json", type = "json")})
 public String addGoodsTypeTN() {
   if (Validate.StrisNull(this.getName())) {
     this.setSucflag(true);
     return "json";
   }
   List<GoodsTypeTN> list = this.getGoodsTypeTNService().findGoodsTypeTNByName(this.getName());
   if (list.isEmpty()) {
     GoodsTypeTN gtn = new GoodsTypeTN();
     gtn.setGoodsTypeId(this.getSerial().Serialid(Serial.GOODSTYPE));
     gtn.setName(this.getName().trim());
     gtn.setCreatetime(BaseTools.systemtime());
     gtn.setCreatorid(BaseTools.adminCreateId());
     gtn.setGoodsParameter(this.getGoodsParameter());
     this.getGoodsTypeTNService().save(gtn);
     this.setSucflag(true);
     return "json";
   }
   return "json";
 }
 /**
  * 更新导航
  *
  * @return
  */
 @Action(
     value = "updateSiteNavigationT",
     results = {@Result(name = "json", type = "json")})
 public String updateSiteNavigationT() {
   SiteNavigationT sn = new SiteNavigationT();
   sn.setSnid(this.getSnid());
   sn.setIsTargetBlank(this.getIsTargetBlank());
   sn.setIsVisible(this.getIsVisible());
   sn.setName(this.getName());
   sn.setPosition(this.getPosition());
   sn.setCreatetime(BaseTools.systemtime());
   sn.setCreatorid(BaseTools.adminCreateId());
   sn.setHtmlPath(this.getHtmlPath());
   sn.setSort(Integer.parseInt(this.getSort()));
   sn.setSign(this.getSign());
   if (this.getSiteNavigationTService().updateSiteNavigationT(sn) > 0) {
     // 更新模板页面数据
     this.setSucflag(true);
     return "json";
   }
   this.setSucflag(false);
   return "json";
 }
  /**
   * 更新商品参数
   *
   * @return
   */
  @Action(
      value = "updateGoodsAttributeT",
      results = {@Result(name = "json", type = "json")})
  public String updateGoodsAttributeT() {
    JSONArray ja = (JSONArray) JSONValue.parse(this.getRjson());
    int jsonsize = ja.size();
    GoodsAttributeT gat = new GoodsAttributeT();
    for (int i = 0; i < jsonsize; i++) {
      gat.setCreatetime(BaseTools.systemtime());
      gat.setState(StaticKey.ONE);
      gat.setCreatorid(BaseTools.adminCreateId());
      gat.setGoodsTypeId(this.getGoodsTypeId());
      gat.setGoodsTypeName(this.getGoodsTypeName());
      gat.setAttributeIndex(this.getAttributeIndex());
      JSONObject jo = (JSONObject) ja.get(i);

      gat.setGoodsattributename(jo.get(StaticKey.GOODSATTRIBUTENAME).toString());

      gat.setAttributeType(jo.get(StaticKey.ATTRIBUTETYPE).toString());

      gat.setAttributelist(jo.get(StaticKey.ATTRIBUTELIST).toString());

      gat.setSort(jo.get(StaticKey.SORT).toString());

      gat.setGoodsattributeid(jo.get(StaticKey.GOODSATTRIBUTEID).toString());

      if (gat.getGoodsattributeid().length() == 0) {
        gat.setGoodsattributeid(this.getSerial().Serialid(Serial.GOODSATTRIBUTE));
        this.getGoodsAttributeTService().save(gat);
      } else {
        this.getGoodsAttributeTService().updateGoodsAttributeT(gat);
      }
    }
    this.setSucflag(true);
    return "json";
  }
  /**
   * 获取模板文件和系统内容的输出路径
   *
   * @return
   */
  @Action(
      value = "getTemplateOutHtmlPath",
      results = {@Result(name = "json", type = "json")})
  public String getTemplateOutHtmlPath() {

    List<TemplatesetT> list =
        this.getTemplatesetTService().findAllTemplatesetWithNoParam(BaseTools.adminCreateId());
    if (list != null) {
      this.setTemplatesetstrs("<option value='-1'>---请选择---</option>");
      for (Iterator<TemplatesetT> it = list.iterator(); it.hasNext(); ) {
        TemplatesetT tst = (TemplatesetT) it.next();
        this.templatesetstrs +=
            "<option value='"
                + tst.getBuildhtmlpath()
                + "'>"
                + tst.getSystemcontent()
                + "</option>";
      }
      this.setSucflag(true);
      return "json";
    }
    this.setSucflag(false);
    return "json";
  }
 /**
  * 获取系统内容,包含文章分类,和商品分类的预先读取,可能还有更多的内容,或许会做一个更加多选的页面来描述系统内容,让后绑定模板
  *
  * @return
  */
 @Action(
     value = "findSystemcontent",
     results = {@Result(name = "json", type = "json")})
 public String findSystemcontent() {
   List<GoodsCategoryT> gclist =
       this.getGoodsCategoryTService().findAllGoodsCategoryBycreatorid(BaseTools.adminCreateId());
   List<ArticleCategoryT> aclist =
       this.getArticleCategoryTService()
           .findAllArticleCategoryBycreatorid(BaseTools.adminCreateId());
   // 组织商品分类的所有信息
   this.setSyscontentstrs("");
   this.setSyscontentstrs(
       "<option value='-1'>---请选择---</option><option value='0'>--自定义系统内容--</option><option value='1'>--以下是所创建的商品分类--</option>");
   if (!gclist.isEmpty()) {
     for (Iterator<GoodsCategoryT> it = gclist.iterator(); it.hasNext(); ) {
       GoodsCategoryT gct = (GoodsCategoryT) it.next();
       if (gct.getGrade().equals("0")) {
         this.syscontentstrs +=
             "<option value='"
                 + gct.getGoodsCategoryTid()
                 + ","
                 + gct.getSign()
                 + "'>"
                 + gct.getName()
                 + "</option>";
       } else if (gct.getGrade().equals("1")) {
         this.syscontentstrs +=
             "<option value='"
                 + gct.getGoodsCategoryTid()
                 + ","
                 + gct.getSign()
                 + "'>&nbsp;&nbsp;"
                 + gct.getName()
                 + "</option>";
       } else {
         this.syscontentstrs +=
             "<option value='"
                 + gct.getGoodsCategoryTid()
                 + ","
                 + gct.getSign()
                 + "'>&nbsp;&nbsp;&nbsp;"
                 + gct.getName()
                 + "</option>";
       }
     }
   }
   if (!aclist.isEmpty()) {
     this.syscontentstrs += "<option value='2'>--以下是所创建的文章分类--</option>";
     for (Iterator<ArticleCategoryT> it = aclist.iterator(); it.hasNext(); ) {
       ArticleCategoryT act = (ArticleCategoryT) it.next();
       if (act.getGrade().equals("0")) {
         this.syscontentstrs +=
             "<option value='"
                 + act.getArticleCategoryTid()
                 + ","
                 + act.getSign()
                 + "'>"
                 + act.getName()
                 + "</option>";
       } else if (act.getGrade().equals("1")) {
         this.syscontentstrs +=
             "<option value='"
                 + act.getArticleCategoryTid()
                 + ","
                 + act.getSign()
                 + "'>&nbsp;&nbsp;"
                 + act.getName()
                 + "</option>";
       } else {
         this.syscontentstrs +=
             "<option value='"
                 + act.getArticleCategoryTid()
                 + ","
                 + act.getSign()
                 + "'>&nbsp;&nbsp;&nbsp;"
                 + act.getName()
                 + "</option>";
       }
     }
   }
   this.setSucflag(true);
   return "json";
 }