http工具修改

main
youHong.ai 2022-11-23 10:10:06 +08:00
parent 222e998b6c
commit 8d8375bded
2 changed files with 4 additions and 5 deletions

View File

@ -1034,12 +1034,12 @@ public class HttpUtils {
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
Long totalSize = 0L; Long totalSize = 0L;
for (MultipartFile multipartFile : multipartFileList) { for (MultipartFile multipartFile : multipartFileList) {
log.info(Util.logStr("add file, file info: fileName => [{}], fileKey => [{}], fileSize => [{}]kb", log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize())); multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
totalSize += multipartFile.getFileSize(); totalSize += multipartFile.getFileSize();
builder.addBinaryBody(multipartFile.getFileKey(), multipartFile.getStream(), ContentType.MULTIPART_FORM_DATA, multipartFile.getFileName()); builder.addBinaryBody(multipartFile.getFileKey(), multipartFile.getStream(), ContentType.MULTIPART_FORM_DATA, multipartFile.getFileName());
} }
log.info("total file size: [" + totalSize + "]"); log.info("total file size: [" + totalSize + "]kb");
ContentType contentType = ContentType.create("text/plain", StandardCharsets.UTF_8); ContentType contentType = ContentType.create("text/plain", StandardCharsets.UTF_8);
for (Map.Entry<String, Object> param : params.entrySet()) { for (Map.Entry<String, Object> param : params.entrySet()) {
StringBody stringBody = new StringBody(String.valueOf(param.getValue()), contentType); StringBody stringBody = new StringBody(String.valueOf(param.getValue()), contentType);
@ -1083,12 +1083,12 @@ public class HttpUtils {
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
Long totalSize = 0L; Long totalSize = 0L;
for (MultipartFile multipartFile : multipartFileList) { for (MultipartFile multipartFile : multipartFileList) {
log.info(Util.logStr("add file, file info: fileName => [{}], fileKey => [{}], fileSize => [{}]kb", log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize())); multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
totalSize += multipartFile.getFileSize(); totalSize += multipartFile.getFileSize();
builder.addBinaryBody(multipartFile.getFileKey(), multipartFile.getStream(), ContentType.MULTIPART_FORM_DATA, multipartFile.getFileName()); builder.addBinaryBody(multipartFile.getFileKey(), multipartFile.getStream(), ContentType.MULTIPART_FORM_DATA, multipartFile.getFileName());
} }
log.info("total file size: [" + totalSize + "]"); log.info("total file size: [" + totalSize + "]kb");
ContentType contentType = ContentType.create("text/plain", StandardCharsets.UTF_8); ContentType contentType = ContentType.create("text/plain", StandardCharsets.UTF_8);
for (Map.Entry<String, Object> param : params.entrySet()) { for (Map.Entry<String, Object> param : params.entrySet()) {
StringBody stringBody = new StringBody(String.valueOf(param.getValue()), contentType); StringBody stringBody = new StringBody(String.valueOf(param.getValue()), contentType);

View File

@ -2,7 +2,6 @@ package youhong.ai.pcn;
import ebu7common.youhong.ai.sftp.SftpConnectUtil; import ebu7common.youhong.ai.sftp.SftpConnectUtil;
import baseTest.BaseTest; import baseTest.BaseTest;
import com.jcraft.jsch.ChannelSftp;
import org.junit.Test; import org.junit.Test;
import weaver.general.GCONST; import weaver.general.GCONST;
import weaver.youhong.ai.pcn.hrorganization.sftp.FetchDataUtil; import weaver.youhong.ai.pcn.hrorganization.sftp.FetchDataUtil;