Beispiel #1
0
  public String editSave() throws Exception {
    if (cologo != null) {
      String logo = UploadUtil.upload(cologo, cologoFileName, "user");
      eopSite.setLogofile(logo);
    }

    if (ico != null) {
      String icoPath = UploadUtil.upload(ico, icoFileName, "user");
      eopSite.setIcofile(icoPath);
    }

    if (bklogo != null) {
      String logo = UploadUtil.upload(bklogo, bklogoFileName, "user");
      eopSite.setBklogofile(logo);
    }

    if (bkloginpic != null) {
      String loginpic = UploadUtil.upload(bkloginpic, bkloginpicFileName, "user");
      eopSite.setBkloginpicfile(loginpic);
    }

    eopSite.setQq(eopSite.getQq() == null ? 0 : eopSite.getQq());
    eopSite.setMsn(eopSite.getMsn() == null ? 0 : eopSite.getMsn());
    eopSite.setWw(eopSite.getWw() == null ? 0 : eopSite.getWw());
    eopSite.setTel(eopSite.getTel() == null ? 0 : eopSite.getTel());
    eopSite.setWt(eopSite.getWt() == null ? 0 : eopSite.getWt());

    siteManager.edit(eopSite);

    this.msgs.add("修改成功");
    this.urls.put("我的站点", "userSite!edit.do");

    return this.MESSAGE;
  }
  public void execute(
      Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body)
      throws TemplateException, IOException {

    String pic = params.get("pic").toString();
    if (StringUtil.isEmpty(pic))
      pic = "http://" + EopSetting.IMG_SERVER_DOMAIN + "/images/no_picture.jpg";
    if (pic.startsWith("fs:")) {
      pic = UploadUtil.replacePath(pic);
    }
    String postfix = params.get("postfix").toString();
    env.getOut().write(UploadUtil.getThumbPath(pic, postfix));
  }
 /**
  * 覆写父的数据显示响应事件<br>
  * 逻辑为直接返回字段值<br>
  * 如果为null返回空串
  */
 @Override
 public Object onShow(DataField field, Object value) {
   if (value != null) {
     value = UploadUtil.replacePath(value.toString());
     return value;
   } else return "";
 }
 /*     */ public EopSite get(Integer id) /*     */ {
   /* 298 */ String sql = "select * from eop_site where  id = ?";
   /* 299 */ EopSite site =
       (EopSite) this.daoSupport.queryForObject(sql, EopSite.class, new Object[] {id});
   /* 300 */ String icofile = site.getIcofile();
   /* 301 */ if (icofile != null) /* 302 */ icofile = UploadUtil.replacePath(icofile);
   /* 303 */ site.setIcofile(icofile);
   /*     */
   /* 305 */ String logofile = site.getLogofile();
   /* 306 */ if (logofile != null) {
     /* 307 */ logofile = logofile.replaceAll(EopSetting.FILE_STORE_PREFIX, getContext(site));
     /*     */ }
   /* 309 */ site.setLogofile(logofile);
   /*     */
   /* 311 */ String bklogofile = site.getBklogofile();
   /* 312 */ if (bklogofile != null) {
     /* 313 */ bklogofile = bklogofile.replaceAll(EopSetting.FILE_STORE_PREFIX, getContext(site));
     /*     */ }
   /*     */
   /* 316 */ site.setBklogofile(bklogofile);
   /*     */
   /* 318 */ String bkloginpicfile = site.getBkloginpicfile();
   /* 319 */ if (bkloginpicfile != null) {
     /* 320 */ bkloginpicfile =
         bkloginpicfile.replaceAll(EopSetting.FILE_STORE_PREFIX, getContext(site));
     /*     */ }
   /*     */
   /* 323 */ site.setBkloginpicfile(bkloginpicfile);
   /* 324 */ return site;
   /*     */ }
Beispiel #5
0
 public Adv getAdvDetail(Long advid) {
   Adv adv =
       this.baseDaoSupport.queryForObject("select * from adv where aid = ?", Adv.class, advid);
   String pic = adv.getAtturl();
   if (pic != null) {
     pic = UploadUtil.replacePath(pic);
     adv.setAtturl(pic);
   }
   return adv;
 }
 /*    */ public Map get(Integer valueId) /*    */ {
   /* 44 */ String sql =
       "select sv.*,s.spec_type from "
           + getTableName("spec_values")
           + " sv,"
           + getTableName("specification")
           + " s  where sv.spec_id=s.spec_id and sv.spec_value_id =?";
   /* 45 */ Map temp = this.daoSupport.queryForMap(sql, new Object[] {valueId});
   /* 46 */ String spec_image = (String) temp.get("spec_image");
   /* 47 */ if (spec_image != null) {
     /* 48 */ spec_image = UploadUtil.replacePath(spec_image);
     /*    */ }
   /* 50 */ temp.put("spec_image", spec_image);
   /* 51 */ return temp;
   /*    */ }
