|
@@ -8,6 +8,7 @@ import com.kmall.api.service.*;
|
|
|
import com.kmall.api.util.ApiBaseAction;
|
|
|
import com.kmall.common.utils.MapUtils;
|
|
|
import com.qiniu.util.StringUtils;
|
|
|
+import com.sun.org.apache.xpath.internal.operations.Bool;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -100,6 +101,9 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
BigDecimal goodsAmount = new BigDecimal(0.00);
|
|
|
Integer checkedGoodsCount = 0;
|
|
|
BigDecimal checkedGoodsAmount = new BigDecimal(0.00);
|
|
|
+ List<CartVo> cart00List = new ArrayList<>();
|
|
|
+ List<CartVo> cart02List = new ArrayList<>();
|
|
|
+ List<CartVo> cart11List = new ArrayList<>();
|
|
|
for (CartVo cartItem : cartList) {
|
|
|
goodsCount += cartItem.getNumber();
|
|
|
goodsAmount = goodsAmount.add(cartItem.getRetail_price().multiply(new BigDecimal(cartItem.getNumber())));
|
|
@@ -108,10 +112,24 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
checkedGoodsAmount = checkedGoodsAmount.add(cartItem.getRetail_price().multiply(new BigDecimal(cartItem.getNumber())));
|
|
|
}
|
|
|
if(org.apache.commons.lang.StringUtils.isNotEmpty(cartItem.getGoodsBizType())){
|
|
|
- cartItem.setGoodsBizType(Dict.orderBizType.valueOf("item_"+ cartItem.getGoodsBizType()).getItemName());
|
|
|
+ cartItem.setGoodsBizTypeName(Dict.orderBizType.valueOf("item_"+ cartItem.getGoodsBizType()).getItemName());
|
|
|
}else{
|
|
|
- cartItem.setGoodsBizType("");
|
|
|
+ cartItem.setGoodsBizTypeName("");
|
|
|
}
|
|
|
+
|
|
|
+ if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
|
|
|
+ CartVo cartVo00= cartItem;
|
|
|
+ cart00List.add(cartVo00);
|
|
|
+ }
|
|
|
+ if(Dict.orderBizType.item_02.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
|
|
|
+ CartVo cartVo02= cartItem;
|
|
|
+ cart02List.add(cartVo02);
|
|
|
+ }
|
|
|
+ if(Dict.orderBizType.item_11.getItem().equalsIgnoreCase(cartItem.getGoodsBizType())){
|
|
|
+ CartVo cartVo11= cartItem;
|
|
|
+ cart11List.add(cartVo11);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
// 获取优惠信息提示 邮费
|
|
|
CouponVo shippingCoupon = apiCouponService.matchShippingSign(loginUser.getId(), checkedGoodsAmount);
|
|
@@ -128,6 +146,10 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
}
|
|
|
|
|
|
resultObj.put("couponInfoList", couponInfoList);
|
|
|
+
|
|
|
+ resultObj.put("cart00List", cart00List);//{'cartList':{'type': '保税备货','data':{}}}
|
|
|
+ resultObj.put("cart02List", cart02List);
|
|
|
+ resultObj.put("cart11List", cart11List);
|
|
|
resultObj.put("cartList", cartList);
|
|
|
//
|
|
|
Map<String, Object> cartTotal = new HashMap();
|
|
@@ -405,10 +427,21 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
JSONObject jsonParam = getJsonRequest();
|
|
|
String productIds = jsonParam.getString("productIds");
|
|
|
Integer isChecked = jsonParam.getInteger("isChecked");
|
|
|
- if (StringUtils.isNullOrEmpty(productIds)) {
|
|
|
- return this.toResponsFail("删除出错");
|
|
|
+ String goodsBizType = jsonParam.getString("goodsBizType");
|
|
|
+ String[] productIdArray = null;
|
|
|
+ if(StringUtils.isNullOrEmpty(goodsBizType)) {
|
|
|
+ if (StringUtils.isNullOrEmpty(productIds)) {//点击全选时
|
|
|
+ return this.toResponsFail("删除出错");
|
|
|
+ }
|
|
|
+ productIdArray = productIds.split(",");
|
|
|
+ }else{
|
|
|
+ //根据业务类型查询购物车
|
|
|
+ List<CartVo> cartVoList = cartService.queryCartByGoodsBizType(goodsBizType);
|
|
|
+ productIdArray = new String[cartVoList.size()];
|
|
|
+ for (int i = 0;i< cartVoList.size();i++){
|
|
|
+ productIdArray[i] =cartVoList.get(i).getProduct_id()+"";
|
|
|
+ }
|
|
|
}
|
|
|
- String[] productIdArray = productIds.split(",");
|
|
|
cartService.updateCheck(productIdArray, isChecked, loginUser.getId(), getStoreId());
|
|
|
return toResponsSuccess(getCart());
|
|
|
}
|
|
@@ -553,4 +586,25 @@ public class ApiCartController extends ApiBaseAction {
|
|
|
List<UserCouponVo> couponVos = apiUserCouponService.signUserCouponList(loginUser.getId(), checkedGoodsAmount);
|
|
|
return toResponsSuccess(couponVos);
|
|
|
}
|
|
|
+
|
|
|
+// select checked from mall_cart where goods_biz_type ='00'
|
|
|
+
|
|
|
+ @PostMapping("getCheckedDataByType")
|
|
|
+ public Object getCheckedDataByType() {
|
|
|
+
|
|
|
+ JSONObject jsonParam = getJsonRequest();
|
|
|
+ String goodsBizType = jsonParam.getString("goodsBizType");
|
|
|
+ List<CartVo> cartVoList = cartService.queryCartByGoodsBizType(goodsBizType);
|
|
|
+ for (int i=0;i<cartVoList.size();i++){
|
|
|
+ if(cartVoList.get(i).getChecked()==0){//未选中
|
|
|
+ Map map=new HashMap();
|
|
|
+ map.put("isChecked",false);
|
|
|
+ return toResponsSuccess(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map map=new HashMap();
|
|
|
+ map.put("isChecked",true);
|
|
|
+ return toResponsSuccess(map);
|
|
|
+ }
|
|
|
+
|
|
|
}
|