Bladeren bron

工程代码优化

zhanghaijun 2 jaren geleden
bovenliggende
commit
64cc8bb7c6

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+**/.flattened-pom.xml
 target/
 !.mvn/wrapper/maven-wrapper.jar
 !**/src/main/**/target/

+ 4 - 0
.vscode/settings.json

@@ -0,0 +1,4 @@
+{
+  "java.compile.nullAnalysis.mode": "disabled",
+  "java.configuration.updateBuildConfiguration": "disabled"
+}

+ 0 - 36
README.en.md

@@ -1,36 +0,0 @@
-# Mul-Agent Virtual Simulation System
-
-#### Description
-车站多智能体虚拟仿真系统
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Instructions
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Contribution
-
-1.  Fork the repository
-2.  Create Feat_xxx branch
-3.  Commit your code
-4.  Create Pull Request
-
-
-#### Gitee Feature
-
-1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4.  The most valuable open source project [GVP](https://gitee.com/gvp)
-5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 2 - 30
README.md

@@ -1,35 +1,7 @@
 ## 介绍
+
 车站多智能体虚拟仿真系统
 
 ## 软件架构
-软件架构说明
-
-
-## 安装教程
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-## 使用说明
 
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-## 参与贡献
-
-1.  Fork 本仓库
-2.  新建 Feat_xxx 分支
-3.  提交代码
-4.  新建 Pull Request
-
-
-## 特技
-
-1.  使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
+软件架构说明

+ 209 - 0
pom-demo.xml

@@ -0,0 +1,209 @@
+<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.example</groupId>
+    <artifactId>mul-agent-virtual-simulation-system</artifactId>
+    <version>${revision}</version>
+    <packaging>pom</packaging>
+    <name>${project.artifactId}</name>
+    <description>多智体服务</description>
+
+    <properties>
+        <revision>1.0.1</revision>
+        <java.version>17</java.version>
+        <maven.compiler.source>${java.version}</maven.compiler.source>
+        <maven.compiler.target>${java.version}</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <maven.test.skip>true</maven.test.skip>
+        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
+        <!-- 依赖 -->
+        <hutool.version>5.8.16</hutool.version>
+        <spring-boot.version>3.1.5</spring-boot.version>
+        <lombok.version>1.18.30</lombok.version>
+        <mybatis-plus.version>3.5.3.2</mybatis-plus.version>
+        <!-- 插件版本 -->
+        <mapstruct-plus.version>1.3.5</mapstruct-plus.version>
+        <mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
+        <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
+        <maven-war-plugin.version>3.2.2</maven-war-plugin.version>
+        <therapi-javadoc.version>0.15.0</therapi-javadoc.version>
+        <maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison>
+        <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
+        <flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
+    </properties>
+
+    <modules>
+        <module>server</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-core</artifactId>
+            <version>${hutool.version}</version>
+        </dependency>
+    </dependencies>
+
+    <!-- 依赖声明 -->
+    <dependencyManagement>
+        <dependencies>
+            <!-- SpringBoot的依赖配置-->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <!-- hutool 的依赖配置-->
+            <dependency>
+                <groupId>cn.hutool</groupId>
+                <artifactId>hutool-bom</artifactId>
+                <version>${hutool.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>${lombok.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <profiles>
+        <!-- 本地开发环境 -->
+        <profile>
+            <id>local</id>
+            <properties>
+                <profiles.active>local</profiles.active>
+                <logging.level>debug</logging.level>
+            </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+        </profile>
+        <!-- 生产环境 -->
+        <profile>
+            <id>prod</id>
+            <properties>
+                <profiles.active>prod</profiles.active>
+                <logging.level>info</logging.level>
+            </properties>
+        </profile>
+    </profiles>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${maven-compiler-plugin.verison}</version>
+                <configuration>
+                    <source>${java.version}</source>
+                    <target>${java.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>com.github.therapi</groupId>
+                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
+                            <version>${therapi-javadoc.version}</version>
+                        </path>
+                        <path>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                            <version>${lombok.version}</version>
+                        </path>
+                        <path>
+                            <groupId>org.springframework.boot</groupId>
+                            <artifactId>spring-boot-configuration-processor</artifactId>
+                            <version>${spring-boot.version}</version>
+                        </path>
+                        <path>
+                            <groupId>io.github.linpeilie</groupId>
+                            <artifactId>mapstruct-plus-processor</artifactId>
+                            <version>${mapstruct-plus.version}</version>
+                        </path>
+                        <path>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok-mapstruct-binding</artifactId>
+                            <version>${mapstruct-plus.lombok.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                    <compilerArgs>
+                        <arg>-parameters</arg>
+                    </compilerArgs>
+                </configuration>
+            </plugin>
+            <!-- 单元测试使用 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>${maven-surefire-plugin.version}</version>
+                <configuration>
+                    <!-- 根据打包环境执行对应的@Tag测试方法 -->
+                    <groups>${profiles.active}</groups>
+                    <!-- 排除标签 -->
+                    <excludedGroups>exclude</excludedGroups>
+                </configuration>
+            </plugin>
+            <!-- 统一版本号管理 -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>flatten-maven-plugin</artifactId>
+                <version>${flatten-maven-plugin.version}</version>
+                <configuration>
+                    <updatePomFile>true</updatePomFile>
+                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>flatten</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>flatten</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>flatten.clean</id>
+                        <phase>clean</phase>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <repositories>
+        <repository>
+            <id>public</id>
+            <name>aliyun nexus</name>
+            <url>https://maven.aliyun.com/repository/public/</url>
+        </repository>
+        <repository>
+            <id>spring-releases</id>
+            <url>https://repo.spring.io/libs-release</url>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>public</id>
+            <name>aliyun nexus</name>
+            <url>https://maven.aliyun.com/repository/public/</url>
+        </pluginRepository>
+        <pluginRepository>
+            <id>spring-releases</id>
+            <url>https://repo.spring.io/libs-release</url>
+        </pluginRepository>
+    </pluginRepositories>
+</project>

+ 3 - 59
pom.xml

@@ -2,7 +2,7 @@
          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.example</groupId>
+    <groupId>top.haijunit</groupId>
     <artifactId>mul-agent-virtual-simulation-system</artifactId>
     <version>${revision}</version>
     <packaging>pom</packaging>
@@ -22,6 +22,7 @@
         <hutool.version>5.8.16</hutool.version>
         <spring-boot.version>3.1.5</spring-boot.version>
         <lombok.version>1.18.30</lombok.version>
+        <mybatis-plus.version>3.5.3.2</mybatis-plus.version>
         <!-- 插件版本 -->
         <mapstruct-plus.version>1.3.5</mapstruct-plus.version>
         <mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
@@ -34,7 +35,7 @@
     </properties>
 
     <modules>
-        <module>server</module>
+        <module>train-server</module>
     </modules>
 
     <!-- 依赖声明 -->
@@ -56,11 +57,6 @@
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.projectlombok</groupId>
-                <artifactId>lombok</artifactId>
-                <version>${lombok.version}</version>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -95,58 +91,6 @@
             </resource>
         </resources>
         <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>${maven-compiler-plugin.verison}</version>
-                <configuration>
-                    <source>${java.version}</source>
-                    <target>${java.version}</target>
-                    <encoding>${project.build.sourceEncoding}</encoding>
-                    <annotationProcessorPaths>
-                        <path>
-                            <groupId>com.github.therapi</groupId>
-                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
-                            <version>${therapi-javadoc.version}</version>
-                        </path>
-                        <path>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok</artifactId>
-                            <version>${lombok.version}</version>
-                        </path>
-                        <path>
-                            <groupId>org.springframework.boot</groupId>
-                            <artifactId>spring-boot-configuration-processor</artifactId>
-                            <version>${spring-boot.version}</version>
-                        </path>
-                        <path>
-                            <groupId>io.github.linpeilie</groupId>
-                            <artifactId>mapstruct-plus-processor</artifactId>
-                            <version>${mapstruct-plus.version}</version>
-                        </path>
-                        <path>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok-mapstruct-binding</artifactId>
-                            <version>${mapstruct-plus.lombok.version}</version>
-                        </path>
-                    </annotationProcessorPaths>
-                    <compilerArgs>
-                        <arg>-parameters</arg>
-                    </compilerArgs>
-                </configuration>
-            </plugin>
-            <!-- 单元测试使用 -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <version>${maven-surefire-plugin.version}</version>
-                <configuration>
-                    <!-- 根据打包环境执行对应的@Tag测试方法 -->
-                    <groups>${profiles.active}</groups>
-                    <!-- 排除标签 -->
-                    <excludedGroups>exclude</excludedGroups>
-                </configuration>
-            </plugin>
             <!-- 统一版本号管理 -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>

+ 0 - 6
server/README.md

@@ -1,6 +0,0 @@
-## 项目介绍
-
-## 项目必备环境
-
-- openjdk-17 [https://www.oracle.com/cn/java/technologies/downloads/#java17](https://www.oracle.com/cn/java/technologies/downloads/#java17)
-- redis [https://github.com/zkteco-home/redis-windows/releases](https://github.com/zkteco-home/redis-windows/releases)

+ 0 - 77
server/pom.xml

@@ -1,77 +0,0 @@
-<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>com.example</groupId>
-        <artifactId>mul-agent-virtual-simulation-system</artifactId>
-        <version>${revision}</version>
-    </parent>
-
-    <artifactId>server</artifactId>
-    <packaging>jar</packaging>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-websocket</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.liquibase</groupId>
-            <artifactId>liquibase-core</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <finalName>${project.artifactId}</finalName>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>${spring-boot.version}</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>${maven-jar-plugin.version}</version>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>${maven-war-plugin.version}</version>
-                <configuration>
-                    <failOnMissingWebXml>false</failOnMissingWebXml>
-                    <warName>${project.artifactId}</warName>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 13
server/src/main/java/com/example/server/ServerApplication.java

@@ -1,13 +0,0 @@
-package com.example.server;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class ServerApplication {
-
-  public static void main(String[] args) {
-    SpringApplication.run(ServerApplication.class, args);
-  }
-
-}

+ 0 - 26
server/src/main/resources/db/changelog/db-server-train.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<databaseChangeLog
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
-    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
-
-
-    <changeSet id="demo" author="zhanghaijun" failOnError="false" runOnChange="true">
-        <createTable tableName="goods" schemaName="${schema.name}" tablespace="${tablespace}" remarks="商品">
-            <column name="goods_id" type="${autoing.type}" autoIncrement="true" remarks="商品ID">
-                <constraints nullable="false" primaryKey="true"/>
-            </column>
-            <column name="logo" type="VARCHAR(128)" defaultValue="" remarks="主图地址"/>
-            <column name="remark" type="VARCHAR(255)" defaultValue="" remarks="备注商品"/>
-
-            <column name="status" type="${number.type}" defaultValue="1" remarks="数据状态"/>
-            <column name="tenant_id" type="VARCHAR(64)" defaultValue="" remarks="租户字段"/>
-            <column name="create_time" type="datetime" remarks="创建时间"/>
-            <column name="create_by" type="${autoing.type}" remarks="创建者"/>
-            <column name="update_time" type="datetime" remarks="更新时间"/>
-            <column name="update_by" type="${autoing.type}" remarks="更新者"/>
-        </createTable>
-    </changeSet>
-
-</databaseChangeLog>
-

+ 0 - 36
server/src/main/resources/db/changelog/db-server.xml

@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<databaseChangeLog
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
-    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
-
-    <property name="schema.name" value="${database.defaultSchemaName}"/>
-    <property name="catalog.name" value="${database.defaultCatalogName}"/>
-
-    <property name="clob.type" value="longtext" dbms="h2"/>
-    <property name="clob.type" value="longtext" dbms="mysql,mariadb"/>
-    <property name="clob.type" value="clob"/>
-
-    <property name="autoing.type" value="bigint(20)" dbms="h2"/>
-    <property name="autoing.type" value="bigint(20)" dbms="mysql,mariadb"/>
-    <property name="autoing.type" value="serial"/>
-
-    <property name="number.type" value="bigint" dbms="h2"/>
-    <property name="number.type" value="int" dbms="mysql,mariadb"/>
-    <property name="number.type" value="serial"/>
-
-    <property name="now" value="now()" dbms="h2"/>
-    <property name="now" value="now()" dbms="mysql,mariadb"/>
-    <property name="now" value="sysdate"/>
-
-    <changeSet author="zhanghaijun" id="mysql_charsets_change" runOnChange="true" runAlways="true" failOnError="false" dbms="mysql,mariadb">
-        <validCheckSum>ANY</validCheckSum>
-        <sql dbms="mysql,mariadb" splitStatements="true" stripComments="true">
-            ALTER DATABASE ${schema.name} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin
-        </sql>
-    </changeSet>
-
-    <include relativeToChangelogFile="true" file="db-server-train"/>
-
-</databaseChangeLog>
-

+ 0 - 13
server/src/test/java/com/example/server/ServerApplicationTests.java

@@ -1,13 +0,0 @@
-package com.example.server;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class ServerApplicationTests {
-
-  @Test
-  void contextLoads() {
-  }
-
-}

+ 0 - 33
train-server/.gitignore

@@ -1,33 +0,0 @@
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/

+ 4 - 11
train-server/pom.xml

@@ -3,19 +3,12 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <groupId>org.springframework.boot</groupId>
-        <artifactId>spring-boot-starter-parent</artifactId>
-        <version>3.1.5</version>
-        <relativePath/>
+        <groupId>com.example</groupId>
+        <artifactId>mul-agent-virtual-simulation-system</artifactId>
+        <version>${revision}</version>
     </parent>
-    <groupId>top.haijunit</groupId>
     <artifactId>train-server</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-    <name>train-server</name>
-    <description>train server</description>
-    <properties>
-        <java.version>17</java.version>
-    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 5 - 0
train-server/src/main/java/top/haijunit/train/config/MybatisPlusConfig.java

@@ -5,6 +5,11 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description Mybatis配置
+ */
 @Configuration
 @MapperScan("top.haijunit.train.mapper")
 public class MybatisPlusConfig {

+ 5 - 0
train-server/src/main/java/top/haijunit/train/config/WebSocketConfig.java

@@ -4,6 +4,11 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description WebSocket配置
+ */
 @Configuration
 public class WebSocketConfig {
     @Bean

+ 5 - 0
train-server/src/main/java/top/haijunit/train/controller/WebSocketController.java

@@ -8,6 +8,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description 测试websocket界面
+ */
 @RestController
 public class WebSocketController {
 

+ 5 - 0
train-server/src/main/java/top/haijunit/train/mapper/UserMapper.java

@@ -3,5 +3,10 @@ package top.haijunit.train.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import top.haijunit.train.model.UserDO;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description user数据库操作
+ */
 public interface UserMapper extends BaseMapper<UserDO> {
 }

+ 5 - 0
train-server/src/main/java/top/haijunit/train/model/UserDO.java

@@ -3,6 +3,11 @@ package top.haijunit.train.model;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description user实体
+ */
 @Data
 @TableName("db_user")
 public class UserDO {

+ 5 - 0
train-server/src/main/java/top/haijunit/train/websocket/WebSocketServer.java

@@ -13,6 +13,11 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+/**
+ * @author zhanghaijun
+ * @date 2023/11/3 16:36
+ * @description websocket服务接口
+ */
 @Component
 @ServerEndpoint("/socket/{uid}")
 @Slf4j

+ 22 - 1
server/src/main/resources/application.yml

@@ -33,10 +33,31 @@ spring:
     change-log: classpath:/db/changelog/db-server.xml
   datasource:
     driver-class-name: org.h2.Driver
-    type: org.h2.jdbcx.JdbcConnectionPool
+    type: com.zaxxer.hikari.HikariDataSource
     url: jdbc:h2:./store/db_train;IGNORECASE=TRUE;MODE=MySQL;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9090;USER=root;PASSWORD=123456
     username: root
     password: 123456
+    hikari:
+      minimum-idle: 10
+      maximum-pool-size: 20
+      connectionTimeout: 30000
+      validationTimeout: 5000
+      idleTimeout: 600000
+      maxLifetime: 1800000
+      connectionTestQuery: SELECT 1
+      keepaliveTime: 30000
+  freemarker:
+    enabled: true
+    request-context-attribute: request
+    prefix: /templates/
+    suffix: .html
+    content-type: text/html
+    cache: false
+    charset: UTF-8
+    allow-request-override: false
+    expose-request-attributes: true
+    expose-session-attributes: true
+    expose-spring-macro-helpers: true
   h2:
     console:
       path: /h2

server/src/main/resources/logback.xml → train-server/src/main/resources/logback.xml