From 436f8eb737b6b4051d7fcb9c61874271fd12be9f Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 31 Dec 2019 18:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E9=A1=B6=E7=BA=A7=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/security/service/TokenService.java | 2 -- .../system/service/impl/SysDeptServiceImpl.java | 15 ++++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ruoyi/src/main/java/com/ruoyi/framework/security/service/TokenService.java b/ruoyi/src/main/java/com/ruoyi/framework/security/service/TokenService.java index dc33e8930..3ecbc000d 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/security/service/TokenService.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/security/service/TokenService.java @@ -124,8 +124,6 @@ public class TokenService long currentTime = System.currentTimeMillis(); if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { - String token = loginUser.getToken(); - loginUser.setToken(token); refreshToken(loginUser); } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java index cc51d49b2..338e2a66c 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysDeptServiceImpl.java @@ -49,18 +49,19 @@ public class SysDeptServiceImpl implements ISysDeptService public List buildDeptTree(List depts) { List returnList = new ArrayList(); - if (StringUtils.isNotEmpty(depts) && StringUtils.isNotNull(depts.stream().findFirst())) + List tempList = new ArrayList(); + for (SysDept dept : depts) { - depts.stream().findFirst().get().setParentId(null); + tempList.add(dept.getDeptId()); } for (Iterator iterator = depts.iterator(); iterator.hasNext();) { - SysDept t = (SysDept) iterator.next(); - // 根据传入的某个父节点ID,遍历该父节点的所有子节点 - if (StringUtils.isNull(t.getParentId()) || t.getParentId() == 0) + SysDept dept = (SysDept) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(dept.getParentId())) { - recursionFn(depts, t); - returnList.add(t); + recursionFn(depts, dept); + returnList.add(dept); } } if (returnList.isEmpty())