管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-02-27 7b2cce1b88761c23da4dc8b5343dd9700c36a6fd
修改导出报告功能
已修改1个文件
206 ■■■■ 文件已修改
src/main/java/com/lf/server/service/sys/ReportService.java 206 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -167,6 +167,12 @@
                case "countExplorationPoints":
                    createCountExplorationPointsWord(source, target);
                    break;
                case "countSizesByType":
                    createCountSizesByTypeWord(source, target);
                    break;
                case "countSizesByPrj":
                    createCountSizesByPrjWord(source, target);
                    break;
                default:
                    break;
            }
@@ -183,6 +189,12 @@
                    break;
                case "countExplorationPoints":
                    createCountExplorationPointsExcel(source, target);
                    break;
                case "countSizesByType":
                    createCountSizesByTypeExcel(source, target);
                    break;
                case "countSizesByPrj":
                    createCountSizesByPrjExcel(source, target);
                    break;
                default:
                    break;
@@ -214,29 +226,6 @@
    }
    /**
     * 创建 服务调用量统计 Word
     */
    public void createCountServicesWord(String source, String target) {
        List<CountEntity> list = countServices();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            allCount += ce.getCount();
            String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()};
            addList.add(strs);
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", "" + allCount});
        }
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 数据量统计 Word
     */
    public void createCountSizesWord(String source, String target) {
@@ -255,6 +244,29 @@
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", FileHelper.getSizes(allSize)});
        }
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 服务调用量统计 Word
     */
    public void createCountServicesWord(String source, String target) {
        List<CountEntity> list = countServices();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            allCount += ce.getCount();
            String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()};
            addList.add(strs);
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", "" + allCount});
        }
        WordHelper.generateWord(source, target, null, addList);
@@ -286,38 +298,60 @@
    }
    /**
     * 创建 用户流量统计 Excel
     * 创建 数据格式统计 Word
     */
    public void createCountOperatesExcel(String source, String target) {
        List<CountEntity> list = countOperates();
    public void createCountSizesByTypeWord(String source, String target) {
        List<CountEntity> list = countSizesByType();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        Double allSize = 0d;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            allSize += ce.getSizes();
            allCount += ce.getCount();
            String[] strs = new String[]{"" + rows++, ce.getM1(), "" + ce.getCount(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
            ce.setNo(rows);
            ce.setM1("总计");
            ce.setCount((long) allCount);
            list.add(ce);
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", "" + allCount, FileHelper.getSizes(allSize)});
        }
        Map<String, List<CountEntity>> map = new HashMap<>(1);
        map.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map);
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 服务调用量统计 Excel
     * 创建 项目数据统计 Word
     */
    public void createCountServicesExcel(String source, String target) {
        List<CountEntity> list = countServices();
    public void createCountSizesByPrjWord(String source, String target) {
        List<CountEntity> list = countSizesByPrj();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        Double allSize = 0d;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            allSize += ce.getSizes();
            allCount += ce.getCount();
            String[] strs = new String[]{"" + rows++, ce.getM1(), "" + ce.getCount(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", "" + allCount, FileHelper.getSizes(allSize)});
        }
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 用户流量统计 Excel
     */
    public void createCountOperatesExcel(String source, String target) {
        List<CountEntity> list = countOperates();
        if (null == list || list.isEmpty()) {
            return;
        }
@@ -372,6 +406,34 @@
    }
    /**
     * 创建 服务调用量统计 Excel
     */
    public void createCountServicesExcel(String source, String target) {
        List<CountEntity> list = countServices();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            allCount += ce.getCount();
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
            ce.setNo(rows);
            ce.setM1("总计");
            ce.setCount((long) allCount);
            list.add(ce);
        }
        Map<String, List<CountEntity>> map = new HashMap<>(1);
        map.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map);
    }
    /**
     * 创建 钻孔数据统计 Excel
     */
    public void createCountExplorationPointsExcel(String source, String target) {
@@ -404,6 +466,70 @@
    }
    /**
     * 创建 数据格式统计 Excel
     */
    public void createCountSizesByTypeExcel(String source, String target) {
        List<CountEntity> list = countSizesByType();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        Double allSize = 0d;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            ce.setM2(FileHelper.getSizes(ce.getSizes()));
            allCount += ce.getCount();
            allSize += ce.getSizes();
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
            ce.setNo(rows);
            ce.setM1("总计");
            ce.setCount((long) allCount);
            ce.setM2(FileHelper.getSizes(allSize));
            list.add(ce);
        }
        Map<String, List<CountEntity>> map = new HashMap<>(1);
        map.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map);
    }
    /**
     * 创建 项目数据统计 Excel
     */
    public void createCountSizesByPrjExcel(String source, String target) {
        List<CountEntity> list = countSizesByPrj();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1, allCount = 0;
        Double allSize = 0d;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            ce.setM2(FileHelper.getSizes(ce.getSizes()));
            allCount += ce.getCount();
            allSize += ce.getSizes();
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
            ce.setNo(rows);
            ce.setM1("总计");
            ce.setCount((long) allCount);
            ce.setM2(FileHelper.getSizes(allSize));
            list.add(ce);
        }
        Map<String, List<CountEntity>> map = new HashMap<>(1);
        map.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map);
    }
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file) {