Przeglądaj źródła

fix:修复出现重复IMEI码时提示UI没有使用JavaFX线程更新导致的异常中断问题;移除控制台的输出信息

yang yi 11 miesięcy temu
rodzic
commit
7bf34ed6e4

+ 8 - 6
src/main/java/space/anyi/amountVerification/App.java

@@ -359,7 +359,7 @@ public class App extends Application {
                 PDFTextStripper textStripper = new PDFTextStripper();
                 //提取文本
                 text = textStripper.getText(pdDocument);
-                System.out.println("text = " + text);
+                //System.out.println("text = " + text);
                 //解析金额
                 Matcher matcher = pattern.matcher(text);
                 if (matcher.find()) {
@@ -370,7 +370,7 @@ public class App extends Application {
                     outputModel.setPdfAmount(amount2.doubleValue());
                     outputModel.setMargin(amount1.subtract(amount2).doubleValue());
                 } else {
-                    System.out.println("未匹配到金额");
+                    //System.out.println("未匹配到金额");
                     errorImeiList.add(new OutputErrorModel(imei));
                 }
             } catch (IOException | NumberFormatException e) {
@@ -404,10 +404,12 @@ public class App extends Application {
                 if (pdfFile.getName().endsWith(".pdf")) {
                     if (pdfFileMap.containsKey(imei)) {
                         //出现重复的imei
-                        Alert alert = new Alert(Alert.AlertType.ERROR);
-                        alert.setHeaderText("出现重复的imei");
-                        alert.setContentText("请检查文件夹中是否出现重复的imei:" + imei);
-                        alert.showAndWait();
+                        Platform.runLater(()->{
+                            Alert alert = new Alert(Alert.AlertType.ERROR);
+                            alert.setHeaderText("出现重复的imei");
+                            alert.setContentText("请检查文件夹中是否出现重复的imei:" + imei);
+                            alert.showAndWait();
+                        });
                         return;
                     }
                     pdfFileMap.put(imei, pdfFile);