fwq
2024-04-23 1b4658cf9c20cef9d4cec9a63b7f5d12c47d2cb5
Merge branch 'master-fwq-积分抵扣现金' into master-test
1个文件已添加
2个文件已修改
88 ■■■■■ 已修改文件
phis-feign/src/main/java/com/hz/his/dto/order/OrderPayMethodDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phis-feign/src/main/java/com/hz/his/dto/order/OrderPayMethodDto.java
@@ -22,6 +22,13 @@
    /**是否划扣计算:0否1是*/
    private Integer isExecute;
    /** 抵扣类型 */
    private String deductionType;
    /** 抵扣金额 */
    private BigDecimal deductionMoney;
    /** 剩余抵扣金额 */
    private BigDecimal surplusDeductionTotal;
    /** 转换方式编码 (实际退款方式编码) */
    private String refundNumberNo;
    /** 转换方式名称 (实际退款方式编码)*/
@@ -43,4 +50,17 @@
        this.isMoneyPay = isMoneyPay;
        this.isExecute = isExecute;
    }
    public OrderPayMethodDto(String payMethodNo, String payMethodName, BigDecimal payTotal, Integer isMoneyPay,
                             Integer isExecute, String deductionType, BigDecimal deductionMoney,
                             BigDecimal surplusDeductionTotal) {
        this.payMethodNo = payMethodNo;
        this.payMethodName = payMethodName;
        this.payTotal = payTotal;
        this.isMoneyPay = isMoneyPay;
        this.isExecute = isExecute;
        this.deductionType = deductionType;
        this.deductionMoney = deductionMoney;
        this.surplusDeductionTotal = surplusDeductionTotal;
    }
}
phis-feign/src/main/java/com/hz/his/dto/order/PayAmountDto.java
@@ -17,6 +17,8 @@
    private BigDecimal amount;
    /**必填 支付方式*/
    private String method;
    /**必填 抵扣实际支付的金额 如果是积分抵扣现金这里存的是要支付的积分*/
    private BigDecimal deductionAmount = BigDecimal.ZERO;
    /**非必填 商品/项目id/组合项标识(卡项支付时必传组合项标识)*/
    private String commonId;
phis-feign/src/main/java/com/hz/his/vo/project/SkuDeductionVo.java
New file
@@ -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;
    /**子单可抵扣最大现金金额*/
    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本身计算的最大抵扣现金 大于 剩余要支付的现金,取剩余要支付的现金
        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);
    }
}