Prechádzať zdrojové kódy

Merge branch 'feature-2022.06.27' of https://git.flowbb.cn/RK-Dev/fqgz-server into feature-2022.06.27

humuyu 3 rokov pred
rodič
commit
094e8cc715
100 zmenil súbory, kde vykonal 772 pridanie a 534 odobranie
  1. 6 0
      eladmin-common/pom.xml
  2. 1 1
      eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java
  3. 1 1
      eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java
  4. 3 4
      eladmin-system/src/main/java/me/zhengjie/base/mq/ClientCache.java
  5. 7 29
      eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java
  6. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/MsgType.java
  7. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/SocketMsg.java
  8. 3 8
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/WebSocketEventListenner.java
  9. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/WebSocketServer.java
  10. 36 0
      eladmin-mnt/pom.xml
  11. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/App.java
  12. 7 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Database.java
  13. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Deploy.java
  14. 7 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/DeployHistory.java
  15. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/ServerDeploy.java
  16. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/AppRepository.java
  17. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DatabaseRepository.java
  18. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployHistoryRepository.java
  19. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployRepository.java
  20. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/ServerDeployRepository.java
  21. 5 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java
  22. 7 6
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java
  23. 6 5
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java
  24. 4 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java
  25. 5 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java
  26. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java
  27. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java
  28. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java
  29. 5 5
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java
  30. 5 4
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java
  31. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppDto.java
  32. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppQueryCriteria.java
  33. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseDto.java
  34. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseQueryCriteria.java
  35. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployDto.java
  36. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryDto.java
  37. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryQueryCriteria.java
  38. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployQueryCriteria.java
  39. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployDto.java
  40. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployQueryCriteria.java
  41. 10 11
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java
  42. 9 8
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java
  43. 8 7
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java
  44. 20 19
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java
  45. 9 8
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java
  46. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/AppMapper.java
  47. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DatabaseMapper.java
  48. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DeployHistoryMapper.java
  49. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DeployMapper.java
  50. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/ServerDeployMapper.java
  51. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/DataTypeEnum.java
  52. 4 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/ExecuteShellUtil.java
  53. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/ScpClientUtil.java
  54. 6 2
      eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/SqlUtils.java
  55. 32 0
      eladmin-quartz/pom.xml
  56. 4 4
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/JobRunner.java
  57. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/QuartzConfig.java
  58. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzJob.java
  59. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzLog.java
  60. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzJobRepository.java
  61. 2 2
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzLogRepository.java
  62. 5 4
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java
  63. 6 4
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java
  64. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/dto/JobQueryCriteria.java
  65. 9 8
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java
  66. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/TestTask.java
  67. 13 7
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/ExecutionJob.java
  68. 4 3
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzManage.java
  69. 2 1
      eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzRunnable.java
  70. 48 0
      eladmin-security/pom.xml
  71. 3 3
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java
  72. 9 10
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/SpringSecurityConfig.java
  73. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java
  74. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java
  75. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java
  76. 1 3
      eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/SecurityProperties.java
  77. 1 1
      eladmin-system/src/main/java/me/zhengjie/modules/security/error/SystemErrorController.java
  78. 25 59
      eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
  79. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java
  80. 3 2
      eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/AuthUserDto.java
  81. 1 2
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/JwtAccessDeniedHandler.java
  82. 5 7
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/JjwtAppUtil.java
  83. 4 7
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/JwtAuthenticationEntryPoint.java
  84. 4 6
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenConfigurer.java
  85. 52 56
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java
  86. 6 5
      eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java
  87. 50 45
      eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java
  88. 72 0
      eladmin-security/src/main/java/me/zhengjie/security/service/dto/OnlineUserDto.java
  89. 26 42
      eladmin-system/pom.xml
  90. 3 9
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/DemoController.java
  91. 3 1
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/MenuController.java
  92. 1 2
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/NotaryOrderController.java
  93. 4 2
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/OrderRoomIdController.java
  94. 3 1
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/RoleController.java
  95. 46 18
      eladmin-system/src/main/java/me/zhengjie/application/admin/controller/UserController.java
  96. 1 1
      eladmin-system/src/main/java/me/zhengjie/application/admin/job/GenerateNotarizationJob.java
  97. 45 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/dto/JwtUserDto.java
  98. 3 1
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/DeptServiceImpl.java
  99. 12 10
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/ModelNotarizationServiceImpl.java
  100. 0 0
      eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotaryOfficeServiceImpl.java

+ 6 - 0
eladmin-common/pom.xml

@@ -10,6 +10,7 @@
     <modelVersion>4.0.0</modelVersion>
     <properties>
         <hutool.version>5.3.4</hutool.version>
+        <netty-socketio.version>1.7.11</netty-socketio.version>
     </properties>
 
     <artifactId>eladmin-common</artifactId>
