Examples of IGatewayService


Examples of com.lgx8.gateway.service.IGatewayService

      String farewaydesc = request.getParameter("farewaydesc");
      String saledesc = request.getParameter("saledesc");
      String code = request.getParameter("code");
     
      ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
      IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
     
     
      Product product = new Product();
      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();
        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();
        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);
     
      int pamount = 0;
      try {
        pamount = new Integer(amount);
      } catch (Exception e) {
        pamount = 0;
      }
      if(pamount<=0) {
        out.print("({'result':'0','msg':'请正确填写总量!'})");
        out.flush();
        return;
      }
      product.setAmount(pamount);
     
      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;
      }
     
      gatewayService.updateProduct(product);
     
      out.print("({'result':'1','msg':'修改商品信息成功!'})");
      out.flush();
      return;
    }
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

    Map<Object, Object> root = new HashMap<Object, Object>();
    root.putAll(super.root);
    Template temp = getConfiguration().getTemplate("brand/BrandDetail.ftl");
   
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    String id = request.getParameter("id");
    long lid = -1;
    try {
      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);
    }
   
    List<Supplier> suppliers = gatewayService.findSupplier();
    if(suppliers!=null&&suppliers.size()>0) {
      root.put("suppliers", suppliers);
    }
   
    /* 将模板和数据模型合并 */
 
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

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

Examples of com.lgx8.gateway.service.IGatewayService

   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Map<Object, Object> root = new HashMap<Object, Object>();
    root.putAll(super.root);
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    String type = request.getParameter("type");
   
    if(type == null || "".equals(type) ||"null".equals(type)||"0".equals(type))
    {
      List<Product> products = gatewayService.findAllProductByAreaCategoryId(Long.parseLong(type));
     
      Template temp = getConfiguration().getTemplate("listProduct.ftl");
     
      root.put("products", products);
     
      /* 将模板和数据模型合并 */
      Writer out = response.getWriter();
      try {
        temp.process(root, out);
      } catch (TemplateException e) {
        e.printStackTrace();
      }
      out.flush();
    }else
    {
      List<Brand> brands = gatewayService.findAllBrand();
     
      Template temp = getConfiguration().getTemplate("listBrand.ftl");
     
      root.put("brands", brands);
     
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
    Product product = new Product();
   
    String name = request.getParameter("name");
    product.setName(name);
   
    String areaNode = request.getParameter("areaNode");
    product.setAreaNode(areaNode);
   
    String code = request.getParameter("code");
    product.setCode(code);
   
    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;
      }
    }
    if(image!=null) {
      product.setImage(image);
    }
    String price = request.getParameter("price");
    double pprice = 0;
    try {
      pprice = new Double(price);
    } catch (Exception e) {
      pprice = 0;
    }
    product.setPrice(pprice);
   
    String leaves = request.getParameter("leaves");
    int pleaves = 0;
    try {
      pleaves = new Integer(leaves);
    } catch (Exception e) {
      pleaves = 0;
    }
    product.setLeaves(pleaves);
   
    String onsale = request.getParameter("onsale");
    if("1".equals(onsale)) {
      product.setOnsale(1);
    } else {
      product.setOnsale(0);
    }
   
    String areaCategoryId = request.getParameter("areaCategoryId");
    AreaCategory areaCategory = null;
    try {
      areaCategory = gatewayService.findAreaCategory(new Long(areaCategoryId));
    } catch (Exception e) {
      areaCategory = null;
    }
    if(areaCategory!=null) {
      product.setAreaCategory(areaCategory);
    }
   
    String categoryId = request.getParameter("categoryId");
    Category category = null;
    try {
      category = gatewayService.findCategory(new Long(categoryId));
    } catch (Exception e) {
      category = null;
    }
    product.setCategory(category);
   
    String description = request.getParameter("description");
    product.setDescription(description);
   
    gatewayService.createProduct(product);
   
    PrintWriter out = response.getWriter();
    out.print("1");
    out.flush();
    out.close();
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

    root.putAll(super.root);
   
    Template temp = getConfiguration().getTemplate("imageList.ftl");
   
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    List<ProductImage> productImages = gatewayService.findProductImageListOrderByTime("desc");
   
    if(productImages!=null&&productImages.size()>0) {
      root.put("productImages", productImages);
    }
   
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

    Map<Object, Object> root = new HashMap<Object, Object>();
    root.putAll(super.root);
    Template temp = getConfiguration().getTemplate("supplier/SupplierDetail.ftl");
   
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    String id = request.getParameter("id");
    long lid = -1;
    try {
      lid = Long.parseLong(id);
    } catch (Exception e1) {
      lid = -1;
    }
   
    Supplier supplier = gatewayService.findSupplier(lid);
   
    if(supplier!=null) {
      root.put("supplier", supplier);
      root.put("Supplier_List_Url", Constants.SUPPLIER_LIST_URL);
    }
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

    root.putAll(base);
   
    Template temp = getConfiguration().getTemplate("adviseproductlist.ftl");
   
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    //奢品模块品牌
    List<ProductVO> productVOs = gatewayService.initGatewayInfo(GatewayConstants.CSP_SPMK11);
    root.put("productVOs", productVOs);
   
    String pageno = request.getParameter("pageno");
   
    String brandid = request.getParameter("brandid");
   
    if(StringUtil.isEmptyStr(brandid))
    {
      brandid = "0";
      if(productVOs.size() != 0)
      {
        brandid = productVOs.get(0).getEntityId();
      }
    }

    //处理当前页
    if(pageno==null) {
      pageno = "1";
    }
    int pagenum = 1;
    try {
      pagenum = Integer.parseInt(pageno);
    } catch (Exception e1) {
      pagenum = 1;
    }   
   
    PageList pageList = null;
   
    pageList = gatewayService.findProductByBrandConditions(4l, Long.valueOf(brandid), "", "",null,pagenum+"",null);
   
    if(pageList!=null&&pageList.getDataList()!=null)
    {
      root.put("pageList", pageList);
    }
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

      category.setSendMsg(sendMsg);
      categoryDao.updateCategory(category);
    }
   
   
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
    //更新ServletContext中的目录列表
    @SuppressWarnings("unchecked")
    List<Category> categorys = (List<Category>) getServletContext().getAttribute("categorys");
    categorys.clear();
    categorys.addAll(gatewayService.findAllCategory());
   
    Map<Long, Category> categoryMap = new HashMap<Long, Category>();
    GatewayIndexListen.addCategoryToMap(categorys, categoryMap);
    getServletContext().setAttribute("categoryMap", categoryMap);
   
View Full Code Here

Examples of com.lgx8.gateway.service.IGatewayService

    response.setCharacterEncoding("UTF-8");
   
    String id = request.getParameter("categoryId");
   
    ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
    IGatewayService gatewayService = (IGatewayService) ac.getBean("gatewayService");
   
    gatewayService.deleteProductPropertyCategory(Long.parseLong(id));
   
    pw.write("1");
  }
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.