From 72ddb6d1c81bae015549347915b868591fabe7e1 Mon Sep 17 00:00:00 2001 From: whyczh <hzjl@qq.com> Date: 星期五, 18 三月 2022 19:32:43 +0800 Subject: [PATCH] 更新 --- src/main/java/testElectronJ/TestController.java | 81 +++++++++++++++++++++------------------- 1 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/main/java/testElectronJ/TestController.java b/src/main/java/testElectronJ/TestController.java index 09ee193..aa54c33 100644 --- a/src/main/java/testElectronJ/TestController.java +++ b/src/main/java/testElectronJ/TestController.java @@ -39,17 +39,11 @@ @PostMapping("/export") public void export(HttpServletRequest req, HttpServletResponse resp){ - String lbottom_echart = req.getParameter("lbottom_echart"); //鐢垫睜鐢垫祦鎶樼嚎鍥� - String rbottom_echart = req.getParameter("rbottom_echart"); //鍗曚綋鐢靛帇鎶樼幇鍥� + String curr_echart = req.getParameter("curr_echart"); //鐢垫睜鐢垫祦鎶樼嚎鍥� + String groupVol_echart = req.getParameter("groupVol_echart"); //缁勭鐢靛帇鎶樼嚎鍥� + String cap_echart = req.getParameter("cap_echart"); //娴嬭瘯瀹归噺鎶樼嚎鍥� + String vol_echart = req.getParameter("vol_echart"); //鍗曚綋鐢靛帇鎶樼嚎鍥� - String rl_echart = req.getParameter("ltop_echart"); //鍗曚綋瀹归噺鏌辩姸鍥� - String sjbg_echart = req.getParameter("rtop_echart"); //鏁版嵁琛ㄦ牸 - - String zddy_echart = req.getParameter("ltop_echart"); //缁勭鐢靛帇 - String dtdy_echart = req.getParameter("rtop_echart"); //鍗曚綋鐢靛帇鎶樼嚎鍥� - - //int battGroupId =Integer.valueOf(req.getParameter("battGroupId")); //鐢垫睜缁勭紪鍙� - //int testRecordCount =Integer.valueOf(req.getParameter("testRecordCount")); //娴嬭瘯缂栧彿 String filePath = req.getParameter("filePath"); FboDataInf fboDataInf = new FboDataInf(); @@ -60,23 +54,17 @@ List<byte[]> bytes = new ArrayList<>(); try { - if (ServletUtils.isNotNull(lbottom_echart)) { - String[] url = lbottom_echart.split(","); + if (ServletUtils.isNotNull(curr_echart)) { + String[] url = curr_echart.split(","); bytes.add(new BASE64Decoder().decodeBuffer(url[1])); - }if (ServletUtils.isNotNull(rbottom_echart)) { - String[] url = rbottom_echart.split(","); + }if (ServletUtils.isNotNull(groupVol_echart)) { + String[] url = groupVol_echart.split(","); bytes.add(new BASE64Decoder().decodeBuffer(url[1])); - }if (ServletUtils.isNotNull(rl_echart)) { - String[] url = rl_echart.split(","); + }if (ServletUtils.isNotNull(cap_echart)) { + String[] url = cap_echart.split(","); bytes.add(new BASE64Decoder().decodeBuffer(url[1])); - }if (ServletUtils.isNotNull(sjbg_echart)) { - String[] url = sjbg_echart.split(","); - bytes.add(new BASE64Decoder().decodeBuffer(url[1])); - }if (ServletUtils.isNotNull(zddy_echart)) { - String[] url = zddy_echart.split(","); - bytes.add(new BASE64Decoder().decodeBuffer(url[1])); - }if (ServletUtils.isNotNull(dtdy_echart)) { - String[] url = dtdy_echart.split(","); + }if (ServletUtils.isNotNull(vol_echart)) { + String[] url = vol_echart.split(","); bytes.add(new BASE64Decoder().decodeBuffer(url[1])); } }catch (Exception e){ @@ -106,14 +94,26 @@ cellTitle.setCellValue("涓�浣撴満鍏呮斁鐢垫暟鎹�"); cellTitle.setCellStyle(cellStyle); rowNum++; + + FboDataHeadStart start = fboDataInf.fboDataStart; + HSSFRow rowHand = sheet.createRow(rowNum); + rowHand.createCell(0).setCellValue("鐢垫睜鍚嶇О锛�"); + rowHand.createCell(1).setCellValue(start.battNameStr); + rowHand.createCell(2).setCellValue("鐢垫睜鍝佺墝锛�"); + rowHand.createCell(1).setCellValue(start.battBrandStr); + rowNum++; + + //灞炴�ф爮 HSSFRow row = sheet.createRow(rowNum); - row.createCell(0).setCellValue("娴嬭瘯鏃堕暱"); //鍒涘缓鍗曞厓鏍� + + + row.createCell(0).setCellValue("娴嬭瘯鏃堕棿"); //鍒涘缓鍗曞厓鏍� row.createCell(1).setCellValue("鎬荤數鍘�"); row.createCell(2).setCellValue("娴嬭瘯瀹归噺"); row.createCell(3).setCellValue("鍓╀綑瀹归噺"); - for(int i=0;i<5;i++){ + for(int i=0;i<list.get(0).SingleVol.length;i++){ row.createCell(4+i).setCellValue("#"+Integer.valueOf(i+1)); } rowNum++; @@ -123,11 +123,13 @@ sheet.createRow(rowNum); //鍒涘缓琛� for(int j=0;j<5;j++){ FboData fbo=list.get(i+j); - sheet.getRow(rowNum).createCell(0).setCellValue(fbo.m_TestTime.toString()); + sheet.getRow(rowNum).createCell(0).setCellValue(fbo.m_TestTime.hms()); sheet.getRow(rowNum).createCell(1).setCellValue(fbo.SumVoltage); sheet.getRow(rowNum).createCell(2).setCellValue(fbo.testCap); sheet.getRow(rowNum).createCell(3).setCellValue(fbo.residualCap); - //sheet.getRow(rowNum).createCell(4+j).setCellValue(fbo.getMonVol()); + for (int k = 0;k<list.get(0).SingleVol.length;k++){ + sheet.getRow(rowNum).createCell(4+k).setCellValue(fbo.SingleVol[k]); + } } i=i+5-1; rowNum++; @@ -137,17 +139,20 @@ //鎻掑叆鍥剧墖 int picNum = 0; String[] picName = new String[]{ - "鐢垫睜鐢垫祦鎶樼嚎鍥�","鍗曚綋鐢靛帇鏌辩姸鍥�","鍗曚綋瀹归噺鏌辩姸鍥�","鏁版嵁琛ㄦ牸","缁勭鐢靛帇","鍗曚綋鐢靛帇鎶樼嚎鍥�" + "鐢垫睜鐢垫祦鎶樼嚎鍥�","缁勭鐢靛帇鎶樼嚎鍥�","娴嬭瘯瀹归噺鎶樼嚎鍥�","鍗曚綋鐢靛帇鎶樼嚎鍥�" }; - //for(int i=0;i<picName.length;i++){ - // sheet.createRow(rowNum-1); - // sheet.getRow(rowNum-1).createCell(0).setCellValue(picName[i]); - // //rowNum++; - // HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+27); - // anchor.setAnchorType(3); - // patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); - // picNum ++;rowNum+=27; - //} + if (picName.length==bytes.size()){ + for(int i=0;i<picName.length;i++){ + sheet.createRow(rowNum-1); + sheet.getRow(rowNum-1).createCell(0).setCellValue(picName[i]); + //rowNum++; + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rowNum, (short) 10, rowNum+27); + anchor.setAnchorType(3); + patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1); + picNum ++; + rowNum+=27; + } + } rowNum++; -- Gitblit v1.9.1