Commit 5b558fcd by 王世昌

富有对接 折扣券改为使用折扣比计算

parent 582d5f15
......@@ -3,6 +3,7 @@ package cn.freemud.entities.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
......@@ -63,11 +64,10 @@ public class GetMemberInfoResponseVo {
*/
private Integer discountAmount;
/**
* 折扣 (千分比)
* 500代表的是千分之500
/**(千分比)
* 6.5代表的是6.5折
*/
private Integer discount;
private BigDecimal discount;
/**
* 状态:-1:未激活 0:可用(剔除过期) 1:已使用 2:部分使用 3:取消 6:已过期(根据生失效日期) 99:未知(目前暂不支持)
......
......@@ -1296,10 +1296,16 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
coupon.setCouponName(each.getCouponName());
// 折扣券使用折扣字段
if(Objects.equals(each.getCouponType(),CouponTypeEnum.TYPE_3.getCode())){
coupon.setDiscount(Integer.valueOf(each.getDiscountAmount()));
int discountAmount = Integer.parseInt(Optional.ofNullable(each.getDiscountAmount()).orElse("0"));
BigDecimal discount = BigDecimal.ZERO;
// 转换千分比为小数
if (discountAmount != 0){
discount = new BigDecimal(discountAmount).divide(BigDecimal.valueOf(100),1,BigDecimal.ROUND_DOWN);
}
coupon.setDiscount(discount);
coupon.setDiscountAmount(0);
}else {
coupon.setDiscount(0);
coupon.setDiscount(BigDecimal.ZERO);
coupon.setDiscountAmount(Integer.valueOf(each.getDiscountAmount()));
}
coupon.setCouponLimit(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment