24282 2 жил өмнө
parent
commit
aff980bb38
100 өөрчлөгдсөн 2133 нэмэгдсэн , 2968 устгасан
  1. 8 16
      hx-base/src/main/java/com/fjhx/base/common/CaptchaController.java
  2. 21 44
      hx-base/src/main/java/com/fjhx/base/common/CommonController.java
  3. 10 18
      hx-base/src/main/java/com/fjhx/base/monitor/CacheController.java
  4. 3 5
      hx-base/src/main/java/com/fjhx/base/monitor/ServerController.java
  5. 7 13
      hx-base/src/main/java/com/fjhx/base/monitor/SysLogininforController.java
  6. 6 11
      hx-base/src/main/java/com/fjhx/base/monitor/SysOperlogController.java
  7. 9 20
      hx-base/src/main/java/com/fjhx/base/monitor/SysUserOnlineController.java
  8. 12 23
      hx-base/src/main/java/com/fjhx/base/system/SysConfigController.java
  9. 14 29
      hx-base/src/main/java/com/fjhx/base/system/SysDeptController.java
  10. 10 19
      hx-base/src/main/java/com/fjhx/base/system/SysDictDataController.java
  11. 12 23
      hx-base/src/main/java/com/fjhx/base/system/SysDictTypeController.java
  12. 5 5
      hx-base/src/main/java/com/fjhx/base/system/SysIndexController.java
  13. 4 6
      hx-base/src/main/java/com/fjhx/base/system/SysLoginController.java
  14. 16 34
      hx-base/src/main/java/com/fjhx/base/system/SysMenuController.java
  15. 7 13
      hx-base/src/main/java/com/fjhx/base/system/SysNoticeController.java
  16. 14 28
      hx-base/src/main/java/com/fjhx/base/system/SysPostController.java
  17. 14 27
      hx-base/src/main/java/com/fjhx/base/system/SysProfileController.java
  18. 4 7
      hx-base/src/main/java/com/fjhx/base/system/SysRegisterController.java
  19. 21 43
      hx-base/src/main/java/com/fjhx/base/system/SysRoleController.java
  20. 24 50
      hx-base/src/main/java/com/fjhx/base/system/SysUserController.java
  21. 2 2
      hx-socket/src/main/java/com/fjhx/socket/event/WebSocketSendFailEvent.java
  22. 66 67
      hx-socket/src/main/java/com/fjhx/socket/service/WebSocketServer.java
  23. 3 5
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java
  24. 20 29
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java
  25. 33 56
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
  26. 17 35
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java
  27. 5 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java
  28. 14 25
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java
  29. 13 23
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
  30. 9 20
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
  31. 20 38
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
  32. 22 44
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
  33. 19 35
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
  34. 20 38
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
  35. 7 7
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java
  36. 4 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
  37. 23 48
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
  38. 14 27
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
  39. 22 43
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
  40. 18 37
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
  41. 9 12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
  42. 21 43
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
  43. 24 50
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  44. 23 27
      ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
  45. 4 9
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java
  46. 3 8
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java
  47. 5 10
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java
  48. 12 18
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
  49. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
  50. 5 10
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java
  51. 4 8
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java
  52. 3 10
      ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java
  53. 66 75
      ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
  54. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
  55. 6 7
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  56. 128 59
      ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
  57. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java
  58. 20 14
      ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java
  59. 54 21
      ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java
  60. 35 56
      ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
  61. 46 58
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java
  62. 17 8
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
  63. 33 49
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java
  64. 27 28
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java
  65. 24 27
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java
  66. 79 80
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java
  67. 70 72
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java
  68. 40 41
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java
  69. 111 112
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java
  70. 97 102
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java
  71. 93 103
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
  72. 54 86
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java
  73. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java
  74. 33 41
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java
  75. 26 29
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
  76. 4 7
      ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java
  77. 40 65
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
  78. 36 31
      ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java
  79. 170 321
      ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java
  80. 15 31
      ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java
  81. 2 4
      ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java
  82. 3 4
      ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java
  83. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
  84. 7 11
      ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java
  85. 1 2
      ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java
  86. 2 3
      ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java
  87. 5 9
      ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java
  88. 3 5
      ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java
  89. 9 16
      ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java
  90. 16 25
      ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java
  91. 5 9
      ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java
  92. 14 27
      ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java
  93. 3 5
      ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java
  94. 4 6
      ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java
  95. 4 6
      ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java
  96. 10 19
      ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java
  97. 14 27
      ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java
  98. 6 11
      ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java
  99. 3 5
      ruoyi-common/src/main/java/com/ruoyi/common/exception/user/BlackListException.java
  100. 3 5
      ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java

+ 8 - 16
hx-base/src/main/java/com/fjhx/base/common/CaptchaController.java

@@ -24,13 +24,12 @@ import java.util.concurrent.TimeUnit;
 
 /**
  * 验证码操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @DataSource(DataSourceType.SLAVE)
-public class CaptchaController
-{
+public class CaptchaController {
     @Resource(name = "captchaProducer")
     private Producer captchaProducer;
 
@@ -39,7 +38,7 @@ public class CaptchaController
 
     @Autowired
     private RedisCache redisCache;
-    
+
     @Autowired
     private ISysConfigService configService;
 
@@ -51,8 +50,7 @@ public class CaptchaController
         AjaxResult ajax = AjaxResult.success();
         boolean captchaEnabled = configService.selectCaptchaEnabled();
         ajax.put("captchaEnabled", captchaEnabled);
-        if (!captchaEnabled)
-        {
+        if (!captchaEnabled) {
             return ajax;
         }
 
@@ -65,15 +63,12 @@ public class CaptchaController
 
         // 生成验证码
         String captchaType = RuoYiConfig.getCaptchaType();
-        if ("math".equals(captchaType))
-        {
+        if ("math".equals(captchaType)) {
             String capText = captchaProducerMath.createText();
             capStr = capText.substring(0, capText.lastIndexOf("@"));
             code = capText.substring(capText.lastIndexOf("@") + 1);
             image = captchaProducerMath.createImage(capStr);
-        }
-        else if ("char".equals(captchaType))
-        {
+        } else if ("char".equals(captchaType)) {
             capStr = code = captchaProducer.createText();
             image = captchaProducer.createImage(capStr);
         }
@@ -81,12 +76,9 @@ public class CaptchaController
         redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
         // 转换流信息写出
         FastByteArrayOutputStream os = new FastByteArrayOutputStream();
-        try
-        {
+        try {
             ImageIO.write(image, "jpg", os);
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             return AjaxResult.error(e.getMessage());
         }
 

+ 21 - 44
hx-base/src/main/java/com/fjhx/base/common/CommonController.java

@@ -26,34 +26,28 @@ import java.util.List;
 
 /**
  * 通用请求处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/common")
 @DataSource(DataSourceType.SLAVE)
-public class CommonController
-{
+public class CommonController {
     private static final Logger log = LoggerFactory.getLogger(CommonController.class);
-
+    private static final String FILE_DELIMETER = ",";
     @Autowired
     private ServerConfig serverConfig;
 
-    private static final String FILE_DELIMETER = ",";
-
     /**
      * 通用下载请求
-     * 
+     *
      * @param fileName 文件名称
-     * @param delete 是否删除
+     * @param delete   是否删除
      */
     @GetMapping("/download")
-    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(fileName))
-            {
+    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+        try {
+            if (!FileUtils.checkAllowDownload(fileName)) {
                 throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
             }
             String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@@ -62,13 +56,10 @@ public class CommonController
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, realFileName);
             FileUtils.writeBytes(filePath, response.getOutputStream());
-            if (delete)
-            {
+            if (delete) {
                 FileUtils.deleteFile(filePath);
             }
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("下载文件失败", e);
         }
     }
@@ -77,10 +68,8 @@ public class CommonController
      * 通用上传请求(单个)
      */
     @PostMapping("/upload")
