lxw
2022-06-16 addc5a16ce7c02e37997c7e9c8d6586ace3ab4d8
src/main/java/com/whyc/service/EchartPictureDowloadService.java
@@ -123,7 +123,7 @@
        int battGroupId = Integer.valueOf(req.getParameter("battGroupId"));  //电池组编号
        int testRecordCount = Integer.valueOf(req.getParameter("testRecordCount"));  //测试编号
        String stateFlag = req.getParameter("stateFlag");//第几次放电
        stateFlag = "第1次放电";
        //stateFlag = "2022-02-10-第1次放电";
        List<FBOTestData> list = fboservice.getList(battGroupId, testRecordCount);  //查询4059充放电数据
@@ -198,33 +198,34 @@
                    sheet.getRow(rowNum).createCell(1).setCellValue(fbo.getSumVol());
                    sheet.getRow(rowNum).createCell(2).setCellValue(fbo.getTestCurr());
                    sheet.getRow(rowNum).createCell(3).setCellValue(fbo.getTestCap());
                    sheet.getRow(rowNum).createCell(4+j).setCellValue(fbo.getMonVol());
                    sheet.getRow(rowNum).createCell(4 + j).setCellValue(fbo.getMonVol());
                }
                i=i+monCount-1;
                i = i + monCount - 1;
                rowNum++;
            }
        }
        rowNum+=2;
        rowNum += 2;
        //excel文件名
        String testTime = new SimpleDateFormat("yyyy-MM-dd").format(test_starttime);
        excelName = excelName+"-"+testTime;
        String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, 、?]";
        excelName = excelName.replace(regEx,"");
        /*String testTime = new SimpleDateFormat("yyyy-MM-dd").format(test_starttime);
        excelName = excelName+"-"+testTime;*/
        String regEx = "[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。, 、?]";
        excelName = excelName.replace(regEx, "");
        //插入图片
        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]);
        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+rowNumAdd);
            HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255, (short) 0, rowNum, (short) 10, rowNum + rowNumAdd);
            anchor.setAnchorType(3);
            patriarch.createPicture(anchor,wb.addPicture(bytes.get(picNum),HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1);
            picNum ++;rowNum+=rowNumAdd;
            patriarch.createPicture(anchor, wb.addPicture(bytes.get(picNum), HSSFWorkbook.PICTURE_TYPE_PNG)).resize(1);
            picNum++;
            rowNum += rowNumAdd;
        }
        rowNum++;