Пример #1
0
 @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";
 }
Пример #2
0
 @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";
 }
Пример #3
0
 @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";
 }
Пример #4
0
 @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;
 }
Пример #5
0
 @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";
 }
Пример #6
0
 @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";
 }