REQ-3581: 该签署位已签署, 无法再次签署
This commit is contained in:
parent
8a909a5be8
commit
9b34776762
@ -1,16 +1,7 @@
|
||||
|
||||
package cn.axzo.nanopart.ess.server.ess.support;
|
||||
|
||||
import cn.axzo.nanopart.ess.server.utils.BizAssertions;
|
||||
import cn.axzo.oss.http.api.ServerFileServiceApi;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlDownloadRequest;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlDownloadResponse;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlUploadRequest;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlUploadResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import static cn.axzo.nanopart.ess.server.utils.BizAssertions.fail;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -23,7 +14,17 @@ import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.axzo.nanopart.ess.server.utils.BizAssertions.fail;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.axzo.nanopart.ess.server.utils.BizAssertions;
|
||||
import cn.axzo.oss.http.api.ServerFileServiceApi;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlDownloadRequest;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlDownloadResponse;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlUploadRequest;
|
||||
import cn.axzo.oss.http.model.ApiSignUrlUploadResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
@ -91,21 +92,16 @@ public class OssService {
|
||||
connection.setRequestProperty("Content-Type", ossResponse.getContentType());
|
||||
connection.setRequestProperty("Content-Disposition",
|
||||
String.format("attachment;filename=\"%s\"", URLEncoder.encode(fileName, "utf-8")));
|
||||
try {
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(content);
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = is.read(buffer)) != -1)
|
||||
os.write(buffer, 0, bytesRead);
|
||||
os.flush();
|
||||
}
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
ByteArrayInputStream is = new ByteArrayInputStream(content);
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = is.read(buffer)) != -1)
|
||||
os.write(buffer, 0, bytesRead);
|
||||
os.flush();
|
||||
int responseCode = connection.getResponseCode();
|
||||
log.info("上传到OSS返回码: {}", responseCode);
|
||||
}
|
||||
finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user