Beispiel #1
0
 public void update(Cart cart, PopularityGroup popularityGroup) {
   if (popularityGroup != null) {
     PopularityItem popularityItem =
         popularityItemMng.findById(cart.getId(), popularityGroup.getId());
     if (popularityItem != null) {
       popularityItemMng.deleteById(popularityItem.getId());
     }
   }
 }
Beispiel #2
0
  // 选择收货地址、付款方式、配送方式
  @RequestMapping(value = "/cart/checkout_shipping.jspx")
  public String shippingInput(
      Long[] cart2Checkbox,
      HttpServletRequest request,
      HttpServletResponse response,
      ModelMap model) {
    Website web = SiteUtils.getWeb(request);
    ShopMember member = MemberThread.get();
    if (member == null) {
      return "redirect:../login.jspx";
    }
    Cart cart = shoppingSvc.getCart(member.getId());
    if (cart == null) {
      return "redirect:shopping_cart.jspx";
    }
    List<PopularityItem> popularityItems = null;
    Double popularityPrice = 0.0;
    if (cart != null) {
      popularityItems = popularityItemMng.getlist(cart.getId(), null);
      for (PopularityItem popularityItem : popularityItems) {
        popularityPrice +=
            popularityItem.getPopularityGroup().getPrivilege() * popularityItem.getCount();
      }
    }

    Set<CartItem> items = getItems(cart2Checkbox, cart);
    Double price = getPrice(items);
    // 配送方式
    List<Shipping> splist = shippingMng.getList(web.getId(), true);
    // 会员地址
    List<ShopMemberAddress> smalist = shopMemberAddressMng.getList(member.getId());
    // 所处省份
    List<Address> plist = addressMng.getListById(null);
    // 付款方式
    List<Payment> paylist = paymentMng.getList((long) 1, true);
    model.addAttribute(
        "memberCouponlist", memberCouponMng.getList(member.getId(), new BigDecimal(price)));
    model.addAttribute("items", getItems(cart2Checkbox, cart));
    model.addAttribute("smalist", smalist);
    model.addAttribute("plist", plist);
    model.addAttribute("paylist", paylist);
    model.addAttribute("splist", splist);
    model.addAttribute("popularityPrice", popularityPrice);
    ShopFrontHelper.setCommonData(request, model, web, 1);
    return web.getTplSys(MEMBER_SYS, MessageResolver.getMessage(request, CHECKOUT_SHIPPING));
  }