|
|
@ -24,6 +24,8 @@ import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils;
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import sun.misc.BASE64Decoder;
|
|
|
|
import sun.misc.BASE64Decoder;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -33,6 +35,8 @@ import sun.misc.BASE64Decoder;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class FileUtils
|
|
|
|
public class FileUtils
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
|
|
|
|
|
|
|
|
|
|
|
|
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
|
|
|
|
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -210,17 +214,15 @@ public class FileUtils
|
|
|
|
fileOut = new FileOutputStream(desc);
|
|
|
|
fileOut = new FileOutputStream(desc);
|
|
|
|
zipOutputStream = new ZipOutputStream(fileOut);
|
|
|
|
zipOutputStream = new ZipOutputStream(fileOut);
|
|
|
|
for(Map<String,Object> filePath:filePathList){
|
|
|
|
for(Map<String,Object> filePath:filePathList){
|
|
|
|
URL file = new URL(filePath.get("urlPath").toString());
|
|
|
|
try{
|
|
|
|
bufIn = new BufferedInputStream(file.openStream());
|
|
|
|
URL file = new URL(filePath.get("urlPath").toString());
|
|
|
|
zipEntry = new ZipEntry(filePath.get("downloadPath").toString());
|
|
|
|
bufIn = new BufferedInputStream(file.openStream());
|
|
|
|
zipOutputStream.putNextEntry(zipEntry);
|
|
|
|
zipEntry = new ZipEntry(filePath.get("downloadPath").toString());
|
|
|
|
// byte[] b = new byte[1024*4];
|
|
|
|
zipOutputStream.putNextEntry(zipEntry);
|
|
|
|
// int length;
|
|
|
|
IOUtils.copy(bufIn,zipOutputStream);
|
|
|
|
// while ((length = bufIn.read(b)) > 0)
|
|
|
|
}catch (Exception ee){
|
|
|
|
// {
|
|
|
|
logger.error("downloadLocalZip方法图片下载失败,"+filePath.get("urlPath").toString()+"地址的图片访问失败",ee);
|
|
|
|
// zipOutputStream.write(b, 0, length);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
IOUtils.copy(bufIn,zipOutputStream);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (IOException e)
|
|
|
|
catch (IOException e)
|
|
|
|