@RequestMapping("acount.html") public String acount( @RequestParam(value = "name") String name, ModelMap modelMap, HttpServletRequest request) { DBObject dbObject = new BasicDBObject(); dbObject.put("name", name); dbObject.put("status", 1000); int payNum = MongoUtil.queryCount(MongoConst.MONGO_ORDERS, dbObject); dbObject.put("status", 1101); int waitNum = MongoUtil.queryCount(MongoConst.MONGO_ORDERS, dbObject); modelMap.put("payNum", payNum); modelMap.put("waitNum", waitNum); return "acount"; }
@RequestMapping("mobile.html") public String mobile(ModelMap modelMap, HttpServletRequest request) { HttpSession session = request.getSession(); String openId = (String) session.getAttribute("openId"); DBCollection collection = MongoUtil.getDb().getCollection(MongoConst.MONGO_MEMBER); BasicDBObject query = new BasicDBObject(); query.put("name", openId); List list = collection.find(query).toArray(); DBObject userDB = (DBObject) list.get(0); modelMap.put("e", userDB); return "mobile"; }
@RequestMapping("orders.html") public String orders( @RequestParam(value = "name") String name, @RequestParam(value = "status") int status, ModelMap modelMap, HttpServletRequest request) throws JSONException { Map map = new HashMap(); map.put("name", name); if (status != 9999) { map.put("status", status); } List list = MongoUtil.queryForPage(MongoConst.MONGO_ORDERS, map, 1, 10, "createTime", -1); modelMap.put("e", list); return "orders"; }
@ResponseBody @RequestMapping(value = "testProduct.json", method = RequestMethod.POST) public JsonVo testProduct( @RequestParam(value = "id") String id, @RequestParam(value = "numbers") int numbers) { JsonVo<String> json = new JsonVo<String>(); DBObject dbObject = MongoUtil.findOne(MongoConst.MONGO_PRODUCT, id); int status = (int) dbObject.get("status"); int num = (int) dbObject.get("num"); if (status != 0) { json.setResult(false); return json; } if (num < 1) { json.setResult(false); return json; } if (num < numbers) { json.setResult(false); return json; } json.setResult(true); return json; }
@RequestMapping("proDetail.html") public String proDetail(String proId, ModelMap modelMap, HttpServletRequest request) { DBObject dbObject = MongoUtil.findOne(MongoConst.MONGO_PRODUCT, proId); modelMap.put("e", dbObject); return "proDetail"; }
@RequestMapping("updateAddress.html") public String updateAddress(@RequestParam(value = "id") String id, ModelMap modelMap) { DBObject dbObject = MongoUtil.findOne(MongoConst.MONGO_ADDRESS, id); modelMap.put("e", dbObject); return "updateAddress"; }