Bladeren bron

07 29 02 fix 递归算法

hr 4 jaren geleden
bovenliggende
commit
75fcc18ede

+ 4 - 4
src/main/java/com/imed/costaccount/common/shiro/OAuth2Filter.java

@@ -91,7 +91,7 @@ public class  OAuth2Filter extends AuthenticatingFilter {
         local.clear();
         String token = this.getRequestToken(req);
         if (StrUtil.isBlank(token)) {
-            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "无效的令牌,请登录"));
+            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "请登录"));
             resp.getWriter().print(json);
             return false;
         }
@@ -99,12 +99,12 @@ public class  OAuth2Filter extends AuthenticatingFilter {
         int userId = jwtUtil.getUserId(token);
         String str = (String) redisUtil.get(userId + "");
         if (StrUtil.isBlank(str)) {
-            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "无效的令牌,请登录"));
+            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "登录过期"));
             resp.getWriter().print(json);
             return false;
         }
         if (!str.equalsIgnoreCase(token)) {
-            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "无效的令牌,请登录"));
+            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "令牌无效,请重新登录"));
             resp.getWriter().print(json);
             return false;
         }
@@ -116,7 +116,7 @@ public class  OAuth2Filter extends AuthenticatingFilter {
 //            // 无效的令牌
             resp.setStatus(400);
             resp.getWriter().print("无效的令牌");
-            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "无效的令牌"));
+            String json = JSONUtil.toJsonStr(ErrorResult.errorMsg(499, "令牌过期,请重新登录"));
             resp.getWriter().print(json);
             return false;
         }

+ 1 - 2
src/main/java/com/imed/costaccount/service/impl/AccountingProductServiceImpl.java

@@ -74,6 +74,7 @@ public class AccountingProductServiceImpl extends ServiceImpl<AccountingProductM
      */
     private List<AccountProductVO> getAccountTree(AccountProductVO accountVO, List<AccountProductVO> list) {
         List<AccountProductVO> accountVOS = new ArrayList<>();
+        accountVOS.add(accountVO);
         for (AccountProductVO account : list) {
             // 如果是父子关系
             if (accountVO.getId().equals(account.getParentId())) {
@@ -100,8 +101,6 @@ public class AccountingProductServiceImpl extends ServiceImpl<AccountingProductM
                 accountVO.setChild(child);
                 // 处理子节点
                 this.getAccountTree(account, list);
-
-                accountVOS.add(accountVO);
             }
         }
         return accountVOS;

+ 2 - 4
src/main/java/com/imed/costaccount/service/impl/AccountingServiceImpl.java

@@ -64,6 +64,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
      */
     private List<AccountVO> getAccountTree(AccountVO accountVO, List<AccountVO> list) {
         List<AccountVO> accountVOS = new ArrayList<>();
+        accountVOS.add(accountVO);
         for (AccountVO account : list) {
             // 如果是父子关系
             if (accountVO.getId().equals(account.getParentId())) {
@@ -75,8 +76,6 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
                 accountVO.setChild(child);
                 // 处理子节点
                 this.getAccountTree(account, list);
-
-                accountVOS.add(accountVO);
             }
         }
         return accountVOS;
@@ -169,6 +168,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
 
     private List<SelectAccountingVO> getSelectAccountTree(SelectAccountingVO parent, List<SelectAccountingVO> all) {
         List<SelectAccountingVO> accountVOS = new ArrayList<>();
+        accountVOS.add(parent);
         for (SelectAccountingVO account : all) {
             // 如果是父子关系
             if (parent.getValue().equals(account.getParentId())) {
@@ -180,8 +180,6 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
                 parent.setChildren(child);
                 // 处理子节点
                 this.getSelectAccountTree(account, all);
-
-                accountVOS.add(parent);
             }
         }
         return accountVOS;