예제 #1
0
 public List getMyWebSiteStyleList(HttpServletRequest request) throws AjClientException {
   ServerUserEx user = (ServerUserEx) new AjAccount().validateUserState(request, null);
   AdsWebsiteStyle siteStyle = new AdsWebsiteStyle();
   siteStyle.setCmId(user.getMember().getId());
   try {
     List list = this.findObjectByExample(DB_POOL_COMMON, siteStyle);
     return list;
   } catch (Exception e) {
     Global.getServerLog().error("读取配置列表失败!参数信息[" + user.getMember().getId() + "]");
     throw new AjClientException(AJ_ERROR_CODE_SERVER_ISBUSY);
   }
 }
예제 #2
0
  public void saveMySiteStyle(AdsWebsiteStyle siteStyle, HttpServletRequest request)
      throws AjClientException {
    ServerUserEx user = (ServerUserEx) new AjAccount().validateUserState(request, null);
    try {

      this.getDBPool(DB_POOL_COMMON).getHibernateTemplate().update(siteStyle);
    } catch (Exception e) {
      Global.getServerLog()
          .error("保存样式发生错误!参数信息:[" + user.getMember().getId() + "," + siteStyle.getId() + "]");
      throw new AjClientException(AJ_ERROR_CODE_SERVER_ISBUSY);
    }
  }
예제 #3
0
  public int createDefaultStyle(
      final int siteId, boolean isMultimedia, String fileType, HttpServletRequest request)
      throws AjClientException {
    ServerUserEx user = (ServerUserEx) new AjAccount().validateUserState(request, null);
    try {
      final AdsWebsiteStyle siteStyle = new AdsWebsiteStyle();

      siteStyle.setAdCount(10);
      siteStyle.setAdCountNext(10);
      siteStyle.setAdPrice(30f);
      siteStyle.setAdPriceNext(30f);
      siteStyle.setCmId(user.getMember().getId());
      siteStyle.setFileType(fileType);
      siteStyle.setIsMultimedia(isMultimedia);
      siteStyle.setSiteId(siteId);
      siteStyle.setStyleBgColor("#FFFFFF");
      siteStyle.setStyleContextColor("#000000");
      siteStyle.setStyleContextLength(120);
      siteStyle.setStyleContextSize(12);
      siteStyle.setStyleDescription("默认介绍");
      siteStyle.setStyleHeight(150);
      siteStyle.setStyleLinkColor("#000000");
      siteStyle.setStyleLinkSize(12);
      siteStyle.setStyleTitle("默认标题");
      siteStyle.setStyleTitleColor("#000000");
      siteStyle.setStyleTitleLength(20);
      siteStyle.setStyleTitleSize(12);
      siteStyle.setStyleWidth(200);

      final AdsWebsiteInfo siteInfo = new AdsWebsiteInfo();
      siteInfo.setAdsCount(0);

      siteInfo.setAdsTotalCount(0);
      siteInfo.setAdsTotalIncome(0f);
      siteInfo.setCmId(user.getMember().getId());
      siteInfo.setSiteId(siteId);
      this.getIDBDao()
          .transactionFunction(
              new IDBFunction() {
                public void doTransactionFunction() throws Exception {
                  HibernateTemplate accountTemplate =
                      getDBPool(DB_POOL_COMMON).getHibernateTemplate();
                  siteStyle.setStyleCode("");
                  accountTemplate.save(siteStyle);
                  siteStyle.setStyleCode(
                      Global.encode(siteId + ENCODE_TOKEN_STRING + siteStyle.getId()));
                  siteInfo.setAdsStyleId(siteStyle.getId());
                  accountTemplate.save(siteInfo);
                  accountTemplate.flush();
                }
              });
      return siteStyle.getId();
    } catch (Exception e) {
      Global.getServerLog()
          .error(
              "创建样式发生错误!参数信息:["
                  + user.getMember().getId()
                  + ","
                  + isMultimedia
                  + ",("
                  + fileType
                  + ")"
                  + "]");
      throw new AjClientException(AJ_ERROR_CODE_SERVER_ISBUSY);
    }
  }