管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-08-24 24a0395f199387b37d09cc6639489d01f7504397
src/main/java/com/lf/server/service/data/MetaService.java
@@ -10,6 +10,7 @@
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.*;
import com.lf.server.mapper.all.BasicMapper;
import com.lf.server.mapper.all.GeomBaseMapper;
import com.lf.server.mapper.data.MetaMapper;
import com.lf.server.service.all.BaseQueryService;
import com.lf.server.service.sys.MetaDownService;
@@ -65,6 +66,11 @@
    }
    @Override
    public List<MetaEntity> selectGdbByGuid(String guid) {
        return metaMapper.selectGdbByGuid(guid);
    }
    @Override
    public Integer selectMetasForCount(String depcode, String dirs, String name) {
        depcode = StringHelper.getRightLike(depcode);
        name = StringHelper.getLikeUpperStr(name);
@@ -114,8 +120,8 @@
    }
    @Override
    public MetaEntity selectByGuid(String guid, String tab) {
        return metaMapper.selectByGuid(guid, tab);
    public MetaEntity selectByGuid(String guid, String dircode, String tab) {
        return metaMapper.selectByGuid(guid, dircode, tab);
    }
    @Override
@@ -238,6 +244,9 @@
            if (str.contains("bs.s_explorationpoint ")) {
                list.add(str.replace("bs.s_explorationpoint ", "bs.s_surveyworksite "));
            }
            if (str.contains("bs.m_surface_deformation_data ")) {
                list.add(str.replace("bs.m_surface_deformation_data ", "bs.m_surface_deformation_data_date "));
            }
            i++;
        }
@@ -269,7 +278,7 @@
                return;
            }
            MetaEntity me = selectByGuid(guid, null);
            MetaEntity me = selectByGuid(guid, null, null);
            if (me == null) {
                WebHelper.writeStr2Page(res, StaticData.NO_FILE);
                return;
@@ -299,6 +308,11 @@
    /**
     * 请求元数据下载
     *
     * @param ue 用户实体
     * @param dr 请求下载实体
     * @return 下载文件GUID
     * @throws Exception 异常
     */
    public String downloadMeteReq(UserEntity ue, DownloadReqEntity dr) throws Exception {
        List<MetaEntity> list = selectMetaFiles(dr.getIds());
@@ -306,18 +320,6 @@
            return null;
        }
        return zipFiles(ue, list, dr.getPwd());
    }
    /**
     * 打包文件
     *
     * @param ue   用户实体
     * @param list 元数据文件集合
     * @param pwd  密码
     * @return 下载文件GUID
     */
    public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception {
        Map<String, List<String>> tabs = getTabs(list);
        rmRepeatMetas(list);
@@ -338,7 +340,7 @@
        }
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + tempName + ".zip";
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, dr.getPwd());
        ZipParameters params = Zip4jHelper.getZipParams(true);
        addMetaFiles(zip, params, list);
        if (dataMap.size() > 0) {
@@ -346,7 +348,7 @@
            addAnnex(zip, params, annexMap);
        }
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(dr.getPwd()));
        DownloadEntity de = getDownloadEntity(ue, zipFile, dbPwd);
        int rows = downloadService.insert(de);
        if (de.getId() > 0) {
@@ -462,6 +464,9 @@
        String filter = String.format("parentid in (%s)", StringHelper.join(ids, ","));
        QueryWrapper<T> wrapper = new QueryWrapper<T>();
        if (baseMapper instanceof GeomBaseMapper) {
            wrapper.select("ST_AsText(geom) as geom, *");
        }
        wrapper.apply(filter);
        return wrapper;
@@ -512,6 +517,9 @@
                    case StaticData.MPT:
                        addMultiFile(uploadPath, mf, zip, params, StaticData.MPT_EXT);
                        break;
                    case StaticData.JPG:
                        addMultiFile(uploadPath, mf, zip, params, StaticData.JPG_EXT);
                        break;
                    case StaticData.IMG:
                        addMultiFile(uploadPath, mf, zip, params, StaticData.IMG_EXT);
                        break;
@@ -525,6 +533,8 @@
                        addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT);
                        break;
                    case StaticData.GDB:
                        continue;
                    case StaticData.OSGB:
                        addFolderFile(uploadPath, mf, zip, params);
                        break;
                    default:
@@ -598,7 +608,7 @@
    private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) {
        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(3);
        de.setSizes(FileHelper.sizeToMb(new File(file).length()));
        de.setDepid(ue.getDepid());