// 获取美食详情 @RequestMapping(value = "/getFoodInfo", method = RequestMethod.GET) public ModelAndView selectFoodDetail( @RequestParam(value = "mallId", required = true) Integer mallId, @RequestParam(value = "foodId", required = true) Integer foodId, @RequestParam(value = "memberId", required = false) Integer memberId, HttpServletRequest request) { logger.info("16.3.获取美食详情begin"); ResponseObject res = null; try { Map<String, Object> param = new HashMap<String, Object>(); param.put("mallId", mallId); param.put("id", foodId); if (null != memberId) param.put("memberId", memberId); Map<String, Object> resultMap = foodService.selectFoodDetail(param); res = new ResponseObject(resultMap); } catch (Exception e) { logger.error(e.getMessage()); res = new ResponseObject("-2", Constants.API_ERROR); } logger.info("16.3.获取美食详情end - " + res.getMap().toString()); return new ModelAndView("jsonView", res.getMap()); }
// 查询美食列表 @RequestMapping(value = "/getRecommendFoodList", method = RequestMethod.GET) public ModelAndView getFoodList( @RequestParam(value = "mallId", required = true) Integer mallId, @RequestParam(value = "memberId", required = false) Integer memberId, @RequestParam(value = "foodName", required = false) String foodName, @RequestParam(value = "foodTypeId", required = false) Integer foodTypeId, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "ts", required = false) Integer ts, HttpServletRequest request) { logger.info("16.2.获取美食推荐列表begin"); ResponseObject res = null; try { if (null == page || page <= 0) { page = 1; } if (null == pageSize || pageSize <= 0) { pageSize = Constants.PAGE_SIZE; } Integer fromRecord = pageSize * (1 <= page ? page - 1 : page); Map<String, Object> param = new HashMap<String, Object>(); param.put("mallId", mallId); param.put("foodName", foodName); param.put("foodTypeId", foodTypeId); param.put("fromRecord", fromRecord); param.put("pageSize", pageSize); param.put("dataFlag", 0); Map<String, Object> foodList = new HashMap<String, Object>(); foodList.put("foodList", foodService.getFoodList(param)); res = new ResponseObject(foodList); } catch (Exception e) { logger.error(e.getMessage()); res = new ResponseObject("-2", Constants.API_ERROR); } logger.info("16.2.获取美食推荐列表end - " + res.getMap().toString()); return new ModelAndView("jsonView", res.getMap()); }