作者 RuoYi

优化代码

正在显示 30 个修改的文件 包含 66 行增加83 行删除
@@ -49,24 +49,15 @@ public class SysUserOnlineController extends BaseController @@ -49,24 +49,15 @@ public class SysUserOnlineController extends BaseController
49 LoginUser user = redisCache.getCacheObject(key); 49 LoginUser user = redisCache.getCacheObject(key);
50 if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) 50 if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
51 { 51 {
52 - if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))  
53 - {  
54 - userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));  
55 - } 52 + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
56 } 53 }
57 else if (StringUtils.isNotEmpty(ipaddr)) 54 else if (StringUtils.isNotEmpty(ipaddr))
58 { 55 {
59 - if (StringUtils.equals(ipaddr, user.getIpaddr()))  
60 - {  
61 - userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));  
62 - } 56 + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
63 } 57 }
64 else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) 58 else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
65 { 59 {
66 - if (StringUtils.equals(userName, user.getUsername()))  
67 - {  
68 - userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));  
69 - } 60 + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
70 } 61 }
71 else 62 else
72 { 63 {
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
14 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
16 import com.ruoyi.common.annotation.Log; 16 import com.ruoyi.common.annotation.Log;
17 -import com.ruoyi.common.constant.UserConstants;  
18 import com.ruoyi.common.core.controller.BaseController; 17 import com.ruoyi.common.core.controller.BaseController;
19 import com.ruoyi.common.core.domain.AjaxResult; 18 import com.ruoyi.common.core.domain.AjaxResult;
20 import com.ruoyi.common.core.page.TableDataInfo; 19 import com.ruoyi.common.core.page.TableDataInfo;
@@ -84,7 +83,7 @@ public class SysConfigController extends BaseController @@ -84,7 +83,7 @@ public class SysConfigController extends BaseController
84 @PostMapping 83 @PostMapping
85 public AjaxResult add(@Validated @RequestBody SysConfig config) 84 public AjaxResult add(@Validated @RequestBody SysConfig config)
86 { 85 {
87 - if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) 86 + if (!configService.checkConfigKeyUnique(config))
88 { 87 {
89 return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); 88 return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
90 } 89 }
@@ -100,7 +99,7 @@ public class SysConfigController extends BaseController @@ -100,7 +99,7 @@ public class SysConfigController extends BaseController
100 @PutMapping 99 @PutMapping
101 public AjaxResult edit(@Validated @RequestBody SysConfig config) 100 public AjaxResult edit(@Validated @RequestBody SysConfig config)
102 { 101 {
103 - if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) 102 + if (!configService.checkConfigKeyUnique(config))
104 { 103 {
105 return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); 104 return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
106 } 105 }
@@ -76,7 +76,7 @@ public class SysDeptController extends BaseController @@ -76,7 +76,7 @@ public class SysDeptController extends BaseController
76 @PostMapping 76 @PostMapping
77 public AjaxResult add(@Validated @RequestBody SysDept dept) 77 public AjaxResult add(@Validated @RequestBody SysDept dept)
78 { 78 {
79 - if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) 79 + if (!deptService.checkDeptNameUnique(dept))
80 { 80 {
81 return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); 81 return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
82 } 82 }
@@ -94,7 +94,7 @@ public class SysDeptController extends BaseController @@ -94,7 +94,7 @@ public class SysDeptController extends BaseController
94 { 94 {
95 Long deptId = dept.getDeptId(); 95 Long deptId = dept.getDeptId();
96 deptService.checkDeptDataScope(deptId); 96 deptService.checkDeptDataScope(deptId);
97 - if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) 97 + if (!deptService.checkDeptNameUnique(dept))
98 { 98 {
99 return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); 99 return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
100 } 100 }
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
14 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
16 import com.ruoyi.common.annotation.Log; 16 import com.ruoyi.common.annotation.Log;
17 -import com.ruoyi.common.constant.UserConstants;  
18 import com.ruoyi.common.core.controller.BaseController; 17 import com.ruoyi.common.core.controller.BaseController;
19 import com.ruoyi.common.core.domain.AjaxResult; 18 import com.ruoyi.common.core.domain.AjaxResult;
20 import com.ruoyi.common.core.domain.entity.SysDictType; 19 import com.ruoyi.common.core.domain.entity.SysDictType;
@@ -72,7 +71,7 @@ public class SysDictTypeController extends BaseController @@ -72,7 +71,7 @@ public class SysDictTypeController extends BaseController
72 @PostMapping 71 @PostMapping
73 public AjaxResult add(@Validated @RequestBody SysDictType dict) 72 public AjaxResult add(@Validated @RequestBody SysDictType dict)
74 { 73 {
75 - if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) 74 + if (!dictTypeService.checkDictTypeUnique(dict))
76 { 75 {
77 return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); 76 return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
78 } 77 }
@@ -88,7 +87,7 @@ public class SysDictTypeController extends BaseController @@ -88,7 +87,7 @@ public class SysDictTypeController extends BaseController
88 @PutMapping 87 @PutMapping
89 public AjaxResult edit(@Validated @RequestBody SysDictType dict) 88 public AjaxResult edit(@Validated @RequestBody SysDictType dict)
90 { 89 {
91 - if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) 90 + if (!dictTypeService.checkDictTypeUnique(dict))
92 { 91 {
93 return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); 92 return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
94 } 93 }
@@ -85,7 +85,7 @@ public class SysMenuController extends BaseController @@ -85,7 +85,7 @@ public class SysMenuController extends BaseController
85 @PostMapping 85 @PostMapping
86 public AjaxResult add(@Validated @RequestBody SysMenu menu) 86 public AjaxResult add(@Validated @RequestBody SysMenu menu)
87 { 87 {
88 - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) 88 + if (!menuService.checkMenuNameUnique(menu))
89 { 89 {
90 return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); 90 return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
91 } 91 }
@@ -105,7 +105,7 @@ public class SysMenuController extends BaseController @@ -105,7 +105,7 @@ public class SysMenuController extends BaseController
105 @PutMapping 105 @PutMapping
106 public AjaxResult edit(@Validated @RequestBody SysMenu menu) 106 public AjaxResult edit(@Validated @RequestBody SysMenu menu)
107 { 107 {
108 - if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) 108 + if (!menuService.checkMenuNameUnique(menu))
109 { 109 {
110 return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); 110 return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
111 } 111 }
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
14 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
16 import com.ruoyi.common.annotation.Log; 16 import com.ruoyi.common.annotation.Log;
17 -import com.ruoyi.common.constant.UserConstants;  
18 import com.ruoyi.common.core.controller.BaseController; 17 import com.ruoyi.common.core.controller.BaseController;
19 import com.ruoyi.common.core.domain.AjaxResult; 18 import com.ruoyi.common.core.domain.AjaxResult;
20 import com.ruoyi.common.core.page.TableDataInfo; 19 import com.ruoyi.common.core.page.TableDataInfo;
@@ -75,11 +74,11 @@ public class SysPostController extends BaseController @@ -75,11 +74,11 @@ public class SysPostController extends BaseController
75 @PostMapping 74 @PostMapping
76 public AjaxResult add(@Validated @RequestBody SysPost post) 75 public AjaxResult add(@Validated @RequestBody SysPost post)
77 { 76 {
78 - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) 77 + if (!postService.checkPostNameUnique(post))
79 { 78 {
80 return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); 79 return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
81 } 80 }
82 - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) 81 + else if (!postService.checkPostCodeUnique(post))
83 { 82 {
84 return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); 83 return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
85 } 84 }
@@ -95,11 +94,11 @@ public class SysPostController extends BaseController @@ -95,11 +94,11 @@ public class SysPostController extends BaseController
95 @PutMapping 94 @PutMapping
96 public AjaxResult edit(@Validated @RequestBody SysPost post) 95 public AjaxResult edit(@Validated @RequestBody SysPost post)
97 { 96 {
98 - if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) 97 + if (!postService.checkPostNameUnique(post))
99 { 98 {
100 return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); 99 return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
101 } 100 }
102 - else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) 101 + else if (!postService.checkPostCodeUnique(post))
103 { 102 {
104 return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); 103 return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
105 } 104 }
@@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController; @@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
11 import org.springframework.web.multipart.MultipartFile; 11 import org.springframework.web.multipart.MultipartFile;
12 import com.ruoyi.common.annotation.Log; 12 import com.ruoyi.common.annotation.Log;
13 import com.ruoyi.common.config.RuoYiConfig; 13 import com.ruoyi.common.config.RuoYiConfig;
14 -import com.ruoyi.common.constant.UserConstants;  
15 import com.ruoyi.common.core.controller.BaseController; 14 import com.ruoyi.common.core.controller.BaseController;
16 import com.ruoyi.common.core.domain.AjaxResult; 15 import com.ruoyi.common.core.domain.AjaxResult;
17 import com.ruoyi.common.core.domain.entity.SysUser; 16 import com.ruoyi.common.core.domain.entity.SysUser;
@@ -63,13 +62,11 @@ public class SysProfileController extends BaseController @@ -63,13 +62,11 @@ public class SysProfileController extends BaseController
63 LoginUser loginUser = getLoginUser(); 62 LoginUser loginUser = getLoginUser();
64 SysUser sysUser = loginUser.getUser(); 63 SysUser sysUser = loginUser.getUser();
65 user.setUserName(sysUser.getUserName()); 64 user.setUserName(sysUser.getUserName());
66 - if (StringUtils.isNotEmpty(user.getPhonenumber())  
67 - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) 65 + if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
68 { 66 {
69 return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); 67 return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
70 } 68 }
71 - if (StringUtils.isNotEmpty(user.getEmail())  
72 - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) 69 + if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
73 { 70 {
74 return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); 71 return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
75 } 72 }
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
14 import org.springframework.web.bind.annotation.RequestMapping; 14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
16 import com.ruoyi.common.annotation.Log; 16 import com.ruoyi.common.annotation.Log;
17 -import com.ruoyi.common.constant.UserConstants;  
18 import com.ruoyi.common.core.controller.BaseController; 17 import com.ruoyi.common.core.controller.BaseController;
19 import com.ruoyi.common.core.domain.AjaxResult; 18 import com.ruoyi.common.core.domain.AjaxResult;
20 import com.ruoyi.common.core.domain.entity.SysDept; 19 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -94,11 +93,11 @@ public class SysRoleController extends BaseController @@ -94,11 +93,11 @@ public class SysRoleController extends BaseController
94 @PostMapping 93 @PostMapping
95 public AjaxResult add(@Validated @RequestBody SysRole role) 94 public AjaxResult add(@Validated @RequestBody SysRole role)
96 { 95 {
97 - if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) 96 + if (!roleService.checkRoleNameUnique(role))
98 { 97 {
99 return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); 98 return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
100 } 99 }
101 - else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) 100 + else if (!roleService.checkRoleKeyUnique(role))
102 { 101 {
103 return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); 102 return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
104 } 103 }
@@ -117,11 +116,11 @@ public class SysRoleController extends BaseController @@ -117,11 +116,11 @@ public class SysRoleController extends BaseController
117 { 116 {
118 roleService.checkRoleAllowed(role); 117 roleService.checkRoleAllowed(role);
119 roleService.checkRoleDataScope(role.getRoleId()); 118 roleService.checkRoleDataScope(role.getRoleId());
120 - if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) 119 + if (!roleService.checkRoleNameUnique(role))
121 { 120 {
122 return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); 121 return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
123 } 122 }
124 - else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) 123 + else if (!roleService.checkRoleKeyUnique(role))
125 { 124 {
126 return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); 125 return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
127 } 126 }
@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.RestController; 17 import org.springframework.web.bind.annotation.RestController;
18 import org.springframework.web.multipart.MultipartFile; 18 import org.springframework.web.multipart.MultipartFile;
19 import com.ruoyi.common.annotation.Log; 19 import com.ruoyi.common.annotation.Log;
20 -import com.ruoyi.common.constant.UserConstants;  
21 import com.ruoyi.common.core.controller.BaseController; 20 import com.ruoyi.common.core.controller.BaseController;
22 import com.ruoyi.common.core.domain.AjaxResult; 21 import com.ruoyi.common.core.domain.AjaxResult;
23 import com.ruoyi.common.core.domain.entity.SysDept; 22 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -125,17 +124,15 @@ public class SysUserController extends BaseController @@ -125,17 +124,15 @@ public class SysUserController extends BaseController
125 @PostMapping 124 @PostMapping
126 public AjaxResult add(@Validated @RequestBody SysUser user) 125 public AjaxResult add(@Validated @RequestBody SysUser user)
127 { 126 {
128 - if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) 127 + if (!userService.checkUserNameUnique(user))
129 { 128 {
130 return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); 129 return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
131 } 130 }
132 - else if (StringUtils.isNotEmpty(user.getPhonenumber())  
133 - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) 131 + else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
134 { 132 {
135 return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); 133 return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
136 } 134 }
137 - else if (StringUtils.isNotEmpty(user.getEmail())  
138 - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) 135 + else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
139 { 136 {
140 return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); 137 return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
141 } 138 }
@@ -154,17 +151,15 @@ public class SysUserController extends BaseController @@ -154,17 +151,15 @@ public class SysUserController extends BaseController
154 { 151 {
155 userService.checkUserAllowed(user); 152 userService.checkUserAllowed(user);
156 userService.checkUserDataScope(user.getUserId()); 153 userService.checkUserDataScope(user.getUserId());
157 - if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) 154 + if (!userService.checkUserNameUnique(user))
158 { 155 {
159 return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); 156 return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
160 } 157 }
161 - else if (StringUtils.isNotEmpty(user.getPhonenumber())  
162 - && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) 158 + else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
163 { 159 {
164 return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); 160 return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
165 } 161 }
166 - else if (StringUtils.isNotEmpty(user.getEmail())  
167 - && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) 162 + else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
168 { 163 {
169 return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); 164 return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
170 } 165 }
@@ -60,9 +60,9 @@ public class UserConstants @@ -60,9 +60,9 @@ public class UserConstants
60 /** InnerLink组件标识 */ 60 /** InnerLink组件标识 */
61 public final static String INNER_LINK = "InnerLink"; 61 public final static String INNER_LINK = "InnerLink";
62 62
63 - /** 校验返回结果码 */  
64 - public final static String UNIQUE = "0";  
65 - public final static String NOT_UNIQUE = "1"; 63 + /** 校验是否唯一的返回标识 */
  64 + public final static boolean UNIQUE = true;
  65 + public final static boolean NOT_UNIQUE = false;
