1.打票增加代客下单重复校验
This commit is contained in:
@@ -262,7 +262,7 @@ public class PrintMechineConsumer {
|
|||||||
|
|
||||||
tbOrderDetails.parallelStream().forEach(it -> {
|
tbOrderDetails.parallelStream().forEach(it -> {
|
||||||
// 已经打印过的菜品不再打印
|
// 已经打印过的菜品不再打印
|
||||||
if ("postPay".equals(orderInfo.getUseType()) && isPrint(it.getId())) {
|
if ("postPay".equals(orderInfo.getUseType()) && isPrint(it)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
@@ -300,15 +300,16 @@ public class PrintMechineConsumer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断商品是否已打票
|
* 判断商品是否已打票
|
||||||
* @param orderDetailId 订单详情id
|
|
||||||
* @return true 已打 false 未打
|
* @return true 已打 false 未打
|
||||||
*/
|
*/
|
||||||
private boolean isPrint(Integer orderDetailId) {
|
private boolean isPrint(TbOrderDetail orderDetail) {
|
||||||
Object info = redisUtils.getMessage(RedisCst.ORDER_PRINT + orderDetailId);
|
String key = RedisCst.ORDER_PRINT + orderDetail.getProductId() + ":" + orderDetail.getProductSkuId();
|
||||||
|
String info = redisUtils.getMessage(key);
|
||||||
|
redisUtils.saveMessage(key, String.valueOf(orderDetail.getNum()), 60 * 60 * 24);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
redisUtils.saveMessage(RedisCst.ORDER_PRINT + orderDetailId, "1", 60 * 60 * 24);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
orderDetail.setNum(orderDetail.getNum() - Integer.parseInt(info));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user