whycxzp
2025-04-30 1024d7a5b86ae091e131bedcc2f5bcf45866fb76
src/main/java/com/whyc/service/ExcelService.java
@@ -60,9 +60,9 @@
        createSheet1(workbook,battGroupId,testRecordCount);
        //创建sheet2 -- 每月电压,12个月,取每月1号零点零分
        //创建sheet3 -- 每月内阻, 12个月,取每月1号零点零分
        //createSheet2And3(workbook,battGroupId);
        createSheet2And3(workbook,battGroupId);
        //创建sheet4 -- 每天温度, 30天, 取每天零点零分
        //createSheet4(workbook,battGroupId);
        createSheet4(workbook,battGroupId);
        // 将工作簿写入文件
        FileOutputStream fileOut = new FileOutputStream(filePath);
@@ -214,6 +214,10 @@
        XSSFCellStyle cellStyleOriginal2 = cellOfSheet3.getCellStyle();
        XSSFCellStyle cellStyleNew2 = getCellStyleFont(cellStyleOriginal2,workbook, true, 15);
        cellOfSheet3.setCellStyle(cellStyleNew2);
        //设置数值类型保留位数
        setDateFormat(workbook,sheet2,3,110,1,columnCount-2, "0.0000");
        setDateFormat(workbook,sheet3,3,110,1,columnCount-2, "0.0000");
        // 创建绘图工具
@@ -465,6 +469,8 @@
            cell.setCellStyle(cellStyle);
        }
        //设置数值类型单元格保留位数
        setDateFormat(workbook,sheet4,3,110,1,columnCount-2, "0.0000");
        createChart(sheet4, columnCount,3,"温度折线图");
    }