|
@@ -32,6 +32,8 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.ExecutionException;
|
|
|
|
|
+import java.util.concurrent.ForkJoinPool;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -454,4 +456,39 @@ public class AssetService {
|
|
|
});
|
|
});
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void transferCDN() throws ExecutionException, InterruptedException {
|
|
|
|
|
+ ForkJoinPool customThreadPool = new ForkJoinPool(100);
|
|
|
|
|
+ customThreadPool.submit(() -> {
|
|
|
|
|
+ collectionRepo.selectResource().parallelStream().forEach(list -> {
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ list.set(i, replaceCDN(list.get(i)));
|
|
|
|
|
+ }
|
|
|
|
|
+ collectionRepo.updateCDN(Long.parseLong(list.get(0)),
|
|
|
|
|
+ list.get(1),
|
|
|
|
|
+ list.get(2),
|
|
|
|
|
+ list.get(3),
|
|
|
|
|
+ list.get(4),
|
|
|
|
|
+ list.get(5));
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ assetRepo.selectResource().parallelStream().forEach(list -> {
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
+ list.set(i, replaceCDN(list.get(i)));
|
|
|
|
|
+ }
|
|
|
|
|
+ assetRepo.updateCDN(Long.parseLong(list.get(0)),
|
|
|
|
|
+ list.get(1),
|
|
|
|
|
+ list.get(2),
|
|
|
|
|
+ list.get(3),
|
|
|
|
|
+ list.get(4),
|
|
|
|
|
+ list.get(5));
|
|
|
|
|
+ });
|
|
|
|
|
+ }).get();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String replaceCDN(String url) {
|
|
|
|
|
+ if (url == null) return null;
|
|
|
|
|
+ return url.replaceAll("https://raex-meta\\.oss-cn-shenzhen\\.aliyuncs\\.com",
|
|
|
|
|
+ "https://cdn.raex.vip");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|