ソースを参照

优惠券支付

zouxuan 3 年 前
コミット
e9a51a3e2e

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -211,9 +211,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(studentGoodsSell.getCouponIdList(),amount,studentGoodsSell.getType() != 1);
         amount = studentPaymentOrder.getActualAmount();
         // 判断金额是否正确
-//        if (studentGoodsSell.getTotalAmount().compareTo(amount) != 0) {
-//            throw new BizException("非法请求");
-//        }
+        if (studentGoodsSell.getTotalAmount().compareTo(amount) != 0) {
+            throw new BizException("非法请求");
+        }
         studentGoodsSell.setCouponMarketAmount(studentPaymentOrder.getCouponRemitFee());
         studentGoodsSell.setOrganId(student.getOrganId());
         studentGoodsSell.setTotalAmount(amount);
@@ -464,9 +464,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
         List<Integer> couponIdList = repairInfo.getCouponIdList();
+        BigDecimal totalAmount = amount;
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(couponIdList,amount,repairInfo.getType() != 1);
-        amount = studentPaymentOrder.getActualAmount();
-        amount = amount.subtract(repairInfo.getExemptionAmount());
+        amount = totalAmount.subtract(repairInfo.getExemptionAmount());
         if (amount.compareTo(BigDecimal.ZERO) < 0) {
             throw new BizException("特权减免金额不能大于总金额");
         }

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysCouponCodeServiceImpl.java

@@ -198,12 +198,12 @@ public class SysCouponCodeServiceImpl extends BaseServiceImpl<Long, SysCouponCod
 			if(amount.compareTo(fullAmount) < 0){
 				throw new BizException("操作失败:当前消费金额不满足优惠券满减条件");
 			}
+			amount = amount.subtract(faceAmount);
+			if (amount.signum() < 0) {
+				amount = BigDecimal.ZERO;
+			}
 			//使用优惠券
 			if(useFlag){
-				amount = amount.subtract(faceAmount);
-				if (amount.signum() < 0) {
-					amount = BigDecimal.ZERO;
-				}
 				sysCouponCodeDao.use(couponIdList);
 			}
 			studentPaymentOrder.setCouponCodeId(StringUtils.join(couponIdList,","));