管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-06 8c10eb7086cb61712747b96dae712526d90e5269
1
已修改10个文件
89 ■■■■■ 文件已修改
data/db_cx.sql 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/sys/ResController.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/Zip4jHelper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/mapper/sys/AttachMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/all/UploadAttachService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/DownloadService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/DataLibService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/PipelineService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/sys/AttachService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
data/db_cx.sql
@@ -9,8 +9,9 @@
select * from lf.sys_attach where tab='lf.sys_style';
select * from lf.sys_attach order by tab,tab_guid;
select * from bs.s_survey_information 勘察信息表
select * from bs.s_surveyworksite 勘察工点
select * from lf.sys_download order by id desc;
src/main/java/com/lf/server/controller/sys/ResController.java
@@ -3,6 +3,7 @@
import com.lf.server.annotation.SysLog;
import com.lf.server.controller.all.BaseController;
import com.lf.server.entity.all.ResponseMsg;
import com.lf.server.entity.ctrl.DownloadReqEntity;
import com.lf.server.entity.sys.ResEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.StringHelper;
@@ -321,17 +322,17 @@
            @ApiImplicitParam(name = "guids", value = "附件Guid数组", dataType = "String", paramType = "body", allowMultiple = true, example = "e5b6ae0889b88111f13a4b6e048348db,fa4f299e901a0c46e634f8fcc8185c0c")
    })
    @ResponseBody
    @PostMapping(value = "/downloadReq")
    public ResponseMsg<Object> downloadReqForGuids(String[] guids, HttpServletRequest req, HttpServletResponse res) {
    @PostMapping(value = "/downloadReqForGuids")
    public ResponseMsg<Object> downloadReqForGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (null == guids || guids.length == 0) {
            if (null == dre || null == dre.getGuids() || dre.getGuids().isEmpty()) {
                return fail("Guid数组为空");
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            String guid = uploadAttachService.downloadReqForGuids(ue, guids);
            String guid = uploadAttachService.downloadReqForGuids(ue, dre.getGuids());
            return success("");
            return success(guid);
        } catch (Exception ex) {
            return fail(ex, null);
        }
@@ -344,18 +345,18 @@
            @ApiImplicitParam(name = "guids", value = "附件Guid数组", dataType = "String", paramType = "body", allowMultiple = true, example = "08e5b4ad-93b8-46f6-adaa-46a6274af4ce,6f94f4f8-6e8d-44e7-8803-3d068d34983f")
    })
    @ResponseBody
    @PostMapping(value = "/downloadReq")
    public ResponseMsg<Object> downloadReqForTabGuids(String tab, String[] guids, HttpServletRequest req, HttpServletResponse res) {
    @PostMapping(value = "/downloadReqForTabGuids")
    public ResponseMsg<Object> downloadReqForTabGuids(@RequestBody DownloadReqEntity dre, HttpServletRequest req, HttpServletResponse res) {
        try {
            if (StringHelper.isEmpty(tab)) {
            if (null == dre || StringHelper.isEmpty(dre.getTab())) {
                return fail("表名为空");
            }
            if (null != guids && guids.length == 0) {
                guids = null;
            if (null != dre.getGuids() && dre.getGuids().size() == 0) {
                dre.setIds(null);
            }
            UserEntity ue = tokenService.getCurrentUser(req);
            String guid = uploadAttachService.downloadReqForTabGuids(ue, tab, guids);
            String guid = uploadAttachService.downloadReqForTabGuids(ue, dre.getTab(), dre.getGuids());
            return success(guid);
        } catch (Exception ex) {
src/main/java/com/lf/server/entity/ctrl/DownloadReqEntity.java
@@ -14,11 +14,15 @@
    private String guid;
    private List<String> guids;
    private List<Integer> ids;
    private String wkt;
    private List<String> entities;
    private String tab;
    private List<String> tabs;
@@ -49,6 +53,14 @@
        this.guid = guid;
    }
    public List<String> getGuids() {
        return guids;
    }
    public void setGuids(List<String> guids) {
        this.guids = guids;
    }
    public List<Integer> getIds() {
        return ids;
    }
@@ -65,6 +77,14 @@
        this.wkt = wkt;
    }
    public String getTab() {
        return tab;
    }
    public void setTab(String tab) {
        this.tab = tab;
    }
    public List<String> getTabs() {
        return tabs;
    }
src/main/java/com/lf/server/helper/Zip4jHelper.java
@@ -41,7 +41,7 @@
                f.delete();
            }
            ZipParameters params = getZipParams();
            ZipParameters params = getZipParams(!StringHelper.isEmpty(pwd));
            // 要打包的文件或文件夹
            File currentFile = new File(sourcePath);
@@ -84,19 +84,22 @@
    /**
     * 获取ZipParameters
     */
    public static ZipParameters getZipParams() {
    public static ZipParameters getZipParams(boolean flag) {
        // 设置压缩文件参数
        ZipParameters params = new ZipParameters();
        // 压缩方式
        params.setCompressionMethod(CompressionMethod.DEFLATE);
        // 压缩级别
        params.setCompressionLevel(CompressionLevel.MAXIMUM);
        // 是否设置加密文件
        params.setEncryptFiles(true);
        // 设置AES加密强度:KEY_STRENGTH_256
        params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128);
        // 设置加密算法
        params.setEncryptionMethod(EncryptionMethod.AES);
        if (flag) {
            // 是否设置加密文件
            params.setEncryptFiles(true);
            // 设置AES加密强度:KEY_STRENGTH_256
            params.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_128);
            // 设置加密算法
            params.setEncryptionMethod(EncryptionMethod.AES);
        }
        return params;
    }
src/main/java/com/lf/server/mapper/sys/AttachMapper.java
@@ -60,7 +60,7 @@
     * @param guids
     * @return
     */
    public List<AttachEntity> selectByGuids(String[] guids);
    public List<AttachEntity> selectByGuids(List<String> guids);
    /**
     * 根据表名和GUID查询
@@ -79,7 +79,7 @@
     * @param guids
     * @return
     */
    public List<AttachEntity> selectByTabGuids(String tab, String[] guids);
    public List<AttachEntity> selectByTabGuids(String tab, List<String> guids);
    /**
     * 根据表和GUID查询
src/main/java/com/lf/server/service/all/UploadAttachService.java
@@ -413,7 +413,7 @@
    /**
     * 请求下载
     */
    public String downloadReqForGuids(UserEntity ue, String[] guids) {
    public String downloadReqForGuids(UserEntity ue, List<String> guids) {
        List<AttachEntity> list = attachService.selectByGuids(guids);
        return downloadReq(ue, list);
@@ -422,7 +422,7 @@
    /**
     * 请求下载
     */
    public String downloadReqForTabGuids(UserEntity ue, String tab, String[] guids) {
    public String downloadReqForTabGuids(UserEntity ue, String tab, List<String> guids) {
        List<AttachEntity> list = attachService.selectByTabGuids(tab, guids);
        return downloadReq(ue, list);
@@ -440,7 +440,7 @@
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, null);
        ZipParameters params = Zip4jHelper.getZipParams();
        ZipParameters params = Zip4jHelper.getZipParams(false);
        addZipFiles(zip, params, list);
        DownloadEntity downloadEntity = getDownloadEntity(ue, zipFile, null);
src/main/java/com/lf/server/service/data/DownloadService.java
@@ -198,7 +198,7 @@
        String zipFile = downloadPath + File.separator + zipName;
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
        ZipParameters params = Zip4jHelper.getZipParams();
        ZipParameters params = Zip4jHelper.getZipParams(true);
        addMetaFiles(zip, params, list);
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
src/main/java/com/lf/server/service/show/DataLibService.java
@@ -112,7 +112,7 @@
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
        ZipParameters params = Zip4jHelper.getZipParams();
        ZipParameters params = Zip4jHelper.getZipParams(true);
        addZipFiles(zip, params, file.listFiles());
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
@@ -266,7 +266,7 @@
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
        ZipParameters params = Zip4jHelper.getZipParams();
        ZipParameters params = Zip4jHelper.getZipParams(true);
        addZipFiles(zip, params, file.listFiles());
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
src/main/java/com/lf/server/service/show/PipelineService.java
@@ -80,7 +80,7 @@
        String zipFile = pathHelper.getDownloadFullPath() + File.separator + zipName;
        ZipFile zip = Zip4jHelper.createZipFile(zipFile, pwd);
        ZipParameters params = Zip4jHelper.getZipParams();
        ZipParameters params = Zip4jHelper.getZipParams(true);
        addZipFiles(zip, params, file.listFiles());
        String dbPwd = Md5Helper.reverse(Md5Helper.generate(pwd));
src/main/java/com/lf/server/service/sys/AttachService.java
@@ -47,7 +47,7 @@
    }
    @Override
    public List<AttachEntity> selectByGuids(String[] guids) {
    public List<AttachEntity> selectByGuids(List<String> guids) {
        return attachMapper.selectByGuids(guids);
    }
@@ -57,7 +57,7 @@
    }
    @Override
    public List<AttachEntity> selectByTabGuids(String tab, String[] guids) {
    public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) {
        return attachMapper.selectByTabGuids(tab, guids);
    }