|
@@ -239,6 +239,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
add.setPayType(3); //金币支付
|
|
add.setPayType(3); //金币支付
|
|
|
add.setOrderType(2);
|
|
add.setOrderType(2);
|
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
|
|
|
+ BigDecimal payPrice = new BigDecimal(0);
|
|
|
Boolean couponBool = true;
|
|
Boolean couponBool = true;
|
|
|
for (OrderGoodsAddBo g : goodsList) {
|
|
for (OrderGoodsAddBo g : goodsList) {
|
|
|
g.setOrderSn(out_trade_no);
|
|
g.setOrderSn(out_trade_no);
|
|
@@ -303,7 +304,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new CustomException("优惠券数据错误");
|
|
throw new CustomException("优惠券数据错误");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ //订单价格不计算优惠
|
|
|
|
|
+ totalPrice = totalPrice.add(g.getGoodsPrice());
|
|
|
//查詢該活動是否使用於此課程上
|
|
//查詢該活動是否使用於此課程上
|
|
|
if(activity!=null&&activity >0 && g.getGoodsType()==1 && activityConfigurationService.selectCount(g.getGoodsId(),activity) > 0 ){
|
|
if(activity!=null&&activity >0 && g.getGoodsType()==1 && activityConfigurationService.selectCount(g.getGoodsId(),activity) > 0 ){
|
|
|
//使用活動
|
|
//使用活動
|
|
@@ -331,7 +333,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- totalPrice = totalPrice.add(g.getGoodsPrice());
|
|
|
|
|
|
|
+ payPrice = payPrice.add(g.getGoodsPrice());
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
BigDecimal zero = new BigDecimal("0.01");
|
|
BigDecimal zero = new BigDecimal("0.01");
|
|
@@ -341,10 +343,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
}
|
|
|
add.setOrderPrice(totalPrice);
|
|
add.setOrderPrice(totalPrice);
|
|
|
|
|
|
|
|
- if(userVo.getMoney().compareTo(totalPrice) < 0){
|
|
|
|
|
|
|
+ if(payPrice.compareTo(zero) < 0){
|
|
|
|
|
+ //价格不能小于0.01
|
|
|
|
|
+ payPrice = zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ add.setPayPrice(payPrice);
|
|
|
|
|
+
|
|
|
|
|
+ if(userVo.getMoney().compareTo(payPrice) < 0){
|
|
|
throw new CustomException("金币不足");
|
|
throw new CustomException("金币不足");
|
|
|
}
|
|
}
|
|
|
- userVo.setMoney(userVo.getMoney().subtract(totalPrice));
|
|
|
|
|
|
|
+ userVo.setMoney(userVo.getMoney().subtract(payPrice));
|
|
|
add.setOrderStatus(0);
|
|
add.setOrderStatus(0);
|
|
|
if(!this.save(add)){
|
|
if(!this.save(add)){
|
|
|
throw new CustomException("订单数据错误");
|
|
throw new CustomException("订单数据错误");
|
|
@@ -459,6 +467,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
add.setOrderPrice(totalPrice);
|
|
add.setOrderPrice(totalPrice);
|
|
|
|
|
+ add.setPayPrice(totalPrice);
|
|
|
if(!this.save(add)){
|
|
if(!this.save(add)){
|
|
|
throw new CustomException("订单数据错误");
|
|
throw new CustomException("订单数据错误");
|
|
|
}
|
|
}
|