From 852ec1d729b61077d8131591a5349c7e4a1bed79 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期五, 30 八月 2024 17:20:55 +0800
Subject: [PATCH] Merge branch 'master' into master-v2
---
src/main/java/com/mzl/flower/service/point/CustomerPointService.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 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 6353061..bb55190 100644
--- a/src/main/java/com/mzl/flower/service/point/CustomerPointService.java
+++ b/src/main/java/com/mzl/flower/service/point/CustomerPointService.java
@@ -17,6 +17,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
@@ -118,4 +119,22 @@
//更新汇总表
updateCustomerPoint(detail);
}
+
+ public void consumptionPoint(BigDecimal orderAmount, String orderNo,String userId) {
+ CustomerPointDetail detail = new CustomerPointDetail();
+ Customer customer = getCustomerByUserId(userId);
+ detail.setCustomerId(customer.getId());
+ detail.setUserId(customer.getUserId());
+ BigDecimal point = orderAmount.setScale(0, BigDecimal.ROUND_HALF_UP);
+ detail.setPoint(point.intValue());
+ detail.setRemarks(orderNo);
+ detail.setRecordDate(LocalDate.now());
+ detail.setChangeType(POINT_CHANGE_TYPE.add.name());
+ detail.setType(POINT_TYPE.consume.name());
+ detail.create(SecurityUtils.getUserId());
+ customerPointDetailMapper.insert(detail);
+
+ //更新汇总表
+ updateCustomerPoint(detail);
+ }
}
--
Gitblit v1.9.3