From 45625d6aaced524da3abebb5548d8495b77b8aa1 Mon Sep 17 00:00:00 2001
From: whyczh <hzjl@qq.com>
Date: 星期一, 21 三月 2022 14:11:39 +0800
Subject: [PATCH] Merge branch 'master' of http://118.89.139.230:10101/r/~whychw/testElectron

---
 src/main/java/testElectronJ/FboData.java          |    2 
 src/main/java/testElectronJ/FboDataHeadStart.java |   12 ++-
 src/main/demo/src/background.js                   |   13 +++-
 src/main/java/testElectronJ/Com.java              |  102 ++++++++++++++++++++++++++++++++++
 src/main/java/testElectronJ/FboDataInf.java       |    4 +
 src/main/java/testElectronJ/TestController.java   |   26 ++++----
 src/main/demo/public/lib/app.jar                  |    0 
 src/main/demo/src/views/result.vue                |   13 ++++
 src/main/java/testElectronJ/FboDataHeadStop.java  |    4 
 9 files changed, 152 insertions(+), 24 deletions(-)

diff --git a/src/main/demo/public/lib/app.jar b/src/main/demo/public/lib/app.jar
index 68e48fd..563df02 100644
--- a/src/main/demo/public/lib/app.jar
+++ b/src/main/demo/public/lib/app.jar
Binary files differ
diff --git a/src/main/demo/src/background.js b/src/main/demo/src/background.js
index 53d8c5c..0f06276 100644
--- a/src/main/demo/src/background.js
+++ b/src/main/demo/src/background.js
@@ -21,8 +21,11 @@
     let path = pathArr.join('\\');
     // require('child_process').spawn('cmd.exe', ['/c', 'echo '+path+' > 123.txt']);
 
-    serverProcess = require('child_process').spawn('cmd.exe', ['/c', 'testElectronJ.bat'], {
-      cwd: path + '/bundled/bin'
+    // serverProcess = require('child_process').spawn('cmd.exe', ['/c', 'testElectronJ.bat'], {
+    //   cwd: path + '/bundled/bin'
+    // })
+    serverProcess = require('child_process').spawn('app_x64.exe', {
+      cwd: path + '/bundled'
     })
   } else {
     const chmod = require('child_process').spawn('chmod', ['+x', app.getAppPath() + "/bin/testElectronJ"]);
@@ -67,10 +70,11 @@
   if (process.env.WEBPACK_DEV_SERVER_URL) {
     // Load the url of the dev server if in development mode
     await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
-    // if (!process.env.IS_TEST) win.webContents.openDevTools()
+    if (!process.env.IS_TEST) win.webContents.openDevTools()
   } else {
     createProtocol('app')
     // Load the index.html when not in development
+    // win.webContents.openDevTools();
     win.loadURL('app://./index.html')
   }
 }
@@ -123,6 +127,9 @@
   })
 }
 
