|
|
|
@ -2,7 +2,6 @@ package apelet.common.core.upload; |
|
|
|
|
|
|
|
|
|
|
|
import apelet.common.core.constant.ErrorCodeEnum; |
|
|
|
import apelet.common.core.constant.ErrorCodeEnum; |
|
|
|
import apelet.common.core.exception.MyRuntimeException; |
|
|
|
import apelet.common.core.exception.MyRuntimeException; |
|
|
|
import apelet.common.core.util.MyCommonUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.BooleanUtil; |
|
|
|
import cn.hutool.core.util.BooleanUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -15,7 +14,10 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.*; |
|
|
|
import java.io.BufferedInputStream; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.InputStream; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.nio.file.Path; |
|
|
|
@ -121,9 +123,8 @@ public class LocalUpDownloader extends BaseUpDownloader { |
|
|
|
try { |
|
|
|
try { |
|
|
|
byte[] bytes = uploadFile.getBytes(); |
|
|
|
byte[] bytes = uploadFile.getBytes(); |
|
|
|
StringBuilder sb = new StringBuilder(256); |
|
|
|
StringBuilder sb = new StringBuilder(256); |
|
|
|
String s = MyCommonUtil.generateUuid() + "@" + responseInfo.getFilename(); |
|
|
|
// fillUploadResponseInfo 已生成 {uuid}.{后缀},此处直接使用,不再二次加前缀(否则会出现 uuid@uuid.后缀)。
|
|
|
|
responseInfo.setFileRealName(responseInfo.getFilename()); |
|
|
|
String s = responseInfo.getFilename(); |
|
|
|
responseInfo.setFilename(s); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sb.append(uploadPath).append("/").append(s); |
|
|
|
sb.append(uploadPath).append("/").append(s); |
|
|
|
Path path = Paths.get(sb.toString()); |
|
|
|
Path path = Paths.get(sb.toString()); |
|
|
|
|