Пример #1
0
  /**
   * 保存地址
   *
   * @throws IOException
   */
  public void addAdress() throws IOException {
    ids = ServletActionContext.getRequest().getParameter("ids");
    goodowner = ServletActionContext.getRequest().getParameter("goodowner");
    addressOwner = ServletActionContext.getRequest().getParameter("addressOwner");
    phonenumerowner = ServletActionContext.getRequest().getParameter("phonenumerowner");
    ids = ServletActionContext.getRequest().getParameter("ids");
    List<GoodStore> listGoodStore = goodStoreService.getMyStore(id);
    String str[] = ids.split(",");
    int array[] = new int[str.length];
    GoodAddress goodAddress = new GoodAddress();
    goodAddress.setAddressOwner(addressOwner);
    goodAddress.setGoodowner(goodowner);
    goodAddress.setPhonenumerowner(phonenumerowner);

    int f = goodAdressServiceImpl.saveAddress(goodAddress);

    try {
      for (int i = 0; i < str.length; i++) {
        array[i] = Integer.parseInt(str[i]);
        goodStore = goodStoreService.getGoodsStore(array[i]);
        goodStore.setAddressId(f);
        goodStoreService.saveOrUpdate(goodStore);
      }
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    } catch (Exception e) {
      e.printStackTrace();
      m.put("msg", "-1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    }
  }
Пример #2
0
 /** 从购物车删除 */
 public void deleteGoodsStore() throws IOException {
   id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
   GoodStore goodStore = goodStoreService.getGoodsStore(id);
   goodStore.setState(-1);
   try {
     goodStoreService.saveOrUpdate(goodStore);
     m.put("msg", "1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   } catch (Exception e) {
     e.printStackTrace();
     m.put("msg", "-1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   }
 }
Пример #3
0
  /** 从购物车提交 */
  public void commitGoodsStore() throws IOException {
    ids = ServletActionContext.getRequest().getParameter("ids");
    String str[] = ids.split(",");
    int array[] = new int[str.length];

    try {
      for (int i = 0; i < str.length; i++) {
        array[i] = Integer.parseInt(str[i]);
        goodStore = goodStoreService.getGoodsStore(array[i]);
        goodStore.setState(1);
        goodStoreService.saveOrUpdate(goodStore);
      }
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    } catch (Exception e) {
      m.put("msg", "-1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
      e.printStackTrace();
    }
  }