chen.cheng 4 mesiacov pred
rodič
commit
99c14882ad

+ 2 - 2
bd-park/park-backend/park-application/build.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="bd-location" basedir=".">
+<project name="park-app" basedir=".">
     <property environment="SystemVariable"/>
-    <property name="buildName" value="bd-location"/>
+    <property name="buildName" value="park-application"/>
     <!--默认目标-->
     <target name="Build" depends="copy-out"/>
     <!--所有的打包最终需要文件copy到特定目录,方便jenkins上取包-->

+ 2 - 2
bd-park/park-backend/park-application/pom.xml

@@ -9,11 +9,11 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>park-appliication</artifactId>
+    <artifactId>park-application</artifactId>
     <version>${park.version}</version>
 
     <description>
-        park-appliication核心模块
+        park-application核心模块
     </description>
 
     <properties>

+ 106 - 0
bd-park/park-backend/park-application/src/main/resources/application-test.yml

@@ -0,0 +1,106 @@
+# 数据源配置
+spring:
+  # redis 配置
+  redis:
+    # 地址
+    host: 127.0.0.1
+    # 端口,默认为6379
+    port: 16379
+    # 数据库索引
+    database: 1
+    # 密码
+    password:
+    # 连接超时时间
+    timeout: 10s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 8
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3s
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    druid:
+      # 主库数据源
+      master:
+        url: jdbc:mysql://127.0.0.1:3306/hs_bds?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: root
+        password: Hs@123456
+      # 从库数据源
+      slave:
+        # 从数据源开关/默认关闭
+        enabled: false
+        url:
+        username:
+        password:
+      # 初始连接数
+      initialSize: 5
+      # 最小连接池数量
+      minIdle: 10
+      # 最大连接池数量
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置连接超时时间
+      connectTimeout: 30000
+      # 配置网络超时时间
+      socketTimeout: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      # 配置一个连接在池中最大生存的时间,单位是毫秒
+      maxEvictableIdleTimeMillis: 900000
+      # 配置检测连接是否有效
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      webStatFilter:
+        enabled: true
+      statViewServlet:
+        enabled: true
+        # 设置白名单,不填则允许所有访问
+        allow:
+        url-pattern: /druid/*
+        # 控制台管理用户名和密码
+        login-username: ruoyi
+        login-password: 123456
+      filter:
+        stat:
+          enabled: true
+          # 慢SQL记录
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: true
+        wall:
+          config:
+            multi-statement-allow: true
+mqtt:
+  client:
+    enabled: false
+    ip: xt.wenhq.top
+    port: 8581
+    name: uwb-location-client
+    client-id: uwb-000001
+    global-subscribe:
+    timeout: 5
+    reconnect: true
+    re-interval: 5000
+    version: mqtt_3_1_1
+    read-buffer-size: 8KB
+    max-bytes-in-message: 10MB
+    keep-alive-secs: 60
+    clean-session: true
+    ssl:
+      enabled: false
+bd:
+  mqtt:
+    enabled: false
+server:
+  port: 28181

+ 13 - 0
bd-park/park-backend/park-collect/build.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="park-collection" basedir=".">
+    <property environment="SystemVariable"/>
+    <property name="buildName" value="park-collect"/>
+    <!--默认目标-->
+    <target name="Build" depends="copy-out"/>
+    <!--所有的打包最终需要文件copy到特定目录,方便jenkins上取包-->
+    <target name="copy-out">
+        <copy todir="${basedir}/../out" overwrite="true" failonerror="no">
+            <fileset file="${basedir}/target/${buildName}.jar"/>
+        </copy>
+    </target>
+</project>

+ 22 - 1
bd-park/park-backend/park-collect/pom.xml

@@ -96,7 +96,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.5.15</version>
+                <version>${spring-boot.version}</version>
                 <configuration>
                     <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
                 </configuration>
@@ -117,6 +117,27 @@
                     <warName>${project.artifactId}</warName>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>package</id>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <ant antfile="build.xml">
+                                    <target name="Build"/>
+                                </ant>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
         <finalName>${project.artifactId}</finalName>
     </build>

+ 93 - 0
bd-park/park-backend/park-collect/src/main/resources/application-test.yml

@@ -0,0 +1,93 @@
+## MQTT##
+aliyun:
+  mqtt:
+    uri: tcp://127.0.0.1:1883
+
+
+# 数据源配置
+spring:
+  # redis 配置
+  redis:
+    # 地址
+    host: 127.0.0.1
+    # 端口,默认为6379
+    port: 16379
+    # 数据库索引
+    database: 1
+    # 密码
+    password:
+    # 连接超时时间
+    timeout: 10s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 8
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: 3s
+  cache:
+    cache-names:
+      - pileHoleList
+      - pileMachineList
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driverClassName: com.mysql.cj.jdbc.Driver
+    druid:
+      # 主库数据源
+      master:
+        url: jdbc:mysql://127.0.0.1:3306/hs_bds?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: root
+        password: Hs@123456
+      # 从库数据源
+      pkb:
+        # 从数据源开关/默认关闭
+        enabled: true
+        url: jdbc:mysql://127.0.0.1:3306/hs_bds?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+        username: root
+        password: Hs@123456
+      # 初始连接数
+      initialSize: 5
+      # 最小连接池数量
+      minIdle: 10
+      # 最大连接池数量
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置连接超时时间
+      connectTimeout: 30000
+      # 配置网络超时时间
+      socketTimeout: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      # 配置一个连接在池中最大生存的时间,单位是毫秒
+      maxEvictableIdleTimeMillis: 900000
+      # 配置检测连接是否有效
+      validationQuery: SELECT 1 FROM DUAL
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      webStatFilter:
+        enabled: true
+      statViewServlet:
+        enabled: true
+        # 设置白名单,不填则允许所有访问
+        allow:
+        url-pattern: /druid/*
+        # 控制台管理用户名和密码
+        login-username: ruoyi
+        login-password: 123456
+      filter:
+        stat:
+          enabled: true
+          # 慢SQL记录
+          log-slow-sql: true
+          slow-sql-millis: 1000
+          merge-sql: true
+        wall:
+          config:
+            multi-statement-allow: true

+ 1 - 1
bd-park/park-backend/park-collect/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/opt/project/ruoyi/ruoyi-backend/logs" />
+	<property name="log.path" value="/opt/project/ruoyi/ruoyi-backend/collect-logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 83 - 0
bd-park/park-backend/start.bat

@@ -0,0 +1,83 @@
+@echo off
+
+rem jar平级目录
+set AppName=park-application.jar
+set appPort=28080
+
+set JarPath=./out/park-application.jar
+
+set Env=test
+
+rem JVM参数
+set JVM_OPTS="-Dapp.name=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps  -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
+
+
+ECHO.
+	ECHO.  [1] 启动%AppName%
+	ECHO.  [2] 关闭%AppName%
+	ECHO.  [3] 重启%AppName%
+	ECHO.  [4] 启动状态 %AppName%
+	ECHO.  [6] 关闭Nginx
+	ECHO.  [5] 退 出
+ECHO.
+
+ECHO.请输入选择项目的序号:
+set /p ID=
+	IF "%id%"=="1" GOTO start
+	IF "%id%"=="2" GOTO stop
+	IF "%id%"=="3" GOTO restart
+	IF "%id%"=="4" GOTO status
+	IF "%id%"=="6" GOTO stopNginx
+	IF "%id%"=="7" GOTO startNginx
+	IF "%id%"=="5" EXIT
+PAUSE
+
+:stopNginx
+   taskkill /f /fi "imagename eq nginx.exe"
+goto:eof
+
+:start
+    set pid=
+    for /f "usebackq tokens=2,5" %%a in (`netstat -ano ^| findstr  %appPort%`) do (
+		set pid=%%b
+		set image_name=%%a
+	)
+   if  defined pid (
+        echo %%pid is running
+        exit /b
+   )
+
+echo javaw %JVM_OPTS% -jar %JarPath% --spring.profiles.active=%Env%
+start javaw %JVM_OPTS% -jar %JarPath% --spring.profiles.active=%Env%
+
+echo  starting……
+echo  Start %AppName% success...
+goto:eof
+
+rem 函数stop通过jps命令查找pid并结束进程
+:stop
+    set pid=
+	for /f "usebackq tokens=2,5" %%a in (`netstat -ano ^| findstr  %appPort%`) do (
+		set pid=%%b
+		set image_name=%%a
+	)
+	if not defined pid (echo process %AppName% does not exists) else (
+		echo prepare to kill %image_name%
+		echo start kill %pid% ...
+		rem 根据进程ID,kill进程
+		taskkill /f /t /pid %pid%
+	)
+goto:eof
+:restart
+    call :stop
+    call :start
+goto:eof
+:status
+	for /f "usebackq tokens=2,5" %%a in (`netstat -ano ^| findstr  %appPort%`) do (
+		set pid=%%b
+		set image_name=%%a
+	)
+	if not defined pid (echo process %AppName% is dead ) else (
+		echo %image_name% is running
+	)
+goto:eof