1.获取桌码通过tableId获取

This commit is contained in:
2024-08-31 16:45:08 +08:00
parent ed78691326
commit 4101c5235b
3 changed files with 9 additions and 6 deletions

View File

@@ -79,11 +79,12 @@ public class OrderController {
@RequestHeader("loginName") String loginName,
@RequestHeader("clientType") String clientType,
@RequestParam("shopId") String shopId,
@RequestParam(required = false) String tableId,
String type
){
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
String userId = jsonObject.getString("accountId");
return orderService.createCode(shopId,clientType,userId,type);
return orderService.createCode(shopId,clientType,userId,type, tableId);
}
@GetMapping("/getCartList")
public Result getCart(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,

View File

@@ -90,7 +90,7 @@ public class PrintMechineConsumer {
}
list.parallelStream().forEach(it -> {
list.forEach(it -> {
if (!"network".equals(it.getConnectionType())) {
log.error("非网络打印机:{},{}", it.getAddress(), it.getConnectionType());
return;
@@ -197,8 +197,7 @@ public class PrintMechineConsumer {
return;
}
if (StrUtil.isNotBlank(orderInfo.getUseType()) && orderInfo.getUseType().equals("postPay")
&& (!orderInfo.getStatus().equals("closed"))) {
if ((!orderInfo.getStatus().equals("closed"))) {
return;
}
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));

View File

@@ -654,6 +654,7 @@ public class OrderService {
return Result.fail(CARTEXIST);
}
for (TbCashierCart cashierCart : list) {
TbProductSkuWithBLOBs tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
@@ -719,6 +720,7 @@ public class OrderService {
orderInfo.setUserId(orderVo.getUserId());
orderInfo.setUseType(StrUtil.isNotBlank(orderVo.getTableId()) ? "postPay" : "afterPay");
orderInfo.setTableName(shopTable != null ? shopTable.getName() : null);
orderInfo.setPayAmount(BigDecimal.ZERO);
if (StrUtil.isNotBlank(orderVo.getTableId())) {
orderInfo.setTableId(orderVo.getTableId());
@@ -883,10 +885,11 @@ public class OrderService {
return orderCode;
}
public Result createCode(String shopId, String clientType, String userId, String type) {
public Result createCode(String shopId, String clientType, String userId, String type, String tableId) {
String day = DateUtils.getDay();
JSONObject jsonObject = new JSONObject();
String key="SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId;
// String key="SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId;
String key="SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + ":" + tableId;
String userCode = redisUtil.getMessage(key)+"";
if ("1".equals(type)) {
String code = "#" + generateOrderCode(day, clientType, shopId);