Ver código fonte

Merge remote-tracking branch 'origin/master' into test

lwhhszx 1 ano atrás
pai
commit
e2c9555fee

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/service/InviteMessageService.java

@@ -78,7 +78,7 @@ public class InviteMessageService extends ServiceImpl<InviteMessageMapper, Invit
                 return 0;
             } else {
                 //TODO 给邀请人赠送优惠券
-                activityService.doingActivity(inviteMessage.getInvitedPersonUuid(),ACTIVITY_SCOPE);
+                activityService.doingActivity(inviteMessage.getInvitePersonUuid(),ACTIVITY_SCOPE);
                 inviteMessage.setIfBuyVip(true);
                 inviteMessage.updateById();
                 return 3;

+ 15 - 4
src/main/java/com/example/xiaoshiweixinback/service/OrderService.java

@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -119,13 +120,23 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
         //计算商品价格
         GoodImp goodImp = goodFactory.getClass(type);
         Double allPrice =  goodImp.computePrice(goodVOS);
-     Double withVocherPrice =allPrice-voucherMon;
-     if(withVocherPrice<=0){
-         withVocherPrice=0d;
+        System.out.println("总价"+allPrice);
+        System.out.println("卷值"+voucherMon);
+        BigDecimal allPriceBig =new BigDecimal(allPrice.toString());
+        BigDecimal   voucherMonBig    =new BigDecimal(voucherMon.toString());
+     BigDecimal withVocherPriceBig =allPriceBig.subtract(voucherMonBig);
+        BigDecimal discontBig =new BigDecimal(discount.toString());
+
+     if(voucherMonBig.doubleValue()<=0){
+         withVocherPriceBig=new BigDecimal("0");
      }
         //查看是否有折扣
         // 计算价格 (商品总价格-优惠券) *折扣
-        Double truePrice =withVocherPrice*discount;
+        BigDecimal truePriceBig =withVocherPriceBig.multiply(discontBig);
+     System.out.println("价格"+truePriceBig);
+
+     System.out.println("折扣"+discontBig);
+     Double truePrice=truePriceBig.doubleValue();
         if(!truePrice.equals(price)){
             throw new BusinessException(ExceptionEnum.BUSINESS_ERROR,"价格错误");
         }