This commit is contained in:
Your Name詹Sirgit config --global user.name Your 2023-03-25 14:49:08 +08:00
parent ebb5dd50f6
commit 1d10c3c712
32 changed files with 176 additions and 131 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.source</groupId>
<artifactId>source</artifactId>
<version>3.8.1</version>
<version>4.0.0</version>
<name>source</name>
<url>https://sourcebyte.vip</url>
@ -24,7 +24,7 @@
<kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.2.0</mybatis-spring-boot.version>
<pagehelper.boot.version>1.4.0</pagehelper.boot.version>
<fastjson.version>1.2.83</fastjson.version>
<fastjson.version>2.0.25</fastjson.version>
<oshi.version>5.8.6</oshi.version>
<jna.version>5.10.0</jna.version>
<commons.io.version>2.11.0</commons.io.version>
@ -146,8 +146,8 @@
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson.version}</version>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

View File

@ -9,7 +9,8 @@ import cn.source.common.utils.sms.DySmsUtil;
import cn.source.common.utils.uuid.CodeUtil;
import cn.source.common.utils.uuid.IdUtils;
import cn.source.system.service.ISysConfigService;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.google.code.kaptcha.Producer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -55,7 +55,7 @@ public class EchartsController {
// ipFlow进行ip去重
HashSet ipSet = new HashSet<>();
// 判断IP键是否存在
if(StringUtils.isNotNull(redisCache.getCacheObject(ipFlow))){
if(StringUtils.isNotNull(ipFlow) && StringUtils.isNotNull(redisCache.getCacheObject(ipFlow))){
ipSet = ((HashSet) redisCache.getCacheObject(ipFlow));
}
FlowModel indexFlowModel = new FlowModel();

View File

@ -12,7 +12,8 @@ import cn.source.framework.web.service.TokenService;
import cn.source.system.domain.SysNotice;
import cn.source.system.service.ISysNoticeService;
import cn.source.system.service.ISysUserService;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -7,7 +7,8 @@ import cn.source.common.utils.DateUtils;
import cn.source.common.utils.file.FileUploadUtils;
import cn.source.common.utils.http.HttpUtils;
import cn.source.common.utils.uuid.IdUtils;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -111,7 +112,7 @@ public class WxUtil {
String tokenData = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+APPID+"&secret="+SECRET;
// 返回的用户信息json字符串
String resp = HttpUtils.sendGet(tokenData);
JSONObject jsonObject = JSONObject.parseObject(resp);
JSONObject jsonObject = JSON.parseObject(resp);
return String.valueOf(jsonObject.get("access_token"));
}
@ -123,8 +124,8 @@ public class WxUtil {
jsonData.put("code", code);
// 返回的用户信息json字符串此处调用Hutool工具类
String resp = HttpUtil.post(path, jsonData.toJSONString());
JSONObject jsonObject = JSONObject.parseObject(resp);
JSONObject phoneInfo = JSONObject.parseObject(jsonObject.get("phone_info").toString());
JSONObject jsonObject = JSON.parseObject(resp);
JSONObject phoneInfo = JSON.parseObject(jsonObject.get("phone_info").toString());
return String.valueOf(phoneInfo.get("phoneNumber"));
}
@ -132,7 +133,7 @@ public class WxUtil {
public static Map obtainUserDetail(String accessToken, String openId){
String openInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token="+accessToken+"&openid="+openId+"&lang=zh_CN";
String resp = HttpUtils.sendGet(openInfoUrl);
JSONObject userDetail = JSONObject.parseObject(resp);
JSONObject userDetail = JSON.parseObject(resp);
String openid = userDetail.getString("openid");
Integer subscribe = userDetail.getInteger("subscribe");
Integer subscribeTime = userDetail.getInteger("subscribe_time");
@ -221,12 +222,12 @@ public class WxUtil {
String tokenData = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+G_APPID+"&secret="+G_SECRET;
// 返回的用户信息json字符串
String resp = HttpUtils.sendGet(tokenData);
JSONObject jsonObject = JSONObject.parseObject(resp);
JSONObject jsonObject = JSON.parseObject(resp);
System.out.println("token:"+jsonObject.get("access_token"));
HttpUtils.sendGet(tokenData);
String openInfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token="+jsonObject.get("access_token")+"&openid=oM3w46__sVVjRWGUU4FGSwYOypTg&lang=zh_CN";
String resp2 = HttpUtils.sendGet(openInfoUrl);
JSONObject userDetail = JSONObject.parseObject(resp2);
JSONObject userDetail = JSON.parseObject(resp2);
System.out.println(userDetail);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -61,8 +61,8 @@
<!-- 阿里JSON解析器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
</dependency>
<!-- io常用工具类 -->

View File

@ -0,0 +1,44 @@
package cn.source.common.constant;
/**
* 缓存的key 常量
*
* @author ruoyi
*/
public class CacheConstants
{
/**
* 登录用户 redis key
*/
public static final String LOGIN_TOKEN_KEY = "login_tokens:";
/**
* 验证码 redis key
*/
public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
/**
* 参数管理 cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/**
* 防重提交 redis key
*/
public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";
/**
* 限流 redis key
*/
public static final String RATE_LIMIT_KEY = "rate_limit:";
/**
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
}

View File

@ -4,7 +4,7 @@ import java.util.Collection;
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 cn.source.common.core.domain.entity.SysUser;
/**

View File

@ -74,6 +74,28 @@ public class RedisCache
return redisTemplate.expire(key, timeout, unit);
}
/**
* 获取有效时间
*
* @param key Redis键
* @return 有效时间
*/
public long getExpire(final String key)
{
return redisTemplate.getExpire(key);
}
/**
* 判断 key是否存在
*
* @param key
* @return true 存在 false不存在
*/
public Boolean hasKey(String key)
{
return redisTemplate.hasKey(key);
}
/**
* 获得缓存的基本对象
*
@ -102,9 +124,9 @@ public class RedisCache
* @param collection 多个对象
* @return
*/
public long deleteObject(final Collection collection)
public boolean deleteObject(final Collection collection)
{
return redisTemplate.delete(collection);
return redisTemplate.delete(collection) > 0;
}
/**
@ -209,18 +231,6 @@ public class RedisCache
return opsForHash.get(key, hKey);
}
/**
* 删除Hash中的数据
*
* @param key
* @param mapkey
*/
public void delCacheMapValue(final String key, final String hkey)
{
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.delete(key, hkey);
}
/**
* 获取多个Hash中的数据
*
@ -233,6 +243,18 @@ public class RedisCache
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
/**
* 删除Hash中的某条数据
*
* @param key Redis键
* @param hKey Hash键
* @return 是否成功
*/
public boolean deleteCacheMapValue(final String key, final String hKey)
{
return redisTemplate.opsForHash().delete(key, hKey) > 0;
}
/**
* 获得缓存的基本对象列表
*
@ -243,4 +265,4 @@ public class RedisCache
{
return redisTemplate.keys(pattern);
}
}
}

View File

@ -18,7 +18,7 @@ public class InvalidExtensionException extends FileUploadException
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;

View File

@ -2,6 +2,9 @@ package cn.source.common.utils;
import java.util.Collection;
import java.util.List;
import cn.source.common.constant.CacheConstants;
import com.alibaba.fastjson2.JSONArray;
import cn.source.common.constant.Constants;
import cn.source.common.core.domain.entity.SysDictData;
import cn.source.common.core.redis.RedisCache;
@ -9,7 +12,7 @@ import cn.source.common.utils.spring.SpringUtils;
/**
* 字典工具类
*
*
* @author ruoyi
*/
public class DictUtils
@ -21,7 +24,7 @@ public class DictUtils
/**
* 设置字典缓存
*
*
* @param key 参数键
* @param dictDatas 字典数据列表
*/
@ -32,24 +35,23 @@ public class DictUtils
/**
* 获取字典缓存
*
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static List<SysDictData> getDictCache(String key)
{
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(arrayCache))
{
List<SysDictData> dictDatas = StringUtils.cast(cacheObj);
return dictDatas;
return arrayCache.toList(SysDictData.class);
}
return null;
}
/**
* 根据字典类型和字典值获取字典标签
*
*
* @param dictType 字典类型
* @param dictValue 字典值
* @return 字典标签
@ -61,7 +63,7 @@ public class DictUtils
/**
* 根据字典类型和字典标签获取字典值
*
*
* @param dictType 字典类型
* @param dictLabel 字典标签
* @return 字典值
@ -73,7 +75,7 @@ public class DictUtils
/**
* 根据字典类型和字典值获取字典标签
*
*
* @param dictType 字典类型
* @param dictValue 字典值
* @param separator 分隔符
@ -84,27 +86,30 @@ public class DictUtils
StringBuilder propertyString = new StringBuilder();
List<SysDictData> datas = getDictCache(dictType);
if (StringUtils.containsAny(separator, dictValue) && StringUtils.isNotEmpty(datas))
if (StringUtils.isNotNull(datas))
{
for (SysDictData dict : datas)
if (StringUtils.containsAny(separator, dictValue))
{
for (String value : dictValue.split(separator))
for (SysDictData dict : datas)
{
if (value.equals(dict.getDictValue()))
for (String value : dictValue.split(separator))
{
propertyString.append(dict.getDictLabel() + separator);
break;
if (value.equals(dict.getDictValue()))
{
propertyString.append(dict.getDictLabel()).append(separator);
break;
}
}
}
}
}
else
{
for (SysDictData dict : datas)
else
{
if (dictValue.equals(dict.getDictValue()))
for (SysDictData dict : datas)
{
return dict.getDictLabel();
if (dictValue.equals(dict.getDictValue()))
{
return dict.getDictLabel();
}
}
}
}
@ -113,7 +118,7 @@ public class DictUtils
/**
* 根据字典类型和字典标签获取字典值
*
*
* @param dictType 字典类型
* @param dictLabel 字典标签
* @param separator 分隔符
@ -132,7 +137,7 @@ public class DictUtils
{
if (label.equals(dict.getDictLabel()))
{
propertyString.append(dict.getDictValue() + separator);
propertyString.append(dict.getDictValue()).append(separator);
break;
}
}
@ -153,7 +158,7 @@ public class DictUtils
/**
* 删除指定字典缓存
*
*
* @param key 字典键
*/
public static void removeDictCache(String key)
@ -166,18 +171,18 @@ public class DictUtils
*/
public static void clearDictCache()
{
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*");
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
}
/**
* 设置cache key
*
*
* @param configKey 参数键
* @return 缓存键key
*/
public static String getCacheKey(String configKey)
{
return Constants.SYS_DICT_KEY + configKey;
return CacheConstants.SYS_DICT_KEY + configKey;
}
}
}

View File

@ -4,7 +4,8 @@ import cn.source.common.config.RuoYiConfig;
import cn.source.common.constant.Constants;
import cn.source.common.utils.StringUtils;
import cn.source.common.utils.http.HttpUtils;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,7 +42,7 @@ public class AddressUtils
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);
@ -68,7 +69,7 @@ public class AddressUtils
log.error("获取城市位置异常 {}", ip);
return UNKNOWN;
}
JSONObject obj = JSONObject.parseObject(rspStr);
JSONObject obj = JSON.parseObject(rspStr);
String region = obj.getString("pro");
city = obj.getString("city");
}

View File

@ -1,7 +1,7 @@
package cn.source.common.utils.sms;
import cn.source.common.utils.http.HttpUtils;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
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 cn.source.common.annotation.Log;
import cn.source.common.core.domain.model.LoginUser;
import cn.source.common.enums.BusinessStatus;

View File

@ -1,35 +1,24 @@
package cn.source.framework.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter;
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序列化
*
*
* @author ruoyi
*/
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
{
@SuppressWarnings("unused")
private ObjectMapper objectMapper = new ObjectMapper();
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
private Class<T> clazz;
static
{
ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
}
public FastJson2JsonRedisSerializer(Class<T> clazz)
{
super();
@ -43,7 +32,7 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
{
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,17 +44,6 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
}
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)
{
Assert.notNull(objectMapper, "'objectMapper' must not be null");
this.objectMapper = objectMapper;
}
protected JavaType getJavaType(Class<?> clazz)
{
return TypeFactory.defaultInstance().constructType(clazz);
}
}
}

