管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-02-26 b30a9bc3be541896054abfb46acc49efb3c66ee2
添加钻孔数据导出Excel、Word
已修改1个文件
45 ■■■■■ 文件已修改
src/main/java/com/lf/server/service/sys/ReportService.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -164,6 +164,9 @@
                case "countServices":
                    createCountServicesWord(source, target);
                    break;
                case "countExplorationPoints":
                    createCountExplorationPointsWord(source, target);
                    break;
                default:
                    break;
            }
@@ -177,6 +180,9 @@
                    break;
                case "countServices":
                    createCountServicesExcel(source, target);
                    break;
                case "countExplorationPoints":
                    createCountExplorationPointsExcel(source, target);
                    break;
                default:
                    break;
@@ -242,6 +248,25 @@
    }
    /**
     * 创建 钻孔数据统计 Word
     */
    public void createCountExplorationPointsWord(String source, String target) {
        List<CountEntity> list = countExplorationPoints();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            String[] strs = new String[]{"" + rows++, ce.getM1(), "" + ce.getCount(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 用户流量统计 Excel
     */
    public void createCountOperatesExcel(String source, String target) {
@@ -303,6 +328,26 @@
    }
    /**
     * 创建 钻孔数据统计 Excel
     */
    public void createCountExplorationPointsExcel(String source, String target) {
        List<CountEntity> list = countExplorationPoints();
        if (null == list || list.isEmpty()) {
            return;
        }
        int rows = 1;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
        }
        Map<String, List<CountEntity>> map = new HashMap<>(1);
        map.put("data", list);
        ExcelHelper.writeToTemplate(source, target, map);
    }
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file) {