打印样式修改

This commit is contained in:
谭凯凯
2024-10-15 10:56:22 +08:00
committed by Tankaikai
parent 71745dc96e
commit cb1d05a042
2 changed files with 34 additions and 24 deletions

View File

@@ -155,6 +155,10 @@ public class PrintConsumer {
wrapper.like(TbPrintMachine::getPrintType, printType);
}
List<TbPrintMachine> list = mpPrintMachineMapper.selectList(wrapper);
for (TbPrintMachine item : list) {
//实际打印以传递的参数为准
item.setPrintMethod(printMethod);
}
if (list.isEmpty()) {
log.error("店铺未配置打印机店铺id: {}", shopId);
return list;

View File

@@ -153,7 +153,7 @@ public class ShopPrintLogServiceImpl extends ServiceImpl<TbPrintMachineLogMapper
// 云想印
if ("yxyPrinter".equals(config.getContentType())) {
// 延迟3ms复查打印状态 (用户可以根据设备信息查询到当前设备的在线情况该接口只能提供参考设备的离线状态是在设备离线3分钟后才会生效)
ThreadUtil.safeSleep(1000*3);
ThreadUtil.safeSleep(1000 * 5);
String jsonStr = PrinterUtils.checkPrintStatus(config.getAddress(), entity.getTaskId());
cn.hutool.json.JSONObject resp = JSONUtil.parseObj(jsonStr);
int code = resp.getInt("code");
@@ -186,7 +186,7 @@ public class ShopPrintLogServiceImpl extends ServiceImpl<TbPrintMachineLogMapper
}
// 飞鹅云打印机
} else if ("fePrinter".equals(config.getContentType())) {
ThreadUtil.safeSleep(1000*3);
ThreadUtil.safeSleep(1000 * 5);
Boolean success = FeieyunPrintUtil.checkPrintStatus(entity.getTaskId());
if (success == null) {
entity.setFailFlag(1);
@@ -197,10 +197,16 @@ public class ShopPrintLogServiceImpl extends ServiceImpl<TbPrintMachineLogMapper
entity.setRespMsg("打印成功");
} else {
String msg = FeieyunPrintUtil.checkOnline(entity.getAddress());
if (msg.indexOf("在线") > 0) {
entity.setFailFlag(0);
entity.setPrintTime(new Date());
entity.setRespMsg("打印成功");
} else {
entity.setFailFlag(1);
entity.setPrintTime(null);
entity.setRespMsg(StrUtil.concat(true, "打印失败,", "_", msg));
}
}
super.updateById(entity);
}
}