pom.xml
@@ -33,7 +33,7 @@ <commons.io.version>2.11.0</commons.io.version> <commons.fileupload.version>1.4</commons.fileupload.version> <velocity.version>2.3</velocity.version> <fastjson.version>1.2.83</fastjson.version> <fastjson.version>2.0.4</fastjson.version> <jjwt.version>0.9.1</jjwt.version> <minio.version>8.2.2</minio.version> <poi.version>4.1.2</poi.version> @@ -163,8 +163,8 @@ <!-- JSON 解析器和生成器 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> <version>${fastjson.version}</version> </dependency> ruoyi-common/ruoyi-common-core/pom.xml
@@ -67,8 +67,8 @@ <!-- Alibaba Fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> </dependency> <!-- Jwt --> ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ServletUtils.java
@@ -18,7 +18,7 @@ import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.text.Convert; @@ -296,7 +296,7 @@ response.setStatusCode(status); response.getHeaders().add(HttpHeaders.CONTENT_TYPE, contentType); R<?> result = R.fail(code, value.toString()); DataBuffer dataBuffer = response.bufferFactory().wrap(JSONObject.toJSONString(result).getBytes()); DataBuffer dataBuffer = response.bufferFactory().wrap(JSON.toJSONString(result).getBytes()); return response.writeWith(Mono.just(dataBuffer)); } } ruoyi-common/ruoyi-common-log/src/main/java/com/ruoyi/common/log/aspect/LogAspect.java
@@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import org.springframework.web.multipart.MultipartFile; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.ip.IpUtils; ruoyi-common/ruoyi-common-redis/src/main/java/com/ruoyi/common/redis/configure/FastJson2JsonRedisSerializer.java
@@ -1,15 +1,15 @@ package com.ruoyi.common.redis.configure; 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,10 +25,6 @@ private Class<T> clazz; static { ParserConfig.getGlobalInstance().setAutoTypeSupport(true); } public FastJson2JsonRedisSerializer(Class<T> clazz) { @@ -43,7 +39,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 +51,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) ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java
@@ -10,7 +10,8 @@ import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.gateway.config.properties.CaptchaProperties; @@ -52,7 +53,7 @@ try { String rspStr = resolveBodyFromRequest(request); JSONObject obj = JSONObject.parseObject(rspStr); JSONObject obj = JSON.parseObject(rspStr); validateCodeService.checkCaptcha(obj.getString(CODE), obj.getString(UUID)); } catch (Exception e) ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/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.core.constant.Constants; import com.ruoyi.common.core.constant.GenConstants; import com.ruoyi.common.core.exception.ServiceException; @@ -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); ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/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.core.constant.GenConstants; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.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())