1.代客下单 增加自动手动清台,新增台桌订单状态信息
This commit is contained in:
parent
f2bfc718c3
commit
3ebec6f0c5
|
|
@ -2,7 +2,7 @@ package cn.ysk.cashier.enums;
|
|||
|
||||
public enum TableStateEnum {
|
||||
IDLE("idle"),
|
||||
CLOSED("closed"), PAYING("paying"), PENDING("pending"), USING("using");
|
||||
CLOSED("closed"), PAYING("paying"), PENDING("pending"), USING("using"), CLEANING("cleaning");
|
||||
private String state = "closed";
|
||||
|
||||
TableStateEnum(String state) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import javax.persistence.*;
|
|||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -104,6 +106,23 @@ public class TbShopTable implements Serializable {
|
|||
@ApiModelProperty(value = "二维码")
|
||||
private String qrcode = "";
|
||||
|
||||
@Column(name = "`auto_clear`")
|
||||
@ApiModelProperty(value = "自动清台")
|
||||
private Integer autoClear=1;
|
||||
|
||||
@Column(name = "`use_time`")
|
||||
private Date useTime;
|
||||
@Column(name = "`end_time`")
|
||||
private Date endTime;
|
||||
|
||||
@Column(name = "`product_num`")
|
||||
private Integer productNum;
|
||||
@Column(name = "`total_amount`")
|
||||
private Integer totalAmount;
|
||||
@Column(name = "`real_amount`")
|
||||
private Integer realAmount;
|
||||
|
||||
|
||||
public void copy(TbShopTable source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -644,7 +644,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
});
|
||||
|
||||
|
||||
|
||||
if (!skuIds.isEmpty()) {
|
||||
List<TbProductSku> skuList = productSkuRepository.findAllById(skuIds);
|
||||
HashMap<String, TbProductSku> skuMap = new HashMap<>();
|
||||
|
|
@ -1163,8 +1162,6 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
// 推送耗材信息
|
||||
pushConsMsg(orderInfo, cashierCarts);
|
||||
|
||||
|
||||
|
||||
if (createOrderDTO.isPostPay() && isPrint) {
|
||||
Long count = orderInfoMapper.selectCount(new LambdaQueryWrapper<TbOrderInfo>()
|
||||
.eq(TbOrderInfo::getStatus, "unpaid")
|
||||
|
|
@ -1174,9 +1171,14 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
}
|
||||
}
|
||||
|
||||
// 设置台桌信息
|
||||
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getShopId, createOrderDTO.getShopId())
|
||||
.eq(TbShopTable::getQrcode, createOrderDTO.getTableId())
|
||||
.set(TbShopTable::getUseTime, DateUtil.date())
|
||||
.set(TbShopTable::getProductNum, cashierCarts.size())
|
||||
.set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount())
|
||||
.set(TbShopTable::getRealAmount, orderInfo.getOrderAmount())
|
||||
.set(TbShopTable::getStatus, TableStateEnum.USING.getState()));
|
||||
|
||||
String tableCartKey = RedisConstant.getTableCartKey(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString());
|
||||
|
|
@ -1419,9 +1421,20 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
rabbitTemplate.convertAndSend(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, mqData.toJSONString(), new CorrelationData(UUID.randomUUID().toString()));
|
||||
|
||||
// 修改台桌状态
|
||||
TbShopTable tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getShopId, payDTO.getShopId())
|
||||
.eq(TbShopTable::getQrcode, orderInfo.getTableId()));
|
||||
if (tbShopTable.getAutoClear().equals(1)) {
|
||||
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
|
||||
.set(TbShopTable::getEndTime, DateUtil.date())
|
||||
.set(TbShopTable::getStatus, TableStateEnum.IDLE.getState()));
|
||||
} else {
|
||||
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, orderInfo.getTableId())
|
||||
.set(TbShopTable::getEndTime, DateUtil.date())
|
||||
.set(TbShopTable::getStatus, TableStateEnum.CLEANING.getState()));
|
||||
}
|
||||
|
||||
if ("postPay".equals(orderInfo.getUseType())) {
|
||||
String day = DateUtils.getDay();
|
||||
|
|
|
|||
Loading…
Reference in New Issue