From 266ce0c6a7dd39b610f64a8d7c187de6ea1c19d7 Mon Sep 17 00:00:00 2001 From: weihongyang <1075331873@qq.com> Date: Tue, 21 Jun 2022 09:44:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E6=9E=AA=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../barcode/listener/GlobalKeyListenerExample.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java b/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java index 1bc1d10..98586d9 100644 --- a/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java +++ b/ym-barcode/src/main/java/com/cnbm/barcode/listener/GlobalKeyListenerExample.java @@ -48,14 +48,17 @@ public class GlobalKeyListenerExample implements NativeKeyListener { return NativeKeyEvent.getKeyText(n); }).collect(Collectors.toList()); - for (String s : collect) { - result = result + s; - } if (queue.size() == 5) { - log.info("符合标准的扫码是:"+ result.replace("Enter","")); + for (String s : collect) { + result = result + s; + } }else { - log.info("符合标准的扫码是:"+ result.substring(1).replace("Enter","")); + for (int i = 1; i < collect.size(); i++) { + result = result + collect.get(i); + } } + + log.info("符合标准的扫码是:"+ result.replace("Enter","")); queue.clear(); } if (queue.size() == 6){