You've already forked FrameTour-BE
优惠券相关+后台
This commit is contained in:
@@ -40,8 +40,12 @@ public class VideoGoodsDetailVO {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date shotTime;
|
||||
// 价格
|
||||
private Integer couponId;
|
||||
private Integer couponRecordId;
|
||||
private BigDecimal couponPrice;
|
||||
private BigDecimal origPrice;
|
||||
private String price;
|
||||
private String slashPrice;
|
||||
private BigDecimal slashPrice;
|
||||
// 是否已购买 0否 1是
|
||||
private Integer isBuy;
|
||||
// 镜头数
|
||||
@@ -51,4 +55,14 @@ public class VideoGoodsDetailVO {
|
||||
private Integer height;
|
||||
private Integer width;
|
||||
private BigDecimal duration;
|
||||
|
||||
public BigDecimal getDiscountPrice() {
|
||||
if (slashPrice == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (slashPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return slashPrice.subtract(origPrice);
|
||||
}
|
||||
}
|
||||
|
@@ -45,4 +45,20 @@ public class CouponEntity {
|
||||
return originalPrice.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice);
|
||||
}
|
||||
}
|
||||
public BigDecimal calculateDiscountPrice(String originalPrice) {
|
||||
BigDecimal priceObj = new BigDecimal(originalPrice);
|
||||
if (discountType == 0) {
|
||||
return discountPrice;
|
||||
} else {
|
||||
return priceObj.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice);
|
||||
}
|
||||
}
|
||||
public String calculateDiscountedPrice(String originalPrice) {
|
||||
BigDecimal priceObj = new BigDecimal(originalPrice);
|
||||
if (discountType == 0) {
|
||||
return priceObj.subtract(discountPrice).setScale(2, RoundingMode.HALF_DOWN).toString();
|
||||
} else {
|
||||
return priceObj.subtract(priceObj.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN).multiply(discountPrice)).setScale(2, RoundingMode.HALF_DOWN).toString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,11 +2,13 @@ package com.ycwl.basic.model.pc.couponRecord.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("coupon_record")
|
||||
public class CouponRecordEntity {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
@@ -9,4 +9,5 @@ public class CouponRecordPageQueryReq {
|
||||
private Long scenicId;
|
||||
private String couponName;
|
||||
private Integer couponType;
|
||||
private Integer status;
|
||||
}
|
Reference in New Issue
Block a user