金额值 改为浮点数
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package cn.ysk.cashier.mybatis.entity;
|
package cn.ysk.cashier.mybatis.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
@@ -31,9 +32,9 @@ public class TbActivateInRecord extends Model<TbActivateInRecord> {
|
|||||||
//商品id
|
//商品id
|
||||||
private Integer proId;
|
private Integer proId;
|
||||||
//满多少金额
|
//满多少金额
|
||||||
private Integer fullAmount;
|
private BigDecimal fullAmount;
|
||||||
//减多少金额
|
//减多少金额
|
||||||
private Integer discountAmount;
|
private BigDecimal discountAmount;
|
||||||
//赠送数量
|
//赠送数量
|
||||||
private Integer num;
|
private Integer num;
|
||||||
//未使用数量
|
//未使用数量
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.ysk.cashier.mybatis.entity;
|
package cn.ysk.cashier.mybatis.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||||||
//1-满减 2-商品
|
//1-满减 2-商品
|
||||||
private Integer type;
|
private Integer type;
|
||||||
//满多少金额
|
//满多少金额
|
||||||
private Integer fullAmount;
|
private BigDecimal fullAmount;
|
||||||
//减多少金额
|
//减多少金额
|
||||||
private Integer discountAmount;
|
private BigDecimal discountAmount;
|
||||||
//描述
|
//描述
|
||||||
private String description;
|
private String description;
|
||||||
//发放数量
|
//发放数量
|
||||||
@@ -98,19 +99,19 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getFullAmount() {
|
public BigDecimal getFullAmount() {
|
||||||
return fullAmount;
|
return fullAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFullAmount(Integer fullAmount) {
|
public void setFullAmount(BigDecimal fullAmount) {
|
||||||
this.fullAmount = fullAmount;
|
this.fullAmount = fullAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getDiscountAmount() {
|
public BigDecimal getDiscountAmount() {
|
||||||
return discountAmount;
|
return discountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiscountAmount(Integer discountAmount) {
|
public void setDiscountAmount(BigDecimal discountAmount) {
|
||||||
this.discountAmount = discountAmount;
|
this.discountAmount = discountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
||||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||||
if (tbShopCoupon.getType().equals(1)) {
|
if (tbShopCoupon.getType().equals(1)) {
|
||||||
if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||||
isUse = false;
|
isUse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId());
|
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId());
|
||||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||||
if (tbShopCoupon.getType().equals(1)) {
|
if (tbShopCoupon.getType().equals(1)) {
|
||||||
if (tbOrderInfo.getOrderAmount().compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
if (tbOrderInfo.getOrderAmount().compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||||
isUse = false;
|
isUse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1751,7 +1751,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
|
|
||||||
// 设置优惠券信息
|
// 设置优惠券信息
|
||||||
orderInfo.setCouponInfoList(JSONObject.toJSONString(activateInInfoVOS));
|
orderInfo.setCouponInfoList(JSONObject.toJSONString(activateInInfoVOS));
|
||||||
orderInfo.setUserCouponAmount(BigDecimal.valueOf(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(0, Integer::sum)));
|
orderInfo.setUserCouponAmount(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
// record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
// record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user