feat: 1.餐位费允许增减数量 2.选择人数根据店铺配置决定是否操作
This commit is contained in:
@@ -62,6 +62,8 @@ public interface TableConstant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CashierCart {
|
class CashierCart {
|
||||||
|
public static final String ID = "-999";
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum Status {
|
public enum Status {
|
||||||
REFUNDING("refunding"), REFUND("refund"), CLOSED("closed"), CREATE("create"),
|
REFUNDING("refunding"), REFUND("refund"), CLOSED("closed"), CREATE("create"),
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ public class OrderController {
|
|||||||
*/
|
*/
|
||||||
@PutMapping("/choseCount")
|
@PutMapping("/choseCount")
|
||||||
public Result choseCount(@Validated @RequestBody ChoseCountDTO choseCountDTO) {
|
public Result choseCount(@Validated @RequestBody ChoseCountDTO choseCountDTO) {
|
||||||
|
if (choseCountDTO.getNum() == null) {
|
||||||
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS, orderService.choseCount(choseCountDTO));
|
return Result.success(CodeEnum.SUCCESS, orderService.choseCount(choseCountDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public class ChoseCountDTO {
|
|||||||
private Integer shopId;
|
private Integer shopId;
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
private String tableId;
|
private String tableId;
|
||||||
@NotNull
|
|
||||||
@Min(1)
|
@Min(1)
|
||||||
private Integer num;
|
private Integer num;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public class ShopEatTypeInfoDTO {
|
|||||||
private boolean isMunchies;
|
private boolean isMunchies;
|
||||||
private boolean isDineInAfter;
|
private boolean isDineInAfter;
|
||||||
private boolean isDineInBefore;
|
private boolean isDineInBefore;
|
||||||
|
private boolean needSeatFee;
|
||||||
private TbShopInfo shopInfo;
|
private TbShopInfo shopInfo;
|
||||||
private String useType;
|
private String useType;
|
||||||
private String sendType;
|
private String sendType;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (TbShopPermission)表服务接口
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-09-14 17:08:48
|
||||||
|
*/
|
||||||
|
public interface MpShopTableService extends IService<TbShopTable> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -96,6 +96,7 @@ public class OrderService {
|
|||||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||||
private final MpShopTableMapper mpShopTableMapper;
|
private final MpShopTableMapper mpShopTableMapper;
|
||||||
private final MpOrderInfoService mpOrderInfoService;
|
private final MpOrderInfoService mpOrderInfoService;
|
||||||
|
private final MpShopTableService mpShopTableService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbConsInfoMapper tbConsInfoMapper;
|
TbConsInfoMapper tbConsInfoMapper;
|
||||||
@@ -132,13 +133,14 @@ public class OrderService {
|
|||||||
|
|
||||||
|
|
||||||
public OrderService(WxAccountUtil wxAccountUtil, MPCashierCartMapper mpCashierCartMapper,
|
public OrderService(WxAccountUtil wxAccountUtil, MPCashierCartMapper mpCashierCartMapper,
|
||||||
TbShopOpenIdMapper shopOpenIdMapper, MpShopTableMapper mpShopTableMapper, MpOrderInfoService mpOrderInfoService,
|
TbShopOpenIdMapper shopOpenIdMapper, MpShopTableMapper mpShopTableMapper, MpOrderInfoService mpOrderInfoService, MpShopTableService mpShopTableService,
|
||||||
TbCashierCartMapper tbCashierCartMapper, MpCashierCartService mpCashierCartService) {
|
TbCashierCartMapper tbCashierCartMapper, MpCashierCartService mpCashierCartService) {
|
||||||
this.wxAccountUtil = wxAccountUtil;
|
this.wxAccountUtil = wxAccountUtil;
|
||||||
this.mpCashierCartMapper = mpCashierCartMapper;
|
this.mpCashierCartMapper = mpCashierCartMapper;
|
||||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||||
this.mpShopTableMapper = mpShopTableMapper;
|
this.mpShopTableMapper = mpShopTableMapper;
|
||||||
this.mpOrderInfoService = mpOrderInfoService;
|
this.mpOrderInfoService = mpOrderInfoService;
|
||||||
|
this.mpShopTableService = mpShopTableService;
|
||||||
this.tbCashierCartMapper = tbCashierCartMapper;
|
this.tbCashierCartMapper = tbCashierCartMapper;
|
||||||
this.mpCashierCartService = mpCashierCartService;
|
this.mpCashierCartService = mpCashierCartService;
|
||||||
}
|
}
|
||||||
@@ -162,8 +164,9 @@ public class OrderService {
|
|||||||
|
|
||||||
boolean isDineInAfter = !isMunchies && !isTakeout;
|
boolean isDineInAfter = !isMunchies && !isTakeout;
|
||||||
boolean isDineInBefore = isMunchies && !isTakeout;
|
boolean isDineInBefore = isMunchies && !isTakeout;
|
||||||
|
boolean needSeatFee = shopInfo.getIsTableFee() == null || shopInfo.getIsTableFee() == 0;
|
||||||
|
|
||||||
return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() :
|
return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, needSeatFee, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() :
|
||||||
isMunchies ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : OrderUseTypeEnum.DINE_IN_AFTER.getValue(), isTakeout ? OrderSendTypeEnums.TAKE_SELF.getValue() : OrderSendTypeEnums.TABLE.getValue());
|
isMunchies ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : OrderUseTypeEnum.DINE_IN_AFTER.getValue(), isTakeout ? OrderSendTypeEnums.TAKE_SELF.getValue() : OrderSendTypeEnums.TABLE.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,26 +181,9 @@ public class OrderService {
|
|||||||
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
String eatModel = StrUtil.isBlank(tableId) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue();
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, eatModel);
|
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, eatModel);
|
||||||
|
|
||||||
TbProduct product = mpProductMapper.selectOne(new LambdaQueryWrapper<TbProduct>()
|
|
||||||
.eq(TbProduct::getId, productId)
|
|
||||||
.eq(TbProduct::getStatus, 1));
|
|
||||||
if (ObjectUtil.isEmpty(product)) {
|
|
||||||
return Result.fail(CodeEnum.PRODUCTINFOERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
TbProductSkuWithBLOBs skuWithBLOBs;
|
|
||||||
if ("1".equals(product.getTypeEnum())) {
|
|
||||||
skuWithBLOBs = tbProductSkuMapper.selectByProduct(productId);
|
|
||||||
} else {
|
|
||||||
skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(skuId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(skuWithBLOBs)) {
|
|
||||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 台桌点单
|
// 台桌点单
|
||||||
|
boolean isSeatCart = TableConstant.CashierCart.ID.equals(productId.toString());
|
||||||
if ((StrUtil.isNotBlank(tableId))) {
|
if ((StrUtil.isNotBlank(tableId))) {
|
||||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
|
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
|
||||||
.eq(TbShopTable::getQrcode, tableId)
|
.eq(TbShopTable::getQrcode, tableId)
|
||||||
@@ -206,6 +192,9 @@ public class OrderService {
|
|||||||
if (shopTable == null) {
|
if (shopTable == null) {
|
||||||
return Result.fail("台桌不处于开台或空闲状态");
|
return Result.fail("台桌不处于开台或空闲状态");
|
||||||
}
|
}
|
||||||
|
if (shopEatTypeInfoDTO.isNeedSeatFee() && number > shopTable.getMaxCapacity() && isSeatCart) {
|
||||||
|
return Result.fail("当前台桌最大人数未: " + shopTable.getMaxCapacity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<TbCashierCart> cartQuery = new LambdaQueryWrapper<TbCashierCart>()
|
LambdaQueryWrapper<TbCashierCart> cartQuery = new LambdaQueryWrapper<TbCashierCart>()
|
||||||
@@ -215,60 +204,78 @@ public class OrderService {
|
|||||||
.in(TbCashierCart::getStatus, "create")
|
.in(TbCashierCart::getStatus, "create")
|
||||||
.eq(TbCashierCart::getId, cartId);
|
.eq(TbCashierCart::getId, cartId);
|
||||||
|
|
||||||
// 后付款订单只查询为空的
|
|
||||||
if (shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
cartQuery.isNull(TbCashierCart::getPlaceNum);
|
|
||||||
}
|
|
||||||
TbCashierCart cart = mpCashierCartMapper.selectOne(cartQuery);
|
TbCashierCart cart = mpCashierCartMapper.selectOne(cartQuery);
|
||||||
|
|
||||||
// 校验是否是代客下单往期订单
|
// 校验是否是代客下单往期订单
|
||||||
if (shopEatTypeInfoDTO.isDineInAfter() && cart != null && cart.getPlaceNum() != null) {
|
if (shopEatTypeInfoDTO.isDineInAfter() && cart != null && cart.getPlaceNum() != null && !isSeatCart) {
|
||||||
return Result.fail("后付费已下单订单仅支持退款");
|
return Result.fail("后付费已下单订单仅支持退款");
|
||||||
}
|
}
|
||||||
|
TbProduct product = null;
|
||||||
|
TbProductSkuWithBLOBs skuWithBLOBs = null;
|
||||||
|
if (!isSeatCart) {
|
||||||
|
product = mpProductMapper.selectOne(new LambdaQueryWrapper<TbProduct>()
|
||||||
|
.eq(TbProduct::getId, productId)
|
||||||
|
.eq(TbProduct::getStatus, 1));
|
||||||
|
if (ObjectUtil.isEmpty(product)) {
|
||||||
|
return Result.fail(CodeEnum.PRODUCTINFOERROR);
|
||||||
|
}
|
||||||
|
|
||||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
|
||||||
if (cart == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
|
|
||||||
number = skuWithBLOBs.getSuit();
|
|
||||||
// 低于起售,删除商品
|
|
||||||
} else if (cart != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()) {
|
|
||||||
delCart(masterId, cartId);
|
|
||||||
if (StrUtil.isNotBlank(cart.getOrderId()) && StrUtil.isNotBlank(cart.getTableId())) {
|
|
||||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
|
||||||
.notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending")
|
|
||||||
.eq(TbCashierCart::getShopId, cart.getShopId());
|
|
||||||
|
|
||||||
TbCashierCart finalCart = cart;
|
if ("1".equals(product.getTypeEnum())) {
|
||||||
queryWrapper.eq(TbCashierCart::getTableId, cart.getTableId())
|
skuWithBLOBs = tbProductSkuMapper.selectByProduct(productId);
|
||||||
.and(q -> q.or(
|
} else {
|
||||||
query -> query.eq(TbCashierCart::getMasterId, finalCart.getMasterId())
|
skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(skuId);
|
||||||
.or()
|
}
|
||||||
.isNull(TbCashierCart::getMasterId)
|
|
||||||
.or()
|
|
||||||
.eq(TbCashierCart::getMasterId, "")
|
|
||||||
)
|
|
||||||
.or(query -> query.eq(TbCashierCart::getOrderId, finalCart.getOrderId())
|
|
||||||
.or()
|
|
||||||
.isNull(TbCashierCart::getOrderId)));
|
|
||||||
|
|
||||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper.eq(TbCashierCart::getStatus, "create"));
|
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (ObjectUtil.isEmpty(skuWithBLOBs)) {
|
||||||
tbOrderInfoMapper.deleteByPrimaryKey(Integer.valueOf(finalCart.getOrderId()));
|
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||||
|
if (cart == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
|
||||||
|
number = skuWithBLOBs.getSuit();
|
||||||
|
// 低于起售,删除商品
|
||||||
|
} else if (cart != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()) {
|
||||||
|
delCart(masterId, cartId);
|
||||||
|
if (StrUtil.isNotBlank(cart.getOrderId()) && StrUtil.isNotBlank(cart.getTableId())) {
|
||||||
|
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||||
|
.notIn(TbCashierCart::getStatus, "final", "refund", "closed", "pending")
|
||||||
|
.eq(TbCashierCart::getShopId, cart.getShopId());
|
||||||
|
|
||||||
|
TbCashierCart finalCart = cart;
|
||||||
|
queryWrapper.eq(TbCashierCart::getTableId, cart.getTableId())
|
||||||
|
.and(q -> q.or(
|
||||||
|
query -> query.eq(TbCashierCart::getMasterId, finalCart.getMasterId())
|
||||||
|
.or()
|
||||||
|
.isNull(TbCashierCart::getMasterId)
|
||||||
|
.or()
|
||||||
|
.eq(TbCashierCart::getMasterId, "")
|
||||||
|
)
|
||||||
|
.or(query -> query.eq(TbCashierCart::getOrderId, finalCart.getOrderId())
|
||||||
|
.or()
|
||||||
|
.isNull(TbCashierCart::getOrderId)));
|
||||||
|
|
||||||
|
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper.eq(TbCashierCart::getStatus, "create"));
|
||||||
|
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
tbOrderInfoMapper.deleteByPrimaryKey(Integer.valueOf(cart.getOrderId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), false);
|
||||||
|
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验库存
|
||||||
|
if ("1".equals(product.getIsStock().toString())) {
|
||||||
|
if (product.getStockNumber() - number < 0) {
|
||||||
|
return Result.fail(CodeEnum.STOCKERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), false);
|
|
||||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 校验库存
|
|
||||||
if ("1".equals(product.getIsStock().toString())) {
|
|
||||||
if (product.getStockNumber() - number < 0) {
|
|
||||||
return Result.fail(CodeEnum.STOCKERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isEmpty(masterId)) {
|
if (StringUtils.isEmpty(masterId)) {
|
||||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -304,10 +311,18 @@ public class OrderService {
|
|||||||
if (isPack.equals("false")) {
|
if (isPack.equals("false")) {
|
||||||
cart.setPackFee(BigDecimal.ZERO);
|
cart.setPackFee(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
if (!isSeatCart) {
|
||||||
|
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||||
|
}else{
|
||||||
|
cart.setPackFee(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isGift.equals("false")) {
|
if (isGift.equals("false")) {
|
||||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
if (!isSeatCart) {
|
||||||
|
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
||||||
|
}else {
|
||||||
|
cart.setTotalAmount(new BigDecimal(number).multiply(cart.getSalePrice()).add(cart.getPackFee()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cart.setTotalAmount(BigDecimal.ZERO);
|
cart.setTotalAmount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
@@ -324,31 +339,42 @@ public class OrderService {
|
|||||||
if (Objects.isNull(cashierCart)) {
|
if (Objects.isNull(cashierCart)) {
|
||||||
cashierCart = new TbCashierCart();
|
cashierCart = new TbCashierCart();
|
||||||
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
cashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
||||||
cashierCart.setCoverImg(product.getCoverImg());
|
if (product != null) {
|
||||||
|
cashierCart.setCoverImg(product.getCoverImg());
|
||||||
|
cashierCart.setIsSku(product.getTypeEnum());
|
||||||
|
cashierCart.setName(product.getName());
|
||||||
|
cashierCart.setCategoryId(product.getCategoryId());
|
||||||
|
}
|
||||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||||
cashierCart.setIsSku(product.getTypeEnum());
|
|
||||||
cashierCart.setMasterId(masterId);
|
cashierCart.setMasterId(masterId);
|
||||||
cashierCart.setUuid(uuid);
|
cashierCart.setUuid(uuid);
|
||||||
cashierCart.setMerchantId(userId);
|
cashierCart.setMerchantId(userId);
|
||||||
cashierCart.setName(product.getName());
|
|
||||||
cashierCart.setProductId(productId.toString());
|
cashierCart.setProductId(productId.toString());
|
||||||
cashierCart.setSalePrice(skuWithBLOBs.getSalePrice());
|
if (skuWithBLOBs != null) {
|
||||||
cashierCart.setSkuId(skuWithBLOBs.getId().toString());
|
cashierCart.setSalePrice(skuWithBLOBs.getSalePrice());
|
||||||
|
cashierCart.setSkuId(skuWithBLOBs.getId().toString());
|
||||||
|
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
||||||
|
}
|
||||||
cashierCart.setShopId(shopId.toString());
|
cashierCart.setShopId(shopId.toString());
|
||||||
cashierCart.setTradeDay(DateUtils.getDay());
|
cashierCart.setTradeDay(DateUtils.getDay());
|
||||||
cashierCart.setStatus("create");
|
cashierCart.setStatus("create");
|
||||||
cashierCart.setIsPack(isPack);
|
cashierCart.setIsPack(isPack);
|
||||||
cashierCart.setIsGift(isGift);
|
cashierCart.setIsGift(isGift);
|
||||||
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
|
||||||
if (isGift.equals("false")) {
|
if (isGift.equals("false")) {
|
||||||
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()));
|
if (isSeatCart) {
|
||||||
|
cashierCart.setTotalAmount(new BigDecimal(number).multiply(cashierCart.getSalePrice()));
|
||||||
|
}else {
|
||||||
|
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
if (isPack.equals("false")) {
|
if (isPack.equals("false")) {
|
||||||
cashierCart.setPackFee(BigDecimal.ZERO);
|
cashierCart.setPackFee(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
if (!isSeatCart) {
|
||||||
|
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||||
|
}
|
||||||
cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee()));
|
cashierCart.setTotalAmount(cashierCart.getTotalAmount().add(cashierCart.getPackFee()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -356,7 +382,6 @@ public class OrderService {
|
|||||||
cashierCart.setUserId(Integer.valueOf(userId));
|
cashierCart.setUserId(Integer.valueOf(userId));
|
||||||
cashierCart.setNumber(number);
|
cashierCart.setNumber(number);
|
||||||
cashierCart.setUuid(uuid);
|
cashierCart.setUuid(uuid);
|
||||||
cashierCart.setCategoryId(product.getCategoryId());
|
|
||||||
cashierCart.setTableId(tableId);
|
cashierCart.setTableId(tableId);
|
||||||
cashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue());
|
cashierCart.setPlatformType(OrderPlatformTypeEnum.CASH.getValue());
|
||||||
list.add(cashierCart);
|
list.add(cashierCart);
|
||||||
@@ -370,7 +395,9 @@ public class OrderService {
|
|||||||
if (isPack.equals("false")) {
|
if (isPack.equals("false")) {
|
||||||
cashierCart.setPackFee(BigDecimal.ZERO);
|
cashierCart.setPackFee(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
if (!isSeatCart) {
|
||||||
|
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getNumber()).multiply(skuWithBLOBs.getSalePrice()).add(cashierCart.getPackFee()));
|
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getNumber()).multiply(skuWithBLOBs.getSalePrice()).add(cashierCart.getPackFee()));
|
||||||
mpCashierCartMapper.updateById(cashierCart);
|
mpCashierCartMapper.updateById(cashierCart);
|
||||||
@@ -380,15 +407,6 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TbCashierCart finalCart1 = cart;
|
|
||||||
// ThreadUtil.execute(() -> {
|
|
||||||
// ThreadUtil.sleep(1, TimeUnit.SECONDS);
|
|
||||||
// if (finalCart1.getOrderId() != null && finalCart1.getTableId() != null) {
|
|
||||||
// log.info("购物车数量改变,开始校验订单是否为空");
|
|
||||||
// printMechineConsumer.printReturnTicket(Integer.valueOf(finalCart1.getOrderId()), tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(finalCart1.getOrderId())));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), true);
|
setRedisTableCartInfo(tableId, shopId, Collections.singletonList(cart), true);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||||
@@ -1781,7 +1799,7 @@ public class OrderService {
|
|||||||
if (shopInfo == null) throw new NotPrintException("店铺信息不存在");
|
if (shopInfo == null) throw new NotPrintException("店铺信息不存在");
|
||||||
|
|
||||||
if (shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 1) {
|
if (shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 1) {
|
||||||
throw new NotPrintException("当前店铺无需选择餐位费");
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||||
|
import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.mybatis.MpShopTableMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.service.MpCashierCartService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.service.MpShopTableService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (TbShopPermission)表服务实现类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-09-14 17:08:49
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbShopTable> implements MpShopTableService {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user