管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-02-26 b30a9bc3be541896054abfb46acc49efb3c66ee2
src/main/java/com/lf/server/service/sys/ReportService.java
@@ -36,14 +36,14 @@
    @Override
    public Integer selectCount(String name, String code) {
        name = StringHelper.getLikeStr(name);
        name = StringHelper.getLikeUpperStr(name);
        return reportMapper.selectCount(name, code);
    }
    @Override
    public List<ReportEntity> selectByPage(String name, String code, Integer limit, Integer offset) {
        name = StringHelper.getLikeStr(name);
        name = StringHelper.getLikeUpperStr(name);
        return reportMapper.selectByPage(name, code, limit, offset);
    }
@@ -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;
            }
        }
@@ -216,6 +241,25 @@
        ArrayList<String[]> addList = new ArrayList<>();
        for (CountEntity ce : list) {
            String[] strs = new String[]{"" + rows++, ce.getM1(), FileHelper.getSizes(ce.getSizes())};
            addList.add(strs);
        }
        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;
        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);
        }
@@ -284,12 +328,32 @@
    }
    /**
     * 创建 钻孔数据统计 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) {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
        // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告
        // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告,7-附件文件,8-瓦片文件
        de.setType(6);
        de.setSizes(FileHelper.sizeToMb(new File(file).length()));
        de.setDepid(ue.getDepid());