From 9d391ea369ce4bdd4643e567930b1bb51c23042c Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sun, 10 Jul 2022 14:31:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 20 +++++++++---------- .../yutou/tools/AuthConfig/AuthConfig.java | 2 +- .../AuthConfig/RoleAccessDecisionManager.java | 6 +++--- .../java/com/yutou/tools/BiliBili/Live.java | 7 ++++--- .../tools/Tools/AuthManagerController.java | 8 ++++---- .../yutou/tools/Tools/PasswordManager.java | 9 +++++---- .../tools/bangumi/AnimMetaController.java | 4 ++-- .../tools/bangumi/AnimationController.java | 11 +++++----- .../yutou/tools/bangumi/AnimationData.java | 4 ++-- .../java/com/yutou/tools/nas/NasManager.java | 7 ++++--- .../java/com/yutou/tools/nas/UpdateIp.java | 2 +- .../java/com/yutou/tools/other/tools.java | 4 ++-- .../yutou/tools/sqlite/ADSQLiteManager.java | 4 ++-- .../com/yutou/tools/sqlite/SQLiteManager.java | 4 ++-- .../java/com/yutou/tools/utils/APIFilter.java | 6 +++--- .../yutou/tools/utils/BiliBiliLiveTools.java | 4 ++-- .../com/yutou/tools/utils/ConfigTools.java | 2 +- .../java/com/yutou/tools/utils/HttpTools.java | 2 +- .../yutou/tools/utils/NasDepotManager.java | 9 +++++---- .../com/yutou/tools/utils/RedisTools.java | 2 +- .../java/com/yutou/tools/utils/Tools.java | 4 ++-- .../com/yutou/tools/web/userController.java | 4 ++-- .../yutou/tools/ToolsApplicationTests.java | 2 +- 23 files changed, 66 insertions(+), 61 deletions(-) diff --git a/pom.xml b/pom.xml index e2fd69e..8c32008 100644 --- a/pom.xml +++ b/pom.xml @@ -47,19 +47,19 @@ org.springframework.boot spring-boot-starter-web - RELEASE + 2.7.0 compile redis.clients jedis - 3.6.3 + 4.2.3 org.springframework.data spring-data-redis - 2.2.5.RELEASE + 2.7.0 mysql @@ -69,20 +69,20 @@ org.mybatis.spring.boot mybatis-spring-boot-starter - 2.2.0 + 2.2.2 org.projectlombok lombok - 1.18.22 + 1.18.24 provided - com.alibaba - fastjson - 1.2.79 + com.alibaba.fastjson2 + fastjson2 + 2.0.8 @@ -93,13 +93,13 @@ com.aliyun.oss aliyun-sdk-oss - 3.13.2 + 3.15.0 org.xerial sqlite-jdbc - 3.36.0.2 + 3.36.0.3 diff --git a/src/main/java/com/yutou/tools/AuthConfig/AuthConfig.java b/src/main/java/com/yutou/tools/AuthConfig/AuthConfig.java index fc085cf..d46db6e 100644 --- a/src/main/java/com/yutou/tools/AuthConfig/AuthConfig.java +++ b/src/main/java/com/yutou/tools/AuthConfig/AuthConfig.java @@ -1,6 +1,6 @@ package com.yutou.tools.AuthConfig; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.PermissionDao; import com.yutou.tools.mybatis.dao.UKeyDao; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/yutou/tools/AuthConfig/RoleAccessDecisionManager.java b/src/main/java/com/yutou/tools/AuthConfig/RoleAccessDecisionManager.java index 81df89c..f0d1e35 100644 --- a/src/main/java/com/yutou/tools/AuthConfig/RoleAccessDecisionManager.java +++ b/src/main/java/com/yutou/tools/AuthConfig/RoleAccessDecisionManager.java @@ -1,6 +1,6 @@ package com.yutou.tools.AuthConfig; -import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson2.JSONArray; import com.yutou.tools.mybatis.dao.PermissionDao; import com.yutou.tools.mybatis.dao.UKeyDao; import com.yutou.tools.mybatis.model.Permission; @@ -79,14 +79,14 @@ public class RoleAccessDecisionManager implements AccessDecisionManager { } UKey key = list.get(0); JSONArray powers = JSONArray.parseArray(key.getPower()); - if(powers.toJavaList(String.class).contains("-1")){ + if(powers.toList(String.class).contains("-1")){ return; } PermissionExample pExample = new PermissionExample(); pExample.createCriteria().andUrlEqualTo(url); List permissions = permissionDao.selectByExample(pExample); if (!permissions.isEmpty()) { - if (!powers.toJavaList(String.class).contains(permissions.get(0).getId()+"")) { + if (!powers.toList(String.class).contains(permissions.get(0).getId()+"")) { System.out.println("111111"); error(); }else{ diff --git a/src/main/java/com/yutou/tools/BiliBili/Live.java b/src/main/java/com/yutou/tools/BiliBili/Live.java index 3cd8456..af5c572 100644 --- a/src/main/java/com/yutou/tools/BiliBili/Live.java +++ b/src/main/java/com/yutou/tools/BiliBili/Live.java @@ -1,7 +1,8 @@ package com.yutou.tools.BiliBili; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.BilibiliLiveDao; import com.yutou.tools.mybatis.model.BilibiliLive; import com.yutou.tools.mybatis.model.BilibiliLiveExample; @@ -54,7 +55,7 @@ public class Live { JSONObject json=new JSONObject(); json.put("code",0); json.put("msg","ok"); - json.put("data",JSONArray.toJSON(list)); + json.put("data", JSON.toJSON(list)); return json.toJSONString(); } @ResponseBody diff --git a/src/main/java/com/yutou/tools/Tools/AuthManagerController.java b/src/main/java/com/yutou/tools/Tools/AuthManagerController.java index 7d94e94..eda8576 100644 --- a/src/main/java/com/yutou/tools/Tools/AuthManagerController.java +++ b/src/main/java/com/yutou/tools/Tools/AuthManagerController.java @@ -1,8 +1,8 @@ package com.yutou.tools.Tools; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.PermissionDao; import com.yutou.tools.mybatis.dao.UKeyDao; import com.yutou.tools.mybatis.model.Permission; @@ -66,7 +66,7 @@ public class AuthManagerController { admin.put("disabled", ""); admin.put("checked", ""); allPermission.add(admin); - List list = powers.toJavaList(String.class); + List list = powers.toList(String.class); if (list.contains("-1")) { userPermission.add("-1"); } diff --git a/src/main/java/com/yutou/tools/Tools/PasswordManager.java b/src/main/java/com/yutou/tools/Tools/PasswordManager.java index e7f2526..f2adbe2 100644 --- a/src/main/java/com/yutou/tools/Tools/PasswordManager.java +++ b/src/main/java/com/yutou/tools/Tools/PasswordManager.java @@ -1,7 +1,8 @@ package com.yutou.tools.Tools; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.ToolsPasswordDao; import com.yutou.tools.mybatis.dao.ToolsPasswordTypeDao; import com.yutou.tools.mybatis.model.ToolsPassword; @@ -45,7 +46,7 @@ public class PasswordManager { } json.put("code",0); json.put("msg","ok"); - json.put("data", JSONArray.toJSON(passwords)); + json.put("data", JSON.toJSON(passwords)); return json.toJSONString(); } @ResponseBody @@ -100,7 +101,7 @@ public class PasswordManager { List toolsPasswordTypes=passwordTypeDao.selectByExample(example); json.put("code",0); json.put("msg","ok"); - json.put("data", JSONArray.toJSON(toolsPasswordTypes)); + json.put("data", JSON.toJSON(toolsPasswordTypes)); return json.toJSONString(); } @ResponseBody diff --git a/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java b/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java index 42081fd..b6e7693 100644 --- a/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java +++ b/src/main/java/com/yutou/tools/bangumi/AnimMetaController.java @@ -1,7 +1,7 @@ package com.yutou.tools.bangumi; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.nas.UpdateIp; import com.yutou.tools.utils.HttpTools; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/yutou/tools/bangumi/AnimationController.java b/src/main/java/com/yutou/tools/bangumi/AnimationController.java index e578fa2..1403925 100644 --- a/src/main/java/com/yutou/tools/bangumi/AnimationController.java +++ b/src/main/java/com/yutou/tools/bangumi/AnimationController.java @@ -1,7 +1,8 @@ package com.yutou.tools.bangumi; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.BangumiItemDao; import com.yutou.tools.mybatis.dao.BangumiListDao; import com.yutou.tools.mybatis.model.BangumiItem; @@ -70,7 +71,7 @@ public class AnimationController { JSONObject json = new JSONObject(); json.put("code", 0); json.put("msg", "ok"); - json.put("data", JSONArray.toJSON(listDao.selectByExample(new BangumiListExample()))); + json.put("data", JSON.toJSON(listDao.selectByExample(new BangumiListExample()))); return json.toJSONString(); } @ResponseBody @@ -111,7 +112,7 @@ public class AnimationController { example.createCriteria().andBidEqualTo(type); json.put("code", 0); json.put("msg", "ok"); - json.put("data", JSONArray.toJSON(itemDao.selectByExample(example))); + json.put("data", JSON.toJSON(itemDao.selectByExample(example))); return json.toJSONString(); } @ResponseBody @@ -161,7 +162,7 @@ public class AnimationController { item.setCategories(animationData.nameToValue(item.getCategories(),false)+""); item.setAuthor(animationData.nameToValue(item.getAuthor(),true)+""); } - JSONArray array= (JSONArray) JSONArray.toJSON(list); + JSONArray array= (JSONArray) JSON.toJSON(list); return array.toJSONString(); } } diff --git a/src/main/java/com/yutou/tools/bangumi/AnimationData.java b/src/main/java/com/yutou/tools/bangumi/AnimationData.java index 957621d..d742f29 100644 --- a/src/main/java/com/yutou/tools/bangumi/AnimationData.java +++ b/src/main/java/com/yutou/tools/bangumi/AnimationData.java @@ -1,7 +1,7 @@ package com.yutou.tools.bangumi; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.utils.HttpTools; import java.net.URLEncoder; diff --git a/src/main/java/com/yutou/tools/nas/NasManager.java b/src/main/java/com/yutou/tools/nas/NasManager.java index 093ace4..c81fbe4 100644 --- a/src/main/java/com/yutou/tools/nas/NasManager.java +++ b/src/main/java/com/yutou/tools/nas/NasManager.java @@ -1,7 +1,8 @@ package com.yutou.tools.nas; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.NasAdminAddressDao; import com.yutou.tools.mybatis.model.NasAdminAddress; import com.yutou.tools.mybatis.model.NasAdminAddressExample; @@ -66,7 +67,7 @@ public class NasManager { if (list.size() == 0) { json.put("data", new JSONArray()); } else { - json.put("data", JSONArray.toJSON(list)); + json.put("data", JSON.toJSON(list)); } } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/com/yutou/tools/nas/UpdateIp.java b/src/main/java/com/yutou/tools/nas/UpdateIp.java index d64f80f..c4fa740 100644 --- a/src/main/java/com/yutou/tools/nas/UpdateIp.java +++ b/src/main/java/com/yutou/tools/nas/UpdateIp.java @@ -1,6 +1,6 @@ package com.yutou.tools.nas; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.utils.ConfigTools; import com.yutou.tools.utils.RedisTools; import com.yutou.tools.utils.Tools; diff --git a/src/main/java/com/yutou/tools/other/tools.java b/src/main/java/com/yutou/tools/other/tools.java index f495e23..260a4e3 100644 --- a/src/main/java/com/yutou/tools/other/tools.java +++ b/src/main/java/com/yutou/tools/other/tools.java @@ -1,7 +1,7 @@ package com.yutou.tools.other; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.ToolsApplication; import com.yutou.tools.mybatis.dao.UKeyDao; import com.yutou.tools.mybatis.model.UKey; diff --git a/src/main/java/com/yutou/tools/sqlite/ADSQLiteManager.java b/src/main/java/com/yutou/tools/sqlite/ADSQLiteManager.java index 77687f3..1f8bd4f 100644 --- a/src/main/java/com/yutou/tools/sqlite/ADSQLiteManager.java +++ b/src/main/java/com/yutou/tools/sqlite/ADSQLiteManager.java @@ -1,7 +1,7 @@ package com.yutou.tools.sqlite; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/src/main/java/com/yutou/tools/sqlite/SQLiteManager.java b/src/main/java/com/yutou/tools/sqlite/SQLiteManager.java index 844dafa..2670971 100644 --- a/src/main/java/com/yutou/tools/sqlite/SQLiteManager.java +++ b/src/main/java/com/yutou/tools/sqlite/SQLiteManager.java @@ -1,7 +1,7 @@ package com.yutou.tools.sqlite; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.utils.ConfigTools; import java.io.File; diff --git a/src/main/java/com/yutou/tools/utils/APIFilter.java b/src/main/java/com/yutou/tools/utils/APIFilter.java index 3d3510a..65b8c8b 100644 --- a/src/main/java/com/yutou/tools/utils/APIFilter.java +++ b/src/main/java/com/yutou/tools/utils/APIFilter.java @@ -1,6 +1,6 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson2.JSONArray; import com.yutou.tools.mybatis.dao.PermissionDao; import com.yutou.tools.mybatis.dao.UKeyDao; import com.yutou.tools.mybatis.model.Permission; @@ -62,14 +62,14 @@ public class APIFilter implements Filter { UKey key = list.get(0); JSONArray powers = JSONArray.parseArray(key.getPower()); - if(powers.toJavaList(String.class).contains("-1")){ + if(powers.toList(String.class).contains("-1")){ isToken=true; }else { PermissionExample pExample = new PermissionExample(); pExample.createCriteria().andUrlEqualTo(url); List permissions = permissionDao.selectByExample(pExample); if (permissions != null && permissions.size() > 0) { - if (powers.toJavaList(String.class).contains(permissions.get(0).getId()+"")) { + if (powers.toList(String.class).contains(permissions.get(0).getId()+"")) { isToken = true; } } diff --git a/src/main/java/com/yutou/tools/utils/BiliBiliLiveTools.java b/src/main/java/com/yutou/tools/utils/BiliBiliLiveTools.java index 7a8d2d8..0ae5e13 100644 --- a/src/main/java/com/yutou/tools/utils/BiliBiliLiveTools.java +++ b/src/main/java/com/yutou/tools/utils/BiliBiliLiveTools.java @@ -1,7 +1,7 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; diff --git a/src/main/java/com/yutou/tools/utils/ConfigTools.java b/src/main/java/com/yutou/tools/utils/ConfigTools.java index f5b5d41..607cae8 100644 --- a/src/main/java/com/yutou/tools/utils/ConfigTools.java +++ b/src/main/java/com/yutou/tools/utils/ConfigTools.java @@ -1,6 +1,6 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import java.io.*; diff --git a/src/main/java/com/yutou/tools/utils/HttpTools.java b/src/main/java/com/yutou/tools/utils/HttpTools.java index ad8e603..969abf3 100644 --- a/src/main/java/com/yutou/tools/utils/HttpTools.java +++ b/src/main/java/com/yutou/tools/utils/HttpTools.java @@ -1,6 +1,6 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.interfaces.DownloadInterface; import org.springframework.util.StringUtils; diff --git a/src/main/java/com/yutou/tools/utils/NasDepotManager.java b/src/main/java/com/yutou/tools/utils/NasDepotManager.java index e2525ca..2a4b3b8 100644 --- a/src/main/java/com/yutou/tools/utils/NasDepotManager.java +++ b/src/main/java/com/yutou/tools/utils/NasDepotManager.java @@ -1,7 +1,8 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -26,7 +27,7 @@ public class NasDepotManager { json.put("code",1); json.put("msg","添加成功"); } - json.put("data", JSONArray.toJSON(RedisTools.list_get(DEPOT_NAME))); + json.put("data", JSON.toJSON(RedisTools.list_get(DEPOT_NAME))); return json; } @@ -36,7 +37,7 @@ public class NasDepotManager { JSONObject json=new JSONObject(); json.put("code",1); json.put("msg","ok"); - json.put("data", JSONArray.toJSON(RedisTools.list_get(DEPOT_NAME))); + json.put("data", JSON.toJSON(RedisTools.list_get(DEPOT_NAME))); return json; } @ResponseBody diff --git a/src/main/java/com/yutou/tools/utils/RedisTools.java b/src/main/java/com/yutou/tools/utils/RedisTools.java index 2079331..78b763f 100644 --- a/src/main/java/com/yutou/tools/utils/RedisTools.java +++ b/src/main/java/com/yutou/tools/utils/RedisTools.java @@ -8,7 +8,7 @@ import java.util.HashSet; import java.util.Properties; import java.util.Set; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; diff --git a/src/main/java/com/yutou/tools/utils/Tools.java b/src/main/java/com/yutou/tools/utils/Tools.java index bd435c7..202c10e 100644 --- a/src/main/java/com/yutou/tools/utils/Tools.java +++ b/src/main/java/com/yutou/tools/utils/Tools.java @@ -1,7 +1,7 @@ package com.yutou.tools.utils; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.interfaces.DownloadInterface; import com.yutou.tools.nas.UpdateIp; import org.apache.commons.codec.digest.DigestUtils; diff --git a/src/main/java/com/yutou/tools/web/userController.java b/src/main/java/com/yutou/tools/web/userController.java index 37ee2e1..107cb83 100644 --- a/src/main/java/com/yutou/tools/web/userController.java +++ b/src/main/java/com/yutou/tools/web/userController.java @@ -1,7 +1,7 @@ package com.yutou.tools.web; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.Tools.GoogleAccount; import com.yutou.tools.utils.ConfigTools; import com.yutou.tools.utils.RedisTools; diff --git a/src/test/java/com/yutou/tools/ToolsApplicationTests.java b/src/test/java/com/yutou/tools/ToolsApplicationTests.java index 4010c95..2d942d0 100644 --- a/src/test/java/com/yutou/tools/ToolsApplicationTests.java +++ b/src/test/java/com/yutou/tools/ToolsApplicationTests.java @@ -1,6 +1,6 @@ package com.yutou.tools; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.Tools.AuthManagerController; import com.yutou.tools.utils.Tools; import org.junit.jupiter.api.Test;