管道基础大数据平台系统开发-【后端】-Server
1.5
13693261870
2023-01-05 e5f61db766b3eaa28506835e3581cbd2fdc8533d
src/main/java/com/lf/server/service/data/DownloadService.java
@@ -2,7 +2,8 @@
import com.lf.server.entity.ctrl.DownloadReqEntity;
import com.lf.server.entity.data.DownloadEntity;
import com.lf.server.entity.data.MetaFileEntity;
import com.lf.server.entity.data.MetaEntity;
import com.lf.server.entity.show.PipelineEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.*;
import com.lf.server.mapper.data.DownloadMapper;
@@ -141,6 +142,28 @@
    /**
     * 解密
     *
     * @param pe 管道分析实体类
     * @return 是/否解密成功
     */
    public static boolean decryptPwd(PipelineEntity pe) {
        try {
            String pwd = RsaHelper.decrypt(pe.getPwd());
            if (StringHelper.isEmpty(pwd)) {
                return false;
            }
            pe.setPwd(pwd);
            return true;
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            return false;
        }
    }
    /**
     * 解密
     *
     * @param pwd 加密密码
     * @return 原始密码
     */
@@ -161,7 +184,7 @@
     * @param pwd  密码
     * @return 下载文件GUID
     */
    public String zipFiles(UserEntity ue, List<MetaFileEntity> list, String pwd) throws Exception {
    public String zipFiles(UserEntity ue, List<MetaEntity> list, String pwd) throws Exception {
        rmRepeatMetaFiles(list);
        String downloadPath = pathHelper.getDownloadFullPath();
@@ -182,12 +205,12 @@
    /**
     * 移除重复的元数据文件
     */
    private void rmRepeatMetaFiles(List<MetaFileEntity> list) {
    private void rmRepeatMetaFiles(List<MetaEntity> list) {
        List<String> guidList = new ArrayList<>();
        int i = 0;
        while (i < list.size()) {
            MetaFileEntity entity = list.get(i);
            MetaEntity entity = list.get(i);
            if (guidList.contains(entity.getGuid())) {
                list.remove(i);
                continue;
@@ -201,11 +224,11 @@
    /**
     * 添加元数据文件至Zip包
     */
    private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaFileEntity> list) {
    private void addMetaFiles(ZipFile zip, ZipParameters params, List<MetaEntity> list) {
        String uploadPath = pathHelper.getConfig().getUploadPath();
        int i = 1;
        for (MetaFileEntity entity : list) {
        for (MetaEntity entity : list) {
            try {
                File file = new File(uploadPath + File.separator + entity.getPath());
                zip.addFile(file, params);