1.代客下单退款单打印
This commit is contained in:
parent
0172bd0478
commit
4bea33ff3e
|
|
@ -297,7 +297,7 @@ public class PrintMechineConsumer {
|
|||
return;
|
||||
}
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
|
|
@ -306,19 +306,27 @@ public class PrintMechineConsumer {
|
|||
String data;
|
||||
String voiceJson;
|
||||
if (isReturn) {
|
||||
|
||||
data = PrinterUtils.getPrintData("return",
|
||||
orderInfo.getPayType().equals("wx_lite")? orderInfo.getTableName(): orderInfo.getMasterId(),
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark);
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, 2, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
}else {
|
||||
data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
|
||||
it.getNum(), remark);
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
|
||||
}
|
||||
// PrinterUtils.printTickets(voiceJson,3, printerNum, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
|
||||
|
||||
|
||||
PrinterUtils.printTickets(voiceJson,3, printerNum, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -388,6 +396,7 @@ public class PrintMechineConsumer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断商品是否已打票
|
||||
* @return true 已打 false 未打
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ public class CloudPrinterService {
|
|||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
ObjectUtil.isEmpty(orderInfo.getMasterId())||ObjectUtil.isNull(orderInfo.getMasterId())?orderInfo.getTableName():orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getPayAmount() != null ? orderInfo.getPayAmount().toPlainString() : orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0",
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0",
|
||||
detailList,orderInfo.getRemark(),null,null);
|
||||
detailPO.setOutNumber(orderInfo.getOutNumber());
|
||||
String printType="退款单";
|
||||
|
|
@ -258,7 +258,7 @@ public class CloudPrinterService {
|
|||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp")?orderInfo.getTableName():orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getPayAmount() != null ? orderInfo.getPayAmount().toPlainString() : orderInfo.getOrderAmount().toPlainString(),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
balance, (ObjectUtil.isEmpty(orderInfo.getPayType())||ObjectUtil.isNull(orderInfo.getPayType())?"":orderInfo.getPayType() ), "0",
|
||||
detailList,orderInfo.getRemark(),orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null,orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
|
||||
String printType="结算单";
|
||||
|
|
@ -507,7 +507,7 @@ public class CloudPrinterService {
|
|||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp")?orderInfo.getTableName():orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getPayAmount() != null ? orderInfo.getPayAmount().toPlainString() : orderInfo.getOrderAmount().toPlainString(),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
balance,(ObjectUtil.isEmpty(orderInfo.getPayType())||ObjectUtil.isNull(orderInfo.getPayType())?"":orderInfo.getPayType() ),
|
||||
"0", detailList,orderInfo.getRemark(),null,null);
|
||||
String printType="结算单";
|
||||
|
|
|
|||
|
|
@ -555,6 +555,7 @@ public class OrderService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createOrder(OrderVo orderVo, String clientType, String token, Integer oldOrderId, boolean isPrint) {
|
||||
String day = DateUtils.getDay();
|
||||
TbShopTable shopTable = null;
|
||||
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, orderVo.getShopId())
|
||||
|
|
@ -585,6 +586,13 @@ public class OrderService {
|
|||
.eq(TbCashierCart::getMasterId, "");
|
||||
}));
|
||||
});
|
||||
|
||||
shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, orderVo.getTableId()));
|
||||
|
||||
if (shopTable == null) {
|
||||
return Result.fail("台桌不存在");
|
||||
}
|
||||
}
|
||||
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper);
|
||||
|
|
@ -607,6 +615,7 @@ public class OrderService {
|
|||
}
|
||||
return Result.fail(CARTEXIST);
|
||||
}
|
||||
|
||||
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||
BigDecimal packAMount = BigDecimal.ZERO;
|
||||
BigDecimal feeAmount = BigDecimal.ZERO;
|
||||
|
|
@ -619,6 +628,7 @@ public class OrderService {
|
|||
if (list.size()<1 || list.isEmpty()){
|
||||
return Result.fail(CARTEXIST);
|
||||
}
|
||||
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
|
||||
TbProductSkuWithBLOBs tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
|
|
@ -683,6 +693,7 @@ public class OrderService {
|
|||
orderInfo.setRemark(orderVo.getRemark());
|
||||
orderInfo.setUserId(orderVo.getUserId());
|
||||
orderInfo.setUseType(StrUtil.isNotBlank(orderVo.getTableId()) ? "postPay" : "afterPay");
|
||||
orderInfo.setTableName(shopTable != null ? shopTable.getName() : null);
|
||||
|
||||
if (StrUtil.isNotBlank(orderVo.getTableId())) {
|
||||
orderInfo.setTableId(orderVo.getTableId());
|
||||
|
|
@ -718,10 +729,12 @@ public class OrderService {
|
|||
|
||||
|
||||
}
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
orderDetail.setOrderId(orderId);
|
||||
orderDetailMapper.insert(orderDetail);
|
||||
}
|
||||
|
||||
boolean flag = true;
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ public class PrinterUtils {
|
|||
* @throws Exception
|
||||
*/
|
||||
public static void printTickets(String voiceJson, Integer actWay, Integer cn, String devName, String data) {
|
||||
log.info("开始请求云享印,请求数据:{}, {}", voiceJson, data);
|
||||
//设备名称
|
||||
//行为方式 1:只打印数据 2:只播放信息 3:打印数据并播放信息
|
||||
// actWay = 3;
|
||||
|
|
|
|||
Loading…
Reference in New Issue