@@ -22,5 +23,10 @@
             <artifactId>hutool-all</artifactId>
             <version>${hutool.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.corundumstudio.socketio</groupId>
+            <artifactId>netty-socketio</artifactId>
+            <version>${netty-socketio.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 1 - 1
eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java

@@ -83,7 +83,7 @@ public class RedisConfig extends CachingConfigurerSupport {
         // 全局开启AutoType,这里方便开发,使用全局的方式
         ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
         // 建议使用这种方式,小范围指定白名单
-        // ParserConfig.getGlobalInstance().addAccept("me.zhengjie.domain");
+        ParserConfig.getGlobalInstance().addAccept("me.zhengjie.");
         // key的序列化采用StringRedisSerializer
         template.setKeySerializer(new StringRedisSerializer());
         template.setHashKeySerializer(new StringRedisSerializer());

+ 1 - 1
eladmin-common/src/main/java/me/zhengjie/exception/handler/GlobalExceptionHandler.java

@@ -66,7 +66,7 @@ public class GlobalExceptionHandler {
 	@ExceptionHandler(Exception.class)
 	public ResponseDTO<?> exceptionHandler(Exception e) {
 		log.error("error: {}", e.getMessage());
-//		e.printStackTrace();
+		e.printStackTrace();
 		// http 请求方式错误
 		if (e instanceof HttpRequestMethodNotSupportedException) {
 			return ResponseDTO.error(ResultCode.REQUEST_METHOD_ERROR);

+ 3 - 4
eladmin-system/src/main/java/me/zhengjie/base/mq/ClientCache.java

@@ -1,4 +1,4 @@
-package me.zhengjie.base.mq;
+package me.zhengjie.utils;
 
 import com.corundumstudio.socketio.SocketIOClient;
 import org.springframework.stereotype.Component;
@@ -23,7 +23,7 @@ public class ClientCache {
 	/**
 	 * 存入本地缓存
 	 *
-	 * @param userId         用户ID
+	 * @param sname         用户ID
 	 * @param sessionId      页面sessionID
 	 * @param socketIOClient 页面对应的通道连接信息
 	 */
@@ -43,7 +43,7 @@ public class ClientCache {
 	/**
 	 * 根据用户ID获取所有通道信息
 	 *
-	 * @param userId
+	 * @param sname
 	 * @return
 	 */
 	public HashMap<UUID, SocketIOClient> getUserClient(String sname) {
@@ -58,7 +58,6 @@ public class ClientCache {
 	 * 根据用户ID及页面sessionID删除页面链接信息
 	 *
 	 * @param userId
-	 * @param sessionId
 	 */
 	public void deleteSessionClient(String userId) {
 		concurrentHashMap.remove(userId);

+ 7 - 29
eladmin-common/src/main/java/me/zhengjie/utils/SecurityUtils.java

@@ -20,12 +20,11 @@ import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.utils.enums.DataScopeEnum;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
+
 import java.util.List;
 
 /**
@@ -41,34 +40,25 @@ public class SecurityUtils {
      * @return UserDetails
      */
     public static UserDetails getCurrentUser() {
-        UserDetailsService userDetailsService = SpringContextHolder.getBean(UserDetailsService.class);
-        return userDetailsService.loadUserByUsername(getCurrentUsername());
-    }
-
-    /**
-     * 获取系统用户名称
-     *
-     * @return 系统用户名称
-     */
-    public static String getCurrentUsername() {
         final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
         if (authentication == null) {
             throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期");
         }
         if (authentication.getPrincipal() instanceof UserDetails) {
             UserDetails userDetails = (UserDetails) authentication.getPrincipal();
-            return userDetails.getUsername();
+            return userDetails;
         }
         throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息");
     }
 
     /**
-     * 获取系统用户ID
-     * @return 系统用户ID
+     * 获取系统用户名称
+     *
+     * @return 系统用户名称
      */
-    public static Long getCurrentUserId() {
+    public static String getCurrentUsername() {
         UserDetails userDetails = getCurrentUser();
-        return new JSONObject(new JSONObject(userDetails).get("user")).get("id", Long.class);
+        return userDetails.getUsername();
     }
 
     /**
@@ -80,16 +70,4 @@ public class SecurityUtils {
         JSONArray array = JSONUtil.parseArray(new JSONObject(userDetails).get("dataScopes"));
         return JSONUtil.toList(array,Long.class);
     }
-
-    /**
-     * 获取数据权限级别
-     * @return 级别
-     */
-    public static String getDataScopeType() {
-        List<Long> dataScopes = getCurrentUserDataScope();
-        if(dataScopes.size() != 0){
-            return "";
-        }
-        return DataScopeEnum.ALL.getValue();
-    }
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/MsgType.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.websocket;
+package me.zhengjie.websocket;
 
 /**
  * @author ZhangHouYing

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/SocketMsg.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.websocket;
+package me.zhengjie.websocket;
 
 import lombok.Data;
 

+ 3 - 8
eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/WebSocketEventListenner.java

@@ -1,4 +1,4 @@
-package me.zhengjie.modules.mnt.websocket;
+package me.zhengjie.websocket;
 
 import com.corundumstudio.socketio.AckRequest;
 import com.corundumstudio.socketio.HandshakeData;
@@ -7,18 +7,13 @@ import com.corundumstudio.socketio.annotation.OnConnect;
 import com.corundumstudio.socketio.annotation.OnDisconnect;
 import com.corundumstudio.socketio.annotation.OnEvent;
 import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.base.mq.ClientCache;
+import me.zhengjie.utils.ClientCache;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-
 import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * @author litong

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/websocket/WebSocketServer.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.websocket;
+package me.zhengjie.websocket;
 
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
@@ -129,7 +129,7 @@ public class WebSocketServer {
 	/**
 	 * 群发自定义消息
 	 * */
-	public static void sendInfo(SocketMsg socketMsg,@PathParam("sid") String sid) throws IOException {
+	public static void sendInfo(SocketMsg socketMsg, @PathParam("sid") String sid) throws IOException {
 		String message = JSONObject.toJSONString(socketMsg);
 		log.info("推送消息到"+sid+",推送内容:"+message);
 		for (WebSocketServer item : webSocketSet) {

+ 36 - 0
eladmin-mnt/pom.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eladmin</artifactId>
+        <groupId>me.zhengjie</groupId>
+        <version>2.6</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eladmin-mnt</artifactId>
+    <name>运维模块</name>
+
+    <properties>
+
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>me.zhengjie</groupId>
+            <artifactId>eladmin-logging</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <!-- linux的管理 -->
+        <dependency>
+            <groupId>ch.ethz.ganymed</groupId>
+            <artifactId>ganymed-ssh2</artifactId>
+            <version>build210</version>
+        </dependency>
+        <dependency>
+            <groupId>com.jcraft</groupId>
+            <artifactId>jsch</artifactId>
+            <version>0.1.55</version>
+        </dependency>
+    </dependencies>
+</project>

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/App.java

@@ -13,14 +13,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.domain;
+package me.zhengjie.mnt.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
+
 import javax.persistence.*;
 import java.io.Serializable;
 

+ 7 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Database.java

@@ -13,15 +13,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.domain;
+package me.zhengjie.mnt.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
-import javax.persistence.*;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.io.Serializable;
 
 /**

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/Deploy.java

@@ -13,14 +13,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.domain;
+package me.zhengjie.mnt.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Set;

+ 7 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/DeployHistory.java

@@ -13,15 +13,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.domain;
+package me.zhengjie.mnt.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import org.hibernate.annotations.CreationTimestamp;
-import javax.persistence.*;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 import java.io.Serializable;
 import java.sql.Timestamp;
 

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/domain/ServerDeploy.java

@@ -13,14 +13,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.domain;
+package me.zhengjie.mnt.domain;
 
-import io.swagger.annotations.ApiModelProperty;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.copier.CopyOptions;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Objects;

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/AppRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.repository;
+package me.zhengjie.mnt.repository;
 
-import me.zhengjie.modules.mnt.domain.App;
+import me.zhengjie.mnt.domain.App;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DatabaseRepository.java

@@ -13,9 +13,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.repository;
+package me.zhengjie.mnt.repository;
 
-import me.zhengjie.modules.mnt.domain.Database;
+
+import me.zhengjie.mnt.domain.Database;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployHistoryRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.repository;
+package me.zhengjie.mnt.repository;
 
-import me.zhengjie.modules.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.domain.DeployHistory;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/DeployRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.repository;
+package me.zhengjie.mnt.repository;
 
-import me.zhengjie.modules.mnt.domain.Deploy;
+import me.zhengjie.mnt.domain.Deploy;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/repository/ServerDeployRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.repository;
+package me.zhengjie.mnt.repository;
 
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.domain.ServerDeploy;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 5 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java

@@ -13,21 +13,22 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.rest;
+package me.zhengjie.mnt.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
-import me.zhengjie.modules.mnt.domain.App;
-import me.zhengjie.modules.mnt.service.AppService;
-import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
+import me.zhengjie.mnt.domain.App;
+import me.zhengjie.mnt.service.AppService;
+import me.zhengjie.mnt.service.dto.AppQueryCriteria;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 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.io.IOException;
 import java.util.Set;

+ 7 - 6
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java

@@ -13,18 +13,18 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.rest;
+package me.zhengjie.mnt.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.mnt.domain.Database;
-import me.zhengjie.modules.mnt.service.DatabaseService;
-import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
-import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
-import me.zhengjie.modules.mnt.util.SqlUtils;
+import me.zhengjie.mnt.domain.Database;
+import me.zhengjie.mnt.service.DatabaseService;
+import me.zhengjie.mnt.service.dto.DatabaseDto;
+import me.zhengjie.mnt.service.dto.DatabaseQueryCriteria;
+import me.zhengjie.mnt.util.SqlUtils;
 import me.zhengjie.utils.FileUtil;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
@@ -33,6 +33,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;

+ 6 - 5
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java

@@ -13,16 +13,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.rest;
+package me.zhengjie.mnt.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
-import me.zhengjie.modules.mnt.domain.Deploy;
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.service.DeployService;
-import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria;
+import me.zhengjie.mnt.domain.Deploy;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.service.DeployService;
+import me.zhengjie.mnt.service.dto.DeployQueryCriteria;
 import me.zhengjie.utils.FileUtil;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
@@ -31,6 +31,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;

+ 4 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployHistoryController.java

@@ -13,19 +13,20 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.rest;
+package me.zhengjie.mnt.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
-import me.zhengjie.modules.mnt.service.DeployHistoryService;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
+import me.zhengjie.mnt.service.DeployHistoryService;
+import me.zhengjie.mnt.service.dto.DeployHistoryQueryCriteria;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Set;

+ 5 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java

@@ -13,21 +13,22 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.rest;
+package me.zhengjie.mnt.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
-import me.zhengjie.modules.mnt.service.ServerDeployService;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
+import me.zhengjie.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.service.ServerDeployService;
+import me.zhengjie.mnt.service.dto.ServerDeployQueryCriteria;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 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.io.IOException;
 import java.util.Set;

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service;
+package me.zhengjie.mnt.service;
 
-import me.zhengjie.modules.mnt.domain.App;
-import me.zhengjie.modules.mnt.service.dto.AppDto;
-import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
+import me.zhengjie.mnt.domain.App;
+import me.zhengjie.mnt.service.dto.AppDto;
+import me.zhengjie.mnt.service.dto.AppQueryCriteria;
 import org.springframework.data.domain.Pageable;
 
 import javax.servlet.http.HttpServletResponse;

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service;
+package me.zhengjie.mnt.service;
 
-import me.zhengjie.modules.mnt.domain.Database;
-import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
-import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
+import me.zhengjie.mnt.domain.Database;
+import me.zhengjie.mnt.service.dto.DatabaseDto;
+import me.zhengjie.mnt.service.dto.DatabaseQueryCriteria;
 import org.springframework.data.domain.Pageable;
 
 import javax.servlet.http.HttpServletResponse;

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service;
+package me.zhengjie.mnt.service;
 
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.service.dto.DeployHistoryDto;
+import me.zhengjie.mnt.service.dto.DeployHistoryQueryCriteria;
 import org.springframework.data.domain.Pageable;
 
 import javax.servlet.http.HttpServletResponse;

+ 5 - 5
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java

@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service;
+package me.zhengjie.mnt.service;
 
-import me.zhengjie.modules.mnt.domain.Deploy;
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.service.dto.DeployDto;
-import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria;
+import me.zhengjie.mnt.domain.Deploy;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.service.dto.DeployDto;
+import me.zhengjie.mnt.service.dto.DeployQueryCriteria;
 import org.springframework.data.domain.Pageable;
 
 import javax.servlet.http.HttpServletResponse;

+ 5 - 4
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service;
+package me.zhengjie.mnt.service;
 
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
+
+import me.zhengjie.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.service.dto.ServerDeployDto;
+import me.zhengjie.mnt.service.dto.ServerDeployQueryCriteria;
 import org.springframework.data.domain.Pageable;
 
 import javax.servlet.http.HttpServletResponse;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppDto.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseDTO;
+
 import java.io.Serializable;
 
 /**

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/AppQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseDto.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseDTO;
+
 import java.io.Serializable;
 
 /**

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DatabaseQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployDto.java

@@ -13,12 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import cn.hutool.core.collection.CollectionUtil;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseDTO;
+
 import java.io.Serializable;
 import java.util.Objects;
 import java.util.Set;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryDto.java

@@ -13,9 +13,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
+
 import java.io.Serializable;
 import java.sql.Timestamp;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployHistoryQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/DeployQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployDto.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseDTO;
+
 import java.io.Serializable;
 import java.util.Objects;
 

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/dto/ServerDeployQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.dto;
+package me.zhengjie.mnt.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 10 - 11
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java

@@ -13,26 +13,25 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.impl;
+package me.zhengjie.mnt.service.impl;
 
-import lombok.RequiredArgsConstructor;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.mnt.domain.App;
-import me.zhengjie.modules.mnt.repository.AppRepository;
-import me.zhengjie.modules.mnt.service.AppService;
-import me.zhengjie.modules.mnt.service.dto.AppDto;
-import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria;
-import me.zhengjie.modules.mnt.service.mapstruct.AppMapper;
+import me.zhengjie.mnt.domain.App;
+import me.zhengjie.mnt.repository.AppRepository;
+import me.zhengjie.mnt.service.AppService;
+import me.zhengjie.mnt.service.dto.AppDto;
+import me.zhengjie.mnt.service.dto.AppQueryCriteria;
+import me.zhengjie.mnt.service.mapstruct.AppMapper;
 import me.zhengjie.utils.FileUtil;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
 import me.zhengjie.utils.ValidationUtil;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;
@@ -44,9 +43,9 @@ import java.util.*;
 @Service
 public class AppServiceImpl implements AppService {
 	@Autowired
-    private  AppRepository appRepository;
+    private AppRepository appRepository;
 	@Autowired
-    private  AppMapper appMapper;
+    private AppMapper appMapper;
     
  
     @Override

+ 9 - 8
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java

@@ -13,18 +13,18 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.impl;
+package me.zhengjie.mnt.service.impl;
 
 import cn.hutool.core.util.IdUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.modules.mnt.domain.Database;
-import me.zhengjie.modules.mnt.repository.DatabaseRepository;
-import me.zhengjie.modules.mnt.service.DatabaseService;
-import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
-import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria;
-import me.zhengjie.modules.mnt.service.mapstruct.DatabaseMapper;
-import me.zhengjie.modules.mnt.util.SqlUtils;
+import me.zhengjie.mnt.domain.Database;
+import me.zhengjie.mnt.repository.DatabaseRepository;
+import me.zhengjie.mnt.service.DatabaseService;
+import me.zhengjie.mnt.service.dto.DatabaseDto;
+import me.zhengjie.mnt.service.dto.DatabaseQueryCriteria;
+import me.zhengjie.mnt.service.mapstruct.DatabaseMapper;
+import me.zhengjie.mnt.util.SqlUtils;
 import me.zhengjie.utils.FileUtil;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
@@ -33,6 +33,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 8 - 7
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java

@@ -13,16 +13,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.impl;
+package me.zhengjie.mnt.service.impl;
 
 import cn.hutool.core.util.IdUtil;
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.repository.DeployHistoryRepository;
-import me.zhengjie.modules.mnt.service.DeployHistoryService;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria;
-import me.zhengjie.modules.mnt.service.mapstruct.DeployHistoryMapper;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.repository.DeployHistoryRepository;
+import me.zhengjie.mnt.service.DeployHistoryService;
+import me.zhengjie.mnt.service.dto.DeployHistoryDto;
+import me.zhengjie.mnt.service.dto.DeployHistoryQueryCriteria;
+import me.zhengjie.mnt.service.mapstruct.DeployHistoryMapper;
 import me.zhengjie.utils.FileUtil;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
@@ -31,6 +31,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 20 - 19
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java

@@ -13,36 +13,37 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.impl;
+package me.zhengjie.mnt.service.impl;
 
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.mnt.domain.App;
-import me.zhengjie.modules.mnt.domain.Deploy;
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
-import me.zhengjie.modules.mnt.repository.DeployRepository;
-import me.zhengjie.modules.mnt.service.DeployHistoryService;
-import me.zhengjie.modules.mnt.service.DeployService;
-import me.zhengjie.modules.mnt.service.ServerDeployService;
-import me.zhengjie.modules.mnt.service.dto.AppDto;
-import me.zhengjie.modules.mnt.service.dto.DeployDto;
-import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
-import me.zhengjie.modules.mnt.service.mapstruct.DeployMapper;
-import me.zhengjie.modules.mnt.util.ExecuteShellUtil;
-import me.zhengjie.modules.mnt.util.ScpClientUtil;
-import me.zhengjie.modules.mnt.websocket.MsgType;
-import me.zhengjie.modules.mnt.websocket.SocketMsg;
-import me.zhengjie.modules.mnt.websocket.WebSocketServer;
+import me.zhengjie.mnt.domain.App;
+import me.zhengjie.mnt.domain.Deploy;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.repository.DeployRepository;
+import me.zhengjie.mnt.service.DeployHistoryService;
+import me.zhengjie.mnt.service.DeployService;
+import me.zhengjie.mnt.service.ServerDeployService;
+import me.zhengjie.mnt.service.dto.AppDto;
+import me.zhengjie.mnt.service.dto.DeployDto;
+import me.zhengjie.mnt.service.dto.DeployQueryCriteria;
+import me.zhengjie.mnt.service.dto.ServerDeployDto;
+import me.zhengjie.mnt.service.mapstruct.DeployMapper;
+import me.zhengjie.mnt.util.ExecuteShellUtil;
+import me.zhengjie.mnt.util.ScpClientUtil;
 import me.zhengjie.utils.*;
+import me.zhengjie.websocket.MsgType;
+import me.zhengjie.websocket.SocketMsg;
+import me.zhengjie.websocket.WebSocketServer;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 9 - 8
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java

@@ -13,16 +13,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.impl;
+package me.zhengjie.mnt.service.impl;
 
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
-import me.zhengjie.modules.mnt.repository.ServerDeployRepository;
-import me.zhengjie.modules.mnt.service.ServerDeployService;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria;
-import me.zhengjie.modules.mnt.service.mapstruct.ServerDeployMapper;
-import me.zhengjie.modules.mnt.util.ExecuteShellUtil;
+import me.zhengjie.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.repository.ServerDeployRepository;
+import me.zhengjie.mnt.service.ServerDeployService;
+import me.zhengjie.mnt.service.dto.ServerDeployDto;
+import me.zhengjie.mnt.service.dto.ServerDeployQueryCriteria;
+import me.zhengjie.mnt.service.mapstruct.ServerDeployMapper;
+import me.zhengjie.mnt.util.ExecuteShellUtil;
 import me.zhengjie.utils.FileUtil;
 import me.zhengjie.utils.PageUtil;
 import me.zhengjie.utils.QueryHelp;
@@ -31,6 +31,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/AppMapper.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.mapstruct;
+package me.zhengjie.mnt.service.mapstruct;
 
 import me.zhengjie.base.BaseMapper;
-import me.zhengjie.modules.mnt.domain.App;
-import me.zhengjie.modules.mnt.service.dto.AppDto;
+import me.zhengjie.mnt.domain.App;
+import me.zhengjie.mnt.service.dto.AppDto;
 import org.mapstruct.Mapper;
 import org.mapstruct.ReportingPolicy;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DatabaseMapper.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.mapstruct;
+package me.zhengjie.mnt.service.mapstruct;
 
 import me.zhengjie.base.BaseMapper;
-import me.zhengjie.modules.mnt.domain.Database;
-import me.zhengjie.modules.mnt.service.dto.DatabaseDto;
+import me.zhengjie.mnt.domain.Database;
+import me.zhengjie.mnt.service.dto.DatabaseDto;
 import org.mapstruct.Mapper;
 import org.mapstruct.ReportingPolicy;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DeployHistoryMapper.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.mapstruct;
+package me.zhengjie.mnt.service.mapstruct;
 
 import me.zhengjie.base.BaseMapper;
-import me.zhengjie.modules.mnt.domain.DeployHistory;
-import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto;
+import me.zhengjie.mnt.domain.DeployHistory;
+import me.zhengjie.mnt.service.dto.DeployHistoryDto;
 import org.mapstruct.Mapper;
 import org.mapstruct.ReportingPolicy;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/DeployMapper.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.mapstruct;
+package me.zhengjie.mnt.service.mapstruct;
 
 import me.zhengjie.base.BaseMapper;
-import me.zhengjie.modules.mnt.domain.Deploy;
-import me.zhengjie.modules.mnt.service.dto.DeployDto;
+import me.zhengjie.mnt.domain.Deploy;
+import me.zhengjie.mnt.service.dto.DeployDto;
 import org.mapstruct.Mapper;
 import org.mapstruct.ReportingPolicy;
 

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/mapstruct/ServerDeployMapper.java

@@ -13,11 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.service.mapstruct;
+package me.zhengjie.mnt.service.mapstruct;
 
 import me.zhengjie.base.BaseMapper;
-import me.zhengjie.modules.mnt.domain.ServerDeploy;
-import me.zhengjie.modules.mnt.service.dto.ServerDeployDto;
+import me.zhengjie.mnt.domain.ServerDeploy;
+import me.zhengjie.mnt.service.dto.ServerDeployDto;
 import org.mapstruct.Mapper;
 import org.mapstruct.ReportingPolicy;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/DataTypeEnum.java

@@ -17,7 +17,7 @@
  *
  */
 
-package me.zhengjie.modules.mnt.util;
+package me.zhengjie.mnt.util;
 import lombok.extern.slf4j.Slf4j;
 
 /**

+ 4 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/ExecuteShellUtil.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.util;
+package me.zhengjie.mnt.util;
 
 import cn.hutool.core.io.IoUtil;
 import com.jcraft.jsch.ChannelShell;
@@ -21,7 +21,9 @@ import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.Session;
 import lombok.extern.slf4j.Slf4j;
 
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
 import java.util.Vector;
 
 /**

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/ScpClientUtil.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.util;
+package me.zhengjie.mnt.util;
 
 import ch.ethz.ssh2.Connection;
 import ch.ethz.ssh2.SCPClient;

+ 6 - 2
eladmin-system/src/main/java/me/zhengjie/modules/mnt/util/SqlUtils.java

@@ -13,20 +13,24 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.mnt.util;
+package me.zhengjie.mnt.util;
 
 import com.alibaba.druid.pool.DruidDataSource;
 import com.alibaba.druid.util.StringUtils;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.utils.CloseUtil;
+
 import javax.sql.DataSource;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.List;
 
 /**

+ 32 - 0
eladmin-quartz/pom.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eladmin</artifactId>
+        <groupId>me.zhengjie</groupId>
+        <version>2.6</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eladmin-quartz</artifactId>
+    <name>定时任务模块</name>
+
+    <properties>
+
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>me.zhengjie</groupId>
+            <artifactId>eladmin-tools</artifactId>
+            <version>2.6</version>
+        </dependency>
+
+        <!-- quartz -->
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 4 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/JobRunner.java

@@ -13,12 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.config;
+package me.zhengjie.quartz.config;
 
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.repository.QuartzJobRepository;
-import me.zhengjie.modules.quartz.utils.QuartzManage;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.repository.QuartzJobRepository;
+import me.zhengjie.quartz.utils.QuartzManage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.ApplicationArguments;

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/config/QuartzConfig.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.config;
+package me.zhengjie.quartz.config;
 
 import org.quartz.spi.TriggerFiredBundle;
 import org.springframework.beans.factory.config.AutowireCapableBeanFactory;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzJob.java

@@ -13,12 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.domain;
+package me.zhengjie.quartz.domain;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import me.zhengjie.base.BaseEntity;
+
 import javax.persistence.*;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/domain/QuartzLog.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.domain;
+package me.zhengjie.quartz.domain;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.hibernate.annotations.CreationTimestamp;
+
 import javax.persistence.*;
 import java.io.Serializable;
 import java.sql.Timestamp;

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzJobRepository.java

@@ -13,11 +13,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.repository;
+package me.zhengjie.quartz.repository;
 
-import me.zhengjie.modules.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzJob;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
 import java.util.List;
 
 /**

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/quartz/repository/QuartzLogRepository.java

@@ -13,9 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.repository;
+package me.zhengjie.quartz.repository;
 
-import me.zhengjie.modules.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.domain.QuartzLog;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 

+ 5 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.rest;
+package me.zhengjie.quartz.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -21,15 +21,16 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.annotation.Log;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 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.io.IOException;
 import java.util.Set;

+ 6 - 4
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java

@@ -13,12 +13,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service;
+package me.zhengjie.quartz.service;
 
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
+
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
 import org.springframework.data.domain.Pageable;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.List;

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/dto/JobQueryCriteria.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service.dto;
+package me.zhengjie.quartz.service.dto;
 
 import lombok.Data;
 import me.zhengjie.annotation.Query;
+
 import java.sql.Timestamp;
 import java.util.List;
 

+ 9 - 8
eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java

@@ -13,25 +13,26 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.service.impl;
+package me.zhengjie.quartz.service.impl;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.repository.QuartzJobRepository;
-import me.zhengjie.modules.quartz.repository.QuartzLogRepository;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
-import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria;
-import me.zhengjie.modules.quartz.utils.QuartzManage;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.repository.QuartzJobRepository;
+import me.zhengjie.quartz.repository.QuartzLogRepository;
+import me.zhengjie.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.service.dto.JobQueryCriteria;
+import me.zhengjie.quartz.utils.QuartzManage;
 import me.zhengjie.utils.*;
 import org.quartz.CronExpression;
 import org.springframework.data.domain.Pageable;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.*;

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/TestTask.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.task;
+package me.zhengjie.quartz.task;
 
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;

+ 13 - 7
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/ExecutionJob.java

@@ -13,17 +13,17 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import cn.hutool.extra.template.Template;
 import cn.hutool.extra.template.TemplateConfig;
 import cn.hutool.extra.template.TemplateEngine;
 import cn.hutool.extra.template.TemplateUtil;
 import me.zhengjie.domain.vo.EmailVo;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
-import me.zhengjie.modules.quartz.domain.QuartzLog;
-import me.zhengjie.modules.quartz.repository.QuartzLogRepository;
-import me.zhengjie.modules.quartz.service.QuartzJobService;
+import me.zhengjie.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzLog;
+import me.zhengjie.quartz.repository.QuartzLogRepository;
+import me.zhengjie.quartz.service.QuartzJobService;
 import me.zhengjie.service.EmailService;
 import me.zhengjie.utils.RedisUtils;
 import me.zhengjie.utils.SpringContextHolder;
@@ -34,8 +34,14 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.quartz.QuartzJobBean;
-import java.util.*;
-import java.util.concurrent.*;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 /**
  * 参考人人开源,https://gitee.com/renrenio/renren-security

+ 4 - 3
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzManage.java

@@ -13,17 +13,18 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.modules.quartz.domain.QuartzJob;
+import me.zhengjie.quartz.domain.QuartzJob;
 import org.quartz.*;
 import org.quartz.impl.triggers.CronTriggerImpl;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+
 import javax.annotation.Resource;
 import java.util.Date;
+
 import static org.quartz.TriggerBuilder.newTrigger;
 
 /**

+ 2 - 1
eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzRunnable.java

@@ -13,12 +13,13 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.quartz.utils;
+package me.zhengjie.quartz.utils;
 
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.utils.SpringContextHolder;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.util.ReflectionUtils;
+
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;
 

+ 48 - 0
eladmin-security/pom.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eladmin</artifactId>
+        <groupId>me.zhengjie</groupId>
+        <version>2.6</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eladmin-security</artifactId>
+    <name>权限模块</name>
+
+    <properties>
+        <jjwt.version>0.11.1</jjwt.version>
+        <gson.version>2.9.0</gson.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>me.zhengjie</groupId>
+            <artifactId>eladmin-common</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <!-- jwt -->
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-api</artifactId>
+            <version>${jjwt.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-impl</artifactId>
+            <version>${jjwt.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.jsonwebtoken</groupId>
+            <artifactId>jjwt-jackson</artifactId>
+            <version>${jjwt.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>${gson.version}</version>
+        </dependency>
+    </dependencies>
+</project>

+ 3 - 3
eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java

@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package me.zhengjie.modules.security.config;
+package me.zhengjie.security.config;
 
-import me.zhengjie.modules.security.config.bean.LoginProperties;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
+import me.zhengjie.security.config.bean.LoginProperties;
+import me.zhengjie.security.config.bean.SecurityProperties;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;

+ 9 - 10
eladmin-system/src/main/java/me/zhengjie/modules/security/config/SpringSecurityConfig.java

@@ -13,14 +13,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.config;
+package me.zhengjie.security.config;
 
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.AnonymousAccess;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
-import me.zhengjie.modules.security.security.*;
-import me.zhengjie.modules.security.service.OnlineUserService;
-import me.zhengjie.modules.security.service.UserCacheClean;
+import me.zhengjie.security.config.bean.SecurityProperties;
+import me.zhengjie.security.security.TokenConfigurer;
+import me.zhengjie.security.security.TokenFilter;
+import me.zhengjie.security.security.TokenProvider;
+import me.zhengjie.security.service.OnlineUserService;
 import me.zhengjie.utils.enums.RequestMethodEnum;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
@@ -40,6 +41,7 @@ import org.springframework.web.filter.CorsFilter;
 import org.springframework.web.method.HandlerMethod;
 import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+
 import java.util.*;
 
 /**
@@ -58,7 +60,6 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
     private final ApplicationContext applicationContext;
     private final SecurityProperties properties;
     private final OnlineUserService onlineUserService;
-    private final UserCacheClean userCacheClean;
 
     @Bean
     GrantedAuthorityDefaults grantedAuthorityDefaults() {
@@ -145,14 +146,13 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                 // 所有请求都需要认证
                 .anyRequest().authenticated()
                 .and().apply(securityConfigurerAdapter());
-        		//设置所有的不需要权限访问的
+                //设置所有的不需要权限访问的
                 TokenFilter.setAnonymousUrl(anonymousUrls);
-        
                 System.out.println(anonymousUrls);
     }
 
     private TokenConfigurer securityConfigurerAdapter() {
-        return new TokenConfigurer(tokenProvider, properties, onlineUserService, userCacheClean);
+        return new TokenConfigurer(tokenProvider, properties, onlineUserService);
     }
 
     private Map<String, Set<String>> getAnonymousUrl(Map<RequestMappingInfo, HandlerMethod> handlerMethodMap) {
@@ -199,5 +199,4 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
         anonymousUrls.put(RequestMethodEnum.ALL.getType(), all);
         return anonymousUrls;
     }
-    
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package me.zhengjie.modules.security.config.bean;
+package me.zhengjie.security.config.bean;
 
 import lombok.Data;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package me.zhengjie.modules.security.config.bean;
+package me.zhengjie.security.config.bean;
 
 /**
  * 验证码配置枚举

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java

@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package me.zhengjie.modules.security.config.bean;
+package me.zhengjie.security.config.bean;
 
 import com.wf.captcha.*;
 import com.wf.captcha.base.Captcha;

+ 1 - 3
eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/SecurityProperties.java

@@ -13,9 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.config.bean;
-
-import javax.annotation.PostConstruct;
+package me.zhengjie.security.config.bean;
 
 import lombok.Data;
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/security/error/SystemErrorController.java

@@ -1,4 +1,4 @@
-package me.zhengjie.modules.security.error;
+package me.zhengjie.security.error;
 
 import lombok.extern.slf4j.Slf4j;
 import me.zhengjie.base.ResponseDTO;

+ 25 - 59
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java

@@ -13,7 +13,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.rest;
+package me.zhengjie.security.rest;
 
 import cn.hutool.core.util.IdUtil;
 import com.wf.captcha.base.Captcha;
@@ -23,24 +23,15 @@ import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.rest.AnonymousDeleteMapping;
 import me.zhengjie.annotation.rest.AnonymousGetMapping;
 import me.zhengjie.annotation.rest.AnonymousPostMapping;
-import me.zhengjie.dao.mybatis.entity.FileInfoEntity;
-import me.zhengjie.application.bank.service.FileInfoService;
-import me.zhengjie.base.util.FileUploadUtil;
 import me.zhengjie.config.RsaProperties;
-import me.zhengjie.modules.security.config.bean.LoginCodeEnum;
-import me.zhengjie.modules.security.config.bean.LoginProperties;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
-import me.zhengjie.modules.security.security.TokenProvider;
-import me.zhengjie.modules.security.service.dto.AuthUserDto;
-import me.zhengjie.modules.security.service.dto.JwtUserDto;
-import me.zhengjie.application.admin.service.UserService;
-import me.zhengjie.application.admin.service.dto.UserDto;
-import me.zhengjie.modules.security.service.OnlineUserService;
-import me.zhengjie.utils.RsaUtils;
+import me.zhengjie.security.config.bean.LoginCodeEnum;
+import me.zhengjie.security.config.bean.LoginProperties;
+import me.zhengjie.security.config.bean.SecurityProperties;
+import me.zhengjie.security.rest.vo.AuthUserVO;
+import me.zhengjie.security.security.TokenProvider;
+import me.zhengjie.security.service.OnlineUserService;
 import me.zhengjie.utils.RedisUtils;
-import me.zhengjie.utils.SecurityUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
+import me.zhengjie.utils.RsaUtils;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -48,7 +39,10 @@ import org.springframework.security.config.annotation.authentication.builders.Au
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
@@ -71,27 +65,23 @@ public class AuthorizationController {
 	private final AuthenticationManagerBuilder authenticationManagerBuilder;
 	@Resource
 	private LoginProperties loginProperties;
-	// 用户的信息
-	private final UserService userService;
-	@Autowired
-	private FileInfoService fileInfoService;
 
 	@ApiOperation("登录授权")
 	@AnonymousPostMapping(value = "/login")
-	public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request)
+	public ResponseEntity<Object> login(@Validated @RequestBody AuthUserVO authUser, HttpServletRequest request)
 			throws Exception {
 		// 密码解密
 		String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
 		// 查询验证码
-//        String code = (String) redisUtils.get(authUser.getUuid());
-//        // 清除验证码
-////        redisUtils.del(authUser.getUuid());
-//        if (StringUtils.isBlank(code)) {
-//            throw new BadRequestException("验证码不存在或已过期");
-//        }
-//        if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
-//            throw new BadRequestException("验证码错误");
-//        }
+		// String code = (String) redisUtils.get(authUser.getUuid());
+		// 清除验证码
+		// redisUtils.del(authUser.getUuid());
+		// if (StringUtils.isBlank(code)) {
+		//  throw new BadRequestException("验证码不存在或已过期");
+		// }
+		// if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
+		// throw new BadRequestException("验证码错误");
+		// }
 		UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(
 				authUser.getUsername(), password);
 		//
@@ -105,17 +95,15 @@ public class AuthorizationController {
 		// userDetails.getAuthorities());
 		// SecurityContextHolder.getContext().setAuthentication(authentication);
 		String token = tokenProvider.createToken(authentication);
-		final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
 		// 保存在线信息
-		// 这里先看一下日志
-		System.out.println("开始保存数据--onlineUserService.save---");
-		onlineUserService.save(jwtUserDto, token, request);
+		Object securityContextUser = authentication.getPrincipal();
+		onlineUserService.save(securityContextUser, token, request);
 		// 返回 token 与 用户信息
 		Map<String, Object> authInfo = new HashMap<String, Object>(2) {
 			private static final long serialVersionUID = 1L;
 			{
 				put("token", properties.getTokenStartWith() + token);
-				put("user", jwtUserDto);
+				put("user", securityContextUser);
 			}
 		};
 
@@ -126,28 +114,6 @@ public class AuthorizationController {
 		return ResponseEntity.ok(authInfo);
 	}
 
-	@ApiOperation("获取用户信息")
-	@GetMapping(value = "/info")
-	public ResponseEntity<Object> getUserInfo() {
-		// 这里需要处理图片显示问题
-		JwtUserDto jwtUserDto = (JwtUserDto) SecurityUtils.getCurrentUser();
-		// 处理图片的显示,重新查询一下当前的用户的值
-		UserDto cacheUser = jwtUserDto.getUser();
-		UserDto user = userService.findUserNoCacheId(cacheUser.getId());
-		if (user != null) {
-			FileInfoEntity fileInfo = fileInfoService.getById(user.getSignImgId());
-			if (fileInfo != null) {
-				String signImgUrl = FileUploadUtil.getFileUrl(fileInfo.getPath());
-				cacheUser.setSignImgUrl(signImgUrl);
-			}else {
-				//这里需要设置图片的路径为空
-				cacheUser.setSignImgUrl("");
-			}
-
-		}
-		return ResponseEntity.ok(jwtUserDto);
-	}
-
 	@ApiOperation("获取验证码")
 	@AnonymousGetMapping(value = "/code")
 	public ResponseEntity<Object> getCode() {

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java

@@ -13,18 +13,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.rest;
+package me.zhengjie.security.rest;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.security.service.OnlineUserService;
+import me.zhengjie.security.service.OnlineUserService;
 import me.zhengjie.utils.EncryptUtils;
 import org.springframework.data.domain.Pageable;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Set;

+ 3 - 2
eladmin-system/src/main/java/me/zhengjie/modules/security/service/dto/AuthUserDto.java

@@ -13,10 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.service.dto;
+package me.zhengjie.security.rest.vo;
 
 import lombok.Getter;
 import lombok.Setter;
+
 import javax.validation.constraints.NotBlank;
 
 /**
@@ -25,7 +26,7 @@ import javax.validation.constraints.NotBlank;
  */
 @Getter
 @Setter
-public class AuthUserDto {
+public class AuthUserVO {
 
     @NotBlank
     private String username;

+ 1 - 2
eladmin-system/src/main/java/me/zhengjie/modules/security/security/JwtAccessDeniedHandler.java

@@ -13,11 +13,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
 import org.springframework.security.access.AccessDeniedException;
 import org.springframework.security.web.access.AccessDeniedHandler;
-import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;

+ 5 - 7
eladmin-system/src/main/java/me/zhengjie/modules/security/security/JjwtAppUtil.java

@@ -1,23 +1,21 @@
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
 
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-
-import org.apache.tomcat.util.codec.binary.Base64;
-
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.JwtBuilder;
 import io.jsonwebtoken.Jwts;
 import io.jsonwebtoken.SignatureAlgorithm;
+import org.apache.tomcat.util.codec.binary.Base64;
 
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
 // 使用io.jsonwebtoken包
-public class JjwtAppUtil {
+public class JwtAppUtil {
 
 	// jti:jwt的唯一身份标识
 	public static final String JWT_ID = UUID.randomUUID().toString();

+ 4 - 7
eladmin-system/src/main/java/me/zhengjie/modules/security/security/JwtAuthenticationEntryPoint.java

@@ -13,22 +13,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.base.ResponseDTO;
+import me.zhengjie.base.ResultCode;
 import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
 import org.springframework.boot.web.servlet.error.ErrorAttributes;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.AuthenticationEntryPoint;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
-import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.base.ResponseDTO;
-import me.zhengjie.base.ResultCode;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;

+ 4 - 6
eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenConfigurer.java

@@ -13,12 +13,11 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
 import lombok.RequiredArgsConstructor;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
-import me.zhengjie.modules.security.service.OnlineUserService;
-import me.zhengjie.modules.security.service.UserCacheClean;
+import me.zhengjie.security.config.bean.SecurityProperties;
+import me.zhengjie.security.service.OnlineUserService;
 import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.web.DefaultSecurityFilterChain;
@@ -33,11 +32,10 @@ public class TokenConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFi
     private final TokenProvider tokenProvider;
     private final SecurityProperties properties;
     private final OnlineUserService onlineUserService;
-    private final UserCacheClean userCacheClean;
 
     @Override
     public void configure(HttpSecurity http) {
-        TokenFilter customFilter = new TokenFilter(tokenProvider, properties, onlineUserService, userCacheClean);
+        TokenFilter customFilter = new TokenFilter(tokenProvider, properties, onlineUserService);
          
         http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
     }

+ 52 - 56
eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java

@@ -13,14 +13,25 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import io.jsonwebtoken.ExpiredJwtException;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.base.ResponseDTO;
+import me.zhengjie.base.ResultCode;
+import me.zhengjie.security.config.bean.SecurityProperties;
+import me.zhengjie.security.service.OnlineUserService;
+import me.zhengjie.security.service.dto.OnlineUserDto;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.util.StringUtils;
+import org.springframework.web.filter.GenericFilterBean;
 
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
@@ -28,55 +39,34 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.util.StringUtils;
-import org.springframework.web.filter.GenericFilterBean;
-
-import com.alibaba.fastjson.JSONObject;
-
-import cn.hutool.core.util.StrUtil;
-import io.jsonwebtoken.ExpiredJwtException;
-import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.base.config.AppConfigInfo;
-import me.zhengjie.base.ResponseDTO;
-import me.zhengjie.base.ResultCode;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
-import me.zhengjie.modules.security.service.OnlineUserService;
-import me.zhengjie.modules.security.service.UserCacheClean;
-import me.zhengjie.modules.security.service.dto.OnlineUserDto;
+import java.io.IOException;
+import java.util.*;
 
 /**
  * @author /
  */
 @Slf4j
 public class TokenFilter extends GenericFilterBean {
-	private static final Logger log = LoggerFactory.getLogger(TokenFilter.class);
-
 	private final TokenProvider tokenProvider;
 	private final SecurityProperties properties;
 	private final OnlineUserService onlineUserService;
-	private final UserCacheClean userCacheClean;
-
 	private static Set<String> anonymousUrl = new HashSet<>();
 
 	/**
 	 * @param tokenProvider     Token
 	 * @param properties        JWT
 	 * @param onlineUserService 用户在线
-	 * @param userCacheClean    用户缓存清理工具
 	 */
-	public TokenFilter(TokenProvider tokenProvider, SecurityProperties properties, OnlineUserService onlineUserService,
-			UserCacheClean userCacheClean) {
+	public TokenFilter(TokenProvider tokenProvider, SecurityProperties properties, OnlineUserService onlineUserService) {
 		this.properties = properties;
 		this.onlineUserService = onlineUserService;
 		this.tokenProvider = tokenProvider;
-		this.userCacheClean = userCacheClean;
 	}
 
+	/**
+	 * 设置匿名访问URL
+	 * @param map
+	 */
 	public final static void setAnonymousUrl(Map<String, Set<String>> map) {
 		Collection<Set<String>> sets = map.values();
 		for (Set<String> set : sets) {
@@ -88,7 +78,7 @@ public class TokenFilter extends GenericFilterBean {
 	 * 错误输出
 	 *
 	 * @param response
-	 * @param responseCodeConst
+	 * @param resultCode
 	 * @throws IOException
 	 */
 	private void outputResult(HttpServletResponse response, ResultCode resultCode) throws IOException {
@@ -113,9 +103,7 @@ public class TokenFilter extends GenericFilterBean {
 //			return;
 //		}
 		// 排除打印的日志数据,
-		if (!AppConfigInfo.APP_EXCLUDE_LOG.contains(reqUrl)) {
-			log.info("请求路径:" + reqUrl);
-		}
+		log.info("请求路径:" + reqUrl);
 
 		// 这里是处理app的接口
 		String token = resolveToken(httpServletRequest);
@@ -132,10 +120,10 @@ public class TokenFilter extends GenericFilterBean {
 				}
 			} catch (ExpiredJwtException e) {
 				log.error(e.getMessage());
-//				outputResult(httpServletResponse, ResultCode.PERMISSION_TOKEN_EXPIRED);
+				// outputResult(httpServletResponse, ResultCode.PERMISSION_TOKEN_EXPIRED);
 			} catch (Exception e) {
 				log.error(e.toString());
-//				outputResult(httpServletResponse, ResultCode.SYSTEM_INNER_ERROR);
+				// outputResult(httpServletResponse, ResultCode.SYSTEM_INNER_ERROR);
 			}
 			if (appToken != null && StringUtils.hasText(token)) {
 				// Token 续期
@@ -148,29 +136,37 @@ public class TokenFilter extends GenericFilterBean {
 		// 这里是token的问题
 		if (StrUtil.isNotBlank(token)) {
 			OnlineUserDto onlineUserDto = null;
-			boolean cleanUserCache = false;
+//			boolean cleanUserCache = false;
 			try {
-				onlineUserDto = onlineUserService.getOne(properties.getOnlineKey() + token);
+				String onlineUser = onlineUserService.getOne(properties.getOnlineKey() + token);
+				JSONObject jsonObject = JSON.parseObject(onlineUser);
+				List<SimpleGrantedAuthority> authorities = JSON.parseArray(jsonObject.getString("authorities"), SimpleGrantedAuthority.class);
+				List<GrantedAuthority> authorityList = new ArrayList<>();
+				for (SimpleGrantedAuthority simpleGrantedAuthority : authorities) {
+					authorityList.add(simpleGrantedAuthority);
+				}
+				onlineUserDto = JSON.parseObject(onlineUser, OnlineUserDto.class);
+				onlineUserDto.setAuthorities(authorityList);
 			} catch (ExpiredJwtException e) {
 				log.error(e.getMessage());
-				cleanUserCache = true;
+//				cleanUserCache = true;
 			} catch (Exception e) {
 				log.error(e.getMessage());
-				cleanUserCache = true;
+//				cleanUserCache = true;
 			}
 			// 不理解已经是空了,为什么还要删除在线人员,
-			finally {
-				try {
-					if (cleanUserCache || Objects.isNull(onlineUserDto)) {
-						userCacheClean.cleanUserCache(
-								String.valueOf(tokenProvider.getClaims(token).get(TokenProvider.AUTHORITIES_KEY)));
-					}
-				} catch (Exception e) {
-					log.error(e.getMessage());
-				}
-			}
+//			finally {
+//				try {
+//					if (cleanUserCache || Objects.isNull(onlineUserDto)) {
+//						userCacheClean.cleanUserCache(
+//								String.valueOf(tokenProvider.getClaims(token).get(TokenProvider.AUTHORITIES_KEY)));
+//					}
+//				} catch (Exception e) {
+//					log.error(e.getMessage());
+//				}
+//			}
 			if (onlineUserDto != null && StringUtils.hasText(token)) {
-				Authentication authentication = tokenProvider.getAuthentication(token);
+				Authentication authentication = new UsernamePasswordAuthenticationToken(onlineUserDto, token, new ArrayList<>());
 				SecurityContextHolder.getContext().setAuthentication(authentication);
 				// Token 续期
 				tokenProvider.checkRenewal(token);

+ 6 - 5
eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java

@@ -13,25 +13,26 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.security;
+package me.zhengjie.security.security;
 
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.IdUtil;
 import io.jsonwebtoken.*;
 import io.jsonwebtoken.io.Decoders;
 import io.jsonwebtoken.security.Keys;
-import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
+
+import me.zhengjie.security.config.bean.SecurityProperties;
 import me.zhengjie.utils.RedisUtils;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.userdetails.User;
 import org.springframework.stereotype.Component;
+
 import javax.servlet.http.HttpServletRequest;
 import java.security.Key;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.concurrent.TimeUnit;
 
 /**

+ 50 - 45
eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java

@@ -13,22 +13,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package me.zhengjie.modules.security.service;
+package me.zhengjie.security.service;
 
+import com.alibaba.fastjson.JSON;
+import com.corundumstudio.socketio.SocketIOClient;
+import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.base.mq.ClientCache;
-import me.zhengjie.modules.security.config.bean.SecurityProperties;
-import me.zhengjie.modules.security.service.dto.JwtUserDto;
-import me.zhengjie.modules.security.service.dto.OnlineUserDto;
+import me.zhengjie.security.config.bean.SecurityProperties;
+import me.zhengjie.security.service.dto.OnlineUserDto;
 import me.zhengjie.utils.*;
-
 import org.springframework.data.domain.Pageable;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
-import com.corundumstudio.socketio.SocketIOClient;
-import com.google.gson.JsonObject;
-
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -52,33 +49,27 @@ public class OnlineUserService {
 
 	/**
 	 * 保存在线用户信息
-	 * 
-	 * @param jwtUserDto /
-	 * @param token      /
-	 * @param request    /
+	 * @param securityContextUser
+	 * @param token
+	 * @param request
 	 * @throws Exception
 	 */
-	public void save(JwtUserDto jwtUserDto, String token, HttpServletRequest request) throws Exception {
-		String dept = jwtUserDto.getUser().getDept().getName();
-		String ip = StringUtils.getIp(request);
-		String browser = StringUtils.getBrowser(request);
-		String address = StringUtils.getCityInfo(ip);
-		OnlineUserDto onlineUserDto = null;
-		String onlineToken = properties.getOnlineKey() + token;
-		try {
-			onlineUserDto = new OnlineUserDto(jwtUserDto.getUser().getRoles(), jwtUserDto.getUsername(), jwtUserDto.getUser().getNickName(), dept,
-					browser, ip, address, EncryptUtils.desEncrypt(token), new Date(), jwtUserDto.getUser().getOrgId(),
-					onlineToken);
-		} catch (Exception e) {
-			log.error(e.getMessage(), e);
-		}
+	public void save(Object securityContextUser, String token, HttpServletRequest request) throws Exception {
+		OnlineUserDto onlineUserDto = (OnlineUserDto) securityContextUser;
+		onlineUserDto.setKey(EncryptUtils.desEncrypt(token));
+		onlineUserDto.setOnlineToken(properties.getOnlineKey() + token);
+		onlineUserDto.setBrowser(StringUtils.getBrowser(request));
+		onlineUserDto.setIp(StringUtils.getIp(request));
+		onlineUserDto.setAddress(StringUtils.getCityInfo(StringUtils.getIp(request)));
+		onlineUserDto.setLoginTime(new Date());
+
 		// 先查询是否存在该登录用户,如果存在,则直接剔除
-		kickOutForUsername(onlineUserDto.getUserName());
+		kickOutForUsername(onlineUserDto.getUsername());
 		// TODO 这里只是单机处理,后面修改为多机处理
 		Map<String, HashMap<UUID, SocketIOClient>> socketServers = ClientCache.getWebSocketMap();
 //		List<String> names = new ArrayList<String>();
 		for (String webSocketName : socketServers.keySet()) {
-			if (StringUtils.isNotBlank(webSocketName) && onlineUserDto.getUserName().equals(webSocketName)) {
+			if (StringUtils.isNotBlank(webSocketName) && onlineUserDto.getUsername().equals(webSocketName)) {
 				HashMap<UUID, SocketIOClient> userClient = socketServers.get(webSocketName);
 				userClient.forEach((uuid, socketIOClient) -> {
 					JsonObject obj = new JsonObject();
@@ -91,7 +82,7 @@ public class OnlineUserService {
 //		for (String key : names) {
 //			socketServers.remove(key);
 //		}
-		redisUtils.set(properties.getOnlineKey() + token, onlineUserDto, properties.getTokenValidityInSeconds() / 1000);
+		redisUtils.set(properties.getOnlineKey() + token, JSON.toJSONString(securityContextUser), properties.getTokenValidityInSeconds() / 1000);
 	}
 
 	/**
@@ -116,20 +107,36 @@ public class OnlineUserService {
 	public List<OnlineUserDto> getAll(String filter) {
 		List<String> keys = redisUtils.scan(properties.getOnlineKey() + "*");
 		Collections.reverse(keys);
-		List<OnlineUserDto> onlineUserDtos = new ArrayList<>();
+		List<OnlineUserDto> onlineUserList = new ArrayList<>();
 		for (String key : keys) {
-			OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key);
+			OnlineUserDto onlineUserDto = JSON.parseObject((String) redisUtils.get(key), OnlineUserDto.class);
 			// onlineUserDto.setToken(key);
 			if (StringUtils.isNotBlank(filter)) {
 				if (onlineUserDto.toString().contains(filter)) {
-					onlineUserDtos.add(onlineUserDto);
+					onlineUserList.add(onlineUserDto);
 				}
 			} else {
-				onlineUserDtos.add(onlineUserDto);
+				onlineUserList.add(onlineUserDto);
 			}
 		}
-		onlineUserDtos.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime()));
-		return onlineUserDtos;
+		onlineUserList.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime()));
+		return onlineUserList;
+	}
+
+	/**
+	 * 查询全部登录用户
+	 *
+	 * @return
+	 */
+	public List<Object> getAllLoginUser() {
+		List<String> keys = redisUtils.scan(properties.getOnlineKey() + "*");
+		Collections.reverse(keys);
+		List<Object> securityContextUsers = new ArrayList<>();
+		for (String key : keys) {
+			securityContextUsers.add(redisUtils.get(key));
+
+		}
+		return securityContextUsers;
 	}
 
 	/**
@@ -144,7 +151,7 @@ public class OnlineUserService {
 
 	/**
 	 * 退出登录
-	 * 
+	 *
 	 * @param token /
 	 */
 	public void logout(String token) {
@@ -163,7 +170,7 @@ public class OnlineUserService {
 		List<Map<String, Object>> list = new ArrayList<>();
 		for (OnlineUserDto user : all) {
 			Map<String, Object> map = new LinkedHashMap<>();
-			map.put("用户名", user.getUserName());
+			map.put("用户名", user.getUsername());
 			map.put("部门", user.getDept());
 			map.put("登录IP", user.getIp());
 			map.put("登录地点", user.getAddress());
@@ -180,8 +187,8 @@ public class OnlineUserService {
 	 * @param key /
 	 * @return /
 	 */
-	public OnlineUserDto getOne(String key) {
-		return (OnlineUserDto) redisUtils.get(key);
+	public String getOne(String key) {
+		return (String) redisUtils.get(key);
 	}
 
 	/**
@@ -195,12 +202,10 @@ public class OnlineUserService {
 			return;
 		}
 		for (OnlineUserDto onlineUserDto : onlineUserDtos) {
-			if (onlineUserDto.getUserName().equals(userName)) {
+			if (onlineUserDto.getUsername().equals(userName)) {
 				try {
 					String token = EncryptUtils.desDecrypt(onlineUserDto.getKey());
-					if (StringUtils.isNotBlank(igoreToken) && !igoreToken.equals(token)) {
-						this.kickOut(token);
-					} else if (StringUtils.isBlank(igoreToken)) {
+					if (StringUtils.isBlank(igoreToken) || !igoreToken.equals(token)) {
 						this.kickOut(token);
 					}
 				} catch (Exception e) {
@@ -219,7 +224,7 @@ public class OnlineUserService {
 	public void kickOutForUsername(String username) throws Exception {
 		List<OnlineUserDto> onlineUsers = getAll(username);
 		for (OnlineUserDto onlineUser : onlineUsers) {
-			if (onlineUser.getUserName().equals(username)) {
+			if (onlineUser.getUsername().equals(username)) {
 				String token = EncryptUtils.desDecrypt(onlineUser.getKey());
 				kickOut(token);
 			}

+ 72 - 0
eladmin-security/src/main/java/me/zhengjie/security/service/dto/OnlineUserDto.java

@@ -0,0 +1,72 @@
+package me.zhengjie.security.service.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class OnlineUserDto implements UserDetails {
+    private Long userId;
+    private String username;
+    private String password;
+    private String nickName;
+    private String dept;
+    private String key;
+    private String onlineToken;
+    private String ip;
+    private String address;
+    private String browser;
+    private Date loginTime;
+    private boolean enabled;
+    private List<Long> dataScopes;
+    private List<GrantedAuthority> authorities;
+
+    @Override
+    public List<GrantedAuthority> getAuthorities() {
+        return authorities;
+    }
+
+    @Override
+    @JSONField(serialize = false)
+    public String getPassword() {
+        return password;
+    }
+
+    @Override
+    public String getUsername() {
+        return username;
+    }
+
+    @JSONField(serialize = false)
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @JSONField(serialize = false)
+    @Override
+    public boolean isAccountNonLocked() {
+        return true;
+    }
+
+    @JSONField(serialize = false)
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    @JSONField(serialize = false)
+    public boolean isEnabled() {
+        return enabled;
+    }
+}

+ 26 - 42
eladmin-system/pom.xml

@@ -24,7 +24,6 @@
 		<tencentcloud.sdk.version>3.1.531</tencentcloud.sdk.version>
 		<hu.tu>5.4.5</hu.tu>
 		<xxl.job.version>2.3.0</xxl.job.version>
-		<netty-socketio.version>1.7.11</netty-socketio.version>
 		<cfca.common.version>3.7.5.3</cfca.common.version>
 		<cfca.sadk.version>3.7.1.0</cfca.sadk.version>
 		<cfca.logback.version>4.2.1.0</cfca.logback.version>
@@ -53,56 +52,46 @@
 			</exclusions>
 		</dependency>
 
-		<!-- tools 模块包含了 common 和 logging 模块 -->
 		<dependency>
 			<groupId>me.zhengjie</groupId>
-			<artifactId>eladmin-tools</artifactId>
+			<artifactId>eladmin-security</artifactId>
 			<version>2.6</version>
+			<exclusions>
+				<exclusion>
+					<groupId>me.zhengjie</groupId>
+					<artifactId>eladmin-common</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 
-		<!-- Spring boot websocket -->
 		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-websocket</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.pdfbox</groupId>
-			<artifactId>pdfbox</artifactId>
-			<version>2.0.13</version>
-		</dependency>
-		<!-- jwt -->
-		<dependency>
-			<groupId>io.jsonwebtoken</groupId>
-			<artifactId>jjwt-api</artifactId>
-			<version>${jjwt.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>io.jsonwebtoken</groupId>
-			<artifactId>jjwt-impl</artifactId>
-			<version>${jjwt.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>io.jsonwebtoken</groupId>
-			<artifactId>jjwt-jackson</artifactId>
-			<version>${jjwt.version}</version>
+			<groupId>me.zhengjie</groupId>
+			<artifactId>eladmin-mnt</artifactId>
+			<version>2.6</version>
+			<exclusions>
+				<exclusion>
+					<groupId>me.zhengjie</groupId>
+					<artifactId>eladmin-logging</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 
-		<!-- quartz -->
+		<!-- quartz模块包含了tools common 和 logging 模块 -->
 		<dependency>
-			<groupId>org.quartz-scheduler</groupId>
-			<artifactId>quartz</artifactId>
+			<groupId>me.zhengjie</groupId>
+			<artifactId>eladmin-quartz</artifactId>
+			<version>2.6</version>
 		</dependency>
 
-		<!-- linux的管理 -->
+		<!-- Spring boot websocket -->
 		<dependency>
-			<groupId>ch.ethz.ganymed</groupId>
-			<artifactId>ganymed-ssh2</artifactId>
-			<version>build210</version>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-websocket</artifactId>
 		</dependency>
 		<dependency>
-			<groupId>com.jcraft</groupId>
-			<artifactId>jsch</artifactId>
-			<version>0.1.55</version>
+			<groupId>org.apache.pdfbox</groupId>
+			<artifactId>pdfbox</artifactId>
+			<version>2.0.13</version>
 		</dependency>
 
 		<!-- 获取系统信息 -->
@@ -143,11 +132,6 @@
 			<version>${zefer.ss_css.version}</version>
 		</dependency>
 		<dependency>
-			<groupId>com.corundumstudio.socketio</groupId>
-			<artifactId>netty-socketio</artifactId>
-			<version>${netty-socketio.version}</version>
-		</dependency>
-		<dependency>
 			<groupId>com.uinid</groupId>
 			<artifactId>NATLSignClient</artifactId>
 			<version>${NATLSignClient.version}</version>

+ 3 - 9
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/DemoController.java

@@ -2,11 +2,11 @@ package me.zhengjie.application.admin.controller;
 
 import com.tencentyun.TLSSigAPIv2;
 import me.zhengjie.annotation.AnonymousAccess;
-import me.zhengjie.modules.mnt.websocket.MsgType;
-import me.zhengjie.modules.mnt.websocket.SocketMsg;
-import me.zhengjie.modules.mnt.websocket.WebSocketServer;
 import me.zhengjie.base.BaseResponse;
 import me.zhengjie.base.ResultData;
+import me.zhengjie.websocket.MsgType;
+import me.zhengjie.websocket.SocketMsg;
+import me.zhengjie.websocket.WebSocketServer;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 
@@ -36,7 +36,6 @@ public class DemoController {
         return "success";
     }
 
-
     /**
      * 机构 查询  银行+公证处
      *
@@ -51,9 +50,4 @@ public class DemoController {
         response.setData(new ResultData(s));
         return response;
     }
-
-
-
-
-
 }

+ 3 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/MenuController.java

@@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
 import me.zhengjie.base.AppBaseResponse;
+import me.zhengjie.base.util.ApplicationContextUtil;
 import me.zhengjie.dao.mybatis.entity.Menu;
 import me.zhengjie.exception.BadRequestException;
 import me.zhengjie.application.admin.service.MenuService;
@@ -51,6 +52,7 @@ public class MenuController {
 
     private final MenuService menuService;
     private final MenuMapper menuMapper;
+    private final ApplicationContextUtil contextUtil;
     private static final String ENTITY_NAME = "menu";
 
     @ApiOperation("导出菜单数据")
@@ -63,7 +65,7 @@ public class MenuController {
     @GetMapping(value = "/build")
     @ApiOperation("获取前端所需菜单")
     public ResponseEntity<Object> buildMenus(){
-        List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId());
+        List<MenuDto> menuDtoList = menuService.findByUser(contextUtil.getCurrentUserId());
         List<MenuDto> menuDtos = menuService.buildTree(menuDtoList);
         return new ResponseEntity<>(menuService.buildMenus(menuDtos),HttpStatus.OK);
     }

+ 1 - 2
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/NotaryOrderController.java

@@ -43,13 +43,13 @@ public class NotaryOrderController {
 
     @Autowired
     private NotaryOrderService notaryOrderService;
-
     @Autowired
     private BorrowerService borrowerService;
     @Autowired
     MortgageService mortgageService;
     @Autowired
     GuaranteeService guaranteeService;
+
     /**
      * 公证订单 查询
      *
@@ -60,7 +60,6 @@ public class NotaryOrderController {
         return notaryOrderService.query(req);
     }
 
-
     /**
      * 查询 客户经理信息
      *

+ 4 - 2
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/OrderRoomIdController.java

@@ -2,6 +2,7 @@ package me.zhengjie.application.admin.controller;
 
 import java.util.List;
 
+import me.zhengjie.base.util.ApplicationContextUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -20,7 +21,6 @@ import me.zhengjie.application.bank.service.OrderRoomIdService;
 import me.zhengjie.base.util.FileUploadUtil;
 import me.zhengjie.base.ResultCode;
 import me.zhengjie.base.util.WebSocketMap;
-import me.zhengjie.utils.SecurityUtils;
 
 @RestController
 @Validated
@@ -29,6 +29,8 @@ import me.zhengjie.utils.SecurityUtils;
 public class OrderRoomIdController {
 	@Autowired
 	OrderRoomIdService orderRoomService;
+	@Autowired
+	ApplicationContextUtil contextUtil;
 
 	/**
 	 * 查询 借款人信息
@@ -75,7 +77,7 @@ public class OrderRoomIdController {
 		String socketId = jsonObj.getString("socketId");
 		List<JSONObject> data = WebSocketMap.get(socketId);
 		// try
-		String userName = SecurityUtils.getCurrentUsername();
+		String userName = contextUtil.getCurrentUsername();
 
 		AppBaseResponse<?> result = null;
 		if (data != null && data.size() > 0) {

+ 3 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/RoleController.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
+import me.zhengjie.base.util.ApplicationContextUtil;
 import me.zhengjie.dao.mybatis.entity.Role;
 import me.zhengjie.exception.BadRequestException;
 import me.zhengjie.application.admin.service.RoleService;
@@ -51,6 +52,7 @@ import java.util.stream.Collectors;
 public class RoleController {
 
     private final RoleService roleService;
+    private final ApplicationContextUtil contextUtil;
 
     private static final String ENTITY_NAME = "role";
 
@@ -142,7 +144,7 @@ public class RoleController {
      * @return /
      */
     private int getLevels(Integer level){
-        List<Integer> levels = roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList());
+        List<Integer> levels = roleService.findByUsersId(contextUtil.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList());
         int min = Collections.min(levels);
         if(level != null){
             if(level < min){

+ 46 - 18
eladmin-system/src/main/java/me/zhengjie/application/admin/controller/UserController.java

@@ -21,22 +21,23 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.annotation.Log;
 import me.zhengjie.annotation.rest.AnonymousPostMapping;
+import me.zhengjie.application.admin.controller.vo.UserPassVo;
+import me.zhengjie.application.admin.controller.vo.UserReq;
+import me.zhengjie.application.admin.service.*;
+import me.zhengjie.application.admin.service.dto.JwtUserDto;
+import me.zhengjie.application.admin.service.dto.RoleSmallDto;
+import me.zhengjie.application.admin.service.dto.UserDto;
+import me.zhengjie.application.admin.service.dto.UserQueryCriteria;
+import me.zhengjie.application.bank.service.FileInfoService;
 import me.zhengjie.base.AppBaseResponse;
+import me.zhengjie.base.util.ApplicationContextUtil;
+import me.zhengjie.base.util.FileUploadUtil;
 import me.zhengjie.config.RsaProperties;
 import me.zhengjie.dao.mybatis.entity.Dept;
-import me.zhengjie.application.admin.controller.vo.UserReq;
-import me.zhengjie.application.admin.service.DataService;
+import me.zhengjie.dao.mybatis.entity.FileInfoEntity;
 import me.zhengjie.dao.mybatis.entity.User;
 import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.application.admin.controller.vo.UserPassVo;
-import me.zhengjie.application.admin.service.DeptService;
-import me.zhengjie.application.admin.service.RoleService;
-import me.zhengjie.application.admin.service.dto.RoleSmallDto;
-import me.zhengjie.application.admin.service.dto.UserDto;
-import me.zhengjie.application.admin.service.dto.UserQueryCriteria;
-import me.zhengjie.application.admin.service.VerifyService;
-import me.zhengjie.utils.*;
-import me.zhengjie.application.admin.service.UserService;
+import me.zhengjie.utils.RsaUtils;
 import me.zhengjie.utils.enums.CodeEnum;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -47,9 +48,13 @@ import org.springframework.util.ObjectUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 /**
@@ -68,6 +73,29 @@ public class UserController {
     private final DeptService deptService;
     private final RoleService roleService;
     private final VerifyService verificationCodeService;
+    private final FileInfoService fileInfoService;
+    private final ApplicationContextUtil contextUtil;
+
+    @ApiOperation("获取用户信息")
+    @GetMapping(value = "/info")
+    public ResponseEntity<Object> getUserInfo() {
+        // 这里需要处理图片显示问题
+        JwtUserDto jwtUserDto = contextUtil.getCurrentUser();
+        // 处理图片的显示,重新查询一下当前的用户的值
+        UserDto cacheUser = jwtUserDto.getUser();
+        UserDto user = userService.findUserNoCacheId(cacheUser.getId());
+        if (user != null) {
+            FileInfoEntity fileInfo = fileInfoService.getById(user.getSignImgId());
+            if (fileInfo != null) {
+                String signImgUrl = FileUploadUtil.getFileUrl(fileInfo.getPath());
+                cacheUser.setSignImgUrl(signImgUrl);
+            }else {
+                //这里需要设置图片的路径为空
+                cacheUser.setSignImgUrl("");
+            }
+        }
+        return ResponseEntity.ok(jwtUserDto);
+    }
 
     @ApiOperation("导出用户数据")
     @GetMapping(value = "/download")
@@ -88,7 +116,7 @@ public class UserController {
             userReq.getDeptIds().addAll(deptService.getDeptChildren(data));
         }
         // 数据权限
-        List<Long> dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername()));
+        List<Long> dataScopes = dataService.getDeptIds(userService.findByName(contextUtil.getCurrentUsername()));
         // getDeptIds() 不为空并且数据权限不为空则取交集
         Map<String,Object> userList = null;
         if (!CollectionUtils.isEmpty(userReq.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)){
@@ -130,7 +158,7 @@ public class UserController {
     @ApiOperation("修改用户:个人中心")
     @PutMapping(value = "center")
     public ResponseEntity<Object> centerUser(@Validated(User.Update.class) @RequestBody User resources){
-        if(!resources.getId().equals(SecurityUtils.getCurrentUserId())){
+        if(!resources.getId().equals(contextUtil.getCurrentUserId())){
             throw new BadRequestException("不能修改他人资料");
         }
         userService.updateCenter(resources);
@@ -143,7 +171,7 @@ public class UserController {
     @PreAuthorize("@el.check('user:del')")
     public ResponseEntity<Object> deleteUser(@RequestBody Set<Long> ids){
         for (Long id : ids) {
-            Integer currentLevel =  Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
+            Integer currentLevel =  Collections.min(roleService.findByUsersId(contextUtil.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
             Integer optLevel =  Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
             if (currentLevel > optLevel) {
                 throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername());
@@ -158,7 +186,7 @@ public class UserController {
     public ResponseEntity<Object> updateUserPass(@RequestBody UserPassVo passVo) throws Exception {
         String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getOldPass());
         String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getNewPass());
-        UserDto user = userService.findByName(SecurityUtils.getCurrentUsername());
+        UserDto user = userService.findByName(contextUtil.getCurrentUsername());
         if(!passwordEncoder.matches(oldPass, user.getPassword())){
             throw new BadRequestException("修改失败,旧密码错误");
         }
@@ -180,7 +208,7 @@ public class UserController {
     @PostMapping(value = "/updateEmail/{code}")
     public ResponseEntity<Object> updateUserEmail(@PathVariable String code,@RequestBody User user) throws Exception {
         String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword());
-        UserDto userDto = userService.findByName(SecurityUtils.getCurrentUsername());
+        UserDto userDto = userService.findByName(contextUtil.getCurrentUsername());
         if(!passwordEncoder.matches(password, userDto.getPassword())){
             throw new BadRequestException("密码错误");
         }
@@ -221,7 +249,7 @@ public class UserController {
      * @param resources /
      */
     private void checkLevel(User resources) {
-        Integer currentLevel =  Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
+        Integer currentLevel =  Collections.min(roleService.findByUsersId(contextUtil.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
         Integer optLevel = roleService.findByRoles(resources.getRoles());
         if (currentLevel > optLevel) {
             throw new BadRequestException("角色权限不足");

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/job/GenerateNotarizationJob.java

@@ -98,7 +98,7 @@ public class GenerateNotarizationJob {
     private void signNotarization(OrderFileEntity orderFile) throws Exception{
         SysUserEntity notaryUser;
         NotaryOfficeEntity notaryOffice;
-        Integer notaryUserId;
+        String notaryUserId;
         if ("10".equals(orderFile.getContractId().substring(0, 2))) {
             BorrowerEntity borrower = borrowerMapper.selectById(orderFile.getContractId());
             notaryUserId = borrower.getNotaryUserId();

+ 45 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/dto/JwtUserDto.java

@@ -0,0 +1,45 @@
+/*
+ *  Copyright 2019-2020 Zheng Jie
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package me.zhengjie.application.admin.service.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import me.zhengjie.security.service.dto.OnlineUserDto;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author Zheng Jie
+ * @date 2018-11-23
+ */
+@NoArgsConstructor
+@Getter
+@Setter
+public class JwtUserDto extends OnlineUserDto {
+
+    private UserDto user;
+
+    public Set<String> getRoles() {
+        return getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toSet());
+    }
+}

+ 3 - 1
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/DeptServiceImpl.java

@@ -18,6 +18,7 @@ package me.zhengjie.application.admin.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import lombok.RequiredArgsConstructor;
+import me.zhengjie.base.util.ApplicationContextUtil;
 import me.zhengjie.exception.BadRequestException;
 import me.zhengjie.dao.mybatis.entity.Dept;
 import me.zhengjie.dao.mybatis.entity.User;
@@ -54,11 +55,12 @@ public class DeptServiceImpl implements DeptService {
     private final UserRepository userRepository;
     private final RedisUtils redisUtils;
     private final RoleRepository roleRepository;
+    private final ApplicationContextUtil contextUtil;
 
     @Override
     public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
         Sort sort = Sort.by(Sort.Direction.ASC, "deptSort");
-        String dataScopeType = SecurityUtils.getDataScopeType();
+        String dataScopeType = contextUtil.getDataScopeType();
         if (isQuery) {
             if(dataScopeType.equals(DataScopeEnum.ALL.getValue())){
                 criteria.setPidIsNull(true);

+ 12 - 10
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/ModelNotarizationServiceImpl.java

@@ -4,22 +4,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
-import me.zhengjie.dao.mybatis.entity.NotaryNoteEntity;
+import me.zhengjie.application.admin.controller.vo.ModelReq;
+import me.zhengjie.application.admin.controller.vo.NotaryNoteReq;
+import me.zhengjie.application.admin.service.ModelNotarizationService;
+import me.zhengjie.application.admin.service.dto.JwtUserDto;
 import me.zhengjie.base.AppBaseResponse;
 import me.zhengjie.base.AppResultData;
-import me.zhengjie.dao.mybatis.mapper.INotaryNoteDao;
-import me.zhengjie.base.util.BeanCopyUtils;
 import me.zhengjie.base.ResultCode;
-import me.zhengjie.modules.security.service.dto.JwtUserDto;
-import me.zhengjie.domain.user.UserDomain;
+import me.zhengjie.base.util.ApplicationContextUtil;
+import me.zhengjie.base.util.BeanCopyUtils;
 import me.zhengjie.dao.mybatis.entity.ModelEntity;
+import me.zhengjie.dao.mybatis.entity.NotaryNoteEntity;
 import me.zhengjie.dao.mybatis.entity.NotaryOfficeEntity;
-import me.zhengjie.application.admin.controller.vo.ModelReq;
-import me.zhengjie.application.admin.controller.vo.NotaryNoteReq;
+import me.zhengjie.dao.mybatis.mapper.INotaryNoteDao;
 import me.zhengjie.dao.mybatis.mapper.ModelMapper;
 import me.zhengjie.dao.mybatis.mapper.NotaryOfficeMapper;
-import me.zhengjie.application.admin.service.ModelNotarizationService;
-import me.zhengjie.utils.SecurityUtils;
+import me.zhengjie.domain.user.UserDomain;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -42,6 +42,8 @@ public class ModelNotarizationServiceImpl implements ModelNotarizationService {
     private INotaryNoteDao notaryNoteDao;
     @Autowired
     private NotaryOfficeMapper notaryOfficeMapper;
+    @Autowired
+    private ApplicationContextUtil contextUtil;
 
     /**
      * 查询公证文书列表
@@ -106,7 +108,7 @@ public class ModelNotarizationServiceImpl implements ModelNotarizationService {
         String roleName = userDomain.getUserMaxRole();
         if ("超级管理员".equals(roleName)) {
         } else if ("公证处管理员".equals(roleName)) {
-            JwtUserDto user = (JwtUserDto) SecurityUtils.getCurrentUser();
+            JwtUserDto user = contextUtil.getCurrentUser();
             qw.eq("notary_office_id", user.getUser().getOrgId().split("_")[1]);
         } else {
             return null;

+ 0 - 0
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/NotaryOfficeServiceImpl.java


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov