Browse Source

父模块设置版本号,提取公共jar

tags/正式3.8.0
王宁 1 year ago
parent
commit
28f42d2844

+ 6
- 10
config/pom.xml View File

@@ -2,21 +2,17 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>config</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>config</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
10
+
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
20 16
     <dependencies>
21 17
         <dependency>
22 18
             <groupId>org.springframework.boot</groupId>

+ 7
- 14
gateway/pom.xml View File

@@ -2,30 +2,23 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>gateway</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>gateway</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
10
+
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
20 16
     <dependencies>
21 17
         <dependency>
22 18
             <groupId>org.springframework.cloud</groupId>
23 19
             <artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId>
24 20
         </dependency>
25
-        <!--<dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-config</artifactId>
28
-        </dependency>-->
21
+
29 22
         <dependency>
30 23
             <groupId>org.springframework.cloud</groupId>
31 24
             <artifactId>spring-cloud-starter-gateway</artifactId>

+ 12
- 0
pom.xml View File

@@ -23,6 +23,18 @@
23 23
         <module>sexam</module>
24 24
     </modules>
25 25
 
26
+    <parent>
27
+        <groupId>org.springframework.boot</groupId>
28
+        <artifactId>spring-boot-starter-parent</artifactId>
29
+        <version>2.6.3</version>
30
+        <relativePath/> <!-- lookup parent from repository -->
31
+    </parent>
32
+
33
+    <properties>
34
+        <java.version>1.8</java.version>
35
+        <spring-cloud.version>2021.0.0</spring-cloud.version>
36
+    </properties>
37
+
26 38
     <dependencyManagement>
27 39
         <dependencies>
28 40
             <dependency>

+ 6
- 10
register/pom.xml View File

@@ -2,21 +2,17 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>register</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>register</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
10
+
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
20 16
     <dependencies>
21 17
         <dependency>
22 18
             <groupId>org.springframework.cloud</groupId>

+ 6
- 24
sapi/pom.xml View File

@@ -2,36 +2,18 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>sapi</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>sapi</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
20
-    <dependencies>
21
-        <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
28
-        </dependency>
29
-        <dependency>
30
-            <groupId>org.springframework.boot</groupId>
31
-            <artifactId>spring-boot-starter-test</artifactId>
32
-            <scope>test</scope>
33
-        </dependency>
34 10
 
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
16
+    <dependencies>
35 17
         <dependency>
36 18
             <groupId>com.xhkjedu</groupId>
37 19
             <artifactId>scommons</artifactId>

+ 0
- 68
sapi/src/main/java/com/xhkjedu/sapi/config/ErrorAdivceController.java View File

@@ -1,68 +0,0 @@
1
-package com.xhkjedu.sapi.config;
2
-import com.alibaba.fastjson.JSON;
3
-import com.xhkjedu.config.MissingParametersException;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.springframework.dao.DataIntegrityViolationException;
8
-import org.springframework.web.bind.annotation.ControllerAdvice;
9
-import org.springframework.web.bind.annotation.ExceptionHandler;
10
-import org.springframework.web.bind.annotation.ResponseBody;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-
14
-
15
-/**
16
- * @创建人 :zj
17
- * @创建时间 2019/11/7
18
- * @修改人和其它信息
19
- * @描述 :项目异常处理类:
20
- * 项目中所有controller层抛出的异常信息都会被拦截。
21
- * 方便我们查看异常原因,减少开发中大量的try catch。
22
- * 拦截异常后,打印异常信息,返回前端约定参数对象。
23
- */
24
-@Slf4j
25
-@ResponseBody
26
-@ControllerAdvice
27
-public class ErrorAdivceController {
28
-    @ExceptionHandler(MissingParametersException.class)
29
-    public ResultVo missingParametersException(MissingParametersException ex) {
30
-        log.error("参数异常:   -------> " + ex.getMessage());
31
-        return new ResultVo(1, ex.getMessage());
32
-    }
33
-
34
-    @ExceptionHandler(DataIntegrityViolationException.class)
35
-    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
36
-        log.error("数据库异常:   -------> " + ex.getMessage());
37
-        String msg = ex.getMessage();
38
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
39
-            return new ResultVo(1,"存在关联信息");
40
-        }
41
-        return new ResultVo(1,"数据库处理异常");
42
-    }
43
-
44
-    @ExceptionHandler(Exception.class)
45
-    public ResultVo exceptionHandler(Exception ex) {
46
-        log.error("程序运行异常:   -------> " + ex.getMessage());
47
-        String msg = ex.getMessage();
48
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
49
-            return new ResultVo(1,"json格式不对");
50
-        }
51
-        return new ResultVo(1, "程序处理异常");
52
-    }
53
-
54
-    @ExceptionHandler(NullPointerException.class)
55
-    public ResultVo nullPointerException(NullPointerException ex) {
56
-        StackTraceElement element = ex.getStackTrace()[0];
57
-        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
58
-        return new ResultVo(1, "参数为空异常");
59
-    }
60
-
61
-    @ExceptionHandler(value = IllegalArgumentException.class)
62
-    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request, IllegalArgumentException ex) {
63
-        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
64
-        return new ResultVo(1, "请求参数错误");
65
-    }
66
-
67
-
68
-}

+ 6
- 24
sclass/pom.xml View File

@@ -2,36 +2,18 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>sclass</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>sclass</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
20
-    <dependencies>
21
-        <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
28
-        </dependency>
29 10
 
30
-        <dependency>
31
-            <groupId>org.springframework.boot</groupId>
32
-            <artifactId>spring-boot-starter-test</artifactId>
33
-            <scope>test</scope>
34
-        </dependency>
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
16
+    <dependencies>
35 17
         <dependency>
36 18
             <groupId>com.xhkjedu</groupId>
37 19
             <artifactId>scommons</artifactId>

+ 0
- 67
sclass/src/main/java/com/xhkjedu/sclass/config/ErrorAdivceController.java View File

@@ -1,67 +0,0 @@
1
-package com.xhkjedu.sclass.config;
2
-import com.alibaba.fastjson.JSON;
3
-import com.xhkjedu.config.MissingParametersException;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.springframework.dao.DataIntegrityViolationException;
8
-import org.springframework.web.bind.annotation.ControllerAdvice;
9
-import org.springframework.web.bind.annotation.ExceptionHandler;
10
-import org.springframework.web.bind.annotation.ResponseBody;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-
14
-/**
15
- * @创建人 :zj
16
- * @创建时间 2019/11/7
17
- * @修改人和其它信息
18
- * @描述 :项目异常处理类:
19
- * 项目中所有controller层抛出的异常信息都会被拦截。
20
- * 方便我们查看异常原因,减少开发中大量的try catch。
21
- * 拦截异常后,打印异常信息,返回前端约定参数对象。
22
- */
23
-@Slf4j
24
-@ResponseBody
25
-@ControllerAdvice
26
-public class ErrorAdivceController {
27
-    @ExceptionHandler(MissingParametersException.class)
28
-    public ResultVo missingParametersException(MissingParametersException ex) {
29
-        log.error("参数异常:   -------> " + ex.getMessage());
30
-        return new ResultVo(1, ex.getMessage());
31
-    }
32
-
33
-    @ExceptionHandler(DataIntegrityViolationException.class)
34
-    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
35
-        log.error("数据库异常:   -------> " + ex.getMessage());
36
-        String msg = ex.getMessage();
37
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
38
-            return new ResultVo(1,"存在关联信息");
39
-        }
40
-        return new ResultVo(1,"数据库处理异常");
41
-    }
42
-
43
-    @ExceptionHandler(Exception.class)
44
-    public ResultVo exceptionHandler(Exception ex) {
45
-        log.error("程序运行异常:   -------> " + ex.getMessage());
46
-        String msg = ex.getMessage();
47
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
48
-            return new ResultVo(1,"json格式不对");
49
-        }
50
-        return new ResultVo(1, "程序处理异常");
51
-    }
52
-
53
-    @ExceptionHandler(NullPointerException.class)
54
-    public ResultVo nullPointerException(NullPointerException ex) {
55
-        StackTraceElement element = ex.getStackTrace()[0];
56
-        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
57
-        return new ResultVo(1, "参数为空异常");
58
-    }
59
-
60
-    @ExceptionHandler(value = IllegalArgumentException.class)
61
-    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request,IllegalArgumentException ex) {
62
-        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
63
-        return new ResultVo(1, "请求参数错误");
64
-    }
65
-
66
-
67
-}

