...
 
Commits (13)
    https://gitcode.net/front-end/ruoyi-vue/-/commit/68ac40eda9cd7567b76a023c718011485d5be13c update maven-plugin 2023-08-14T17:41:52+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/128b186b8e858b36f9fcbb99e5092ba315b5f794 优化定时任务状态页面显示 2023-08-14T17:42:24+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/7c9423657ede25daaf1939d8ea9f0dd81bd5e9a2 Excel自定义数据处理器增加单元格/工作簿对象 2023-08-14T17:42:44+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/ab99a72b65184035f48ccd0bb4f5465a0cd6b1ae 优化代码 2023-08-14T19:11:13+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/8f67bf416bb94b1cb745550c074357b6fef1a487 升级oshi到最新版本6.4.4 2023-08-14T19:11:46+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/c5e4459bb8772d5e1b4a9dd508fc87a060216cbe 优化代码 2023-08-15T11:30:49+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/4ac7a1aa1fe3abc3d59b8ce1d417f2bc8ad215d4 升级commons.io到最新版本2.13.0 2023-08-15T11:31:38+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/45ef54268739d2162046a7a53279518bd11bd5b7 升级fastjson到最新版2.0.39 2023-08-15T12:17:27+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/5b61aea064663172c1b8564abd797ead3497ab78 修复树模板父级编码变量错误(I7JZ0L) 2023-08-19T14:34:30+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/6a742e1d1bb1fc8c7809ab993367c85daf7a54b4 Excel导入数据临时文件无法删除问题(I7KIXX) 2023-08-19T15:43:57+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/d58942c506f5bf3962894e175d9df73b49ed9297 防重复提交数据大小限制(I7KZDA) 2023-08-21T11:57:14+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/90260ce2f9913f8be2fab6365f9b9cbd6a06e476 修复Excels导入时无法获取到dictType字典值问题(I7M4PW) 2023-08-21T15:52:30+08:00 RuoYi yzz_ivy@163.com https://gitcode.net/front-end/ruoyi-vue/-/commit/491b0f3db8a7bba3ff043f3561fc5c24344d8fdd 修复字典缓存删除方法参数错误问题(I7UDIR) 2023-08-23T14:54:20+08:00 RuoYi yzz_ivy@163.com
