|
@@ -331,6 +331,10 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
Coupon coupon = couponService.getById(couponReceive.getCouponId());
|
|
|
log.info("订单信息,{}", tOrder);
|
|
|
log.info("优惠卷信息,{}", coupon);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//折扣券
|
|
|
if (coupon.getDiscountType() == 2) {
|
|
|
//判断门槛金额
|
|
@@ -342,7 +346,6 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
//优惠值
|
|
|
orderVerificationVo.setPreferential(tOrder.getTotalPrice().subtract(bigDecimal));
|
|
|
orderVerificationVo.setTotalPrice(bigDecimal);
|
|
|
- return orderVerificationVo;
|
|
|
} else {
|
|
|
throw new ServiceException("不满足优惠券门槛金额");
|
|
|
}
|
|
@@ -351,11 +354,14 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
//优惠值
|
|
|
orderVerificationVo.setPreferential(coupon.getDiscountValue());
|
|
|
orderVerificationVo.setTotalPrice(tOrder.getTotalPrice().subtract(coupon.getDiscountValue()));
|
|
|
- return orderVerificationVo;
|
|
|
} else {
|
|
|
throw new ServiceException("不满足优惠券门槛金额");
|
|
|
}
|
|
|
}
|
|
|
+ if(orderVerificationVo.getTotalPrice().compareTo(BigDecimal.ZERO)<0){
|
|
|
+ throw new ServiceException("当前项目不可用");
|
|
|
+ }
|
|
|
+ return orderVerificationVo;
|
|
|
}
|
|
|
|
|
|
private TOrder getOrder(TOrder tOrder) {
|
|
@@ -387,6 +393,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
}
|
|
|
|
|
|
orderNew.setPayType(order.getPayType());
|
|
|
+ //优惠券核销
|
|
|
if (StringUtils.isNotBlank(order.getCouponReceiveId())) {
|
|
|
orderNew.setCouponReceiveId(order.getCouponReceiveId());
|
|
|
orderNew.setPreferential(order.getPreferential());
|
|
@@ -434,11 +441,15 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void orderPayManage(TWxUser user, TOrder orderNew) {
|
|
|
-
|
|
|
- //删除优惠卷
|
|
|
-// if(orderNew.){
|
|
|
-//
|
|
|
-// }
|
|
|
+ //更新优惠卷状态
|
|
|
+ if(StringUtils.isNotBlank(orderNew.getCouponReceiveId())){
|
|
|
+ CouponReceive couponReceive = new CouponReceive();
|
|
|
+ couponReceive.setId(orderNew.getCouponReceiveId());
|
|
|
+ couponReceive.setUseState(MassageConstants.INTEGER_TWO);
|
|
|
+ if(!couponReceiveService.updateById(couponReceive)){
|
|
|
+ log.error("优惠券状态更新失败id:,{}",orderNew.getCouponReceiveId());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 更新用户金额 及下单此时
|
|
|
TWxUser paramUser = new TWxUser();
|