/** * 店铺内商品列表 * * @param shopId:店铺ID * @param globalCatId:全站分类Id * @param catId:店铺分类Id * @param page:页码 * @param size:每页显示商品数量 * @param order:排序方式,1:促销,2:新品,3:销量,4:价格 * @param x:经度 * @param y:纬度 * @return */ @RequestMapping(value = "/productlist", method = RequestMethod.GET) @ResponseBody public Result productList( Long shopId, Long globalCatId, Long catId, Integer page, Integer size, Integer order) { log.warn( "shopId = " + shopId + " , catId = " + catId + " , globalCatId = " + globalCatId + " , order = " + order); if (shopId == null) { throw new BusinessException(" parameter 'shopId' can not be null !"); } if (page == null) page = 1; if (size == null) size = 10; if (order == null) order = 1; Shop shop = shopService.find(shopId); if (shop == null) { throw new BusinessException(" Invalid parameter 'shopId' ! "); } ShopCategory shopCategory = null; if (catId != null) { shopCategory = shopCategoryService.find(catId); } ProductCategory productCategory = null; if (globalCatId != null) { productCategory = productCategoryService.find(globalCatId); } ItemPage<Product> itemPage = productService.findShopProductList(shop, productCategory, shopCategory, page, size, order); return new Result(Code.SUCCESS, 1, "", getProductItems(itemPage.getList())); }