feat: 1.临时菜接口 2.购物车数量字段修改为decimal类型
This commit is contained in:
@@ -19,8 +19,6 @@ public class OrderVo {
|
||||
private Integer type;
|
||||
|
||||
private String sendType;
|
||||
|
||||
private String eatModel;
|
||||
@Min(1)
|
||||
private Integer seatNum;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@Data
|
||||
public class TbCashierCart implements Serializable {
|
||||
@@ -12,9 +16,9 @@ public class TbCashierCart implements Serializable {
|
||||
|
||||
private String masterId;
|
||||
|
||||
private String orderId;
|
||||
private Integer orderId;
|
||||
|
||||
private String refOrderId;
|
||||
private Integer refOrderId;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@@ -29,48 +33,62 @@ public class TbCashierCart implements Serializable {
|
||||
private String name;
|
||||
|
||||
private BigDecimal salePrice;
|
||||
private BigDecimal packFee;
|
||||
|
||||
private Integer number;
|
||||
private BigDecimal number;
|
||||
|
||||
private Integer totalNumber;
|
||||
private BigDecimal totalNumber;
|
||||
|
||||
private Integer refundNumber;
|
||||
private BigDecimal refundNumber;
|
||||
|
||||
private String categoryId;
|
||||
private String tradeDay;
|
||||
|
||||
private String status;
|
||||
|
||||
private Byte type;
|
||||
private Integer type;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
private String isPack;
|
||||
private String isGift;
|
||||
private String skuName;
|
||||
private String uuid;
|
||||
|
||||
private Long createdAt;
|
||||
private Long pendingAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String tableId;
|
||||
private String useType;
|
||||
|
||||
private BigDecimal packFee;
|
||||
|
||||
private String tradeDay;
|
||||
|
||||
private String isPack;
|
||||
|
||||
private String isGift;
|
||||
|
||||
private Long pendingAt;
|
||||
|
||||
private String uuid;
|
||||
private String skuName;
|
||||
private Integer placeNum;
|
||||
private String note;
|
||||
private String useType;
|
||||
private String platformType;
|
||||
private BigDecimal memberPrice;
|
||||
// 优惠券id
|
||||
private Integer userCouponId;
|
||||
private BigDecimal memberPrice = BigDecimal.ZERO;
|
||||
private Integer isMember;
|
||||
// 是否临时菜品
|
||||
private Integer isTemporary;
|
||||
private String unit;
|
||||
private BigDecimal discountSaleAmount;
|
||||
private String discountSaleNote;
|
||||
private Boolean isPrint;
|
||||
private String useCouponInfo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private TbProductSpec tbProductSpec;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String selectSpec="";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public void copy(TbCashierCart source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
@@ -81,12 +99,58 @@ public class TbCashierCart implements Serializable {
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
}else {
|
||||
} else {
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(memberPrice).add(packFee);
|
||||
}else {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee);
|
||||
totalAmount = totalNumber.multiply(memberPrice).add(packFee);
|
||||
} else {
|
||||
totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount(BigDecimal discountRadio) {
|
||||
if (discountRadio == null) {
|
||||
discountRadio = BigDecimal.ONE;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
totalAmount = totalNumber.multiply(memberPrice).add(packFee).multiply(discountRadio);
|
||||
} else {
|
||||
totalAmount = totalNumber.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总价不包含打包费
|
||||
*
|
||||
*/
|
||||
public BigDecimal getTotalAmountByNum(BigDecimal num, BigDecimal discountRadio) {
|
||||
if (discountRadio == null) {
|
||||
discountRadio = new BigDecimal("1");
|
||||
}
|
||||
if (num == null) {
|
||||
num = totalNumber;
|
||||
}
|
||||
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
return num.multiply(memberPrice).multiply(discountRadio).add(packFee).setScale(2, RoundingMode.HALF_UP);
|
||||
}else {
|
||||
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// return num.multiply(memberPrice);
|
||||
// } else {
|
||||
// return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer num;
|
||||
private Integer returnNum;
|
||||
private BigDecimal num;
|
||||
private BigDecimal returnNum;
|
||||
|
||||
private String productName;
|
||||
private String status;
|
||||
|
||||
@@ -15,12 +15,6 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private Integer specId;
|
||||
|
||||
private String sourcePath;
|
||||
|
||||
private Integer brandId;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
|
||||
private String name;
|
||||
@@ -33,103 +27,34 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unitSnap;
|
||||
|
||||
private String coverImg;
|
||||
|
||||
private String shareImg;
|
||||
|
||||
private String videoCoverImg;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer limitNumber;
|
||||
|
||||
private Integer productScore;
|
||||
|
||||
private Byte status;
|
||||
|
||||
private String failMsg;
|
||||
|
||||
private Byte isRecommend;
|
||||
|
||||
private Byte isHot;
|
||||
|
||||
private Byte isNew;
|
||||
|
||||
private Byte isOnSale;
|
||||
|
||||
private Byte isShow;
|
||||
|
||||
private String typeEnum;
|
||||
|
||||
/**
|
||||
* 是否共享库存
|
||||
*/
|
||||
private Byte isDistribute;
|
||||
|
||||
private Byte isDel;
|
||||
|
||||
private Byte isStock;
|
||||
|
||||
private Byte isPauseSale;
|
||||
|
||||
private Byte isFreeFreight;
|
||||
|
||||
private Long freightId;
|
||||
|
||||
private String strategyType;
|
||||
|
||||
private Integer strategyId;
|
||||
|
||||
private Byte isVip;
|
||||
|
||||
private Byte isDelete;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Double baseSalesNumber;
|
||||
|
||||
private Integer realSalesNumber;
|
||||
|
||||
private Integer salesNumber;
|
||||
|
||||
private Integer thumbCount;
|
||||
|
||||
private Integer storeCount;
|
||||
|
||||
private Integer furnishMeal;
|
||||
|
||||
private Integer furnishExpress;
|
||||
|
||||
private Integer furnishDraw;
|
||||
|
||||
private Integer furnishVir;
|
||||
|
||||
private Byte isCombo;
|
||||
|
||||
private Byte isShowCash;
|
||||
|
||||
private Byte isShowMall;
|
||||
|
||||
private Byte isNeedExamine;
|
||||
|
||||
private Byte showOnMallStatus;
|
||||
|
||||
private Long showOnMallTime;
|
||||
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
private Byte enableLabel;
|
||||
|
||||
private String taxConfigId;
|
||||
|
||||
private String specTableHeaders;
|
||||
|
||||
private Integer stockNumber;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AddTemporaryDishesDTO {
|
||||
@NotEmpty
|
||||
private String masterId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotBlank(message = "菜品名不为空")
|
||||
private String name;
|
||||
@NotNull(message = "分类不为空")
|
||||
private Integer categoryId;
|
||||
@Min(value = 0, message = "价格最低为0")
|
||||
private BigDecimal price;
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01")
|
||||
private BigDecimal num;
|
||||
@NotBlank(message = "单位不为空")
|
||||
private String unit;
|
||||
private String note;
|
||||
private Integer vipUserId;
|
||||
}
|
||||
@@ -7,13 +7,24 @@ import lombok.Data;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ShopEatTypeInfoDTO {
|
||||
// 是否外带
|
||||
private boolean isTakeout;
|
||||
// 是否快餐
|
||||
private boolean isMunchies;
|
||||
// 是否后付费
|
||||
private boolean isDineInAfter;
|
||||
// 是否先付费
|
||||
private boolean isDineInBefore;
|
||||
// 是否需要餐位费
|
||||
private boolean needSeatFee;
|
||||
// 是否无桌台下单
|
||||
private boolean isNoneTable;
|
||||
// 是否增加masterId
|
||||
private boolean isIncrMaterId;
|
||||
private boolean isMemberPrice;
|
||||
private TbShopInfo shopInfo;
|
||||
private String useType;
|
||||
private Object shopId;
|
||||
private String tableId;
|
||||
private String sendType;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CartVo {
|
||||
@@ -12,8 +14,9 @@ public class CartVo {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private Integer skuId;
|
||||
@Min(1)
|
||||
private Integer number;
|
||||
@NotNull
|
||||
@DecimalMin("0.01")
|
||||
private BigDecimal number;
|
||||
private String isPack;
|
||||
private String isGift;
|
||||
private String status;
|
||||
|
||||
Reference in New Issue
Block a user