月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2024-11-17 796b44ea813a1133beae4f3a67f1c0263510c0c7
src/main/java/com/moon/server/service/data/MetaService.java
@@ -27,11 +27,8 @@
import java.io.FileInputStream;
import java.util.*;
/**
 * 元数据
 * @author WWW
 */
@Service
@SuppressWarnings("ALL")
public class MetaService implements MetaMapper {
    @Autowired
    PathHelper pathHelper;
@@ -187,9 +184,6 @@
        return metaMapper.updates(list);
    }
    /**
     * 删除元数据
     */
    public Integer deletes(List<Integer> list) {
        String ids = StringHelper.join(list, ",");
@@ -202,9 +196,6 @@
        return deletes(sql, ids);
    }
    /**
     * 获取删除表记录SQL
     */
    public String getDelTabsSql(List<MetaEntity> metas) {
        List<String> list = getTabDeletes(metas, metas.get(0).getTab());
        addCascadDeletes(list);
@@ -214,9 +205,6 @@
        return StringHelper.join(list, ";");
    }
    /**
     * 获取删除表记录SQL
     */
    private List<String> getTabDeletes(List<MetaEntity> metas, String tab) {
        List<String> list = new ArrayList<>();
@@ -239,9 +227,6 @@
        return list;
    }
    /**
     * 添加级联删除
     */
    private void addCascadDeletes(List<String> list) {
        int i = 0, c = list.size();
        while (i < c) {
@@ -261,9 +246,6 @@
        }
    }
    /**
     * 添加附件删除
     */
    private void addAttachDeletes(List<String> list) {
        int i = 0, c = list.size();
        while (i < c) {
@@ -277,9 +259,6 @@
        }
    }
    /**
     * 查看文件
     */
    public void downloadForView(String guid, boolean inline, HttpServletResponse res) {
        try {
            if (StringHelper.isEmpty(guid)) {
@@ -306,23 +285,12 @@
        }
    }
    /**
     * 查询元数据中溢出的单位ID
     */
    public List<String> selectMetaOverflowDep(UserEntity ue, DownloadReqEntity dr) {
        String ids = StringHelper.join(dr.getIds(), ",");
        return selectMetaOverflowDep(ids, ue.getDepcode());
    }
    /**
     * 请求元数据下载
     *
     * @param ue 用户实体
     * @param dr 请求下载实体
     * @return 下载文件GUID
     * @throws Exception 异常
     */
    public String downloadMeteReq(UserEntity ue, DownloadReqEntity dr) throws Exception {
        List<MetaEntity> list = selectMetaFiles(dr.getIds());
        if (null == list || list.isEmpty()) {
@@ -367,9 +335,6 @@
        return rows > 0 ? de.getGuid() : null;
    }
    /**
     * 获取数据表
     */
    private Map<String, List<String>> getTabs(List<MetaEntity> list) {
        Map<String, List<String>> tabs = new HashMap<>(2);
        for (MetaEntity meta : list) {
@@ -390,9 +355,6 @@
        return tabs;
    }
    /**
     * 移除重复的元数据文件
     */
    private void rmRepeatMetas(List<MetaEntity> list) {
        List<String> guidList = new ArrayList<>();
@@ -409,9 +371,6 @@
        }
    }
    /**
     * 查询数据
     */
    private void queryData(Map<String, List<String>> tabs, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) {
        for (String tab : tabs.keySet()) {
            try {
@@ -429,9 +388,6 @@
        }
    }
    /**
     * 添加数据
     */
    public void addData(String entity, BasicMapper baseMapper, QueryWrapper wrapper, Map<String, List<?>> dataMap, Map<String, List<AttachEntity>> annexMap) {
        List list = baseMapper.selectList(wrapper);
        if (null == list || list.size() == 0) {
@@ -463,9 +419,6 @@
        }
    }
    /**
     * 创建查询包装器
     */
    private <T> QueryWrapper<T> createQueryWrapper(BasicMapper baseMapper, List<String> ids) {
        for (int i = 0, c = ids.size(); i < c; i++) {
            ids.set(i, "'" + ids.get(i) + "'");
@@ -481,9 +434,6 @@
        return wrapper;
    }
    /**
     * 添加附件
     */
    public void addAnnex(ZipFile zip, ZipParameters params, Map<String, List<AttachEntity>> annexMap) {
        List<String> files = new ArrayList<>();
        String uploadPath = pathHelper.getConfig().getUploadPath();
@@ -508,9 +458,6 @@
        }
    }
    /**
     * 添加元数据文件至Zip包
     */
    private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) {
        List<String> names = new ArrayList<>();
        String uploadPath = pathHelper.getConfig().getUploadPath();
@@ -559,9 +506,6 @@
        }
    }
    /**
     * 添加目录文件
     */
    private void addFolderFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception {
        File file = new File(uploadPath + File.separator + mf.getPath());
        if (!file.exists() || !file.isDirectory()) {
@@ -576,9 +520,6 @@
        }
    }
    /**
     * 添加多文件
     */
    private void addMultiFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params, List<String> extList) throws Exception {
        addSingleFile(uploadPath, mf, zip, params);
@@ -597,9 +538,6 @@
        }
    }
    /**
     * 添加单文件
     */
    private void addSingleFile(String uploadPath, MetaEntity mf, ZipFile zip, ZipParameters params) throws Exception {
        File file = new File(uploadPath + File.separator + mf.getPath());
        if (!file.exists() || file.isDirectory()) {
@@ -614,9 +552,6 @@
        }
    }
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
@@ -635,9 +570,6 @@
        return de;
    }
    /**
     * 插入元数据-下载表
     */
    private void insertMetaDown(UserEntity ue, List<MetaEntity> metas, DownloadEntity de) {
        List<MetaDownEntity> list = new ArrayList<>();
        for (MetaEntity me : metas) {
@@ -652,9 +584,6 @@
        metaDownService.inserts(list);
    }
    /**
     * 获取空间过滤
     */
    public String getGeometryFilter(String wkt) throws Exception {
        if (StringHelper.isEmpty(wkt)) {
            return null;