|
@@ -111,14 +111,14 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
* 获取购物车中的数据
|
|
|
*/
|
|
|
@GetMapping("getCart")
|
|
|
- public Object getCart(String checkCart) {
|
|
|
+ public Object getCart(String checkCart,Long storeId) {
|
|
|
UserVo loginUser = new UserVo();
|
|
|
loginUser.setId(getUserId());
|
|
|
Map<String, Object> resultObj = Maps.newHashMap();
|
|
|
//查询列表数据
|
|
|
Map param = Maps.newHashMap();
|
|
|
param.put("user_id", loginUser.getId());
|
|
|
- Long storeId = getStoreId();
|
|
|
+ storeId = getStoreId();
|
|
|
param.put("store_id", storeId);
|
|
|
param.put("merchSn", getMerchSn());
|
|
|
param.put("checkCart", checkCart);
|
|
@@ -243,9 +243,9 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
/**
|
|
|
* 获取购物车信息,所有对购物车的增删改操作,都要重新返回购物车的信息
|
|
|
*/
|
|
|
- @GetMapping("index")
|
|
|
- public Object index(String checkCart) {
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ @GetMapping("indexs")
|
|
|
+ public Object indexs(String checkCart,Long storeId) {
|
|
|
+ return toResponsSuccess(getCart(checkCart,storeId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -342,7 +342,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
cartInfo.setSku(goodsInfo.getSku());
|
|
|
cartService.update(cartInfo);
|
|
|
}
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ return toResponsSuccess(getCart(checkCart,storeId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -363,7 +363,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
if (0 != MapUtils.getInteger("errno", resultObj)) {
|
|
|
return toResponsObject(MapUtils.getInteger("errno", resultObj), MapUtils.getString("errmsg", resultObj), "");
|
|
|
}
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ return toResponsSuccess(getCart(checkCart,storeId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -515,7 +515,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
//取得规格的信息,判断规格库存
|
|
|
ProductVo productInfo = productService.queryByStoreId(productId, storeId);
|
|
|
if (null == productInfo) {
|
|
|
- return this.toResponsObject(400, "商品已下架", getCart(checkCart));
|
|
|
+ return this.toResponsObject(400, "商品已下架", getCart(checkCart,storeId));
|
|
|
}
|
|
|
ThirdMerchantBizVo thirdMerchantBiz = apiThirdMerchantBizService.getThirdMerchangByCode(goodsInfo.getThirdPartyMerchCode());
|
|
|
if(null == thirdMerchantBiz){
|
|
@@ -536,7 +536,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
}
|
|
|
}
|
|
|
if(stockNum == null || number > stockNum || stockNum <= 0){
|
|
|
- return this.toResponsObject(400, "该商品库存不足", getCart(checkCart));
|
|
|
+ return this.toResponsObject(400, "该商品库存不足", getCart(checkCart,storeId));
|
|
|
}
|
|
|
String msg = "";
|
|
|
// if (productInfo.getStock_num() < number) {
|
|
@@ -551,7 +551,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
cartInfo.setNumber(number);
|
|
|
cartInfo.setStockNum(stockNum);
|
|
|
cartService.update(cartInfo);
|
|
|
- return toResponsObject(0, msg, getCart(checkCart));
|
|
|
+ return toResponsObject(0, msg, getCart(checkCart,storeId));
|
|
|
}
|
|
|
|
|
|
Map cartParam = Maps.newHashMap();
|
|
@@ -583,7 +583,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
cartInfo.setGoods_specification_ids(productInfo.getGoods_specification_ids());
|
|
|
cartService.update(cartInfo);
|
|
|
}
|
|
|
- return toResponsObject(0, msg, getCart(checkCart));
|
|
|
+ return toResponsObject(0, msg, getCart(checkCart,storeId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -611,7 +611,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
}
|
|
|
}
|
|
|
cartService.updateCheck(goodsIdArray, isChecked, loginUser.getId(), getStoreId());
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ return toResponsSuccess(getCart(checkCart,getStoreId()));
|
|
|
}
|
|
|
|
|
|
//删除选中的购物车商品,批量删除
|
|
@@ -624,12 +624,12 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
return toResponsFail("删除出错");
|
|
|
}
|
|
|
cartService.delete(cartId);
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ return toResponsSuccess(getCart(checkCart,getStoreId()));
|
|
|
}
|
|
|
|
|
|
// 获取购物车商品的总件件数
|
|
|
- @GetMapping("goodscount")
|
|
|
- public Object goodscount(@LoginUser UserVo loginUser) {
|
|
|
+ @GetMapping("goodscounts")
|
|
|
+ public Object goodscounts(@LoginUser UserVo loginUser, Long storeId) {
|
|
|
if (null == loginUser || null == loginUser.getId()) {
|
|
|
return toResponsFail("未登录");
|
|
|
}
|
|
@@ -637,8 +637,8 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
//查询列表数据
|
|
|
Map param = Maps.newHashMap();
|
|
|
param.put("user_id", loginUser.getId());
|
|
|
- param.put("store_id", getStoreId());
|
|
|
- param.putAll(setIsStockShare(getStoreId()));
|
|
|
+ param.put("store_id", storeId);
|
|
|
+ param.putAll(setIsStockShare(storeId));
|
|
|
List<CartVo> cartList = cartService.queryList(param);
|
|
|
//获取购物车统计信息
|
|
|
Integer goodsCount = 0;
|
|
@@ -846,7 +846,7 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
for (CartVo cart: list) {
|
|
|
cartService.delete(cart.getId());
|
|
|
}
|
|
|
- return toResponsSuccess(getCart(checkCart));
|
|
|
+ return toResponsSuccess(getCart(checkCart,storeId));
|
|
|
}catch (Exception e){
|
|
|
return toResponsFail("清空失败");
|
|
|
}
|