Exemplo n.º 1
0
  // 获取美食详情
  @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());
  }
Exemplo n.º 2
0
  /**
   * 查询美食分类
   *
   * @param request
   * @return
   */
  @RequestMapping(value = "/getFoodTypeList", method = RequestMethod.GET)
  public ModelAndView listCategories(
      HttpServletRequest request,
      @RequestParam(value = "mallId", required = true) Integer mallId,
      @RequestParam(value = "memberId", required = false) Integer memberId,
      @RequestParam(value = "page", required = false) Integer page,
      @RequestParam(value = "pageSize", required = false) Integer pageSize,
      @RequestParam(value = "ts", required = false) Integer ts) {

    ResponseObject res = null;

    if (null == page || page <= 0) {
      page = 1;
    }
    if (null == pageSize || pageSize <= 0) {
      pageSize = Constants.PAGE_SIZE;
    }

    Map<String, Object> param = new HashMap<String, Object>();
    param.put("mallId", Integer.parseInt(mallId.toString()));
    param.put("page", page);
    param.put("pageSize", pageSize);

    Map<String, Object> selectAllCategories = categoriesService.selectAllCategories(param);
    res = new ResponseObject(selectAllCategories);
    return new ModelAndView("jsonView", res.getMap());
  }
Exemplo n.º 3
0
  // 查询美食列表
  @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());
  }