Examples of Brand


Examples of com.lgx8.gateway.entities.Brand

    return findByPage4Report(hql, values, argment.getCurPage(), argment.getPageSize());
  }

  @Transactional
  public void delBrand(Long id) {
    Brand brand = getBrandById(id);
    this.getHibernateTemplate().delete(brand);
  }
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

        }
       
      }else if(detail.getType() == 1)
      {
        //品牌
        Brand brand = detail.getEntityId() == null? null:this.productDao.getBrandById(Long.parseLong(detail.getEntityId()));
        if(brand != null)
        {
//          vo.setName(brand.getName());
          vo.setDescription(brand.getDescription());
          vo.setUrl(brand.getUrl());
        }
       
        if(!"".equals(detail.getUrl()) && !"null".equals(detail.getUrl()) && detail.getUrl() != null)
        {
          vo.setUrl(detail.getUrl());
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

        }
       
      }else if(detail.getType() == 1)
      {
        //品牌
        Brand brand = detail.getEntityId() == null? null:this.productDao.getBrandById(Long.parseLong(detail.getEntityId()));
        if(brand != null)
        {
//          vo.setName(brand.getName());
          vo.setDescription(brand.getDescription());
          vo.setUrl(brand.getUrl());
        }
       
        if(!"".equals(detail.getUrl()) && !"null".equals(detail.getUrl()) && detail.getUrl() != null)
        {
          vo.setUrl(detail.getUrl());
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

        entityUrl = product.getImage().getSourceURL();
        entityName = product.getName();
      }else if("1".equals(categoryType))
      {
        //品牌
        Brand brand = gatewayService.findBrandById(Long.parseLong(entityId));
        entityUrl = brand.getImageUrl();
        entityName = brand.getName();
      }else if("2".equals(categoryType))
      {
        //广告
        Advertisement advertisment = gatewayService.findAdvertisementById(Long.parseLong(entityId));
        entityUrl = advertisment.getTPLJ();
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

        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();
        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();
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

      lid = Long.parseLong(id);
    } catch (Exception e1) {
      lid = -1;
    }
   
    Brand brand = gatewayService.findBrandById(lid);
    if(brand!=null) {
      root.put("brand", brand);
      root.put("Brand_List_Url", Constants.BRAND_LIST_URL);
    }
   
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

  @RequestMapping("/brand/saveBrand.do")
  public ModelAndView saveBrand(HttpServletRequest request,HttpServletResponse response){
    String name = request.getParameter("name");
    String description = request.getParameter("description");
    String url = request.getParameter("url");
    Brand brand = new Brand();
    brand.setName(name);
    brand.setDescription(description);
    brand.setUrl(url);
    productDao.createBrand(brand);
    return new ModelAndView(new RedirectView("../page/management/brand/brandlist.jsp"));
  }
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

            while (iter.hasNext()) { 
                FileItem item = (FileItem) iter.next()
                if (!item.isFormField()) { 
                  try {
                      
                    Brand brand = productDao.getBrandById(Long.parseLong(brandid));
                     
                       String uploadPath = ImageUtils.getUploadPath();
                       String sourcePath = uploadPath + System.getProperty("file.separator") + "brand" + brand.getId() +".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];
                      brand.setImageUrl(sourcePath);
                      productDao.updateBrand(brand);
                  } catch (Exception e) { 
                        e.printStackTrace()
                   
                } 
View Full Code Here

Examples of com.lgx8.gateway.entities.Brand

      String name = request.getParameter("name");
      String description = request.getParameter("description");
      String imageUrl = request.getParameter("imageUrl");
      String supplierid = request.getParameter("supplierid");
     
      Brand brand = new Brand();
      brand.setName(name);
      brand.setDescription(description);
      brand.setImageUrl(imageUrl);
     
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
      long lsupplierid = -1;
      try {
        lsupplierid = Long.parseLong(supplierid);
      } catch (Exception e) {
        lsupplierid = -1;
      }
      Supplier supplier = gatewayService.findSupplier(lsupplierid);
      if(supplier==null) {
        out.print("({'result':'0','msg':'添加失败,未找到对应的供应商!'})");
        out.flush();
        return;
      }
     
      if(gatewayService.chechBrandNameExsits(name)) {
        out.print("({'result':'0','msg':'添加失败,品牌名称已存在!'})");
        out.flush();
        return;
      }
     
     
      brand.setSupplier(supplier);
     
      gatewayService.createBrand(brand);
     
     
      out.print("({'result':'1','msg':'成功添加品牌!'})");
      out.flush();
      return;
    } 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");
     
      Brand brand = gatewayService.findBrandById(lid);
      if(brand==null) {
        out.print("({'result':'0','msg':'修改的品牌信息不存在!'})");
        out.flush();
        return;
      }
      String name = request.getParameter("name");
     
      /*if(gatewayService.chechBrandNameExsits(name)) {
        out.print("({'result':'0','msg':'修改失败,品牌名称已存在!'})");
        out.flush();
        return;
      }*/
     
     
      String description = request.getParameter("description");
      String imageUrl = request.getParameter("imageUrl");
      String supplierid = request.getParameter("supplierid");
     
      brand.setName(name);
      brand.setDescription(description);
      brand.setImageUrl(imageUrl);
     
     
      long lsupplierid = -1;
      try {
        lsupplierid = Long.parseLong(supplierid);
      } catch (Exception e) {
        lsupplierid = -1;
      }
      Supplier supplier = gatewayService.findSupplier(lsupplierid);
      if(supplier==null) {
        out.print("({'result':'0','msg':'修改失败,未找到对应的供应商!'})");
        out.flush();
        return;
      }
      brand.setSupplier(supplier);
     
     
      gatewayService.updateBrand(brand);
     
      out.print("({'result':'1','msg':'修改品牌信息成功!'})");
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.