Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
Tankaikai
2024-10-09 18:25:28 +08:00
4 changed files with 62 additions and 154 deletions

View File

@@ -676,6 +676,7 @@ public class OrderService {
throw new MsgException("店铺信息不存在");
}
orderVo.setEatModel(StrUtil.isBlank(orderVo.getTableId()) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue());
ShopEatTypeInfoDTO eatTypeInfoDTO = checkEatModel(orderVo.getShopId(), orderVo.getEatModel());
@@ -683,6 +684,17 @@ public class OrderService {
throw new MsgException("店内就餐必须选择桌码");
}
// 餐位费设置
if (!eatTypeInfoDTO.isTakeout() && shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0) {
ChoseCountDTO choseCountDTO = new ChoseCountDTO();
choseCountDTO.setNum(orderVo.getSeatNum());
choseCountDTO.setTableId(orderVo.getTableId());
choseCountDTO.setShopId(orderVo.getShopId());
choseCountDTO.setMasterId(orderVo.getMasterId());
choseCount(choseCountDTO);
}
String day = DateUtils.getDay();
TbShopTable shopTable = null;
int currentPlaceNum = getCurrentPlaceNum(orderVo.getTableId(), orderVo.getShopId().toString(), eatTypeInfoDTO);

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);
}