|
|
|
@ -15,7 +15,7 @@ import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.ShopException; |
|
|
|
|
import co.yixiang.api.BusinessException; |
|
|
|
|
import co.yixiang.common.service.impl.BaseServiceImpl; |
|
|
|
|
import co.yixiang.common.utils.QueryHelpPlus; |
|
|
|
@ -39,7 +39,6 @@ import co.yixiang.modules.cart.domain.YxStoreCart;
|
|
|
|
|
import co.yixiang.modules.cart.service.YxStoreCartService; |
|
|
|
|
import co.yixiang.modules.cart.service.mapper.StoreCartMapper; |
|
|
|
|
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo; |
|
|
|
|
import co.yixiang.modules.category.domain.YxStoreCategory; |
|
|
|
|
import co.yixiang.modules.category.service.YxStoreCategoryService; |
|
|
|
|
import co.yixiang.modules.order.domain.YxExpress; |
|
|
|
|
import co.yixiang.modules.order.domain.YxStoreOrder; |
|
|
|
@ -110,7 +109,6 @@ import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
import java.util.function.Consumer; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -227,12 +225,12 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
cartIds, ShopConstants.ZSW_ONE_NUM); |
|
|
|
|
List<YxStoreCartQueryVo> list = new ArrayList<>(); |
|
|
|
|
if (ObjectUtil.isNotEmpty(cartGroup.get("invalidProductList"))) { |
|
|
|
|
throw new YshopException("有失效的商品请重新提交"); |
|
|
|
|
throw new ShopException("有失效的商品请重新提交"); |
|
|
|
|
}; |
|
|
|
|
cartGroup.get("cartList").forEach(item->{ |
|
|
|
|
YxStoreBrandCart yxStoreBrandCart=(YxStoreBrandCart)item; |
|
|
|
|
if (ObjectUtil.isEmpty(yxStoreBrandCart.getValidProductList())) { |
|
|
|
|
throw new YshopException("请提交购买的商品"); |
|
|
|
|
throw new ShopException("请提交购买的商品"); |
|
|
|
|
} |
|
|
|
|
list.addAll(yxStoreBrandCart.getValidProductList()); |
|
|
|
|
}); |
|
|
|
@ -327,7 +325,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
Long uid = userInfo.getUid(); |
|
|
|
|
CacheDto cacheDTO = this.getCacheOrderInfo(uid, key); |
|
|
|
|
if (ObjectUtil.isNull(cacheDTO)) { |
|
|
|
|
throw new YshopException("订单已过期,请刷新当前页面"); |
|
|
|
|
throw new ShopException("订单已过期,请刷新当前页面"); |
|
|
|
|
} |
|
|
|
|
BigDecimal payPrice = cacheDTO.getPriceGroup().getTotalPrice(); |
|
|
|
|
|
|
|
|
@ -369,11 +367,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
if (StrUtil.isNotBlank(couponId) && !ShopConstants.ZSW_ZERO.equals(couponId)) {//使用优惠券
|
|
|
|
|
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId), uid); |
|
|
|
|
if (couponUser == null) { |
|
|
|
|
throw new YshopException("使用优惠劵失败"); |
|
|
|
|
throw new ShopException("使用优惠劵失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (couponUser.getUseMinPrice().compareTo(payPrice) > 0) { |
|
|
|
|
throw new YshopException("不满足优惠劵的使用条件"); |
|
|
|
|
throw new ShopException("不满足优惠劵的使用条件"); |
|
|
|
|
} |
|
|
|
|
payPrice = NumberUtil.sub(payPrice, couponUser.getCouponPrice()); |
|
|
|
|
couponPrice = couponUser.getCouponPrice(); |
|
|
|
@ -443,15 +441,15 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
YxUserAddress userAddress = null; |
|
|
|
|
if (OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))) { |
|
|
|
|
if (StrUtil.isEmpty(param.getAddressId())) { |
|
|
|
|
throw new YshopException("请选择收货地址"); |
|
|
|
|
throw new ShopException("请选择收货地址"); |
|
|
|
|
} |
|
|
|
|
userAddress = userAddressService.getById(param.getAddressId()); |
|
|
|
|
if (ObjectUtil.isNull(userAddress)) { |
|
|
|
|
throw new YshopException("地址选择有误"); |
|
|
|
|
throw new ShopException("地址选择有误"); |
|
|
|
|
} |
|
|
|
|
} else { //门店
|
|
|
|
|
if (StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) { |
|
|
|
|
throw new YshopException("请填写姓名和电话"); |
|
|
|
|
throw new ShopException("请填写姓名和电话"); |
|
|
|
|
} |
|
|
|
|
userAddress = new YxUserAddress(); |
|
|
|
|
userAddress.setRealName(param.getRealName()); |
|
|
|
@ -560,7 +558,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
|
|
|
|
|
boolean res = this.save(storeOrder); |
|
|
|
|
if (!res) { |
|
|
|
|
throw new YshopException("订单生成失败"); |
|
|
|
|
throw new ShopException("订单生成失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//使用了积分扣积分
|
|
|
|
@ -649,14 +647,14 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
String serviceScore) { |
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(orderCartInfo)) { |
|
|
|
|
throw new YshopException("评价产品不存在"); |
|
|
|
|
throw new ShopException("评价产品不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Long count = productReplyService.count(Wrappers.<YxStoreProductReply>lambdaQuery() |
|
|
|
|
.eq(YxStoreProductReply::getOid, orderCartInfo.getOid()) |
|
|
|
|
.eq(YxStoreProductReply::getProductId, orderCartInfo.getProductId())); |
|
|
|
|
if (count > 0) { |
|
|
|
|
throw new YshopException("该产品已评价"); |
|
|
|
|
throw new ShopException("该产品已评价"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -697,20 +695,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
|
|
|
|
|
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null); |
|
|
|
|
if (ObjectUtil.isNull(orderQueryVo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid()); |
|
|
|
|
if (ObjectUtil.isNull(userQueryVo)) { |
|
|
|
|
throw new YshopException("用户不存在"); |
|
|
|
|
throw new ShopException("用户不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())) { |
|
|
|
|
throw new YshopException("订单已经退款了哦!"); |
|
|
|
|
throw new ShopException("订单已经退款了哦!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderQueryVo.getPayPrice().compareTo(price) < 0) { |
|
|
|
|
throw new YshopException("退款金额不正确"); |
|
|
|
|
throw new ShopException("退款金额不正确"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
@ -798,7 +796,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
@Override |
|
|
|
|
public void orderCheck(String orderId) { |
|
|
|
|
if (StringUtils.isEmpty(orderId)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
YxStoreOrder storeOrder=yxStoreOrderService.lambdaQuery() |
|
|
|
|
.eq(YxStoreOrder::getOrderId,orderId).one(); |
|
|
|
@ -819,21 +817,21 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void orderDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) { |
|
|
|
|
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null); |
|
|
|
|
if (ObjectUtil.isNull(orderQueryVo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!OrderInfoEnum.STATUS_5.getValue().equals(orderQueryVo.getStatus()) || |
|
|
|
|
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { |
|
|
|
|
throw new YshopException("订单状态错误"); |
|
|
|
|
throw new ShopException("订单状态错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!OrderInfoEnum.REFUND_STATUS_0.getValue().equals(orderQueryVo.getRefundStatus())) { |
|
|
|
|
throw new YshopException("订单退款中或已退款"); |
|
|
|
|
throw new ShopException("订单退款中或已退款"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName, deliveryName)); |
|
|
|
|
if (ObjectUtil.isNull(expressQueryVo)) { |
|
|
|
|
throw new YshopException("请后台先添加快递公司"); |
|
|
|
|
throw new ShopException("请后台先添加快递公司"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// //判断拼团产品--现允许未成团单独发货
|
|
|
|
@ -890,17 +888,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void updateDelivery(String orderId, String deliveryId, String deliveryName, String deliveryType) { |
|
|
|
|
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId, null); |
|
|
|
|
if (ObjectUtil.isNull(orderQueryVo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!OrderInfoEnum.STATUS_1.getValue().equals(orderQueryVo.getStatus()) || |
|
|
|
|
OrderInfoEnum.PAY_STATUS_0.getValue().equals(orderQueryVo.getPaid())) { |
|
|
|
|
throw new YshopException("订单状态错误"); |
|
|
|
|
throw new ShopException("订单状态错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName, deliveryName)); |
|
|
|
|
if (ObjectUtil.isNull(expressQueryVo)) { |
|
|
|
|
throw new YshopException("请后台先添加快递公司"); |
|
|
|
|
throw new ShopException("请后台先添加快递公司"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -926,7 +924,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void editOrderPrice(String orderId, String price) { |
|
|
|
|
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId, null); |
|
|
|
|
if (ObjectUtil.isNull(orderQueryVo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -936,7 +934,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) { |
|
|
|
|
throw new YshopException("订单状态错误"); |
|
|
|
|
throw new ShopException("订单状态错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -983,7 +981,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void deleteOrder(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(order)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
//更新订单状态
|
|
|
|
|
LambdaQueryWrapper<YxStoreOrder> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
@ -1005,7 +1003,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void cancelOrder(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(order)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.regressionIntegral(order, 0); |
|
|
|
@ -1034,11 +1032,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void removeOrder(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = getOrderInfo(orderId, (long) uid); |
|
|
|
|
if (order == null) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
order = handleOrder(order); |
|
|
|
|
if (!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) { |
|
|
|
|
throw new YshopException("该订单无法删除"); |
|
|
|
|
throw new ShopException("该订单无法删除"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
yxStoreOrderMapper.deleteById(order.getId()); |
|
|
|
@ -1060,7 +1058,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void takeOrder(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = this.getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(order)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
order = handleOrder(order); |
|
|
|
|
if (!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) { |
|
|
|
@ -1102,25 +1100,25 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue()) |
|
|
|
|
.eq(YxStoreOrder::getRefundStatus, OrderInfoEnum.REFUND_STATUS_0.getValue())); |
|
|
|
|
if (order == null) { |
|
|
|
|
throw new YshopException("核销的订单不存在或未支付或已退款"); |
|
|
|
|
throw new ShopException("核销的订单不存在或未支付或已退款"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (uid != null) { |
|
|
|
|
boolean checkStatus = systemStoreStaffService.checkStatus(uid, order.getStoreId()); |
|
|
|
|
if (!checkStatus) { |
|
|
|
|
throw new YshopException("您没有当前店铺核销权限"); |
|
|
|
|
throw new ShopException("您没有当前店铺核销权限"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) { |
|
|
|
|
throw new YshopException("订单已经核销"); |
|
|
|
|
throw new ShopException("订单已经核销"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (order.getCombinationId() != null && order.getCombinationId() > 0 |
|
|
|
|
&& order.getPinkId() != null && order.getPinkId() > 0) { |
|
|
|
|
YxStorePink storePink = storePinkService.getById(order.getPinkId()); |
|
|
|
|
if (!OrderInfoEnum.PINK_STATUS_2.getValue().equals(storePink.getStatus())) { |
|
|
|
|
throw new YshopException("拼团订单暂未成功无法核销"); |
|
|
|
|
throw new ShopException("拼团订单暂未成功无法核销"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1163,17 +1161,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void orderApplyRefund(String explain, String Img, String text, String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo order = getOrderInfo(orderId, uid); |
|
|
|
|
if (order == null) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())) { |
|
|
|
|
throw new YshopException("订单已退款"); |
|
|
|
|
throw new ShopException("订单已退款"); |
|
|
|
|
} |
|
|
|
|
if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) { |
|
|
|
|
throw new YshopException("正在申请退款中"); |
|
|
|
|
throw new ShopException("正在申请退款中"); |
|
|
|
|
} |
|
|
|
|
if (OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) { |
|
|
|
|
throw new YshopException("订单当前无法退款"); |
|
|
|
|
throw new ShopException("订单当前无法退款"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxStoreOrder storeOrder = new YxStoreOrder(); |
|
|
|
@ -1706,18 +1704,18 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public String aliPay(String orderId) throws Exception { |
|
|
|
|
AlipayConfig alipay = alipayService.find(); |
|
|
|
|
if (ObjectUtil.isNull(alipay)) { |
|
|
|
|
throw new YshopException("请先配置支付宝"); |
|
|
|
|
throw new ShopException("请先配置支付宝"); |
|
|
|
|
} |
|
|
|
|
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, null); |
|
|
|
|
if (ObjectUtil.isNull(orderInfo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { |
|
|
|
|
throw new YshopException("该订单已支付"); |
|
|
|
|
throw new ShopException("该订单已支付"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) { |
|
|
|
|
throw new YshopException("该支付无需支付"); |
|
|
|
|
throw new ShopException("该支付无需支付"); |
|
|
|
|
} |
|
|
|
|
TradeVo trade = new TradeVo(); |
|
|
|
|
trade.setOutTradeNo(orderId); |
|
|
|
@ -1736,17 +1734,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void yuePay(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(orderInfo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { |
|
|
|
|
throw new YshopException("该订单已支付"); |
|
|
|
|
throw new ShopException("该订单已支付"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
YxUserQueryVo userInfo = userService.getYxUserById(uid); |
|
|
|
|
|
|
|
|
|
if (userInfo.getNowMoney().compareTo(orderInfo.getPayPrice()) < 0) { |
|
|
|
|
throw new YshopException("余额不足"); |
|
|
|
|
throw new ShopException("余额不足"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
userService.decPrice(uid, orderInfo.getPayPrice()); |
|
|
|
@ -1766,22 +1764,22 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
public void integralPay(String orderId, Long uid) { |
|
|
|
|
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId, uid); |
|
|
|
|
if (ObjectUtil.isNull(orderInfo)) { |
|
|
|
|
throw new YshopException("订单不存在"); |
|
|
|
|
throw new ShopException("订单不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) { |
|
|
|
|
throw new YshopException("该订单已支付"); |
|
|
|
|
throw new ShopException("该订单已支付"); |
|
|
|
|
} |
|
|
|
|
orderInfo = handleOrder(orderInfo); |
|
|
|
|
orderInfo.getCartInfo().forEach(cart -> { |
|
|
|
|
if (cart.getProductInfo().getIsIntegral() == 0) { |
|
|
|
|
throw new YshopException("该商品不为积分商品"); |
|
|
|
|
throw new ShopException("该商品不为积分商品"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
YxUser userInfo = userService.getById(uid); |
|
|
|
|
|
|
|
|
|
if (userInfo.getIntegral().compareTo(orderInfo.getPayIntegral()) < 0) { |
|
|
|
|
throw new YshopException("积分不足"); |
|
|
|
|
throw new ShopException("积分不足"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//扣除积分
|
|
|
|
|