[测评系统]--测评系统核心代码库
林致杰
2022-08-02 54aecc07ca143841e66e25dc587bd2629fa0ba8f
增加空行判断
1个文件已修改
32 ■■■■■ 已修改文件
src/main/java/com/ots/project/tool/report/MAQTR/chart/MAQTRChart.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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()+"(n="+ 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()+"(n="+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){