package com.wemall.view.web.action;
import com.wemall.core.annotation.SecurityMapping;
import com.wemall.core.domain.virtual.SysMap;
import com.wemall.core.mv.JModelAndView;
import com.wemall.core.query.support.IPageList;
import com.wemall.core.security.support.SecurityUserHolder;
import com.wemall.core.tools.*;
import com.wemall.core.tools.bean.WxOauth2Token;
import com.wemall.core.tools.bean.WxToken;
import com.wemall.foundation.domain.*;
import com.wemall.foundation.domain.query.AddressQueryObject;
import com.wemall.foundation.service.*;
import com.wemall.manage.admin.tools.MsgTools;
import com.wemall.manage.admin.tools.PaymentTools;
import com.wemall.manage.seller.tools.TransportTools;
import com.wemall.pay.alipay.config.AlipayConfig;
import com.wemall.pay.alipay.util.AlipaySubmit;
import com.wemall.pay.tools.PayTools;
import com.wemall.view.web.tools.GoodsViewTools;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.jdom.JDOMException;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
/**
* 购物车控制器
*/
@Controller
public class CartViewAction {
@Autowired
private ISysConfigService configService;
@Autowired
private IUserConfigService userConfigService;
@Autowired
private IGoodsService goodsService;
@Autowired
private IGoodsSpecPropertyService goodsSpecPropertyService;
@Autowired
private IAddressService addressService;
@Autowired
private IAreaService areaService;
@Autowired
private IPaymentService paymentService;
@Autowired
private IOrderFormService orderFormService;
@Autowired
private IGoodsCartService goodsCartService;
@Autowired
private IStoreService storeService;
@Autowired
private IOrderFormLogService orderFormLogService;
@Autowired
private IUserService userService;
@Autowired
private ITemplateService templateService;
@Autowired
private IPredepositLogService predepositLogService;
@Autowired
private IGroupGoodsService groupGoodsService;
@Autowired
private ICouponInfoService couponInfoService;
@Autowired
private IStoreCartService storeCartService;
@Autowired
private MsgTools msgTools;
@Autowired
private PaymentTools paymentTools;
@Autowired
private PayTools payTools;
@Autowired
private TransportTools transportTools;
@Autowired
private GoodsViewTools goodsViewTools;
private static Logger logger = LoggerFactory.getLogger(CartViewAction.class);
private List<StoreCart> cart_calc(HttpServletRequest request){
List<StoreCart> cart = new ArrayList<StoreCart>();
List<StoreCart> user_cart = new ArrayList<StoreCart>();
List<StoreCart> cookie_cart = new ArrayList<StoreCart>();
User user = null;
if (SecurityUserHolder.getCurrentUser() != null){
user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId());
}
String cart_session_id = "";
Map params = new HashMap();
Cookie[] cookies = request.getCookies();
if (cookies != null){
for (Cookie cookie : cookies){
if (cookie.getName().equals("cart_session_id")){
cart_session_id = CommUtil.null2String(cookie.getValue());
}
}
}
if (user != null){
if (!cart_session_id.equals("")){
if (user.getStore() != null){
params.clear();
params.put("cart_session_id", cart_session_id);
params.put("user_id", user.getId());
params.put("sc_status", Integer.valueOf(0));
params.put("store_id", user.getStore().getId());
List<StoreCart> store_cookie_cart = this.storeCartService.query(
"select obj from StoreCart obj where (obj.cart_session_id=:cart_session_id or obj.user.id=:user_id) and obj.sc_status=:sc_status and obj.store.id=:store_id",
params, -1, -1);
for (StoreCart sc : store_cookie_cart){
// sc = (StoreCart)localIterator1.next();
for (GoodsCart gc : ((StoreCart) sc).getGcs()){
gc.getGsps().clear();
this.goodsCartService.delete(gc.getId());
}
this.storeCartService.delete(((StoreCart) sc).getId());
}
}
params.clear();
params.put("cart_session_id", cart_session_id);
params.put("sc_status", Integer.valueOf(0));
cookie_cart = this.storeCartService.query(
"select obj from StoreCart obj where obj.cart_session_id=:cart_session_id and obj.sc_status=:sc_status",
params, -1, -1);
params.clear();
params.put("user_id", user.getId());
params.put("sc_status", Integer.valueOf(0));
user_cart = this.storeCartService.query(
"select obj from StoreCart obj where obj.user.id=:user_id and obj.sc_status=:sc_status", params,
-1, -1);
}else{
params.clear();
params.put("user_id", user.getId());
params.put("sc_status", Integer.valueOf(0));
user_cart = this.storeCartService.query(
"select obj from StoreCart obj where obj.user.id=:user_id and obj.sc_status=:sc_status", params,
-1, -1);
}
}else if (!cart_session_id.equals("")){
params.clear();
params.put("cart_session_id", cart_session_id);
params.put("sc_status", Integer.valueOf(0));
cookie_cart = this.storeCartService.query(
"select obj from StoreCart obj where obj.cart_session_id=:cart_session_id and obj.sc_status=:sc_status",
params, -1, -1);
}
for (StoreCart sc : user_cart){
boolean sc_add = true;
for (StoreCart sc1 : cart){
if (sc1.getStore().getId().equals(sc.getStore().getId())){
sc_add = false;
}
}
if (sc_add){
cart.add(sc);
}
}
for (StoreCart sc : cookie_cart){
boolean sc_add = true;
for (StoreCart sc1 : cart){
if (sc1.getStore().getId().equals(sc.getStore().getId())){
sc_add = false;
for (GoodsCart gc : sc.getGcs()){
gc.setSc(sc1);
this.goodsCartService.update(gc);
}
this.storeCartService.delete(sc.getId());
}
}
if (sc_add){
cart.add(sc);
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于Spring+SpringMVC+hibernate实现的B2B2C商城源码含商家入驻有需要的不要错过
共15554个文件
jpg:2264个
class:847个
java:819个
需积分: 9 9 下载量 34 浏览量
2020-10-16
11:36:35
上传
评论
收藏 498.66MB RAR 举报
温馨提示
保证完整可运行,不会运行或者有问题可以联系本人,可以提供技术支持。内容非常多还有拼团、二手等频道,物超所值吧
资源推荐
资源详情
资源评论
收起资源包目录
基于Spring+SpringMVC+hibernate实现的B2B2C商城源码含商家入驻有需要的不要错过 (15554个子文件)
0001f63f4db2caeb33c8dc55ec4f7f9b578f65 1KB
0003122ee2a6dfe4664445f28769e6c87c6470 679B
0022298c1f47803fc5eea781c382686f4f19d1 358B
0037c67f6ff472d992bf0e3539e1c05cf4ed98 2KB
003a783b6b7c0db5c2c53ec8107a5e9783634c 2KB
004faa8e7a3e4c842ea48c678c4a8e08708148 3KB
0075cbc8b42d31f1c7fafc6054ca81dc3bb2e4 2KB
00791617c117af1c037780526490202bf0482b 476B
0080ae2ad3377f1a62fb8a64dbdab039fb892c 6KB
00949d4ebf1862a1eb92a6fabaa146dd264f14 320B
00974093e56be091532f6039c25ca9a8f92590 884B
009a7300cfcaa05430c0994c502bc6c00f45ca 973B
00a36c820a94e9c11f4673976cc7809d9a5cca 2KB
00a5896cec2d402acb88da1f2a4b948f0ea312 2KB
00b2741b894d3b052ad3c210aef2fe67bde4a0 711B
00b62458ea0cdee6b0ed91f6422e005bcbf174 78KB
00b7c4937b4ea93b775b1dec3975f34ed9fc93 217B
00bdb6b82864e0bce3a84d05ee98cf7035b5e5 2KB
00c0e7cef69257b4adad6d7f642e0f04dde1eb 845B
00c44804a7c5f55e606505663e59107aab3f2c 5KB
00c9f4fc36438fea635d443fa06872797a4348 5KB
00d3464ad926f210dbb55e77ab3ebf8d705076 397KB
00d80e394e0df4c52c83d48ceda36c47bd4bd6 409B
00d8d6b8f38c9c65d94229206661bba53810b5 2KB
00d9c4b01ae8c4702d870c87a9a990358f63ad 2KB
00ec074d1158e1757b8ca85f83ae43b2bb23fe 6KB
00f247ce2d025a0de646bbf288f9b99ff1e00d 868B
00f62f5e90b6b39c2023d08b04339b7d0bae92 821B
00fdbc1813835308048cd66abe3a9aca30b030 857B
0120a42438aa1e25740ee1b43009f209fafc27 1KB
01291c44cc5553fc8660cd0120b27c88d89e45 2KB
013da334ec6f808a6f5626e5d9929c24bb0561 40KB
014062c413045d11804b6080708407ca89ee0b 2KB
014c267a435e1cda7549deeadac89c72f02c3c 509B
015232e66e32552c115bcb25e2874d5f85f44e 95KB
01535b86f7b5b8d03c0fac45496b9c1a1e08ef 6KB
0159b3d6a41c52dc547bbaa7a2d7832c0f01a7 2KB
01656973813486c9f4b908f2a88c59e830b23c 4KB
0167c4557fa86c0699e6b627e1d0b668fd4a3e 855B
01706610c09bebb3fd97dda53cb3aa14461643 268B
017edea21804c71d3babf60e5d429b55d29a94 64B
0180a8b6d749d92a4e6a1706f9a209ba8de4f8 1KB
01854a0102a63b33c2c126001e5dffd0367d6f 1KB
018b0c3f388164de01c60ff2f5316aee139c21 3KB
0197ac3f0310f4de4a9ab4fafafbdcd243ebde 4KB
019f8ff85d7520cd36fa6f67c6311996228217 1KB
01a9e7b32696194fbfc979a80d7b01ee8c981c 6KB
01acefe1e35ad2a78861e3fe5961618491e6f2 185B
01af654c626c3fdd0bc285dd6f12f02710f531 49KB
01c22308d3a620fd5eb3531d4eb1553d84feae 929B
01cf69214de9cefea43c2108933ab1aa0018a6 3KB
01e88c6de5d3f97ef2bfe38d7cf41b54aa32ad 243B
01ec3e8541f8f096f9ea6144afb950bb3603a0 217B
01f79db1c23fb085ca2d5f2b8efcefe1c4e700 3KB
020a5a57a6a937b342879f8a910331aeaafaca 3KB
020efda8541f00b8a850e370f1efe862581e0a 9KB
0212f5dcc4bab9dbeefbcf1e44ba1ed53af723 522B
021aa4bc83ac0fe1da6874f96a9fd2111e1e73 15KB
021d3b40c90676e24d20dd5472dff1b02430b4 6KB
02261bd83b782b38aa22dfda69b98e6e7342c2 1KB
0239e4d4f0ad9151b82e10b1c6d800bfab8ce6 2KB
023fc1e88240791523d1e914f266ec853d509f 278B
02426c114be4b57aabc0a80b8a63d9e56b9eb6 4KB
02442e0fd5182e93b0088063c6204979b99e58 91B
02449c4a693bea440ded3c4ab7742293046c1f 4KB
024e2d4b2629f5c929ba65ee580cabb5e6cb9b 2KB
025a0152e58b3f8336570f4c61f536e591fc81 4KB
0261f0261472cc075482b14ba0eb28763ce2c8 1KB
02663be7949dbe65bd7f2b5a586919f658ea76 325B
026a452f781f79a8172581846a6f639304572d 616B
0279a686aeaaecfa1d612905f82a207526c96f 3KB
027a790e3c04136a12205d3d7a08328b8b6222 13KB
027d866a723bfe9eba3de01f7d8b9ae02214db 2KB
027f981e7ba78834c60864190d2e4cfb39a5a0 122B
0281ec8ab0d96093155abc9200c187c7a07753 688B
02879145f6f5c659f6eac463b4c8c697f33c62 448B
0293ce2b423c4da2b0ca5a968034c5237d34e7 2KB
0294792be00211e921005e65b30fdd6e115d60 93B
0296806c9d4d2d9a1f04898779ab62c8948de8 5KB
029bf631db913c2405cce7634eb7a61f6e8fe9 492B
02a7b9366b85b2f5dee74abb9c57f54d4de28e 352B
02ac11df22868e1889498e2071c1f15e24ca18 858B
02b28775fe9bf596ac7d34c2d60fbcd98fcee5 226B
02b645fc79efd712fac2c73c43df747ab1aeb0 412KB
02bc3ef1d39149956c1234aecced37ed400945 2KB
02bd12c8e8989890c1ecf7501bb69d03790fbe 1KB
02d6b06bc0ec55dd12d228e9d4476f8e60e9be 2KB
02f1f4f668febd28fb2265057b3acf00782154 3KB
02f8c26a94863acdf620d46a62ab9467383265 64B
03003608b2979bae7367e68eaa1f8098d9d3e0 850B
03014ed5b062e82889655b0f574a0036362cfe 16KB
03017960b3972499d3aa92f89953935ae40934 10KB
03027d31435d5abc414952e0c5c828381756f9 76B
030b021ca2697fab0d7f7b0a76b126ab0ddc17 1KB
030bae61ca526080c6241f48f70be71bc3ff5c 6KB
0312b69809ef20bcf24d9d3c7e1abc5c5e7013 13.56MB
031f46a37e8f5a70864a4bb0cbebc55b258c71 5KB
03255ec7bcd26b3d30c9fa922e1a5557089821 1KB
032bbf73e5c4457bd54d7e3eb02cfb2b7d6bdb 444B
03358cee204f2cd1cc58eaec70838e18f37084 173B
共 15554 条
- 1
- 2
- 3
- 4
- 5
- 6
- 156
资源评论
大笨牛
- 粉丝: 6
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功