+// 绂佺敤鏈湴缂撳瓨
+// app.commandLine.appendSwitch("--disable-http-cache");
+
 app.on('ready', async () => {
   // require('child_process').spawn('cmd.exe', ['/c', 'echo ready >> 123.txt'])
   startUp()
diff --git a/src/main/demo/src/views/result.vue b/src/main/demo/src/views/result.vue
index 0824a61..236b1ef 100644
--- a/src/main/demo/src/views/result.vue
+++ b/src/main/demo/src/views/result.vue
@@ -3,6 +3,11 @@
     <div class="content_header" slot="header">
       <three-btn @click="goSelect">閲嶉�夋枃浠�</three-btn>
       <three-btn @click="exportExcel">瀵煎嚭</three-btn>
+      <div class="">
+        璁板綍寮�濮嬫椂闂�:2021-03-21 17锛�52锛�05
+        娴嬭瘯绫诲瀷锛氬厖鐢�
+        缁濈紭
+      </div>
     </div>
     <div class="main">
       <div class="flex-row contain-flex-column">
@@ -48,6 +53,12 @@
 import FlexBox from "@/components/FlexBox";
 import ThreeBtn from "@/components/ThreeBtn";
 import axios from "@/assets/js/axios";
+const dataType = {
+  0xFD: '鏀剧數',
+  0xFC: '鍏呯數',
+  0xFB: '鏅�氭暟鎹�'
+};
+
 export default {
   name: "",
   components: {
@@ -199,7 +210,7 @@
               name: "瀹為檯瀹归噺",
               type: "line",
               symbolSize: 0,
-              sampling: "average",
+              sampling: "lttb",
               data: actualCap,
             },
           ],
diff --git a/src/main/java/testElectronJ/Com.java b/src/main/java/testElectronJ/Com.java
new file mode 100644
index 0000000..267f4dc
--- /dev/null
+++ b/src/main/java/testElectronJ/Com.java
@@ -0,0 +1,102 @@
+package testElectronJ;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Com {
+	final public static int UploadData_ClientType_BS_CLI = 0;
+	final public static int UploadData_ClientType_CS_CLI = 1;
+	final public static int UploadData_ClientType_CS_SVR = 2;
+	
+	final public static String DTF_YMDhms = "yyyy-MM-dd HH:mm:ss";
+	final public static String DTF_YMDhm = "yyyy-MM-dd HH:mm";
+	final public static String DTF_YMDh = "yyyy-MM-dd HH";
+	final public static String DTF_YMD = "yyyy-MM-dd";
+	final public static String DTFYMD = "yyyyMMdd";
+	final public static String DTF_hms = "HH:mm:ss";
+	final public static String DTF_YMD_h_m_s = "yyyy-MM-dd+HH_mm_ss";
+	
+	
+	//final public static DateFormat DateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	
+	public static String getDateTimeFormat(Date dt, String format){
+		DateFormat dtf = new SimpleDateFormat(format);
+		return dtf.format(dt);
+	}
+	
+	public static Date getDateTimeFromStr(String dt, String format){
+		DateFormat dtf = new SimpleDateFormat(format);
+		Date date = new Date();
+		try {
+			date = dtf.parse(dt);
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		
+		return date;
+	}
+	
+	/**
+     * 锟叫讹拷number锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷示锟斤拷式
+     * @param number
+     * @return
+     */
+    public static boolean isIntegerNumber(String number){
+        number = number.trim();
+        String intNumRegex = "\\-{0,1}\\d+";	//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷式
+        if(number.matches(intNumRegex))
+            return true;
+        else
+            return false;
+    }
+      
+
+    
+    /**
+     * 锟叫讹拷number锟斤拷锟斤拷锟角凤拷锟斤拷锟斤拷锟节憋拷示锟斤拷式
+     * @param str
+     * @return
+     */
+    public static boolean isValidDate(String str, String format) {
+    	boolean convertSuccess = true;
+        try {
+        	//DateTimeFormat.setLenient(false);
+        	DateFormat dtf = new SimpleDateFormat(format);
+        	dtf.parse(str);
+         } catch (ParseException e) {
+             convertSuccess = false;
+         }
+         return convertSuccess;
+	}
+
+    
+    /**
+     * 
+     * @param 
+     * @return
+     */
+    public static void getIPFromStr(String ipstr, byte ip[])
+	{
+		try
+		{
+			for(int n=0; n<3; n++)
+			{
+				int index = ipstr.indexOf('.');
+				if(index > 0)
+					ip[n] = (byte)Integer.parseInt(ipstr.substring(0, index));
+				
+				ipstr = ipstr.substring(index+1);
+			}
+			ip[3] = (byte)Integer.parseInt(ipstr);
+			
+			//System.out.println((ip[0]&0xFF) + ": "+(ip[1]&0xFF) + ": "+(ip[2]&0xFF)+ ": "+(ip[3]&0xFF));
+		}
+		catch(Exception e)
+		{
+			System.out.println(e.getMessage());
+		}
+	}
+}
diff --git a/src/main/java/testElectronJ/FboData.java b/src/main/java/testElectronJ/FboData.java
index 51d2e5e..aaecfdd 100644
--- a/src/main/java/testElectronJ/FboData.java
+++ b/src/main/java/testElectronJ/FboData.java
@@ -222,7 +222,7 @@
 	    	residualSubTime[i] = ComBase.changeShortToInt(bf.getShort()); //鏈娇鐢�		//鍓╀綑鏃堕棿
 	    }
 	    
-	    System.out.println(this);
+	    //System.out.println(this);
 	}
 
 
diff --git a/src/main/java/testElectronJ/FboDataHeadStart.java b/src/main/java/testElectronJ/FboDataHeadStart.java
index d3847a5..1f7c55f 100644
--- a/src/main/java/testElectronJ/FboDataHeadStart.java
+++ b/src/main/java/testElectronJ/FboDataHeadStart.java
@@ -33,6 +33,7 @@
     public int batt_mon_num;               		//鍗曚綋鏁伴噺								1
     public float batt_mon_vol;               	//鍗曚綋鐢靛帇 0.1							2		=100		
     public DateTime TestStartTime;            	//鏀剧數寮�濮嬬殑鏃堕棿						6
+	public Date testStartTime;
     public int Device;                     		//浠〃绫诲瀷 鏈娇鐢�						1
     public int DataVersion;                		//鏁版嵁鐗堟湰								1
     public int DataType;                    	//鏁版嵁绫诲瀷;0xFD琛ㄧず鏀剧數,0xFC琛ㄧず鍏呯數			1	
@@ -59,6 +60,7 @@
     
     public FboDataHeadStart(){
     	TestStartTime = new DateTime();
+    	testStartTime = new Date();
     }
     
     public class DateTime{
@@ -76,7 +78,7 @@
         		return;
         	}
         	this.year = ComBase.changeByteToInt(bf.get());
-        	this.month = ComBase.changeByteToInt(bf.get());
+        	this.month = ComBase.changeByteToInt(bf.get())-1;
         	this.day = ComBase.changeByteToInt(bf.get());
         	this.hour = ComBase.changeByteToInt(bf.get());
         	this.minute = ComBase.changeByteToInt(bf.get());
@@ -87,6 +89,7 @@
         public Date getFBODateTime() {
     		Calendar c = Calendar.getInstance();
     		c.set(2000+year, month, day, hour, minute, second);
+    		//System.out.println("娴嬭瘯寮�濮嬫椂闂�"+Com.getDateTimeFormat(c.getTime(),Com.DTF_YMDhms));
     		return c.getTime();
     		//return Com.get_DT_FromStr(year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second, Com.DTF_YMDhms);
     	}
@@ -117,8 +120,9 @@
 	    batt_mon_num = ComBase.changeShortToInt(bf.getShort());             //鍗曚綋鏁伴噺								1
 	    batt_mon_vol = ComBase.changeShortToInt(bf.getShort())/10;       	//鍗曚綋鐢靛帇 0.1							2		=100		
 	    TestStartTime.setDateTime(bf);;            							//鏀剧數寮�濮嬬殑鏃堕棿						6
+		testStartTime = TestStartTime.getFBODateTime();
 	    Device = ComBase.changeShortToInt(bf.getShort());                   //浠〃绫诲瀷 鏈娇鐢�						1
-	    System.out.println("浠〃绫诲瀷锛�"+getDeviceType(Device));
+	    //System.out.println("浠〃绫诲瀷锛�"+getDeviceType(Device));
 	    DataVersion = ComBase.changeShortToInt(bf.getShort());              //鏁版嵁鐗堟湰								1
 	    DataType = ComBase.changeByteToInt(bf.get());                    	//鏁版嵁绫诲瀷;0xFD琛ㄧず鏀剧數,0xFC琛ㄧず鍏呯數			1	
 	    HourRate = ComBase.changeByteToInt(bf.get());                    	//灏忔椂鐜� 鏈娇鐢�							1
@@ -128,7 +132,7 @@
 	    MVLLimitCount = ComBase.changeShortToInt(bf.getShort());            //鍗曚綋涓嬮檺涓暟 鏈娇鐢�					2
 	    for(int i=0;i<module_mon_num.length;i++) {
 	    	module_mon_num[i] = ComBase.changeShortToInt(bf.getShort());	//姣忎釜缁勫帇妯″潡鍗曚綋鑺傛暟 鐩墠鍙敤5涓�		20
-	    	System.out.println((i+1)+":鍗曚綋鏁扮洰锛�"+module_mon_num[i]);
+	    	//System.out.println((i+1)+":鍗曚綋鏁扮洰锛�"+module_mon_num[i]);
 	    }
 	    GrpVol_H_Limit = ComBase.changeShortToFloat(bf.getShort())/10;        //缁勭鐢靛帇涓婇檺							2
 	    GrpVol_L_Limit = ComBase.changeShortToFloat(bf.getShort())/10;        //缁勭鐢靛帇涓嬮檺							2
@@ -145,7 +149,7 @@
 		for(int i =0;i<StandBy.length;i++) {
 			StandBy[i] =  ComBase.changeShortToInt(bf.getShort());			  //淇濈暀澶囩敤								20		179
 		}
-		System.out.println(this);
+		//System.out.println(this);
 		
 		fboHeadStop.setFboStopData(bf);
 		//System.out.println("avg_curr:"+avg_curr);
diff --git a/src/main/java/testElectronJ/FboDataHeadStop.java b/src/main/java/testElectronJ/FboDataHeadStop.java
index b1479ea..2b0cd1e 100644
--- a/src/main/java/testElectronJ/FboDataHeadStop.java
+++ b/src/main/java/testElectronJ/FboDataHeadStop.java
@@ -33,7 +33,7 @@
 		if(bf.remaining() < BYTE_LEN) {
 			return;
 		}
-		System.out.println("绱㈠紩浣嶇疆锛�"+bf.position());
+		//System.out.println("绱㈠紩浣嶇疆锛�"+bf.position());
 		this.TestTimeLong = new FboData().new TestTime();
 		this.TestTimeLong.hour = ComBase.changeByteToInt(bf.get());
 		this.TestTimeLong.minute = ComBase.changeByteToInt(bf.get());
@@ -55,7 +55,7 @@
 		}            
 		this.TestCap = ComBase.changeShortToFloat(bf.getShort());           //娴嬭瘯瀹归噺 鏈娇鐢�				2
 		
