Пример #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 addGoodsStoredirect() throws IOException {
    id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
    goodId = Integer.parseInt(ServletActionContext.getRequest().getParameter("goodId"));
    count = Integer.parseInt(ServletActionContext.getRequest().getParameter("goodId"));
    GoodStore goodstore = new GoodStore();
    goodstore.setState(1);
    goodstore.setCount(count);
    goodstore.setAddressId(id);
    goodstore.setGoodId(goodId);

    try {
      goodStoreService.saveGoodStore(goodstore);
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    } catch (Exception e) {
      m.put("msg", "-1");
      e.printStackTrace();
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    }
  }