From 54aecc07ca143841e66e25dc587bd2629fa0ba8f Mon Sep 17 00:00:00 2001 From: 林致杰 <1003392067@qq.com> Date: 星期二, 02 八月 2022 15:08:09 +0800 Subject: [PATCH] 增加空行判断 --- src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java b/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java index fdc8777..068f2bc 100644 --- a/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java +++ b/src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java @@ -62,30 +62,26 @@ XSSFSheet sheet = wb.getSheetAt(i); String companyName = sheet.getRow(1).getCell(0).getStringCellValue(); Map<Integer,List<Double>> map = new HashMap<>(); + //缁熻浜烘暟 + int person = 0; //琛� for (int j = 1; j <= sheet.getLastRowNum(); j++) { XSSFRow row = sheet.getRow(j); if(row == null){ - continue; + break; } //鍒� for (int k = 1; k < row.getLastCellNum(); k++) { XSSFCell cell = row.getCell(k); if(cell == null){ - continue; + break; } -/* - if (CellType.NUMERIC == cell.getCellType()) { - System.out.println(cell.getNumericCellValue()); - } else if (CellType.STRING == cell.getCellType()) { - System.out.println(cell.getStringCellValue()); - } -*/ + //涓嶆槸鍒嗘暟 蹇界暐 switch (cell.getCellType()) { case STRING: - continue; + break; } - //table1 澶氫釜绛旈缁撴灉澶勭悊 + //褰掔被涓�� if(map.get(k) != null){ map.get(k).add(cell.getNumericCellValue()); }else { @@ -94,7 +90,15 @@ map.put(k,list); } } + person++; } + + //璁剧疆浜烘暟 + List<Double> list = new ArrayList<>(); + list.add(Double.valueOf(person)); + map.put(999,list); + + //璁剧疆涓嶅悓鍥㈤槦鐨勬暟鎹� dataMap.put(companyName,map); } //骞冲潎鍊奸泦鍚� @@ -149,8 +153,8 @@ //鍔ㄦ�佸�� for (Map.Entry<String,Map<Integer,Double>> map : dataMap.entrySet()) { SeriesData valSeriesData = new SeriesData(); - valSeriesData.setName(map.getKey()); Map<Integer,Double> valMap = map.getValue(); + valSeriesData.setName(map.getKey()+"锛坣="+ valMap.get(999).intValue() +"锛�"); List<RowData> valRowDataList = new ArrayList<>(); for (int i = oneIndex; i > 0; i--) { RowData rowData = new RowData(); @@ -206,8 +210,8 @@ //鍔ㄦ�佸�� for (Map.Entry<String,Map<Integer,Double>> map : dataMap.entrySet()) { SeriesData valSeriesData = new SeriesData(); - valSeriesData.setName(map.getKey()); Map<Integer,Double> valMap = map.getValue(); + valSeriesData.setName(map.getKey()+"锛坣="+valMap.get(999).intValue()+"锛�"); List<RowData> valRowDataList = new ArrayList<>(); for (int i = twoIndex; i > oneIndex; i--) { RowData rowData = new RowData(); @@ -505,7 +509,7 @@ } //鍒犻櫎澶氫綑琛屾暟 int lastRowNum = sheet.getLastRowNum(); - log.error("lastRowNum:{},size:{}",lastRowNum,size); + //log.error("lastRowNum:{},size:{}",lastRowNum,size); if (lastRowNum > size) { for (int idx = lastRowNum; idx > size; idx--) { if(sheet.getRow(idx) == null){ -- Gitblit v1.9.1