管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-04-03 105fc752691e15d79715827dc58f22c9a2b87b96
src/main/java/com/lf/server/service/show/DataLibService.java
@@ -1,7 +1,6 @@
package com.lf.server.service.show;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lf.server.entity.all.BaseEntity;
import com.lf.server.entity.ctrl.DownloadReqEntity;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.sys.AttachEntity;
@@ -152,7 +151,6 @@
        String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date());
        String tempPath = pathHelper.getTempPath(tempName);
        String gdbPath = tempPath + File.separator + "tabs.gdb";
        String annexPath = tempPath + File.separator + "annex";
        File gdbFile = new File(gdbPath);
        if (gdbFile.exists() && gdbFile.isDirectory()) {
@@ -160,23 +158,18 @@
        }
        GdbHelper.createGdb(gdbPath, dataMap);
        File annexFile = new File(annexPath);
        if (!annexFile.exists() || !annexFile.isDirectory()) {
            annexFile.mkdirs();
        }
        createAnnex(annexPath, annexMap);
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".gdb.zip";
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd());
        ZipParameters params = Zip4jHelper.getZipParams(true);
        zip.addFolder(new File(gdbPath), params);
        zip.addFolder(new File(annexPath), params);
        // zip.addFolder(new File(annexPath), params)
        downloadService.addAnnex(zip, params, annexMap);
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd()));
        DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, dbPwd);
        int rows = downloadMapper.insert(downloadEntity);
        DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd);
        int rows = downloadMapper.insert(de);
        return rows > 0 ? downloadEntity.getGuid() : null;
        return rows > 0 ? de.getGuid() : null;
    }
    /**
@@ -201,11 +194,11 @@
                } else {
                    dataMap.get(entity).addAll(list);
                }
                if ("bborehole".equals(entity)) {
                    continue;
                }
                if (wrapper.isEmptyOfWhere()) {
                    wrapper.apply("1 = 1");
                }
                if ("bborehole".equals(entity)) {
                    wrapper.last("limit 100");
                }
                String tab = BaseQueryService.getTabName(baseMapper);
@@ -215,9 +208,9 @@
                }
                if (!annexMap.containsKey(entity)) {
                    annexMap.put(entity, annex);
                    annexMap.put(tab.replace(".", "_"), annex);
                } else {
                    annexMap.get(entity).addAll(annex);
                    annexMap.get(tab.replace(".", "_")).addAll(annex);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
@@ -256,7 +249,7 @@
    }
    /**
     * 创建附件
     * 创建附件 *
     */
    private void createAnnex(String annexPath, Map<String, List<AttachEntity>> annexMap) {
        if (annexMap.size() == 0) {