Examples of ProductImage


Examples of com.lgx8.common.entities.ProductImage

                       String[] names = name.split("\\"+System.getProperty("file.separator"));
                       name = names[names.length-1];
                       names = name.split("\\.");
                       name = names[names.length-2];
                      
                       ProductImage productImage = new ProductImage();
                       productImage.setDate(new Date());
                       productImage.setDescription(name);
                      
                       name = productImage.getDate().getTime()+"";
                       productImage.setName(name);
                      
                       String uploadPath = ImageUtils.getUploadPath();
                       String sourcePath = uploadPath + System.getProperty("file.separator") + name+".jpg";
                   
                    item.write(new File(sourcePath))
                   
                    String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setSourceURL(sourcePath);
                    
                     
                      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
                      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
                      gatewayService.createProductImage(productImage);
                     
                      GatewayConfig gatewayConfig = (GatewayConfig) getServletContext().getAttribute("gatewayConfig");
                     
                      PrintWriter out = response.getWriter();
                     
                      String fileUrl = gatewayConfig.getUrl()+"/"+productImage.getSourceURL();
                      //CKEditorFuncNum就是在提交上传文件的同时传递到后台的request内容,表明应该插入到编辑器中的位置
                      String callback = request.getParameter("CKEditorFuncNum");
                      out.println("<script type=\"text/javascript\">");
                      out.println("window.parent.CKEDITOR.tools.callFunction(" + callback
                          + ",'" + fileUrl + "',''" + ")");
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

                       String[] names = name.split("\\"+System.getProperty("file.separator"));
                       name = names[names.length-1];
                       names = name.split("\\.");
                       name = names[names.length-2];
                      
                       ProductImage productImage = new ProductImage();
                       productImage.setDate(new Date());
                       productImage.setDescription(name);
                      
                       name = productImage.getDate().getTime()+"";
                       productImage.setName(name);
                      
                       String uploadPath = ImageUtils.getUploadPath();
                       String sourcePath = uploadPath + System.getProperty("file.separator") + name+".jpg";
                   
                    item.write(new File(sourcePath))
                   
                    String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setSourceURL(sourcePath);
                    
                     
                      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
                      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
                      gatewayService.createProductImage(productImage);
                     
                      GatewayConfig gatewayConfig = (GatewayConfig) getServletContext().getAttribute("gatewayConfig");
                     
                     
                      PrintWriter out = response.getWriter();
                      out.println("<script type=\"text/javascript\">");
                      out.println("var ret=new Array();");
                      out.println("ret[0]='"+productImage.getSourceURL()+"';");
                      out.println("ret[1]='"+gatewayConfig.getUrl()+"/"+productImage.getSourceURL()+"';");
                      out.println("window.returnValue=ret;");
                      out.println("window.close();");
                      out.println("</script>");
                      out.write("");
                      out.flush();
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

  public ModelAndView applyReturn(HttpServletRequest req,HttpServletResponse response){
    System.out.println("--------------------------applyReturn----------------------------");
    DefaultMultipartHttpServletRequest request = (DefaultMultipartHttpServletRequest)req;
   
    String[] ids = request.getParameterValues("returnOrderProductId");
    ProductImage pi1 = null;
    ProductImage pi2 = null;
    ProductImage pi3 = null;
    if(ids!=null&&ids.length>0){
      try{
        String orderId = request.getParameter("orderId");
        ReturnRequest rr = new ReturnRequest();
       
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

             String[] names = name.split("\\"+System.getProperty("file.separator"));
             name = names[names.length-1];
             names = name.split("\\.");
             name = names[names.length-2];
            
             ProductImage productImage = new ProductImage();
             productImage.setDate(new Date());
             productImage.setDescription(name);
            
             name = productImage.getDate().getTime()+"";
             productImage.setName(name);
            
             String uploadPath = ImageUtils.getUploadPath();
             String sourcePath = uploadPath + System.getProperty("file.separator") + name+".jpg";
             file.transferTo(new File(sourcePath));
       
         String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
             sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
             productImage.setSourceURL(sourcePath);
             return productImage;
             //ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
             //IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
             //gatewayService.createProductImage(productImage);
           
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

        imageid = -1;
        out.print("({'result':'0','msg':'请上传商品图片!'})");
        out.flush();
        return;
      }
      ProductImage image = gatewayService.findProductImage(imageid);
      if(image!=null) {
        product.setImage(image);
      } else {
        out.print("({'result':'0','msg':'未找到商品图片!'})");
        out.flush();
        return;
      }
       
     
      long lbrandid = -1;
      try {
        lbrandid = Long.parseLong(brandId);
      } catch (Exception e) {
        lbrandid = -1;
        out.print("({'result':'0','msg':'请选择商品品牌!'})");
        out.flush();
        return;
      }
      Brand brand = gatewayService.findBrandById(lbrandid);
      if(brand!=null) {
        product.setBrand(brand);
      } else {
        out.print("({'result':'0','msg':'未找到商品品牌!'})");
        out.flush();
        return;
      }
     
      double pprice = 0;
      try {
        pprice = new Double(price);
      } catch (Exception e) {
        pprice = 0;
      }
      if(pprice<=0) {
        out.print("({'result':'0','msg':'请正确填写价格!'})");
        out.flush();
        return;
      }
      product.setPrice(pprice);
     
      int pleaves = 0;
      try {
        pleaves = new Integer(leaves);
      } catch (Exception e) {
        pleaves = 0;
      }
      if(pleaves<0) {
        out.print("({'result':'0','msg':'请正确填写库存!'})");
        out.flush();
        return;
      }
      product.setLeaves(pleaves);
      product.setAmount(pleaves);
     
      if("1".equals(onsale)) {
        product.setOnsale(1);
      } else {
        product.setOnsale(0);
      }
     
      AreaCategory areaCategory = null;
      try {
        areaCategory = gatewayService.findAreaCategory(new Long(areaCategoryId));
      } catch (Exception e) {
        areaCategory = null;
      }
      if(areaCategory!=null) {
        product.setAreaCategory(areaCategory);
      } else {
        out.print("({'result':'0','msg':'请选择商品分区!'})");
        out.flush();
        return;
      }
     
      Category category = null;
      try {
        category = gatewayService.findCategory(new Long(categoryId));
      } catch (Exception e) {
        category = null;
      }
      if(category!=null) {
        product.setCategory(category);
      } else {
        out.print("({'result':'0','msg':'请选择商品类型!'})");
        out.flush();
        return;
      }
     
      product.setDescription(description);
      product.setFarewaydesc(farewaydesc);
      product.setSaledesc(saledesc);
     
      if(colors!=null) {
        String color = "";
        for(int i=0;i<colors.length;i++) {
          if(i!=colors.length-1) {
            color = color+colors[i]+";";
          } else {
            color = color+colors[i];
          }
        }
        product.setColor(color);
      }
     
      if(colthesizes!=null) {
        String clothessize = "";
        for(int i=0;i<colthesizes.length;i++) {
          if(i!=colthesizes.length-1) {
            clothessize = clothessize+colthesizes[i]+";";
          } else {
            clothessize = clothessize+colthesizes[i];
          }
        }
        product.setClothessize(clothessize);
      }
     
      if(shoesizes!=null) {
        String shoesize = "";
        for(int i=0;i<shoesizes.length;i++) {
          if(i!=shoesizes.length-1) {
            shoesize = shoesize+shoesizes[i]+";";
          } else {
            shoesize = shoesize+shoesizes[i];
          }
        }
        product.setShoesize(shoesize);
      }
     
      if(fareways!=null) {
        String fareway = "";
        for(int i=0;i<fareways.length;i++) {
          if(i!=fareways.length-1) {
            fareway = fareway+fareways[i]+";";
          } else {
            fareway = fareway+fareways[i];
          }
        }
        product.setFareway(fareway);
      } else {
        out.print("({'result':'0','msg':'请选择商品运费支付方式!'})");
        out.flush();
        return;
      }
     
      product.setCreatedate(new Date());
     
      gatewayService.createProduct(product);
     
      out.print("({'result':'1','msg':'成功添加商品!'})");
      out.flush();
      return;
     
    } else if("3".equals(operation)) {
      String id = request.getParameter("id");
     
      long lid = -1;
      try {
        lid = Long.parseLong(id);
      } catch (Exception e) {
        lid = -1;
      }
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
      gatewayService.deleteProduct(lid);
     
      request.getRequestDispatcher("page/gateway/admin/product/ProductList.jsp").forward(request, response);
    } else if("2".equals(operation)) {
      String id = request.getParameter("id");
     
      long lid = -1;
      try {
        lid = Long.parseLong(id);
      } catch (Exception e) {
        lid = -1;
      }
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
      Product product = gatewayService.findProductById(lid);
      if(product==null) {
        out.print("({'result':'0','msg':'修改的商品信息不存在!'})");
        out.flush();
        return;
      }
      String name = request.getParameter("name");
      String areaNode = request.getParameter("areaNode");
      String weight = request.getParameter("weight");
      String productImageId = request.getParameter("productImageId");
      String price = request.getParameter("price");
      String amount = request.getParameter("amount");
      String leaves = request.getParameter("leaves");
      String brandId = request.getParameter("brandId");
      String onsale = request.getParameter("onsale");
      String areaCategoryId = request.getParameter("areaCategoryId");
      String categoryId = request.getParameter("categoryId");
      String[] colors = request.getParameterValues("color");
      String[] colthesizes = request.getParameterValues("colthesize");
      String[] shoesizes = request.getParameterValues("shoesize");
      String[] fareways = request.getParameterValues("fareway");
      String description = request.getParameter("description");
      String farewaydesc = request.getParameter("farewaydesc");
      String saledesc = request.getParameter("saledesc");
      String code = request.getParameter("code");
     
      product.setName(name);
      product.setAreaNode(areaNode);
      product.setWeight(Double.parseDouble(weight));
      product.setCode(code);
     
      long imageid = -1;
      try {
        imageid = Long.parseLong(productImageId);
      } catch (Exception e) {
        imageid = -1;
        out.print("({'result':'0','msg':'请上传商品图片!'})");
        out.flush();
        return;
      }
      ProductImage image = gatewayService.findProductImage(imageid);
      if(image!=null) {
        product.setImage(image);
      } else {
        out.print("({'result':'0','msg':'未找到商品图片!'})");
        out.flush();
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

                      String[] names = name.split("\\"+System.getProperty("file.separator"));
                      name = names[names.length-1];
                      names = name.split("\\.");
                      name = names[names.length-2];
                     
                      ProductImage productImage = new ProductImage();
                      productImage.setDate(new Date());
                      productImage.setDescription(name);
                     
                      name = productImage.getDate().getTime()+"";
                      productImage.setName(name);
                     
                      String uploadPath = ImageUtils.getUploadPath();
                      String sourcePath = uploadPath + System.getProperty("file.separator") + name+".jpg";
                     
                      FileOutputStream fos = new FileOutputStream(sourcePath);
                      InputStream is = item.getInputStream();
                      ImageIO.write(ImageUtils.resizeImage(is, ImageUtils.IMAGE_JPEG, 0, 0),
                              "JPEG", fos);
                      fos.close();
                      String[] path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setSourceURL(sourcePath);
                     
                      /*sourcePath = uploadPath + System.getProperty("file.separator") +name+"-"+ProductImage.SMALL_WIDTH+"x"+ProductImage.SMALL_HEIGHT+".jpg";
                      fos = new FileOutputStream(sourcePath);
                      is = item.getInputStream();
                      ImageIO.write(ImageUtils.resizeImage(is, ImageUtils.IMAGE_JPEG, ProductImage.SMALL_WIDTH, ProductImage.SMALL_HEIGHT),
                              "JPEG", fos);
                      fos.close();
                      path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setSmallURL(sourcePath);
                     
                      sourcePath = uploadPath + System.getProperty("file.separator") +name+"-"+ProductImage.MEDIUM_WIDTH+"x"+ProductImage.MEDIUM_HEIGHT+".jpg";
                      fos = new FileOutputStream(sourcePath);
                      is = item.getInputStream();
                      ImageIO.write(ImageUtils.resizeImage(is, ImageUtils.IMAGE_JPEG, ProductImage.MEDIUM_WIDTH, ProductImage.MEDIUM_HEIGHT),
                              "JPEG", fos);
                      fos.close();
                      path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setMediumURL(sourcePath);*/
                     
                      sourcePath = uploadPath + System.getProperty("file.separator") +name+"-"+ProductImage.LARGE_WIDTH+"x"+ProductImage.LARGE_HEIGHT+".jpg";
                      fos = new FileOutputStream(sourcePath);
                      is = item.getInputStream();
                      ImageIO.write(ImageUtils.resizeImage(is, ImageUtils.IMAGE_JPEG, ProductImage.LARGE_WIDTH, ProductImage.LARGE_HEIGHT),
                              "JPEG", fos);
                      fos.close();
                      path = sourcePath.split("\\"+System.getProperty("file.separator"));
                      sourcePath = path[path.length-3]+"/"+ path[path.length-2]+"/"+ path[path.length-1];
                      productImage.setLargeURL(sourcePath);
                     
                      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
                      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
                      gatewayService.createProductImage(productImage);
                     
                      GatewayConfig gatewayConfig = (GatewayConfig) getServletContext().getAttribute("gatewayConfig");
                     
                      PrintWriter out = response.getWriter();
                      out.println("<script type=\"text/javascript\">");
                      out.println("var ret=new Array();");
                      out.println("var ret=new Array();");
                      out.println("ret[0]='"+productImage.getId()+"';");
                      out.println("ret[1]='"+gatewayConfig.getUrl()+"/"+productImage.getLargeURL()+"';");
                      out.println("ret[2]='"+productImage.getLargeURL()+"';");
                      out.println("window.returnValue=ret;");
                      out.println("window.close();");
                      out.println("</script>");
                      out.write("");
                      out.flush();
View Full Code Here

Examples of com.lgx8.common.entities.ProductImage

   
    String weight = request.getParameter("weight");
    product.setWeight(Double.parseDouble(weight));
   
    String productImageId = request.getParameter("productImageId");
    ProductImage image = null;
    if(productImageId!=null) {
      try {
        image = gatewayService.findProductImage(new Long(productImageId));
      } catch (Exception e) {
        image = null;
View Full Code Here

Examples of com.swinarta.sunflower.core.model.ProductImage

  public FileRepresentation getRepresent() throws IOException{
   
    Integer id = RequestUtil.getInteger(getRequest().getAttributes().get("id"));
   
    try{
      ProductImage respImage = coreManager.get(ProductImage.class, id);

      File f = File.createTempFile("sunflower_", ".img");
           
      FileOutputStream fos = new FileOutputStream(f);
     
      fos.write(respImage.getImage());
     
      fos.close();
             
      FileRepresentation resp = new FileRepresentation(f, MediaType.IMAGE_ALL);
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.