|
@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
@@ -381,12 +382,13 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
- for (ImageTypeDetail item : items) {
|
|
|
+ List<ImageTypeDetail> imageTypeDetails = Collections.synchronizedList(items);
|
|
|
+ synchronized(imageTypeDetails){
|
|
|
+ imageTypeDetails.parallelStream().forEach(item->{
|
|
|
String par = "?x-oss-process=image/resize,m_lfit,w_" + imageType.getSize() + "/crop,w_512,h_512,x_" + item.getX() + ",y_" + item.getY();
|
|
|
// if(FYunTypeEnum.AWS.code().equals(uploadType)){
|
|
|
// par += "&imagesVersion="+ imagesVersion;
|
|
|
// }
|
|
|
-
|
|
|
var url = this.resourceUrl + key;
|
|
|
FYunTypeEnum storageType = FYunTypeEnum.get(uploadType);
|
|
|
switch (storageType){
|
|
@@ -394,15 +396,20 @@ public class DownloadServiceImpl implements IDownloadService {
|
|
|
url += par;
|
|
|
break;
|
|
|
case AWS:
|
|
|
- url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
+ try {
|
|
|
+ url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
//key.split("/" + resolution + "/")[0] + "/" +
|
|
|
var fky = dir + "/" + imageType.getName() + num + "_" + item.getI() + "_" + item.getJ() + ext;
|
|
|
+
|
|
|
this.downloadFile(url, path + fky);
|
|
|
// this.downloadFile(url, path);
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|