-		System.out.println(this);
+		//System.out.println(this);
 	}
 
 	@Override
diff --git a/src/main/java/testElectronJ/FboDataInf.java b/src/main/java/testElectronJ/FboDataInf.java
index 9a8c835..9c92f7c 100644
--- a/src/main/java/testElectronJ/FboDataInf.java
+++ b/src/main/java/testElectronJ/FboDataInf.java
@@ -62,6 +62,7 @@
         		
 		} catch (IOException e) {
 			e.printStackTrace();
+			//log.error(e.toString());
 		} finally {
 			if(null != fis)
 			{
@@ -69,6 +70,7 @@
 					fis.close();
 				} catch (IOException e) {
 					e.printStackTrace();
+					//log.error(e.toString());
 				}
 			}
 		}
@@ -80,6 +82,6 @@
 		//fbo.readFboFile("D:/test/F2022-03-09 11.26.12.FBX");
 		//fbo.readFboFile("D:/test/F2022-03-09 16.22.37.FBX");
 		//fbo.readFboFile("D:/test/F2022-03-10 11.12.30.FBX");
-		fbo.readFboFile("D:/test/F2022-03-14 15.32.19.FBX");
+		fbo.readFboFile("C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_zdl14lk119zg21\\FileStorage\\File\\2022-03\\F2022-03-16 23.45.56(1).FBX");
 	}
 }
