pom.xml
@@ -26,7 +26,7 @@ <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <mybatis.spring.boot.starter.version>2.2.2</mybatis.spring.boot.starter.version> <pagehelper.spring.boot.starter.version>1.4.1</pagehelper.spring.boot.starter.version> <fastjson.version>1.2.83</fastjson.version> <fastjson.version>2.0.4</fastjson.version> <druid.version>1.2.8</druid.version> <commons.io.version>2.11.0</commons.io.version> <commons.fileupload.version>1.4</commons.fileupload.version> @@ -155,8 +155,8 @@ <!-- 阿里JSON解析器 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> <version>${fastjson.version}</version> </dependency> src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
@@ -18,7 +18,7 @@ public InvalidExtensionException(String[] allowedExtension, String extension, String filename) { super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传 [" + Arrays.toString(allowedExtension) + "]格式文件"); super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式"); this.allowedExtension = allowedExtension; this.extension = extension; this.filename = filename; src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java
@@ -2,7 +2,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.HttpUtils; @@ -40,7 +41,7 @@ log.error("获取地理位置异常 {}", ip); return UNKNOWN; } JSONObject obj = JSONObject.parseObject(rspStr); JSONObject obj = JSON.parseObject(rspStr); String region = obj.getString("pro"); String city = obj.getString("city"); return String.format("%s %s", region, city); src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
@@ -14,7 +14,7 @@ import org.springframework.validation.BindingResult; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.HandlerMapping; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.enums.HttpMethod; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServletUtils; src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java
@@ -1,15 +1,15 @@ package com.ruoyi.framework.config; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import java.nio.charset.Charset; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.SerializationException; import org.springframework.util.Assert; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONReader; import com.alibaba.fastjson2.JSONWriter; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.SerializationException; import com.alibaba.fastjson.parser.ParserConfig; import org.springframework.util.Assert; import java.nio.charset.Charset; /** * Redis使用FastJson序列化 @@ -25,11 +25,6 @@ private Class<T> clazz; static { ParserConfig.getGlobalInstance().setAutoTypeSupport(true); } public FastJson2JsonRedisSerializer(Class<T> clazz) { super(); @@ -43,7 +38,7 @@ { return new byte[0]; } return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET); } @Override @@ -55,7 +50,7 @@ } String str = new String(bytes, DEFAULT_CHARSET); return JSON.parseObject(str, clazz); return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); } public void setObjectMapper(ObjectMapper objectMapper) src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java
@@ -6,7 +6,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.framework.interceptor.annotation.RepeatSubmit; import com.ruoyi.framework.web.domain.AjaxResult; @@ -32,7 +32,7 @@ if (this.isRepeatSubmit(request, annotation)) { AjaxResult ajaxResult = AjaxResult.error(annotation.message()); ServletUtils.renderString(response, JSONObject.toJSONString(ajaxResult)); ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); return false; } } src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
@@ -7,7 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.filter.RepeatedlyRequestWrapper; import com.ruoyi.common.utils.StringUtils; @@ -50,7 +50,7 @@ // body参数为空,获取Parameter的数据 if (StringUtils.isEmpty(nowParams)) { nowParams = JSONObject.toJSONString(request.getParameterMap()); nowParams = JSON.toJSONString(request.getParameterMap()); } Map<String, Object> nowDataMap = new HashMap<String, Object>(); nowDataMap.put(REPEAT_PARAMS, nowParams); src/main/java/com/ruoyi/framework/security/LoginUser.java
@@ -4,7 +4,7 @@ import java.util.Set; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson2.annotation.JSONField; import com.ruoyi.project.system.domain.SysUser; /** src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java
@@ -7,7 +7,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java
@@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.utils.ServletUtils; src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java
@@ -21,8 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.GenConstants; import com.ruoyi.common.core.text.CharsetKit; @@ -401,7 +401,7 @@ if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { String options = JSON.toJSONString(genTable.getParams()); JSONObject paramsObj = JSONObject.parseObject(options); JSONObject paramsObj = JSON.parseObject(options); if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { throw new ServiceException("树编码字段不能为空"); @@ -485,7 +485,7 @@ */ public void setTableFromOptions(GenTable genTable) { JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); JSONObject paramsObj = JSON.parseObject(genTable.getOptions()); if (StringUtils.isNotNull(paramsObj)) { String treeCode = paramsObj.getString(GenConstants.TREE_CODE); src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java
@@ -5,7 +5,8 @@ import java.util.List; import java.util.Set; import org.apache.velocity.VelocityContext; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.GenConstants; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; @@ -75,7 +76,7 @@ public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); JSONObject paramsObj = JSONObject.parseObject(options); JSONObject paramsObj = JSON.parseObject(options); String parentMenuId = getParentMenuId(paramsObj); context.put("parentMenuId", parentMenuId); } @@ -83,7 +84,7 @@ public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); JSONObject paramsObj = JSONObject.parseObject(options); JSONObject paramsObj = JSON.parseObject(options); String treeCode = getTreecode(paramsObj); String treeParentCode = getTreeParentCode(paramsObj); String treeName = getTreeName(paramsObj); @@ -381,7 +382,7 @@ public static int getExpandColumn(GenTable genTable) { String options = genTable.getOptions(); JSONObject paramsObj = JSONObject.parseObject(options); JSONObject paramsObj = JSON.parseObject(options); String treeName = paramsObj.getString(GenConstants.TREE_NAME); int num = 0; for (GenTableColumn column : genTable.getColumns())