whycxzp
2025-03-18 f127214ad1076769c9cb4a97963ee3ad5053e970
src/main/java/com/whyc/service/ExcelExportService.java
@@ -1,8 +1,8 @@
package com.whyc.service;
import com.whyc.dto.ActmStopReason;
import com.whyc.pojo.db_batt_testdata.BattTestDataId;
import com.whyc.pojo.db_batt_testdata.BattTestDataInf;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData;
import com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf;
import com.whyc.util.ActionUtil;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -23,7 +23,7 @@
    private SubTablePageInfoService subService;
    @Autowired(required = false)
    private BattTestDataInfService infService;
    private BattLithiumTestDataInfService infService;
    //导出文件
    public void exportExcel1(Integer devId,  Integer testRecordCount,HttpServletResponse response) {
@@ -40,12 +40,12 @@
            row.createCell(i).setCellValue(titiles[i]);
        }
        rowNum++;
        List<BattTestDataId> list=subService.getTdataById(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataById(devId,testRecordCount);
        if(list!=null){
            //数据栏
            for (int i = 0; i < list.size(); i++) {
                sheet.createRow(rowNum);  //创建行
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                for(int j=0;j<titiles.length;j++){
                    sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                    sheet.getRow(rowNum).createCell(1).setCellValue(tdata.getBattIdx()+1);
@@ -106,7 +106,7 @@
        cellStyle.setFont(font);
        String[] titiles=new String[]{"Time(H:M:S)","Group V(V)","Group A(A)","Cap (AH)","Temp H(°C)","Temp L(°C)"};
        List<BattTestDataId> list=subService.getTdataByIdWithListA200(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataByIdWithListA200(devId,testRecordCount);
        int rowNum=0;
        // 创建标题行
@@ -129,7 +129,7 @@
            for (int i = 0; i < list.size(); i++) {
                Row row1 =  sheet.createRow(rowNum);  //创建行
                row1.setHeightInPoints(20.0f);
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                sheet.getRow(rowNum).createCell(1).setCellValue(String.format("%.1f",tdata.getGroupVol()));
                sheet.getRow(rowNum).createCell(2).setCellValue(String.format("%.1f",tdata.getTestCurr()));
@@ -177,7 +177,7 @@
        cellStyle.setFont(font);
        //获取放电inf
        BattTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        BattLithiumTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        String[] titiles33=new String[]{"PACK/模组号:","测试开始时间:","测试结束时间:","数据类型:","停止原因:","预放容量(AH):"
                ,"放电电流(A):","测试时长(h:m:s):","单串下限(V):","组端下限(V):","电芯串数:","最高温度(°C):","最低温度(°C):","采集频率(秒):"};
        String[] titiles34=new String[]{tinf.getBatteryName(),ActionUtil.sdf.format(tinf.getTestStarttime()),ActionUtil.sdf.format(tinf.getRecordTime()), "放电数据",tinf.getStopTypeReason(),String.format("%.1f",tinf.getTestCap())
@@ -226,7 +226,7 @@
        cellStyle.setFont(font);
        String[] titiles=new String[]{"测试时长"};
        List<BattTestDataId> list=subService.getTdataByIdWithListActm(devId,testRecordCount);
        List<BattLithiumTestData> list=subService.getTdataByIdWithListActm(devId,testRecordCount);
        int rowNum=0;
        // 创建标题行
@@ -252,7 +252,7 @@
            for (int i = 0; i < list.size(); i++) {
                Row row1 =  sheet.createRow(rowNum);  //创建行
                row1.setHeightInPoints(20.0f);
                BattTestDataId tdata=list.get(i);
                BattLithiumTestData tdata=list.get(i);
                sheet.getRow(rowNum).createCell(0 ).setCellValue(ActionUtil.secToTime(tdata.getTestTimelong()));
                List<Float> monVols = tdata.getMonVols();
                List<Float> monCurrs = tdata.getMonCurrs();
@@ -302,7 +302,7 @@
        cellStyle.setFont(font);
        //获取放电inf
        BattTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        BattLithiumTestDataInf tinf=infService.getTinfExport(devId,testRecordCount);
        String[] titiles3=new String[]{"电池包序号:","模组编号:","工作模式:","电池类型:","电池串数:","电压阀值(v):"
                ,"工作电流(A):","开始测试时间:","结束测试时间:","停止原因:"};