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

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

View File

@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.List;
@ -19,6 +20,7 @@ public class OrderVo {
private String sendType;
@NotBlank
private String eatModel;
@Min(1)
private Integer seatNum;
}

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

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