From de2ac66f0b6c696213c67235af4a6f3cf51bfc36 Mon Sep 17 00:00:00 2001 From: liguonan Date: Mon, 3 Aug 2020 17:57:33 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java index 2747f6a8..347837bc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java @@ -75,7 +75,7 @@ public class SysUserOnlineServiceImpl implements ISysUserOnlineService @Override public SysUserOnline loginUserToUserOnline(LoginUser user) { - if (StringUtils.isNull(user) && StringUtils.isNull(user.getUser())) + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) { return null; } From d8d636fdbdf79d17c459a00e9381be0bf6b17a86 Mon Sep 17 00:00:00 2001 From: fungleo Date: Tue, 4 Aug 2020 11:39:43 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=EF=BC=88=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E6=95=B0=E7=BB=84=EF=BC=89JS=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/ruoyi.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 23879aaf..08fbd9db 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -78,18 +78,17 @@ export function selectDictLabel(datas, value) { } // 回显数据字典(字符串数组) -export function selectDictLabels(datas, value, separator) { - var actions = []; - var currentSeparator = undefined === separator ? "," : separator; - var temp = value.split(currentSeparator); - Object.keys(value.split(currentSeparator)).some((val) => { - Object.keys(datas).some((key) => { - if (datas[key].dictValue == ('' + temp[val])) { - actions.push(datas[key].dictLabel + currentSeparator); - } - }) - }) - return actions.join('').substring(0, actions.join('').length - 1); +export function selectDictLabels (datas = {}, value = '', separator = ',') { + const actions = [] + const temp = value.split(separator) + temp.forEach((_, index) => { + Object.keys(datas).forEach(key => { + if (datas[key].dictValue === temp[index].toString()) { + actions.push(datas[key].dictLabel) + } + }) + }) + return actions.join(separator) } // 通用下载方法 From 876ecf21c713ce333e676f9b81c57de4ecc983d3 Mon Sep 17 00:00:00 2001 From: fungleo Date: Tue, 4 Aug 2020 14:11:02 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=A0=91=E5=BD=A2=E6=95=B0=E6=8D=AEJS=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/ruoyi.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 08fbd9db..75613539 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -126,23 +126,19 @@ export function praseStrEmpty(str) { * @param {*} children 孩子节点字段 默认 'children' * @param {*} rootId 根Id 默认 0 */ -export function handleTree(data, id, parentId, children, rootId) { - id = id || 'id' - parentId = parentId || 'parentId' - children = children || 'children' - rootId = rootId || 0 +export function handleTree(data = [], id = 'id', parentId = 'parentId', children = 'children', rootId = 0) { //对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(data)) //循环所有项 const treeData = cloneData.filter(father => { - let branchArr = cloneData.filter(child => { + const branchArr = cloneData.filter(child => { //返回每一项的子级数组 return father[id] === child[parentId] }); - branchArr.length > 0 ? father.children = branchArr : ''; + branchArr.length && (father.children = branchArr); //返回第一层 return father[parentId] === rootId; }); - return treeData != '' ? treeData : data; + return treeData !== '' ? treeData : data; } From 503dd64e3fa83f3615e833a9c679e4519053ff1b Mon Sep 17 00:00:00 2001 From: fungleo Date: Tue, 4 Aug 2020 14:32:29 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=20addDateRange=20js=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/ruoyi.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 75613539..00dcb47b 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -54,15 +54,12 @@ export function resetForm(refName) { } // 添加日期范围 -export function addDateRange(params, dateRange) { - var search = params; - search.beginTime = ""; - search.endTime = ""; - if (null != dateRange && '' != dateRange) { - search.beginTime = this.dateRange[0]; - search.endTime = this.dateRange[1]; - } - return search; +export function addDateRange (params = {}, dateRange) { + if (dateRange != null && dateRange !== '') { + params.beginTime = this.dateRange[0] + params.endTime = this.dateRange[1] + } + return params } // 回显数据字典 From b56898858d829a314b9209fb6b05dac01ff5ef6a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 5 Aug 2020 10:04:43 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E8=B6=85=E6=97=B6=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=90=8E=E9=A1=B5=E9=9D=A2=E8=B7=B3=E8=BD=AC=E5=88=B0=E9=A6=96?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/request.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 42639792..04ee5b42 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -32,17 +32,14 @@ service.interceptors.response.use(res => { // 获取错误信息 const msg = errorCode[code] || res.data.msg || errorCode['default'] if (code === 401) { - MessageBox.confirm( - '登录状态已过期,您可以继续留在该页面,或者重新登录', - '系统提示', - { + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' } ).then(() => { store.dispatch('LogOut').then(() => { - location.reload() // 为了重新实例化vue-router对象 避免bug + location.href = '/index'; }) }) } else if (code === 500) { From 26dfee2ce8ac0112d698bffdb66c0e3ca5bf61d1 Mon Sep 17 00:00:00 2001 From: fungleo Date: Wed, 5 Aug 2020 10:24:54 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BD=BB=E5=BA=95=E9=87=8D=E5=86=99?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- ruoyi-ui/src/utils/ruoyi.js | 27 +++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 4916f7a2..a58be013 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,8 @@ nbdist/ # Others *.log *.xml.versionsBackup +*.swp !*/build/*.java !*/build/*.html -!*/build/*.xml \ No newline at end of file +!*/build/*.xml diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 00dcb47b..b669fb31 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -63,29 +63,20 @@ export function addDateRange (params = {}, dateRange) { } // 回显数据字典 -export function selectDictLabel(datas, value) { - var actions = []; - Object.keys(datas).some((key) => { - if (datas[key].dictValue == ('' + value)) { - actions.push(datas[key].dictLabel); - return true; - } - }) - return actions.join(''); +export function selectDictLabel(datas = [], value = '') { + if (!value) return '-'; + const dataArr = datas.filter(item => item.dictValue === value.toString()); + return dataArr.length ? dataArr[0].dictLabel : 'Error Dict'; } // 回显数据字典(字符串数组) -export function selectDictLabels (datas = {}, value = '', separator = ',') { - const actions = [] - const temp = value.split(separator) +export function selectDictLabels(datas = [], value = '', separator = ',') { + const actions = []; + const temp = value.split(separator).filter(item => item); temp.forEach((_, index) => { - Object.keys(datas).forEach(key => { - if (datas[key].dictValue === temp[index].toString()) { - actions.push(datas[key].dictLabel) - } - }) + actions.push(selectDictLabel(datas, temp[index])); }) - return actions.join(separator) + return actions.join(separator); } // 通用下载方法 From a9695d1756d2dce623bf6f0d4a627f44850dce3d Mon Sep 17 00:00:00 2001 From: mazh Date: Wed, 5 Aug 2020 11:28:57 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG:=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?Excel=E5=8A=9F=E8=83=BD,=20=E5=BD=93attr=E7=9A=84cellType?= =?UTF-8?q?=E4=B8=BAString=E6=97=B6,=20cell=E7=9A=84cellType=E7=94=B1Numer?= =?UTF-8?q?ic=E4=BF=AE=E6=AD=A3=E4=B8=BAString=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 494fb4b4..d950b77f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -476,7 +476,7 @@ public class ExcelUtil { if (ColumnType.STRING == attr.cellType()) { - cell.setCellType(CellType.NUMERIC); + cell.setCellType(CellType.STRING); cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix()); } else if (ColumnType.NUMERIC == attr.cellType()) From 3b61ed56b03df91c7f3967eb19d370d7df84b1dd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 5 Aug 2020 12:56:32 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=9A=84=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/spring/SpringUtils.java | 36 +++++++++++- ruoyi-ui/src/utils/ruoyi.js | 55 ++++++++++++------- 2 files changed, 68 insertions(+), 23 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java index e0311595..0d260442 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java @@ -5,7 +5,10 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.StringUtils; /** * spring工具类 方便在非spring管理环境中获取bean @@ -13,17 +16,25 @@ import org.springframework.stereotype.Component; * @author ruoyi */ @Component -public final class SpringUtils implements BeanFactoryPostProcessor +public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware { /** Spring应用上下文环境 */ private static ConfigurableListableBeanFactory beanFactory; + private static ApplicationContext applicationContext; + @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { SpringUtils.beanFactory = beanFactory; } + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + SpringUtils.applicationContext = applicationContext; + } + /** * 获取对象 * @@ -111,4 +122,25 @@ public final class SpringUtils implements BeanFactoryPostProcessor { return (T) AopContext.currentProxy(); } + + /** + * 获取当前的环境配置,无配置返回null + * + * @return 当前的环境配置 + */ + public static String[] getActiveProfiles() + { + return applicationContext.getEnvironment().getActiveProfiles(); + } + + /** + * 获取当前的环境配置,当有多个环境配置时,只获取第一个 + * + * @return 当前的环境配置 + */ + public static String getActiveProfile() + { + final String[] activeProfiles = getActiveProfiles(); + return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null; + } } diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index b669fb31..462dc8f6 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -55,28 +55,38 @@ export function resetForm(refName) { // 添加日期范围 export function addDateRange (params = {}, dateRange) { - if (dateRange != null && dateRange !== '') { - params.beginTime = this.dateRange[0] - params.endTime = this.dateRange[1] - } - return params + if (dateRange != null && dateRange !== '') { + params.beginTime = this.dateRange[0] + params.endTime = this.dateRange[1] + } + return params } // 回显数据字典 -export function selectDictLabel(datas = [], value = '') { - if (!value) return '-'; - const dataArr = datas.filter(item => item.dictValue === value.toString()); - return dataArr.length ? dataArr[0].dictLabel : 'Error Dict'; +export function selectDictLabel(datas, value) { + var actions = []; + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + value)) { + actions.push(datas[key].dictLabel); + return true; + } + }) + return actions.join(''); } // 回显数据字典(字符串数组) -export function selectDictLabels(datas = [], value = '', separator = ',') { - const actions = []; - const temp = value.split(separator).filter(item => item); - temp.forEach((_, index) => { - actions.push(selectDictLabel(datas, temp[index])); - }) - return actions.join(separator); +export function selectDictLabels(datas, value, separator) { + var actions = []; + var currentSeparator = undefined === separator ? "," : separator; + var temp = value.split(currentSeparator); + Object.keys(value.split(currentSeparator)).some((val) => { + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + temp[val])) { + actions.push(datas[key].dictLabel + currentSeparator); + } + }) + }) + return actions.join('').substring(0, actions.join('').length - 1); } // 通用下载方法 @@ -114,19 +124,22 @@ export function praseStrEmpty(str) { * @param {*} children 孩子节点字段 默认 'children' * @param {*} rootId 根Id 默认 0 */ -export function handleTree(data = [], id = 'id', parentId = 'parentId', children = 'children', rootId = 0) { +export function handleTree(data, id, parentId, children, rootId) { + id = id || 'id' + parentId = parentId || 'parentId' + children = children || 'children' + rootId = rootId || 0 //对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(data)) //循环所有项 const treeData = cloneData.filter(father => { - const branchArr = cloneData.filter(child => { + let branchArr = cloneData.filter(child => { //返回每一项的子级数组 return father[id] === child[parentId] }); - branchArr.length && (father.children = branchArr); + branchArr.length > 0 ? father.children = branchArr : ''; //返回第一层 return father[parentId] === rootId; }); - return treeData !== '' ? treeData : data; + return treeData != '' ? treeData : data; } - From 51fa66f61aca23d5c8a119672f75fcd291a6cff2 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 5 Aug 2020 14:28:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=94=AF=E4=B8=80=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=8F=AA=E8=BF=94=E5=9B=9E=E5=8D=95=E6=9D=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/system/SysConfigMapper.xml | 2 +- .../src/main/resources/mapper/system/SysDeptMapper.xml | 2 +- .../src/main/resources/mapper/system/SysDictTypeMapper.xml | 2 +- .../src/main/resources/mapper/system/SysMenuMapper.xml | 2 +- .../src/main/resources/mapper/system/SysPostMapper.xml | 4 ++-- .../src/main/resources/mapper/system/SysRoleMapper.xml | 4 ++-- .../src/main/resources/mapper/system/SysRoleMenuMapper.xml | 2 +- .../src/main/resources/mapper/system/SysUserMapper.xml | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml index 2f0c8be8..9c35661f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml @@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 9da14d8f..36c2aa56 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - where dict_type = #{dictType} + where dict_type = #{dictType} limit 1 diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index 7c97ff5e..83d161e2 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -118,7 +118,7 @@ diff --git a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml index e845b0a5..6ac8e7c3 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml @@ -64,12 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 8958c6ba..c2b30499 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -80,12 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml index 5f6c047a..b81c34db 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -10,7 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index a6aeb628..e16860c2 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"