コード例 #1
0
 /**
  * 改变数量
  *
  * @throws IOException
  */
 public void addCount() throws IOException {
   count = Integer.parseInt(ServletActionContext.getRequest().getParameter("count"));
   id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
   GoodStore goodStore = goodStoreService.getGoodsStore(id);
   goodStore.setCount(count);
   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));
   }
 }
コード例 #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));
    }
  }