+ 27
- 12
scommons/pom.xml View File

@@ -2,19 +2,38 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
5
+
11 6
     <groupId>com.xhkjedu</groupId>
12 7
     <artifactId>scommons</artifactId>
13 8
     <version>0.0.1-SNAPSHOT</version>
14 9
     <name>scommons</name>
15 10
     <description>scommons</description>
16 11
 
12
+    <parent>
13
+        <groupId>com.xhkjedu</groupId>
14
+        <artifactId>cloud-schoolapi</artifactId>
15
+        <version>1.0-SNAPSHOT</version>
16
+    </parent>
17
+
17 18
     <dependencies>
19
+
20
+        <dependency>
21
+            <groupId>org.springframework.boot</groupId>
22
+            <artifactId>spring-boot-starter-web</artifactId>
23
+        </dependency>
24
+
25
+        <dependency>
26
+            <groupId>org.springframework.cloud</groupId>
27
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
28
+            <version>3.1.0</version>
29
+        </dependency>
30
+
31
+        <dependency>
32
+            <groupId>org.springframework.boot</groupId>
33
+            <artifactId>spring-boot-starter-test</artifactId>
34
+            <!--<scope>test</scope>-->
35
+        </dependency>
36
+
18 37
         <dependency>
19 38
             <groupId>org.projectlombok</groupId>
20 39
             <artifactId>lombok</artifactId>
@@ -53,6 +72,7 @@
53 72
             <artifactId>mapper-spring-boot-starter</artifactId>
54 73
             <version>2.0.2</version>
55 74
         </dependency>
75
+
56 76
     </dependencies>
57 77
 
58 78
     <build>
@@ -62,12 +82,7 @@
62 82
                 <artifactId>spring-boot-maven-plugin</artifactId>
63 83
                 <configuration>
64 84
                     <skip>true</skip>
65
-                    <excludes>
66
-                        <exclude>
67
-                            <groupId>org.projectlombok</groupId>
68
-                            <artifactId>lombok</artifactId>
69
-                        </exclude>
70
-                    </excludes>
85
+                    <classifier>exec</classifier>
71 86
                 </configuration>
72 87
             </plugin>
73 88
         </plugins>

suser/src/main/java/com/xhkjedu/suser/config/ErrorAdivceController.java → scommons/src/main/java/com/xhkjedu/exception/ErrorAdivceController.java View File

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.suser.config;
1
+package com.xhkjedu.exception;
2 2
 import com.alibaba.fastjson.JSON;
3 3
 import com.xhkjedu.config.MissingParametersException;
4 4
 import com.xhkjedu.utils.N_Utils;

+ 7
- 24
sexam/pom.xml View File

@@ -2,36 +2,19 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>sexam</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>sexam</name>
15 9
     <description>sexam</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
20
-    <dependencies>
21
-        <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
28
-        </dependency>
29 10
 
30
-        <dependency>
31
-            <groupId>org.springframework.boot</groupId>
32
-            <artifactId>spring-boot-starter-test</artifactId>
33
-            <scope>test</scope>
34
-        </dependency>
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
16
+
17
+    <dependencies>
35 18
         <dependency>
36 19
             <groupId>com.xhkjedu</groupId>
37 20
             <artifactId>scommons</artifactId>

+ 0
- 67
sexam/src/main/java/com/xhkjedu/sexam/config/ErrorAdivceController.java View File

