|
@@ -3,6 +3,7 @@ package com.caimei365.order.service.impl;
|
|
import com.caimei365.order.components.ProductService;
|
|
import com.caimei365.order.components.ProductService;
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
import com.caimei365.order.mapper.CartClubMapper;
|
|
import com.caimei365.order.mapper.CartClubMapper;
|
|
|
|
+import com.caimei365.order.mapper.OrderCommonMapper;
|
|
import com.caimei365.order.model.ResponseJson;
|
|
import com.caimei365.order.model.ResponseJson;
|
|
import com.caimei365.order.model.dto.CartDto;
|
|
import com.caimei365.order.model.dto.CartDto;
|
|
import com.caimei365.order.model.po.CartPo;
|
|
import com.caimei365.order.model.po.CartPo;
|
|
@@ -41,6 +42,8 @@ public class CartClubServiceImpl implements CartClubService {
|
|
@Resource
|
|
@Resource
|
|
private CartClubMapper cartClubMapper;
|
|
private CartClubMapper cartClubMapper;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private OrderCommonMapper orderCommonMapper;
|
|
|
|
+ @Resource
|
|
private ProductService productService;
|
|
private ProductService productService;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -75,7 +78,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
List<PromotionsVo> totalPromotions = new ArrayList<>();
|
|
List<PromotionsVo> totalPromotions = new ArrayList<>();
|
|
List<Integer> promotionsIds = new ArrayList<>();
|
|
List<Integer> promotionsIds = new ArrayList<>();
|
|
// 用户可用优惠券(总)
|
|
// 用户可用优惠券(总)
|
|
- List<CouponVo> couponList = cartClubMapper.getClubCouponList(userId);
|
|
|
|
|
|
+ List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
|
|
List<CartItemVo> cartAllProducts = new ArrayList<>();
|
|
List<CartItemVo> cartAllProducts = new ArrayList<>();
|
|
// 用户身份
|
|
// 用户身份
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(userId);
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(userId);
|
|
@@ -302,7 +305,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
CouponVo coupon = iterator.next();
|
|
CouponVo coupon = iterator.next();
|
|
if (coupon.getCouponType() == 0 && coupon.getProductType() == 2) {
|
|
if (coupon.getCouponType() == 0 && coupon.getProductType() == 2) {
|
|
// 活动券商品Ids
|
|
// 活动券商品Ids
|
|
- List<Integer> productIds = cartClubMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
|
|
|
|
+ List<Integer> productIds = orderCommonMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
coupon.setProductIds(productIds);
|
|
coupon.setProductIds(productIds);
|
|
for (CartItemVo item : cartItems) {
|
|
for (CartItemVo item : cartItems) {
|
|
if (!productIds.contains(item.getProductId())) {
|
|
if (!productIds.contains(item.getProductId())) {
|
|
@@ -361,7 +364,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
break;
|
|
break;
|
|
} else {
|
|
} else {
|
|
// 活动券商品Ids
|
|
// 活动券商品Ids
|
|
- List<Integer> productIds = cartClubMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
|
|
|
|
+ List<Integer> productIds = orderCommonMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
for (CartItemVo item : cartItems) {
|
|
for (CartItemVo item : cartItems) {
|
|
if (productIds.contains(item.getProductId())) {
|
|
if (productIds.contains(item.getProductId())) {
|
|
couponsLogo = true;
|
|
couponsLogo = true;
|
|
@@ -807,8 +810,15 @@ public class CartClubServiceImpl implements CartClubService {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // 发票信息
|
|
|
|
+ InvoiceVo invoice = baseMapper.getUserInvoice(userId);
|
|
|
|
+ // 可用余额
|
|
|
|
+ Double availableMoney = baseMapper.getAbleUserMoney(userId);
|
|
|
|
+ // 可用采美豆
|
|
|
|
+ Integer userBeans = baseMapper.getUserBeans(userId);
|
|
|
|
+
|
|
// 用户可用优惠券(总)
|
|
// 用户可用优惠券(总)
|
|
- List<CouponVo> couponList = cartClubMapper.getClubCouponList(userId);
|
|
|
|
|
|
+ List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
|
|
Iterator<CouponVo> iterator = couponList.iterator();
|
|
Iterator<CouponVo> iterator = couponList.iterator();
|
|
while (iterator.hasNext()) {
|
|
while (iterator.hasNext()) {
|
|
CouponVo coupon = iterator.next();
|
|
CouponVo coupon = iterator.next();
|
|
@@ -822,7 +832,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
totalAmount = MathUtil.add(price, totalAmount);
|
|
totalAmount = MathUtil.add(price, totalAmount);
|
|
} else if (coupon.getProductType() == 2) {
|
|
} else if (coupon.getProductType() == 2) {
|
|
//活动券-指定商品
|
|
//活动券-指定商品
|
|
- List<Integer> couponProductIds = cartClubMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
|
|
|
|
+ List<Integer> couponProductIds = orderCommonMapper.getCouponProductIds(coupon.getCouponId(), source);
|
|
if (couponProductIds.contains(item.getProductId())) {
|
|
if (couponProductIds.contains(item.getProductId())) {
|
|
BigDecimal price = MathUtil.mul(item.getPrice(), item.getNumber());
|
|
BigDecimal price = MathUtil.mul(item.getPrice(), item.getNumber());
|
|
totalAmount = MathUtil.add(price, totalAmount);
|
|
totalAmount = MathUtil.add(price, totalAmount);
|
|
@@ -859,12 +869,6 @@ public class CartClubServiceImpl implements CartClubService {
|
|
}
|
|
}
|
|
couponList.sort((o1, o2) -> o2.getCouponAmount().compareTo(o1.getCouponAmount()));
|
|
couponList.sort((o1, o2) -> o2.getCouponAmount().compareTo(o1.getCouponAmount()));
|
|
|
|
|
|
- // 发票信息
|
|
|
|
- InvoiceVo invoice = baseMapper.getUserInvoice(userId);
|
|
|
|
- // 可用余额
|
|
|
|
- Double availableMoney = baseMapper.getAbleUserMoney(userId);
|
|
|
|
- // 可用采美豆
|
|
|
|
- Integer userBeans = baseMapper.getUserBeans(userId);
|
|
|
|
// 包装返回数据
|
|
// 包装返回数据
|
|
Map<String, Object> resultData = new HashMap<>();
|
|
Map<String, Object> resultData = new HashMap<>();
|
|
resultData.put("list", shopList);
|
|
resultData.put("list", shopList);
|