From 802cf2676ba3fb4a813027bd54c65832e136aff4 Mon Sep 17 00:00:00 2001
From: whyczh <hzjl@qq.com>
Date: 星期六, 19 三月 2022 11:34:58 +0800
Subject: [PATCH] 更新

---
 src/main/java/testElectronJ/TestController.java |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/main/java/testElectronJ/TestController.java b/src/main/java/testElectronJ/TestController.java
index ffee167..00f89ef 100644
--- a/src/main/java/testElectronJ/TestController.java
+++ b/src/main/java/testElectronJ/TestController.java
@@ -22,7 +22,8 @@
 public class TestController {
     //@Autowired
     //private FboDataInf fboDataInf;
-    public static String fileUrl = "";
+    public String fileUrl = "";
+    public FboDataInf fboDataInf;
 
     @GetMapping("/hello")
     public Response hello(){
@@ -30,11 +31,11 @@
     }
 
     @PostMapping("/readFboFile")
-    public Response readFboFile(@RequestParam String filePath) throws UnsupportedEncodingException {
-        FboDataInf fboDataInf = new FboDataInf();
+    public Response readFboFile(@RequestParam String filePath){
+        fboDataInf = new FboDataInf();
         //String filePath1 = java.net.URLDecoder.decode(filePath,"utf-8");
         fboDataInf.readFboFile(filePath);
-        TestController.fileUrl = filePath;
+        fileUrl = filePath;
         return new Response().set(1,fboDataInf,filePath);
     }
 
@@ -48,11 +49,13 @@
         String vol_echart = req.getParameter("vol_echart");			//鍗曚綋鐢靛帇鎶樼嚎鍥�
 
         String filePath = req.getParameter("filePath");
-        FboDataInf fboDataInf = new FboDataInf();
-        if (filePath==null || "".equals(filePath)){
-            filePath = fileUrl;
+        if (fboDataInf==null){
+            fboDataInf = new FboDataInf();
+            if (filePath==null || "".equals(filePath)){
+                filePath = fileUrl;
+            }
+            fboDataInf.readFboFile(filePath);
         }
-        fboDataInf.readFboFile(filePath);
         //浠庢枃浠朵腑鑾峰彇鏁版嵁
         List<FboData> list = fboDataInf.fboData;
         //鍥剧墖base64鍚庣殑鏁版嵁
@@ -154,15 +157,13 @@
         //鏁版嵁鏍�
         for (int i = 0; i < list.size(); i++) {
             sheet1.createRow(rowNum);  //鍒涘缓琛�
-            for(int j=0;j<5;j++){
-                FboData fbo=list.get(i);
-                sheet1.getRow(rowNum).createCell(0).setCellValue(fbo.m_TestTime.hms());
-                sheet1.getRow(rowNum).createCell(1).setCellValue(fbo.SumVoltage);
-                sheet1.getRow(rowNum).createCell(2).setCellValue(fbo.testCap);
-                sheet1.getRow(rowNum).createCell(3).setCellValue(fbo.residualCap);
-                for (int k = 0;k<list.get(0).SingleVol.length;k++){
-                    sheet1.getRow(rowNum).createCell(4+k).setCellValue(fbo.SingleVol[k]);
-                }
+            FboData fbo=list.get(i);
+            sheet1.getRow(rowNum).createCell(0).setCellValue(fbo.m_TestTime.hms());
+            sheet1.getRow(rowNum).createCell(1).setCellValue(fbo.SumVoltage);
+            sheet1.getRow(rowNum).createCell(2).setCellValue(fbo.testCap);
+            sheet1.getRow(rowNum).createCell(3).setCellValue(fbo.residualCap);
+            for (int k = 0;k<list.get(0).SingleVol.length;k++){
+                sheet1.getRow(rowNum).createCell(4+k).setCellValue(fbo.SingleVol[k]);
             }
             rowNum++;
         }

--
Gitblit v1.9.1