public void myBuyedStore() throws IOException { id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id")); List<GoodStore> listgoostore = goodStoreService.getMyBuyedStore(id); for (GoodStore goodStore : listgoostore) { JSONObject jsonObj = new JSONObject(); Goods good = goodsService.getGoods(goodStore.getGoodId()); jsonObj.put("goodStoreid", goodStore.getGoodStoreid()); jsonObj.put("title", good.getTitle()); jsonObj.put( "addTime", goodStore.getAddtime() == null ? "" : sdf1.format(goodStore.getAddtime())); jsonObj.put("price", good.getPrice() * goodStore.getCount()); jsonObj.put("count", goodStore.getCount()); jsonObj.put("id", goodStore.getGoodId()); List<Image> listimage = imageServiceImpl.getimage(goodStore.getGoodId(), 3); Image image = new Image(); if (listimage.size() > 0) { image.setImageUrl(IpMain.IP + listimage.get(1).getImageUrl()); } else { image.setImageUrl(""); } jsonObj.put("imgUrl", image); array.add(jsonObj); } m.put("msg", array); ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m)); }