|
@@ -234,26 +234,25 @@ public class OrderHandler {
|
|
|
//整理优惠券,在下面循环中有可能会删除无法使用的优惠券
|
|
|
List<CouponItemDto> couponItemDtoList = new ArrayList<>();
|
|
|
for (CouponItemDto cid : list){
|
|
|
+
|
|
|
+ if(total < cid.getCouponConsumeEnough()){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
if(3 == cid.getCouponType()){
|
|
|
//判断抵扣券的是否能够使用
|
|
|
Exchange exchange = new Exchange();
|
|
|
exchange.setCouponId(cid.getCouponId());
|
|
|
List<Exchange> exchangeList = exchangeService.getExchangeList(exchange);
|
|
|
for (Exchange ex : exchangeList){
|
|
|
- boolean fl = false;
|
|
|
-// boolean fg = false;
|
|
|
+ boolean fl = false; //用于表示是否有兑换的产品
|
|
|
for (CartDto cartDto : cartDtos) {
|
|
|
Integer noColor = 0;
|
|
|
for (ExchangeItem exchangeItem : ex.getExchangeItemList()){
|
|
|
if(cartDto.getCartColorId().equals(exchangeItem.getColorId())){
|
|
|
fl = true;
|
|
|
- }else{
|
|
|
- noColor++;
|
|
|
}
|
|
|
}
|
|
|
- if(noColor == ex.getExchangeItemList().size()){
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
if(fl){
|
|
|
couponItemDtoList.add(cid);
|
|
@@ -297,7 +296,7 @@ public class OrderHandler {
|
|
|
|
|
|
/**
|
|
|
* 发起支付请求
|
|
|
- * @param dto 支付参数, 根据情况调整方法是否进行synchronized<br>在生成订单时不会存在安全问题
|
|
|
+ * @param request 支付参数, 根据情况调整方法是否进行synchronized<br>在生成订单时不会存在安全问题
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@@ -503,8 +502,13 @@ public class OrderHandler {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ if(!fl){
|
|
|
+ msg.setMessage(ResultInfo.COUPON_NO_MEET_DEMAND); //消费没有达到需求
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//优惠券的类型,是直接减免额度 还是折扣价
|
|
|
if(couponType.getCouponType()==1){
|
|
|
total=total-couponType.getCouponReduce();
|