Selaa lähdekoodia

代码小整理

Signed-off-by: taest <876239615@qq.com>
taest 3 vuotta sitten
vanhempi
commit
d4c61daf9b

+ 1 - 1
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDictData.java

@@ -131,7 +131,7 @@ public class SysDictData extends BaseEntity
131
 
131
 
132
     public boolean getDefault()
132
     public boolean getDefault()
133
     {
133
     {
134
-        return UserConstants.YES.equals(this.isDefault) ? true : false;
134
+        return UserConstants.YES.equals(this.isDefault);
135
     }
135
     }
136
 
136
 
137
     public String getIsDefault()
137
     public String getIsDefault()

+ 6 - 5
ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java

@@ -59,16 +59,17 @@ public class SysLoginService
59
         // 查询用户信息
59
         // 查询用户信息
60
         R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
60
         R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
61
 
61
 
62
-        if (R.FAIL == userResult.getCode())
63
-        {
64
-            throw new ServiceException(userResult.getMsg());
65
-        }
66
-
67
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
62
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
68
         {
63
         {
69
             recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
64
             recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
70
             throw new ServiceException("登录用户:" + username + " 不存在");
65
             throw new ServiceException("登录用户:" + username + " 不存在");
71
         }
66
         }
67
+
68
+        if (R.FAIL == userResult.getCode())
69
+        {
70
+            throw new ServiceException(userResult.getMsg());
71
+        }
72
+        
72
         LoginUser userInfo = userResult.getData();
73
         LoginUser userInfo = userResult.getData();
73
         SysUser user = userResult.getData().getSysUser();
74
         SysUser user = userResult.getData().getSysUser();
74
         if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
75
         if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))

+ 2 - 10
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptController.java

@@ -55,16 +55,8 @@ public class SysDeptController extends BaseController
55
     public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
55
     public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
56
     {
56
     {
57
         List<SysDept> depts = deptService.selectDeptList(new SysDept());
57
         List<SysDept> depts = deptService.selectDeptList(new SysDept());
58
-        Iterator<SysDept> it = depts.iterator();
59
-        while (it.hasNext())
60
-        {
61
-            SysDept d = (SysDept) it.next();
62
-            if (d.getDeptId().intValue() == deptId
63
-                    || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
64
-            {
65
-                it.remove();
66
-            }
67
-        }
58
+        depts.removeIf(d -> d.getDeptId().intValue() == deptId
59
+                || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
68
         return AjaxResult.success(depts);
60
         return AjaxResult.success(depts);
69
     }
61
     }
70
 
62