管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-02-26 76888937ff6070d074896675f962d20f4551cc1b
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -94,6 +94,11 @@
    }
    @Override
    public List<CountEntity> countSizesByType() {
        return reportMapper.countSizesByType();
    }
    @Override
    public List<CountEntity> countServices() {
        return reportMapper.countServices();
    }
@@ -101,6 +106,16 @@
    @Override
    public List<CountEntity> countOperates() {
        return reportMapper.countOperates();
    }
    @Override
    public List<CountEntity> countSizesByPrj() {
        return reportMapper.countSizesByPrj();
    }
    @Override
    public List<CountEntity> countExplorationPoints() {
        return reportMapper.countExplorationPoints();
    }
    /**
@@ -146,8 +161,13 @@
                case "countSizes":
                    createCountSizesWord(source, target);
                    break;
                default:
                case "countServices":
                    createCountServicesWord(source, target);
                    break;
                case "countExplorationPoints":
                    createCountExplorationPointsWord(source, target);
                    break;
                default:
                    break;
            }
        } else {
@@ -158,8 +178,13 @@
                case "countSizes":
                    createCountSizesExcel(source, target);
                    break;
                default:
                case "countServices":
                    createCountServicesExcel(source, target);
                    break;
                case "countExplorationPoints":
                    createCountExplorationPointsExcel(source, target);
                    break;
                default:
                    break;
            }
        }
@@ -174,11 +199,15 @@
            return;
        }
        int rows = 1;
        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.getM2(), ce.getCount().toString()};
            addList.add(strs);
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", " ", "" + allCount});
        }
        WordHelper.generateWord(source, target, null, addList);
@@ -193,11 +222,15 @@
            return;
        }
        int rows = 1;
        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);
@@ -213,10 +246,40 @@
        }
        int rows = 1;
        Double allSize = 0d;
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            allSize += ce.getSizes();
            String[] strs = new String[]{"" + rows++, ce.getM1(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
        if (addList.size() > 0) {
            addList.add(new String[]{"" + rows, "总计", FileHelper.getSizes(allSize)});
        }
        WordHelper.generateWord(source, target, null, addList);
    }
    /**
     * 创建 钻孔数据统计 Word
     */
    public void createCountExplorationPointsWord(String source, String target) {
        List<CountEntity> list = countExplorationPoints();
        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);
@@ -231,9 +294,17 @@
            return;
        }
        int rows = 1;
        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);
@@ -251,9 +322,17 @@
            return;
        }
        int rows = 1;
        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);
@@ -272,9 +351,50 @@
        }
        int rows = 1;
        Double allSize = 0d;
        for (CountEntity ce : list) {
            ce.setNo(rows++);
            ce.setM2(FileHelper.getSizes(ce.getSizes()));
            allSize += ce.getSizes();
        }
        if (list.size() > 0) {
            CountEntity ce = new CountEntity();
            ce.setNo(rows);
            ce.setM1("总计");
            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 createCountExplorationPointsExcel(String source, String target) {
        List<CountEntity> list = countExplorationPoints();
        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);