Beispiel #7
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 #8
0
  public Object mapRow(ResultSet rs, int rowNum) throws SQLException {

    CartItem cartItem = new CartItem();
    cartItem.setId(rs.getInt("cart_id"));
    cartItem.setProduct_id(rs.getInt("product_id"));
    cartItem.setGoods_id(rs.getInt("goods_id"));
    cartItem.setName(rs.getString("name"));
    cartItem.setMktprice(rs.getDouble("mktprice"));
    cartItem.setPrice(rs.getDouble("price"));
    cartItem.setCoupPrice(rs.getDouble("price")); // 优惠价格默认为销售价,则优惠规则去改变
    //	cartItem.setCatid(rs.getInt("catid"));

    String image_default = rs.getString("image_default");

    if (image_default != null) {
      image_default = UploadUtil.replacePath(image_default);
    }
    cartItem.setImage_default(image_default);
    cartItem.setNum(rs.getInt("num"));
    cartItem.setPoint(rs.getInt("point"));
    cartItem.setItemtype(rs.getInt("itemtype"));
    if (cartItem.getItemtype().intValue() == 0) {
      cartItem.setAddon(rs.getString("addon"));
    }
    // 赠品设置其限购数量
    if (cartItem.getItemtype().intValue() == 2) {
      cartItem.setLimitnum(rs.getInt("limitnum"));
    }

    if (cartItem.getItemtype().intValue() == 1) {
      cartItem.setSn(rs.getString("sn"));
    }

    if (cartItem.getItemtype().intValue() == 0) {
      String specs = rs.getString("specs");
      cartItem.setSpecs(specs);
      if (StringUtil.isEmpty(specs)) cartItem.setName(cartItem.getName());
      else cartItem.setName(cartItem.getName() + "(" + specs + ")");
    }

    return cartItem;
  }
  @Override
  public String onDisplay(DataField field, Object value) {
    StringBuffer html = new StringBuffer();
    html.append(
        "<textarea id=\""
            + field.getEnglish_name()
            + "\" name=\""
            + field.getEnglish_name()
            + "\">");
    if (value != null) {
      value = UploadUtil.replacePath(value.toString());
      html.append(value);
    }
    html.append("</textarea>");
    html.append("<script type=\"text/javascript\">");
    html.append("$('#" + field.getEnglish_name() + "' ).ckeditor( );");
    html.append("</script>");

    return html.toString();
  }
 /*     */ private DataLog createDataLog(Map goods) /*     */ {
   /*  52 */ DataLog datalog = new DataLog();
   /*  53 */ datalog.setContent("商品名:" + goods.get("name") + "<br>" + "描述:" + goods.get("intro"));
   /*  54 */ String image_file = (String) goods.get("image_file");
   /*     */
   /*  56 */ StringBuffer pics = new StringBuffer();
   /*  57 */ if (!StringUtil.isEmpty(image_file)) {
     /*  58 */ String[] files = StringUtils.split(image_file, ",");
     /*  59 */ for (String file : files) {
       /*  60 */ if (pics.length() > 0) /*  61 */ pics.append(",");
       /*  62 */ pics.append(UploadUtil.getThumbPath(file, "_thumbnail"));
       /*  63 */ pics.append("|");
       /*  64 */ pics.append(file);
       /*     */ }
     /*     */ }
   /*     */
   /*  68 */ datalog.setPics(pics.toString());
   /*  69 */ datalog.setLogtype("商品");
   /*  70 */ datalog.setOptype("添加");
   /*  71 */ datalog.setUrl("/goods-" + goods.get("goods_id") + ".html");
   /*     */
   /*  73 */ return datalog;
   /*     */ }
 /*     */ public String getEditHtml(Map goods, HttpServletRequest request) /*     */ {
   /*  48 */ String contextPath = request.getContextPath();
   /*     */
   /*  50 */ FreeMarkerPaser freeMarkerPaser = FreeMarkerPaser.getInstance();
   /*     */
   /*  53 */ String image_default = null;
   /*  54 */ if ((goods.get("image_file") != null) && (goods.get("image_file") != "")) {
     /*  55 */ String image_file = goods.get("image_file").toString();
     /*  56 */ String[] thumbnail_images = StringUtils.split(image_file, ",");
     /*     */
     /*  58 */ image_default = (String) goods.get("image_default");
     /*  59 */ if (!StringUtil.isEmpty(image_default)) {
       /*  60 */ image_default = UploadUtil.replacePath(image_default);
       /*     */ }
     /*     */
     /*  64 */ freeMarkerPaser.putData("ctx", contextPath);
     /*  65 */ freeMarkerPaser.putData("image_default", image_default);
     /*  66 */ freeMarkerPaser.putData("thumbnail_images", thumbnail_images);
     /*     */ }
   /*     */
   /*  69 */ freeMarkerPaser.setPageName("album");
   /*  70 */ String html = freeMarkerPaser.proessPageContent();
   /*  71 */ return html;
   /*     */ }