添加打印发票功能
This commit is contained in:
@@ -666,4 +666,40 @@ public class CloudPrinterService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Result printInvoice(String shopId,String content,String remark,String amount){
|
||||
|
||||
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(shopId);
|
||||
|
||||
if (ObjectUtil.isEmpty(bloBsList) || bloBsList.size() <= 0) {
|
||||
log.error("此店铺没有对应的打印机设备");
|
||||
return Result.fail(CodeEnum.printmachinenoexsit);
|
||||
}
|
||||
|
||||
bloBsList.parallelStream().forEach(it->{
|
||||
if (!"network".equals(it.getConnectionType())) {
|
||||
log.error("非网络打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"1".equals(it.getStatus().toString())) {
|
||||
log.error("打印机状态异常");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!it.getSubType().equals("cash")){
|
||||
log.error("非小票打印机");
|
||||
return;
|
||||
}
|
||||
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,1,1,it.getAddress(),PrinterUtils.printInvoice(content, remark, amount));
|
||||
});
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user