|
@@ -227,7 +227,7 @@ public class App extends Application {
|
|
|
alert.setHeaderText("金额验证工具");
|
|
alert.setHeaderText("金额验证工具");
|
|
|
alert.setContentText("作者: 杨逸\n" +
|
|
alert.setContentText("作者: 杨逸\n" +
|
|
|
"联系方式: huanglve2004@163.com\n\n" +
|
|
"联系方式: huanglve2004@163.com\n\n" +
|
|
|
- "版本: 1.0.0\n" +
|
|
|
|
|
|
|
+ "版本: 1.0.1\n" +
|
|
|
"描述: 用于金额验证的桌面应用程序");
|
|
"描述: 用于金额验证的桌面应用程序");
|
|
|
|
|
|
|
|
alert.showAndWait();
|
|
alert.showAndWait();
|
|
@@ -285,10 +285,10 @@ public class App extends Application {
|
|
|
|
|
|
|
|
private void startVerification() {
|
|
private void startVerification() {
|
|
|
//如果当前时间大于2025-11-28,则关闭程序
|
|
//如果当前时间大于2025-11-28,则关闭程序
|
|
|
- //if (System.currentTimeMillis() > 1764341281000L) {
|
|
|
|
|
- // new Alert(Alert.AlertType.ERROR, "软件已过期,请联系作者获取最新版本").showAndWait();
|
|
|
|
|
- // Platform.exit();
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ if (System.currentTimeMillis() > 1764341281000L) {
|
|
|
|
|
+ new Alert(Alert.AlertType.ERROR, "软件已过期,请联系作者获取最新版本").showAndWait();
|
|
|
|
|
+ Platform.exit();
|
|
|
|
|
+ }
|
|
|
startButton.setDisable(true);
|
|
startButton.setDisable(true);
|
|
|
String filePath = fileField.getText();
|
|
String filePath = fileField.getText();
|
|
|
String folderPath = folderField.getText();
|
|
String folderPath = folderField.getText();
|
|
@@ -384,18 +384,21 @@ public class App extends Application {
|
|
|
for (InputModel inputModel : inputModelList) {
|
|
for (InputModel inputModel : inputModelList) {
|
|
|
OutputModel outputModel = new OutputModel(inputModel);
|
|
OutputModel outputModel = new OutputModel(inputModel);
|
|
|
String imei = inputModel.getImei().trim();
|
|
String imei = inputModel.getImei().trim();
|
|
|
- log.info("开始对账IMEI:{}",imei);
|
|
|
|
|
|
|
+ String workOrderNumber = inputModel.getWorkOrderNumber().trim();
|
|
|
|
|
+ String fileKey = workOrderNumber + "-" + imei;
|
|
|
|
|
+ fileKey = fileKey.toUpperCase(Locale.ROOT);
|
|
|
|
|
+ log.info("开始对账工单:{}",fileKey);
|
|
|
//找到对应工单文件的路径
|
|
//找到对应工单文件的路径
|
|
|
- File workOrderFile = workOrderFileMap.getOrDefault(imei, null);
|
|
|
|
|
|
|
+ File workOrderFile = workOrderFileMap.getOrDefault(fileKey, null);
|
|
|
if (Objects.isNull(workOrderFile)) {
|
|
if (Objects.isNull(workOrderFile)) {
|
|
|
- log.warn("未找到IMEI:{}对应的工单文件",imei);
|
|
|
|
|
- errorImeiList.add(new OutputErrorModel(imei));
|
|
|
|
|
|
|
+ log.warn("未找到{}对应的工单文件",fileKey);
|
|
|
|
|
+ errorImeiList.add(new OutputErrorModel(imei,workOrderNumber));
|
|
|
processedWorkOrders++;
|
|
processedWorkOrders++;
|
|
|
double progress = 0.5 + (0.4 * processedWorkOrders / totalWorkOrders);
|
|
double progress = 0.5 + (0.4 * processedWorkOrders / totalWorkOrders);
|
|
|
- updateProgress("解析工单文件: " + processedWorkOrders + "/" + totalWorkOrders + " (IMEI未找到: " + imei + ")", progress);
|
|
|
|
|
|
|
+ updateProgress("解析工单文件: " + processedWorkOrders + "/" + totalWorkOrders + " (工单文件未找到: " + fileKey + ")", progress);
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- log.info("找到IMEI:{}对应的工单文件:{}",imei,workOrderFile.getName());
|
|
|
|
|
|
|
+ log.info("找到{}对应的工单文件:{}",fileKey,workOrderFile.getName());
|
|
|
//解析工单文件
|
|
//解析工单文件
|
|
|
log.info("开始解析工单文件:{}",workOrderFile.getName());
|
|
log.info("开始解析工单文件:{}",workOrderFile.getName());
|
|
|
String text = null;
|
|
String text = null;
|
|
@@ -410,7 +413,7 @@ public class App extends Application {
|
|
|
if (Objects.isNull(text)) {
|
|
if (Objects.isNull(text)) {
|
|
|
//没有文本
|
|
//没有文本
|
|
|
log.warn("解析IMEI:{}对应的工单文件: {} 失败",imei,workOrderFile.getName());
|
|
log.warn("解析IMEI:{}对应的工单文件: {} 失败",imei,workOrderFile.getName());
|
|
|
- errorImeiList.add(new OutputErrorModel(imei));
|
|
|
|
|
|
|
+ errorImeiList.add(new OutputErrorModel(imei,workOrderNumber));
|
|
|
}else{
|
|
}else{
|
|
|
Matcher matcher = pattern.matcher(text);
|
|
Matcher matcher = pattern.matcher(text);
|
|
|
if (matcher.find()) {
|
|
if (matcher.find()) {
|
|
@@ -422,7 +425,7 @@ public class App extends Application {
|
|
|
outputModel.setMargin(amount1.subtract(amount2).doubleValue());
|
|
outputModel.setMargin(amount1.subtract(amount2).doubleValue());
|
|
|
} else {
|
|
} else {
|
|
|
log.warn("IMEI:{}未匹配到金额",imei);
|
|
log.warn("IMEI:{}未匹配到金额",imei);
|
|
|
- errorImeiList.add(new OutputErrorModel(imei));
|
|
|
|
|
|
|
+ errorImeiList.add(new OutputErrorModel(imei,workOrderNumber));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
log.info("解析IMEI:{}对应的工单文件: {} 完成",imei,workOrderFile.getName());
|
|
log.info("解析IMEI:{}对应的工单文件: {} 完成",imei,workOrderFile.getName());
|
|
@@ -494,7 +497,7 @@ public class App extends Application {
|
|
|
File folder = new File(folderPath);
|
|
File folder = new File(folderPath);
|
|
|
File[] files = folder.listFiles();
|
|
File[] files = folder.listFiles();
|
|
|
|
|
|
|
|
- // 扫描文件夹并建立IMEI-工单文件映射
|
|
|
|
|
|
|
+ // 扫描文件夹并建立工单号+IMEI=工单文件映射
|
|
|
int totalFolders = files.length;
|
|
int totalFolders = files.length;
|
|
|
int processedFolders = 0;
|
|
int processedFolders = 0;
|
|
|
|
|
|
|
@@ -503,26 +506,28 @@ public class App extends Application {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
log.info("正在扫描文件夹,查找工单文件: {}", file.getName());
|
|
log.info("正在扫描文件夹,查找工单文件: {}", file.getName());
|
|
|
- File[] listFiles = file.listFiles();
|
|
|
|
|
- String[] split = file.getName().split("-");
|
|
|
|
|
- String imei = split[split.length-1].trim();
|
|
|
|
|
- log.debug("IMEI: {}", imei);
|
|
|
|
|
|
|
+ File[] childrenFiles = file.listFiles();
|
|
|
|
|
+ String fileKey = file.getName().replaceAll(" ","").toUpperCase(Locale.ROOT);
|
|
|
|
|
+ log.debug("fileKey: {}", fileKey);
|
|
|
//拿到文件夹里的工单文件(文件类型可能是PDF或JPG)
|
|
//拿到文件夹里的工单文件(文件类型可能是PDF或JPG)
|
|
|
- for (File workOrderFile : listFiles) {
|
|
|
|
|
|
|
+ for (File workOrderFile : childrenFiles) {
|
|
|
|
|
+ if (workOrderFile.isDirectory()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
if (workOrderFile.getName().contains("工单照片")) {
|
|
if (workOrderFile.getName().contains("工单照片")) {
|
|
|
- if (workOrderFileMap.containsKey(imei)) {
|
|
|
|
|
- log.warn("出现重复的imei: {}", imei);
|
|
|
|
|
|
|
+ if (workOrderFileMap.containsKey(fileKey)) {
|
|
|
|
|
+ log.error("出现重复的工单文件夹: {}", fileKey);
|
|
|
//出现重复的imei
|
|
//出现重复的imei
|
|
|
Platform.runLater(()->{
|
|
Platform.runLater(()->{
|
|
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
|
|
- alert.setHeaderText("出现重复的imei");
|
|
|
|
|
- alert.setContentText("请检查文件夹中是否出现重复的imei:" + imei);
|
|
|
|
|
|
|
+ alert.setHeaderText("出现重复的工单文件夹");
|
|
|
|
|
+ alert.setContentText("请检查文件夹中是否出现重复的工单文件夹:" + fileKey);
|
|
|
alert.showAndWait();
|
|
alert.showAndWait();
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- log.info("找到IMEI;{}对应的工单文件: {}", imei,workOrderFile.getName());
|
|
|
|
|
- workOrderFileMap.put(imei, workOrderFile);
|
|
|
|
|
|
|
+ log.info("找到工单文件: {}",workOrderFile.getName());
|
|
|
|
|
+ workOrderFileMap.put(fileKey, workOrderFile);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|