|
|
|
@ -83,8 +83,9 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!isExists)
|
|
|
|
|
return ResultVOUtils.error(9999,"文件不存在");
|
|
|
|
|
return ResultVOUtils.error(9999,filePath + filePathSlash + imagePath + strs[0]);
|
|
|
|
|
String result = relayFile(files,host);
|
|
|
|
|
logger.error(result);
|
|
|
|
|
if (IDCUtils.isJson(result)) {
|
|
|
|
|
BaseResponse baseResponse = JSON.parseObject(result,BaseResponse.class);
|
|
|
|
|
return baseResponse;
|
|
|
|
@ -111,6 +112,8 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
ArrayList<String> saveFiles = new ArrayList<>();
|
|
|
|
|
Date startTime = new Date();
|
|
|
|
|
if (files != null) {
|
|
|
|
|
if(!FileUtils.makeDirectory(filePath + filePathSlash + imagePath))
|
|
|
|
|
IDCUtils.createDirectory(filePath + filePathSlash + imagePath);
|
|
|
|
|
try {
|
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
|
String imageName = filePath + filePathSlash + imagePath + file.getOriginalFilename();
|
|
|
|
@ -129,7 +132,8 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
|
|
|
|
|
if(isRelay) {
|
|
|
|
|
String result = relayFile(saveFiles,host);
|
|
|
|
|
if (IDCUtils.isJson(result)) {
|
|
|
|
|
logger.info(result);
|
|
|
|
|
if (IDCUtils.isJson(result)&&!result.contains("<html")) {
|
|
|
|
|
BaseResponse baseResponse = JSON.parseObject(result,BaseResponse.class);
|
|
|
|
|
return baseResponse;
|
|
|
|
|
}
|
|
|
|
@ -157,7 +161,9 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
for (int i = 0; i < files.size(); i++) {
|
|
|
|
|
if (!StringUtils.isEmpty(files.get(i))) {
|
|
|
|
|
File file = new File(files.get(i));
|
|
|
|
|
builder.addFormDataPart("files", files.get(i),
|
|
|
|
|
String fileName = files.get(i);
|
|
|
|
|
fileName = fileName.substring(fileName.lastIndexOf("/"));
|
|
|
|
|
builder.addFormDataPart("files", fileName,
|
|
|
|
|
RequestBody.create(MediaType.parse(fileType), file));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|