Bladeren bron

1.首页添加风速风向
2.气压数据显示异常修复
3.合并前端打包到一起

wangt 1 jaar geleden
bovenliggende
commit
bbc2632e60

+ 1 - 0
pom.xml

@@ -190,6 +190,7 @@
                 <version>${dynamic-datasource.version}</version>
             </dependency>
 
+
         </dependencies>
     </dependencyManagement>
 

+ 79 - 22
wps-biz/pom.xml

@@ -67,6 +67,12 @@
             <artifactId>commons-math3</artifactId>
             <version>3.6.1</version>
         </dependency>
+
+        <!-- spring-boot-thymeleaf -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
     </dependencies>
 
     <profiles>    <!--考虑到window 和linux环境 npm命令格式的问题,使用maven的profile实现动态指定命令-->
@@ -112,11 +118,58 @@
                         </fileset>
                         <fileset>
                             <!-- 最终项目打包自动生成的package目录 -->
-                            <directory>../package/wps/${project.version}</directory>
+                            <directory>src/main/resources/templates</directory>
+                        </fileset>
+                        <fileset>
+                            <!-- 最终项目打包自动生成的package目录 -->
+                            <directory>src/main/resources/static</directory>
                         </fileset>
                     </filesets>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.7.10</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 -->
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                    <mainClass>com.jiayue.WpsApplication</mainClass>
+                    <layout>ZIP</layout>
+                    <fork>true</fork>
+                    <includes>
+                        <!-- 不包含任何jar包 -->
+                        <include>
+                            <groupId>nothing</groupId>
+                            <artifactId>nothing</artifactId>
+                        </include>
+                    </includes>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- third-party jar into lib directory -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>exec-maven-plugin</artifactId>
@@ -171,48 +224,52 @@
                 </configuration>
                 <executions>
                     <execution>
-                        <id>copy static</id>
+                        <id>copy html</id>
                         <phase>generate-resources</phase>
                         <goals>
                             <goal>copy-resources</goal>
                         </goals>
                         <configuration>
                             <!-- 复制前端打包文件到这里 -->
-                            <outputDirectory>../package/wps/${project.version}/vue</outputDirectory>
+                            <outputDirectory>src/main/resources/templates</outputDirectory>
                             <overwrite>true</overwrite>
                             <resources>
                                 <resource>
                                     <!-- 从前端打包的目录dist进行指定文件、文件夹内容的复制-->
-                                    <directory>../wps-ui</directory>
+                                    <directory>../wps-ui/dist</directory>
+
                                     <includes>
-                                        <!-- 具体根据实际前端代码、及目录结构进行配置-->
-                                        <include>dist/</include>
-                                        <include>nginx.conf</include>
+                                        <include>favicon.ico</include>
                                         <include>index.html</include>
                                         <include>robots.txt</include>
+                                        <include>simhei-normal.js</include>
+                                        <include>html</include>
+                                        <include>img</include>
                                     </includes>
                                 </resource>
                             </resources>
                         </configuration>
                     </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.1.7.RELEASE</version>
-                <configuration>
-                    <outputDirectory>../package/wps/${project.version}/java</outputDirectory>
-                    <!--控制是否启用支持Linux下service方式运行-->
-                    <executable>true</executable>
-                    <includeSystemScope>true</includeSystemScope>
-                </configuration>
-                <executions>
                     <execution>
+                        <id>copy static</id>
+                        <phase>generate-resources</phase>
                         <goals>
-                            <goal>build-info</goal>
-                            <goal>repackage</goal>
+                            <goal>copy-resources</goal>
                         </goals>
+                        <configuration>
+                            <!-- 复制前端打包文件到这里 -->
+                            <outputDirectory>src/main/resources/</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <resources>
+                                <resource>
+                                    <!-- 从前端打包的目录dist进行指定文件、文件夹内容的复制-->
+                                    <directory>../wps-ui/dist</directory>
+                                    <includes>
+                                        <include>static/</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
                     </execution>
                 </executions>
             </plugin>

+ 1 - 1
wps-biz/src/main/java/com/jiayue/biz/conf/Channel.java

@@ -108,7 +108,7 @@ public class Channel {
     }
 
 
