支付成功清空台桌就餐人数等信息
This commit is contained in:
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TbShopTable implements Serializable {
|
||||
@@ -53,6 +54,12 @@ public class TbShopTable implements Serializable {
|
||||
private Integer seatNum;
|
||||
|
||||
private Integer autoClear;
|
||||
private Date useTime;
|
||||
private Date endTime;
|
||||
private Integer productNum;
|
||||
private BigDecimal totalAmount;
|
||||
private BigDecimal realAmount;
|
||||
private Integer useNum;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,4 +17,10 @@ public interface MpShopTableService extends IService<TbShopTable> {
|
||||
* @param tableId qrcode
|
||||
*/
|
||||
TbShopTable selectByQrcode(String tableId);
|
||||
|
||||
/**
|
||||
* 清除台桌状态
|
||||
* @param tableId 台桌id
|
||||
*/
|
||||
boolean clearTableState(String tableId);
|
||||
}
|
||||
|
||||
@@ -25,4 +25,21 @@ public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbSho
|
||||
return getOne(new LambdaQueryWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, tableId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clearTableState(String tableId) {
|
||||
TbShopTable shopTable = selectByQrcode(tableId);
|
||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||
return update(new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, tableId)
|
||||
.set(TbShopTable::getUseTime, null)
|
||||
.set(TbShopTable::getProductNum, 0)
|
||||
.set(TbShopTable::getTotalAmount, 0)
|
||||
.set(TbShopTable::getRealAmount, 0)
|
||||
.set(TbShopTable::getUseNum, 0)
|
||||
.set(TbShopTable::getStatus, TableConstant.ShopTable.State.CLEANING.getValue()));
|
||||
}else {
|
||||
return updateStateByQrcode(tableId, TableConstant.ShopTable.State.CLEANING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1110,9 @@ public class CartService {
|
||||
// 去除餐位费信息
|
||||
|
||||
List<TbActivateOutRecord> outRecords = new ArrayList<>();
|
||||
int totalNum = 0;
|
||||
for (TbCashierCart cashierCart : cashierCartList) {
|
||||
totalNum += cashierCart.getNumber();
|
||||
if (!cashierCart.getProductId().equals("-999") && cashierCart.getIsVip().equals((byte) 1)) {
|
||||
List<TbActivateInRecord> actInRecords = activateInRecordService.queryAllByVipIdAndShopIdAndProId(
|
||||
Integer.valueOf(tbShopUser.getId()), Integer.valueOf(orderInfo.getShopId()), Integer.valueOf(cashierCart.getProductId()));
|
||||
@@ -1143,12 +1145,6 @@ public class CartService {
|
||||
|
||||
cashierCartList = cashierCartList.stream().filter(item -> !"-999".equals(item.getProductId())).collect(Collectors.toList());
|
||||
|
||||
|
||||
// 删除旧的餐位费信息
|
||||
// if (shopEatTypeInfoDTO.isTakeout() && seatCartInfo != null) {
|
||||
// cashierCartMapper.deleteByPrimaryKey(seatCartInfo.getId());
|
||||
// }
|
||||
|
||||
if (!CollectionUtils.isEmpty(outRecords)) outRecordMapper.insertBatch(outRecords);
|
||||
|
||||
// 打印票据
|
||||
@@ -1167,8 +1163,13 @@ public class CartService {
|
||||
}
|
||||
|
||||
// 修改台桌状态
|
||||
if (!shopEatTypeInfoDTO.isTakeout() && StrUtil.isNotBlank(tableId)) {
|
||||
mpShopTableService.updateStateByQrcode(tableId, TableConstant.ShopTable.State.USING);
|
||||
if (!shopEatTypeInfoDTO.isTakeout() && StrUtil.isNotBlank(tableId) && shopTable != null) {
|
||||
shopTable.setStatus(TableConstant.ShopTable.State.USING.getValue());
|
||||
shopTable.setProductNum(totalNum);
|
||||
shopTable.setTotalAmount(totalAmount);
|
||||
shopTable.setRealAmount(totalAmount);
|
||||
shopTable.setSeatNum(seatNum);
|
||||
mpShopTableService.updateById(shopTable);
|
||||
}
|
||||
|
||||
// 发送mq消息
|
||||
|
||||
@@ -527,12 +527,7 @@ public class PayService {
|
||||
|
||||
// 重置台桌状态
|
||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||
}else {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
||||
}
|
||||
mpShopTableService.clearTableState(orderInfo.getTableId());
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS, "1");
|
||||
}
|
||||
@@ -1154,12 +1149,7 @@ public class PayService {
|
||||
|
||||
// 重置台桌状态
|
||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||
}else {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.CLEANING);
|
||||
}
|
||||
mpShopTableService.clearTableState(orderInfo.getTableId());
|
||||
}
|
||||
return "SUCCESS";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user