From f6137d2b84e7249548b2efd8d32db6e814eef3d2 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <cuizf@fengyuntec.com>
Date: 星期五, 13 九月 2024 18:58:20 +0800
Subject: [PATCH] 打印价格计算 双倍bug

---
 src/main/java/com/mzl/flower/service/point/CustomerPointService.java |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/mzl/flower/service/point/CustomerPointService.java b/src/main/java/com/mzl/flower/service/point/CustomerPointService.java
index a75a7a9..1f9dfa0 100644
--- a/src/main/java/com/mzl/flower/service/point/CustomerPointService.java
+++ b/src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -79,21 +79,25 @@
             point.setTotalPoint(0);
             point.setUsedPoint(0);
             point.setExpiredPoint(0);
+            point.setDeductionPoint(0);
             point.create(SecurityUtils.getUserId());
         }
 
         if(POINT_CHANGE_TYPE.add.name().equals(detail.getChangeType())){
             point.setTotalPoint(point.getTotalPoint() + detail.getPoint());
         }else if(POINT_CHANGE_TYPE.reduce.name().equals(detail.getChangeType())){
-            Integer balancePoint = point.getTotalPoint() - point.getUsedPoint()-point.getExpiredPoint();//可用积分
-            balancePoint = balancePoint.intValue()>0?balancePoint.intValue():0;
-            if(balancePoint.intValue() >= detail.getPoint().intValue()){
-                point.setUsedPoint(point.getUsedPoint() + detail.getPoint());
-            }else{
-                //积分不足,直接清0
-                point.setUsedPoint(point.getUsedPoint() + balancePoint);
-                detail.setPoint(balancePoint);
-                detail.setRemarks(detail.getRemarks()+",积分不足,扣除积分"+balancePoint);
+            Integer detailPoint = detail.getPoint();
+            if(POINT_TYPE.deduction.name().equals(detail.getType())){ //积分扣减
+                Integer balancePoint = point.getTotalPoint() - point.getUsedPoint()-point.getExpiredPoint()-point.getDeductionPoint();//可用积分
+                balancePoint = balancePoint.intValue()>0?balancePoint.intValue():0;
+                if(balancePoint.intValue() >= detail.getPoint().intValue()){
+                    point.setDeductionPoint(point.getDeductionPoint() + detail.getPoint());
+                }else{
+                    //积分不足,直接清0
+                    point.setDeductionPoint(point.getDeductionPoint() + balancePoint);
+                    detail.setPoint(balancePoint);
+                    detail.setRemarks(detail.getRemarks()+",当前积分不足"+detailPoint+",实际扣除积分"+balancePoint);
+                }
             }
         }
         if(isAdd){

--
Gitblit v1.9.3