-    @Scheduled(cron = "0 0/10 * * * ? ")
+    @Scheduled(cron = "0 0/2 * * * ? ")
     public void tunnel() {
         List<TunnelInfo> tunnelInfoList = tunnelInfoService.list();
         List<AttributeAndPointVo> attributeAndPointVoList = attributeAndPointVoService.selectEquipmentAttributeAndGatherDataPointById();

+ 3 - 1
wps-system/src/main/java/com/jiayue/framework/web/controller/common/IndexController.java → wps-biz/src/main/java/com/jiayue/biz/controller/IndexController.java

@@ -1,7 +1,9 @@
-package com.jiayue.framework.web.controller.common;
+package com.jiayue.biz.controller;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * IndexController

+ 2 - 0
wps-biz/src/main/java/com/jiayue/biz/service/impl/EnvironmentalDataServiceImpl.java

@@ -157,6 +157,8 @@ public class EnvironmentalDataServiceImpl extends ServiceImpl<EnvironmentalDataM
                 weatherMap.put("t", environmentalData.getT());
                 weatherMap.put("rh", environmentalData.getRh());
                 weatherMap.put("pa", environmentalData.getPa());
+                weatherMap.put("ws", environmentalData.getWs());
+                weatherMap.put("wd", environmentalData.getWd());
                 weatherMap.put("weatherLook", weatherLook.getWeatherLookNo());
             }else{
                 weatherMap.put("t", null);

+ 65 - 69
wps-biz/src/main/resources/application-prod.yml

@@ -1,64 +1,74 @@
 # 数据源配置
 spring:
+  servlet:
+    multipart:
+      max-file-size: 10MB
+      max-request-size: 20MB
   datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    driverClassName: com.mysql.cj.jdbc.Driver
-    druid:
-      # 主库数据源
-      master:
-        url: jdbc:mysql://10.124.252.246:3306/nerp-db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&allowMultiQueries=true&rewriteBatchedStatements=true
-        username: root
-        password: '!QAZ2root'
-      # 从库数据源
-      slave:
-        # 从数据源开关/默认关闭
-        enabled: false
-        url:
-        username:
-        password:
-      # 初始连接数
-      initialSize: 5
-      # 最小连接池数量
-      minIdle: 10
-      # 最大连接池数量
-      maxActive: 20
-      # 配置获取连接等待超时的时间
-      maxWait: 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: nerp
-        login-password: nerp
-      filter:
-        stat:
-          enabled: true
-          # 慢SQL记录
-          log-slow-sql: true
-          slow-sql-millis: 1000
-          merge-sql: true
-        wall:
-          config:
-            multi-statement-allow: true
+    dynamic:
+      primary: mysql #设置默认的数据源或者数据源组,默认值即为master
+      datasource:
+        mysql:
+          url: jdbc:mysql://localhost:3306/wps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
+          username: root
+          password: '!QAZ2root'
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          type: com.alibaba.druid.pool.DruidDataSource
+          druid:
+            # 初始连接数
+            initial-size: 5
+            # 最小连接池数量
+            min-idle: 10
+            # 最大连接池数量
+            max-active: 20
+            # 配置获取连接等待超时的时间
+            max-wait: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            min-evictable-idle-time-millis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            max-evictable-idle-time-millis: 900000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            time-between-eviction-runs-millis: 60000
+            # 配置检测连接是否有效
+            test-while-idle: true
+            test-on-borrow: false
+            test-on-return: false
+            validation-query: select 1
+            validation-query-timeout: -1
+            webStatFilter:
+              enabled: true
+            statViewServlet:
+              enabled: true
+              # 设置白名单,不填则允许所有访问
+              allow:
+              url-pattern: /druid/*
+              # 控制台管理用户名和密码
+              login-username: nerp
+              login-password: nerp
+            filter:
+              stat:
+                enabled: true
+                # 慢SQL记录
+                log-slow-sql: true
+                slow-sql-millis: 1000
+                merge-sql: true
+              wall:
+                config:
+                  multi-statement-allow: true
+        tdengine:
+          url: jdbc:TAOS://localhost:6030/nerp_db
+          username: root
+          password: "!QAZ2root"
+          driver-class-name: com.taosdata.jdbc.TSDBDriver
+          type: com.alibaba.druid.pool.DruidDataSource
+          druid:
+            initial-size: 5
+            min-idle: 5
+            max-active: 5
   # redis 配置
   redis:
     # 地址
-    host: 10.124.252.244
+    host: 127.0.0.1
     # 端口,默认为6379
     port: 6379
     # 数据库索引
@@ -77,17 +87,3 @@ spring:
         max-active: 8
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
-#
-#mybatis-plus:
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志
-file:
-  outPutDir: "D:\\out\\new\\"
-  excelDir: "D:\\analysisData\\new\\"
-  outPutBackDir: "D:\\out\\backUps\\"
-  excelBackDir: "D:\\analysisData\\backUps\\"
-email:
-  user: "wanghongchen942"
-  password: "LXQDEOCRCSXWBIAO"
-  host: "imap.126.com"
-  path: "d:\\in\\"

+ 7 - 1
wps-biz/src/main/resources/application.yml

@@ -52,7 +52,7 @@ management:
 
 # 日志配置
 logging:
-  config: classpath:logback-nerp.xml
+  config: classpath:logback-wps.xml
 
 # Spring配置
 spring:
@@ -75,6 +75,11 @@ spring:
       # 热部署开关
       enabled: true
 
+  # 模板引擎
+  thymeleaf:
+    mode: HTML
+    encoding: utf-8
+    cache: false
 # token配置
 token:
   # 令牌自定义标识
@@ -193,3 +198,4 @@ xss:
   excludes: /system/notice
   # 匹配链接
   urlPatterns: /system/*,/monitor/*,/tool/*
+

+ 6 - 28
wps-biz/src/main/resources/logback-nerp.xml → wps-biz/src/main/resources/logback-wps.xml

@@ -66,33 +66,11 @@
     </appender>
 
 
-    <!-- <appender name="TunnelLogFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
-       &lt;!&ndash; 编码 &ndash;&gt;
-       &lt;!&ndash;<Encoding>UTF-8</Encoding>&ndash;&gt;
-       &lt;!&ndash; 按照时间来 &ndash;&gt;
-       <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-         &lt;!&ndash;日志文件输出的文件名&ndash;&gt;
-         <FileNamePattern>D://testlog//#TunnelName#.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
-         &lt;!&ndash;日志文件保留天数&ndash;&gt;
-         <MaxHistory>180</MaxHistory>
-         <maxFileSize>10MB</maxFileSize>
-         <totalSizeCap>1024MB</totalSizeCap>
-         <cleanHistoryOnStart>true</cleanHistoryOnStart>
-       </rollingPolicy>
-       &lt;!&ndash; 布局 &ndash;&gt;
-       <encoder>
-         &lt;!&ndash;格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符&ndash;&gt;
-         <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
-         <charset>UTF-8</charset>
-       </encoder>
-       <append>false</append>
-     </appender>
 
-     <logger name="TunnelLogger" level="debug" additivity="true">
-       <appender-ref ref="TunnelLogFile"/>
-     </logger>-->
-
-    <logger name="com.jiayue" level="info" additivity="true">
+    <logger name="com.jiayue" level="debug" additivity="true">
+        <appender-ref ref="logFile"/>
+    </logger>
+    <logger name="wei.yigulu" level="debug" additivity="true">
         <appender-ref ref="logFile"/>
     </logger>
     <logger name="com.alibaba.druid.filter.stat.StatFilter" level="info" additivity="true">
@@ -100,11 +78,11 @@
     </logger>
 
 
-    <logger name="org" level="info" additivity="true">
+    <logger name="org" level="debug" additivity="true">
         <appender-ref ref="logFile"/>
     </logger>
 
-    <root level="info">
+    <root level="debug">
         <appender-ref ref="STDOUT"/>
     </root>
 </configuration>

+ 4 - 0
wps-system/src/main/java/com/jiayue/framework/config/ResourcesConfig.java

@@ -6,6 +6,8 @@ import com.jiayue.framework.interceptor.RepeatSubmitInterceptor;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
 import org.springframework.web.cors.CorsConfiguration;
 import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
 import org.springframework.web.filter.CorsFilter;
@@ -35,6 +37,8 @@ public class ResourcesConfig implements WebMvcConfigurer {
         /* swagger配置 */
         registry.addResourceHandler("/swagger-ui/**")
                 .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
+        /** 前端静态资源配置 */
+        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
     }
 
     /**

+ 3 - 2
wps-system/src/main/java/com/jiayue/framework/config/SecurityConfig.java

@@ -93,12 +93,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/login", "/register", "/captchaImage").anonymous()
                 .antMatchers(
                         HttpMethod.GET,
-                        "/",
                         "/*.html",
                         "/**/*.html",
                         "/**/*.css",
                         "/**/*.js",
