From 2edfdb662767a66f3f5f3756ae7f4c128ebc5842 Mon Sep 17 00:00:00 2001
From: fwq <582742538@qq.com>
Date: 星期二, 23 四月 2024 14:24:42 +0800
Subject: [PATCH] 积分抵扣现金

---
 phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java  |   66 +++++++++++++++++++++++++++++++++
 phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java     |    2 +
 phis-feign/src/main/java/com/hz/his/dto/order/OrderItemPHisDto.java |    4 ++
 3 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/phis-feign/src/main/java/com/hz/his/dto/order/OrderItemPHisDto.java b/phis-feign/src/main/java/com/hz/his/dto/order/OrderItemPHisDto.java
index 28f4219..9ed4794 100644
--- a/phis-feign/src/main/java/com/hz/his/dto/order/OrderItemPHisDto.java
+++ b/phis-feign/src/main/java/com/hz/his/dto/order/OrderItemPHisDto.java
@@ -24,6 +24,10 @@
     private BigDecimal totalPoints;
     /**闈炲繀濉� 鎶樻墸(鍗曚綅:鐧惧垎姣�) 蹇呭~锛岄粯璁�100,涓嶄紶鍚庡彴榛樿100*/
     private BigDecimal discount;
+    /**鎶垫墸鐜伴噾閲戦*/
+    private BigDecimal cash = BigDecimal.ZERO;
+    /**鎶垫墸鐜伴噾閲戦闇�瑕佹敮浠樼殑绉垎*/
+    private BigDecimal integralCash = BigDecimal.ZERO;
     /**蹇呭~ 璐拱鏁伴噺 蹇呭~锛岄粯璁�0*/
     private Integer buyNum;
     /**蹇呭~ 椤圭洰id/鍟嗗搧id/濂楅鏍囪瘑/鍏朵粬鏍囪瘑锛堝叕鐢ㄦ爣璇嗭級 蹇呭~*/
diff --git a/phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java b/phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java
index 57030f2..99fbe70 100644
--- a/phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java
+++ b/phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java
@@ -17,6 +17,8 @@
     private BigDecimal amount;
     /**蹇呭~ 鏀粯鏂瑰紡*/
     private String method;
+    /**蹇呭~ 鎶垫墸瀹為檯鏀粯鐨勯噾棰� 濡傛灉鏄Н鍒嗘姷鎵g幇閲戣繖閲屽瓨鐨勬槸瑕佹敮浠樼殑绉垎*/
+    private BigDecimal deductionAmount = BigDecimal.ZERO;
 
     /**闈炲繀濉� 鍟嗗搧/椤圭洰id/缁勫悎椤规爣璇�(鍗¢」鏀粯鏃跺繀浼犵粍鍚堥」鏍囪瘑)*/
     private String commonId;
diff --git a/phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java b/phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java
new file mode 100644
index 0000000..8be5dde
--- /dev/null
+++ b/phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java
@@ -0,0 +1,66 @@
+package com.hz.his.vo.project;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+/**
+ * SKU鎶垫墸鏁版嵁
+ */
+@Data
+public class SkuDeductionVo {
+    /**sku鏍囪瘑*/
+    private String skuId;
+    /**sku鏈�澶у彲鎶垫墸鐜伴噾閲戦*/
+    private BigDecimal maxCash = BigDecimal.ZERO;
+    /**sku鎶垫墸鏈�澶х幇閲戦噾棰濋渶瑕佹敮浠樼殑绉垎*/
+    private BigDecimal maxIntegralCash = BigDecimal.ZERO;
+
+    /**鎬诲崟璐拱椤圭洰鏁伴噺*/
+    private Integer totalBuyNum = 0;
+    /**椤圭洰鏁伴噺鍗犳�诲崟姣�*/
+    private BigDecimal skuNumRate = BigDecimal.ZERO;
+    /**瀛愬崟璐拱鏁伴噺*/
+    private Integer buyNum = 0;
+    /**瀛愬崟鐜颁环鎬婚渶瑕佹敮浠樼殑閲戦*/
+    private BigDecimal skuPrice = BigDecimal.ZERO;
+    /**瀛愬崟鍒嗘憡绯荤粺閲戦(鍌ㄥ�奸噾+澧炲�奸噾)*/
+    private BigDecimal skuSystemPrice = BigDecimal.ZERO;
+    /**瀛愬崟浼樻儬閲戦*/
+    private BigDecimal skuDiscountPrice = BigDecimal.ZERO;
+    /**瀛愬崟鍓╀綑杩橀渶鏀粯鐨勯噾棰�*/
+    private BigDecimal skuRemainingPrice = BigDecimal.ZERO;
+    /**瀛愬崟鍙姷鎵f渶澶х幇閲戦噾棰�*/
+    private BigDecimal skuMaxCash = BigDecimal.ZERO;
+
+    /**鍓╀綑鍙垎閰�*/
+    private BigDecimal cash = BigDecimal.ZERO;
+
+    /**
+     * 璁$畻鎶垫墸閲戦
+     * */
+    public void handlerMoney() {
+        //璁$畻鍓╀綑杩樿鏀粯鐨勯噾棰�
+        this.skuRemainingPrice = this.skuPrice.subtract(this.skuSystemPrice).subtract(this.skuDiscountPrice).setScale(2, RoundingMode.HALF_UP);
+        //璁$畻瀛愬崟鏈�澶у彲鎶垫墸
+        this.skuMaxCash = this.maxCash.multiply(new BigDecimal(this.buyNum));
+        //濡傛灉Sku鏈韩璁$畻鐨勬渶澶ф姷鎵g幇閲� 澶т簬 鍓╀綑瑕佹敮浠樼殑鐜伴噾,鍙栧墿浣欒鏀粯鐨勭幇閲�
+        if (this.skuMaxCash.compareTo(this.skuRemainingPrice) > 0){
+            this.skuMaxCash = this.skuRemainingPrice;
+        }
+    }
+
+    /**璁$畻鏁伴噺*/
+    public void handlerNum(Integer totalBuyNum) {
+        this.totalBuyNum = totalBuyNum;
+        if (totalBuyNum != 0){
+            this.skuNumRate = new BigDecimal(this.buyNum).divide(new BigDecimal(this.totalBuyNum),2,RoundingMode.HALF_UP);
+        }
+    }
+
+    /**璁$畻鏁伴噺*/
+    public void handlerCash(BigDecimal totalMoney) {
+        this.cash = this.skuMaxCash.subtract(totalMoney).setScale(2,RoundingMode.HALF_UP);
+    }
+}

--
Gitblit v1.8.0