管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-15 739290c9f9274e7e5b3b79afe13fbfad7fe19e38
src/main/java/com/lf/server/service/show/MarkService.java
@@ -103,7 +103,7 @@
            return null;
        }
        String zip = getZip();
        String zip = getZipPath();
        ZipHelper.zip(zip, parent);
        FileHelper.deleteDir(parent);
@@ -119,25 +119,31 @@
        return rows > 0 ? de.getGuid() : null;
    }
    /**
     * 创建shp文件
     */
    private String createShapeFiles(UserEntity ue, List<MarkJsonEntity> list, String parent) {
        String path = getShpDir(ue, parent);
        List<MarkJsonEntity> points = getMarkByType(list, "POINT");
        if (points.size() > 0) {
            String pointFile = ShpHelper.createShp(points, path, "POINT");
            ShpHelper.createShp(points, path, "POINT");
        }
        List<MarkJsonEntity> lines = getMarkByType(list, "LINESTRING");
        if (lines.size() > 0) {
            String lineFile = ShpHelper.createShp(lines, path, "LINESTRING");
            ShpHelper.createShp(lines, path, "LINESTRING");
        }
        List<MarkJsonEntity> polygons = getMarkByType(list, "POLYGON");
        if (polygons.size() > 0) {
            String polygonFile = ShpHelper.createShp(polygons, path, "POLYGON");
            ShpHelper.createShp(polygons, path, "POLYGON");
        }
        return path;
    }
    /**
     * 获取shp目录
     */
    private String getShpDir(UserEntity ue, String parent) {
        String path = parent + File.separator + WebHelper.getRandomInt(100000, 1000000);
@@ -149,8 +155,11 @@
        return path;
    }
    /**
     * 获取标绘类型
     */
    private List<MarkJsonEntity> getMarkByType(List<MarkJsonEntity> list, String type) {
        List<MarkJsonEntity> rs = new ArrayList<MarkJsonEntity>();
        List<MarkJsonEntity> rs = new ArrayList<>();
        for (MarkJsonEntity mark : list) {
            if (StringHelper.isEmpty(mark.getWkt())) {
                continue;
@@ -163,7 +172,10 @@
        return rs;
    }
    private String getZip() {
    /**
     * 获取zip路径
     */
    private String getZipPath() {
        String path = pathHelper.getDownloadFullPath() + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip";
        File file = new File(path);
@@ -174,6 +186,9 @@
        return path;
    }
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
@@ -183,7 +198,7 @@
        de.setDcount(0);
        // de.setPwd(null)
        de.setUrl(FileHelper.getRelativePath(file));
        de.setDescr("ShapeFile文件");
        de.setDescr("shp文件");
        de.setGuid(FileHelper.getFileMd5(file));
        de.setCreateUser(ue.getId());
        // de.setGeom(null)
@@ -193,9 +208,6 @@
    /**
     * 获取下载文件路径
     *
     * @param de 下载实体类
     * @return 下载文件路径
     */
    public String getDownloadFilePath(DownloadEntity de) {
        return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl();
@@ -203,9 +215,6 @@
    /**
     * 读取ShapeFile文件获取Mark实体类
     *
     * @param list ShapeFile文件列表
     * @return Mark实体类集合
     */
    public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) {
        String fileName = null;