-                        "/profile/**"
+                        "/static/**",
+                        "/",
+                        "/index"
                 ).permitAll()
                 .antMatchers("/swagger-ui.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()

+ 1 - 1
wps-ui/.env.development

@@ -5,7 +5,7 @@ VUE_APP_TITLE = 风压管理平台
 ENV = 'development'
 
 # ELF管理系统/开发环境
-VUE_APP_BASE_API = '/dev-api'
+VUE_APP_BASE_API = ''
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 2 - 2
wps-ui/.env.production

@@ -5,6 +5,6 @@ VUE_APP_TITLE = 风压管理平台
 ENV = 'production'
 
 # ELF管理系统/生产环境
-VUE_APP_BASE_API = '/prod-api'
+VUE_APP_BASE_API = ''
 
-VUE_APP_GIS_API = '/webgis-api'
+VUE_APP_GIS_API = ''

+ 1 - 0
wps-ui/src/assets/icons/svg/wd.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1695363395821" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3889" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.1953125" height="200"><path d="M1024.219162 1024.073054l-734.705571-289.294428L0.949704-0.073054l729.372619 300.910038z" fill="#4185F4" p-id="3890"></path><path d="M513.643718 511.890419m-438.324891 0a438.324891 438.324891 0 1 0 876.649783 0 438.324891 438.324891 0 1 0-876.649783 0Z" fill="#FFFFFF" p-id="3891"></path><path d="M513.643718 511.890419m-365.270742 0a365.270743 365.270743 0 1 0 730.541485 0 365.270743 365.270743 0 1 0-730.541485 0Z" fill="#A0C2F9" p-id="3892"></path><path d="M513.643718 511.890419m-219.162445 0a219.162446 219.162446 0 1 0 438.324891 0 219.162446 219.162446 0 1 0-438.324891 0Z" fill="#4185F4" p-id="3893"></path><path d="M513.643718 511.890419m-73.054148 0a73.054149 73.054149 0 1 0 146.108297 0 73.054149 73.054149 0 1 0-146.108297 0Z" fill="#FFFFFF" p-id="3894"></path></svg>

+ 1 - 0
wps-ui/src/assets/icons/svg/ws.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1695363029035" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2752" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M840.96 533.333333h-256a21.333333 21.333333 0 0 1-21.333333-21.333333 184.533333 184.533333 0 0 1 343.04-94.293333A76.373333 76.373333 0 0 1 840.96 533.333333z m-233.173333-42.666666h233.173333a33.28 33.28 0 0 0 29.226667-16.853334 33.706667 33.706667 0 0 0 0-34.346666 141.653333 141.653333 0 0 0-262.4 51.2zM276.053333 696.533333a185.6 185.6 0 0 1-158.506666-90.24A76.373333 76.373333 0 0 1 183.04 490.666667h256a21.333333 21.333333 0 0 1 21.333333 21.333333 184.746667 184.746667 0 0 1-184.32 184.533333zM183.04 533.333333a33.706667 33.706667 0 0 0-28.8 51.2A141.653333 141.653333 0 0 0 416.213333 533.333333z" fill="#5879FB" p-id="2753"></path><path d="M533.333333 460.586667h-21.333333a184.533333 184.533333 0 0 1-94.506667-343.04 76.373333 76.373333 0 0 1 77.226667 0A75.52 75.52 0 0 1 533.333333 183.04zM456.96 149.333333a34.986667 34.986667 0 0 0-17.493333 4.906667A141.866667 141.866667 0 0 0 490.666667 416.213333V183.04A33.92 33.92 0 0 0 456.96 149.333333zM567.04 917.333333a77.013333 77.013333 0 0 1-37.76-10.026666A75.52 75.52 0 0 1 490.666667 840.96v-277.333333h21.333333a184.533333 184.533333 0 0 1 94.293333 343.04 76.16 76.16 0 0 1-39.253333 10.666666zM533.333333 607.786667v233.173333a33.28 33.28 0 0 0 16.853334 29.226667 33.706667 33.706667 0 0 0 34.346666 0 141.653333 141.653333 0 0 0-51.2-262.4z" fill="#2FDDDC" p-id="2754"></path></svg>

+ 1 - 1
wps-ui/src/router/index.js

@@ -164,7 +164,7 @@ Router.prototype.push = function push(location) {
 }
 
 export default new Router({
-  mode: 'history', // 去掉url中的#
+  mode: 'hash', // 去掉url中的#
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })

+ 1 - 1
wps-ui/src/views/dataQuery/WeatherStationStatusData/index.vue

@@ -35,7 +35,7 @@
           <el-table-column label="风速" align="center" prop="ws"/>
           <el-table-column label="风向" align="center" prop="wd"/>
           <el-table-column label="温度" align="center" prop="t"/>
-          <el-table-column label="气压" align="center" prop="p"/>
+          <el-table-column label="气压" align="center" prop="pa"/>
           <el-table-column label="湿度" align="center" prop="rh"/>
 
         </el-table>

+ 12 - 1
wps-ui/src/views/largeScreenPage/index.vue

@@ -58,6 +58,18 @@
                   </svg>
                   <span class="header-title">压强:</span> {{item.pa}} Pa
                 </div>
+                <div>
+                  <svg class="icon" aria-hidden="true">
+                    <use xlink:href="#icon-ws"></use>
+                  </svg>
+                  <span class="header-title">风速:</span> {{item.ws}} m/s
+                </div>
+                <div>
+                  <svg class="icon" aria-hidden="true">
+                    <use xlink:href="#icon-wd"></use>
+                  </svg>
+                  <span class="header-title">风向:</span> {{item.wd}} °
+                </div>
               </div>
             </div>
           </div>
@@ -185,7 +197,6 @@ export default {
     },
     getWeatherLookInfo() {
       selectHomePageByPTR().then(res => {
-        // this.eqData = res.rows
         this.eqData = res.data
         this.eqNo = this.eqData[0].weatherLookNo
         this.eqName = this.eqData[0].weatherLookName