66 66
67 /** 67 /**
68 * 用户名长度限制 68 * 用户名长度限制
@@ -145,16 +145,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils @@ -145,16 +145,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
145 } 145 }
146 146
147 /** 147 /**
148 - * 计算两个时间差 148 + * 计算时间差(单位:分钟)
  149 + *
  150 + * @param endTime 最后时间
  151 + * @param startTime 开始时间
  152 + * @return 时间差(天/小时/分钟)
149 */ 153 */
150 - public static String getDatePoor(Date endDate, Date nowDate) 154 + public static String timeDistance(Date endDate, Date startTime)
151 { 155 {
152 long nd = 1000 * 24 * 60 * 60; 156 long nd = 1000 * 24 * 60 * 60;
153 long nh = 1000 * 60 * 60; 157 long nh = 1000 * 60 * 60;
154 long nm = 1000 * 60; 158 long nm = 1000 * 60;
155 // long ns = 1000; 159 // long ns = 1000;
156 // 获得两个时间的毫秒时间差异 160 // 获得两个时间的毫秒时间差异
157 - long diff = endDate.getTime() - nowDate.getTime(); 161 + long diff = endDate.getTime() - startTime.getTime();
158 // 计算差多少天 162 // 计算差多少天
159 long day = diff / nd; 163 long day = diff / nd;
160 // 计算差多少小时 164 // 计算差多少小时
@@ -1321,7 +1321,7 @@ public class ExcelUtil<T> @@ -1321,7 +1321,7 @@ public class ExcelUtil<T>
1321 */ 1321 */
1322 public String encodingFilename(String filename) 1322 public String encodingFilename(String filename)
1323 { 1323 {
1324 - filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; 1324 + filename = UUID.randomUUID() + "_" + filename + ".xlsx";
1325 return filename; 1325 return filename;
1326 } 1326 }
1327 1327
@@ -1598,7 +1598,7 @@ public class ExcelUtil<T> @@ -1598,7 +1598,7 @@ public class ExcelUtil<T>
1598 HSSFPicture pic = (HSSFPicture) shape; 1598 HSSFPicture pic = (HSSFPicture) shape;
1599 int pictureIndex = pic.getPictureIndex() - 1; 1599 int pictureIndex = pic.getPictureIndex() - 1;
1600 HSSFPictureData picData = pictures.get(pictureIndex); 1600 HSSFPictureData picData = pictures.get(pictureIndex);
1601 - String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1()); 1601 + String picIndex = anchor.getRow1() + "_" + anchor.getCol1();
1602 sheetIndexPicMap.put(picIndex, picData); 1602 sheetIndexPicMap.put(picIndex, picData);
1603 } 1603 }
1604 } 1604 }
@@ -22,7 +22,7 @@ public class Seq @@ -22,7 +22,7 @@ public class Seq
22 private static AtomicInteger uploadSeq = new AtomicInteger(1); 22 private static AtomicInteger uploadSeq = new AtomicInteger(1);
23 23
24 // 机器标识 24 // 机器标识
25 - private static String machineCode = "A"; 25 + private static final String machineCode = "A";
26 26
27 /** 27 /**
28 * 获取通用序列号 28 * 获取通用序列号
@@ -117,7 +117,7 @@ public class Jvm @@ -117,7 +117,7 @@ public class Jvm
117 */ 117 */
118 public String getRunTime() 118 public String getRunTime()
119 { 119 {
120 - return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()); 120 + return DateUtils.timeDistance(DateUtils.getNowDate(), DateUtils.getServerStartDate());
121 } 121 }
122 122
123 /** 123 /**
@@ -69,7 +69,7 @@ public class SysRegisterService @@ -69,7 +69,7 @@ public class SysRegisterService
69 { 69 {
70 msg = "密码长度必须在5到20个字符之间"; 70 msg = "密码长度必须在5到20个字符之间";
71 } 71 }
72 - else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser))) 72 + else if (!userService.checkUserNameUnique(sysUser))
73 { 73 {
74 msg = "保存用户'" + username + "'失败,注册账号已存在"; 74 msg = "保存用户'" + username + "'失败,注册账号已存在";
75 } 75 }
@@ -85,5 +85,5 @@ public interface ISysConfigService @@ -85,5 +85,5 @@ public interface ISysConfigService
85 * @param config 参数信息 85 * @param config 参数信息
86 * @return 结果 86 * @return 结果
87 */ 87 */
88 - public String checkConfigKeyUnique(SysConfig config); 88 + public boolean checkConfigKeyUnique(SysConfig config);
89 } 89 }
@@ -89,7 +89,7 @@ public interface ISysDeptService @@ -89,7 +89,7 @@ public interface ISysDeptService
89 * @param dept 部门信息 89 * @param dept 部门信息
90 * @return 结果 90 * @return 结果
91 */ 91 */
92 - public String checkDeptNameUnique(SysDept dept); 92 + public boolean checkDeptNameUnique(SysDept dept);
93 93
94 /** 94 /**
95 * 校验部门是否有数据权限 95 * 校验部门是否有数据权限
@@ -94,5 +94,5 @@ public interface ISysDictTypeService @@ -94,5 +94,5 @@ public interface ISysDictTypeService
94 * @param dictType 字典类型 94 * @param dictType 字典类型
95 * @return 结果 95 * @return 结果
96 */ 96 */
97 - public String checkDictTypeUnique(SysDictType dictType); 97 + public boolean checkDictTypeUnique(SysDictType dictType);
98 } 98 }
@@ -140,5 +140,5 @@ public interface ISysMenuService @@ -140,5 +140,5 @@ public interface ISysMenuService
140 * @param menu 菜单信息 140 * @param menu 菜单信息
141 * @return 结果 141 * @return 结果
142 */ 142 */
143 - public String checkMenuNameUnique(SysMenu menu); 143 + public boolean checkMenuNameUnique(SysMenu menu);
144 } 144 }
@@ -47,7 +47,7 @@ public interface ISysPostService @@ -47,7 +47,7 @@ public interface ISysPostService
47 * @param post 岗位信息 47 * @param post 岗位信息
48 * @return 结果 48 * @return 结果
49 */ 49 */
50 - public String checkPostNameUnique(SysPost post); 50 + public boolean checkPostNameUnique(SysPost post);
51 51
52 /** 52 /**
53 * 校验岗位编码 53 * 校验岗位编码
@@ -55,7 +55,7 @@ public interface ISysPostService @@ -55,7 +55,7 @@ public interface ISysPostService
55 * @param post 岗位信息 55 * @param post 岗位信息
56 * @return 结果 56 * @return 结果
57 */ 57 */
58 - public String checkPostCodeUnique(SysPost post); 58 + public boolean checkPostCodeUnique(SysPost post);
59 59
60 /** 60 /**
61 * 通过岗位ID查询岗位使用数量 61 * 通过岗位ID查询岗位使用数量
@@ -65,7 +65,7 @@ public interface ISysRoleService @@ -65,7 +65,7 @@ public interface ISysRoleService
65 * @param role 角色信息 65 * @param role 角色信息
66 * @return 结果 66 * @return 结果
67 */ 67 */
68 - public String checkRoleNameUnique(SysRole role); 68 + public boolean checkRoleNameUnique(SysRole role);
69 69
70 /** 70 /**
71 * 校验角色权限是否唯一 71 * 校验角色权限是否唯一
@@ -73,7 +73,7 @@ public interface ISysRoleService @@ -73,7 +73,7 @@ public interface ISysRoleService
73 * @param role 角色信息 73 * @param role 角色信息
74 * @return 结果 74 * @return 结果
75 */ 75 */
76 - public String checkRoleKeyUnique(SysRole role); 76 + public boolean checkRoleKeyUnique(SysRole role);
77 77
78 /** 78 /**
79 * 校验角色是否允许操作 79 * 校验角色是否允许操作
@@ -72,7 +72,7 @@ public interface ISysUserService @@ -72,7 +72,7 @@ public interface ISysUserService
72 * @param user 用户信息 72 * @param user 用户信息
73 * @return 结果 73 * @return 结果
74 */ 74 */
75 - public String checkUserNameUnique(SysUser user); 75 + public boolean checkUserNameUnique(SysUser user);
76 76
77 /** 77 /**
78 * 校验手机号码是否唯一 78 * 校验手机号码是否唯一
@@ -80,7 +80,7 @@ public interface ISysUserService @@ -80,7 +80,7 @@ public interface ISysUserService
80 * @param user 用户信息 80 * @param user 用户信息
81 * @return 结果 81 * @return 结果
82 */ 82 */
83 - public String checkPhoneUnique(SysUser user); 83 + public boolean checkPhoneUnique(SysUser user);
84 84
85 /** 85 /**
86 * 校验email是否唯一 86 * 校验email是否唯一
@@ -88,7 +88,7 @@ public interface ISysUserService @@ -88,7 +88,7 @@ public interface ISysUserService
88 * @param user 用户信息 88 * @param user 用户信息
89 * @return 结果 89 * @return 结果
90 */ 90 */
91 - public String checkEmailUnique(SysUser user); 91 + public boolean checkEmailUnique(SysUser user);
92 92
93 /** 93 /**
94 * 校验用户是否允许操作 94 * 校验用户是否允许操作
@@ -208,7 +208,7 @@ public class SysConfigServiceImpl implements ISysConfigService @@ -208,7 +208,7 @@ public class SysConfigServiceImpl implements ISysConfigService
208 * @return 结果 208 * @return 结果
209 */ 209 */
210 @Override 210 @Override
211 - public String checkConfigKeyUnique(SysConfig config) 211 + public boolean checkConfigKeyUnique(SysConfig config)
212 { 212 {
213 Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); 213 Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
214 SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); 214 SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
@@ -171,7 +171,7 @@ public class SysDeptServiceImpl implements ISysDeptService @@ -171,7 +171,7 @@ public class SysDeptServiceImpl implements ISysDeptService
171 * @return 结果 171 * @return 结果
172 */ 172 */
173 @Override 173 @Override
174 - public String checkDeptNameUnique(SysDept dept) 174 + public boolean checkDeptNameUnique(SysDept dept)
175 { 175 {
176 Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); 176 Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
177 SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); 177 SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
@@ -210,7 +210,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService @@ -210,7 +210,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
210 * @return 结果 210 * @return 结果
211 */ 211 */
212 @Override 212 @Override
213 - public String checkDictTypeUnique(SysDictType dict) 213 + public boolean checkDictTypeUnique(SysDictType dict)
214 { 214 {
215 Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); 215 Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
216 SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); 216 SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
@@ -175,7 +175,7 @@ public class SysMenuServiceImpl implements ISysMenuService @@ -175,7 +175,7 @@ public class SysMenuServiceImpl implements ISysMenuService
175 router.setQuery(menu.getQuery()); 175 router.setQuery(menu.getQuery());
176 router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); 176 router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
177 List<SysMenu> cMenus = menu.getChildren(); 177 List<SysMenu> cMenus = menu.getChildren();
178 - if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) 178 + if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
179 { 179 {
180 router.setAlwaysShow(true); 180 router.setAlwaysShow(true);
181 router.setRedirect("noRedirect"); 181 router.setRedirect("noRedirect");
@@ -335,7 +335,7 @@ public class SysMenuServiceImpl implements ISysMenuService @@ -335,7 +335,7 @@ public class SysMenuServiceImpl implements ISysMenuService
335 * @return 结果 335 * @return 结果
336 */ 336 */
337 @Override 337 @Override
338 - public String checkMenuNameUnique(SysMenu menu) 338 + public boolean checkMenuNameUnique(SysMenu menu)
339 { 339 {
340 Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); 340 Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
341 SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); 341 SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
@@ -79,7 +79,7 @@ public class SysPostServiceImpl implements ISysPostService @@ -79,7 +79,7 @@ public class SysPostServiceImpl implements ISysPostService
79 * @return 结果 79 * @return 结果
80 */ 80 */
81 @Override 81 @Override
82 - public String checkPostNameUnique(SysPost post) 82 + public boolean checkPostNameUnique(SysPost post)
83 { 83 {
84 Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); 84 Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
85 SysPost info = postMapper.checkPostNameUnique(post.getPostName()); 85 SysPost info = postMapper.checkPostNameUnique(post.getPostName());
@@ -97,7 +97,7 @@ public class SysPostServiceImpl implements ISysPostService @@ -97,7 +97,7 @@ public class SysPostServiceImpl implements ISysPostService
97 * @return 结果 97 * @return 结果
98 */ 98 */
99 @Override 99 @Override
100 - public String checkPostCodeUnique(SysPost post) 100 + public boolean checkPostCodeUnique(SysPost post)
101 { 101 {
102 Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); 102 Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
103 SysPost info = postMapper.checkPostCodeUnique(post.getPostCode()); 103 SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
@@ -146,7 +146,7 @@ public class SysRoleServiceImpl implements ISysRoleService @@ -146,7 +146,7 @@ public class SysRoleServiceImpl implements ISysRoleService
146 * @return 结果 146 * @return 结果
147 */ 147 */
148 @Override 148 @Override
149 - public String checkRoleNameUnique(SysRole role) 149 + public boolean checkRoleNameUnique(SysRole role)
150 { 150 {
151 Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); 151 Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
152 SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); 152 SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
@@ -164,7 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService @@ -164,7 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService
164 * @return 结果 164 * @return 结果
165 */ 165 */
166 @Override 166 @Override
167 - public String checkRoleKeyUnique(SysRole role) 167 + public boolean checkRoleKeyUnique(SysRole role)
168 { 168 {
169 Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); 169 Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
170 SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); 170 SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
@@ -165,7 +165,7 @@ public class SysUserServiceImpl implements ISysUserService @@ -165,7 +165,7 @@ public class SysUserServiceImpl implements ISysUserService
165 * @return 结果 165 * @return 结果
166 */ 166 */
167 @Override 167 @Override
168 - public String checkUserNameUnique(SysUser user) 168 + public boolean checkUserNameUnique(SysUser user)
169 { 169 {
170 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); 170 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
171 SysUser info = userMapper.checkUserNameUnique(user.getUserName()); 171 SysUser info = userMapper.checkUserNameUnique(user.getUserName());
@@ -183,7 +183,7 @@ public class SysUserServiceImpl implements ISysUserService @@ -183,7 +183,7 @@ public class SysUserServiceImpl implements ISysUserService
183 * @return 183 * @return
184 */ 184 */
185 @Override 185 @Override
186 - public String checkPhoneUnique(SysUser user) 186 + public boolean checkPhoneUnique(SysUser user)
187 { 187 {
188 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); 188 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
189 SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber()); 189 SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
@@ -201,7 +201,7 @@ public class SysUserServiceImpl implements ISysUserService @@ -201,7 +201,7 @@ public class SysUserServiceImpl implements ISysUserService
201 * @return 201 * @return
202 */ 202 */
203 @Override 203 @Override
204 - public String checkEmailUnique(SysUser user) 204 + public boolean checkEmailUnique(SysUser user)
205 { 205 {
206 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); 206 Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
207 SysUser info = userMapper.checkEmailUnique(user.getEmail()); 207 SysUser info = userMapper.checkEmailUnique(user.getEmail());
@@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
107 <el-table-column label="参数主键" align="center" prop="configId" /> 107 <el-table-column label="参数主键" align="center" prop="configId" />
108 <el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" /> 108 <el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
109 <el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" /> 109 <el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
110 - <el-table-column label="参数键值" align="center" prop="configValue" /> 110 + <el-table-column label="参数键值" align="center" prop="configValue" :show-overflow-tooltip="true" />
111 <el-table-column label="系统内置" align="center" prop="configType"> 111 <el-table-column label="系统内置" align="center" prop="configType">
112 <template slot-scope="scope"> 112 <template slot-scope="scope">
113 <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/> 113 <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>