手动清台设置

This commit is contained in:
2024-10-09 13:40:58 +08:00
parent f96c47ecac
commit 5c5ffd10da
2 changed files with 47 additions and 153 deletions

View File

@@ -1,8 +1,11 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class TbShopTable implements Serializable {
private Integer id;
@@ -36,133 +39,7 @@ public class TbShopTable implements Serializable {
private String qrcode;
public String getQrcode() {
return qrcode;
}
private Integer autoClear;
public void setQrcode(String qrcode) {
this.qrcode = qrcode;
}
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getMaxCapacity() {
return maxCapacity;
}
public void setMaxCapacity(Integer maxCapacity) {
this.maxCapacity = maxCapacity;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getAreaId() {
return areaId;
}
public void setAreaId(Integer areaId) {
this.areaId = areaId;
}
public Byte getIsPredate() {
return isPredate;
}
public void setIsPredate(Byte isPredate) {
this.isPredate = isPredate;
}
public BigDecimal getPredateAmount() {
return predateAmount;
}
public void setPredateAmount(BigDecimal predateAmount) {
this.predateAmount = predateAmount;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getPerhour() {
return perhour;
}
public void setPerhour(BigDecimal perhour) {
this.perhour = perhour;
}
public String getView() {
return view;
}
public void setView(String view) {
this.view = view == null ? null : view.trim();
}
public Long getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Long createdAt) {
this.createdAt = createdAt;
}
public Long getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Long updatedAt) {
this.updatedAt = updatedAt;
}
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.chaozhanggui.system.cashierservice.bean.TableStateEnum;
import com.chaozhanggui.system.cashierservice.dao.*;
@@ -295,9 +296,12 @@ public class PayService {
producer.printMechine(orderId);
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
orderInfo.getShopId());
@@ -318,9 +322,12 @@ public class PayService {
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
// 打印结算单
producer.printMechine(orderId);
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
@@ -380,9 +387,12 @@ public class PayService {
producer.printMechine(orderId);
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
// 打印结算单
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
orderInfo.getShopId());
@@ -399,9 +409,12 @@ public class PayService {
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
// 打印结算单
producer.printMechine(orderId);
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
@@ -886,9 +899,12 @@ public class PayService {
mqData.put("type", "pc");
producer.sendStockSaleMsg(mqData);
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
orderInfo.getShopId());
@@ -980,9 +996,12 @@ public class PayService {
redisUtil.del("SHOP:CODE:USER:" + "pc" + ":" + orderInfo.getShopId() + ":" + DateUtils.getDay() + TokenUtil.parseParamFromToken(token).getString("accountId"));
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
// 小程序购物车缓存
String tableCartKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(),
@@ -1071,9 +1090,12 @@ public class PayService {
redisUtil.del("SHOP:CODE:USER:" + "pc" + ":" + orderInfo.getShopId() + ":" + DateUtils.getDay() + TokenUtil.parseParamFromToken(token).getString("accountId"));
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>().eq(TbShopTable::getQrcode, orderInfo.getTableId()));
if (shopTable.getAutoClear() == 1) {
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
}
clearTableInfoCache(orderInfo);
return Result.success(CodeEnum.SUCCESS);
@@ -1398,11 +1420,6 @@ public class PayService {
}
redisUtil.del("SHOP:CODE:USER:" + "pc" + ":" + orderInfo.getShopId() + ":" + DateUtils.getDay() + TokenUtil.parseParamFromToken(token).getString("accountId"));
// 修改台桌状态
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
return Result.success(CodeEnum.SUCCESS);
}