@@ -1,67 +0,0 @@
1
-package com.xhkjedu.sexam.config;
2
-import com.alibaba.fastjson.JSON;
3
-import com.xhkjedu.config.MissingParametersException;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.springframework.dao.DataIntegrityViolationException;
8
-import org.springframework.web.bind.annotation.ControllerAdvice;
9
-import org.springframework.web.bind.annotation.ExceptionHandler;
10
-import org.springframework.web.bind.annotation.ResponseBody;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-
14
-/**
15
- * @创建人 :zj
16
- * @创建时间 2019/11/7
17
- * @修改人和其它信息
18
- * @描述 :项目异常处理类:
19
- * 项目中所有controller层抛出的异常信息都会被拦截。
20
- * 方便我们查看异常原因,减少开发中大量的try catch。
21
- * 拦截异常后,打印异常信息,返回前端约定参数对象。
22
- */
23
-@Slf4j
24
-@ResponseBody
25
-@ControllerAdvice
26
-public class ErrorAdivceController {
27
-    @ExceptionHandler(MissingParametersException.class)
28
-    public ResultVo missingParametersException(MissingParametersException ex) {
29
-        log.error("参数异常:   -------> " + ex.getMessage());
30
-        return new ResultVo(1, ex.getMessage());
31
-    }
32
-
33
-    @ExceptionHandler(DataIntegrityViolationException.class)
34
-    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
35
-        log.error("数据库异常:   -------> " + ex.getMessage());
36
-        String msg = ex.getMessage();
37
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
38
-            return new ResultVo(1,"存在关联信息");
39
-        }
40
-        return new ResultVo(1,"数据库处理异常");
41
-    }
42
-
43
-    @ExceptionHandler(Exception.class)
44
-    public ResultVo exceptionHandler(Exception ex) {
45
-        log.error("程序运行异常:   -------> " + ex.getMessage());
46
-        String msg = ex.getMessage();
47
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
48
-            return new ResultVo(1,"json格式不对");
49
-        }
50
-        return new ResultVo(1, "程序处理异常");
51
-    }
52
-
53
-    @ExceptionHandler(NullPointerException.class)
54
-    public ResultVo nullPointerException(NullPointerException ex) {
55
-        StackTraceElement element = ex.getStackTrace()[0];
56
-        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
57
-        return new ResultVo(1, "参数为空异常");
58
-    }
59
-
60
-    @ExceptionHandler(value = IllegalArgumentException.class)
61
-    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request, IllegalArgumentException ex) {
62
-        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
63
-        return new ResultVo(1, "请求参数错误");
64
-    }
65
-
66
-
67
-}

+ 7
- 25
slive/pom.xml View File

@@ -2,37 +2,19 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
5
+
11 6
     <groupId>com.xhkjedu</groupId>
12 7
     <artifactId>slive</artifactId>
13 8
     <version>0.0.1-SNAPSHOT</version>
14 9
     <name>slive</name>
15 10
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
20
-    <dependencies>
21
-        <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25
-
26
-        <dependency>
27
-            <groupId>org.springframework.cloud</groupId>
28
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
29
-        </dependency>
30 11
 
31
-        <dependency>
32
-            <groupId>org.springframework.boot</groupId>
33
-            <artifactId>spring-boot-starter-test</artifactId>
34
-            <scope>test</scope>
35
-        </dependency>
12
+    <parent>
13
+        <groupId>com.xhkjedu</groupId>
14
+        <artifactId>cloud-schoolapi</artifactId>
15
+        <version>1.0-SNAPSHOT</version>
16
+    </parent>
17
+    <dependencies>
36 18
         <dependency>
37 19
             <groupId>com.xhkjedu</groupId>
38 20
             <artifactId>scommons</artifactId>

+ 0
- 67
slive/src/main/java/com/xhkjedu/slive/config/ErrorAdivceController.java View File