...@@ -23,15 +23,15 @@ ...@@ -23,15 +23,15 @@
<swagger.version>3.0.0</swagger.version> <swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.3</kaptcha.version> <kaptcha.version>2.3.3</kaptcha.version>
<pagehelper.boot.version>1.4.6</pagehelper.boot.version> <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
<fastjson.version>2.0.34</fastjson.version> <fastjson.version>2.0.39</fastjson.version>
<oshi.version>6.4.3</oshi.version> <oshi.version>6.4.4</oshi.version>
<commons.io.version>2.11.0</commons.io.version> <commons.io.version>2.13.0</commons.io.version>
<commons.collections.version>3.2.2</commons.collections.version> <commons.collections.version>3.2.2</commons.collections.version>
<poi.version>4.1.2</poi.version> <poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version> <velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version> <jwt.version>0.9.1</jwt.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version> <version>2.5.15</version>
<configuration> <configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration> </configuration>
......
...@@ -60,27 +60,22 @@ public class SysProfileController extends BaseController ...@@ -60,27 +60,22 @@ public class SysProfileController extends BaseController
public AjaxResult updateProfile(@RequestBody SysUser user) public AjaxResult updateProfile(@RequestBody SysUser user)
{ {
LoginUser loginUser = getLoginUser(); LoginUser loginUser = getLoginUser();
SysUser sysUser = loginUser.getUser(); SysUser currentUser = loginUser.getUser();
user.setUserName(sysUser.getUserName()); currentUser.setNickName(user.getNickName());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{ {
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} }
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{ {
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
} }
user.setUserId(sysUser.getUserId()); if (userService.updateUserProfile(currentUser) > 0)
user.setPassword(null);
user.setAvatar(null);
user.setDeptId(null);
if (userService.updateUserProfile(user) > 0)
{ {
// 更新缓存用户信息 // 更新缓存用户信息
sysUser.setNickName(user.getNickName());
sysUser.setPhonenumber(user.getPhonenumber());
sysUser.setEmail(user.getEmail());
sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
return success(); return success();
} }
......
...@@ -129,6 +129,11 @@ public class Constants ...@@ -129,6 +129,11 @@ public class Constants
*/ */
public static final String LOOKUP_LDAPS = "ldaps:"; public static final String LOOKUP_LDAPS = "ldaps:";
/**
* 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
*/
public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
/** /**
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
*/ */
......
package com.ruoyi.common.utils.poi; package com.ruoyi.common.utils.poi;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook;
/** /**
* Excel数据格式处理适配器 * Excel数据格式处理适配器
* *
...@@ -12,8 +15,10 @@ public interface ExcelHandlerAdapter ...@@ -12,8 +15,10 @@ public interface ExcelHandlerAdapter
* *
* @param value 单元格数据值 * @param value 单元格数据值
* @param args excel注解args参数组 * @param args excel注解args参数组
* @param cell 单元格对象
* @param wb 工作簿对象
* *
* @return 处理后的值 * @return 处理后的值
*/ */
Object format(Object value, String[] args); Object format(Object value, String[] args, Cell cell, Workbook wb);
} }
...@@ -288,9 +288,23 @@ public class ExcelUtil<T> ...@@ -288,9 +288,23 @@ public class ExcelUtil<T>
* @param is 输入流 * @param is 输入流
* @return 转换后集合 * @return 转换后集合
*/ */
public List<T> importExcel(InputStream is) throws Exception public List<T> importExcel(InputStream is)
{ {
return importExcel(is, 0); List<T> list = null;
try
{
list = importExcel(is, 0);
}
catch (Exception e)
{
log.error("导入Excel异常{}", e.getMessage());
throw new UtilException(e.getMessage());
}
finally
{
IOUtils.closeQuietly(is);
}
return list;
} }
/** /**
...@@ -336,7 +350,6 @@ public class ExcelUtil<T> ...@@ -336,7 +350,6 @@ public class ExcelUtil<T>
} }
// 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1 // 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1
int rows = sheet.getLastRowNum(); int rows = sheet.getLastRowNum();
if (rows > 0) if (rows > 0)
{ {
// 定义一个map用于存放excel列的序号和field. // 定义一个map用于存放excel列的序号和field.
...@@ -451,7 +464,7 @@ public class ExcelUtil<T> ...@@ -451,7 +464,7 @@ public class ExcelUtil<T>
{ {
propertyName = field.getName() + "." + attr.targetAttr(); propertyName = field.getName() + "." + attr.targetAttr();
} }
else if (StringUtils.isNotEmpty(attr.readConverterExp())) if (StringUtils.isNotEmpty(attr.readConverterExp()))
{ {
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
} }
...@@ -461,7 +474,7 @@ public class ExcelUtil<T> ...@@ -461,7 +474,7 @@ public class ExcelUtil<T>
} }
else if (!attr.handler().equals(ExcelHandlerAdapter.class)) else if (!attr.handler().equals(ExcelHandlerAdapter.class))
{ {
val = dataFormatHandlerAdapter(val, attr); val = dataFormatHandlerAdapter(val, attr, null);
} }
else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures)) else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures))
{ {
...@@ -1052,7 +1065,7 @@ public class ExcelUtil<T> ...@@ -1052,7 +1065,7 @@ public class ExcelUtil<T>
} }
else if (!attr.handler().equals(ExcelHandlerAdapter.class)) else if (!attr.handler().equals(ExcelHandlerAdapter.class))
{ {
cell.setCellValue(dataFormatHandlerAdapter(value, attr)); cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell));
} }
else else
{ {
...@@ -1265,13 +1278,13 @@ public class ExcelUtil<T> ...@@ -1265,13 +1278,13 @@ public class ExcelUtil<T>
* @param excel 数据注解 * @param excel 数据注解
* @return * @return
*/ */
public String dataFormatHandlerAdapter(Object value, Excel excel) public String dataFormatHandlerAdapter(Object value, Excel excel, Cell cell)
{ {
try try
{ {
Object instance = excel.handler().newInstance(); Object instance = excel.handler().newInstance();
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class }); Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class });
value = formatMethod.invoke(instance, value, excel.args()); value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb);
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -6,6 +6,8 @@ import org.springframework.data.redis.serializer.SerializationException; ...@@ -6,6 +6,8 @@ import org.springframework.data.redis.serializer.SerializationException;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader; import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter; import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.filter.Filter;
import com.ruoyi.common.constant.Constants;
/** /**
* Redis使用FastJson序列化 * Redis使用FastJson序列化
...@@ -16,6 +18,8 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> ...@@ -16,6 +18,8 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
{ {
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR);
private Class<T> clazz; private Class<T> clazz;
public FastJson2JsonRedisSerializer(Class<T> clazz) public FastJson2JsonRedisSerializer(Class<T> clazz)
...@@ -43,6 +47,6 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> ...@@ -43,6 +47,6 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
} }
String str = new String(bytes, DEFAULT_CHARSET); String str = new String(bytes, DEFAULT_CHARSET);
return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); return JSON.parseObject(str, clazz, AUTO_TYPE_FILTER);
} }
} }
...@@ -47,8 +47,9 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor ...@@ -47,8 +47,9 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
/** /**
* 验证是否重复提交由子类实现具体的防重复提交的规则 * 验证是否重复提交由子类实现具体的防重复提交的规则
* *
* @param request * @param request 请求信息
* @return * @param annotation 防重复注解参数
* @return 结果
* @throws Exception * @throws Exception
*/ */
public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation); public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation);
......
...@@ -4,6 +4,8 @@ import java.util.HashMap; ...@@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -29,6 +31,8 @@ import io.jsonwebtoken.SignatureAlgorithm; ...@@ -29,6 +31,8 @@ import io.jsonwebtoken.SignatureAlgorithm;
@Component @Component
public class TokenService public class TokenService
{ {
private static final Logger log = LoggerFactory.getLogger(TokenService.class);
// 令牌自定义标识 // 令牌自定义标识
@Value("${token.header}") @Value("${token.header}")
private String header; private String header;
...@@ -72,6 +76,7 @@ public class TokenService ...@@ -72,6 +76,7 @@ public class TokenService
} }
catch (Exception e) catch (Exception e)
{ {
log.error("获取用户信息异常'{}'", e.getMessage());
} }
} }
return null; return null;
......
...@@ -453,7 +453,7 @@ export default { ...@@ -453,7 +453,7 @@ export default {
this.reset(); this.reset();
this.getTreeselect(); this.getTreeselect();
if (row != null) { if (row != null) {
this.form.${treeParentCode} = row.${treeCode}; this.form.${treeParentCode} = row.${treeParentCode};
} }
get${BusinessName}(row.${pkColumn.javaField}).then(response => { get${BusinessName}(row.${pkColumn.javaField}).then(response => {
this.form = response.data; this.form = response.data;
......
...@@ -420,7 +420,7 @@ async function handleUpdate(row) { ...@@ -420,7 +420,7 @@ async function handleUpdate(row) {
reset(); reset();
await getTreeselect(); await getTreeselect();
if (row != null) { if (row != null) {
form.value.${treeParentCode} = row.${treeCode}; form.value.${treeParentCode} = row.${treeParentCode};
} }
get${BusinessName}(row.${pkColumn.javaField}).then(response => { get${BusinessName}(row.${pkColumn.javaField}).then(response => {
form.value = response.data; form.value = response.data;
......
...@@ -14,7 +14,7 @@ const mutations = { ...@@ -14,7 +14,7 @@ const mutations = {
try { try {
for (let i = 0; i < state.dict.length; i++) { for (let i = 0; i < state.dict.length; i++) {
if (state.dict[i].key == key) { if (state.dict[i].key == key) {
state.dict.splice(i, i) state.dict.splice(i, 1)
return true return true
} }
} }
......
...@@ -42,6 +42,12 @@ service.interceptors.request.use(config => { ...@@ -42,6 +42,12 @@ service.interceptors.request.use(config => {
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
time: new Date().getTime() time: new Date().getTime()
} }
const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小
const limitSize = 5 * 1024 * 1024; // 限制存放数据5M
if (requestSize >= limitSize) {
console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制,无法进行防重复提交验证。')
return config;
}
const sessionObj = cache.session.getJSON('sessionObj') const sessionObj = cache.session.getJSON('sessionObj')
if (sessionObj === undefined || sessionObj === null || sessionObj === '') { if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
cache.session.setJSON('sessionObj', requestObj) cache.session.setJSON('sessionObj', requestObj)
......
...@@ -200,7 +200,18 @@ ...@@ -200,7 +200,18 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24" v-if="form.jobId !== undefined">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_job_status"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="执行策略" prop="misfirePolicy"> <el-form-item label="执行策略" prop="misfirePolicy">
<el-radio-group v-model="form.misfirePolicy" size="small"> <el-radio-group v-model="form.misfirePolicy" size="small">
<el-radio-button label="1">立即执行</el-radio-button> <el-radio-button label="1">立即执行</el-radio-button>
...@@ -217,17 +228,6 @@ ...@@ -217,17 +228,6 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_job_status"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务状态:"> <el-form-item label="任务状态:">
<div v-if="form.status == 0">正常</div> <div v-if="form.status == 0">正常</div>
<div v-else-if="form.status == 1">失败</div> <div v-else-if="form.status == 1">暂停</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
......