管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-06-29 9e4294e44897452b0b37ae89477c3d0df87ba69e
1
已修改3个文件
46 ■■■■ 文件已修改
data/db_cx.sql 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/PublishController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/PublishService.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_cx.sql
@@ -75,6 +75,8 @@
---------------------------------------------------------------------------------------------- 
-- update lf.sys_publish a set geom = ST_GeomFromText('POINT Z (31.231025 113.223529 12)') where id = 1;
select id from lf.sys_layer where cn_name = '三维地质模型' and pid = (select id from lf.sys_layer where cn_name = '勘察' order by pid limit 1);
src/main/java/com/lf/server/controller/data/PublishController.java
@@ -233,6 +233,13 @@
                return fail("id数组不能为空", -1);
            }
            String strs = StringHelper.join(ids, ",");
            List<PublishEntity> list = publishService.selectByIds(strs);
            if (null == list || list.isEmpty()) {
                return fail("没有找到要删除的数据", -1);
            }
            publishService.deleteFiles(list);
            int count = publishService.deletes(ids, req);
            return success(count);
src/main/java/com/lf/server/service/data/PublishService.java
@@ -7,20 +7,21 @@
import com.lf.server.entity.ctrl.RegisterEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.data.PublishEntity;
import com.lf.server.helper.PathHelper;
import com.lf.server.helper.RestHelper;
import com.lf.server.helper.StringHelper;
import com.lf.server.helper.WebHelper;
import com.lf.server.mapper.data.PublishMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 数据发布
@@ -34,11 +35,14 @@
    @Value("${sys.iisHost}")
    private String iisHost;
    @Autowired
    @Resource
    PublishMapper publishMapper;
    @Autowired
    @Resource
    FmeService fmeService;
    @Resource
    PathHelper pathHelper;
    private final static Log log = LogFactory.getLog(PublishService.class);
@@ -254,4 +258,25 @@
            }
        }
    }
    /**
     * 删除发布文件
     */
    public void deleteFiles(List<PublishEntity> list) {
        String uploadPath = pathHelper.getConfig().getUploadPath();
        for (PublishEntity pub : list) {
            if (null != pub.getUrl() && pub.getUrl().contains("/SG/")) {
                continue;
            }
            String path = uploadPath + File.separator + pub.getPath().replace("\\tileset.json", "");
            File file = new File(path);
            if (!file.exists() || !file.isDirectory()) {
                continue;
            }
            String cmd = String.format("cmd /c rd \"%s\" /s /q", path);
            WebHelper.exec(cmd);
        }
    }
}