예제 #1
0
  /**
   * 获取店铺详情
   *
   * @param shop
   * @return
   */
  public ShopDetail getShopDetail(Shop shop) {

    ShopDetail detail = new ShopDetail();

    detail.setCode(shop.getId());
    detail.setTitle(shop.getName());
    detail.setHeaderImageurl(shop.getLogo());
    detail.setScore(shop.getAvgScore());
    detail.setCollectFlag(
        shopFavoriteService.isUserCollectShop(memberService.getAppCurrent(), shop) ? 1 : 0);
    detail.setAllProduct(productService.findShopProductCount(shop));
    detail.setSaleProduct(promotionService.findShopPromotionCount(shop));
    detail.setSaleStatus(shop.getStatus());
    detail.setDesc(shop.getDescription());
    detail.setType(shop.getShopType());
    detail.setAddress(shop.getAddress());
    detail.setNotice(shop.getNotice());
    detail.setLatitude(shop.getLatitude() == null ? 0 : shop.getLatitude().doubleValue());
    detail.setLongitude(shop.getLongitude() == null ? 0 : shop.getLongitude().doubleValue());
    detail.setTelephone(shop.getTelephone());
    detail.setBusinessTime(shop.getBusinessTime());

    List<ShopImage> shopImages = shop.getShopImages();
    List<String> imageList = new ArrayList<String>();

    if (shopImages != null && shopImages.size() > 0) {
      for (ShopImage image : shopImages) {
        imageList.add(image.getSource());
      }
    }

    detail.setShopImages(imageList);

    ShopReview shopReview = shopReviewService.findLatestReview(shop);
    detail.setEvaluate(shopReview == null ? "" : shopReview.getContent());

    List<ShopActivity> shopActivities = shop.getShopActivities();
    List<cn.bmwm.modules.shop.controller.app.vo.ShopActivity> activityList =
        new ArrayList<cn.bmwm.modules.shop.controller.app.vo.ShopActivity>();

    if (shopActivities != null && shopActivities.size() > 0) {
      for (ShopActivity shopActivity : shopActivities) {
        cn.bmwm.modules.shop.controller.app.vo.ShopActivity activity =
            new cn.bmwm.modules.shop.controller.app.vo.ShopActivity();
        activity.setImageurl(shopActivity.getImageurl());
        activity.setLinkurl(shopActivity.getLinkurl());
        activityList.add(activity);
      }
    }

    detail.setActivityList(activityList);

    // 店铺热销商品
    List<Product> hostList = productService.findShopHotList(shop);

    detail.setRecommend(this.getShopProductItemCategory(shop, hostList));

    return detail;
  }