@@ -1,67 +0,0 @@
1
-package com.xhkjedu.slive.config;
2
-import com.alibaba.fastjson.JSON;
3
-import com.xhkjedu.config.MissingParametersException;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.springframework.dao.DataIntegrityViolationException;
8
-import org.springframework.web.bind.annotation.ControllerAdvice;
9
-import org.springframework.web.bind.annotation.ExceptionHandler;
10
-import org.springframework.web.bind.annotation.ResponseBody;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-
14
-/**
15
- * @创建人 :zj
16
- * @创建时间 2019/11/7
17
- * @修改人和其它信息
18
- * @描述 :项目异常处理类:
19
- * 项目中所有controller层抛出的异常信息都会被拦截。
20
- * 方便我们查看异常原因,减少开发中大量的try catch。
21
- * 拦截异常后,打印异常信息,返回前端约定参数对象。
22
- */
23
-@Slf4j
24
-@ResponseBody
25
-@ControllerAdvice
26
-public class ErrorAdivceController {
27
-    @ExceptionHandler(MissingParametersException.class)
28
-    public ResultVo missingParametersException(MissingParametersException ex) {
29
-        log.error("参数异常:   -------> " + ex.getMessage());
30
-        return new ResultVo(1, ex.getMessage());
31
-    }
32
-
33
-    @ExceptionHandler(DataIntegrityViolationException.class)
34
-    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
35
-        log.error("数据库异常:   -------> " + ex.getMessage());
36
-        String msg = ex.getMessage();
37
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
38
-            return new ResultVo(1,"存在关联信息");
39
-        }
40
-        return new ResultVo(1,"数据库处理异常");
41
-    }
42
-
43
-    @ExceptionHandler(Exception.class)
44
-    public ResultVo exceptionHandler(Exception ex) {
45
-        log.error("程序运行异常:   -------> " + ex.getMessage());
46
-        String msg = ex.getMessage();
47
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
48
-            return new ResultVo(1,"json格式不对");
49
-        }
50
-        return new ResultVo(1, "程序处理异常");
51
-    }
52
-
53
-    @ExceptionHandler(NullPointerException.class)
54
-    public ResultVo nullPointerException(NullPointerException ex) {
55
-        StackTraceElement element = ex.getStackTrace()[0];
56
-        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
57
-        return new ResultVo(1, "参数为空异常");
58
-    }
59
-
60
-    @ExceptionHandler(value = IllegalArgumentException.class)
61
-    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request,IllegalArgumentException ex) {
62
-        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
63
-        return new ResultVo(1, "请求参数错误");
64
-    }
65
-
66
-
67
-}

+ 10
- 28
sstudy/pom.xml View File

@@ -2,29 +2,23 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>sstudy</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>sstudy</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
10
+
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
16
+
20 17
     <dependencies>
21 18
         <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25
-        <dependency>
26
-            <groupId>org.springframework.cloud</groupId>
27
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
19
+            <groupId>com.xhkjedu</groupId>
20
+            <artifactId>scommons</artifactId>
21
+            <version>0.0.1-SNAPSHOT</version>
28 22
         </dependency>
29 23
 
30 24
         <dependency>
@@ -33,18 +27,6 @@
33 27
             <version>3.8.1</version>
34 28
         </dependency>
35 29
 
36
-        <dependency>
37
-            <groupId>org.springframework.boot</groupId>
38
-            <artifactId>spring-boot-starter-test</artifactId>
39
-            <scope>test</scope>
40
-        </dependency>
41
-
42
-        <dependency>
43
-            <groupId>com.xhkjedu</groupId>
44
-            <artifactId>scommons</artifactId>
45
-            <version>0.0.1-SNAPSHOT</version>
46
-        </dependency>
47
-
48 30
         <!--amqp的起步依赖-->
49 31
         <dependency>
50 32
             <groupId>org.springframework.boot</groupId>

+ 0
- 68
sstudy/src/main/java/com/xhkjedu/sstudy/config/ErrorAdivceController.java View File

