fuliqi
2024-12-23 deb49773f332f83dafb78788bc3d9b2b39fa421c
business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -1,6 +1,8 @@
package com.ycl.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
@@ -570,7 +572,13 @@
            }
            tempDir = Files.createTempDirectory("temp-dir").toFile();
            ZipUtil.unzip(tempZip, tempDir, StandardCharsets.ISO_8859_1);
            try {
                ZipUtil.unzip(tempZip, tempDir, CharsetUtil.CHARSET_UTF_8);
            }catch (IORuntimeException e){
                    log.error("解压失败,尝试使用GBK编码解压...");
                    ZipUtil.unzip(tempZip, tempDir, CharsetUtil.CHARSET_GBK);
            }
            Path path = tempDir.toPath();
            ProjectImportListener projectImportListener = new ProjectImportListener();
@@ -609,7 +617,7 @@
            files.forEach(attachmentFile -> {
                try {
                    //上传
                    String url = FileUploadUtils.upload(filePath, file);
                    String url = FileUploadUtils.uploadIOFile(filePath, attachmentFile);
                    //存放的文件名会加上_时间戳的后缀
                    String newName = FileUtils.getName(url);
                    attachments.add(new File()