-    public AjaxResult uploadFile(MultipartFile file) throws Exception
-    {
-        try
-        {
+    public AjaxResult uploadFile(MultipartFile file) throws Exception {
+        try {
             // 上传文件路径
             String filePath = RuoYiConfig.getUploadPath();
             // 上传并返回新文件名称
@@ -92,9 +81,7 @@ public class CommonController
             ajax.put("newFileName", FileUtils.getName(fileName));
             ajax.put("originalFilename", file.getOriginalFilename());
             return ajax;
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
     }
@@ -103,18 +90,15 @@ public class CommonController
      * 通用上传请求(多个)
      */
     @PostMapping("/uploads")
-    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
-    {
-        try
-        {
+    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
+        try {
             // 上传文件路径
             String filePath = RuoYiConfig.getUploadPath();
             List<String> urls = new ArrayList<String>();
             List<String> fileNames = new ArrayList<String>();
             List<String> newFileNames = new ArrayList<String>();
             List<String> originalFilenames = new ArrayList<String>();
-            for (MultipartFile file : files)
-            {
+            for (MultipartFile file : files) {
                 // 上传并返回新文件名称
                 String fileName = FileUploadUtils.upload(filePath, file);
                 String url = serverConfig.getUrl() + fileName;
@@ -129,9 +113,7 @@ public class CommonController
             ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
             ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
             return ajax;
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
     }
@@ -141,12 +123,9 @@ public class CommonController
      */
     @GetMapping("/download/resource")
     public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
-            throws Exception
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(resource))
-            {
+            throws Exception {
+        try {
+            if (!FileUtils.checkAllowDownload(resource)) {
                 throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
             }
             // 本地资源路径
@@ -158,9 +137,7 @@ public class CommonController
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, downloadName);
             FileUtils.writeBytes(downloadPath, response.getOutputStream());
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("下载文件失败", e);
         }
     }

+ 10 - 18
hx-base/src/main/java/com/fjhx/base/monitor/CacheController.java

@@ -14,17 +14,16 @@ import java.util.*;
 
 /**
  * 缓存监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/cache")
-public class CacheController
-{
+public class CacheController {
+    private final static List<SysCache> caches = new ArrayList<SysCache>();
     @Autowired
     private RedisTemplate<String, String> redisTemplate;
 
-    private final static List<SysCache> caches = new ArrayList<SysCache>();
     {
         caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
         caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
@@ -37,8 +36,7 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping()
-    public AjaxResult getInfo() throws Exception
-    {
+    public AjaxResult getInfo() throws Exception {
         Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
         Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
         Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
@@ -61,23 +59,20 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getNames")
-    public AjaxResult cache()
-    {
+    public AjaxResult cache() {
         return AjaxResult.success(caches);
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getKeys/{cacheName}")
-    public AjaxResult getCacheKeys(@PathVariable String cacheName)
-    {
+    public AjaxResult getCacheKeys(@PathVariable String cacheName) {
         Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
         return AjaxResult.success(cacheKeys);
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getValue/{cacheName}/{cacheKey}")
-    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
-    {
+    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) {
         String cacheValue = redisTemplate.opsForValue().get(cacheKey);
         SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
         return AjaxResult.success(sysCache);
@@ -85,8 +80,7 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheName/{cacheName}")
-    public AjaxResult clearCacheName(@PathVariable String cacheName)
-    {
+    public AjaxResult clearCacheName(@PathVariable String cacheName) {
         Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
         redisTemplate.delete(cacheKeys);
         return AjaxResult.success();
@@ -94,16 +88,14 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheKey/{cacheKey}")
-    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
-    {
+    public AjaxResult clearCacheKey(@PathVariable String cacheKey) {
         redisTemplate.delete(cacheKey);
         return AjaxResult.success();
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheAll")
-    public AjaxResult clearCacheAll()
-    {
+    public AjaxResult clearCacheAll() {
         Collection<String> cacheKeys = redisTemplate.keys("*");
         redisTemplate.delete(cacheKeys);
         return AjaxResult.success();

+ 3 - 5
hx-base/src/main/java/com/fjhx/base/monitor/ServerController.java

@@ -9,17 +9,15 @@ import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 服务器监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/server")
-public class ServerController
-{
+public class ServerController {
     @PreAuthorize("@ss.hasPermi('monitor:server:list')")
     @GetMapping()
-    public AjaxResult getInfo() throws Exception
-    {
+    public AjaxResult getInfo() throws Exception {
         Server server = new Server();
         server.copyTo();
         return AjaxResult.success(server);

+ 7 - 13
hx-base/src/main/java/com/fjhx/base/monitor/SysLogininforController.java

@@ -20,14 +20,13 @@ import java.util.List;
 
 /**
  * 系统访问记录
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/logininfor")
 @DataSource(DataSourceType.SLAVE)
-public class SysLogininforController extends BaseController
-{
+public class SysLogininforController extends BaseController {
     @Autowired
     private ISysLogininforService logininforService;
 
@@ -36,8 +35,7 @@ public class SysLogininforController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysLogininfor logininfor)
-    {
+    public TableDataInfo list(SysLogininfor logininfor) {
         startPage();
         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
         return getDataTable(list);
@@ -46,8 +44,7 @@ public class SysLogininforController extends BaseController
     @Log(title = "登录日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysLogininfor logininfor)
-    {
+    public void export(HttpServletResponse response, SysLogininfor logininfor) {
         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
         ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
         util.exportExcel(response, list, "登录日志");
@@ -56,16 +53,14 @@ public class SysLogininforController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
     @Log(title = "登录日志", businessType = BusinessType.DELETE)
     @DeleteMapping("/{infoIds}")
-    public AjaxResult remove(@PathVariable Long[] infoIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] infoIds) {
         return toAjax(logininforService.deleteLogininforByIds(infoIds));
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
     @Log(title = "登录日志", businessType = BusinessType.CLEAN)
     @DeleteMapping("/clean")
-    public AjaxResult clean()
-    {
+    public AjaxResult clean() {
         logininforService.cleanLogininfor();
         return success();
     }
@@ -73,8 +68,7 @@ public class SysLogininforController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
     @Log(title = "账户解锁", businessType = BusinessType.OTHER)
     @GetMapping("/unlock/{userName}")
-    public AjaxResult unlock(@PathVariable("userName") String userName)
-    {
+    public AjaxResult unlock(@PathVariable("userName") String userName) {
         passwordService.clearLoginRecordCache(userName);
         return success();
     }

+ 6 - 11
hx-base/src/main/java/com/fjhx/base/monitor/SysOperlogController.java

@@ -19,21 +19,19 @@ import java.util.List;
 
 /**
  * 操作日志记录
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/operlog")
 @DataSource(DataSourceType.SLAVE)
-public class SysOperlogController extends BaseController
-{
+public class SysOperlogController extends BaseController {
     @Autowired
     private ISysOperLogService operLogService;
 
     @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysOperLog operLog)
-    {
+    public TableDataInfo list(SysOperLog operLog) {
         startPage();
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         return getDataTable(list);
@@ -42,8 +40,7 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysOperLog operLog)
-    {
+    public void export(HttpServletResponse response, SysOperLog operLog) {
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
         util.exportExcel(response, list, "操作日志");
@@ -52,16 +49,14 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.DELETE)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/{operIds}")
-    public AjaxResult remove(@PathVariable Long[] operIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] operIds) {
         return toAjax(operLogService.deleteOperLogByIds(operIds));
     }
 
     @Log(title = "操作日志", businessType = BusinessType.CLEAN)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/clean")
-    public AjaxResult clean()
-    {
+    public AjaxResult clean() {
         operLogService.cleanOperLog();
         return success();
     }

+ 9 - 20
hx-base/src/main/java/com/fjhx/base/monitor/SysUserOnlineController.java

@@ -22,13 +22,12 @@ import java.util.List;
 
 /**
  * 在线用户监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/online")
-public class SysUserOnlineController extends BaseController
-{
+public class SysUserOnlineController extends BaseController {
     @Autowired
     private ISysUserOnlineService userOnlineService;
 
@@ -37,27 +36,18 @@ public class SysUserOnlineController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('monitor:online:list')")
     @GetMapping("/list")
-    public TableDataInfo list(String ipaddr, String userName)
-    {
+    public TableDataInfo list(String ipaddr, String userName) {
         Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
         List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
-        for (String key : keys)
-        {
+        for (String key : keys) {
             LoginUser user = redisCache.getCacheObject(key);
-            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
-            {
+            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
                 userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
-            }
-            else if (StringUtils.isNotEmpty(ipaddr))
-            {
+            } else if (StringUtils.isNotEmpty(ipaddr)) {
                 userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
-            }
-            else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
-            {
+            } else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
                 userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
-            }
-            else
-            {
+            } else {
                 userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
             }
         }
@@ -72,8 +62,7 @@ public class SysUserOnlineController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
     @Log(title = "在线用户", businessType = BusinessType.FORCE)
     @DeleteMapping("/{tokenId}")
-    public AjaxResult forceLogout(@PathVariable String tokenId)
-    {
+    public AjaxResult forceLogout(@PathVariable String tokenId) {
         redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
         return success();
     }

+ 12 - 23
hx-base/src/main/java/com/fjhx/base/system/SysConfigController.java

@@ -20,14 +20,13 @@ import java.util.List;
 
 /**
  * 参数配置 信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/config")
 @DataSource(DataSourceType.SLAVE)
-public class SysConfigController extends BaseController
-{
+public class SysConfigController extends BaseController {
     @Autowired
     private ISysConfigService configService;
 
@@ -36,8 +35,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysConfig config)
-    {
+    public TableDataInfo list(SysConfig config) {
         startPage();
         List<SysConfig> list = configService.selectConfigList(config);
         return getDataTable(list);
@@ -46,8 +44,7 @@ public class SysConfigController extends BaseController
     @Log(title = "参数管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:config:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysConfig config)
-    {
+    public void export(HttpServletResponse response, SysConfig config) {
         List<SysConfig> list = configService.selectConfigList(config);
         ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
         util.exportExcel(response, list, "参数数据");
@@ -58,8 +55,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:query')")
     @GetMapping(value = "/{configId}")
-    public AjaxResult getInfo(@PathVariable Long configId)
-    {
+    public AjaxResult getInfo(@PathVariable Long configId) {
         return success(configService.selectConfigById(configId));
     }
 
@@ -67,8 +63,7 @@ public class SysConfigController extends BaseController
      * 根据参数键名查询参数值
      */
     @GetMapping(value = "/configKey/{configKey}")
-    public AjaxResult getConfigKey(@PathVariable String configKey)
-    {
+    public AjaxResult getConfigKey(@PathVariable String configKey) {
         return success(configService.selectConfigByKey(configKey));
     }
 
@@ -78,10 +73,8 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:add')")
     @Log(title = "参数管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysConfig config)
-    {
-        if (!configService.checkConfigKeyUnique(config))
-        {
+    public AjaxResult add(@Validated @RequestBody SysConfig config) {
+        if (!configService.checkConfigKeyUnique(config)) {
             return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setCreateBy(getUsername());
@@ -94,10 +87,8 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:edit')")
     @Log(title = "参数管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysConfig config)
-    {
-        if (!configService.checkConfigKeyUnique(config))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysConfig config) {
+        if (!configService.checkConfigKeyUnique(config)) {
             return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setUpdateBy(getUsername());
@@ -110,8 +101,7 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{configIds}")
-    public AjaxResult remove(@PathVariable Long[] configIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] configIds) {
         configService.deleteConfigByIds(configIds);
         return success();
     }
@@ -122,8 +112,7 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.CLEAN)
     @DeleteMapping("/refreshCache")
-    public AjaxResult refreshCache()
-    {
+    public AjaxResult refreshCache() {
         configService.resetConfigCache();
         return success();
     }

+ 14 - 29
hx-base/src/main/java/com/fjhx/base/system/SysDeptController.java

@@ -20,14 +20,13 @@ import java.util.List;
 
 /**
  * 部门信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dept")
 @DataSource(DataSourceType.SLAVE)
-public class SysDeptController extends BaseController
-{
+public class SysDeptController extends BaseController {
     @Autowired
     private ISysDeptService deptService;
 
@@ -36,8 +35,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list")
-    public AjaxResult list(SysDept dept)
-    {
+    public AjaxResult list(SysDept dept) {
         List<SysDept> depts = deptService.selectDeptList(dept);
         return success(depts);
     }
@@ -47,8 +45,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list/exclude/{deptId}")
-    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
-    {
+    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
         List<SysDept> depts = deptService.selectDeptList(new SysDept());
         depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
         return success(depts);
@@ -59,8 +56,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:query')")
     @GetMapping(value = "/{deptId}")
-    public AjaxResult getInfo(@PathVariable Long deptId)
-    {
+    public AjaxResult getInfo(@PathVariable Long deptId) {
         deptService.checkDeptDataScope(deptId);
         return success(deptService.selectDeptById(deptId));
     }
@@ -71,10 +67,8 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:add')")
     @Log(title = "部门管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDept dept)
-    {
-        if (!deptService.checkDeptNameUnique(dept))
-        {
+    public AjaxResult add(@Validated @RequestBody SysDept dept) {
+        if (!deptService.checkDeptNameUnique(dept)) {
             return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
         }
         dept.setCreateBy(getUsername());
@@ -87,20 +81,14 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:edit')")
     @Log(title = "部门管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDept dept)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysDept dept) {
         Long deptId = dept.getDeptId();
         deptService.checkDeptDataScope(deptId);
-        if (!deptService.checkDeptNameUnique(dept))
-        {
+        if (!deptService.checkDeptNameUnique(dept)) {
             return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
-        }
-        else if (dept.getParentId().equals(deptId))
-        {
+        } else if (dept.getParentId().equals(deptId)) {
             return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
-        }
-        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
-        {
+        } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
             return error("该部门包含未停用的子部门!");
         }
         dept.setUpdateBy(getUsername());
@@ -113,14 +101,11 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:remove')")
     @Log(title = "部门管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{deptId}")
-    public AjaxResult remove(@PathVariable Long deptId)
-    {
-        if (deptService.hasChildByDeptId(deptId))
-        {
+    public AjaxResult remove(@PathVariable Long deptId) {
+        if (deptService.hasChildByDeptId(deptId)) {
             return warn("存在下级部门,不允许删除");
         }
-        if (deptService.checkDeptExistUser(deptId))
-        {
+        if (deptService.checkDeptExistUser(deptId)) {
             return warn("部门存在用户,不允许删除");
         }
         deptService.checkDeptDataScope(deptId);

+ 10 - 19
hx-base/src/main/java/com/fjhx/base/system/SysDictDataController.java

@@ -23,14 +23,13 @@ import java.util.List;
 
 /**
  * 数据字典信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dict/data")
 @DataSource(DataSourceType.SLAVE)
-public class SysDictDataController extends BaseController
-{
+public class SysDictDataController extends BaseController {
     @Autowired
     private ISysDictDataService dictDataService;
 
@@ -39,8 +38,7 @@ public class SysDictDataController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictData dictData)
-    {
+    public TableDataInfo list(SysDictData dictData) {
         startPage();
         List<SysDictData> list = dictDataService.selectDictDataList(dictData);
         return getDataTable(list);
@@ -49,8 +47,7 @@ public class SysDictDataController extends BaseController
     @Log(title = "字典数据", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:dict:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysDictData dictData)
-    {
+    public void export(HttpServletResponse response, SysDictData dictData) {
         List<SysDictData> list = dictDataService.selectDictDataList(dictData);
         ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
         util.exportExcel(response, list, "字典数据");
@@ -61,8 +58,7 @@ public class SysDictDataController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictCode}")
-    public AjaxResult getInfo(@PathVariable Long dictCode)
-    {
+    public AjaxResult getInfo(@PathVariable Long dictCode) {
         return success(dictDataService.selectDictDataById(dictCode));
     }
 
@@ -70,11 +66,9 @@ public class SysDictDataController extends BaseController
      * 根据字典类型查询字典数据信息
      */
     @GetMapping(value = "/type/{dictType}")
-    public AjaxResult dictType(@PathVariable String dictType)
-    {
+    public AjaxResult dictType(@PathVariable String dictType) {
         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
-        if (StringUtils.isNull(data))
-        {
+        if (StringUtils.isNull(data)) {
             data = new ArrayList<SysDictData>();
         }
         return success(data);
@@ -86,8 +80,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @Log(title = "字典数据", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDictData dict)
-    {
+    public AjaxResult add(@Validated @RequestBody SysDictData dict) {
         dict.setCreateBy(getUsername());
         return toAjax(dictDataService.insertDictData(dict));
     }
@@ -98,8 +91,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @Log(title = "字典数据", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDictData dict)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
         dict.setUpdateBy(getUsername());
         return toAjax(dictDataService.updateDictData(dict));
     }
@@ -110,8 +102,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.DELETE)
     @DeleteMapping("/{dictCodes}")
-    public AjaxResult remove(@PathVariable Long[] dictCodes)
-    {
+    public AjaxResult remove(@PathVariable Long[] dictCodes) {
         dictDataService.deleteDictDataByIds(dictCodes);
         return success();
     }

+ 12 - 23
hx-base/src/main/java/com/fjhx/base/system/SysDictTypeController.java

@@ -20,21 +20,19 @@ import java.util.List;
 
 /**
  * 数据字典信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dict/type")
 @DataSource(DataSourceType.SLAVE)
-public class SysDictTypeController extends BaseController
-{
+public class SysDictTypeController extends BaseController {
     @Autowired
     private ISysDictTypeService dictTypeService;
 
     @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictType dictType)
-    {
+    public TableDataInfo list(SysDictType dictType) {
         startPage();
         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
         return getDataTable(list);
@@ -43,8 +41,7 @@ public class SysDictTypeController extends BaseController
     @Log(title = "字典类型", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:dict:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysDictType dictType)
-    {
+    public void export(HttpServletResponse response, SysDictType dictType) {
         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
         ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
         util.exportExcel(response, list, "字典类型");
@@ -55,8 +52,7 @@ public class SysDictTypeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictId}")
-    public AjaxResult getInfo(@PathVariable Long dictId)
-    {
+    public AjaxResult getInfo(@PathVariable Long dictId) {
         return success(dictTypeService.selectDictTypeById(dictId));
     }
 
@@ -66,10 +62,8 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @Log(title = "字典类型", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDictType dict)
-    {
-        if (!dictTypeService.checkDictTypeUnique(dict))
-        {
+    public AjaxResult add(@Validated @RequestBody SysDictType dict) {
+        if (!dictTypeService.checkDictTypeUnique(dict)) {
             return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
         dict.setCreateBy(getUsername());
@@ -82,10 +76,8 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @Log(title = "字典类型", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDictType dict)
-    {
-        if (!dictTypeService.checkDictTypeUnique(dict))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
+        if (!dictTypeService.checkDictTypeUnique(dict)) {
             return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
         dict.setUpdateBy(getUsername());
@@ -98,8 +90,7 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.DELETE)
     @DeleteMapping("/{dictIds}")
-    public AjaxResult remove(@PathVariable Long[] dictIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] dictIds) {
         dictTypeService.deleteDictTypeByIds(dictIds);
         return success();
     }
@@ -110,8 +101,7 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.CLEAN)
     @DeleteMapping("/refreshCache")
-    public AjaxResult refreshCache()
-    {
+    public AjaxResult refreshCache() {
         dictTypeService.resetDictCache();
         return success();
     }
@@ -120,8 +110,7 @@ public class SysDictTypeController extends BaseController
      * 获取字典选择框列表
      */
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
         return success(dictTypes);
     }

+ 5 - 5
hx-base/src/main/java/com/fjhx/base/system/SysIndexController.java

@@ -15,9 +15,10 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 @DataSource(DataSourceType.SLAVE)
-public class SysIndexController
-{
-    /** 系统基础配置 */
+public class SysIndexController {
+    /**
+     * 系统基础配置
+     */
     @Autowired
     private RuoYiConfig ruoyiConfig;
 
@@ -25,8 +26,7 @@ public class SysIndexController
      * 访问首页,提示语
      */
     @RequestMapping("/")
-    public String index()
-    {
+    public String index() {
         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
     }
 }

+ 4 - 6
hx-base/src/main/java/com/fjhx/base/system/SysLoginController.java

@@ -62,12 +62,11 @@ public class SysLoginController {
 
     /**
      * 获取用户信息
-     * 
+     *
      * @return 用户信息
      */
     @GetMapping("getInfo")
-    public AjaxResult getInfo()
-    {
+    public AjaxResult getInfo() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);
@@ -82,12 +81,11 @@ public class SysLoginController {
 
     /**
      * 获取路由信息
-     * 
+     *
      * @return 路由信息
      */
     @GetMapping("getRouters")
-    public AjaxResult getRouters()
-    {
+    public AjaxResult getRouters() {
         Long userId = SecurityUtils.getUserId();
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
         return AjaxResult.success(menuService.buildMenus(menus));

+ 16 - 34
hx-base/src/main/java/com/fjhx/base/system/SysMenuController.java

@@ -19,14 +19,13 @@ import java.util.List;
 
 /**
  * 菜单信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/menu")
 @DataSource(DataSourceType.SLAVE)
-public class SysMenuController extends BaseController
-{
+public class SysMenuController extends BaseController {
     @Autowired
     private ISysMenuService menuService;
 
@@ -35,8 +34,7 @@ public class SysMenuController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:menu:list')")
     @GetMapping("/list")
-    public AjaxResult list(SysMenu menu)
-    {
+    public AjaxResult list(SysMenu menu) {
         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
         return success(menus);
     }
@@ -46,8 +44,7 @@ public class SysMenuController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:menu:query')")
     @GetMapping(value = "/{menuId}")
-    public AjaxResult getInfo(@PathVariable Long menuId)
-    {
+    public AjaxResult getInfo(@PathVariable Long menuId) {
         return success(menuService.selectMenuById(menuId));
     }
 
@@ -55,8 +52,7 @@ public class SysMenuController extends BaseController
      * 获取菜单下拉树列表
      */
     @GetMapping("/treeselect")
-    public AjaxResult treeselect(SysMenu menu)
-    {
+    public AjaxResult treeselect(SysMenu menu) {
         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
         return success(menuService.buildMenuTreeSelect(menus));
     }
@@ -65,8 +61,7 @@ public class SysMenuController extends BaseController
      * 加载对应角色菜单列表树
      */
     @GetMapping(value = "/roleMenuTreeselect/{roleId}")
-    public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
-    {
+    public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
         List<SysMenu> menus = menuService.selectMenuList(getUserId());
         AjaxResult ajax = AjaxResult.success();
         ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
@@ -80,14 +75,10 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:add')")
     @Log(title = "菜单管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysMenu menu)
-    {
-        if (!menuService.checkMenuNameUnique(menu))
-        {
+    public AjaxResult add(@Validated @RequestBody SysMenu menu) {
+        if (!menuService.checkMenuNameUnique(menu)) {
             return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
-        }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
-        {
+        } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
             return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
         }
         menu.setCreateBy(getUsername());
@@ -100,18 +91,12 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:edit')")
     @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysMenu menu)
-    {
-        if (!menuService.checkMenuNameUnique(menu))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
+        if (!menuService.checkMenuNameUnique(menu)) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
-        }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
-        {
+        } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
-        }
-        else if (menu.getMenuId().equals(menu.getParentId()))
-        {
+        } else if (menu.getMenuId().equals(menu.getParentId())) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
         }
         menu.setUpdateBy(getUsername());
@@ -124,14 +109,11 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:remove')")
     @Log(title = "菜单管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{menuId}")
-    public AjaxResult remove(@PathVariable("menuId") Long menuId)
-    {
-        if (menuService.hasChildByMenuId(menuId))
-        {
+    public AjaxResult remove(@PathVariable("menuId") Long menuId) {
+        if (menuService.hasChildByMenuId(menuId)) {
             return warn("存在子菜单,不允许删除");
         }
-        if (menuService.checkMenuExistRole(menuId))
-        {
+        if (menuService.checkMenuExistRole(menuId)) {
             return warn("菜单已分配,不允许删除");
         }
         return toAjax(menuService.deleteMenuById(menuId));

+ 7 - 13
hx-base/src/main/java/com/fjhx/base/system/SysNoticeController.java

@@ -18,14 +18,13 @@ import java.util.List;
 
 /**
  * 公告 信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/notice")
 @DataSource(DataSourceType.SLAVE)
-public class SysNoticeController extends BaseController
-{
+public class SysNoticeController extends BaseController {
     @Autowired
     private ISysNoticeService noticeService;
 
@@ -34,8 +33,7 @@ public class SysNoticeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:notice:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysNotice notice)
-    {
+    public TableDataInfo list(SysNotice notice) {
         startPage();
         List<SysNotice> list = noticeService.selectNoticeList(notice);
         return getDataTable(list);
@@ -46,8 +44,7 @@ public class SysNoticeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{noticeId}")
-    public AjaxResult getInfo(@PathVariable Long noticeId)
-    {
+    public AjaxResult getInfo(@PathVariable Long noticeId) {
         return success(noticeService.selectNoticeById(noticeId));
     }
 
@@ -57,8 +54,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:add')")
     @Log(title = "通知公告", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysNotice notice)
-    {
+    public AjaxResult add(@Validated @RequestBody SysNotice notice) {
         notice.setCreateBy(getUsername());
         return toAjax(noticeService.insertNotice(notice));
     }
@@ -69,8 +65,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:edit')")
     @Log(title = "通知公告", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysNotice notice)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
         notice.setUpdateBy(getUsername());
         return toAjax(noticeService.updateNotice(notice));
     }
@@ -81,8 +76,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:remove')")
     @Log(title = "通知公告", businessType = BusinessType.DELETE)
     @DeleteMapping("/{noticeIds}")
-    public AjaxResult remove(@PathVariable Long[] noticeIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] noticeIds) {
         return toAjax(noticeService.deleteNoticeByIds(noticeIds));
     }
 }

+ 14 - 28
hx-base/src/main/java/com/fjhx/base/system/SysPostController.java

@@ -20,14 +20,13 @@ import java.util.List;
 
 /**
  * 岗位信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/post")
 @DataSource(DataSourceType.SLAVE)
-public class SysPostController extends BaseController
-{
+public class SysPostController extends BaseController {
     @Autowired
     private ISysPostService postService;
 
@@ -36,18 +35,16 @@ public class SysPostController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:post:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysPost post)
-    {
+    public TableDataInfo list(SysPost post) {
         startPage();
         List<SysPost> list = postService.selectPostList(post);
         return getDataTable(list);
     }
-    
+
     @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:post:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysPost post)
-    {
+    public void export(HttpServletResponse response, SysPost post) {
         List<SysPost> list = postService.selectPostList(post);
         ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
         util.exportExcel(response, list, "岗位数据");
@@ -58,8 +55,7 @@ public class SysPostController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:post:query')")
     @GetMapping(value = "/{postId}")
-    public AjaxResult getInfo(@PathVariable Long postId)
-    {
+    public AjaxResult getInfo(@PathVariable Long postId) {
         return success(postService.selectPostById(postId));
     }
 
@@ -69,14 +65,10 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:add')")
     @Log(title = "岗位管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysPost post)
-    {
-        if (!postService.checkPostNameUnique(post))
-        {
+    public AjaxResult add(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
             return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
-        }
-        else if (!postService.checkPostCodeUnique(post))
-        {
+        } else if (!postService.checkPostCodeUnique(post)) {
             return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
         }
         post.setCreateBy(getUsername());
@@ -89,14 +81,10 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:edit')")
     @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysPost post)
-    {
-        if (!postService.checkPostNameUnique(post))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
             return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
-        }
-        else if (!postService.checkPostCodeUnique(post))
-        {
+        } else if (!postService.checkPostCodeUnique(post)) {
             return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
         }
         post.setUpdateBy(getUsername());
@@ -109,8 +97,7 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:remove')")
     @Log(title = "岗位管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{postIds}")
-    public AjaxResult remove(@PathVariable Long[] postIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] postIds) {
         return toAjax(postService.deletePostByIds(postIds));
     }
 
@@ -118,8 +105,7 @@ public class SysPostController extends BaseController
      * 获取岗位选择框列表
      */
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         List<SysPost> posts = postService.selectPostAll();
         return success(posts);
     }

+ 14 - 27
hx-base/src/main/java/com/fjhx/base/system/SysProfileController.java

@@ -21,14 +21,13 @@ import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 个人信息 业务处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/user/profile")
 @DataSource(DataSourceType.SLAVE)
-public class SysProfileController extends BaseController
-{
+public class SysProfileController extends BaseController {
     @Autowired
     private ISysUserService userService;
 
@@ -39,8 +38,7 @@ public class SysProfileController extends BaseController
      * 个人信息
      */
     @GetMapping
-    public AjaxResult profile()
-    {
+    public AjaxResult profile() {
         LoginUser loginUser = getLoginUser();
         SysUser user = loginUser.getUser();
         AjaxResult ajax = AjaxResult.success(user);
@@ -54,25 +52,21 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult updateProfile(@RequestBody SysUser user)
-    {
+    public AjaxResult updateProfile(@RequestBody SysUser user) {
         LoginUser loginUser = getLoginUser();
         SysUser sysUser = loginUser.getUser();
         user.setUserName(sysUser.getUserName());
-        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
         }
-        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUserId(sysUser.getUserId());
         user.setPassword(null);
         user.setAvatar(null);
         user.setDeptId(null);
-        if (userService.updateUserProfile(user) > 0)
-        {
+        if (userService.updateUserProfile(user) > 0) {
             // 更新缓存用户信息
             sysUser.setNickName(user.getNickName());
             sysUser.setPhonenumber(user.getPhonenumber());
@@ -89,21 +83,17 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping("/updatePwd")
-    public AjaxResult updatePwd(String oldPassword, String newPassword)
-    {
+    public AjaxResult updatePwd(String oldPassword, String newPassword) {
         LoginUser loginUser = getLoginUser();
         String userName = loginUser.getUsername();
         String password = loginUser.getPassword();
-        if (!SecurityUtils.matchesPassword(oldPassword, password))
-        {
+        if (!SecurityUtils.matchesPassword(oldPassword, password)) {
             return error("修改密码失败,旧密码错误");
         }
-        if (SecurityUtils.matchesPassword(newPassword, password))
-        {
+        if (SecurityUtils.matchesPassword(newPassword, password)) {
             return error("新密码不能与旧密码相同");
         }
-        if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
-        {
+        if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
             // 更新缓存用户密码
             loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
             tokenService.setLoginUser(loginUser);
@@ -117,14 +107,11 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "用户头像", businessType = BusinessType.UPDATE)
     @PostMapping("/avatar")
-    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
-    {
-        if (!file.isEmpty())
-        {
+    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
+        if (!file.isEmpty()) {
             LoginUser loginUser = getLoginUser();
             String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
-            if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
-            {
+            if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
                 AjaxResult ajax = AjaxResult.success();
                 ajax.put("imgUrl", avatar);
                 // 更新缓存用户头像

+ 4 - 7
hx-base/src/main/java/com/fjhx/base/system/SysRegisterController.java

@@ -15,13 +15,12 @@ import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 注册验证
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @DataSource(DataSourceType.SLAVE)
-public class SysRegisterController extends BaseController
-{
+public class SysRegisterController extends BaseController {
     @Autowired
     private SysRegisterService registerService;
 
@@ -29,10 +28,8 @@ public class SysRegisterController extends BaseController
     private ISysConfigService configService;
 
     @PostMapping("/register")
-    public AjaxResult register(@RequestBody RegisterBody user)
-    {
-        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
-        {
+    public AjaxResult register(@RequestBody RegisterBody user) {
+        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
             return error("当前系统没有开启注册功能!");
         }
         String msg = registerService.register(user);

+ 21 - 43
hx-base/src/main/java/com/fjhx/base/system/SysRoleController.java

@@ -29,14 +29,13 @@ import java.util.List;
 
 /**
  * 角色信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/role")
 @DataSource(DataSourceType.SLAVE)
-public class SysRoleController extends BaseController
-{
+public class SysRoleController extends BaseController {
     @Autowired
     private ISysRoleService roleService;
 
@@ -54,8 +53,7 @@ public class SysRoleController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysRole role)
-    {
+    public TableDataInfo list(SysRole role) {
         startPage();
         List<SysRole> list = roleService.selectRoleList(role);
         return getDataTable(list);
@@ -64,8 +62,7 @@ public class SysRoleController extends BaseController
     @Log(title = "角色管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:role:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysRole role)
-    {
+    public void export(HttpServletResponse response, SysRole role) {
         List<SysRole> list = roleService.selectRoleList(role);
         ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
         util.exportExcel(response, list, "角色数据");
@@ -76,8 +73,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping(value = "/{roleId}")
-    public AjaxResult getInfo(@PathVariable Long roleId)
-    {
+    public AjaxResult getInfo(@PathVariable Long roleId) {
         roleService.checkRoleDataScope(roleId);
         return success(roleService.selectRoleById(roleId));
     }
@@ -88,14 +84,10 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:add')")
     @Log(title = "角色管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysRole role)
-    {
-        if (!roleService.checkRoleNameUnique(role))
-        {
+    public AjaxResult add(@Validated @RequestBody SysRole role) {
+        if (!roleService.checkRoleNameUnique(role)) {
             return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (!roleService.checkRoleKeyUnique(role))
-        {
+        } else if (!roleService.checkRoleKeyUnique(role)) {
             return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setCreateBy(getUsername());
@@ -109,16 +101,12 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysRole role)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
-        if (!roleService.checkRoleNameUnique(role))
-        {
+        if (!roleService.checkRoleNameUnique(role)) {
             return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (!roleService.checkRoleKeyUnique(role))
-        {
+        } else if (!roleService.checkRoleKeyUnique(role)) {
             return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setUpdateBy(getUsername());
@@ -143,8 +131,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/dataScope")
-    public AjaxResult dataScope(@RequestBody SysRole role)
-    {
+    public AjaxResult dataScope(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         return toAjax(roleService.authDataScope(role));
@@ -156,8 +143,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysRole role)
-    {
+    public AjaxResult changeStatus(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         role.setUpdateBy(getUsername());
@@ -170,8 +156,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:remove')")
     @Log(title = "角色管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{roleIds}")
-    public AjaxResult remove(@PathVariable Long[] roleIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] roleIds) {
         return toAjax(roleService.deleteRoleByIds(roleIds));
     }
 
@@ -180,8 +165,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         return success(roleService.selectRoleAll());
     }
 
@@ -190,8 +174,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/allocatedList")
-    public TableDataInfo allocatedList(SysUser user)
-    {
+    public TableDataInfo allocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectAllocatedList(user);
         return getDataTable(list);
@@ -202,8 +185,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/unallocatedList")
-    public TableDataInfo unallocatedList(SysUser user)
-    {
+    public TableDataInfo unallocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUnallocatedList(user);
         return getDataTable(list);
@@ -215,8 +197,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancel")
-    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
-    {
+    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
         return toAjax(roleService.deleteAuthUser(userRole));
     }
 
@@ -226,8 +207,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancelAll")
-    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
         return toAjax(roleService.deleteAuthUsers(roleId, userIds));
     }
 
@@ -237,8 +217,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/selectAll")
-    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
         roleService.checkRoleDataScope(roleId);
         return toAjax(roleService.insertAuthUsers(roleId, userIds));
     }
@@ -248,8 +227,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping(value = "/deptTree/{roleId}")
-    public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
-    {
+    public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
         AjaxResult ajax = AjaxResult.success();
         ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
         ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));

+ 24 - 50
hx-base/src/main/java/com/fjhx/base/system/SysUserController.java

@@ -30,14 +30,13 @@ import java.util.stream.Collectors;
 
 /**
  * 用户信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/user")
 @DataSource(DataSourceType.SLAVE)
-public class SysUserController extends BaseController
-{
+public class SysUserController extends BaseController {
     @Autowired
     private ISysUserService userService;
 
@@ -55,8 +54,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysUser user)
-    {
+    public TableDataInfo list(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUserList(user);
         return getDataTable(list);
@@ -65,8 +63,7 @@ public class SysUserController extends BaseController
     @Log(title = "用户管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:user:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysUser user)
-    {
+    public void export(HttpServletResponse response, SysUser user) {
         List<SysUser> list = userService.selectUserList(user);
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         util.exportExcel(response, list, "用户数据");
@@ -75,8 +72,7 @@ public class SysUserController extends BaseController
     @Log(title = "用户管理", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('system:user:import')")
     @PostMapping("/importData")
-    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
-    {
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         List<SysUser> userList = util.importExcel(file.getInputStream());
         String operName = getUsername();
@@ -85,8 +81,7 @@ public class SysUserController extends BaseController
     }
 
     @PostMapping("/importTemplate")
-    public void importTemplate(HttpServletResponse response)
-    {
+    public void importTemplate(HttpServletResponse response) {
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         util.importTemplateExcel(response, "用户数据");
     }
@@ -95,16 +90,14 @@ public class SysUserController extends BaseController
      * 根据用户编号获取详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:user:query')")
-    @GetMapping(value = { "/", "/{userId}" })
-    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
-    {
+    @GetMapping(value = {"/", "/{userId}"})
+    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
         userService.checkUserDataScope(userId);
         AjaxResult ajax = AjaxResult.success();
         List<SysRole> roles = roleService.selectRoleAll();
         ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
         ajax.put("posts", postService.selectPostAll());
-        if (StringUtils.isNotNull(userId))
-        {
+        if (StringUtils.isNotNull(userId)) {
             SysUser sysUser = userService.selectUserById(userId);
             ajax.put(AjaxResult.DATA_TAG, sysUser);
             ajax.put("postIds", postService.selectPostListByUserId(userId));
@@ -119,18 +112,12 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:add')")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysUser user)
-    {
-        if (!userService.checkUserNameUnique(user))
-        {
+    public AjaxResult add(@Validated @RequestBody SysUser user) {
+        if (!userService.checkUserNameUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setCreateBy(getUsername());
@@ -144,20 +131,14 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysUser user)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
-        if (!userService.checkUserNameUnique(user))
-        {
+        if (!userService.checkUserNameUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUpdateBy(getUsername());
@@ -170,10 +151,8 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:remove')")
     @Log(title = "用户管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{userIds}")
-    public AjaxResult remove(@PathVariable Long[] userIds)
-    {
-        if (ArrayUtils.contains(userIds, getUserId()))
-        {
+    public AjaxResult remove(@PathVariable Long[] userIds) {
+        if (ArrayUtils.contains(userIds, getUserId())) {
             return error("当前用户不能删除");
         }
         return toAjax(userService.deleteUserByIds(userIds));
@@ -185,8 +164,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/resetPwd")
-    public AjaxResult resetPwd(@RequestBody SysUser user)
-    {
+    public AjaxResult resetPwd(@RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
@@ -200,8 +178,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysUser user)
-    {
+    public AjaxResult changeStatus(@RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
         user.setUpdateBy(getUsername());
@@ -213,8 +190,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:query')")
     @GetMapping("/authRole/{userId}")
-    public AjaxResult authRole(@PathVariable("userId") Long userId)
-    {
+    public AjaxResult authRole(@PathVariable("userId") Long userId) {
         AjaxResult ajax = AjaxResult.success();
         SysUser user = userService.selectUserById(userId);
         List<SysRole> roles = roleService.selectRolesByUserId(userId);
@@ -229,8 +205,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.GRANT)
     @PutMapping("/authRole")
-    public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
-    {
+    public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
         userService.checkUserDataScope(userId);
         userService.insertUserAuth(userId, roleIds);
         return success();
@@ -241,8 +216,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
     @GetMapping("/deptTree")
-    public AjaxResult deptTree(SysDept dept)
-    {
+    public AjaxResult deptTree(SysDept dept) {
         return success(deptService.selectDeptTreeList(dept));
     }
 }

+ 2 - 2
hx-socket/src/main/java/com/fjhx/socket/event/WebSocketSendFailEvent.java

@@ -1,8 +1,8 @@
 package com.fjhx.socket.event;
 
 
-import com.fjhx.socket.service.WebSocketServer;
 import com.fjhx.socket.entity.MessageEntity;
+import com.fjhx.socket.service.WebSocketServer;
 import lombok.Getter;
 import org.springframework.context.ApplicationEvent;
 
@@ -21,7 +21,7 @@ public class WebSocketSendFailEvent extends ApplicationEvent {
 
     @Override
     public WebSocketServer getSource() {
-        return (WebSocketServer)super.getSource();
+        return (WebSocketServer) super.getSource();
     }
 
 }

+ 66 - 67
hx-socket/src/main/java/com/fjhx/socket/service/WebSocketServer.java

@@ -33,6 +33,7 @@ public class WebSocketServer {
      * concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
      */
     private static final Map<Long, Map<Long, WebSocketServer>> webSocketMap = new ConcurrentHashMap<>();
+    private static final TokenService tokenService = SpringUtil.getBean(TokenService.class);
     /**
      * 与某个客户端的连接会话,需要通过它来给客户端发送数据
      */
@@ -46,7 +47,71 @@ public class WebSocketServer {
      */
     private Long sessionId;
 
-    private static final TokenService tokenService = SpringUtil.getBean(TokenService.class);
+    /**
+     * 发送自定义消息
+     *
+     * @param userId  发送用户
+     * @param type    消息类型
+     * @param message 消息内容
+     */
+    public static void sendInfo(Long userId, Integer type, Object message) {
+        Map<Long, WebSocketServer> sessionIdWebSocketServerMap = webSocketMap.get(userId);
+
+        if (sessionIdWebSocketServerMap == null) {
+            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
+            return;
+        }
+
+        for (WebSocketServer webSocketServer : sessionIdWebSocketServerMap.values()) {
+            webSocketServer.sendMessage(type, message);
+        }
+
+    }
+
+    /**
+     * 发送自定义消息
+     *
+     * @param userId    发送用户
+     * @param sessionId sessionId
+     * @param type      消息类型
+     * @param message   消息内容
+     */
+    public static void sendInfo(Long userId, Long sessionId, Integer type, Object message) {
+        Map<Long, WebSocketServer> sessionIdWebSocketServerMap = webSocketMap.get(userId);
+
+        if (sessionIdWebSocketServerMap == null) {
+            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
+            return;
+        }
+
+        WebSocketServer webSocketServer = sessionIdWebSocketServerMap.get(sessionId);
+        if (webSocketServer != null) {
+            webSocketServer.sendMessage(type, message);
+        } else {
+            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
+        }
+
+    }
+
+    /**
+     * 发送自定义消息--群发
+     *
+     * @param message 消息内容
+     */
+    public static void sendInfoGroup(Integer type, Object message) {
+        if (webSocketMap.size() > 0) {
+            for (Long userId : WebSocketServer.webSocketMap.keySet()) {
+                sendInfo(userId, type, message);
+            }
+        }
+    }
+
+    /**
+     * 在线人数
+     */
+    public static int getOnlineCount() {
+        return webSocketMap.size();
+    }
 
     /**
      * 连接建立成功调用的方法
@@ -145,70 +210,4 @@ public class WebSocketServer {
         }
     }
 
-    /**
-     * 发送自定义消息
-     *
-     * @param userId  发送用户
-     * @param type    消息类型
-     * @param message 消息内容
-     */
-    public static void sendInfo(Long userId, Integer type, Object message) {
-        Map<Long, WebSocketServer> sessionIdWebSocketServerMap = webSocketMap.get(userId);
-
-        if (sessionIdWebSocketServerMap == null) {
-            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
-            return;
-        }
-
-        for (WebSocketServer webSocketServer : sessionIdWebSocketServerMap.values()) {
-            webSocketServer.sendMessage(type, message);
-        }
-
-    }
-
-    /**
-     * 发送自定义消息
-     *
-     * @param userId    发送用户
-     * @param sessionId sessionId
-     * @param type      消息类型
-     * @param message   消息内容
-     */
-    public static void sendInfo(Long userId, Long sessionId, Integer type, Object message) {
-        Map<Long, WebSocketServer> sessionIdWebSocketServerMap = webSocketMap.get(userId);
-
-        if (sessionIdWebSocketServerMap == null) {
-            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
-            return;
-        }
-
-        WebSocketServer webSocketServer = sessionIdWebSocketServerMap.get(sessionId);
-        if (webSocketServer != null) {
-            webSocketServer.sendMessage(type, message);
-        } else {
-            applicationContext.publishEvent(new WebSocketUserOfflineEvent(userId, message));
-        }
-
-    }
-
-    /**
-     * 发送自定义消息--群发
-     *
-     * @param message 消息内容
-     */
-    public static void sendInfoGroup(Integer type, Object message) {
-        if (webSocketMap.size() > 0) {
-            for (Long userId : WebSocketServer.webSocketMap.keySet()) {
-                sendInfo(userId, type, message);
-            }
-        }
-    }
-
-    /**
-     * 在线人数
-     */
-    public static int getOnlineCount() {
-        return webSocketMap.size();
-    }
-
 }

+ 3 - 5
ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java

@@ -5,14 +5,12 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
 
 /**
  * web容器中进行部署
- * 
+ *
  * @author ruoyi
  */
-public class RuoYiServletInitializer extends SpringBootServletInitializer
-{
+public class RuoYiServletInitializer extends SpringBootServletInitializer {
     @Override
-    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
-    {
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
         return application.sources(RuoYiApplication.class);
     }
 }

+ 20 - 29
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java

@@ -1,37 +1,35 @@
 package com.ruoyi.web.controller.common;
 
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import javax.annotation.Resource;
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.FastByteArrayOutputStream;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.google.code.kaptcha.Producer;
+import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.CacheConstants;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.sign.Base64;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 验证码操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @DataSource(DataSourceType.SLAVE)
-public class CaptchaController
-{
+public class CaptchaController {
     @Resource(name = "captchaProducer")
     private Producer captchaProducer;
 
@@ -40,7 +38,7 @@ public class CaptchaController
 
     @Autowired
     private RedisCache redisCache;
-    
+
     @Autowired
     private ISysConfigService configService;
 
@@ -52,8 +50,7 @@ public class CaptchaController
         AjaxResult ajax = AjaxResult.success();
         boolean captchaEnabled = configService.selectCaptchaEnabled();
         ajax.put("captchaEnabled", captchaEnabled);
-        if (!captchaEnabled)
-        {
+        if (!captchaEnabled) {
             return ajax;
         }
 
@@ -66,15 +63,12 @@ public class CaptchaController
 
         // 生成验证码
         String captchaType = RuoYiConfig.getCaptchaType();
-        if ("math".equals(captchaType))
-        {
+        if ("math".equals(captchaType)) {
             String capText = captchaProducerMath.createText();
             capStr = capText.substring(0, capText.lastIndexOf("@"));
             code = capText.substring(capText.lastIndexOf("@") + 1);
             image = captchaProducerMath.createImage(capStr);
-        }
-        else if ("char".equals(captchaType))
-        {
+        } else if ("char".equals(captchaType)) {
             capStr = code = captchaProducer.createText();
             image = captchaProducer.createImage(capStr);
         }
@@ -82,12 +76,9 @@ public class CaptchaController
         redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
         // 转换流信息写出
         FastByteArrayOutputStream os = new FastByteArrayOutputStream();
-        try
-        {
+        try {
             ImageIO.write(image, "jpg", os);
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             return AjaxResult.error(e.getMessage());
         }
 

+ 33 - 56
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -1,12 +1,14 @@
 package com.ruoyi.web.controller.common;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.common.utils.file.FileUtils;
+import com.ruoyi.framework.config.ServerConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,44 +18,36 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-import com.ruoyi.framework.config.ServerConfig;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 通用请求处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/common")
 @DataSource(DataSourceType.SLAVE)
-public class CommonController
-{
+public class CommonController {
     private static final Logger log = LoggerFactory.getLogger(CommonController.class);
-
+    private static final String FILE_DELIMETER = ",";
     @Autowired
     private ServerConfig serverConfig;
 
-    private static final String FILE_DELIMETER = ",";
-
     /**
      * 通用下载请求
-     * 
+     *
      * @param fileName 文件名称
-     * @param delete 是否删除
+     * @param delete   是否删除
      */
     @GetMapping("/download")
-    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(fileName))
-            {
+    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+        try {
+            if (!FileUtils.checkAllowDownload(fileName)) {
                 throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
             }
             String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@@ -62,13 +56,10 @@ public class CommonController
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, realFileName);
             FileUtils.writeBytes(filePath, response.getOutputStream());
-            if (delete)
-            {
+            if (delete) {
                 FileUtils.deleteFile(filePath);
             }
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("下载文件失败", e);
         }
     }
@@ -77,10 +68,8 @@ public class CommonController
      * 通用上传请求(单个)
      */
     @PostMapping("/upload")
-    public AjaxResult uploadFile(MultipartFile file) throws Exception
-    {
-        try
-        {
+    public AjaxResult uploadFile(MultipartFile file) throws Exception {
+        try {
             // 上传文件路径
             String filePath = RuoYiConfig.getUploadPath();
             // 上传并返回新文件名称
@@ -92,9 +81,7 @@ public class CommonController
             ajax.put("newFileName", FileUtils.getName(fileName));
             ajax.put("originalFilename", file.getOriginalFilename());
             return ajax;
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
     }
@@ -103,18 +90,15 @@ public class CommonController
      * 通用上传请求(多个)
      */
     @PostMapping("/uploads")
-    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
-    {
-        try
-        {
+    public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
+        try {
             // 上传文件路径
             String filePath = RuoYiConfig.getUploadPath();
             List<String> urls = new ArrayList<String>();
             List<String> fileNames = new ArrayList<String>();
             List<String> newFileNames = new ArrayList<String>();
             List<String> originalFilenames = new ArrayList<String>();
-            for (MultipartFile file : files)
-            {
+            for (MultipartFile file : files) {
                 // 上传并返回新文件名称
                 String fileName = FileUploadUtils.upload(filePath, file);
                 String url = serverConfig.getUrl() + fileName;
@@ -129,9 +113,7 @@ public class CommonController
             ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
             ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
             return ajax;
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
     }
@@ -141,12 +123,9 @@ public class CommonController
      */
     @GetMapping("/download/resource")
     public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
-            throws Exception
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(resource))
-            {
+            throws Exception {
+        try {
+            if (!FileUtils.checkAllowDownload(resource)) {
                 throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
             }
             // 本地资源路径
@@ -158,9 +137,7 @@ public class CommonController
             response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
             FileUtils.setAttachmentResponseHeader(response, downloadName);
             FileUtils.writeBytes(downloadPath, response.getOutputStream());
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("下载文件失败", e);
         }
     }

+ 17 - 35
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java

@@ -1,43 +1,32 @@
 package com.ruoyi.web.controller.monitor;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
 import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.constant.CacheConstants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisCallback;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.constant.CacheConstants;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.system.domain.SysCache;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
 
 /**
  * 缓存监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/cache")
 @DataSource(DataSourceType.SLAVE)
-public class CacheController
-{
+public class CacheController {
+    private final static List<SysCache> caches = new ArrayList<SysCache>();
     @Autowired
     private RedisTemplate<String, String> redisTemplate;
 
-    private final static List<SysCache> caches = new ArrayList<SysCache>();
     {
         caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
         caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
@@ -50,8 +39,7 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping()
-    public AjaxResult getInfo() throws Exception
-    {
+    public AjaxResult getInfo() throws Exception {
         Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
         Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
         Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
@@ -74,23 +62,20 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getNames")
-    public AjaxResult cache()
-    {
+    public AjaxResult cache() {
         return AjaxResult.success(caches);
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getKeys/{cacheName}")
-    public AjaxResult getCacheKeys(@PathVariable String cacheName)
-    {
+    public AjaxResult getCacheKeys(@PathVariable String cacheName) {
         Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
         return AjaxResult.success(cacheKeys);
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @GetMapping("/getValue/{cacheName}/{cacheKey}")
-    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
-    {
+    public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) {
         String cacheValue = redisTemplate.opsForValue().get(cacheKey);
         SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
         return AjaxResult.success(sysCache);
@@ -98,8 +83,7 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheName/{cacheName}")
-    public AjaxResult clearCacheName(@PathVariable String cacheName)
-    {
+    public AjaxResult clearCacheName(@PathVariable String cacheName) {
         Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
         redisTemplate.delete(cacheKeys);
         return AjaxResult.success();
@@ -107,16 +91,14 @@ public class CacheController
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheKey/{cacheKey}")
-    public AjaxResult clearCacheKey(@PathVariable String cacheKey)
-    {
+    public AjaxResult clearCacheKey(@PathVariable String cacheKey) {
         redisTemplate.delete(cacheKey);
         return AjaxResult.success();
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
     @DeleteMapping("/clearCacheAll")
-    public AjaxResult clearCacheAll()
-    {
+    public AjaxResult clearCacheAll() {
         Collection<String> cacheKeys = redisTemplate.keys("*");
         redisTemplate.delete(cacheKeys);
         return AjaxResult.success();

+ 5 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java

@@ -1,28 +1,26 @@
 package com.ruoyi.web.controller.monitor;
 
 import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.framework.web.domain.Server;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.Server;
 
 /**
  * 服务器监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/server")
 @DataSource(DataSourceType.SLAVE)
-public class ServerController
-{
+public class ServerController {
     @PreAuthorize("@ss.hasPermi('monitor:server:list')")
     @GetMapping()
-    public AjaxResult getInfo() throws Exception
-    {
+    public AjaxResult getInfo() throws Exception {
         Server server = new Server();
         server.copyTo();
         return AjaxResult.success(server);

+ 14 - 25
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java

@@ -1,38 +1,32 @@
 package com.ruoyi.web.controller.monitor;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.service.SysPasswordService;
 import com.ruoyi.system.domain.SysLogininfor;
 import com.ruoyi.system.service.ISysLogininforService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 系统访问记录
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/logininfor")
 @DataSource(DataSourceType.SLAVE)
-public class SysLogininforController extends BaseController
-{
+public class SysLogininforController extends BaseController {
     @Autowired
     private ISysLogininforService logininforService;
 
@@ -41,8 +35,7 @@ public class SysLogininforController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysLogininfor logininfor)
-    {
+    public TableDataInfo list(SysLogininfor logininfor) {
         startPage();
         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
         return getDataTable(list);
@@ -51,8 +44,7 @@ public class SysLogininforController extends BaseController
     @Log(title = "登录日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysLogininfor logininfor)
-    {
+    public void export(HttpServletResponse response, SysLogininfor logininfor) {
         List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
         ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
         util.exportExcel(response, list, "登录日志");
@@ -61,16 +53,14 @@ public class SysLogininforController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
     @Log(title = "登录日志", businessType = BusinessType.DELETE)
     @DeleteMapping("/{infoIds}")
-    public AjaxResult remove(@PathVariable Long[] infoIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] infoIds) {
         return toAjax(logininforService.deleteLogininforByIds(infoIds));
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
     @Log(title = "登录日志", businessType = BusinessType.CLEAN)
     @DeleteMapping("/clean")
-    public AjaxResult clean()
-    {
+    public AjaxResult clean() {
         logininforService.cleanLogininfor();
         return success();
     }
@@ -78,8 +68,7 @@ public class SysLogininforController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
     @Log(title = "账户解锁", businessType = BusinessType.OTHER)
     @GetMapping("/unlock/{userName}")
-    public AjaxResult unlock(@PathVariable("userName") String userName)
-    {
+    public AjaxResult unlock(@PathVariable("userName") String userName) {
         passwordService.clearLoginRecordCache(userName);
         return success();
     }

+ 13 - 23
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java

@@ -1,44 +1,37 @@
 package com.ruoyi.web.controller.monitor;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysOperLog;
 import com.ruoyi.system.service.ISysOperLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 操作日志记录
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/operlog")
 @DataSource(DataSourceType.SLAVE)
-public class SysOperlogController extends BaseController
-{
+public class SysOperlogController extends BaseController {
     @Autowired
     private ISysOperLogService operLogService;
 
     @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysOperLog operLog)
-    {
+    public TableDataInfo list(SysOperLog operLog) {
         startPage();
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         return getDataTable(list);
@@ -47,8 +40,7 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysOperLog operLog)
-    {
+    public void export(HttpServletResponse response, SysOperLog operLog) {
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
         ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
         util.exportExcel(response, list, "操作日志");
@@ -57,16 +49,14 @@ public class SysOperlogController extends BaseController
     @Log(title = "操作日志", businessType = BusinessType.DELETE)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/{operIds}")
-    public AjaxResult remove(@PathVariable Long[] operIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] operIds) {
         return toAjax(operLogService.deleteOperLogByIds(operIds));
     }
 
     @Log(title = "操作日志", businessType = BusinessType.CLEAN)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
     @DeleteMapping("/clean")
-    public AjaxResult clean()
-    {
+    public AjaxResult clean() {
         operLogService.cleanOperLog();
         return success();
     }

+ 9 - 20
ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java

@@ -24,14 +24,13 @@ import java.util.List;
 
 /**
  * 在线用户监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/monitor/online")
 @DataSource(DataSourceType.SLAVE)
-public class SysUserOnlineController extends BaseController
-{
+public class SysUserOnlineController extends BaseController {
     @Autowired
     private ISysUserOnlineService userOnlineService;
 
@@ -40,27 +39,18 @@ public class SysUserOnlineController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('monitor:online:list')")
     @GetMapping("/list")
-    public TableDataInfo list(String ipaddr, String userName)
-    {
+    public TableDataInfo list(String ipaddr, String userName) {
         Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
         List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
-        for (String key : keys)
-        {
+        for (String key : keys) {
             LoginUser user = redisCache.getCacheObject(key);
-            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
-            {
+            if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
                 userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
-            }
-            else if (StringUtils.isNotEmpty(ipaddr))
-            {
+            } else if (StringUtils.isNotEmpty(ipaddr)) {
                 userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
-            }
-            else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
-            {
+            } else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
                 userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
-            }
-            else
-            {
+            } else {
                 userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
             }
         }
@@ -75,8 +65,7 @@ public class SysUserOnlineController extends BaseController
     @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
     @Log(title = "在线用户", businessType = BusinessType.FORCE)
     @DeleteMapping("/{tokenId}")
-    public AjaxResult forceLogout(@PathVariable String tokenId)
-    {
+    public AjaxResult forceLogout(@PathVariable String tokenId) {
         redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
         return success();
     }

+ 20 - 38
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java

@@ -1,40 +1,32 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 参数配置 信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/config")
 @DataSource(DataSourceType.SLAVE)
-public class SysConfigController extends BaseController
-{
+public class SysConfigController extends BaseController {
     @Autowired
     private ISysConfigService configService;
 
@@ -43,8 +35,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysConfig config)
-    {
+    public TableDataInfo list(SysConfig config) {
         startPage();
         List<SysConfig> list = configService.selectConfigList(config);
         return getDataTable(list);
@@ -53,8 +44,7 @@ public class SysConfigController extends BaseController
     @Log(title = "参数管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:config:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysConfig config)
-    {
+    public void export(HttpServletResponse response, SysConfig config) {
         List<SysConfig> list = configService.selectConfigList(config);
         ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
         util.exportExcel(response, list, "参数数据");
@@ -65,8 +55,7 @@ public class SysConfigController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:config:query')")
     @GetMapping(value = "/{configId}")
-    public AjaxResult getInfo(@PathVariable Long configId)
-    {
+    public AjaxResult getInfo(@PathVariable Long configId) {
         return success(configService.selectConfigById(configId));
     }
 
@@ -74,8 +63,7 @@ public class SysConfigController extends BaseController
      * 根据参数键名查询参数值
      */
     @GetMapping(value = "/configKey/{configKey}")
-    public AjaxResult getConfigKey(@PathVariable String configKey)
-    {
+    public AjaxResult getConfigKey(@PathVariable String configKey) {
         return success(configService.selectConfigByKey(configKey));
     }
 
@@ -85,10 +73,8 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:add')")
     @Log(title = "参数管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysConfig config)
-    {
-        if (!configService.checkConfigKeyUnique(config))
-        {
+    public AjaxResult add(@Validated @RequestBody SysConfig config) {
+        if (!configService.checkConfigKeyUnique(config)) {
             return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setCreateBy(getUsername());
@@ -101,10 +87,8 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:edit')")
     @Log(title = "参数管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysConfig config)
-    {
-        if (!configService.checkConfigKeyUnique(config))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysConfig config) {
+        if (!configService.checkConfigKeyUnique(config)) {
             return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
         }
         config.setUpdateBy(getUsername());
@@ -117,8 +101,7 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{configIds}")
-    public AjaxResult remove(@PathVariable Long[] configIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] configIds) {
         configService.deleteConfigByIds(configIds);
         return success();
     }
@@ -129,8 +112,7 @@ public class SysConfigController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:config:remove')")
     @Log(title = "参数管理", businessType = BusinessType.CLEAN)
     @DeleteMapping("/refreshCache")
-    public AjaxResult refreshCache()
-    {
+    public AjaxResult refreshCache() {
         configService.resetConfigCache();
         return success();
     }

+ 22 - 44
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java

@@ -1,40 +1,32 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.apache.commons.lang3.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.service.ISysDeptService;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 部门信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dept")
 @DataSource(DataSourceType.SLAVE)
-public class SysDeptController extends BaseController
-{
+public class SysDeptController extends BaseController {
     @Autowired
     private ISysDeptService deptService;
 
@@ -43,8 +35,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list")
-    public AjaxResult list(SysDept dept)
-    {
+    public AjaxResult list(SysDept dept) {
         List<SysDept> depts = deptService.selectDeptList(dept);
         return success(depts);
     }
@@ -54,8 +45,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:list')")
     @GetMapping("/list/exclude/{deptId}")
-    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
-    {
+    public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
         List<SysDept> depts = deptService.selectDeptList(new SysDept());
         depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
         return success(depts);
@@ -66,8 +56,7 @@ public class SysDeptController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dept:query')")
     @GetMapping(value = "/{deptId}")
-    public AjaxResult getInfo(@PathVariable Long deptId)
-    {
+    public AjaxResult getInfo(@PathVariable Long deptId) {
         deptService.checkDeptDataScope(deptId);
         return success(deptService.selectDeptById(deptId));
     }
@@ -78,10 +67,8 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:add')")
     @Log(title = "部门管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDept dept)
-    {
-        if (!deptService.checkDeptNameUnique(dept))
-        {
+    public AjaxResult add(@Validated @RequestBody SysDept dept) {
+        if (!deptService.checkDeptNameUnique(dept)) {
             return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
         }
         dept.setCreateBy(getUsername());
@@ -94,20 +81,14 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:edit')")
     @Log(title = "部门管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDept dept)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysDept dept) {
         Long deptId = dept.getDeptId();
         deptService.checkDeptDataScope(deptId);
-        if (!deptService.checkDeptNameUnique(dept))
-        {
+        if (!deptService.checkDeptNameUnique(dept)) {
             return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
-        }
-        else if (dept.getParentId().equals(deptId))
-        {
+        } else if (dept.getParentId().equals(deptId)) {
             return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
-        }
-        else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
-        {
+        } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
             return error("该部门包含未停用的子部门!");
         }
         dept.setUpdateBy(getUsername());
@@ -120,14 +101,11 @@ public class SysDeptController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dept:remove')")
     @Log(title = "部门管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{deptId}")
-    public AjaxResult remove(@PathVariable Long deptId)
-    {
-        if (deptService.hasChildByDeptId(deptId))
-        {
+    public AjaxResult remove(@PathVariable Long deptId) {
+        if (deptService.hasChildByDeptId(deptId)) {
             return warn("存在下级部门,不允许删除");
         }
-        if (deptService.checkDeptExistUser(deptId))
-        {
+        if (deptService.checkDeptExistUser(deptId)) {
             return warn("部门存在用户,不允许删除");
         }
         deptService.checkDeptDataScope(deptId);

+ 19 - 35
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java

@@ -1,43 +1,35 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.service.ISysDictDataService;
 import com.ruoyi.system.service.ISysDictTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 数据字典信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dict/data")
 @DataSource(DataSourceType.SLAVE)
-public class SysDictDataController extends BaseController
-{
+public class SysDictDataController extends BaseController {
     @Autowired
     private ISysDictDataService dictDataService;
 
@@ -46,8 +38,7 @@ public class SysDictDataController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictData dictData)
-    {
+    public TableDataInfo list(SysDictData dictData) {
         startPage();
         List<SysDictData> list = dictDataService.selectDictDataList(dictData);
         return getDataTable(list);
@@ -56,8 +47,7 @@ public class SysDictDataController extends BaseController
     @Log(title = "字典数据", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:dict:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysDictData dictData)
-    {
+    public void export(HttpServletResponse response, SysDictData dictData) {
         List<SysDictData> list = dictDataService.selectDictDataList(dictData);
         ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
         util.exportExcel(response, list, "字典数据");
@@ -68,8 +58,7 @@ public class SysDictDataController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictCode}")
-    public AjaxResult getInfo(@PathVariable Long dictCode)
-    {
+    public AjaxResult getInfo(@PathVariable Long dictCode) {
         return success(dictDataService.selectDictDataById(dictCode));
     }
 
@@ -77,11 +66,9 @@ public class SysDictDataController extends BaseController
      * 根据字典类型查询字典数据信息
      */
     @GetMapping(value = "/type/{dictType}")
-    public AjaxResult dictType(@PathVariable String dictType)
-    {
+    public AjaxResult dictType(@PathVariable String dictType) {
         List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
-        if (StringUtils.isNull(data))
-        {
+        if (StringUtils.isNull(data)) {
             data = new ArrayList<SysDictData>();
         }
         return success(data);
@@ -93,8 +80,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @Log(title = "字典数据", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDictData dict)
-    {
+    public AjaxResult add(@Validated @RequestBody SysDictData dict) {
         dict.setCreateBy(getUsername());
         return toAjax(dictDataService.insertDictData(dict));
     }
@@ -105,8 +91,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @Log(title = "字典数据", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDictData dict)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
         dict.setUpdateBy(getUsername());
         return toAjax(dictDataService.updateDictData(dict));
     }
@@ -117,8 +102,7 @@ public class SysDictDataController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.DELETE)
     @DeleteMapping("/{dictCodes}")
-    public AjaxResult remove(@PathVariable Long[] dictCodes)
-    {
+    public AjaxResult remove(@PathVariable Long[] dictCodes) {
         dictDataService.deleteDictDataByIds(dictCodes);
         return success();
     }

+ 20 - 38
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java

@@ -1,47 +1,38 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDictType;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.service.ISysDictTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 数据字典信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/dict/type")
 @DataSource(DataSourceType.SLAVE)
-public class SysDictTypeController extends BaseController
-{
+public class SysDictTypeController extends BaseController {
     @Autowired
     private ISysDictTypeService dictTypeService;
 
     @PreAuthorize("@ss.hasPermi('system:dict:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysDictType dictType)
-    {
+    public TableDataInfo list(SysDictType dictType) {
         startPage();
         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
         return getDataTable(list);
@@ -50,8 +41,7 @@ public class SysDictTypeController extends BaseController
     @Log(title = "字典类型", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:dict:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysDictType dictType)
-    {
+    public void export(HttpServletResponse response, SysDictType dictType) {
         List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
         ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
         util.exportExcel(response, list, "字典类型");
@@ -62,8 +52,7 @@ public class SysDictTypeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:dict:query')")
     @GetMapping(value = "/{dictId}")
-    public AjaxResult getInfo(@PathVariable Long dictId)
-    {
+    public AjaxResult getInfo(@PathVariable Long dictId) {
         return success(dictTypeService.selectDictTypeById(dictId));
     }
 
@@ -73,10 +62,8 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:add')")
     @Log(title = "字典类型", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysDictType dict)
-    {
-        if (!dictTypeService.checkDictTypeUnique(dict))
-        {
+    public AjaxResult add(@Validated @RequestBody SysDictType dict) {
+        if (!dictTypeService.checkDictTypeUnique(dict)) {
             return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
         dict.setCreateBy(getUsername());
@@ -89,10 +76,8 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:edit')")
     @Log(title = "字典类型", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysDictType dict)
-    {
-        if (!dictTypeService.checkDictTypeUnique(dict))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
+        if (!dictTypeService.checkDictTypeUnique(dict)) {
             return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
         }
         dict.setUpdateBy(getUsername());
@@ -105,8 +90,7 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.DELETE)
     @DeleteMapping("/{dictIds}")
-    public AjaxResult remove(@PathVariable Long[] dictIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] dictIds) {
         dictTypeService.deleteDictTypeByIds(dictIds);
         return success();
     }
@@ -117,8 +101,7 @@ public class SysDictTypeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:dict:remove')")
     @Log(title = "字典类型", businessType = BusinessType.CLEAN)
     @DeleteMapping("/refreshCache")
-    public AjaxResult refreshCache()
-    {
+    public AjaxResult refreshCache() {
         dictTypeService.resetDictCache();
         return success();
     }
@@ -127,8 +110,7 @@ public class SysDictTypeController extends BaseController
      * 获取字典选择框列表
      */
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
         return success(dictTypes);
     }

+ 7 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java

@@ -1,10 +1,10 @@
 package com.ruoyi.web.controller.system;
 
+import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 首页
@@ -12,9 +12,10 @@ import com.ruoyi.common.utils.StringUtils;
  * @author ruoyi
  */
 @RestController
-public class SysIndexController
-{
-    /** 系统基础配置 */
+public class SysIndexController {
+    /**
+     * 系统基础配置
+     */
     @Autowired
     private RuoYiConfig ruoyiConfig;
 
@@ -22,8 +23,7 @@ public class SysIndexController
      * 访问首页,提示语
      */
     @RequestMapping("/")
-    public String index()
-    {
+    public String index() {
         return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
     }
 }

+ 4 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -62,12 +62,11 @@ public class SysLoginController {
 
     /**
      * 获取用户信息
-     * 
+     *
      * @return 用户信息
      */
     @GetMapping("getInfo")
-    public AjaxResult getInfo()
-    {
+    public AjaxResult getInfo() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);
@@ -82,12 +81,11 @@ public class SysLoginController {
 
     /**
      * 获取路由信息
-     * 
+     *
      * @return 路由信息
      */
     @GetMapping("getRouters")
-    public AjaxResult getRouters()
-    {
+    public AjaxResult getRouters() {
         Long userId = SecurityUtils.getUserId();
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
         return AjaxResult.success(menuService.buildMenus(menus));

+ 23 - 48
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java

@@ -1,39 +1,31 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysMenu;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.service.ISysMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 菜单信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/menu")
 @DataSource(DataSourceType.SLAVE)
-public class SysMenuController extends BaseController
-{
+public class SysMenuController extends BaseController {
     @Autowired
     private ISysMenuService menuService;
 
@@ -42,8 +34,7 @@ public class SysMenuController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:menu:list')")
     @GetMapping("/list")
-    public AjaxResult list(SysMenu menu)
-    {
+    public AjaxResult list(SysMenu menu) {
         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
         return success(menus);
     }
@@ -53,8 +44,7 @@ public class SysMenuController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:menu:query')")
     @GetMapping(value = "/{menuId}")
-    public AjaxResult getInfo(@PathVariable Long menuId)
-    {
+    public AjaxResult getInfo(@PathVariable Long menuId) {
         return success(menuService.selectMenuById(menuId));
     }
 
@@ -62,8 +52,7 @@ public class SysMenuController extends BaseController
      * 获取菜单下拉树列表
      */
     @GetMapping("/treeselect")
-    public AjaxResult treeselect(SysMenu menu)
-    {
+    public AjaxResult treeselect(SysMenu menu) {
         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
         return success(menuService.buildMenuTreeSelect(menus));
     }
@@ -72,8 +61,7 @@ public class SysMenuController extends BaseController
      * 加载对应角色菜单列表树
      */
     @GetMapping(value = "/roleMenuTreeselect/{roleId}")
-    public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
-    {
+    public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
         List<SysMenu> menus = menuService.selectMenuList(getUserId());
         AjaxResult ajax = AjaxResult.success();
         ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
@@ -87,14 +75,10 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:add')")
     @Log(title = "菜单管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysMenu menu)
-    {
-        if (!menuService.checkMenuNameUnique(menu))
-        {
+    public AjaxResult add(@Validated @RequestBody SysMenu menu) {
+        if (!menuService.checkMenuNameUnique(menu)) {
             return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
-        }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
-        {
+        } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
             return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
         }
         menu.setCreateBy(getUsername());
@@ -107,18 +91,12 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:edit')")
     @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysMenu menu)
-    {
-        if (!menuService.checkMenuNameUnique(menu))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
+        if (!menuService.checkMenuNameUnique(menu)) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
-        }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
-        {
+        } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
-        }
-        else if (menu.getMenuId().equals(menu.getParentId()))
-        {
+        } else if (menu.getMenuId().equals(menu.getParentId())) {
             return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
         }
         menu.setUpdateBy(getUsername());
@@ -131,14 +109,11 @@ public class SysMenuController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:menu:remove')")
     @Log(title = "菜单管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{menuId}")
-    public AjaxResult remove(@PathVariable("menuId") Long menuId)
-    {
-        if (menuService.hasChildByMenuId(menuId))
-        {
+    public AjaxResult remove(@PathVariable("menuId") Long menuId) {
+        if (menuService.hasChildByMenuId(menuId)) {
             return warn("存在子菜单,不允许删除");
         }
-        if (menuService.checkMenuExistRole(menuId))
-        {
+        if (menuService.checkMenuExistRole(menuId)) {
             return warn("菜单已分配,不允许删除");
         }
         return toAjax(menuService.deleteMenuById(menuId));

+ 14 - 27
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java

@@ -1,38 +1,30 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.system.domain.SysNotice;
 import com.ruoyi.system.service.ISysNoticeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * 公告 信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/notice")
 @DataSource(DataSourceType.SLAVE)
-public class SysNoticeController extends BaseController
-{
+public class SysNoticeController extends BaseController {
     @Autowired
     private ISysNoticeService noticeService;
 
@@ -41,8 +33,7 @@ public class SysNoticeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:notice:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysNotice notice)
-    {
+    public TableDataInfo list(SysNotice notice) {
         startPage();
         List<SysNotice> list = noticeService.selectNoticeList(notice);
         return getDataTable(list);
@@ -53,8 +44,7 @@ public class SysNoticeController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{noticeId}")
-    public AjaxResult getInfo(@PathVariable Long noticeId)
-    {
+    public AjaxResult getInfo(@PathVariable Long noticeId) {
         return success(noticeService.selectNoticeById(noticeId));
     }
 
@@ -64,8 +54,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:add')")
     @Log(title = "通知公告", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysNotice notice)
-    {
+    public AjaxResult add(@Validated @RequestBody SysNotice notice) {
         notice.setCreateBy(getUsername());
         return toAjax(noticeService.insertNotice(notice));
     }
@@ -76,8 +65,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:edit')")
     @Log(title = "通知公告", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysNotice notice)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
         notice.setUpdateBy(getUsername());
         return toAjax(noticeService.updateNotice(notice));
     }
@@ -88,8 +76,7 @@ public class SysNoticeController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:notice:remove')")
     @Log(title = "通知公告", businessType = BusinessType.DELETE)
     @DeleteMapping("/{noticeIds}")
-    public AjaxResult remove(@PathVariable Long[] noticeIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] noticeIds) {
         return toAjax(noticeService.deleteNoticeByIds(noticeIds));
     }
 }

+ 22 - 43
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java

@@ -1,40 +1,32 @@
 package com.ruoyi.web.controller.system;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysPost;
 import com.ruoyi.system.service.ISysPostService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 岗位信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/post")
 @DataSource(DataSourceType.SLAVE)
-public class SysPostController extends BaseController
-{
+public class SysPostController extends BaseController {
     @Autowired
     private ISysPostService postService;
 
@@ -43,18 +35,16 @@ public class SysPostController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:post:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysPost post)
-    {
+    public TableDataInfo list(SysPost post) {
         startPage();
         List<SysPost> list = postService.selectPostList(post);
         return getDataTable(list);
     }
-    
+
     @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:post:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysPost post)
-    {
+    public void export(HttpServletResponse response, SysPost post) {
         List<SysPost> list = postService.selectPostList(post);
         ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
         util.exportExcel(response, list, "岗位数据");
@@ -65,8 +55,7 @@ public class SysPostController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:post:query')")
     @GetMapping(value = "/{postId}")
-    public AjaxResult getInfo(@PathVariable Long postId)
-    {
+    public AjaxResult getInfo(@PathVariable Long postId) {
         return success(postService.selectPostById(postId));
     }
 
@@ -76,14 +65,10 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:add')")
     @Log(title = "岗位管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysPost post)
-    {
-        if (!postService.checkPostNameUnique(post))
-        {
+    public AjaxResult add(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
             return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
-        }
-        else if (!postService.checkPostCodeUnique(post))
-        {
+        } else if (!postService.checkPostCodeUnique(post)) {
             return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
         }
         post.setCreateBy(getUsername());
@@ -96,14 +81,10 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:edit')")
     @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysPost post)
-    {
-        if (!postService.checkPostNameUnique(post))
-        {
+    public AjaxResult edit(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
             return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
-        }
-        else if (!postService.checkPostCodeUnique(post))
-        {
+        } else if (!postService.checkPostCodeUnique(post)) {
             return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
         }
         post.setUpdateBy(getUsername());
@@ -116,8 +97,7 @@ public class SysPostController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:post:remove')")
     @Log(title = "岗位管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{postIds}")
-    public AjaxResult remove(@PathVariable Long[] postIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] postIds) {
         return toAjax(postService.deletePostByIds(postIds));
     }
 
@@ -125,8 +105,7 @@ public class SysPostController extends BaseController
      * 获取岗位选择框列表
      */
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         List<SysPost> posts = postService.selectPostAll();
         return success(posts);
     }

+ 18 - 37
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java

@@ -1,16 +1,6 @@
 package com.ruoyi.web.controller.system;
 
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.controller.BaseController;
@@ -18,23 +8,26 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.MimeTypeUtils;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 个人信息 业务处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/user/profile")
 @DataSource(DataSourceType.SLAVE)
-public class SysProfileController extends BaseController
-{
+public class SysProfileController extends BaseController {
     @Autowired
     private ISysUserService userService;
 
@@ -45,8 +38,7 @@ public class SysProfileController extends BaseController
      * 个人信息
      */
     @GetMapping
-    public AjaxResult profile()
-    {
+    public AjaxResult profile() {
         LoginUser loginUser = getLoginUser();
         SysUser user = loginUser.getUser();
         AjaxResult ajax = AjaxResult.success(user);
@@ -60,25 +52,21 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult updateProfile(@RequestBody SysUser user)
-    {
+    public AjaxResult updateProfile(@RequestBody SysUser user) {
         LoginUser loginUser = getLoginUser();
         SysUser sysUser = loginUser.getUser();
         user.setUserName(sysUser.getUserName());
-        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
         }
-        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUserId(sysUser.getUserId());
         user.setPassword(null);
         user.setAvatar(null);
         user.setDeptId(null);
-        if (userService.updateUserProfile(user) > 0)
-        {
+        if (userService.updateUserProfile(user) > 0) {
             // 更新缓存用户信息
             sysUser.setNickName(user.getNickName());
             sysUser.setPhonenumber(user.getPhonenumber());
@@ -95,21 +83,17 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "个人信息", businessType = BusinessType.UPDATE)
     @PutMapping("/updatePwd")
-    public AjaxResult updatePwd(String oldPassword, String newPassword)
-    {
+    public AjaxResult updatePwd(String oldPassword, String newPassword) {
         LoginUser loginUser = getLoginUser();
         String userName = loginUser.getUsername();
         String password = loginUser.getPassword();
-        if (!SecurityUtils.matchesPassword(oldPassword, password))
-        {
+        if (!SecurityUtils.matchesPassword(oldPassword, password)) {
             return error("修改密码失败,旧密码错误");
         }
-        if (SecurityUtils.matchesPassword(newPassword, password))
-        {
+        if (SecurityUtils.matchesPassword(newPassword, password)) {
             return error("新密码不能与旧密码相同");
         }
-        if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
-        {
+        if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
             // 更新缓存用户密码
             loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
             tokenService.setLoginUser(loginUser);
@@ -123,14 +107,11 @@ public class SysProfileController extends BaseController
      */
     @Log(title = "用户头像", businessType = BusinessType.UPDATE)
     @PostMapping("/avatar")
-    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
-    {
-        if (!file.isEmpty())
-        {
+    public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception {
+        if (!file.isEmpty()) {
             LoginUser loginUser = getLoginUser();
             String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
-            if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
-            {
+            if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) {
                 AjaxResult ajax = AjaxResult.success();
                 ajax.put("imgUrl", avatar);
                 // 更新缓存用户头像

+ 9 - 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java

@@ -1,27 +1,26 @@
 package com.ruoyi.web.controller.system;
 
 import com.ruoyi.common.annotation.DataSource;
-import com.ruoyi.common.enums.DataSourceType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.RegisterBody;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.web.service.SysRegisterService;
 import com.ruoyi.system.service.ISysConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * 注册验证
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @DataSource(DataSourceType.SLAVE)
-public class SysRegisterController extends BaseController
-{
+public class SysRegisterController extends BaseController {
     @Autowired
     private SysRegisterService registerService;
 
@@ -29,10 +28,8 @@ public class SysRegisterController extends BaseController
     private ISysConfigService configService;
 
     @PostMapping("/register")
-    public AjaxResult register(@RequestBody RegisterBody user)
-    {
-        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
-        {
+    public AjaxResult register(@RequestBody RegisterBody user) {
+        if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
             return error("当前系统没有开启注册功能!");
         }
         String msg = registerService.register(user);

+ 21 - 43
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -29,14 +29,13 @@ import java.util.List;
 
 /**
  * 角色信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/role")
 @DataSource(DataSourceType.SLAVE)
-public class SysRoleController extends BaseController
-{
+public class SysRoleController extends BaseController {
     @Autowired
     private ISysRoleService roleService;
 
@@ -54,8 +53,7 @@ public class SysRoleController extends BaseController
 
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysRole role)
-    {
+    public TableDataInfo list(SysRole role) {
         startPage();
         List<SysRole> list = roleService.selectRoleList(role);
         return getDataTable(list);
@@ -64,8 +62,7 @@ public class SysRoleController extends BaseController
     @Log(title = "角色管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:role:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysRole role)
-    {
+    public void export(HttpServletResponse response, SysRole role) {
         List<SysRole> list = roleService.selectRoleList(role);
         ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
         util.exportExcel(response, list, "角色数据");
@@ -76,8 +73,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping(value = "/{roleId}")
-    public AjaxResult getInfo(@PathVariable Long roleId)
-    {
+    public AjaxResult getInfo(@PathVariable Long roleId) {
         roleService.checkRoleDataScope(roleId);
         return success(roleService.selectRoleById(roleId));
     }
@@ -88,14 +84,10 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:add')")
     @Log(title = "角色管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysRole role)
-    {
-        if (!roleService.checkRoleNameUnique(role))
-        {
+    public AjaxResult add(@Validated @RequestBody SysRole role) {
+        if (!roleService.checkRoleNameUnique(role)) {
             return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (!roleService.checkRoleKeyUnique(role))
-        {
+        } else if (!roleService.checkRoleKeyUnique(role)) {
             return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setCreateBy(getUsername());
@@ -109,16 +101,12 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysRole role)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
-        if (!roleService.checkRoleNameUnique(role))
-        {
+        if (!roleService.checkRoleNameUnique(role)) {
             return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
-        }
-        else if (!roleService.checkRoleKeyUnique(role))
-        {
+        } else if (!roleService.checkRoleKeyUnique(role)) {
             return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
         }
         role.setUpdateBy(getUsername());
@@ -143,8 +131,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/dataScope")
-    public AjaxResult dataScope(@RequestBody SysRole role)
-    {
+    public AjaxResult dataScope(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         return toAjax(roleService.authDataScope(role));
@@ -156,8 +143,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysRole role)
-    {
+    public AjaxResult changeStatus(@RequestBody SysRole role) {
         roleService.checkRoleAllowed(role);
         roleService.checkRoleDataScope(role.getRoleId());
         role.setUpdateBy(getUsername());
@@ -170,8 +156,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:remove')")
     @Log(title = "角色管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{roleIds}")
-    public AjaxResult remove(@PathVariable Long[] roleIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] roleIds) {
         return toAjax(roleService.deleteRoleByIds(roleIds));
     }
 
@@ -180,8 +165,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping("/optionselect")
-    public AjaxResult optionselect()
-    {
+    public AjaxResult optionselect() {
         return success(roleService.selectRoleAll());
     }
 
@@ -190,8 +174,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/allocatedList")
-    public TableDataInfo allocatedList(SysUser user)
-    {
+    public TableDataInfo allocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectAllocatedList(user);
         return getDataTable(list);
@@ -202,8 +185,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:list')")
     @GetMapping("/authUser/unallocatedList")
-    public TableDataInfo unallocatedList(SysUser user)
-    {
+    public TableDataInfo unallocatedList(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUnallocatedList(user);
         return getDataTable(list);
@@ -215,8 +197,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancel")
-    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
-    {
+    public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
         return toAjax(roleService.deleteAuthUser(userRole));
     }
 
@@ -226,8 +207,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/cancelAll")
-    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
         return toAjax(roleService.deleteAuthUsers(roleId, userIds));
     }
 
@@ -237,8 +217,7 @@ public class SysRoleController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:role:edit')")
     @Log(title = "角色管理", businessType = BusinessType.GRANT)
     @PutMapping("/authUser/selectAll")
-    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
-    {
+    public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
         roleService.checkRoleDataScope(roleId);
         return toAjax(roleService.insertAuthUsers(roleId, userIds));
     }
@@ -248,8 +227,7 @@ public class SysRoleController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:role:query')")
     @GetMapping(value = "/deptTree/{roleId}")
-    public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
-    {
+    public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
         AjaxResult ajax = AjaxResult.success();
         ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
         ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));

+ 24 - 50
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -30,14 +30,13 @@ import java.util.stream.Collectors;
 
 /**
  * 用户信息
- * 
+ *
  * @author ruoyi
  */
 @RestController
 @RequestMapping("/system/user")
 @DataSource(DataSourceType.SLAVE)
-public class SysUserController extends BaseController
-{
+public class SysUserController extends BaseController {
     @Autowired
     private ISysUserService userService;
 
@@ -55,8 +54,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
     @GetMapping("/list")
-    public TableDataInfo list(SysUser user)
-    {
+    public TableDataInfo list(SysUser user) {
         startPage();
         List<SysUser> list = userService.selectUserList(user);
         return getDataTable(list);
@@ -65,8 +63,7 @@ public class SysUserController extends BaseController
     @Log(title = "用户管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:user:export')")
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysUser user)
-    {
+    public void export(HttpServletResponse response, SysUser user) {
         List<SysUser> list = userService.selectUserList(user);
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         util.exportExcel(response, list, "用户数据");
@@ -75,8 +72,7 @@ public class SysUserController extends BaseController
     @Log(title = "用户管理", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('system:user:import')")
     @PostMapping("/importData")
-    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
-    {
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         List<SysUser> userList = util.importExcel(file.getInputStream());
         String operName = getUsername();
@@ -85,8 +81,7 @@ public class SysUserController extends BaseController
     }
 
     @PostMapping("/importTemplate")
-    public void importTemplate(HttpServletResponse response)
-    {
+    public void importTemplate(HttpServletResponse response) {
         ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
         util.importTemplateExcel(response, "用户数据");
     }
@@ -95,16 +90,14 @@ public class SysUserController extends BaseController
      * 根据用户编号获取详细信息
      */
     @PreAuthorize("@ss.hasPermi('system:user:query')")
-    @GetMapping(value = { "/", "/{userId}" })
-    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
-    {
+    @GetMapping(value = {"/", "/{userId}"})
+    public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
         userService.checkUserDataScope(userId);
         AjaxResult ajax = AjaxResult.success();
         List<SysRole> roles = roleService.selectRoleAll();
         ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
         ajax.put("posts", postService.selectPostAll());
-        if (StringUtils.isNotNull(userId))
-        {
+        if (StringUtils.isNotNull(userId)) {
             SysUser sysUser = userService.selectUserById(userId);
             ajax.put(AjaxResult.DATA_TAG, sysUser);
             ajax.put("postIds", postService.selectPostListByUserId(userId));
@@ -119,18 +112,12 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:add')")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@Validated @RequestBody SysUser user)
-    {
-        if (!userService.checkUserNameUnique(user))
-        {
+    public AjaxResult add(@Validated @RequestBody SysUser user) {
+        if (!userService.checkUserNameUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setCreateBy(getUsername());
@@ -144,20 +131,14 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@Validated @RequestBody SysUser user)
-    {
+    public AjaxResult edit(@Validated @RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
-        if (!userService.checkUserNameUnique(user))
-        {
+        if (!userService.checkUserNameUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
-        }
-        else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
-        {
+        } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
             return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
         }
         user.setUpdateBy(getUsername());
@@ -170,10 +151,8 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:remove')")
     @Log(title = "用户管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{userIds}")
-    public AjaxResult remove(@PathVariable Long[] userIds)
-    {
-        if (ArrayUtils.contains(userIds, getUserId()))
-        {
+    public AjaxResult remove(@PathVariable Long[] userIds) {
+        if (ArrayUtils.contains(userIds, getUserId())) {
             return error("当前用户不能删除");
         }
         return toAjax(userService.deleteUserByIds(userIds));
@@ -185,8 +164,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/resetPwd")
-    public AjaxResult resetPwd(@RequestBody SysUser user)
-    {
+    public AjaxResult resetPwd(@RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
@@ -200,8 +178,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.UPDATE)
     @PutMapping("/changeStatus")
-    public AjaxResult changeStatus(@RequestBody SysUser user)
-    {
+    public AjaxResult changeStatus(@RequestBody SysUser user) {
         userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
         user.setUpdateBy(getUsername());
@@ -213,8 +190,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:query')")
     @GetMapping("/authRole/{userId}")
-    public AjaxResult authRole(@PathVariable("userId") Long userId)
-    {
+    public AjaxResult authRole(@PathVariable("userId") Long userId) {
         AjaxResult ajax = AjaxResult.success();
         SysUser user = userService.selectUserById(userId);
         List<SysRole> roles = roleService.selectRolesByUserId(userId);
@@ -229,8 +205,7 @@ public class SysUserController extends BaseController
     @PreAuthorize("@ss.hasPermi('system:user:edit')")
     @Log(title = "用户管理", businessType = BusinessType.GRANT)
     @PutMapping("/authRole")
-    public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
-    {
+    public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
         userService.checkUserDataScope(userId);
         userService.insertUserAuth(userId, roleIds);
         return success();
@@ -241,8 +216,7 @@ public class SysUserController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('system:user:list')")
     @GetMapping("/deptTree")
-    public AjaxResult deptTree(SysDept dept)
-    {
+    public AjaxResult deptTree(SysDept dept) {
         return success(deptService.selectDeptTreeList(dept));
     }
 }

+ 23 - 27
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@@ -1,44 +1,45 @@
 package com.ruoyi.web.core.config;
 
-import java.util.ArrayList;
-import java.util.List;
+import com.ruoyi.common.config.RuoYiConfig;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import com.ruoyi.common.config.RuoYiConfig;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.ApiKey;
-import springfox.documentation.service.AuthorizationScope;
-import springfox.documentation.service.Contact;
-import springfox.documentation.service.SecurityReference;
-import springfox.documentation.service.SecurityScheme;
+import springfox.documentation.service.*;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.service.contexts.SecurityContext;
 import springfox.documentation.spring.web.plugins.Docket;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Swagger2的接口配置
- * 
+ *
  * @author ruoyi
  */
 @Configuration
-public class SwaggerConfig
-{
-    /** 系统基础配置 */
+public class SwaggerConfig {
+    /**
+     * 系统基础配置
+     */
     @Autowired
     private RuoYiConfig ruoyiConfig;
 
-    /** 是否开启swagger */
+    /**
+     * 是否开启swagger
+     */
     @Value("${swagger.enabled}")
     private boolean enabled;
 
-    /** 设置请求的统一前缀 */
+    /**
+     * 设置请求的统一前缀
+     */
     @Value("${swagger.pathMapping}")
     private String pathMapping;
 
@@ -46,8 +47,7 @@ public class SwaggerConfig
      * 创建API
      */
     @Bean
-    public Docket createRestApi()
-    {
+    public Docket createRestApi() {
         return new Docket(DocumentationType.OAS_30)
                 // 是否启用Swagger
                 .enable(enabled)
@@ -71,8 +71,7 @@ public class SwaggerConfig
     /**
      * 安全模式,这里指定token通过Authorization头请求头传递
      */
-    private List<SecurityScheme> securitySchemes()
-    {
+    private List<SecurityScheme> securitySchemes() {
         List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
         apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
         return apiKeyList;
@@ -81,8 +80,7 @@ public class SwaggerConfig
     /**
      * 安全上下文
      */
-    private List<SecurityContext> securityContexts()
-    {
+    private List<SecurityContext> securityContexts() {
         List<SecurityContext> securityContexts = new ArrayList<>();
         securityContexts.add(
                 SecurityContext.builder()
@@ -95,8 +93,7 @@ public class SwaggerConfig
     /**
      * 默认的安全上引用
      */
-    private List<SecurityReference> defaultAuth()
-    {
+    private List<SecurityReference> defaultAuth() {
         AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
         AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
         authorizationScopes[0] = authorizationScope;
@@ -108,8 +105,7 @@ public class SwaggerConfig
     /**
      * 添加摘要信息
      */
-    private ApiInfo apiInfo()
-    {
+    private ApiInfo apiInfo() {
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题

+ 4 - 9
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java

@@ -1,19 +1,14 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
 
 /**
  * 匿名访问不鉴权注解
- * 
+ *
  * @author ruoyi
  */
-@Target({ ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.METHOD, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface Anonymous
-{
+public @interface Anonymous {
 }

+ 3 - 8
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java

@@ -1,21 +1,16 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
 
 /**
  * 数据权限过滤注解
- * 
+ *
  * @author ruoyi
  */
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface DataScope
-{
+public @interface DataScope {
     /**
      * 部门表的别名
      */

+ 5 - 10
ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java

@@ -1,26 +1,21 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 import com.ruoyi.common.enums.DataSourceType;
 
+import java.lang.annotation.*;
+
 /**
  * 自定义多数据源切换注解
- *
+ * <p>
  * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
  *
  * @author ruoyi
  */
-@Target({ ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.METHOD, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 @Inherited
-public @interface DataSource
-{
+public @interface DataSource {
     /**
      * 切换数据源名称
      */

+ 12 - 18
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java

@@ -1,23 +1,23 @@
 package com.ruoyi.common.annotation;
 
+import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.math.BigDecimal;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
 
 /**
  * 自定义导出Excel数据注解
- * 
+ *
  * @author ruoyi
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
-public @interface Excel
-{
+public @interface Excel {
     /**
      * 导出时在excel中排序
      */
@@ -153,34 +153,28 @@ public @interface Excel
      */
     Type type() default Type.ALL;
 
-    public enum Type
-    {
+    public enum Type {
         ALL(0), EXPORT(1), IMPORT(2);
         private final int value;
 
-        Type(int value)
-        {
+        Type(int value) {
             this.value = value;
         }
 
-        public int value()
-        {
+        public int value() {
             return this.value;
         }
     }
 
-    public enum ColumnType
-    {
+    public enum ColumnType {
         NUMERIC(0), STRING(1), IMAGE(2);
         private final int value;
 
-        ColumnType(int value)
-        {
+        ColumnType(int value) {
             this.value = value;
         }
 
-        public int value()
-        {
+        public int value() {
             return this.value;
         }
     }

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java

@@ -7,12 +7,11 @@ import java.lang.annotation.Target;
 
 /**
  * Excel注解集
- * 
+ *
  * @author ruoyi
  */
 @Target(ElementType.FIELD)
 @Retention(RetentionPolicy.RUNTIME)
-public @interface Excels
-{
+public @interface Excels {
     public Excel[] value();
 }

+ 5 - 10
ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java

@@ -1,24 +1,19 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OperatorType;
 
+import java.lang.annotation.*;
+
 /**
  * 自定义操作日志记录注解
- * 
- * @author ruoyi
  *
+ * @author ruoyi
  */
-@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Target({ElementType.PARAMETER, ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface Log
-{
+public @interface Log {
     /**
      * 模块
      */

+ 4 - 8
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java

@@ -1,23 +1,19 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
 import com.ruoyi.common.constant.CacheConstants;
 import com.ruoyi.common.enums.LimitType;
 
+import java.lang.annotation.*;
+
 /**
  * 限流注解
- * 
+ *
  * @author ruoyi
  */
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface RateLimiter
-{
+public @interface RateLimiter {
     /**
      * 限流key
      */

+ 3 - 10
ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java

@@ -1,24 +1,17 @@
 package com.ruoyi.common.annotation;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
 
 /**
  * 自定义注解防止表单重复提交
- * 
- * @author ruoyi
  *
+ * @author ruoyi
  */
 @Inherited
 @Target(ElementType.METHOD)
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface RepeatSubmit
-{
+public @interface RepeatSubmit {
     /**
      * 间隔时间(ms),小于此时间视为重复提交
      */

+ 66 - 75
ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java

@@ -5,91 +5,54 @@ import org.springframework.stereotype.Component;
 
 /**
  * 读取项目相关配置
- * 
+ *
  * @author ruoyi
  */
 @Component
 @ConfigurationProperties(prefix = "ruoyi")
-public class RuoYiConfig
-{
-    /** 项目名称 */
+public class RuoYiConfig {
+    /**
+     * 上传路径
+     */
+    private static String profile;
+    /**
+     * 获取地址开关
+     */
+    private static boolean addressEnabled;
+    /**
+     * 验证码类型
+     */
+    private static String captchaType;
+    /**
+     * 项目名称
+     */
     private String name;
-
-    /** 版本 */
+    /**
+     * 版本
+     */
     private String version;
-
-    /** 版权年份 */
+    /**
+     * 版权年份
+     */
     private String copyrightYear;
-
-    /** 实例演示开关 */
+    /**
+     * 实例演示开关
+     */
     private boolean demoEnabled;
 
-    /** 上传路径 */
-    private static String profile;
-
-    /** 获取地址开关 */
-    private static boolean addressEnabled;
-
-    /** 验证码类型 */
-    private static String captchaType;
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion(String version)
-    {
-        this.version = version;
-    }
-
-    public String getCopyrightYear()
-    {
-        return copyrightYear;
-    }
-
-    public void setCopyrightYear(String copyrightYear)
-    {
-        this.copyrightYear = copyrightYear;
-    }
-
-    public boolean isDemoEnabled()
-    {
-        return demoEnabled;
-    }
-
-    public void setDemoEnabled(boolean demoEnabled)
-    {
-        this.demoEnabled = demoEnabled;
-    }
-
-    public static String getProfile()
-    {
+    public static String getProfile() {
         return profile;
     }
 
-    public void setProfile(String profile)
-    {
+    public void setProfile(String profile) {
         RuoYiConfig.profile = profile;
     }
 
-    public static boolean isAddressEnabled()
-    {
+    public static boolean isAddressEnabled() {
         return addressEnabled;
     }
 
-    public void setAddressEnabled(boolean addressEnabled)
-    {
+    public void setAddressEnabled(boolean addressEnabled) {
         RuoYiConfig.addressEnabled = addressEnabled;
     }
 
@@ -104,32 +67,60 @@ public class RuoYiConfig
     /**
      * 获取导入上传路径
      */
-    public static String getImportPath()
-    {
+    public static String getImportPath() {
         return getProfile() + "/import";
     }
 
     /**
      * 获取头像上传路径
      */
-    public static String getAvatarPath()
-    {
+    public static String getAvatarPath() {
         return getProfile() + "/avatar";
     }
 
     /**
      * 获取下载路径
      */
-    public static String getDownloadPath()
-    {
+    public static String getDownloadPath() {
         return getProfile() + "/download/";
     }
 
     /**
      * 获取上传路径
      */
-    public static String getUploadPath()
-    {
+    public static String getUploadPath() {
         return getProfile() + "/upload";
     }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public String getCopyrightYear() {
+        return copyrightYear;
+    }
+
+    public void setCopyrightYear(String copyrightYear) {
+        this.copyrightYear = copyrightYear;
+    }
+
+    public boolean isDemoEnabled() {
+        return demoEnabled;
+    }
+
+    public void setDemoEnabled(boolean demoEnabled) {
+        this.demoEnabled = demoEnabled;
+    }
 }

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.constant;
 
 /**
  * 缓存的key 常量
- * 
+ *
  * @author ruoyi
  */
-public class CacheConstants
-{
+public class CacheConstants {
     /**
      * 登录用户 redis key
      */

+ 6 - 7
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -4,11 +4,10 @@ import io.jsonwebtoken.Claims;
 
 /**
  * 通用常量信息
- * 
+ *
  * @author ruoyi
  */
-public class Constants
-{
+public class Constants {
     /**
      * UTF-8 字符集
      */
@@ -63,7 +62,7 @@ public class Constants
      * 登录失败
      */
     public static final String LOGIN_FAIL = "Error";
- 
+
     /**
      * 验证码有效期(分钟)
      */
@@ -132,11 +131,11 @@ public class Constants
     /**
      * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
      */
-    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
+    public static final String[] JOB_WHITELIST_STR = {"com.ruoyi"};
 
     /**
      * 定时任务违规的字符
      */
-    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
-            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
+    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
+            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"};
 }

+ 128 - 59
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java

@@ -2,116 +2,185 @@ package com.ruoyi.common.constant;
 
 /**
  * 代码生成通用常量
- * 
+ *
  * @author ruoyi
  */
-public class GenConstants
-{
-    /** 单表(增删改查) */
+public class GenConstants {
+    /**
+     * 单表(增删改查)
+     */
     public static final String TPL_CRUD = "crud";
 
-    /** 树表(增删改查) */
+    /**
+     * 树表(增删改查)
+     */
     public static final String TPL_TREE = "tree";
 
-    /** 主子表(增删改查) */
+    /**
+     * 主子表(增删改查)
+     */
     public static final String TPL_SUB = "sub";
 
-    /** 树编码字段 */
+    /**
+     * 树编码字段
+     */
     public static final String TREE_CODE = "treeCode";
 
-    /** 树父编码字段 */
+    /**
+     * 树父编码字段
+     */
     public static final String TREE_PARENT_CODE = "treeParentCode";
 
-    /** 树名称字段 */
+    /**
+     * 树名称字段
+     */
     public static final String TREE_NAME = "treeName";
 
-    /** 上级菜单ID字段 */
+    /**
+     * 上级菜单ID字段
+     */
     public static final String PARENT_MENU_ID = "parentMenuId";
 
-    /** 上级菜单名称字段 */
+    /**
+     * 上级菜单名称字段
+     */
     public static final String PARENT_MENU_NAME = "parentMenuName";
 
-    /** 数据库字符串类型 */
-    public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
-
-    /** 数据库文本类型 */
-    public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
-
-    /** 数据库时间类型 */
-    public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
-
-    /** 数据库数字类型 */
-    public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
-            "bit", "bigint", "float", "double", "decimal" };
-
-    /** 页面不需要编辑字段 */
-    public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
-
-    /** 页面不需要显示的列表字段 */
-    public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
-            "update_time" };
-
-    /** 页面不需要查询字段 */
-    public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
-            "update_time", "remark" };
-
-    /** Entity基类字段 */
-    public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
-
-    /** Tree基类字段 */
-    public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };
-
-    /** 文本框 */
+    /**
+     * 数据库字符串类型
+     */
+    public static final String[] COLUMNTYPE_STR = {"char", "varchar", "nvarchar", "varchar2"};
+
+    /**
+     * 数据库文本类型
+     */
+    public static final String[] COLUMNTYPE_TEXT = {"tinytext", "text", "mediumtext", "longtext"};
+
+    /**
+     * 数据库时间类型
+     */
+    public static final String[] COLUMNTYPE_TIME = {"datetime", "time", "date", "timestamp"};
+
+    /**
+     * 数据库数字类型
+     */
+    public static final String[] COLUMNTYPE_NUMBER = {"tinyint", "smallint", "mediumint", "int", "number", "integer",
+            "bit", "bigint", "float", "double", "decimal"};
+
+    /**
+     * 页面不需要编辑字段
+     */
+    public static final String[] COLUMNNAME_NOT_EDIT = {"id", "create_by", "create_time", "del_flag"};
+
+    /**
+     * 页面不需要显示的列表字段
+     */
+    public static final String[] COLUMNNAME_NOT_LIST = {"id", "create_by", "create_time", "del_flag", "update_by",
+            "update_time"};
+
+    /**
+     * 页面不需要查询字段
+     */
+    public static final String[] COLUMNNAME_NOT_QUERY = {"id", "create_by", "create_time", "del_flag", "update_by",
+            "update_time", "remark"};
+
+    /**
+     * Entity基类字段
+     */
+    public static final String[] BASE_ENTITY = {"createBy", "createTime", "updateBy", "updateTime", "remark"};
+
+    /**
+     * Tree基类字段
+     */
+    public static final String[] TREE_ENTITY = {"parentName", "parentId", "orderNum", "ancestors", "children"};
+
+    /**
+     * 文本框
+     */
     public static final String HTML_INPUT = "input";
 
-    /** 文本域 */
+    /**
+     * 文本域
+     */
     public static final String HTML_TEXTAREA = "textarea";
 
-    /** 下拉框 */
+    /**
+     * 下拉框
+     */
     public static final String HTML_SELECT = "select";
 
-    /** 单选框 */
+    /**
+     * 单选框
+     */
     public static final String HTML_RADIO = "radio";
 
-    /** 复选框 */
+    /**
+     * 复选框
+     */
     public static final String HTML_CHECKBOX = "checkbox";
 
-    /** 日期控件 */
+    /**
+     * 日期控件
+     */
     public static final String HTML_DATETIME = "datetime";
 
-    /** 图片上传控件 */
+    /**
+     * 图片上传控件
+     */
     public static final String HTML_IMAGE_UPLOAD = "imageUpload";
 
-    /** 文件上传控件 */
+    /**
+     * 文件上传控件
+     */
     public static final String HTML_FILE_UPLOAD = "fileUpload";
 
-    /** 富文本控件 */
+    /**
+     * 富文本控件
+     */
     public static final String HTML_EDITOR = "editor";
 
-    /** 字符串类型 */
+    /**
+     * 字符串类型
+     */
     public static final String TYPE_STRING = "String";
 
-    /** 整型 */
+    /**
+     * 整型
+     */
     public static final String TYPE_INTEGER = "Integer";
 
-    /** 长整型 */
+    /**
+     * 长整型
+     */
     public static final String TYPE_LONG = "Long";
 
-    /** 浮点型 */
+    /**
+     * 浮点型
+     */
     public static final String TYPE_DOUBLE = "Double";
 
-    /** 高精度计算类型 */
+    /**
+     * 高精度计算类型
+     */
     public static final String TYPE_BIGDECIMAL = "BigDecimal";
 
-    /** 时间类型 */
+    /**
+     * 时间类型
+     */
     public static final String TYPE_DATE = "Date";
 
-    /** 模糊查询 */
+    /**
+     * 模糊查询
+     */
     public static final String QUERY_LIKE = "LIKE";
 
-    /** 相等查询 */
+    /**
+     * 相等查询
+     */
     public static final String QUERY_EQ = "EQ";
 
-    /** 需要 */
+    /**
+     * 需要
+     */
     public static final String REQUIRE = "1";
 }

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.constant;
 
 /**
  * 返回状态码
- * 
+ *
  * @author ruoyi
  */
-public class HttpStatus
-{
+public class HttpStatus {
     /**
      * 操作成功
      */

+ 20 - 14
ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java

@@ -2,30 +2,38 @@ package com.ruoyi.common.constant;
 
 /**
  * 任务调度通用常量
- * 
+ *
  * @author ruoyi
  */
-public class ScheduleConstants
-{
+public class ScheduleConstants {
     public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
 
-    /** 执行目标key */
+    /**
+     * 执行目标key
+     */
     public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
 
-    /** 默认 */
+    /**
+     * 默认
+     */
     public static final String MISFIRE_DEFAULT = "0";
 
-    /** 立即触发执行 */
+    /**
+     * 立即触发执行
+     */
     public static final String MISFIRE_IGNORE_MISFIRES = "1";
 
-    /** 触发一次执行 */
+    /**
+     * 触发一次执行
+     */
     public static final String MISFIRE_FIRE_AND_PROCEED = "2";
 
-    /** 不触发立即执行 */
+    /**
+     * 不触发立即执行
+     */
     public static final String MISFIRE_DO_NOTHING = "3";
 
-    public enum Status
-    {
+    public enum Status {
         /**
          * 正常
          */
@@ -37,13 +45,11 @@ public class ScheduleConstants
 
         private String value;
 
-        private Status(String value)
-        {
+        private Status(String value) {
             this.value = value;
         }
 
-        public String getValue()
-        {
+        public String getValue() {
             return value;
         }
     }

+ 54 - 21
ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java

@@ -2,65 +2,98 @@ package com.ruoyi.common.constant;
 
 /**
  * 用户常量信息
- * 
+ *
  * @author ruoyi
  */
-public class UserConstants
-{
+public class UserConstants {
     /**
      * 平台内系统用户的唯一标志
      */
     public static final String SYS_USER = "SYS_USER";
 
-    /** 正常状态 */
+    /**
+     * 正常状态
+     */
     public static final String NORMAL = "0";
 
-    /** 异常状态 */
+    /**
+     * 异常状态
+     */
     public static final String EXCEPTION = "1";
 
-    /** 用户封禁状态 */
+    /**
+     * 用户封禁状态
+     */
     public static final String USER_DISABLE = "1";
 
-    /** 角色封禁状态 */
+    /**
+     * 角色封禁状态
+     */
     public static final String ROLE_DISABLE = "1";
 
-    /** 部门正常状态 */
+    /**
+     * 部门正常状态
+     */
     public static final String DEPT_NORMAL = "0";
 
-    /** 部门停用状态 */
+    /**
+     * 部门停用状态
+     */
     public static final String DEPT_DISABLE = "1";
 
-    /** 字典正常状态 */
+    /**
+     * 字典正常状态
+     */
     public static final String DICT_NORMAL = "0";
 
-    /** 是否为系统默认(是) */
+    /**
+     * 是否为系统默认(是)
+     */
     public static final String YES = "Y";
 
-    /** 是否菜单外链(是) */
+    /**
+     * 是否菜单外链(是)
+     */
     public static final String YES_FRAME = "0";
 
-    /** 是否菜单外链(否) */
+    /**
+     * 是否菜单外链(否)
+     */
     public static final String NO_FRAME = "1";
 
-    /** 菜单类型(目录) */
+    /**
+     * 菜单类型(目录)
+     */
     public static final String TYPE_DIR = "M";
 
-    /** 菜单类型(菜单) */
+    /**
+     * 菜单类型(菜单)
+     */
     public static final String TYPE_MENU = "C";
 
-    /** 菜单类型(按钮) */
+    /**
+     * 菜单类型(按钮)
+     */
     public static final String TYPE_BUTTON = "F";
 
-    /** Layout组件标识 */
+    /**
+     * Layout组件标识
+     */
     public final static String LAYOUT = "Layout";
-    
-    /** ParentView组件标识 */
+
+    /**
+     * ParentView组件标识
+     */
     public final static String PARENT_VIEW = "ParentView";
 
-    /** InnerLink组件标识 */
+    /**
+     * InnerLink组件标识
+     */
     public final static String INNER_LINK = "InnerLink";
 
-    /** 校验是否唯一的返回标识 */
+    /**
+     * 校验是否唯一的返回标识
+     */
     public final static boolean UNIQUE = true;
     public final static boolean NOT_UNIQUE = false;
 

+ 35 - 56
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java

@@ -1,12 +1,5 @@
 package com.ruoyi.common.core.controller;
 
-import java.beans.PropertyEditorSupport;
-import java.util.Date;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.InitBinder;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.constant.HttpStatus;
@@ -20,28 +13,32 @@ import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.sql.SqlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+
+import java.beans.PropertyEditorSupport;
+import java.util.Date;
+import java.util.List;
 
 /**
  * web层通用数据处理
- * 
+ *
  * @author ruoyi
  */
-public class BaseController
-{
+public class BaseController {
     protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     /**
      * 将前台传递过来的日期格式的字符串,自动转化为Date类型
      */
     @InitBinder
-    public void initBinder(WebDataBinder binder)
-    {
+    public void initBinder(WebDataBinder binder) {
         // Date 类型转换
-        binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
-        {
+        binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
             @Override
-            public void setAsText(String text)
-            {
+            public void setAsText(String text) {
                 setValue(DateUtils.parseDate(text));
             }
         });
@@ -50,19 +47,16 @@ public class BaseController
     /**
      * 设置请求分页数据
      */
-    protected void startPage()
-    {
+    protected void startPage() {
         PageUtils.startPage();
     }
 
     /**
      * 设置请求排序数据
      */
-    protected void startOrderBy()
-    {
+    protected void startOrderBy() {
         PageDomain pageDomain = TableSupport.buildPageRequest();
-        if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
-        {
+        if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
             String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
             PageHelper.orderBy(orderBy);
         }
@@ -71,17 +65,15 @@ public class BaseController
     /**
      * 清理分页的线程变量
      */
-    protected void clearPage()
-    {
+    protected void clearPage() {
         PageUtils.clearPage();
     }
 
     /**
      * 响应请求分页数据
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected TableDataInfo getDataTable(List<?> list)
-    {
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    protected TableDataInfo getDataTable(List<?> list) {
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(HttpStatus.SUCCESS);
         rspData.setMsg("查询成功");
@@ -93,110 +85,97 @@ public class BaseController
     /**
      * 返回成功
      */
-    public AjaxResult success()
-    {
+    public AjaxResult success() {
         return AjaxResult.success();
     }
 
     /**
      * 返回失败消息
      */
-    public AjaxResult error()
-    {
+    public AjaxResult error() {
         return AjaxResult.error();
     }
 
     /**
      * 返回成功消息
      */
-    public AjaxResult success(String message)
-    {
+    public AjaxResult success(String message) {
         return AjaxResult.success(message);
     }
-    
+
     /**
      * 返回成功消息
      */
-    public AjaxResult success(Object data)
-    {
+    public AjaxResult success(Object data) {
         return AjaxResult.success(data);
     }
 
     /**
      * 返回失败消息
      */
-    public AjaxResult error(String message)
-    {
+    public AjaxResult error(String message) {
         return AjaxResult.error(message);
     }
 
     /**
      * 返回警告消息
      */
-    public AjaxResult warn(String message)
-    {
+    public AjaxResult warn(String message) {
         return AjaxResult.warn(message);
     }
 
     /**
      * 响应返回结果
-     * 
+     *
      * @param rows 影响行数
      * @return 操作结果
      */
-    protected AjaxResult toAjax(int rows)
-    {
+    protected AjaxResult toAjax(int rows) {
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
     /**
      * 响应返回结果
-     * 
+     *
      * @param result 结果
      * @return 操作结果
      */
-    protected AjaxResult toAjax(boolean result)
-    {
+    protected AjaxResult toAjax(boolean result) {
         return result ? success() : error();
     }
 
     /**
      * 页面跳转
      */
-    public String redirect(String url)
-    {
+    public String redirect(String url) {
         return StringUtils.format("redirect:{}", url);
     }
 
     /**
      * 获取用户缓存信息
      */
-    public LoginUser getLoginUser()
-    {
+    public LoginUser getLoginUser() {
         return SecurityUtils.getLoginUser();
     }
 
     /**
      * 获取登录用户id
      */
-    public Long getUserId()
-    {
+    public Long getUserId() {
         return getLoginUser().getUserId();
     }
 
     /**
      * 获取登录部门id
      */
-    public Long getDeptId()
-    {
+    public Long getDeptId() {
         return getLoginUser().getDeptId();
     }
 
     /**
      * 获取登录用户名
      */
-    public String getUsername()
-    {
+    public String getUsername() {
         return getLoginUser().getUsername();
     }
 }

+ 46 - 58
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java

@@ -1,103 +1,98 @@
 package com.ruoyi.common.core.domain;
 
-import java.util.HashMap;
 import com.ruoyi.common.constant.HttpStatus;
 import com.ruoyi.common.utils.StringUtils;
 
+import java.util.HashMap;
+
 /**
  * 操作消息提醒
- * 
+ *
  * @author ruoyi
  */
-public class AjaxResult extends HashMap<String, Object>
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 状态码 */
+public class AjaxResult extends HashMap<String, Object> {
+    /**
+     * 状态码
+     */
     public static final String CODE_TAG = "code";
-
-    /** 返回内容 */
+    /**
+     * 返回内容
+     */
     public static final String MSG_TAG = "msg";
-
-    /** 数据对象 */
+    /**
+     * 数据对象
+     */
     public static final String DATA_TAG = "data";
+    private static final long serialVersionUID = 1L;
 
     /**
      * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
      */
-    public AjaxResult()
-    {
+    public AjaxResult() {
     }
 
     /**
      * 初始化一个新创建的 AjaxResult 对象
-     * 
+     *
      * @param code 状态码
-     * @param msg 返回内容
+     * @param msg  返回内容
      */
-    public AjaxResult(int code, String msg)
-    {
+    public AjaxResult(int code, String msg) {
         super.put(CODE_TAG, code);
         super.put(MSG_TAG, msg);
     }
 
     /**
      * 初始化一个新创建的 AjaxResult 对象
-     * 
+     *
      * @param code 状态码
-     * @param msg 返回内容
+     * @param msg  返回内容
      * @param data 数据对象
      */
-    public AjaxResult(int code, String msg, Object data)
-    {
+    public AjaxResult(int code, String msg, Object data) {
         super.put(CODE_TAG, code);
         super.put(MSG_TAG, msg);
-        if (StringUtils.isNotNull(data))
-        {
+        if (StringUtils.isNotNull(data)) {
             super.put(DATA_TAG, data);
         }
     }
 
     /**
      * 返回成功消息
-     * 
+     *
      * @return 成功消息
      */
-    public static AjaxResult success()
-    {
+    public static AjaxResult success() {
         return AjaxResult.success("操作成功");
     }
 
     /**
      * 返回成功数据
-     * 
+     *
      * @return 成功消息
      */
-    public static AjaxResult success(Object data)
-    {
+    public static AjaxResult success(Object data) {
         return AjaxResult.success("操作成功", data);
     }
 
     /**
      * 返回成功消息
-     * 
+     *
      * @param msg 返回内容
      * @return 成功消息
      */
-    public static AjaxResult success(String msg)
-    {
+    public static AjaxResult success(String msg) {
         return AjaxResult.success(msg, null);
     }
 
     /**
      * 返回成功消息
-     * 
-     * @param msg 返回内容
+     *
+     * @param msg  返回内容
      * @param data 数据对象
      * @return 成功消息
      */
-    public static AjaxResult success(String msg, Object data)
-    {
+    public static AjaxResult success(String msg, Object data) {
         return new AjaxResult(HttpStatus.SUCCESS, msg, data);
     }
 
@@ -107,78 +102,71 @@ public class AjaxResult extends HashMap<String, Object>
      * @param msg 返回内容
      * @return 警告消息
      */
-    public static AjaxResult warn(String msg)
-    {
+    public static AjaxResult warn(String msg) {
         return AjaxResult.warn(msg, null);
     }
 
     /**
      * 返回警告消息
      *
-     * @param msg 返回内容
+     * @param msg  返回内容
      * @param data 数据对象
      * @return 警告消息
      */
-    public static AjaxResult warn(String msg, Object data)
-    {
+    public static AjaxResult warn(String msg, Object data) {
         return new AjaxResult(HttpStatus.WARN, msg, data);
     }
 
     /**
      * 返回错误消息
-     * 
+     *
      * @return 错误消息
      */
-    public static AjaxResult error()
-    {
+    public static AjaxResult error() {
         return AjaxResult.error("操作失败");
     }
 
     /**
      * 返回错误消息
-     * 
+     *
      * @param msg 返回内容
      * @return 错误消息
      */
-    public static AjaxResult error(String msg)
-    {
+    public static AjaxResult error(String msg) {
         return AjaxResult.error(msg, null);
     }
 
     /**
      * 返回错误消息
-     * 
-     * @param msg 返回内容
+     *
+     * @param msg  返回内容
      * @param data 数据对象
      * @return 错误消息
      */
-    public static AjaxResult error(String msg, Object data)
-    {
+    public static AjaxResult error(String msg, Object data) {
         return new AjaxResult(HttpStatus.ERROR, msg, data);
     }
 
     /**
      * 返回错误消息
-     * 
+     *
      * @param code 状态码
-     * @param msg 返回内容
+     * @param msg  返回内容
      * @return 错误消息
      */
-    public static AjaxResult error(int code, String msg)
-    {
+    public static AjaxResult error(int code, String msg) {
         return new AjaxResult(code, msg, null);
     }
 
     /**
      * 方便链式调用
      *
-     * @param key 键
+     * @param key   
      * @param value 值
      * @return 数据对象
      */
     @Override
-    public AjaxResult put(String key, Object value)
-    {
+    public AjaxResult put(String key, Object value) {
         super.put(key, value);
         return this;
     }

+ 17 - 8
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java

@@ -12,32 +12,41 @@ import java.util.Map;
 
 /**
  * Entity基类
- * 
+ *
  * @author ruoyi
  */
-public class BaseEntity implements Serializable
-{
+public class BaseEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    /** 搜索值 */
+    /**
+     * 搜索值
+     */
     @TableField(exist = false)
     @JsonIgnore
     private String searchValue;
 
-    /** 创建者 */
+    /**
+     * 创建者
+     */
     @TableField(exist = false)
     private String createBy;
 
-    /** 创建时间 */
+    /**
+     * 创建时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField(exist = false)
     private Date createTime;
 
-    /** 更新者 */
+    /**
+     * 更新者
+     */
     @TableField(exist = false)
     private String updateBy;
 
-    /** 更新时间 */
+    /**
+     * 更新时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField(exist = false)
     private Date updateTime;

+ 33 - 49
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java

@@ -1,71 +1,63 @@
 package com.ruoyi.common.core.domain;
 
-import java.io.Serializable;
 import com.ruoyi.common.constant.HttpStatus;
 
+import java.io.Serializable;
+
 /**
  * 响应信息主体
  *
  * @author ruoyi
  */
-public class R<T> implements Serializable
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 成功 */
+public class R<T> implements Serializable {
+    /**
+     * 成功
+     */
     public static final int SUCCESS = HttpStatus.SUCCESS;
-
-    /** 失败 */
+    /**
+     * 失败
+     */
     public static final int FAIL = HttpStatus.ERROR;
-
+    private static final long serialVersionUID = 1L;
     private int code;
 
     private String msg;
 
     private T data;
 
-    public static <T> R<T> ok()
-    {
+    public static <T> R<T> ok() {
         return restResult(null, SUCCESS, "操作成功");
     }
 
-    public static <T> R<T> ok(T data)
-    {
+    public static <T> R<T> ok(T data) {
         return restResult(data, SUCCESS, "操作成功");
     }
 
-    public static <T> R<T> ok(T data, String msg)
-    {
+    public static <T> R<T> ok(T data, String msg) {
         return restResult(data, SUCCESS, msg);
     }
 
-    public static <T> R<T> fail()
-    {
+    public static <T> R<T> fail() {
         return restResult(null, FAIL, "操作失败");
     }
 
-    public static <T> R<T> fail(String msg)
-    {
+    public static <T> R<T> fail(String msg) {
         return restResult(null, FAIL, msg);
     }
 
-    public static <T> R<T> fail(T data)
-    {
+    public static <T> R<T> fail(T data) {
         return restResult(data, FAIL, "操作失败");
     }
 
-    public static <T> R<T> fail(T data, String msg)
-    {
+    public static <T> R<T> fail(T data, String msg) {
         return restResult(data, FAIL, msg);
     }
 
-    public static <T> R<T> fail(int code, String msg)
-    {
+    public static <T> R<T> fail(int code, String msg) {
         return restResult(null, code, msg);
     }
 
-    private static <T> R<T> restResult(T data, int code, String msg)
-    {
+    private static <T> R<T> restResult(T data, int code, String msg) {
         R<T> apiResult = new R<>();
         apiResult.setCode(code);
         apiResult.setData(data);
@@ -73,43 +65,35 @@ public class R<T> implements Serializable
         return apiResult;
     }
 
-    public int getCode()
-    {
+    public static <T> Boolean isError(R<T> ret) {
+        return !isSuccess(ret);
+    }
+
+    public static <T> Boolean isSuccess(R<T> ret) {
+        return R.SUCCESS == ret.getCode();
+    }
+
+    public int getCode() {
         return code;
     }
 
-    public void setCode(int code)
-    {
+    public void setCode(int code) {
         this.code = code;
     }
 
-    public String getMsg()
-    {
+    public String getMsg() {
         return msg;
     }
 
-    public void setMsg(String msg)
-    {
+    public void setMsg(String msg) {
         this.msg = msg;
     }
 
-    public T getData()
-    {
+    public T getData() {
         return data;
     }
 
-    public void setData(T data)
-    {
+    public void setData(T data) {
         this.data = data;
     }
-
-    public static <T> Boolean isError(R<T> ret)
-    {
-        return !isSuccess(ret);
-    }
-
-    public static <T> Boolean isSuccess(R<T> ret)
-    {
-        return R.SUCCESS == ret.getCode();
-    }
 }

+ 27 - 28
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java

@@ -5,75 +5,74 @@ import java.util.List;
 
 /**
  * Tree基类
- * 
+ *
  * @author ruoyi
  */
-public class TreeEntity extends BaseEntity
-{
+public class TreeEntity extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 父菜单名称 */
+    /**
+     * 父菜单名称
+     */
     private String parentName;
 
-    /** 父菜单ID */
+    /**
+     * 父菜单ID
+     */
     private Long parentId;
 
-    /** 显示顺序 */
+    /**
+     * 显示顺序
+     */
     private Integer orderNum;
 
-    /** 祖级列表 */
+    /**
+     * 祖级列表
+     */
     private String ancestors;
 
-    /** 子部门 */
+    /**
+     * 子部门
+     */
     private List<?> children = new ArrayList<>();
 
-    public String getParentName()
-    {
+    public String getParentName() {
         return parentName;
     }
 
-    public void setParentName(String parentName)
-    {
+    public void setParentName(String parentName) {
         this.parentName = parentName;
     }
 
-    public Long getParentId()
-    {
+    public Long getParentId() {
         return parentId;
     }
 
-    public void setParentId(Long parentId)
-    {
+    public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
 
-    public Integer getOrderNum()
-    {
+    public Integer getOrderNum() {
         return orderNum;
     }
 
-    public void setOrderNum(Integer orderNum)
-    {
+    public void setOrderNum(Integer orderNum) {
         this.orderNum = orderNum;
     }
 
-    public String getAncestors()
-    {
+    public String getAncestors() {
         return ancestors;
     }
 
-    public void setAncestors(String ancestors)
-    {
+    public void setAncestors(String ancestors) {
         this.ancestors = ancestors;
     }
 
-    public List<?> getChildren()
-    {
+    public List<?> getChildren() {
         return children;
     }
 
-    public void setChildren(List<?> children)
-    {
+    public void setChildren(List<?> children) {
         this.children = children;
     }
 }

+ 24 - 27
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java

@@ -1,77 +1,74 @@
 package com.ruoyi.common.core.domain;
 
-import java.io.Serializable;
-import java.util.List;
-import java.util.stream.Collectors;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysMenu;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
  * Treeselect树结构实体类
- * 
+ *
  * @author ruoyi
  */
-public class TreeSelect implements Serializable
-{
+public class TreeSelect implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    /** 节点ID */
+    /**
+     * 节点ID
+     */
     private Long id;
 
-    /** 节点名称 */
+    /**
+     * 节点名称
+     */
     private String label;
 
-    /** 子节点 */
+    /**
+     * 子节点
+     */
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private List<TreeSelect> children;
 
-    public TreeSelect()
-    {
+    public TreeSelect() {
 
     }
 
-    public TreeSelect(SysDept dept)
-    {
+    public TreeSelect(SysDept dept) {
         this.id = dept.getDeptId();
         this.label = dept.getDeptName();
         this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
-    public TreeSelect(SysMenu menu)
-    {
+    public TreeSelect(SysMenu menu) {
         this.id = menu.getMenuId();
         this.label = menu.getMenuName();
         this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
-    public Long getId()
-    {
+    public Long getId() {
         return id;
     }
 
-    public void setId(Long id)
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public String getLabel()
-    {
+    public String getLabel() {
         return label;
     }
 
-    public void setLabel(String label)
-    {
+    public void setLabel(String label) {
         this.label = label;
     }
 
-    public List<TreeSelect> getChildren()
-    {
+    public List<TreeSelect> getChildren() {
         return children;
     }
 
-    public void setChildren(List<TreeSelect> children)
-    {
+    public void setChildren(List<TreeSelect> children) {
         this.children = children;
     }
 }

+ 79 - 80
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java

@@ -15,195 +15,194 @@ import java.util.List;
 
 /**
  * 部门表 sys_dept
- * 
+ *
  * @author ruoyi
  */
-public class SysDept extends BaseEntity
-{
+public class SysDept extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 部门ID */
+    /**
+     * 部门ID
+     */
     @TableId
     private Long deptId;
 
-    /** 父部门ID */
+    /**
+     * 父部门ID
+     */
     private Long parentId;
 
-    /** 祖级列表 */
+    /**
+     * 祖级列表
+     */
     private String ancestors;
 
-    /** 部门名称 */
+    /**
+     * 部门名称
+     */
     private String deptName;
 
-    /** 显示顺序 */
+    /**
+     * 显示顺序
+     */
     private Integer orderNum;
 
-    /** 负责人 */
+    /**
+     * 负责人
+     */
     private String leader;
 
-    /** 联系电话 */
+    /**
+     * 联系电话
+     */
     private String phone;
 
-    /** 邮箱 */
+    /**
+     * 邮箱
+     */
     private String email;
 
-    /** 部门状态:0正常,1停用 */
+    /**
+     * 部门状态:0正常,1停用
+     */
     private String status;
 
-    /** 删除标志(0代表存在 2代表删除) */
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
     private String delFlag;
 
-    /** 父部门名称 */
+    /**
+     * 父部门名称
+     */
     @TableField(exist = false)
     private String parentName;
-    
-    /** 子部门 */
+
+    /**
+     * 子部门
+     */
     @TableField(exist = false)
     private List<SysDept> children = new ArrayList<SysDept>();
 
-    public Long getDeptId()
-    {
+    public Long getDeptId() {
         return deptId;
     }
 
-    public void setDeptId(Long deptId)
-    {
+    public void setDeptId(Long deptId) {
         this.deptId = deptId;
     }
 
-    public Long getParentId()
-    {
+    public Long getParentId() {
         return parentId;
     }
 
-    public void setParentId(Long parentId)
-    {
+    public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
 
-    public String getAncestors()
-    {
+    public String getAncestors() {
         return ancestors;
     }
 
-    public void setAncestors(String ancestors)
-    {
+    public void setAncestors(String ancestors) {
         this.ancestors = ancestors;
     }
 
     @NotBlank(message = "部门名称不能为空")
     @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
-    public String getDeptName()
-    {
+    public String getDeptName() {
         return deptName;
     }
 
-    public void setDeptName(String deptName)
-    {
+    public void setDeptName(String deptName) {
         this.deptName = deptName;
     }
 
     @NotNull(message = "显示顺序不能为空")
-    public Integer getOrderNum()
-    {
+    public Integer getOrderNum() {
         return orderNum;
     }
 
-    public void setOrderNum(Integer orderNum)
-    {
+    public void setOrderNum(Integer orderNum) {
         this.orderNum = orderNum;
     }
 
-    public String getLeader()
-    {
+    public String getLeader() {
         return leader;
     }
 
-    public void setLeader(String leader)
-    {
+    public void setLeader(String leader) {
         this.leader = leader;
     }
 
     @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
-    public String getPhone()
-    {
+    public String getPhone() {
         return phone;
     }
 
-    public void setPhone(String phone)
-    {
+    public void setPhone(String phone) {
         this.phone = phone;
     }
 
     @Email(message = "邮箱格式不正确")
     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
-    public String getEmail()
-    {
+    public String getEmail() {
         return email;
     }
 
-    public void setEmail(String email)
-    {
+    public void setEmail(String email) {
         this.email = email;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getDelFlag()
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
-    public void setDelFlag(String delFlag)
-    {
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getParentName()
-    {
+    public String getParentName() {
         return parentName;
     }
 
-    public void setParentName(String parentName)
-    {
+    public void setParentName(String parentName) {
         this.parentName = parentName;
     }
 
-    public List<SysDept> getChildren()
-    {
+    public List<SysDept> getChildren() {
         return children;
     }
 
-    public void setChildren(List<SysDept> children)
-    {
+    public void setChildren(List<SysDept> children) {
         this.children = children;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("deptId", getDeptId())
-            .append("parentId", getParentId())
-            .append("ancestors", getAncestors())
-            .append("deptName", getDeptName())
-            .append("orderNum", getOrderNum())
-            .append("leader", getLeader())
-            .append("phone", getPhone())
-            .append("email", getEmail())
-            .append("status", getStatus())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("deptId", getDeptId())
+                .append("parentId", getParentId())
+                .append("ancestors", getAncestors())
+                .append("deptName", getDeptName())
+                .append("orderNum", getOrderNum())
+                .append("leader", getLeader())
+                .append("phone", getPhone())
+                .append("email", getEmail())
+                .append("status", getStatus())
+                .append("delFlag", getDelFlag())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .toString();
     }
 }

+ 70 - 72
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java

@@ -1,179 +1,177 @@
 package com.ruoyi.common.core.domain.entity;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Size;
-
 import com.baomidou.mybatisplus.annotation.TableId;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
 
 /**
  * 字典数据表 sys_dict_data
- * 
+ *
  * @author ruoyi
  */
-public class SysDictData extends BaseEntity
-{
+public class SysDictData extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 字典编码 */
+    /**
+     * 字典编码
+     */
     @TableId
     @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
     private Long dictCode;
 
-    /** 字典排序 */
+    /**
+     * 字典排序
+     */
     @Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
     private Long dictSort;
 
-    /** 字典标签 */
+    /**
+     * 字典标签
+     */
     @Excel(name = "字典标签")
     private String dictLabel;
 
-    /** 字典键值 */
+    /**
+     * 字典键值
+     */
     @Excel(name = "字典键值")
     private String dictValue;
 
-    /** 字典类型 */
+    /**
+     * 字典类型
+     */
     @Excel(name = "字典类型")
     private String dictType;
 
-    /** 样式属性(其他样式扩展) */
+    /**
+     * 样式属性(其他样式扩展)
+     */
     private String cssClass;
 
-    /** 表格字典样式 */
+    /**
+     * 表格字典样式
+     */
     private String listClass;
 
-    /** 是否默认(Y是 N否) */
+    /**
+     * 是否默认(Y是 N否)
+     */
     @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
     private String isDefault;
 
-    /** 状态(0正常 1停用) */
+    /**
+     * 状态(0正常 1停用)
+     */
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
-    public Long getDictCode()
-    {
+    public Long getDictCode() {
         return dictCode;
     }
 
-    public void setDictCode(Long dictCode)
-    {
+    public void setDictCode(Long dictCode) {
         this.dictCode = dictCode;
     }
 
-    public Long getDictSort()
-    {
+    public Long getDictSort() {
         return dictSort;
     }
 
-    public void setDictSort(Long dictSort)
-    {
+    public void setDictSort(Long dictSort) {
         this.dictSort = dictSort;
     }
 
     @NotBlank(message = "字典标签不能为空")
     @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
-    public String getDictLabel()
-    {
+    public String getDictLabel() {
         return dictLabel;
     }
 
-    public void setDictLabel(String dictLabel)
-    {
+    public void setDictLabel(String dictLabel) {
         this.dictLabel = dictLabel;
     }
 
     @NotBlank(message = "字典键值不能为空")
     @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
-    public String getDictValue()
-    {
+    public String getDictValue() {
         return dictValue;
     }
 
-    public void setDictValue(String dictValue)
-    {
+    public void setDictValue(String dictValue) {
         this.dictValue = dictValue;
     }
 
     @NotBlank(message = "字典类型不能为空")
     @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
-    public String getDictType()
-    {
+    public String getDictType() {
         return dictType;
     }
 
-    public void setDictType(String dictType)
-    {
+    public void setDictType(String dictType) {
         this.dictType = dictType;
     }
 
     @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
-    public String getCssClass()
-    {
+    public String getCssClass() {
         return cssClass;
     }
 
-    public void setCssClass(String cssClass)
-    {
+    public void setCssClass(String cssClass) {
         this.cssClass = cssClass;
     }
 
-    public String getListClass()
-    {
+    public String getListClass() {
         return listClass;
     }
 
-    public void setListClass(String listClass)
-    {
+    public void setListClass(String listClass) {
         this.listClass = listClass;
     }
 
-    public boolean getDefault()
-    {
+    public boolean getDefault() {
         return UserConstants.YES.equals(this.isDefault);
     }
 
-    public String getIsDefault()
-    {
+    public String getIsDefault() {
         return isDefault;
     }
 
-    public void setIsDefault(String isDefault)
-    {
+    public void setIsDefault(String isDefault) {
         this.isDefault = isDefault;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
-    
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("dictCode", getDictCode())
-            .append("dictSort", getDictSort())
-            .append("dictLabel", getDictLabel())
-            .append("dictValue", getDictValue())
-            .append("dictType", getDictType())
-            .append("cssClass", getCssClass())
-            .append("listClass", getListClass())
-            .append("isDefault", getIsDefault())
-            .append("status", getStatus())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("dictCode", getDictCode())
+                .append("dictSort", getDictSort())
+                .append("dictLabel", getDictLabel())
+                .append("dictValue", getDictValue())
+                .append("dictType", getDictType())
+                .append("cssClass", getCssClass())
+                .append("listClass", getListClass())
+                .append("isDefault", getIsDefault())
+                .append("status", getStatus())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
     }
 }

+ 40 - 41
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java

@@ -1,99 +1,98 @@
 package com.ruoyi.common.core.domain.entity;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-
 import com.baomidou.mybatisplus.annotation.TableId;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
 
 /**
  * 字典类型表 sys_dict_type
- * 
+ *
  * @author ruoyi
  */
-public class SysDictType extends BaseEntity
-{
+public class SysDictType extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 字典主键 */
+    /**
+     * 字典主键
+     */
     @TableId
     @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
     private Long dictId;
 
-    /** 字典名称 */
+    /**
+     * 字典名称
+     */
     @Excel(name = "字典名称")
     private String dictName;
 
-    /** 字典类型 */
+    /**
+     * 字典类型
+     */
     @Excel(name = "字典类型")
     private String dictType;
 
-    /** 状态(0正常 1停用) */
+    /**
+     * 状态(0正常 1停用)
+     */
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
-    public Long getDictId()
-    {
+    public Long getDictId() {
         return dictId;
     }
 
-    public void setDictId(Long dictId)
-    {
+    public void setDictId(Long dictId) {
         this.dictId = dictId;
     }
 
     @NotBlank(message = "字典名称不能为空")
     @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
-    public String getDictName()
-    {
+    public String getDictName() {
         return dictName;
     }
 
-    public void setDictName(String dictName)
-    {
+    public void setDictName(String dictName) {
         this.dictName = dictName;
     }
 
     @NotBlank(message = "字典类型不能为空")
     @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
     @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
-    public String getDictType()
-    {
+    public String getDictType() {
         return dictType;
     }
 
-    public void setDictType(String dictType)
-    {
+    public void setDictType(String dictType) {
         this.dictType = dictType;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
-    
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("dictId", getDictId())
-            .append("dictName", getDictName())
-            .append("dictType", getDictType())
-            .append("status", getStatus())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("dictId", getDictId())
+                .append("dictName", getDictName())
+                .append("dictType", getDictType())
+                .append("status", getStatus())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
     }
 }

+ 111 - 112
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java

@@ -1,262 +1,261 @@
 package com.ruoyi.common.core.domain.entity;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.ruoyi.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.core.domain.BaseEntity;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 菜单权限表 sys_menu
- * 
+ *
  * @author ruoyi
  */
-public class SysMenu extends BaseEntity
-{
+public class SysMenu extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 菜单ID */
+    /**
+     * 菜单ID
+     */
     @TableId
     private Long menuId;
 
-    /** 菜单名称 */
+    /**
+     * 菜单名称
+     */
     private String menuName;
 
-    /** 父菜单名称 */
+    /**
+     * 父菜单名称
+     */
     private String parentName;
 
-    /** 父菜单ID */
+    /**
+     * 父菜单ID
+     */
     private Long parentId;
 
-    /** 显示顺序 */
+    /**
+     * 显示顺序
+     */
     private Integer orderNum;
 
-    /** 路由地址 */
+    /**
+     * 路由地址
+     */
     private String path;
 
-    /** 组件路径 */
+    /**
+     * 组件路径
+     */
     private String component;
 
-    /** 路由参数 */
+    /**
+     * 路由参数
+     */
     private String query;
 
-    /** 是否为外链(0是 1否) */
+    /**
+     * 是否为外链(0是 1否)
+     */
     private String isFrame;
 
-    /** 是否缓存(0缓存 1不缓存) */
+    /**
+     * 是否缓存(0缓存 1不缓存)
+     */
     private String isCache;
 
-    /** 类型(M目录 C菜单 F按钮) */
+    /**
+     * 类型(M目录 C菜单 F按钮)
+     */
     private String menuType;
 
-    /** 显示状态(0显示 1隐藏) */
+    /**
+     * 显示状态(0显示 1隐藏)
+     */
     private String visible;
-    
-    /** 菜单状态(0正常 1停用) */
+
+    /**
+     * 菜单状态(0正常 1停用)
+     */
     private String status;
 
-    /** 权限字符串 */
+    /**
+     * 权限字符串
+     */
     private String perms;
 
-    /** 菜单图标 */
+    /**
+     * 菜单图标
+     */
     private String icon;
 
-    /** 子菜单 */
+    /**
+     * 子菜单
+     */
     private List<SysMenu> children = new ArrayList<SysMenu>();
 
-    public Long getMenuId()
-    {
+    public Long getMenuId() {
         return menuId;
     }
 
-    public void setMenuId(Long menuId)
-    {
+    public void setMenuId(Long menuId) {
         this.menuId = menuId;
     }
 
     @NotBlank(message = "菜单名称不能为空")
     @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
-    public String getMenuName()
-    {
+    public String getMenuName() {
         return menuName;
     }
 
-    public void setMenuName(String menuName)
-    {
+    public void setMenuName(String menuName) {
         this.menuName = menuName;
     }
 
-    public String getParentName()
-    {
+    public String getParentName() {
         return parentName;
     }
 
-    public void setParentName(String parentName)
-    {
+    public void setParentName(String parentName) {
         this.parentName = parentName;
     }
 
-    public Long getParentId()
-    {
+    public Long getParentId() {
         return parentId;
     }
 
-    public void setParentId(Long parentId)
-    {
+    public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
 
     @NotNull(message = "显示顺序不能为空")
-    public Integer getOrderNum()
-    {
+    public Integer getOrderNum() {
         return orderNum;
     }
 
-    public void setOrderNum(Integer orderNum)
-    {
+    public void setOrderNum(Integer orderNum) {
         this.orderNum = orderNum;
     }
 
     @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
-    public String getPath()
-    {
+    public String getPath() {
         return path;
     }
 
-    public void setPath(String path)
-    {
+    public void setPath(String path) {
         this.path = path;
     }
 
     @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
-    public String getComponent()
-    {
+    public String getComponent() {
         return component;
     }
 
-    public void setComponent(String component)
-    {
+    public void setComponent(String component) {
         this.component = component;
     }
 
-    public String getQuery()
-    {
+    public String getQuery() {
         return query;
     }
 
-    public void setQuery(String query)
-    {
+    public void setQuery(String query) {
         this.query = query;
     }
 
-    public String getIsFrame()
-    {
+    public String getIsFrame() {
         return isFrame;
     }
 
-    public void setIsFrame(String isFrame)
-    {
+    public void setIsFrame(String isFrame) {
         this.isFrame = isFrame;
     }
 
-    public String getIsCache()
-    {
+    public String getIsCache() {
         return isCache;
     }
 
-    public void setIsCache(String isCache)
-    {
+    public void setIsCache(String isCache) {
         this.isCache = isCache;
     }
 
     @NotBlank(message = "菜单类型不能为空")
-    public String getMenuType()
-    {
+    public String getMenuType() {
         return menuType;
     }
 
-    public void setMenuType(String menuType)
-    {
+    public void setMenuType(String menuType) {
         this.menuType = menuType;
     }
 
-    public String getVisible()
-    {
+    public String getVisible() {
         return visible;
     }
 
-    public void setVisible(String visible)
-    {
+    public void setVisible(String visible) {
         this.visible = visible;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
 
     @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
-    public String getPerms()
-    {
+    public String getPerms() {
         return perms;
     }
 
-    public void setPerms(String perms)
-    {
+    public void setPerms(String perms) {
         this.perms = perms;
     }
 
-    public String getIcon()
-    {
+    public String getIcon() {
         return icon;
     }
 
-    public void setIcon(String icon)
-    {
+    public void setIcon(String icon) {
         this.icon = icon;
     }
 
-    public List<SysMenu> getChildren()
-    {
+    public List<SysMenu> getChildren() {
         return children;
     }
 
-    public void setChildren(List<SysMenu> children)
-    {
+    public void setChildren(List<SysMenu> children) {
         this.children = children;
     }
-    
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("menuId", getMenuId())
-            .append("menuName", getMenuName())
-            .append("parentId", getParentId())
-            .append("orderNum", getOrderNum())
-            .append("path", getPath())
-            .append("component", getComponent())
-            .append("isFrame", getIsFrame())
-            .append("IsCache", getIsCache())
-            .append("menuType", getMenuType())
-            .append("visible", getVisible())
-            .append("status ", getStatus())
-            .append("perms", getPerms())
-            .append("icon", getIcon())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("menuId", getMenuId())
+                .append("menuName", getMenuName())
+                .append("parentId", getParentId())
+                .append("orderNum", getOrderNum())
+                .append("path", getPath())
+                .append("component", getComponent())
+                .append("isFrame", getIsFrame())
+                .append("IsCache", getIsCache())
+                .append("menuType", getMenuType())
+                .append("visible", getVisible())
+                .append("status ", getStatus())
+                .append("perms", getPerms())
+                .append("icon", getIcon())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
     }
 }

+ 97 - 102
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java

@@ -1,244 +1,239 @@
 package com.ruoyi.common.core.domain.entity;
 
-import java.util.Set;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
 import com.baomidou.mybatisplus.annotation.TableId;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.Set;
 
 /**
  * 角色表 sys_role
- * 
+ *
  * @author ruoyi
  */
-public class SysRole extends BaseEntity
-{
+public class SysRole extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 角色ID */
+    /**
+     * 角色ID
+     */
     @TableId
     @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
     private Long roleId;
 
-    /** 角色名称 */
+    /**
+     * 角色名称
+     */
     @Excel(name = "角色名称")
     private String roleName;
 
-    /** 角色权限 */
+    /**
+     * 角色权限
+     */
     @Excel(name = "角色权限")
     private String roleKey;
 
-    /** 角色排序 */
+    /**
+     * 角色排序
+     */
     @Excel(name = "角色排序")
     private Integer roleSort;
 
-    /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
+    /**
+     * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)
+     */
     @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
     private String dataScope;
 
-    /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
+    /**
+     * 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)
+     */
     private boolean menuCheckStrictly;
 
-    /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
+    /**
+     * 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )
+     */
     private boolean deptCheckStrictly;
 
-    /** 角色状态(0正常 1停用) */
+    /**
+     * 角色状态(0正常 1停用)
+     */
     @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
-    /** 删除标志(0代表存在 2代表删除) */
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
     private String delFlag;
 
-    /** 用户是否存在此角色标识 默认不存在 */
+    /**
+     * 用户是否存在此角色标识 默认不存在
+     */
     private boolean flag = false;
 
-    /** 菜单组 */
+    /**
+     * 菜单组
+     */
     private Long[] menuIds;
 
-    /** 部门组(数据权限) */
+    /**
+     * 部门组(数据权限)
+     */
     private Long[] deptIds;
 
-    /** 角色菜单权限 */
+    /**
+     * 角色菜单权限
+     */
     private Set<String> permissions;
 
-    public SysRole()
-    {
+    public SysRole() {
 
     }
 
-    public SysRole(Long roleId)
-    {
+    public SysRole(Long roleId) {
         this.roleId = roleId;
     }
 
-    public Long getRoleId()
-    {
+    public static boolean isAdmin(Long roleId) {
+        return roleId != null && 1L == roleId;
+    }
+
+    public Long getRoleId() {
         return roleId;
     }
 
-    public void setRoleId(Long roleId)
-    {
+    public void setRoleId(Long roleId) {
         this.roleId = roleId;
     }
 
-    public boolean isAdmin()
-    {
+    public boolean isAdmin() {
         return isAdmin(this.roleId);
     }
 
-    public static boolean isAdmin(Long roleId)
-    {
-        return roleId != null && 1L == roleId;
-    }
-
     @NotBlank(message = "角色名称不能为空")
     @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
-    public String getRoleName()
-    {
+    public String getRoleName() {
         return roleName;
     }
 
-    public void setRoleName(String roleName)
-    {
+    public void setRoleName(String roleName) {
         this.roleName = roleName;
     }
 
     @NotBlank(message = "权限字符不能为空")
     @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
-    public String getRoleKey()
-    {
+    public String getRoleKey() {
         return roleKey;
     }
 
-    public void setRoleKey(String roleKey)
-    {
+    public void setRoleKey(String roleKey) {
         this.roleKey = roleKey;
     }
 
     @NotNull(message = "显示顺序不能为空")
-    public Integer getRoleSort()
-    {
+    public Integer getRoleSort() {
         return roleSort;
     }
 
-    public void setRoleSort(Integer roleSort)
-    {
+    public void setRoleSort(Integer roleSort) {
         this.roleSort = roleSort;
     }
 
-    public String getDataScope()
-    {
+    public String getDataScope() {
         return dataScope;
     }
 
-    public void setDataScope(String dataScope)
-    {
+    public void setDataScope(String dataScope) {
         this.dataScope = dataScope;
     }
 
-    public boolean isMenuCheckStrictly()
-    {
+    public boolean isMenuCheckStrictly() {
         return menuCheckStrictly;
     }
 
-    public void setMenuCheckStrictly(boolean menuCheckStrictly)
-    {
+    public void setMenuCheckStrictly(boolean menuCheckStrictly) {
         this.menuCheckStrictly = menuCheckStrictly;
     }
 
-    public boolean isDeptCheckStrictly()
-    {
+    public boolean isDeptCheckStrictly() {
         return deptCheckStrictly;
     }
 
-    public void setDeptCheckStrictly(boolean deptCheckStrictly)
-    {
+    public void setDeptCheckStrictly(boolean deptCheckStrictly) {
         this.deptCheckStrictly = deptCheckStrictly;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getDelFlag()
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
-    public void setDelFlag(String delFlag)
-    {
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public boolean isFlag()
-    {
+    public boolean isFlag() {
         return flag;
     }
 
-    public void setFlag(boolean flag)
-    {
+    public void setFlag(boolean flag) {
         this.flag = flag;
     }
 
-    public Long[] getMenuIds()
-    {
+    public Long[] getMenuIds() {
         return menuIds;
     }
 
-    public void setMenuIds(Long[] menuIds)
-    {
+    public void setMenuIds(Long[] menuIds) {
         this.menuIds = menuIds;
     }
 
-    public Long[] getDeptIds()
-    {
+    public Long[] getDeptIds() {
         return deptIds;
     }
 
-    public void setDeptIds(Long[] deptIds)
-    {
+    public void setDeptIds(Long[] deptIds) {
         this.deptIds = deptIds;
     }
 
-    public Set<String> getPermissions()
-    {
+    public Set<String> getPermissions() {
         return permissions;
     }
 
-    public void setPermissions(Set<String> permissions)
-    {
+    public void setPermissions(Set<String> permissions) {
         this.permissions = permissions;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("roleId", getRoleId())
-            .append("roleName", getRoleName())
-            .append("roleKey", getRoleKey())
-            .append("roleSort", getRoleSort())
-            .append("dataScope", getDataScope())
-            .append("menuCheckStrictly", isMenuCheckStrictly())
-            .append("deptCheckStrictly", isDeptCheckStrictly())
-            .append("status", getStatus())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("roleId", getRoleId())
+                .append("roleName", getRoleName())
+                .append("roleKey", getRoleKey())
+                .append("roleSort", getRoleSort())
+                .append("dataScope", getDataScope())
+                .append("menuCheckStrictly", isMenuCheckStrictly())
+                .append("deptCheckStrictly", isDeptCheckStrictly())
+                .append("status", getStatus())
+                .append("delFlag", getDelFlag())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
     }
 }

+ 93 - 103
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -18,60 +18,85 @@ import java.util.List;
 
 /**
  * 用户对象 sys_user
- * 
+ *
  * @author ruoyi
  */
-public class SysUser extends BaseEntity
-{
+public class SysUser extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 用户ID */
+    /**
+     * 用户ID
+     */
     @TableId
     @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
     private Long userId;
 
-    /** 部门ID */
+    /**
+     * 部门ID
+     */
     @Excel(name = "部门编号", type = Type.IMPORT)
     private Long deptId;
 
-    /** 用户账号 */
+    /**
+     * 用户账号
+     */
     @Excel(name = "登录名称")
     private String userName;
 
-    /** 用户昵称 */
+    /**
+     * 用户昵称
+     */
     @Excel(name = "用户名称")
     private String nickName;
 
-    /** 用户邮箱 */
+    /**
+     * 用户邮箱
+     */
     @Excel(name = "用户邮箱")
     private String email;
 
-    /** 手机号码 */
+    /**
+     * 手机号码
+     */
     @Excel(name = "手机号码")
     private String phonenumber;
 
-    /** 用户性别 */
+    /**
+     * 用户性别
+     */
     @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
     private String sex;
 
-    /** 用户头像 */
+    /**
+     * 用户头像
+     */
     private String avatar;
 
-    /** 密码 */
+    /**
+     * 密码
+     */
     private String password;
 
-    /** 帐号状态(0正常 1停用) */
+    /**
+     * 帐号状态(0正常 1停用)
+     */
     @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
-    /** 删除标志(0代表存在 2代表删除) */
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
     private String delFlag;
 
-    /** 最后登录IP */
+    /**
+     * 最后登录IP
+     */
     @Excel(name = "最后登录IP", type = Type.EXPORT)
     private String loginIp;
 
-    /** 最后登录时间 */
+    /**
+     * 最后登录时间
+     */
     @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
     private Date loginDate;
 
@@ -117,190 +142,155 @@ public class SysUser extends BaseEntity
         this.userId = userId;
     }
 
+    public static boolean isAdmin(Long userId) {
+        return userId != null && 1L == userId;
+    }
+
     public Long getUserId() {
         return userId;
     }
 
-    public void setUserId(Long userId)
-    {
+    public void setUserId(Long userId) {
         this.userId = userId;
     }
 
-    public boolean isAdmin()
-    {
+    public boolean isAdmin() {
         return isAdmin(this.userId);
     }
 
-    public static boolean isAdmin(Long userId)
-    {
-        return userId != null && 1L == userId;
-    }
-
-    public Long getDeptId()
-    {
+    public Long getDeptId() {
         return deptId;
     }
 
-    public void setDeptId(Long deptId)
-    {
+    public void setDeptId(Long deptId) {
         this.deptId = deptId;
     }
 
     @Xss(message = "用户昵称不能包含脚本字符")
     @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
-    public String getNickName()
-    {
+    public String getNickName() {
         return nickName;
     }
 
-    public void setNickName(String nickName)
-    {
+    public void setNickName(String nickName) {
         this.nickName = nickName;
     }
 
     @Xss(message = "用户账号不能包含脚本字符")
     @NotBlank(message = "用户账号不能为空")
     @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
-    public String getUserName()
-    {
+    public String getUserName() {
         return userName;
     }
 
-    public void setUserName(String userName)
-    {
+    public void setUserName(String userName) {
         this.userName = userName;
     }
 
     @Email(message = "邮箱格式不正确")
     @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
-    public String getEmail()
-    {
+    public String getEmail() {
         return email;
     }
 
-    public void setEmail(String email)
-    {
+    public void setEmail(String email) {
         this.email = email;
     }
 
     @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
-    public String getPhonenumber()
-    {
+    public String getPhonenumber() {
         return phonenumber;
     }
 
-    public void setPhonenumber(String phonenumber)
-    {
+    public void setPhonenumber(String phonenumber) {
         this.phonenumber = phonenumber;
     }
 
-    public String getSex()
-    {
+    public String getSex() {
         return sex;
     }
 
-    public void setSex(String sex)
-    {
+    public void setSex(String sex) {
         this.sex = sex;
     }
 
-    public String getAvatar()
-    {
+    public String getAvatar() {
         return avatar;
     }
 
-    public void setAvatar(String avatar)
-    {
+    public void setAvatar(String avatar) {
         this.avatar = avatar;
     }
 
-    public String getPassword()
-    {
+    public String getPassword() {
         return password;
     }
 
-    public void setPassword(String password)
-    {
+    public void setPassword(String password) {
         this.password = password;
     }
 
-    public String getStatus()
-    {
+    public String getStatus() {
         return status;
     }
 
-    public void setStatus(String status)
-    {
+    public void setStatus(String status) {
         this.status = status;
     }
 
-    public String getDelFlag()
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
-    public void setDelFlag(String delFlag)
-    {
+    public void setDelFlag(String delFlag) {
         this.delFlag = delFlag;
     }
 
-    public String getLoginIp()
-    {
+    public String getLoginIp() {
         return loginIp;
     }
 
-    public void setLoginIp(String loginIp)
-    {
+    public void setLoginIp(String loginIp) {
         this.loginIp = loginIp;
     }
 
-    public Date getLoginDate()
-    {
+    public Date getLoginDate() {
         return loginDate;
     }
 
-    public void setLoginDate(Date loginDate)
-    {
+    public void setLoginDate(Date loginDate) {
         this.loginDate = loginDate;
     }
 
-    public SysDept getDept()
-    {
+    public SysDept getDept() {
         return dept;
     }
 
-    public void setDept(SysDept dept)
-    {
+    public void setDept(SysDept dept) {
         this.dept = dept;
     }
 
-    public List<SysRole> getRoles()
-    {
+    public List<SysRole> getRoles() {
         return roles;
     }
 
-    public void setRoles(List<SysRole> roles)
-    {
+    public void setRoles(List<SysRole> roles) {
         this.roles = roles;
     }
 
-    public Long[] getRoleIds()
-    {
+    public Long[] getRoleIds() {
         return roleIds;
     }
 
-    public void setRoleIds(Long[] roleIds)
-    {
+    public void setRoleIds(Long[] roleIds) {
         this.roleIds = roleIds;
     }
 
-    public Long[] getPostIds()
-    {
+    public Long[] getPostIds() {
         return postIds;
     }
 
-    public void setPostIds(Long[] postIds)
-    {
+    public void setPostIds(Long[] postIds) {
         this.postIds = postIds;
     }
 
@@ -329,19 +319,19 @@ public class SysUser extends BaseEntity
                 .append("nickName", getNickName())
                 .append("email", getEmail())
                 .append("phonenumber", getPhonenumber())
-            .append("sex", getSex())
-            .append("avatar", getAvatar())
-            .append("password", getPassword())
-            .append("status", getStatus())
-            .append("delFlag", getDelFlag())
-            .append("loginIp", getLoginIp())
-            .append("loginDate", getLoginDate())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .append("dept", getDept())
-            .toString();
+                .append("sex", getSex())
+                .append("avatar", getAvatar())
+                .append("password", getPassword())
+                .append("status", getStatus())
+                .append("delFlag", getDelFlag())
+                .append("loginIp", getLoginIp())
+                .append("loginDate", getLoginDate())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .append("dept", getDept())
+                .toString();
     }
 }

+ 54 - 86
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java

@@ -1,19 +1,19 @@
 package com.ruoyi.common.core.domain.model;
 
-import java.util.Collection;
-import java.util.Set;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
 import com.alibaba.fastjson2.annotation.JSONField;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.Collection;
+import java.util.Set;
 
 /**
  * 登录用户身份权限
- * 
+ *
  * @author ruoyi
  */
-public class LoginUser implements UserDetails
-{
+public class LoginUser implements UserDetails {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -71,64 +71,53 @@ public class LoginUser implements UserDetails
      */
     private SysUser user;
 
-    public Long getUserId()
-    {
-        return userId;
+    public LoginUser() {
     }
 
-    public void setUserId(Long userId)
-    {
-        this.userId = userId;
+    public LoginUser(SysUser user, Set<String> permissions) {
+        this.user = user;
+        this.permissions = permissions;
     }
 
-    public Long getDeptId()
-    {
-        return deptId;
+    public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions) {
+        this.userId = userId;
+        this.deptId = deptId;
+        this.user = user;
+        this.permissions = permissions;
     }
 
-    public void setDeptId(Long deptId)
-    {
-        this.deptId = deptId;
+    public Long getUserId() {
+        return userId;
     }
 
-    public String getToken()
-    {
-        return token;
+    public void setUserId(Long userId) {
+        this.userId = userId;
     }
 
-    public void setToken(String token)
-    {
-        this.token = token;
+    public Long getDeptId() {
+        return deptId;
     }
 
-    public LoginUser()
-    {
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
     }
 
-    public LoginUser(SysUser user, Set<String> permissions)
-    {
-        this.user = user;
-        this.permissions = permissions;
+    public String getToken() {
+        return token;
     }
 
-    public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
-    {
-        this.userId = userId;
-        this.deptId = deptId;
-        this.user = user;
-        this.permissions = permissions;
+    public void setToken(String token) {
+        this.token = token;
     }
 
     @JSONField(serialize = false)
     @Override
-    public String getPassword()
-    {
+    public String getPassword() {
         return user.getPassword();
     }
 
     @Override
-    public String getUsername()
-    {
+    public String getUsername() {
         return user.getUserName();
     }
 
@@ -137,130 +126,109 @@ public class LoginUser implements UserDetails
      */
     @JSONField(serialize = false)
     @Override
-    public boolean isAccountNonExpired()
-    {
+    public boolean isAccountNonExpired() {
         return true;
     }
 
     /**
      * 指定用户是否解锁,锁定的用户无法进行身份验证
-     * 
+     *
      * @return
      */
     @JSONField(serialize = false)
     @Override
-    public boolean isAccountNonLocked()
-    {
+    public boolean isAccountNonLocked() {
         return true;
     }
 
     /**
      * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
-     * 
+     *
      * @return
      */
     @JSONField(serialize = false)
     @Override
-    public boolean isCredentialsNonExpired()
-    {
+    public boolean isCredentialsNonExpired() {
         return true;
     }
 
     /**
      * 是否可用 ,禁用的用户不能身份验证
-     * 
+     *
      * @return
      */
     @JSONField(serialize = false)
     @Override
-    public boolean isEnabled()
-    {
+    public boolean isEnabled() {
         return true;
     }
 
-    public Long getLoginTime()
-    {
+    public Long getLoginTime() {
         return loginTime;
     }
 
-    public void setLoginTime(Long loginTime)
-    {
+    public void setLoginTime(Long loginTime) {
         this.loginTime = loginTime;
     }
 
-    public String getIpaddr()
-    {
+    public String getIpaddr() {
         return ipaddr;
     }
 
-    public void setIpaddr(String ipaddr)
-    {
+    public void setIpaddr(String ipaddr) {
         this.ipaddr = ipaddr;
     }
 
-    public String getLoginLocation()
-    {
+    public String getLoginLocation() {
         return loginLocation;
     }
 
-    public void setLoginLocation(String loginLocation)
-    {
+    public void setLoginLocation(String loginLocation) {
         this.loginLocation = loginLocation;
     }
 
-    public String getBrowser()
-    {
+    public String getBrowser() {
         return browser;
     }
 
-    public void setBrowser(String browser)
-    {
+    public void setBrowser(String browser) {
         this.browser = browser;
     }
 
-    public String getOs()
-    {
+    public String getOs() {
         return os;
     }
 
-    public void setOs(String os)
-    {
+    public void setOs(String os) {
         this.os = os;
     }
 
-    public Long getExpireTime()
-    {
+    public Long getExpireTime() {
         return expireTime;
     }
 
-    public void setExpireTime(Long expireTime)
-    {
+    public void setExpireTime(Long expireTime) {
         this.expireTime = expireTime;
     }
 
-    public Set<String> getPermissions()
-    {
+    public Set<String> getPermissions() {
         return permissions;
     }
 
-    public void setPermissions(Set<String> permissions)
-    {
+    public void setPermissions(Set<String> permissions) {
         this.permissions = permissions;
     }
 
-    public SysUser getUser()
-    {
+    public SysUser getUser() {
         return user;
     }
 
-    public void setUser(SysUser user)
-    {
+    public void setUser(SysUser user) {
         this.user = user;
     }
 
     @Override
-    public Collection<? extends GrantedAuthority> getAuthorities()
-    {
+    public Collection<? extends GrantedAuthority> getAuthorities() {
         return null;
     }
 }

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java

@@ -2,10 +2,9 @@ package com.ruoyi.common.core.domain.model;
 
 /**
  * 用户注册对象
- * 
+ *
  * @author ruoyi
  */
-public class RegisterBody extends LoginBody
-{
+public class RegisterBody extends LoginBody {
 
 }

+ 33 - 41
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java

@@ -4,98 +4,90 @@ import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 分页数据
- * 
+ *
  * @author ruoyi
  */
-public class PageDomain
-{
-    /** 当前记录起始索引 */
+public class PageDomain {
+    /**
+     * 当前记录起始索引
+     */
     private Integer pageNum;
 
-    /** 每页显示记录数 */
+    /**
+     * 每页显示记录数
+     */
     private Integer pageSize;
 
-    /** 排序列 */
+    /**
+     * 排序列
+     */
     private String orderByColumn;
 
-    /** 排序的方向desc或者asc */
+    /**
+     * 排序的方向desc或者asc
+     */
     private String isAsc = "asc";
 
-    /** 分页参数合理化 */
+    /**
+     * 分页参数合理化
+     */
     private Boolean reasonable = true;
 
-    public String getOrderBy()
-    {
-        if (StringUtils.isEmpty(orderByColumn))
-        {
+    public String getOrderBy() {
+        if (StringUtils.isEmpty(orderByColumn)) {
             return "";
         }
         return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
     }
 
-    public Integer getPageNum()
-    {
+    public Integer getPageNum() {
         return pageNum;
     }
 
-    public void setPageNum(Integer pageNum)
-    {
+    public void setPageNum(Integer pageNum) {
         this.pageNum = pageNum;
     }
 
-    public Integer getPageSize()
-    {
+    public Integer getPageSize() {
         return pageSize;
     }
 
-    public void setPageSize(Integer pageSize)
-    {
+    public void setPageSize(Integer pageSize) {
         this.pageSize = pageSize;
     }
 
-    public String getOrderByColumn()
-    {
+    public String getOrderByColumn() {
         return orderByColumn;
     }
 
-    public void setOrderByColumn(String orderByColumn)
-    {
+    public void setOrderByColumn(String orderByColumn) {
         this.orderByColumn = orderByColumn;
     }
 
-    public String getIsAsc()
-    {
+    public String getIsAsc() {
         return isAsc;
     }
 
-    public void setIsAsc(String isAsc)
-    {
-        if (StringUtils.isNotEmpty(isAsc))
-        {
+    public void setIsAsc(String isAsc) {
+        if (StringUtils.isNotEmpty(isAsc)) {
             // 兼容前端排序类型
-            if ("ascending".equals(isAsc))
-            {
+            if ("ascending".equals(isAsc)) {
                 isAsc = "asc";
-            }
-            else if ("descending".equals(isAsc))
-            {
+            } else if ("descending".equals(isAsc)) {
                 isAsc = "desc";
             }
             this.isAsc = isAsc;
         }
     }
 
-    public Boolean getReasonable()
-    {
-        if (StringUtils.isNull(reasonable))
-        {
+    public Boolean getReasonable() {
+        if (StringUtils.isNull(reasonable)) {
             return Boolean.TRUE;
         }
         return reasonable;
     }
 
-    public void setReasonable(Boolean reasonable)
-    {
+    public void setReasonable(Boolean reasonable) {
         this.reasonable = reasonable;
     }
 }

+ 26 - 29
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java

@@ -5,81 +5,78 @@ import java.util.List;
 
 /**
  * 表格分页数据对象
- * 
+ *
  * @author ruoyi
  */
-public class TableDataInfo implements Serializable
-{
+public class TableDataInfo implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    /** 总记录数 */
+    /**
+     * 总记录数
+     */
     private long total;
 
-    /** 列表数据 */
+    /**
+     * 列表数据
+     */
     private List<?> rows;
 
-    /** 消息状态码 */
+    /**
+     * 消息状态码
+     */
     private int code;
 
-    /** 消息内容 */
+    /**
+     * 消息内容
+     */
     private String msg;
 
     /**
      * 表格数据对象
      */
-    public TableDataInfo()
-    {
+    public TableDataInfo() {
     }
 
     /**
      * 分页
-     * 
-     * @param list 列表数据
+     *
+     * @param list  列表数据
      * @param total 总记录数
      */
-    public TableDataInfo(List<?> list, int total)
-    {
+    public TableDataInfo(List<?> list, int total) {
         this.rows = list;
         this.total = total;
     }
 
-    public long getTotal()
-    {
+    public long getTotal() {
         return total;
     }
 
-    public void setTotal(long total)
-    {
+    public void setTotal(long total) {
         this.total = total;
     }
 
-    public List<?> getRows()
-    {
+    public List<?> getRows() {
         return rows;
     }
 
-    public void setRows(List<?> rows)
-    {
+    public void setRows(List<?> rows) {
         this.rows = rows;
     }
 
-    public int getCode()
-    {
+    public int getCode() {
         return code;
     }
 
-    public void setCode(int code)
-    {
+    public void setCode(int code) {
         this.code = code;
     }
 
-    public String getMsg()
-    {
+    public String getMsg() {
         return msg;
     }
 
-    public void setMsg(String msg)
-    {
+    public void setMsg(String msg) {
         this.msg = msg;
     }
 }

+ 4 - 7
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java

@@ -5,11 +5,10 @@ import com.ruoyi.common.utils.ServletUtils;
 
 /**
  * 表格数据处理
- * 
+ *
  * @author ruoyi
  */
-public class TableSupport
-{
+public class TableSupport {
     /**
      * 当前记录起始索引
      */
@@ -38,8 +37,7 @@ public class TableSupport
     /**
      * 封装分页对象
      */
-    public static PageDomain getPageDomain()
-    {
+    public static PageDomain getPageDomain() {
         PageDomain pageDomain = new PageDomain();
         pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
         pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
@@ -49,8 +47,7 @@ public class TableSupport
         return pageDomain;
     }
 
-    public static PageDomain buildPageRequest()
-    {
+    public static PageDomain buildPageRequest() {
         return getPageDomain();
     }
 }

+ 40 - 65
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@@ -1,11 +1,5 @@
 package com.ruoyi.common.core.redis;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.BoundSetOperations;
 import org.springframework.data.redis.core.HashOperations;
@@ -13,64 +7,62 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Component;
 
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
 /**
  * spring redis 工具类
  *
  * @author ruoyi
  **/
-@SuppressWarnings(value = { "unchecked", "rawtypes" })
+@SuppressWarnings(value = {"unchecked", "rawtypes"})
 @Component
-public class RedisCache
-{
+public class RedisCache {
     @Autowired
     public RedisTemplate redisTemplate;
 
     /**
      * 缓存基本的对象,Integer、String、实体类等
      *
-     * @param key 缓存的键值
+     * @param key   缓存的键值
      * @param value 缓存的值
      */
-    public <T> void setCacheObject(final String key, final T value)
-    {
+    public <T> void setCacheObject(final String key, final T value) {
         redisTemplate.opsForValue().set(key, value);
     }
 
     /**
      * 缓存基本的对象,Integer、String、实体类等
      *
-     * @param key 缓存的键值
-     * @param value 缓存的值
-     * @param timeout 时间
+     * @param key      缓存的键值
+     * @param value    缓存的值
+     * @param timeout  时间
      * @param timeUnit 时间颗粒度
      */
-    public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit)
-    {
+    public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) {
         redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
     }
 
     /**
      * 设置有效时间
      *
-     * @param key Redis键
+     * @param key     Redis键
      * @param timeout 超时时间
      * @return true=设置成功;false=设置失败
      */
-    public boolean expire(final String key, final long timeout)
-    {
+    public boolean expire(final String key, final long timeout) {
         return expire(key, timeout, TimeUnit.SECONDS);
     }
 
     /**
      * 设置有效时间
      *
-     * @param key Redis键
+     * @param key     Redis键
      * @param timeout 超时时间
-     * @param unit 时间单位
+     * @param unit    时间单位
      * @return true=设置成功;false=设置失败
      */
-    public boolean expire(final String key, final long timeout, final TimeUnit unit)
-    {
+    public boolean expire(final String key, final long timeout, final TimeUnit unit) {
         return redisTemplate.expire(key, timeout, unit);
     }
 
@@ -80,8 +72,7 @@ public class RedisCache
      * @param key Redis键
      * @return 有效时间
      */
-    public long getExpire(final String key)
-    {
+    public long getExpire(final String key) {
         return redisTemplate.getExpire(key);
     }
 
@@ -91,8 +82,7 @@ public class RedisCache
      * @param key 键
      * @return true 存在 false不存在
      */
-    public Boolean hasKey(String key)
-    {
+    public Boolean hasKey(String key) {
         return redisTemplate.hasKey(key);
     }
 
@@ -102,8 +92,7 @@ public class RedisCache
      * @param key 缓存键值
      * @return 缓存键值对应的数据
      */
-    public <T> T getCacheObject(final String key)
-    {
+    public <T> T getCacheObject(final String key) {
         ValueOperations<String, T> operation = redisTemplate.opsForValue();
         return operation.get(key);
     }
@@ -113,8 +102,7 @@ public class RedisCache
      *
      * @param key
      */
-    public boolean deleteObject(final String key)
-    {
+    public boolean deleteObject(final String key) {
         return redisTemplate.delete(key);
     }
 
@@ -124,20 +112,18 @@ public class RedisCache
      * @param collection 多个对象
      * @return
      */
-    public boolean deleteObject(final Collection collection)
-    {
+    public boolean deleteObject(final Collection collection) {
         return redisTemplate.delete(collection) > 0;
     }
 
     /**
      * 缓存List数据
      *
-     * @param key 缓存的键值
+     * @param key      缓存的键值
      * @param dataList 待缓存的List数据
      * @return 缓存的对象
      */
-    public <T> long setCacheList(final String key, final List<T> dataList)
-    {
+    public <T> long setCacheList(final String key, final List<T> dataList) {
         Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
         return count == null ? 0 : count;
     }
@@ -148,24 +134,21 @@ public class RedisCache
      * @param key 缓存的键值
      * @return 缓存键值对应的数据
      */
-    public <T> List<T> getCacheList(final String key)
-    {
+    public <T> List<T> getCacheList(final String key) {
         return redisTemplate.opsForList().range(key, 0, -1);
     }
 
     /**
      * 缓存Set
      *
-     * @param key 缓存键值
+     * @param key     缓存键值
      * @param dataSet 缓存的数据
      * @return 缓存数据的对象
      */
-    public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet)
-    {
+    public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
         BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
         Iterator<T> it = dataSet.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             setOperation.add(it.next());
         }
         return setOperation;
@@ -177,8 +160,7 @@ public class RedisCache
      * @param key
      * @return
      */
-    public <T> Set<T> getCacheSet(final String key)
-    {
+    public <T> Set<T> getCacheSet(final String key) {
         return redisTemplate.opsForSet().members(key);
     }
 
@@ -188,8 +170,7 @@ public class RedisCache
      * @param key
      * @param dataMap
      */
-    public <T> void setCacheMap(final String key, final Map<String, T> dataMap)
-    {
+    public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
         if (dataMap != null) {
             redisTemplate.opsForHash().putAll(key, dataMap);
         }
@@ -201,32 +182,29 @@ public class RedisCache
      * @param key
      * @return
      */
-    public <T> Map<String, T> getCacheMap(final String key)
-    {
+    public <T> Map<String, T> getCacheMap(final String key) {
         return redisTemplate.opsForHash().entries(key);
     }
 
     /**
      * 往Hash中存入数据
      *
-     * @param key Redis键
-     * @param hKey Hash键
+     * @param key   Redis键
+     * @param hKey  Hash键
      * @param value 值
      */
-    public <T> void setCacheMapValue(final String key, final String hKey, final T value)
-    {
+    public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
         redisTemplate.opsForHash().put(key, hKey, value);
     }
 
     /**
      * 获取Hash中的数据
      *
-     * @param key Redis键
+     * @param key  Redis键
      * @param hKey Hash键
      * @return Hash中的对象
      */
-    public <T> T getCacheMapValue(final String key, final String hKey)
-    {
+    public <T> T getCacheMapValue(final String key, final String hKey) {
         HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
         return opsForHash.get(key, hKey);
     }
@@ -234,24 +212,22 @@ public class RedisCache
     /**
      * 获取多个Hash中的数据
      *
-     * @param key Redis键
+     * @param key   Redis键
      * @param hKeys Hash键集合
      * @return Hash对象集合
      */
-    public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys)
-    {
+    public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
         return redisTemplate.opsForHash().multiGet(key, hKeys);
     }
 
     /**
      * 删除Hash中的某条数据
      *
-     * @param key Redis键
+     * @param key  Redis键
      * @param hKey Hash键
      * @return 是否成功
      */
-    public boolean deleteCacheMapValue(final String key, final String hKey)
-    {
+    public boolean deleteCacheMapValue(final String key, final String hKey) {
         return redisTemplate.opsForHash().delete(key, hKey) > 0;
     }
 
@@ -261,8 +237,7 @@ public class RedisCache
      * @param pattern 字符串前缀
      * @return 对象列表
      */
-    public Collection<String> keys(final String pattern)
-    {
+    public Collection<String> keys(final String pattern) {
         return redisTemplate.keys(pattern);
     }
 }

+ 36 - 31
ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java

@@ -1,76 +1,82 @@
 package com.ruoyi.common.core.text;
 
+import com.ruoyi.common.utils.StringUtils;
+
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
-import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 字符集工具类
- * 
+ *
  * @author ruoyi
  */
-public class CharsetKit
-{
-    /** ISO-8859-1 */
+public class CharsetKit {
+    /**
+     * ISO-8859-1
+     */
     public static final String ISO_8859_1 = "ISO-8859-1";
-    /** UTF-8 */
+    /**
+     * UTF-8
+     */
     public static final String UTF_8 = "UTF-8";
-    /** GBK */
+    /**
+     * GBK
+     */
     public static final String GBK = "GBK";
 
-    /** ISO-8859-1 */
+    /**
+     * ISO-8859-1
+     */
     public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1);
-    /** UTF-8 */
+    /**
+     * UTF-8
+     */
     public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8);
-    /** GBK */
+    /**
+     * GBK
+     */
     public static final Charset CHARSET_GBK = Charset.forName(GBK);
 
     /**
      * 转换为Charset对象
-     * 
+     *
      * @param charset 字符集,为空则返回默认字符集
      * @return Charset
      */
-    public static Charset charset(String charset)
-    {
+    public static Charset charset(String charset) {
         return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset);
     }
 
     /**
      * 转换字符串的字符集编码
-     * 
-     * @param source 字符串
-     * @param srcCharset 源字符集,默认ISO-8859-1
+     *
+     * @param source      字符串
+     * @param srcCharset  源字符集,默认ISO-8859-1
      * @param destCharset 目标字符集,默认UTF-8
      * @return 转换后的字符集
      */
-    public static String convert(String source, String srcCharset, String destCharset)
-    {
+    public static String convert(String source, String srcCharset, String destCharset) {
         return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset));
     }
 
     /**
      * 转换字符串的字符集编码
-     * 
-     * @param source 字符串
-     * @param srcCharset 源字符集,默认ISO-8859-1
+     *
+     * @param source      字符串
+     * @param srcCharset  源字符集,默认ISO-8859-1
      * @param destCharset 目标字符集,默认UTF-8
      * @return 转换后的字符集
      */
-    public static String convert(String source, Charset srcCharset, Charset destCharset)
-    {
-        if (null == srcCharset)
-        {
+    public static String convert(String source, Charset srcCharset, Charset destCharset) {
+        if (null == srcCharset) {
             srcCharset = StandardCharsets.ISO_8859_1;
         }
 
-        if (null == destCharset)
-        {
+        if (null == destCharset) {
             destCharset = StandardCharsets.UTF_8;
         }
 
-        if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset))
-        {
+        if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) {
             return source;
         }
         return new String(source.getBytes(srcCharset), destCharset);
@@ -79,8 +85,7 @@ public class CharsetKit
     /**
      * @return 系统字符集编码
      */
-    public static String systemCharset()
-    {
+    public static String systemCharset() {
         return Charset.defaultCharset().name();
     }
 }

+ 170 - 321
ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java

@@ -1,38 +1,35 @@
 package com.ruoyi.common.core.text;
 
+import com.ruoyi.common.utils.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.text.NumberFormat;
 import java.util.Set;
-import com.ruoyi.common.utils.StringUtils;
-import org.apache.commons.lang3.ArrayUtils;
 
 /**
  * 类型转换器
  *
  * @author ruoyi
  */
-public class Convert
-{
+public class Convert {
     /**
      * 转换为字符串<br>
      * 如果给定的值为null,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static String toStr(Object value, String defaultValue)
-    {
-        if (null == value)
-        {
+    public static String toStr(Object value, String defaultValue) {
+        if (null == value) {
             return defaultValue;
         }
-        if (value instanceof String)
-        {
+        if (value instanceof String) {
             return (String) value;
         }
         return value.toString();
@@ -46,8 +43,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static String toStr(Object value)
-    {
+    public static String toStr(Object value) {
         return toStr(value, null);
     }
 
@@ -56,18 +52,15 @@ public class Convert
      * 如果给定的值为null,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Character toChar(Object value, Character defaultValue)
-    {
-        if (null == value)
-        {
+    public static Character toChar(Object value, Character defaultValue) {
+        if (null == value) {
             return defaultValue;
         }
-        if (value instanceof Character)
-        {
+        if (value instanceof Character) {
             return (Character) value;
         }
 
@@ -83,8 +76,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Character toChar(Object value)
-    {
+    public static Character toChar(Object value) {
         return toChar(value, null);
     }
 
@@ -93,35 +85,27 @@ public class Convert
      * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Byte toByte(Object value, Byte defaultValue)
-    {
-        if (value == null)
-        {
+    public static Byte toByte(Object value, Byte defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Byte)
-        {
+        if (value instanceof Byte) {
             return (Byte) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).byteValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return Byte.parseByte(valueStr);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -134,8 +118,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Byte toByte(Object value)
-    {
+    public static Byte toByte(Object value) {
         return toByte(value, null);
     }
 
@@ -144,35 +127,27 @@ public class Convert
      * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Short toShort(Object value, Short defaultValue)
-    {
-        if (value == null)
-        {
+    public static Short toShort(Object value, Short defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Short)
-        {
+        if (value instanceof Short) {
             return (Short) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).shortValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return Short.parseShort(valueStr.trim());
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -185,8 +160,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Short toShort(Object value)
-    {
+    public static Short toShort(Object value) {
         return toShort(value, null);
     }
 
@@ -195,31 +169,24 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Number toNumber(Object value, Number defaultValue)
-    {
-        if (value == null)
-        {
+    public static Number toNumber(Object value, Number defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return (Number) value;
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return NumberFormat.getInstance().parse(valueStr);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -232,8 +199,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Number toNumber(Object value)
-    {
+    public static Number toNumber(Object value) {
         return toNumber(value, null);
     }
 
@@ -242,35 +208,27 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Integer toInt(Object value, Integer defaultValue)
-    {
-        if (value == null)
-        {
+    public static Integer toInt(Object value, Integer defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Integer)
-        {
+        if (value instanceof Integer) {
             return (Integer) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).intValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return Integer.parseInt(valueStr.trim());
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -283,8 +241,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Integer toInt(Object value)
-    {
+    public static Integer toInt(Object value) {
         return toInt(value, null);
     }
 
@@ -294,8 +251,7 @@ public class Convert
      * @param str 被转换的值
      * @return 结果
      */
-    public static Integer[] toIntArray(String str)
-    {
+    public static Integer[] toIntArray(String str) {
         return toIntArray(",", str);
     }
 
@@ -305,8 +261,7 @@ public class Convert
      * @param str 被转换的值
      * @return 结果
      */
-    public static Long[] toLongArray(String str)
-    {
+    public static Long[] toLongArray(String str) {
         return toLongArray(",", str);
     }
 
@@ -317,16 +272,13 @@ public class Convert
      * @param split 被转换的值
      * @return 结果
      */
-    public static Integer[] toIntArray(String split, String str)
-    {
-        if (StringUtils.isEmpty(str))
-        {
-            return new Integer[] {};
+    public static Integer[] toIntArray(String split, String str) {
+        if (StringUtils.isEmpty(str)) {
+            return new Integer[]{};
         }
         String[] arr = str.split(split);
         final Integer[] ints = new Integer[arr.length];
-        for (int i = 0; i < arr.length; i++)
-        {
+        for (int i = 0; i < arr.length; i++) {
             final Integer v = toInt(arr[i], 0);
             ints[i] = v;
         }
@@ -337,19 +289,16 @@ public class Convert
      * 转换为Long数组<br>
      *
      * @param split 分隔符
-     * @param str 被转换的值
+     * @param str   被转换的值
      * @return 结果
      */
-    public static Long[] toLongArray(String split, String str)
-    {
-        if (StringUtils.isEmpty(str))
-        {
-            return new Long[] {};
+    public static Long[] toLongArray(String split, String str) {
+        if (StringUtils.isEmpty(str)) {
+            return new Long[]{};
         }
         String[] arr = str.split(split);
         final Long[] longs = new Long[arr.length];
-        for (int i = 0; i < arr.length; i++)
-        {
+        for (int i = 0; i < arr.length; i++) {
             final Long v = toLong(arr[i], null);
             longs[i] = v;
         }
@@ -362,8 +311,7 @@ public class Convert
      * @param str 被转换的值
      * @return 结果
      */
-    public static String[] toStrArray(String str)
-    {
+    public static String[] toStrArray(String str) {
         return toStrArray(",", str);
     }
 
@@ -374,8 +322,7 @@ public class Convert
      * @param split 被转换的值
      * @return 结果
      */
-    public static String[] toStrArray(String split, String str)
-    {
+    public static String[] toStrArray(String split, String str) {
         return str.split(split);
     }
 
@@ -384,36 +331,28 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Long toLong(Object value, Long defaultValue)
-    {
-        if (value == null)
-        {
+    public static Long toLong(Object value, Long defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Long)
-        {
+        if (value instanceof Long) {
             return (Long) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).longValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             // 支持科学计数法
             return new BigDecimal(valueStr.trim()).longValue();
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -426,8 +365,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Long toLong(Object value)
-    {
+    public static Long toLong(Object value) {
         return toLong(value, null);
     }
 
@@ -436,36 +374,28 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Double toDouble(Object value, Double defaultValue)
-    {
-        if (value == null)
-        {
+    public static Double toDouble(Object value, Double defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Double)
-        {
+        if (value instanceof Double) {
             return (Double) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).doubleValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             // 支持科学计数法
             return new BigDecimal(valueStr.trim()).doubleValue();
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -478,8 +408,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Double toDouble(Object value)
-    {
+    public static Double toDouble(Object value) {
         return toDouble(value, null);
     }
 
@@ -488,35 +417,27 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Float toFloat(Object value, Float defaultValue)
-    {
-        if (value == null)
-        {
+    public static Float toFloat(Object value, Float defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Float)
-        {
+        if (value instanceof Float) {
             return (Float) value;
         }
-        if (value instanceof Number)
-        {
+        if (value instanceof Number) {
             return ((Number) value).floatValue();
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return Float.parseFloat(valueStr.trim());
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -529,8 +450,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Float toFloat(Object value)
-    {
+    public static Float toFloat(Object value) {
         return toFloat(value, null);
     }
 
@@ -539,28 +459,23 @@ public class Convert
      * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static Boolean toBool(Object value, Boolean defaultValue)
-    {
-        if (value == null)
-        {
+    public static Boolean toBool(Object value, Boolean defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof Boolean)
-        {
+        if (value instanceof Boolean) {
             return (Boolean) value;
         }
         String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
         valueStr = valueStr.trim().toLowerCase();
-        switch (valueStr)
-        {
+        switch (valueStr) {
             case "true":
             case "yes":
             case "ok":
@@ -583,8 +498,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static Boolean toBool(Object value)
-    {
+    public static Boolean toBool(Object value) {
         return toBool(value, null);
     }
 
@@ -592,34 +506,27 @@ public class Convert
      * 转换为Enum对象<br>
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      *
-     * @param clazz Enum的Class
-     * @param value 值
+     * @param clazz        Enum的Class
+     * @param value        
      * @param defaultValue 默认值
      * @return Enum
      */
-    public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue)
-    {
-        if (value == null)
-        {
+    public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (clazz.isAssignableFrom(value.getClass()))
-        {
+        if (clazz.isAssignableFrom(value.getClass())) {
             @SuppressWarnings("unchecked")
             E myE = (E) value;
             return myE;
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return Enum.valueOf(clazz, valueStr);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -632,8 +539,7 @@ public class Convert
      * @param value 值
      * @return Enum
      */
-    public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value)
-    {
+    public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) {
         return toEnum(clazz, value, null);
     }
 
@@ -642,35 +548,27 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
-    {
-        if (value == null)
-        {
+    public static BigInteger toBigInteger(Object value, BigInteger defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof BigInteger)
-        {
+        if (value instanceof BigInteger) {
             return (BigInteger) value;
         }
-        if (value instanceof Long)
-        {
+        if (value instanceof Long) {
             return BigInteger.valueOf((Long) value);
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return new BigInteger(valueStr);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -683,8 +581,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static BigInteger toBigInteger(Object value)
-    {
+    public static BigInteger toBigInteger(Object value) {
         return toBigInteger(value, null);
     }
 
@@ -693,43 +590,33 @@ public class Convert
      * 如果给定的值为空,或者转换失败,返回默认值<br>
      * 转换失败不会报错
      *
-     * @param value 被转换的值
+     * @param value        被转换的值
      * @param defaultValue 转换错误时的默认值
      * @return 结果
      */
-    public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
-    {
-        if (value == null)
-        {
+    public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
+        if (value == null) {
             return defaultValue;
         }
-        if (value instanceof BigDecimal)
-        {
+        if (value instanceof BigDecimal) {
             return (BigDecimal) value;
         }
-        if (value instanceof Long)
-        {
+        if (value instanceof Long) {
             return new BigDecimal((Long) value);
         }
-        if (value instanceof Double)
-        {
+        if (value instanceof Double) {
             return BigDecimal.valueOf((Double) value);
         }
-        if (value instanceof Integer)
-        {
+        if (value instanceof Integer) {
             return new BigDecimal((Integer) value);
         }
         final String valueStr = toStr(value, null);
-        if (StringUtils.isEmpty(valueStr))
-        {
+        if (StringUtils.isEmpty(valueStr)) {
             return defaultValue;
         }
-        try
-        {
+        try {
             return new BigDecimal(valueStr);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return defaultValue;
         }
     }
@@ -742,8 +629,7 @@ public class Convert
      * @param value 被转换的值
      * @return 结果
      */
-    public static BigDecimal toBigDecimal(Object value)
-    {
+    public static BigDecimal toBigDecimal(Object value) {
         return toBigDecimal(value, null);
     }
 
@@ -754,8 +640,7 @@ public class Convert
      * @param obj 对象
      * @return 字符串
      */
-    public static String utf8Str(Object obj)
-    {
+    public static String utf8Str(Object obj) {
         return str(obj, CharsetKit.CHARSET_UTF_8);
     }
 
@@ -763,12 +648,11 @@ public class Convert
      * 将对象转为字符串<br>
      * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
      *
-     * @param obj 对象
+     * @param obj         对象
      * @param charsetName 字符集
      * @return 字符串
      */
-    public static String str(Object obj, String charsetName)
-    {
+    public static String str(Object obj, String charsetName) {
         return str(obj, Charset.forName(charsetName));
     }
 
@@ -776,32 +660,23 @@ public class Convert
      * 将对象转为字符串<br>
      * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
      *
-     * @param obj 对象
+     * @param obj     对象
      * @param charset 字符集
      * @return 字符串
      */
-    public static String str(Object obj, Charset charset)
-    {
-        if (null == obj)
-        {
+    public static String str(Object obj, Charset charset) {
+        if (null == obj) {
             return null;
         }
 
-        if (obj instanceof String)
-        {
+        if (obj instanceof String) {
             return (String) obj;
-        }
-        else if (obj instanceof byte[])
-        {
+        } else if (obj instanceof byte[]) {
             return str((byte[]) obj, charset);
-        }
-        else if (obj instanceof Byte[])
-        {
+        } else if (obj instanceof Byte[]) {
             byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
             return str(bytes, charset);
-        }
-        else if (obj instanceof ByteBuffer)
-        {
+        } else if (obj instanceof ByteBuffer) {
             return str((ByteBuffer) obj, charset);
         }
         return obj.toString();
@@ -810,31 +685,27 @@ public class Convert
     /**
      * 将byte数组转为字符串
      *
-     * @param bytes byte数组
+     * @param bytes   byte数组
      * @param charset 字符集
      * @return 字符串
      */
-    public static String str(byte[] bytes, String charset)
-    {
+    public static String str(byte[] bytes, String charset) {
         return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
     }
 
     /**
      * 解码字节码
      *
-     * @param data 字符串
+     * @param data    字符串
      * @param charset 字符集,如果此字段为空,则解码的结果取决于平台
      * @return 解码后的字符串
      */
-    public static String str(byte[] data, Charset charset)
-    {
-        if (data == null)
-        {
+    public static String str(byte[] data, Charset charset) {
+        if (data == null) {
             return null;
         }
 
-        if (null == charset)
-        {
+        if (null == charset) {
             return new String(data);
         }
         return new String(data, charset);
@@ -843,14 +714,12 @@ public class Convert
     /**
      * 将编码的byteBuffer数据转换为字符串
      *
-     * @param data 数据
+     * @param data    数据
      * @param charset 字符集,如果为空使用当前系统字符集
      * @return 字符串
      */
-    public static String str(ByteBuffer data, String charset)
-    {
-        if (data == null)
-        {
+    public static String str(ByteBuffer data, String charset) {
+        if (data == null) {
             return null;
         }
 
@@ -860,55 +729,47 @@ public class Convert
     /**
      * 将编码的byteBuffer数据转换为字符串
      *
-     * @param data 数据
+     * @param data    数据
      * @param charset 字符集,如果为空使用当前系统字符集
      * @return 字符串
      */
-    public static String str(ByteBuffer data, Charset charset)
-    {
-        if (null == charset)
-        {
+    public static String str(ByteBuffer data, Charset charset) {
+        if (null == charset) {
             charset = Charset.defaultCharset();
         }
         return charset.decode(data).toString();
     }
 
     // ----------------------------------------------------------------------- 全角半角转换
+
     /**
      * 半角转全角
      *
      * @param input String.
      * @return 全角字符串.
      */
-    public static String toSBC(String input)
-    {
+    public static String toSBC(String input) {
         return toSBC(input, null);
     }
 
     /**
      * 半角转全角
      *
-     * @param input String
+     * @param input         String
      * @param notConvertSet 不替换的字符集合
      * @return 全角字符串.
      */
-    public static String toSBC(String input, Set<Character> notConvertSet)
-    {
+    public static String toSBC(String input, Set<Character> notConvertSet) {
         char[] c = input.toCharArray();
-        for (int i = 0; i < c.length; i++)
-        {
-            if (null != notConvertSet && notConvertSet.contains(c[i]))
-            {
+        for (int i = 0; i < c.length; i++) {
+            if (null != notConvertSet && notConvertSet.contains(c[i])) {
                 // 跳过不替换的字符
                 continue;
             }
 
-            if (c[i] == ' ')
-            {
+            if (c[i] == ' ') {
                 c[i] = '\u3000';
-            }
-            else if (c[i] < '\177')
-            {
+            } else if (c[i] < '\177') {
                 c[i] = (char) (c[i] + 65248);
 
             }
@@ -922,35 +783,28 @@ public class Convert
      * @param input String.
      * @return 半角字符串
      */
-    public static String toDBC(String input)
-    {
+    public static String toDBC(String input) {
         return toDBC(input, null);
     }
 
     /**
      * 替换全角为半角
      *
-     * @param text 文本
+     * @param text          文本
      * @param notConvertSet 不替换的字符集合
      * @return 替换后的字符
      */
-    public static String toDBC(String text, Set<Character> notConvertSet)
-    {
+    public static String toDBC(String text, Set<Character> notConvertSet) {
         char[] c = text.toCharArray();
-        for (int i = 0; i < c.length; i++)
-        {
-            if (null != notConvertSet && notConvertSet.contains(c[i]))
-            {
+        for (int i = 0; i < c.length; i++) {
+            if (null != notConvertSet && notConvertSet.contains(c[i])) {
                 // 跳过不替换的字符
                 continue;
             }
 
-            if (c[i] == '\u3000')
-            {
+            if (c[i] == '\u3000') {
                 c[i] = ' ';
-            }
-            else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
-            {
+            } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
                 c[i] = (char) (c[i] - 65248);
             }
         }
@@ -965,31 +819,26 @@ public class Convert
      * @param n 数字
      * @return 中文大写数字
      */
-    public static String digitUppercase(double n)
-    {
-        String[] fraction = { "角", "分" };
-        String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
-        String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } };
+    public static String digitUppercase(double n) {
+        String[] fraction = {"角", "分"};
+        String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"};
+        String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}};
 
         String head = n < 0 ? "负" : "";
         n = Math.abs(n);
 
         String s = "";
-        for (int i = 0; i < fraction.length; i++)
-        {
+        for (int i = 0; i < fraction.length; i++) {
             s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
         }
-        if (s.length() < 1)
-        {
+        if (s.length() < 1) {
             s = "整";
         }
         int integerPart = (int) Math.floor(n);
 
-        for (int i = 0; i < unit[0].length && integerPart > 0; i++)
-        {
+        for (int i = 0; i < unit[0].length && integerPart > 0; i++) {
             String p = "";
-            for (int j = 0; j < unit[1].length && n > 0; j++)
-            {
+            for (int j = 0; j < unit[1].length && n > 0; j++) {
                 p = digit[integerPart % 10] + unit[1][j] + p;
                 integerPart = integerPart / 10;
             }

+ 15 - 31
ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java

@@ -4,11 +4,10 @@ import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 字符串格式化
- * 
+ *
  * @author ruoyi
  */
-public class StrFormatter
-{
+public class StrFormatter {
     public static final String EMPTY_JSON = "{}";
     public static final char C_BACKSLASH = '\\';
     public static final char C_DELIM_START = '{';
@@ -22,15 +21,13 @@ public class StrFormatter
      * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
      * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
      * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
-     * 
+     *
      * @param strPattern 字符串模板
-     * @param argArray 参数列表
+     * @param argArray   参数列表
      * @return 结果
      */
-    public static String format(final String strPattern, final Object... argArray)
-    {
-        if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
-        {
+    public static String format(final String strPattern, final Object... argArray) {
+        if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
             return strPattern;
         }
         final int strPatternLength = strPattern.length();
@@ -40,43 +37,30 @@ public class StrFormatter
 
         int handledPosition = 0;
         int delimIndex;// 占位符所在位置
-        for (int argIndex = 0; argIndex < argArray.length; argIndex++)
-        {
+        for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
             delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
-            if (delimIndex == -1)
-            {
-                if (handledPosition == 0)
-                {
+            if (delimIndex == -1) {
+                if (handledPosition == 0) {
                     return strPattern;
-                }
-                else
-                { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
+                } else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
                     sbuf.append(strPattern, handledPosition, strPatternLength);
                     return sbuf.toString();
                 }
-            }
-            else
-            {
-                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
-                {
-                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
-                    {
+            } else {
+                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
+                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
                         // 转义符之前还有一个转义符,占位符依旧有效
                         sbuf.append(strPattern, handledPosition, delimIndex - 1);
                         sbuf.append(Convert.utf8Str(argArray[argIndex]));
                         handledPosition = delimIndex + 2;
-                    }
-                    else
-                    {
+                    } else {
                         // 占位符被转义
                         argIndex--;
                         sbuf.append(strPattern, handledPosition, delimIndex - 1);
                         sbuf.append(C_DELIM_START);
                         handledPosition = delimIndex + 1;
                     }
-                }
-                else
-                {
+                } else {
                     // 正常占位符
                     sbuf.append(strPattern, handledPosition, delimIndex);
                     sbuf.append(Convert.utf8Str(argArray[argIndex]));

+ 2 - 4
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java

@@ -2,12 +2,10 @@ package com.ruoyi.common.enums;
 
 /**
  * 操作状态
- * 
- * @author ruoyi
  *
+ * @author ruoyi
  */
-public enum BusinessStatus
-{
+public enum BusinessStatus {
     /**
      * 成功
      */

+ 3 - 4
ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
 
 /**
  * 业务操作类型
- * 
+ *
  * @author ruoyi
  */
-public enum BusinessType
-{
+public enum BusinessType {
     /**
      * 其它
      */
@@ -51,7 +50,7 @@ public enum BusinessType
      * 生成代码
      */
     GENCODE,
-    
+
     /**
      * 清空数据
      */

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
 
 /**
  * 数据源
- * 
+ *
  * @author ruoyi
  */
-public enum DataSourceType
-{
+public enum DataSourceType {
     /**
      * 主库
      */

+ 7 - 11
ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java

@@ -1,36 +1,32 @@
 package com.ruoyi.common.enums;
 
+import org.springframework.lang.Nullable;
+
 import java.util.HashMap;
 import java.util.Map;
-import org.springframework.lang.Nullable;
 
 /**
  * 请求方式
  *
  * @author ruoyi
  */
-public enum HttpMethod
-{
+public enum HttpMethod {
     GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
 
     private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
 
-    static
-    {
-        for (HttpMethod httpMethod : values())
-        {
+    static {
+        for (HttpMethod httpMethod : values()) {
             mappings.put(httpMethod.name(), httpMethod);
         }
     }
 
     @Nullable
-    public static HttpMethod resolve(@Nullable String method)
-    {
+    public static HttpMethod resolve(@Nullable String method) {
         return (method != null ? mappings.get(method) : null);
     }
 
-    public boolean matches(String method)
-    {
+    public boolean matches(String method) {
         return (this == resolve(method));
     }
 }

+ 1 - 2
ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java

@@ -6,8 +6,7 @@ package com.ruoyi.common.enums;
  * @author ruoyi
  */
 
-public enum LimitType
-{
+public enum LimitType {
     /**
      * 默认策略全局限流
      */

+ 2 - 3
ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.enums;
 
 /**
  * 操作人类别
- * 
+ *
  * @author ruoyi
  */
-public enum OperatorType
-{
+public enum OperatorType {
     /**
      * 其它
      */

+ 5 - 9
ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java

@@ -2,29 +2,25 @@ package com.ruoyi.common.enums;
 
 /**
  * 用户状态
- * 
+ *
  * @author ruoyi
  */
-public enum UserStatus
-{
+public enum UserStatus {
     OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
 
     private final String code;
     private final String info;
 
-    UserStatus(String code, String info)
-    {
+    UserStatus(String code, String info) {
         this.code = code;
         this.info = info;
     }
 
-    public String getCode()
-    {
+    public String getCode() {
         return code;
     }
 
-    public String getInfo()
-    {
+    public String getInfo() {
         return info;
     }
 }

+ 3 - 5
ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java

@@ -2,14 +2,12 @@ package com.ruoyi.common.exception;
 
 /**
  * 演示模式异常
- * 
+ *
  * @author ruoyi
  */
-public class DemoModeException extends RuntimeException
-{
+public class DemoModeException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
-    public DemoModeException()
-    {
+    public DemoModeException() {
     }
 }

+ 9 - 16
ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.exception;
 
 /**
  * 全局异常
- * 
+ *
  * @author ruoyi
  */
-public class GlobalException extends RuntimeException
-{
+public class GlobalException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -16,7 +15,7 @@ public class GlobalException extends RuntimeException
 
     /**
      * 错误明细,内部调试错误
-     *
+     * <p>
      * 和 {@link CommonResult#getDetailMessage()} 一致的设计
      */
     private String detailMessage;
@@ -24,34 +23,28 @@ public class GlobalException extends RuntimeException
     /**
      * 空构造方法,避免反序列化问题
      */
-    public GlobalException()
-    {
+    public GlobalException() {
     }
 
-    public GlobalException(String message)
-    {
+    public GlobalException(String message) {
         this.message = message;
     }
 
-    public String getDetailMessage()
-    {
+    public String getDetailMessage() {
         return detailMessage;
     }
 
-    public GlobalException setDetailMessage(String detailMessage)
-    {
+    public GlobalException setDetailMessage(String detailMessage) {
         this.detailMessage = detailMessage;
         return this;
     }
 
     @Override
-    public String getMessage()
-    {
+    public String getMessage() {
         return message;
     }
 
-    public GlobalException setMessage(String message)
-    {
+    public GlobalException setMessage(String message) {
         this.message = message;
         return this;
     }

+ 16 - 25
ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java

@@ -2,11 +2,10 @@ package com.ruoyi.common.exception;
 
 /**
  * 业务异常
- * 
+ *
  * @author ruoyi
  */
-public final class ServiceException extends RuntimeException
-{
+public final class ServiceException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -21,7 +20,7 @@ public final class ServiceException extends RuntimeException
 
     /**
      * 错误明细,内部调试错误
-     *
+     * <p>
      * 和 {@link CommonResult#getDetailMessage()} 一致的设计
      */
     private String detailMessage;
@@ -29,46 +28,38 @@ public final class ServiceException extends RuntimeException
     /**
      * 空构造方法,避免反序列化问题
      */
-    public ServiceException()
-    {
+    public ServiceException() {
     }
 
-    public ServiceException(String message)
-    {
+    public ServiceException(String message) {
         this.message = message;
     }
 
-    public ServiceException(String message, Integer code)
-    {
+    public ServiceException(String message, Integer code) {
         this.message = message;
         this.code = code;
     }
 
-    public String getDetailMessage()
-    {
+    public String getDetailMessage() {
         return detailMessage;
     }
 
-    @Override
-    public String getMessage()
-    {
-        return message;
+    public ServiceException setDetailMessage(String detailMessage) {
+        this.detailMessage = detailMessage;
+        return this;
     }
 
-    public Integer getCode()
-    {
-        return code;
+    @Override
+    public String getMessage() {
+        return message;
     }
 
-    public ServiceException setMessage(String message)
-    {
+    public ServiceException setMessage(String message) {
         this.message = message;
         return this;
     }
 
-    public ServiceException setDetailMessage(String detailMessage)
-    {
-        this.detailMessage = detailMessage;
-        return this;
+    public Integer getCode() {
+        return code;
     }
 }

+ 5 - 9
ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java

@@ -2,25 +2,21 @@ package com.ruoyi.common.exception;
 
 /**
  * 工具类异常
- * 
+ *
  * @author ruoyi
  */
-public class UtilException extends RuntimeException
-{
+public class UtilException extends RuntimeException {
     private static final long serialVersionUID = 8247610319171014183L;
 
-    public UtilException(Throwable e)
-    {
+    public UtilException(Throwable e) {
         super(e.getMessage(), e);
     }
 
-    public UtilException(String message)
-    {
+    public UtilException(String message) {
         super(message);
     }
 
-    public UtilException(String message, Throwable throwable)
-    {
+    public UtilException(String message, Throwable throwable) {
         super(message, throwable);
     }
 }

+ 14 - 27
ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java

@@ -5,11 +5,10 @@ import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 基础异常
- * 
+ *
  * @author ruoyi
  */
-public class BaseException extends RuntimeException
-{
+public class BaseException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
     /**
@@ -32,66 +31,54 @@ public class BaseException extends RuntimeException
      */
     private String defaultMessage;
 
-    public BaseException(String module, String code, Object[] args, String defaultMessage)
-    {
+    public BaseException(String module, String code, Object[] args, String defaultMessage) {
         this.module = module;
         this.code = code;
         this.args = args;
         this.defaultMessage = defaultMessage;
     }
 
-    public BaseException(String module, String code, Object[] args)
-    {
+    public BaseException(String module, String code, Object[] args) {
         this(module, code, args, null);
     }
 
-    public BaseException(String module, String defaultMessage)
-    {
+    public BaseException(String module, String defaultMessage) {
         this(module, null, null, defaultMessage);
     }
 
-    public BaseException(String code, Object[] args)
-    {
+    public BaseException(String code, Object[] args) {
         this(null, code, args, null);
     }
 
-    public BaseException(String defaultMessage)
-    {
+    public BaseException(String defaultMessage) {
         this(null, null, null, defaultMessage);
     }
 
     @Override
-    public String getMessage()
-    {
+    public String getMessage() {
         String message = null;
-        if (!StringUtils.isEmpty(code))
-        {
+        if (!StringUtils.isEmpty(code)) {
             message = MessageUtils.message(code, args);
         }
-        if (message == null)
-        {
+        if (message == null) {
             message = defaultMessage;
         }
         return message;
     }
 
-    public String getModule()
-    {
+    public String getModule() {
         return module;
     }
 
-    public String getCode()
-    {
+    public String getCode() {
         return code;
     }
 
-    public Object[] getArgs()
-    {
+    public Object[] getArgs() {
         return args;
     }
 
-    public String getDefaultMessage()
-    {
+    public String getDefaultMessage() {
         return defaultMessage;
     }
 }

+ 3 - 5
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java

@@ -4,15 +4,13 @@ import com.ruoyi.common.exception.base.BaseException;
 
 /**
  * 文件信息异常类
- * 
+ *
  * @author ruoyi
  */
-public class FileException extends BaseException
-{
+public class FileException extends BaseException {
     private static final long serialVersionUID = 1L;
 
-    public FileException(String code, Object[] args)
-    {
+    public FileException(String code, Object[] args) {
         super("file", code, args, null);
     }
 

+ 4 - 6
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java

@@ -2,15 +2,13 @@ package com.ruoyi.common.exception.file;
 
 /**
  * 文件名称超长限制异常类
- * 
+ *
  * @author ruoyi
  */
-public class FileNameLengthLimitExceededException extends FileException
-{
+public class FileNameLengthLimitExceededException extends FileException {
     private static final long serialVersionUID = 1L;
 
-    public FileNameLengthLimitExceededException(int defaultFileNameLength)
-    {
-        super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
+    public FileNameLengthLimitExceededException(int defaultFileNameLength) {
+        super("upload.filename.exceed.length", new Object[]{defaultFileNameLength});
     }
 }

+ 4 - 6
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java

@@ -2,15 +2,13 @@ package com.ruoyi.common.exception.file;
 
 /**
  * 文件名大小限制异常类
- * 
+ *
  * @author ruoyi
  */
-public class FileSizeLimitExceededException extends FileException
-{
+public class FileSizeLimitExceededException extends FileException {
     private static final long serialVersionUID = 1L;
 
-    public FileSizeLimitExceededException(long defaultMaxSize)
-    {
-        super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
+    public FileSizeLimitExceededException(long defaultMaxSize) {
+        super("upload.exceed.maxSize", new Object[]{defaultMaxSize});
     }
 }

+ 10 - 19
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileUploadException.java

@@ -5,57 +5,48 @@ import java.io.PrintWriter;
 
 /**
  * 文件上传异常类
- * 
+ *
  * @author ruoyi
  */
-public class FileUploadException extends Exception
-{
+public class FileUploadException extends Exception {
 
     private static final long serialVersionUID = 1L;
 
     private final Throwable cause;
 
-    public FileUploadException()
-    {
+    public FileUploadException() {
         this(null, null);
     }
 
-    public FileUploadException(final String msg)
-    {
+    public FileUploadException(final String msg) {
         this(msg, null);
     }
 
-    public FileUploadException(String msg, Throwable cause)
-    {
+    public FileUploadException(String msg, Throwable cause) {
         super(msg);
         this.cause = cause;
     }
 
     @Override
-    public void printStackTrace(PrintStream stream)
-    {
+    public void printStackTrace(PrintStream stream) {
         super.printStackTrace(stream);
-        if (cause != null)
-        {
+        if (cause != null) {
             stream.println("Caused by:");
             cause.printStackTrace(stream);
         }
     }
 
     @Override
-    public void printStackTrace(PrintWriter writer)
-    {
+    public void printStackTrace(PrintWriter writer) {
         super.printStackTrace(writer);
-        if (cause != null)
-        {
+        if (cause != null) {
             writer.println("Caused by:");
             cause.printStackTrace(writer);
         }
     }
 
     @Override
-    public Throwable getCause()
-    {
+    public Throwable getCause() {
         return cause;
     }
 }

+ 14 - 27
ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java

@@ -4,76 +4,63 @@ import java.util.Arrays;
 
 /**
  * 文件上传 误异常类
- * 
+ *
  * @author ruoyi
  */
-public class InvalidExtensionException extends FileUploadException
-{
+public class InvalidExtensionException extends FileUploadException {
     private static final long serialVersionUID = 1L;
 
     private String[] allowedExtension;
     private String extension;
     private String filename;
 
-    public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
-    {
+    public InvalidExtensionException(String[] allowedExtension, String extension, String filename) {
         super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式");
         this.allowedExtension = allowedExtension;
         this.extension = extension;
         this.filename = filename;
     }
 
-    public String[] getAllowedExtension()
-    {
+    public String[] getAllowedExtension() {
         return allowedExtension;
     }
 
-    public String getExtension()
-    {
+    public String getExtension() {
         return extension;
     }
 
-    public String getFilename()
-    {
+    public String getFilename() {
         return filename;
     }
 
-    public static class InvalidImageExtensionException extends InvalidExtensionException
-    {
+    public static class InvalidImageExtensionException extends InvalidExtensionException {
         private static final long serialVersionUID = 1L;
 
-        public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename)
-        {
+        public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
             super(allowedExtension, extension, filename);
         }
     }
 
-    public static class InvalidFlashExtensionException extends InvalidExtensionException
-    {
+    public static class InvalidFlashExtensionException extends InvalidExtensionException {
         private static final long serialVersionUID = 1L;
 
-        public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename)
-        {
+        public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) {
             super(allowedExtension, extension, filename);
         }
     }
 
-    public static class InvalidMediaExtensionException extends InvalidExtensionException
-    {
+    public static class InvalidMediaExtensionException extends InvalidExtensionException {
         private static final long serialVersionUID = 1L;
 
-        public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename)
-        {
+        public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
             super(allowedExtension, extension, filename);
         }
     }
 
-    public static class InvalidVideoExtensionException extends InvalidExtensionException
-    {
+    public static class InvalidVideoExtensionException extends InvalidExtensionException {
         private static final long serialVersionUID = 1L;
 
-        public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename)
-        {
+        public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) {
             super(allowedExtension, extension, filename);
         }
     }

+ 6 - 11
ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java

@@ -2,33 +2,28 @@ package com.ruoyi.common.exception.job;
 
 /**
  * 计划策略异常
- * 
+ *
  * @author ruoyi
  */
-public class TaskException extends Exception
-{
+public class TaskException extends Exception {
     private static final long serialVersionUID = 1L;
 
     private Code code;
 
-    public TaskException(String msg, Code code)
-    {
+    public TaskException(String msg, Code code) {
         this(msg, code, null);
     }
 
-    public TaskException(String msg, Code code, Exception nestedEx)
-    {
+    public TaskException(String msg, Code code, Exception nestedEx) {
         super(msg, nestedEx);
         this.code = code;
     }
 
-    public Code getCode()
-    {
+    public Code getCode() {
         return code;
     }
 
-    public enum Code
-    {
+    public enum Code {
         TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
     }
 }

+ 3 - 5
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/BlackListException.java

@@ -2,15 +2,13 @@ package com.ruoyi.common.exception.user;
 
 /**
  * 黑名单IP异常类
- * 
+ *
  * @author ruoyi
  */
-public class BlackListException extends UserException
-{
+public class BlackListException extends UserException {
     private static final long serialVersionUID = 1L;
 
-    public BlackListException()
-    {
+    public BlackListException() {
         super("login.blocked", null);
     }
 }

+ 3 - 5
ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java

@@ -2,15 +2,13 @@ package com.ruoyi.common.exception.user;
 
 /**
  * 验证码错误异常类
- * 
+ *
  * @author ruoyi
  */
-public class CaptchaException extends UserException
-{
+public class CaptchaException extends UserException {
     private static final long serialVersionUID = 1L;
 
-    public CaptchaException()
-    {
+    public CaptchaException() {
         super("user.jcaptcha.error", null);
     }
 }

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно