|
@@ -388,40 +388,7 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- items.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(StorageType.AWS.code().equals(uploadType)){
|
|
|
- par += "&imagesVersion="+ imagesVersion;
|
|
|
- }
|
|
|
-
|
|
|
- var url = this.
|
|
|
- resourceUrl + key;
|
|
|
- StorageType storageType = StorageType.get(uploadType);
|
|
|
- switch (storageType){
|
|
|
- case OSS:
|
|
|
- url += par;
|
|
|
- break;
|
|
|
- case AWS:
|
|
|
- try {
|
|
|
- url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- var fky = key.split("/" + resolution + "/")[0] + "/" + dir + "/" + imageType.getName() + num + "_" + item.getI() + "_" + item.getJ() + ext;
|
|
|
- if(!imgKeys.contains(fky)){
|
|
|
- imgKeys.add(fky);
|
|
|
- long start = Calendar.getInstance().getTimeInMillis();
|
|
|
- try {
|
|
|
- this.zipBytes(out, wwwroot + fky, FileUtils.getBytesFromUrl(url));
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- log.info("切图耗时,url:{},time:{}", url, Calendar.getInstance().getTimeInMillis() - start);
|
|
|
- }
|
|
|
- });
|
|
|
-// for (ImageTypeDetail item : items) {
|
|
|
+// items.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(StorageType.AWS.code().equals(uploadType)){
|
|
|
// par += "&imagesVersion="+ imagesVersion;
|
|
@@ -435,18 +402,51 @@ public class SceneDownloadHandlerServiceImpl {
|
|
|
// url += par;
|
|
|
// break;
|
|
|
// case AWS:
|
|
|
-// url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
+// try {
|
|
|
+// url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
// break;
|
|
|
// }
|
|
|
// var fky = key.split("/" + resolution + "/")[0] + "/" + dir + "/" + imageType.getName() + num + "_" + item.getI() + "_" + item.getJ() + ext;
|
|
|
-// if(imgKeys.contains(fky)){
|
|
|
-// continue;
|
|
|
+// if(!imgKeys.contains(fky)){
|
|
|
+// imgKeys.add(fky);
|
|
|
+// long start = Calendar.getInstance().getTimeInMillis();
|
|
|
+// try {
|
|
|
+// this.zipBytes(out, wwwroot + fky, FileUtils.getBytesFromUrl(url));
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// log.info("切图耗时,url:{},time:{}", url, Calendar.getInstance().getTimeInMillis() - start);
|
|
|
// }
|
|
|
-// imgKeys.add(fky);
|
|
|
-// long start = Calendar.getInstance().getTimeInMillis();
|
|
|
-// this.zipBytes(out, wwwroot + fky, FileUtils.getBytesFromUrl(url));
|
|
|
-// log.info("切图耗时,url:{},time:{}", url, Calendar.getInstance().getTimeInMillis() - start);
|
|
|
-// }
|
|
|
+// });
|
|
|
+ for (ImageTypeDetail item : items) {
|
|
|
+ String par = "?x-oss-process=image/resize,m_lfit,w_" + imageType.getSize() + "/crop,w_512,h_512,x_" + item.getX() + ",y_" + item.getY();
|
|
|
+ if(StorageType.AWS.code().equals(uploadType)){
|
|
|
+ par += "&imagesVersion="+ imagesVersion;
|
|
|
+ }
|
|
|
+
|
|
|
+ var url = this.
|
|
|
+ resourceUrl + key;
|
|
|
+ StorageType storageType = StorageType.get(uploadType);
|
|
|
+ switch (storageType){
|
|
|
+ case OSS:
|
|
|
+ url += par;
|
|
|
+ break;
|
|
|
+ case AWS:
|
|
|
+ url += URLEncoder.encode(par.replace("/", "@"), "UTF-8");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var fky = key.split("/" + resolution + "/")[0] + "/" + dir + "/" + imageType.getName() + num + "_" + item.getI() + "_" + item.getJ() + ext;
|
|
|
+ if(imgKeys.contains(fky)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ imgKeys.add(fky);
|
|
|
+ long start = Calendar.getInstance().getTimeInMillis();
|
|
|
+ this.zipBytes(out, wwwroot + fky, FileUtils.getBytesFromUrl(url));
|
|
|
+ log.info("切图耗时,url:{},time:{}", url, Calendar.getInstance().getTimeInMillis() - start);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|