diff --git a/src/main/java/testElectronJ/TestController.java b/src/main/java/testElectronJ/TestController.java
index 43e81fa..3fd85c0 100644
--- a/src/main/java/testElectronJ/TestController.java
+++ b/src/main/java/testElectronJ/TestController.java
@@ -21,8 +21,6 @@
 public class TestController {
     //@Autowired
     //private FboDataInf fboDataInf;
-    public String fileUrl = "";
-    public FboDataInf fboDataInf;
 
     @GetMapping("/hello")
     public Response hello(){
@@ -31,13 +29,15 @@
 
     @PostMapping("/readFboFile")
     public Response readFboFile(@RequestParam String filePath){
-        log.info("readFboFile寮�濮�");
-        fboDataInf = new FboDataInf();
+        log.info("鎺ュ彛readFboFile寮�濮�");
+        FboDataInf  fboDataInf = new FboDataInf();
+        log.info("fboDataInf:"+fboDataInf);
+        log.info("filePath:"+filePath);
         //String filePath1 = java.net.URLDecoder.decode(filePath,"utf-8");
         fboDataInf.readFboFile(filePath);
         log.info(fboDataInf.fboData.toString());
         log.info("璇诲彇缁撴潫");
-        fileUrl = filePath;
+//        fileUrl = filePath;
         return new Response().set(1,fboDataInf,filePath);
     }
 
@@ -51,13 +51,15 @@
         String vol_echart = req.getParameter("vol_echart");			//鍗曚綋鐢靛帇鎶樼嚎鍥�
 
         String filePath = req.getParameter("filePath");
-        if (fboDataInf==null){
-            fboDataInf = new FboDataInf();
-            if (filePath==null || "".equals(filePath)){
-                filePath = fileUrl;
-            }
-            fboDataInf.readFboFile(filePath);
-        }
+        FboDataInf  fboDataInf = new FboDataInf();
+        fboDataInf.readFboFile(filePath);
+//        if (fboDataInf==null){
+//            fboDataInf = new FboDataInf();
+//            if (filePath==null || "".equals(filePath)){
+//                filePath = fileUrl;
+//            }
+//            fboDataInf.readFboFile(filePath);
+//        }
         //浠庢枃浠朵腑鑾峰彇鏁版嵁
         List<FboData> list = fboDataInf.fboData;
         //鍥剧墖base64鍚庣殑鏁版嵁

--
Gitblit v1.9.1