@@ -1,68 +0,0 @@
1
-package com.xhkjedu.sstudy.config;
2
-import com.alibaba.fastjson.JSON;
3
-import com.xhkjedu.config.MissingParametersException;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.springframework.dao.DataIntegrityViolationException;
8
-import org.springframework.web.bind.annotation.ControllerAdvice;
9
-import org.springframework.web.bind.annotation.ExceptionHandler;
10
-import org.springframework.web.bind.annotation.ResponseBody;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-
14
-
15
-/**
16
- * @创建人 :zj
17
- * @创建时间 2019/11/7
18
- * @修改人和其它信息
19
- * @描述 :项目异常处理类:
20
- * 项目中所有controller层抛出的异常信息都会被拦截。
21
- * 方便我们查看异常原因,减少开发中大量的try catch。
22
- * 拦截异常后,打印异常信息,返回前端约定参数对象。
23
- */
24
-@Slf4j
25
-@ResponseBody
26
-@ControllerAdvice
27
-public class ErrorAdivceController {
28
-    @ExceptionHandler(MissingParametersException.class)
29
-    public ResultVo missingParametersException(MissingParametersException ex) {
30
-        log.error("参数异常:   -------> " + ex.getMessage());
31
-        return new ResultVo(1, ex.getMessage());
32
-    }
33
-
34
-    @ExceptionHandler(DataIntegrityViolationException.class)
35
-    public ResultVo DataIntegrityViolationException(DataIntegrityViolationException ex){
36
-        log.error("数据库异常:   -------> " + ex.getMessage());
37
-        String msg = ex.getMessage();
38
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("SQLIntegrityConstraintViolationException") != -1){
39
-            return new ResultVo(1,"存在关联信息");
40
-        }
41
-        return new ResultVo(1,"数据库处理异常");
42
-    }
43
-
44
-    @ExceptionHandler(Exception.class)
45
-    public ResultVo exceptionHandler(Exception ex) {
46
-        log.error("程序运行异常:   -------> " + ex.getMessage());
47
-        String msg = ex.getMessage();
48
-        if (N_Utils.isNotEmpty(msg) && msg.indexOf("JSON parse error") != -1){
49
-            return new ResultVo(1,"json格式不对");
50
-        }
51
-        return new ResultVo(1, "程序处理异常");
52
-    }
53
-
54
-    @ExceptionHandler(NullPointerException.class)
55
-    public ResultVo nullPointerException(NullPointerException ex) {
56
-        StackTraceElement element = ex.getStackTrace()[0];
57
-        log.error("参数为空异常:   -------> " + JSON.toJSONString(element));
58
-        return new ResultVo(1, "参数为空异常");
59
-    }
60
-
61
-    @ExceptionHandler(value = IllegalArgumentException.class)
62
-    public ResultVo illegalArgumentExceptionHandler(HttpServletRequest request, IllegalArgumentException ex) {
63
-        log.error("请求参数错误 URL : {},Exception : {}", request.getRequestURL(),ex.getMessage());
64
-        return new ResultVo(1, "请求参数错误");
65
-    }
66
-
67
-
68
-}

+ 7
- 24
suser/pom.xml View File

@@ -2,36 +2,19 @@
2 2
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5
-    <parent>
6
-        <groupId>org.springframework.boot</groupId>
7
-        <artifactId>spring-boot-starter-parent</artifactId>
8
-        <version>2.6.3</version>
9
-        <relativePath/> <!-- lookup parent from repository -->
10
-    </parent>
11 5
     <groupId>com.xhkjedu</groupId>
12 6
     <artifactId>suser</artifactId>
13 7
     <version>0.0.1-SNAPSHOT</version>
14 8
     <name>suser</name>
15 9
     <description>Demo project for Spring Boot</description>
16
-    <properties>
17
-        <java.version>1.8</java.version>
18
-        <spring-cloud.version>2021.0.0</spring-cloud.version>
19
-    </properties>
20
-    <dependencies>
21
-        <dependency>
22
-            <groupId>org.springframework.boot</groupId>
23
-            <artifactId>spring-boot-starter-web</artifactId>
24
-        </dependency>
25 10
 
26
-        <dependency>
27
-            <groupId>org.springframework.cloud</groupId>
28
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
29
-        </dependency>
30
-        <dependency>
31
-            <groupId>org.springframework.boot</groupId>
32
-            <artifactId>spring-boot-starter-test</artifactId>
33
-            <scope>test</scope>
34
-        </dependency>
11
+    <parent>
12
+        <groupId>com.xhkjedu</groupId>
13
+        <artifactId>cloud-schoolapi</artifactId>
14
+        <version>1.0-SNAPSHOT</version>
15
+    </parent>
16
+
17
+    <dependencies>
35 18
         <dependency>
36 19
             <groupId>com.xhkjedu</groupId>
37 20
             <artifactId>scommons</artifactId>

Loading…
Cancel
Save