src/main/demo/public/lib/app.jar | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/demo/src/background.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/demo/src/views/result.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/Com.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/FboData.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/FboDataHeadStart.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/FboDataHeadStop.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/FboDataInf.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/testElectronJ/TestController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/demo/public/lib/app.jarBinary files differ
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() 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, }, ], src/main/java/testElectronJ/Com.java
New file @@ -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()); } } } src/main/java/testElectronJ/FboData.java
@@ -222,7 +222,7 @@ residualSubTime[i] = ComBase.changeShortToInt(bf.getShort()); //未使用 //剩余时间 } System.out.println(this); //System.out.println(this); } 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); 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 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"); } } 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后的数据