diff --git a/src/main/java/com/zh/project0512/controller/UtilsController.java b/src/main/java/com/zh/project0512/controller/UtilsController.java index e98e60b..0ae30eb 100644 --- a/src/main/java/com/zh/project0512/controller/UtilsController.java +++ b/src/main/java/com/zh/project0512/controller/UtilsController.java @@ -8,6 +8,7 @@ import com.zh.project0512.mapper.RankMapper; import com.zh.project0512.service.ITaskService; import com.zh.project0512.service.IVideoService; import com.zh.project0512.utils.FileTypeUtil; +import com.zh.project0512.utils.RegexUtil; import com.zh.project0512.utils.result.HttpStatusEnum; import com.zh.project0512.utils.result.Result; import io.swagger.v3.oas.annotations.Operation; @@ -15,6 +16,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import net.coobird.thumbnailator.Thumbnails; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -97,7 +99,7 @@ public class UtilsController { // if (!dest.getParentFile().exists()) { // dest.getParentFile().mkdirs(); // } -// file.transferTo(dest); + file.transferTo(dest); res.put("fileUrl", "/upload/" + newFileName); res.put("fileName", fileName); @@ -197,9 +199,9 @@ public class UtilsController { } public static void main(String[] args) { -// String url = "9.20 tRK:/ 男人第一天上班就被当成修电脑的,谁知他竟然是总经理%好剧推荐 %全集解说%幸福一家人%关于爱情%宅家dou剧 %持续关注持续精彩 https://v.kuaishou.com/Yh4DwM9/ 复制此链接,打开Dou音搜索,直接观看视频!"; -// Pattern p = Pattern.compile("((https://)+\\S*\\s)", Pattern.CASE_INSENSITIVE); -// + String url = "4.38 wfb:/ 复制打开抖音,看看【酸味真火的作品】坚持总会有收获的# 意想不到的情侣健身 https://v.douyin.com/YT982Sf/"; + Pattern p = Pattern.compile("((https://)+\\S*(/)\\S*(/))", Pattern.CASE_INSENSITIVE); + System.out.println(new RegexUtil().httpReg(url)); // Matcher m = p.matcher(url); // System.out.println(m); // String a = m.find() ? m.group(1) : url; @@ -208,45 +210,42 @@ public class UtilsController { // System.out.println(b); - List list1 = new ArrayList(); - list1.add("1"); - list1.add("2"); - list1.add("3"); - list1.add("5"); - list1.add("6"); - List list2 = new ArrayList(); - list2.add("2"); - list2.add("3"); - list2.add("7"); - list2.add("8"); -// 交集 - List intersection = list1.stream().filter(item -> list2.contains(item)).collect(Collectors.toList()); - System.out.println("---交集 intersection---"); - intersection.parallelStream().forEach(System.out::println); -// 差集 (list1 - list2) - List reduce1 = list1.stream().filter(item -> !list2.contains(item)).collect(Collectors.toList()); - System.out.println("---差集 reduce1 (list1 - list2)---"); - reduce1.parallelStream().forEach(System.out::println); -// 差集 (list2 - list1) - List reduce2 = list2.stream().filter(item -> !list1.contains(item)).collect(Collectors.toList()); - System.out.println("---差集 reduce2 (list2 - list1)---"); - reduce2.parallelStream().forEach(System.out::println); -// 并集 - List listAll = list1.parallelStream().collect(Collectors.toList()); - List listAll2 = list2.parallelStream().collect(Collectors.toList()); - listAll.addAll(listAll2); - System.out.println("---并集 listAll---"); - listAll.parallelStream().forEachOrdered(System.out::println); -// 去重并集 - List listAllDistinct = listAll.stream().distinct().collect(Collectors.toList()); - System.out.println("---得到去重并集 listAllDistinct---"); - listAllDistinct.parallelStream().forEachOrdered(System.out::println); - System.out.println("---原来的List1---"); - list1.parallelStream().forEachOrdered(System.out::println); - System.out.println("---原来的List2---"); - list2.parallelStream().forEachOrdered(System.out::println); - } - - private class LogUtil { +// List list1 = new ArrayList(); +// list1.add("1"); +// list1.add("2"); +// list1.add("3"); +// list1.add("5"); +// list1.add("6"); +// List list2 = new ArrayList(); +// list2.add("2"); +// list2.add("3"); +// list2.add("7"); +// list2.add("8"); +//// 交集 +// List intersection = list1.stream().filter(item -> list2.contains(item)).collect(Collectors.toList()); +// System.out.println("---交集 intersection---"); +// intersection.parallelStream().forEach(System.out::println); +//// 差集 (list1 - list2) +// List reduce1 = list1.stream().filter(item -> !list2.contains(item)).collect(Collectors.toList()); +// System.out.println("---差集 reduce1 (list1 - list2)---"); +// reduce1.parallelStream().forEach(System.out::println); +//// 差集 (list2 - list1) +// List reduce2 = list2.stream().filter(item -> !list1.contains(item)).collect(Collectors.toList()); +// System.out.println("---差集 reduce2 (list2 - list1)---"); +// reduce2.parallelStream().forEach(System.out::println); +//// 并集 +// List listAll = list1.parallelStream().collect(Collectors.toList()); +// List listAll2 = list2.parallelStream().collect(Collectors.toList()); +// listAll.addAll(listAll2); +// System.out.println("---并集 listAll---"); +// listAll.parallelStream().forEachOrdered(System.out::println); +//// 去重并集 +// List listAllDistinct = listAll.stream().distinct().collect(Collectors.toList()); +// System.out.println("---得到去重并集 listAllDistinct---"); +// listAllDistinct.parallelStream().forEachOrdered(System.out::println); +// System.out.println("---原来的List1---"); +// list1.parallelStream().forEachOrdered(System.out::println); +// System.out.println("---原来的List2---"); +// list2.parallelStream().forEachOrdered(System.out::println); } }