From e1f869f20951152ed4f5a3c66cda3928dc4ecdf1 Mon Sep 17 00:00:00 2001
From: SZH <szh_hello@163.com>
Date: 星期三, 22 六月 2022 19:43:57 +0800
Subject: [PATCH] 更新框架
---
.gitignore | 5
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/CorsConfig.java | 33 +
emergency/emergency-rpc-api/pom.xml | 76 +++
safePlatfrom-out-web/src/main/resources/config/application-prod.yaml | 53 ++
emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyDemoRpcProvider.java | 18
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAuthenticationEntryPoint.java | 26 +
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/impl/DemoServiceImpl.java | 22
emergency/emergency-service/pom.xml | 25 +
pom.xml | 197 ++++++++
emergency/emergency-rpc-provider/pom.xml | 23
safePlatfrom-out-web/pom.xml | 62 ++
goal-manage/goal-manage-rpc-provider/pom.xml | 17
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/controller/DemoController.java | 20
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAccessDeniedHandler.java | 24 +
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/DemoService.java | 6
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/JSONAuthentication.java | 26 +
emergency/pom.xml | 21
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MybatisAspectj.java | 27 +
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java | 155 ++++++
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/WebSecurityConfig.java | 91 +++
safePlatfrom-out-web/src/main/resources/config/application-dev.yaml | 53 ++
goal-manage/goal-manage-service/pom.xml | 19
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/Application.java | 13
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/Test.java | 26 +
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java | 40 +
goal-manage/goal-manage-rpc-api/pom.xml | 77 +++
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyDemoRpcAPi.java | 8
goal-manage/pom.xml | 28 +
safePlatfrom-out-web/src/main/resources/config/application.yaml | 14
safePlatfrom-out-web/src/main/resources/config/log/log4j2.xml | 87 +++
safePlatfrom-out-web/src/main/resources/config/application-test.yaml | 53 ++
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/User.java | 24 +
safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigOne.java | 60 ++
33 files changed, 1,429 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 32858aa..5967eda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,14 @@
.mtj.tmp/
# Package Files #
+*.iml
*.jar
*.war
*.ear
+*.log
+
+.idea
+target
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
diff --git a/emergency/emergency-rpc-api/pom.xml b/emergency/emergency-rpc-api/pom.xml
new file mode 100644
index 0000000..05936e9
--- /dev/null
+++ b/emergency/emergency-rpc-api/pom.xml
@@ -0,0 +1,76 @@
+<?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>emergency</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <artifactId>emergency-rpc-api</artifactId>
+
+ <distributionManagement>
+ <!--稳定版本的仓库地址,必须是允许上传的私服地址-->
+ <repository>
+ <id>nexus-gkhy-releases</id>
+ <url>http://121.239.169.27:28080/repository/guotai-release/</url>
+ </repository>
+ <!--开发版本的仓库地址,必须是允许上传的私服地址-->
+ <snapshotRepository>
+ <id>nexus-gkhy-snapshots</id>
+ <url>http://121.239.169.27:28080/repository/guotai-snapshot/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.3.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/java</source>
+ <!-- <source>build/generated/source/proto/main/java</source>-->
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- 上传源码 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyDemoRpcAPi.java b/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyDemoRpcAPi.java
new file mode 100644
index 0000000..901fa1f
--- /dev/null
+++ b/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyDemoRpcAPi.java
@@ -0,0 +1,8 @@
+package com.gkhy.safePlatform.emergency.rpc.api;
+
+import com.gkhy.safePlatform.emergency.rpc.api.model.User;
+
+public interface EmergencyDemoRpcAPi {
+
+ String sayHello(User user);
+}
diff --git a/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/User.java b/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/User.java
new file mode 100644
index 0000000..f3b289d
--- /dev/null
+++ b/emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/User.java
@@ -0,0 +1,24 @@
+package com.gkhy.safePlatform.emergency.rpc.api.model;
+
+public class User {
+
+ private String name;
+
+ private String email;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+}
diff --git a/emergency/emergency-rpc-provider/pom.xml b/emergency/emergency-rpc-provider/pom.xml
new file mode 100644
index 0000000..e481007
--- /dev/null
+++ b/emergency/emergency-rpc-provider/pom.xml
@@ -0,0 +1,23 @@
+<?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>emergency</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <artifactId>emergency-rpc-provider</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-rpc-api</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyDemoRpcProvider.java b/emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyDemoRpcProvider.java
new file mode 100644
index 0000000..744d278
--- /dev/null
+++ b/emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyDemoRpcProvider.java
@@ -0,0 +1,18 @@
+package com.gkhy.safePlatform.emergency.rpc.provider;
+
+
+import com.gkhy.safePlatform.emergency.rpc.api.EmergencyDemoRpcAPi;
+import com.gkhy.safePlatform.emergency.rpc.api.model.User;
+import org.apache.dubbo.config.annotation.DubboService;
+
+@DubboService
+public class EmergencyDemoRpcProvider implements EmergencyDemoRpcAPi {
+
+ @Override
+ public String sayHello(User user) {
+ if(user == null)
+ return "non";
+ String resp = "Name: "+user.getName()+" Email:"+user.getEmail()+" rpc call";
+ return resp;
+ }
+}
diff --git a/emergency/emergency-service/pom.xml b/emergency/emergency-service/pom.xml
new file mode 100644
index 0000000..7154fa8
--- /dev/null
+++ b/emergency/emergency-service/pom.xml
@@ -0,0 +1,25 @@
+<?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>emergency</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+
+ <artifactId>emergency-service</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-rpc-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/Test.java b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/Test.java
new file mode 100644
index 0000000..821dc7c
--- /dev/null
+++ b/emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/Test.java
@@ -0,0 +1,26 @@
+package com.gkhy.safePlatform.emergency.controller;
+
+import com.gkhy.safePlatform.account.rpc.apimodel.NameService;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/emgc")
+public class Test {
+
+ @DubboReference(check = false)
+ private NameService nameService;
+
+// private Logger logger = LogManager.getLogger(Test.class);
+
+
+ @RequestMapping(value = "/t/rpc",method = RequestMethod.GET)
+ public Object testRpc(String id){
+ String resp = nameService.sayName(id);
+ return resp;
+ }
+}
diff --git a/emergency/pom.xml b/emergency/pom.xml
new file mode 100644
index 0000000..908322e
--- /dev/null
+++ b/emergency/pom.xml
@@ -0,0 +1,21 @@
+<?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>safe-platform</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>emergency</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>emergency-service</module>
+ <module>emergency-rpc-api</module>
+ <module>emergency-rpc-provider</module>
+ </modules>
+
+
+</project>
\ No newline at end of file
diff --git a/goal-manage/goal-manage-rpc-api/pom.xml b/goal-manage/goal-manage-rpc-api/pom.xml
new file mode 100644
index 0000000..a7cb4cf
--- /dev/null
+++ b/goal-manage/goal-manage-rpc-api/pom.xml
@@ -0,0 +1,77 @@
+<?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>goal-manage</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+
+ <artifactId>goal-manage-rpc-api</artifactId>
+
+ <distributionManagement>
+ <!--稳定版本的仓库地址,必须是允许上传的私服地址-->
+ <repository>
+ <id>nexus-gkhy-releases</id>
+ <url>http://121.239.169.27:28080/repository/guotai-release/</url>
+ </repository>
+ <!--开发版本的仓库地址,必须是允许上传的私服地址-->
+ <snapshotRepository>
+ <id>nexus-gkhy-snapshots</id>
+ <url>http://121.239.169.27:28080/repository/guotai-snapshot/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>kr.motd.maven</groupId>
+ <artifactId>os-maven-plugin</artifactId>
+ </extension>
+ </extensions>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.3.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/java</source>
+ <!-- <source>build/generated/source/proto/main/java</source>-->
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- 上传源码 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/goal-manage/goal-manage-rpc-provider/pom.xml b/goal-manage/goal-manage-rpc-provider/pom.xml
new file mode 100644
index 0000000..fa17bd9
--- /dev/null
+++ b/goal-manage/goal-manage-rpc-provider/pom.xml
@@ -0,0 +1,17 @@
+<?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>goal-manage</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+
+ <artifactId>goal-manage-rpc-provider</artifactId>
+
+
+</project>
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/pom.xml b/goal-manage/goal-manage-service/pom.xml
new file mode 100644
index 0000000..0c3fcc0
--- /dev/null
+++ b/goal-manage/goal-manage-service/pom.xml
@@ -0,0 +1,19 @@
+<?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>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>goal-manage</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+
+ <artifactId>goal-manage-service</artifactId>
+
+
+
+
+</project>
\ No newline at end of file
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/controller/DemoController.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/controller/DemoController.java
new file mode 100644
index 0000000..b9ab4dc
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/controller/DemoController.java
@@ -0,0 +1,20 @@
+package com.gkhy.safePlatform.goalManage.controller;
+
+import com.gkhy.safePlatform.goalManage.service.DemoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/goal/demo")
+public class DemoController {
+
+ @Autowired
+ private DemoService demoService;
+
+ @RequestMapping(value = "/test/rpc",method = RequestMethod.GET)
+ public Object testRpc(String name,String email){
+ return demoService.getUserDescInfo(name,email);
+ }
+}
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/DemoService.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/DemoService.java
new file mode 100644
index 0000000..02c1f5d
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/DemoService.java
@@ -0,0 +1,6 @@
+package com.gkhy.safePlatform.goalManage.service;
+
+public interface DemoService {
+
+ String getUserDescInfo(String name,String email);
+}
diff --git a/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/impl/DemoServiceImpl.java b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/impl/DemoServiceImpl.java
new file mode 100644
index 0000000..ab7644e
--- /dev/null
+++ b/goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/goalManage/service/impl/DemoServiceImpl.java
@@ -0,0 +1,22 @@
+package com.gkhy.safePlatform.goalManage.service.impl;
+
+import com.gkhy.safePlatform.emergency.rpc.api.EmergencyDemoRpcAPi;
+import com.gkhy.safePlatform.emergency.rpc.api.model.User;
+import com.gkhy.safePlatform.goalManage.service.DemoService;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DemoServiceImpl implements DemoService {
+
+ @DubboReference(check = false)
+ private EmergencyDemoRpcAPi emergencyDemoRpcProvider;
+
+ @Override
+ public String getUserDescInfo(String name, String email) {
+ User user = new User();
+ user.setName(name);
+ user.setEmail(email);
+ return emergencyDemoRpcProvider.sayHello(user);
+ }
+}
diff --git a/goal-manage/pom.xml b/goal-manage/pom.xml
new file mode 100644
index 0000000..cbd44f7
--- /dev/null
+++ b/goal-manage/pom.xml
@@ -0,0 +1,28 @@
+<?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>safe-platform</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>goal-manage</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>goal-manage-service</module>
+ <module>goal-manage-rpc-api</module>
+ <module>goal-manage-rpc-provider</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-rpc-api</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..2476c05
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,197 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>safe-platform</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <modules>
+ <module>goal-manage/goal-manage-service</module>
+ <module>goal-manage/goal-manage-rpc-provider</module>
+ <module>emergency/emergency-service</module>
+ <module>emergency/emergency-rpc-provider</module>
+ <module>safePlatfrom-out-web</module>
+ </modules>
+
+ <properties>
+ <project.build.sourceencoding>UTF-8</project.build.sourceencoding>
+ <project.reporting.outputencoding>UTF-8</project.reporting.outputencoding>
+ <java.version>1.8</java.version>
+ <dubbo.version>3.0.8</dubbo.version>
+ <nacos.client.version>2.1.0</nacos.client.version>
+ <minio.version>8.4.2</minio.version>
+ <okhttp.version>4.10.0</okhttp.version>
+ <fastjson.version>1.2.47</fastjson.version>
+ <mysql.connector.version>8.0.29</mysql.connector.version>
+ <mybatisPlusStarter.version>3.5.1</mybatisPlusStarter.version>
+ <guava.version>31.1-jre</guava.version>
+ <account.rpc.model.version>1.0-SNAPSHOT</account.rpc.model.version>
+ </properties>
+
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>2.6.7</version>
+ </parent>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ <version>${nacos.client.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ <version>${dubbo.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.minio</groupId>
+ <artifactId>minio</artifactId>
+ <version>${minio.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp.version}</version>
+ </dependency>
+
+ <!-- 安全平台组件 -->
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>account-rpc-api</artifactId>
+ <version>${account.rpc.model.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-rpc-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ </exclusion>
+ <!-- <exclusion>-->
+ <!-- <groupId>org.springframework.boot</groupId>-->
+ <!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
+ <!-- </exclusion>-->
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>fastjson</artifactId>
+ <version>${fastjson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.baomidou</groupId>
+ <artifactId>mybatis-plus-boot-starter</artifactId>
+ <version>${mybatisPlusStarter.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.9.9.1</version>
+ <!-- <scope>runtime</scope>-->
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba</groupId>
+ <artifactId>druid-spring-boot-starter</artifactId>
+ <version>1.2.9</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.nacos</groupId>
+ <artifactId>nacos-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-kryo</artifactId>
+ <version>2.7.15</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-registry-nacos</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.minio</groupId>
+ <artifactId>minio</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ </dependency>
+
+ <!-- 安全平台业务组件 -->
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>account-rpc-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.10.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/safePlatfrom-out-web/pom.xml b/safePlatfrom-out-web/pom.xml
new file mode 100644
index 0000000..5ff1ebe
--- /dev/null
+++ b/safePlatfrom-out-web/pom.xml
@@ -0,0 +1,62 @@
+<?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>safe-platform</artifactId>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>safePlatfrom-out-web</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>commons</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-rpc-provider</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>emergency-service</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.gkhy.safePlatfrom</groupId>
+ <artifactId>goal-manage-service</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>com.gkhy.safePlatform.Application</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/Application.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/Application.java
new file mode 100644
index 0000000..04148da
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/Application.java
@@ -0,0 +1,13 @@
+package com.gkhy.safePlatform;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class Application {
+ public static void main(String[] agrs){
+ SpringApplication.run(Application.class,agrs);
+ }
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java
new file mode 100644
index 0000000..7fce4a5
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/DataSourceConfig.java
@@ -0,0 +1,40 @@
+package com.gkhy.safePlatform.config.database;
+
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.sql.DataSource;
+
+@Configuration
+public class DataSourceConfig {
+
+ @Bean
+ @ConfigurationProperties("spring.datasource.one")
+ DataSource dsOne(){
+ return DruidDataSourceBuilder.create().build();
+ }
+
+// @Bean
+// @ConfigurationProperties("spring.datasource.two")
+// DataSource dsTwo(){
+// return DruidDataSourceBuilder.create().build();
+// }
+
+
+ /**
+ * 新版分页插件
+ * @return
+ */
+ @Bean
+ public MybatisPlusInterceptor mybatisPlusInterceptor(){
+ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+ interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
+ return interceptor;
+ }
+
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigOne.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigOne.java
new file mode 100644
index 0000000..df4e0b5
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigOne.java
@@ -0,0 +1,60 @@
+package com.gkhy.safePlatform.config.database;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
+import org.apache.ibatis.plugin.Interceptor;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionTemplate;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.stereotype.Repository;
+
+import javax.sql.DataSource;
+
+@Configuration
+@MapperScan(basePackages = "com.gkhy.safePlatform",sqlSessionTemplateRef = "sqlTemplate1",annotationClass =
+ Repository.class)
+public class MyBatisConfigOne {
+
+ @Autowired
+ @Qualifier("dsOne")
+ DataSource dsOne;
+
+ @Autowired
+ private MybatisPlusInterceptor mybatisPlusInterceptor;
+
+ @Bean(name = "datasource1")
+ @ConfigurationProperties(prefix = "spring.datasource.one")
+ public DruidDataSource druidDataSourceA(){
+ return DruidDataSourceBuilder.create().build();
+ }
+
+ @Bean(name = "sqlFactory1")
+ public SqlSessionFactory sqlSessionFactory(@Qualifier("datasource1") DruidDataSource dataSource)
+ throws Exception
+ {
+ MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
+ factoryBean.setDataSource(dataSource);
+ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+ factoryBean.setMapperLocations(resolver.getResources("classpath*:config/mapper/**/**Mapper.xml"));
+ //设置分页插件
+ Interceptor[] plugins = {mybatisPlusInterceptor};
+ factoryBean.setPlugins(plugins);
+ return factoryBean.getObject();
+ }
+
+ @Bean(name = "sqlTemplate1")
+ public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sqlFactory1") SqlSessionFactory sqlSessionFactory)
+ {
+ return new SqlSessionTemplate(sqlSessionFactory);
+ }
+
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MybatisAspectj.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MybatisAspectj.java
new file mode 100644
index 0000000..e187c67
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MybatisAspectj.java
@@ -0,0 +1,27 @@
+package com.gkhy.safePlatform.config.database;
+
+import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Component
+public class MybatisAspectj {
+ // 配置织入点
+ @Pointcut("execution(public * com.baomidou.mybatisplus.core.mapper.BaseMapper.selectOne(..))")
+ public void selectOneAspect() {
+ }
+
+ @Before("selectOneAspect()")
+ public void beforeSelect(JoinPoint point) {
+ Object arg = point.getArgs()[0];
+ if (arg instanceof AbstractWrapper) {
+ arg = (AbstractWrapper) arg;
+ ((AbstractWrapper) arg).last("limit 1");
+ }
+ }
+
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/CorsConfig.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/CorsConfig.java
new file mode 100644
index 0000000..af07df6
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/CorsConfig.java
@@ -0,0 +1,33 @@
+package com.gkhy.safePlatform.config.security;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+@Configuration
+public class CorsConfig {
+ private CorsConfiguration buildConfig() {
+ CorsConfiguration corsConfiguration = new CorsConfiguration();
+ // 你需要跨域的地址 注意这里的 127.0.0.1 != localhost
+ // * 表示对所有的地址都可以访问
+ corsConfiguration.addAllowedOriginPattern("*"); // 1
+ // 跨域的请求方法
+ corsConfiguration.addAllowedMethod("*"); // 3
+ // 跨域的请求头
+ corsConfiguration.addAllowedHeader("*"); // 2
+ //加上了这一句,大致意思是可以携带 cookie
+ //最终的结果是可以 在跨域请求的时候获取同一个 session
+ corsConfiguration.setAllowCredentials(true);
+ return corsConfiguration;
+ }
+ @Bean
+ public CorsFilter corsFilter() {
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ //配置 可以访问的地址
+ source.registerCorsConfiguration("/**", buildConfig());
+ return new CorsFilter(source);
+ }
+
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
new file mode 100644
index 0000000..c9bd858
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/TokenAuthenticationFilter.java
@@ -0,0 +1,155 @@
+//package com.gkhy.safePlatform.config.security;
+//
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.gkhy.safePlatform.account.model.cache.CacheUser;
+//import com.gkhy.safePlatform.account.rpc.apimodel.NameService;
+//import com.gkhy.safePlatform.commons.config.token.TokenConfig;
+//import com.gkhy.safePlatform.commons.enums.RedisKeyEnum;
+//import com.gkhy.safePlatform.commons.enums.ResultCodes;
+//import com.gkhy.safePlatform.commons.exception.BusinessException;
+//import com.gkhy.safePlatform.commons.utils.RedisUtils;
+//import com.gkhy.safePlatform.commons.utils.StringUtils;
+//import com.gkhy.safePlatform.commons.vo.ResultVO;
+//import org.apache.dubbo.config.annotation.DubboReference;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+//import org.springframework.security.core.GrantedAuthority;
+//import org.springframework.security.core.authority.SimpleGrantedAuthority;
+//import org.springframework.security.core.context.SecurityContextHolder;
+//import org.springframework.stereotype.Component;
+//import org.springframework.web.filter.OncePerRequestFilter;
+//
+//import javax.servlet.FilterChain;
+//import javax.servlet.ServletException;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.io.IOException;
+//import java.io.PrintWriter;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+//* @Description: token登录过滤器
+//*/
+//@Component
+//public class TokenAuthenticationFilter extends OncePerRequestFilter {
+//
+// @Autowired
+// private TokenConfig tokenConfig;
+// @Autowired
+// private RedisUtils redisUtil;
+// @DubboReference(check = false)
+// private NameService nameService;
+//
+//
+//
+// @Override
+// protected void doFilterInternal(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException {
+//
+// try {
+// //获取当前认证成功用户权限信息
+// UsernamePasswordAuthenticationToken authRequest = getAuthentication(req, resp);
+// if (authRequest != null) {
+// SecurityContextHolder.getContext().setAuthentication(authRequest);
+// }
+// // 执行下一个 filter 过滤器链
+// chain.doFilter(req, resp);
+// } catch (BusinessException e) {
+// // 返回异常
+// this.writeJSON(req, resp, new ResultVO<>(e.getError()));
+// } catch (Exception e) {
+// e.printStackTrace();
+// this.writeJSON(req, resp, new ResultVO<>(ResultCodes.SERVER_ERROR));
+// }
+//
+//
+// }
+//
+//
+// private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest req,HttpServletResponse resp) {
+// // header获取token
+// String authToken = req.getHeader(tokenConfig.getHeader());
+// String loginUserId = req.getHeader(tokenConfig.getLoginUserHeader());
+//
+// if(authToken != null) {
+// // header 传入 userId
+// if (StringUtils.isBlank(loginUserId)) {
+// throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_LACK);
+// }
+// // 登录成功时,会将权限数据存入redis
+// // 这里是验证获取权限信息
+// // 1.从redis中获取对应该用户的权限信息
+// String accessTokenKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_TOKEN, loginUserId);
+// Object o = redisUtil.get(accessTokenKey);
+// // 2.token是否存在
+// if (o == null) {
+// // 是否存在
+// throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_SIGN_INVALID);
+// }else{
+// Long userId = Long.valueOf(loginUserId);
+// CacheUser cacheUser = JSONObject.parseObject(o.toString(), CacheUser.class);
+// assert userId.equals(cacheUser.getUserId());
+// if ( !authToken.equals(cacheUser.getAccessToken())) {
+// throw new BusinessException(ResultCodes.CLIENT_CREDENTIALS_TOKEN_INVALID);
+// }
+//
+// // 3.redis获取权限
+// String authoritiesKey = RedisKeyEnum.authKey(RedisKeyEnum.AUTH_AUTHORITIES, userId);
+// Object oo = redisUtil.get(authoritiesKey);
+// List<GrantedAuthority> authorities;
+// // 4.redis中是否存在
+// if (oo != null) {
+// // 5.存在
+// String json = oo.toString();
+// authorities = JSONArray.parseArray(json, GrantedAuthority.class);
+// }else {
+// authorities = new ArrayList<>();
+// // 6.不存在=>数据库查询
+// List<String> roleCodes = nameService.getUserRoleCodeByUserId(userId);
+// // role
+// for (String roleCode : roleCodes) {
+// SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority("ROLE_" + roleCode);
+// authorities.add(simpleGrantedAuthority);
+// }
+//
+// // permission
+// List<String> permissions = nameService.getUserPermissionByUserId(userId);
+// for (String permission : permissions) {
+// SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(permission);
+// authorities.add(simpleGrantedAuthority);
+// }
+// }
+//
+// // security对象中存入登陆者信息
+// return new UsernamePasswordAuthenticationToken(userId,authToken,authorities);
+//
+// }
+//
+//
+//
+//
+//
+//
+// }
+// return null;
+// }
+//
+//
+//
+// protected void writeJSON(HttpServletRequest req,
+// HttpServletResponse resp,
+// ResultVO resultVO) throws IOException {
+// // 设置编码格式
+// resp.setContentType("text/json;charset=utf-8");
+// // 处理跨域问题
+// resp.setHeader("Access-Control-Allow-Origin", "*");
+// resp.setHeader("Access-Control-Allow-Methods", "POST, GET");
+//
+// //输出JSON
+// PrintWriter out = resp.getWriter();
+// out.write(JSONObject.toJSONString(resultVO));
+// out.flush();
+// out.close();
+// }
+//}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/WebSecurityConfig.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/WebSecurityConfig.java
new file mode 100644
index 0000000..d152a68
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/WebSecurityConfig.java
@@ -0,0 +1,91 @@
+package com.gkhy.safePlatform.config.security;
+
+import com.gkhy.safePlatform.account.rpc.apimodel.NameService;
+import com.gkhy.safePlatform.config.security.customzie.CustomizeAccessDeniedHandler;
+import com.gkhy.safePlatform.config.security.customzie.CustomizeAuthenticationEntryPoint;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+import javax.annotation.Resource;
+
+@Configuration
+@EnableWebSecurity
+@EnableGlobalMethodSecurity(securedEnabled = true,prePostEnabled = true)
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Resource
+ private CustomizeAccessDeniedHandler accessDeniedHandler;
+
+ @Resource
+ private CustomizeAuthenticationEntryPoint authenticationEntryPoint;
+
+// @Resource
+// private TokenAuthenticationFilter tokenAuthenticationFilter;
+
+ @DubboReference(check = false)
+ private NameService nameService;
+
+
+
+
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+
+ // 关闭跨域攻击
+ http.csrf().disable();
+ // 关闭session
+ http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
+ // 登录json放行
+ http.authorizeRequests().anyRequest().permitAll();
+ // 关闭
+ http.headers().cacheControl();
+ // jwt过滤器
+// http.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
+ // 没有登录,没有权限 => 自定义返回
+ http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint).accessDeniedHandler(accessDeniedHandler);
+ // 请求认证访问
+// http.authorizeRequests().anyRequest().authenticated();
+ // 允许跨域访问
+ http.cors();
+
+ }
+
+
+
+
+
+ /**
+ * @Description: 自定义查询逻辑 & 密码处理器
+ */
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService());
+ }
+
+ /**
+ * @Description: 自定义查询逻辑
+ */
+ @Bean
+ @Qualifier("myUserDetailService")
+ protected UserDetailsService userDetailsService(){
+ return username -> nameService.getUserDetailsByUsername(username);
+ }
+
+
+ @Override
+ public void configure(WebSecurity web) {
+ web.ignoring().mvcMatchers();
+ }
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAccessDeniedHandler.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAccessDeniedHandler.java
new file mode 100644
index 0000000..402495c
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAccessDeniedHandler.java
@@ -0,0 +1,24 @@
+package com.gkhy.safePlatform.config.security.customzie;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gkhy.safePlatform.commons.enums.ResultCodes;
+import com.gkhy.safePlatform.commons.vo.ResultVO;
+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;
+import java.io.IOException;
+
+/**
+ * 用来解决认证过的用户访问无权限资源时的异常
+ */
+@Component
+public class CustomizeAccessDeniedHandler extends JSONAuthentication implements AccessDeniedHandler {
+ @Override
+ public void handle(HttpServletRequest req, HttpServletResponse resp, AccessDeniedException e) throws IOException {
+ ResultVO result = new ResultVO<>(ResultCodes.CLIENT_PERMISSION_NOT_ALLOW);
+ this.writeJSON(req,resp,JSONObject.toJSONString(result));
+ }
+}
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAuthenticationEntryPoint.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAuthenticationEntryPoint.java
new file mode 100644
index 0000000..18f7ce2
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/CustomizeAuthenticationEntryPoint.java
@@ -0,0 +1,26 @@
+package com.gkhy.safePlatform.config.security.customzie;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gkhy.safePlatform.commons.enums.ResultCodes;
+import com.gkhy.safePlatform.commons.vo.ResultVO;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 用来解决匿名用户访问无权限资源时的异常
+ */
+@Component
+public class CustomizeAuthenticationEntryPoint extends JSONAuthentication implements AuthenticationEntryPoint {
+ @Override
+ public void commence(HttpServletRequest req, HttpServletResponse resp, AuthenticationException e) throws IOException, ServletException {
+ ResultVO result = new ResultVO<>(ResultCodes.CLIENT_PERMISSION_NOT_ALLOW);
+ this.writeJSON(req,resp,JSONObject.toJSONString(result));
+ }
+}
+
diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/JSONAuthentication.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/JSONAuthentication.java
new file mode 100644
index 0000000..9350934
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/security/customzie/JSONAuthentication.java
@@ -0,0 +1,26 @@
+package com.gkhy.safePlatform.config.security.customzie;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+public abstract class JSONAuthentication {
+
+ protected void writeJSON(HttpServletRequest req,
+ HttpServletResponse resp,
+ String content) throws IOException {
+ // 设置编码格式
+ resp.setContentType("text/json;charset=utf-8");
+ // 处理跨域问题
+ resp.setHeader("Access-Control-Allow-Origin", "*");
+ resp.setHeader("Access-Control-Allow-Methods", "POST, GET");
+
+ //输出JSON
+ PrintWriter out = resp.getWriter();
+ out.write(content);
+ out.flush();
+ out.close();
+ }
+
+}
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml b/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
new file mode 100644
index 0000000..643f67d
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/resources/config/application-dev.yaml
@@ -0,0 +1,53 @@
+server:
+ tomcat:
+ uri-encoding: UTF-8
+ basedir: /
+ port: 8009
+ servlet:
+ context-path: /
+
+# mysql
+spring:
+ datasource:
+ one:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://twt.sinanoaq.com:13306/zhongtai.demo?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+ username: root
+ password: Sinanoaq#415
+ type: com.alibaba.druid.pool.DruidDataSource
+
+
+mybatis-plus:
+ configuration:
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+dubbo:
+ registry:
+ protocol: nacos
+ address: nacos://192.168.0.62:18848?namespace=e07a2454-136b-4498-99eb-09dae3336ebe&username=gkhy_safeplatform_out&password=9485uyJHISes09t
+ application:
+ name: gkhy-safeplatform-account-provider
+ scan:
+ # 扫描rpc接口定义包
+ base-packages: com.gkhy.safePlatform
+ protocol:
+ name: dubbo
+ port: 18082
+ serialization: kryo
+ consumer:
+ # 服务连接超时时间
+ timeout: 3000
+ # 取消服务启动检查
+ check: false
+
+minio:
+ endPoint: 192.168.0.62
+ port: 9001
+ accessKey: kH6eiQtNrWqGNb1r
+ secretKey: ff5ykVUJJn0hi5PghsitdGNSsrW0Xrju
+ secure: false
+ bucketName: szh-stu
+ urlPrefix: http://192.168.0.62/file
+
+
+
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-prod.yaml b/safePlatfrom-out-web/src/main/resources/config/application-prod.yaml
new file mode 100644
index 0000000..1fc34f4
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/resources/config/application-prod.yaml
@@ -0,0 +1,53 @@
+server:
+ tomcat:
+ uri-encoding: UTF-8
+ basedir: /
+ port: 8009
+ servlet:
+ context-path: /
+
+# mysql
+spring:
+ datasource:
+ one:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://twt.sinanoaq.com:13306/zhongtai.demo?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+ username: root
+ password: Sinanoaq#415
+ type: com.alibaba.druid.pool.DruidDataSource
+
+
+mybatis-plus:
+ configuration:
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+dubbo:
+ registry:
+ protocol: nacos
+ address: nacos://192.168.0.62:18848?namespace=71701971-5257-48d9-b745-a4218022b397&username=gkhy_safeplatform_out&password=9485uyJHISes09t
+ application:
+ name: gkhy-safeplatform-account-provider
+ scan:
+ # 扫描rpc接口定义包
+ base-packages: com.gkhy.safePlatform
+ protocol:
+ name: dubbo
+ port: 18080
+ serialization: kryo
+ consumer:
+ # 服务连接超时时间
+ timeout: 3000
+ # 取消服务启动检查
+ check: false
+
+minio:
+ endPoint: 192.168.0.62
+ port: 9001
+ accessKey: kH6eiQtNrWqGNb1r
+ secretKey: ff5ykVUJJn0hi5PghsitdGNSsrW0Xrju
+ secure: false
+ bucketName: szh-stu
+ urlPrefix: http://192.168.0.62/file
+
+
+
diff --git a/safePlatfrom-out-web/src/main/resources/config/application-test.yaml b/safePlatfrom-out-web/src/main/resources/config/application-test.yaml
new file mode 100644
index 0000000..780cb2d
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/resources/config/application-test.yaml
@@ -0,0 +1,53 @@
+server:
+ tomcat:
+ uri-encoding: UTF-8
+ basedir: /
+ port: 8009
+ servlet:
+ context-path: /
+
+# mysql
+spring:
+ datasource:
+ one:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ url: jdbc:mysql://twt.sinanoaq.com:13306/zhongtai.demo?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+ username: root
+ password: Sinanoaq#415
+ type: com.alibaba.druid.pool.DruidDataSource
+
+
+mybatis-plus:
+ configuration:
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+dubbo:
+ registry:
+ protocol: nacos
+ address: nacos://192.168.0.62:18848?namespace=e07a2454-136b-4498-99eb-09dae3336ebe&username=gkhy_safeplatform_out&password=9485uyJHISes09t
+ application:
+ name: gkhy-safeplatform-account-provider
+ scan:
+ # 扫描rpc接口定义包
+ base-packages: com.gkhy.safePlatform
+ protocol:
+ name: dubbo
+ port: 18080
+ serialization: kryo
+ consumer:
+ # 服务连接超时时间
+ timeout: 3000
+ # 取消服务启动检查
+ check: false
+
+minio:
+ endPoint: 192.168.0.62
+ port: 9001
+ accessKey: kH6eiQtNrWqGNb1r
+ secretKey: ff5ykVUJJn0hi5PghsitdGNSsrW0Xrju
+ secure: false
+ bucketName: szh-stu
+ urlPrefix: http://192.168.0.62/file
+
+
+
diff --git a/safePlatfrom-out-web/src/main/resources/config/application.yaml b/safePlatfrom-out-web/src/main/resources/config/application.yaml
new file mode 100644
index 0000000..f005f0b
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/resources/config/application.yaml
@@ -0,0 +1,14 @@
+spring:
+ application:
+ name: gkhy-safeplatform-out
+ profiles:
+# active: prod
+ active: dev
+
+mybatis-plus:
+ mapper-locations: classpath:config/mapper/**/*.xml
+
+logging:
+ config: classpath:config/log/log4j2.xml
+ level:
+ com.gkhy: info
\ No newline at end of file
diff --git a/safePlatfrom-out-web/src/main/resources/config/log/log4j2.xml b/safePlatfrom-out-web/src/main/resources/config/log/log4j2.xml
new file mode 100644
index 0000000..f04ba8e
--- /dev/null
+++ b/safePlatfrom-out-web/src/main/resources/config/log/log4j2.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--status:log4j包内部日志等级 600s刷新一次配置 -->
+<Configuration status="OFF" monitorInterval="600">
+ <!-- 参数声明 -->
+ <Properties>
+ <!-- 日志文件存放根路径 -->
+ <property name="DEFAULT_LOG_ROOT_PATH" value="./logs"/>
+ <!-- 日志格式 -->
+ <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} - %highlight{%-5level}{ERROR=Bright RED, WARN=Bright Yellow, INFO=Bright Green, DEBUG=Bright Cyan, TRACE=Bright White} %logger{36}.%M - %msg%n"/>
+ <!-- 日志文件最大文件大小全局配置,单位可以为KB、MB或GB,一天之内最大文件产生数量全局配置 -->
+ <property name="MAX_FILE_SIZE" value="100MB"/>
+ <property name="MAX_FILE_NUM" value="30"/>
+
+ <!-- debug 日志文件位置及名称,在rollFile的时候老文件的生成规则 -->
+ <property name="DEBUG_FILE_PATH_ING" value="${DEFAULT_LOG_ROOT_PATH}/current/debug.log"/>
+ <!-- filePattern="${LOG_HOME}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log.gz"> 备份时使用gz格式压缩-->
+ <property name="DEBUG_FILE_PATH_ED" value="${DEFAULT_LOG_ROOT_PATH}/history/$${date:yyyy-MM-dd}/debug-%d{yyyy-MM-dd}.%i.log"/>
+
+ <!-- info 日志文件位置及名称,在rollFile的时候老文件的生成规则 -->
+ <property name="INFO_FILE_PATH_ING" value="${DEFAULT_LOG_ROOT_PATH}/current/info.log"/>
+ <property name="INFO_FILE_PATH_ED" value="${DEFAULT_LOG_ROOT_PATH}/history/$${date:yyyy-MM-dd}/info-%d{yyyy-MM-dd}.%i.log"/>
+
+ <!-- error 日志文件位置及名称,在rollFile的时候老文件的生成规则 -->
+ <property name="ERROR_FILE_PATH_ING" value="${DEFAULT_LOG_ROOT_PATH}/current/error.log"/>
+ <property name="ERROR_FILE_PATH_ED" value="${DEFAULT_LOG_ROOT_PATH}/history/$${date:yyyy-MM-dd}/error-%d{yyyy-MM-dd}.%i.log"/>
+
+ <!-- warn 日志文件位置及名称,在rollFile的时候老文件的生成规则 -->
+ <property name="WARN_FILE_PATH_ING" value="${DEFAULT_LOG_ROOT_PATH}/current/warn_error.log"/>
+ <property name="WARN_FILE_PATH_ED" value="${DEFAULT_LOG_ROOT_PATH}/history/$${date:yyyy-MM-dd}/warn_error-%d{yyyy-MM-dd}.%i.log"/>
+ </Properties>
+
+ <appenders>
+ <!-- 控制台输出日志信息 -->
+ <console name="Console_Log" target="SYSTEM_OUT">
+ <PatternLayout pattern="${LOG_PATTERN}"/>
+ </console>
+ <!-- debug日志文件输出日志信息 -->
+ <RollingFile name="Debug_File" fileName="${DEBUG_FILE_PATH_ING}" filePattern="${DEBUG_FILE_PATH_ED}">
+ <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
+ <PatternLayout pattern="${LOG_PATTERN}"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="${MAX_FILE_SIZE}"/>
+ <TimeBasedTriggeringPolicy/>
+ </Policies>
+ <DefaultRolloverStrategy max="${MAX_FILE_NUM}"/>
+ </RollingFile>
+ <!-- info日志文件输出日志信息 -->
+ <RollingFile name="Info_File" fileName="${INFO_FILE_PATH_ING}" filePattern="${INFO_FILE_PATH_ED}">
+ <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
+ <PatternLayout pattern="${LOG_PATTERN}"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="${MAX_FILE_SIZE}"/>
+ <TimeBasedTriggeringPolicy/>
+ </Policies>
+ <DefaultRolloverStrategy max="${MAX_FILE_NUM}"/>
+ </RollingFile>
+ <!-- warn日志文件输出日志信息 -->
+ <RollingFile name="Warn_File" fileName="${ERROR_FILE_PATH_ING}" filePattern="${ERROR_FILE_PATH_ED}">
+ <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
+ <PatternLayout pattern="${LOG_PATTERN}"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="${MAX_FILE_SIZE}"/>
+ <TimeBasedTriggeringPolicy/>
+ </Policies>
+ <DefaultRolloverStrategy max="${MAX_FILE_NUM}"/>
+ </RollingFile>
+ <!-- error日志文件输出日志信息 -->
+ <RollingFile name="Error_File" fileName="${ERROR_FILE_PATH_ING}" filePattern="${ERROR_FILE_PATH_ED}">
+ <ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/>
+ <PatternLayout pattern="${LOG_PATTERN}"/>
+ <Policies>
+ <SizeBasedTriggeringPolicy size="${MAX_FILE_SIZE}"/>
+ <TimeBasedTriggeringPolicy/>
+ </Policies>
+ <DefaultRolloverStrategy max="${MAX_FILE_NUM}"/>
+ </RollingFile>
+ </appenders>
+ <!--配置总的日志监听级别-->
+ <loggers>
+ <root level="INFO">
+ <appender-ref ref="Console_Log"/>
+ <appender-ref ref="Debug_File"/>
+ <appender-ref ref="Info_File"/>
+ <appender-ref ref="Error_File"/>
+ </root>
+ </loggers>
+</Configuration>
\ No newline at end of file
--
Gitblit v1.9.2