View File

@ -29,22 +29,13 @@ public class RedisConfig extends CachingConfigurerSupport
{
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
serializer.setObjectMapper(mapper);
// 使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(serializer);
// Hash的key也采用StringRedisSerializer的序列化方式
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(serializer);
template.afterPropertiesSet();
return template;
}

View File

@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse;
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 cn.source.common.annotation.RepeatSubmit;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.utils.ServletUtils;
@ -32,7 +32,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
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;
}
}

View File

@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletRequest;
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 cn.source.common.annotation.RepeatSubmit;
import cn.source.common.constant.Constants;
import cn.source.common.core.redis.RedisCache;
@ -50,7 +50,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
// 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);

View File

@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletResponse;
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 cn.source.common.constant.HttpStatus;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.utils.ServletUtils;

View File

@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
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 cn.source.common.constant.Constants;
import cn.source.common.constant.HttpStatus;
import cn.source.common.core.domain.AjaxResult;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory;
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 cn.source.common.constant.Constants;
import cn.source.common.constant.GenConstants;
import cn.source.common.core.text.CharsetKit;
@ -392,7 +392,7 @@ public class GenTableServiceImpl implements IGenTableService
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("树编码字段不能为空");
@ -476,7 +476,7 @@ public class GenTableServiceImpl implements IGenTableService
*/
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);

View File

@ -5,7 +5,8 @@ import java.util.HashSet;
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 cn.source.common.constant.GenConstants;
import cn.source.common.utils.DateUtils;
import cn.source.common.utils.StringUtils;
@ -75,7 +76,7 @@ public class VelocityUtils
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 class VelocityUtils
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);
@ -366,7 +367,7 @@ public class VelocityUtils
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())

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -9,7 +9,7 @@ import cn.source.system.domain.HouseRoom;
import cn.source.system.domain.HouseVillage;
import cn.source.system.service.IHouseRoomService;
import cn.source.system.service.IHouseVillageService;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>source</artifactId>
<groupId>cn.source</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>