|
@@ -1,5 +1,7 @@
|
|
|
package space.anyi.amountVerification;
|
|
package space.anyi.amountVerification;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
|
|
+import com.alibaba.excel.read.listener.PageReadListener;
|
|
|
import javafx.application.Application;
|
|
import javafx.application.Application;
|
|
|
import javafx.geometry.Insets;
|
|
import javafx.geometry.Insets;
|
|
|
import javafx.geometry.Pos;
|
|
import javafx.geometry.Pos;
|
|
@@ -18,7 +20,12 @@ import javafx.scene.layout.VBox;
|
|
|
import javafx.stage.DirectoryChooser;
|
|
import javafx.stage.DirectoryChooser;
|
|
|
import javafx.stage.FileChooser;
|
|
import javafx.stage.FileChooser;
|
|
|
import javafx.stage.Stage;
|
|
import javafx.stage.Stage;
|
|
|
|
|
+import space.anyi.amountVerification.model.InputModel;
|
|
|
|
|
+import space.anyi.amountVerification.model.OutputModel;
|
|
|
|
|
+
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -29,8 +36,25 @@ import java.util.Optional;
|
|
|
* @Description:
|
|
* @Description:
|
|
|
*/
|
|
*/
|
|
|
public class App extends Application {
|
|
public class App extends Application {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 文件
|
|
|
|
|
+ * @see TextField
|
|
|
|
|
+ */
|
|
|
private TextField fileField;
|
|
private TextField fileField;
|
|
|
|
|
+ /**文件夹
|
|
|
|
|
+ * @see TextField
|
|
|
|
|
+ */
|
|
|
private TextField folderField;
|
|
private TextField folderField;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * excel输入数据
|
|
|
|
|
+ * @see List<InputModel>
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<InputModel> inputModelList;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * excel输出数据
|
|
|
|
|
+ * @see List<OutputModel>
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<OutputModel> outputModelList;
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
|
Application.launch(App.class, args);
|
|
Application.launch(App.class, args);
|
|
@@ -150,6 +174,12 @@ public class App extends Application {
|
|
|
private void chooseFile() {
|
|
private void chooseFile() {
|
|
|
FileChooser fileChooser = new FileChooser();
|
|
FileChooser fileChooser = new FileChooser();
|
|
|
fileChooser.setTitle("选择文件");
|
|
fileChooser.setTitle("选择文件");
|
|
|
|
|
+
|
|
|
|
|
+ // 添加文件过滤器,只允许选择xlsx文件
|
|
|
|
|
+ FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(
|
|
|
|
|
+ "Excel文件 (*.xlsx)", "*.xlsx");
|
|
|
|
|
+ fileChooser.getExtensionFilters().add(extFilter);
|
|
|
|
|
+
|
|
|
File selectedFile = fileChooser.showOpenDialog(null);
|
|
File selectedFile = fileChooser.showOpenDialog(null);
|
|
|
if (selectedFile != null) {
|
|
if (selectedFile != null) {
|
|
|
fileField.setText(selectedFile.getAbsolutePath());
|
|
fileField.setText(selectedFile.getAbsolutePath());
|
|
@@ -173,7 +203,22 @@ public class App extends Application {
|
|
|
System.out.println("请至少选择文件或文件夹");
|
|
System.out.println("请至少选择文件或文件夹");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ inputModelList = new ArrayList<>();
|
|
|
|
|
+ outputModelList = new ArrayList<>();
|
|
|
|
|
+ //读取excel
|
|
|
|
|
+ String fileName = fileField.getText();
|
|
|
|
|
+ EasyExcel.read(fileName, InputModel.class, new PageReadListener<InputModel>(dataList -> {
|
|
|
|
|
+ for (InputModel inputModel : dataList) {
|
|
|
|
|
+ //todo:日志
|
|
|
|
|
+ inputModelList.add(inputModel);
|
|
|
|
|
+ System.out.println("inputModel = " + inputModel);
|
|
|
|
|
+ //log.info("读取到一条数据{}", JSON.toJSONString(demoData));
|
|
|
|
|
+ }
|
|
|
|
|
+ })).sheet().doRead();
|
|
|
|
|
+ //todo:进度条
|
|
|
|
|
+ for (InputModel inputModel : inputModelList) {
|
|
|
|
|
+ //todo:读取pdf金额
|
|
|
|
|
+ }
|
|
|
System.out.println("开始验证...");
|
|
System.out.println("开始验证...");
|
|
|
System.out.println("文件路径: " + filePath);
|
|
System.out.println("文件路径: " + filePath);
|
|
|
System.out.println("文件夹路径: " + folderPath);
|
|
System.out.println("文件夹路径: " + folderPath);
|