燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2023-07-14 db44f336e46825afc855466512065cc08e5790bd
添加新代码
已添加108个文件
9277 ■■■■■ 文件已修改
pom.xml 361 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/Application.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/CorsConfig.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/CsvFilePathConfig.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/DatFilePathConfig.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/InitConfig.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/Knife4jConfig.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/ScheduleConfig.java 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/ThreadPoolConfig.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/config/WebSocketConfig.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/AlertConfigController.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/CountController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/EmissionController.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/FeedbackController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/ForecastAnalyseController.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/LocationController.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/SuYuanController.java 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/WarningAnalyseController.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/WeatherController.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/AlertConfig.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Coordinate.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/DictRecord.java 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/DistanceSuYuan.java 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Emission.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/ExpPoint.java 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/FeedbackDetail.java 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/ForecastAnalyseVo.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Location.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/MonitorPointPosition.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Qxsh.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Report.java 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Stratum.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuan.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuan2d.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuan3d.java 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuan700.java 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuanMonitorData.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Temporary.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/ThuAccuracy.java 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/VocCoords.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/VocVals.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/WarningDetail.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/WarningVo.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/Weather.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/AlertConfigMapper.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/BaseMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/CommonMapper.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/DictRecordMapper.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/EmissionMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/ExpPointMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/FeedbackMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/LocationMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/QxshMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/StratumMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/SuYuanMapper.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/ThuAccuracyMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/VocValsMapper.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/WarningDetailMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/WeatherMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/AlertConfigService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/AsyncService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/CommonService.java 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/CountService.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/DictRecordService.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/EmissionService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/FeedbackService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/ForecastAnalyseService.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/LocationService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/SuYuanService.java 313 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/VocValsService.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/WarningAnalyseService.java 396 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/WeatherService.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/AjaxResult.java 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/CacheUtils.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/CalculateUtils.java 371 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/CommonConstant.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/CsvParser.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/DateUtils.java 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/FileUtils.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/GisUtil.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/HttpStatus.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/Result.java 154 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/ServletInitializer.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/SpringUtils.java 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/StringUtils.java 528 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/TableStrategy.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/utils/VocParser.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-file.yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-scheduled.yml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-test.yml 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/logback.xml 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/AlertConfigMapper.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/CommonMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/DictRecordMapper.xml 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/EmissionMapper.xml 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/FeedbackMapper.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocationMapper.xml 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/QxshMapper.xml 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/StratumMapper.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/SuYuanMapper.xml 232 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ThuAccuracyMapper.xml 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/VocValsMapper.xml 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WarningDetailMapper.xml 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WeatherMapper.xml 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,361 @@
<?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">
    <!-- https://start.springboot.io/ -->
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.6.RELEASE</version>
        <relativePath/>
    </parent>
    <!--打包成war-->
    <packaging>war</packaging>
    <groupId>com</groupId>
    <artifactId>yssh</artifactId>
    <version>1.0.0</version>
    <name>yssh</name>
    <description>燕山石化溯源三维电子沙盘</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <!--log4j-->
        <!--<dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>-->
        <!--logback-->
        <!--<dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
        </dependency>-->
        <!--spring-boot-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!--排除内置tomcat容器,让外部容器运行spring-boot项目-->
            <exclusions>
            <!--<exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>-->
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--spring事务管理-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <!--tomcat-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!--jdbc-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <!--thymeleaf-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
            <version>2.2.2.RELEASE</version>
        </dependency>
        <!--lombok-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!--mybatis-plus-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>
        <!--postgresql-->
        <!--dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency-->
        <!--aop-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <!--页面热部署-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>true</scope>
        </dependency>
        <!--fastjson-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency>
        <!--整合druid数据源-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.22</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.22</version>
        </dependency>
        <!--test-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--text-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.1</version>
        </dependency>
        <!--swagger-->
        <!--<dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>-->
        <!--httpclient-->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <!--websocket-->
        <dependency>
            <groupId>javax.websocket</groupId>
            <artifactId>javax.websocket-api</artifactId>
            <version>1.0</version>
        </dependency>
        <!--websocket-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</artifactId>
        </dependency>
        <!--hutool-->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.7.20</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>5.5.0</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>5.5.0</version>
        </dependency>
        <!--commons-fileupload-->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <!--war:servlet-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <!--fast-md5-->
        <dependency>
            <groupId>com.joyent.util</groupId>
            <artifactId>fast-md5</artifactId>
            <version>2.7.1</version>
        </dependency>
        <!--apache.poi-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>
        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <!--biyanwen-->
        <dependency>
            <groupId>com.github.biyanwen</groupId>
            <artifactId>easycsv</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>3.0.3</version>
        </dependency>
        <!--geotools依赖-->
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-shapefile</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-main</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-epsg-hsql</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geotiff</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-geojson</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-api</artifactId>
            <version>20.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-metadata</artifactId>
            <version>22.0</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-opengis</artifactId>
            <version>22.0</version>
            <scope>compile</scope>
        </dependency>
        <!--Caffeine缓存-->
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <version>2.9.3</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>test</id>
            <properties>
                <activatedProperties>test</activatedProperties>
            </properties>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <activatedProperties>dev</activatedProperties>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <activatedProperties>prod</activatedProperties>
            </properties>
        </profile>
    </profiles>
    <build>
        <finalName>yssh</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!--<version>2.3.0.RELEASE</version>-->
                <configuration>
                    <mainClass>com.yssh.Application</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>osgeo</id>
            <name>OSGeo Release Repository</name>
            <url>https://repo.osgeo.org/repository/release/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
        <repository>
            <id>osgeo-snapshot</id>
            <name>OSGeo Snapshot Repository</name>
            <url>https://repo.osgeo.org/repository/snapshot/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
        <repository>
            <id>public</id>
            <name>aliyun nexus</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
</project>
src/main/java/com/yssh/Application.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.yssh;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * åº”用程序
 * @author WWW
 * æŽ’除Security:, exclude = {SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class}
 *
 * jar -> war:继承 SpringBootServletInitializer,实现 configure å‡½æ•°
 */
@EnableSwagger2
@SpringBootApplication(scanBasePackages = {"com.yssh.*"})
public class Application extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) {
        return springApplicationBuilder.sources(Application.class);
    }
}
src/main/java/com/yssh/config/CorsConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.yssh.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
/**
 * @author wMeng
 * @ClassName CorsConfig
 * @Description è·¨åŸŸé…ç½®
 * @date 2022/10/31 16:42
 * @Version 1.0
 */
@Configuration
public class CorsConfig extends WebMvcConfigurationSupport {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // è®¾ç½®è®¿é—®è·¯å¾„为 â€œ/” è·³è½¬åˆ°æŒ‡å®šé¡µé¢
        registry.addViewController("/").setViewName("redirect:/doc.html");
        // è®¾ç½®ä¸ºæœ€é«˜ä¼˜å…ˆçº§
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowCredentials(true)
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
                .allowedHeaders("*")
                .maxAge(3600);
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //设置静态资源映射
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Bean
    public CorsFilter corsFilter() {
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        corsConfiguration.addAllowedOrigin("*");
        corsConfiguration.addAllowedHeader("*");
        corsConfiguration.addAllowedMethod("*");
        source.registerCorsConfiguration("/**", corsConfiguration);
        return new CorsFilter(source);
    }
}
src/main/java/com/yssh/config/CsvFilePathConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "csv")
public class CsvFilePathConfig {
    private String filePath;
    public String getFilePath() {
        return filePath;
    }
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }
    private String vocPath;
    public String getVocPath() {
        return vocPath;
    }
    public void setVocPath(String vocPath) {
        this.vocPath = vocPath;
    }
}
src/main/java/com/yssh/config/DatFilePathConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "dat")
public class DatFilePathConfig {
    private String filePath2d;
    private String filePath3d;
    public String getFilePath2d() {
        return filePath2d;
    }
    public void setFilePath2d(String filePath2d) {
        this.filePath2d = filePath2d;
    }
    public String getFilePath3d() {
        return filePath3d;
    }
    public void setFilePath3d(String filePath3d) {
        this.filePath3d = filePath3d;
    }
}
src/main/java/com/yssh/config/InitConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
package com.yssh.config;
import com.yssh.service.WarningAnalyseService;
import com.yssh.utils.CacheUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import com.yssh.service.CommonService;
import com.yssh.service.DictRecordService;
import javax.annotation.Resource;
import java.util.Calendar;
@Component
public class InitConfig implements ApplicationRunner {
    //protected final Log logger = LogFactory.getLog(this.getClass());
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private CommonService commonService;
    @Autowired
    private DictRecordService dictRecordService;
    @Resource
    WarningAnalyseService warningAnalyseService;
    @Resource
    ScheduleConfig task;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        CacheUtils.init();
        boolean tableExists = commonService.checkTableExists("dict_record");
        if (!tableExists) {
            dictRecordService.createDictRecoTable();
        }
        // è¯»å–dat数据
        commonService.readDatData();
        //test();
        logger.info("***************** ç³»ç»Ÿå¯åŠ¨å®Œæ¯• *****************" + "\n");
    }
    private void test() {
        //task.corpReserveDataSync();
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.MONTH, 5);
        calendar.set(Calendar.DAY_OF_MONTH, 8);
        calendar.set(Calendar.HOUR_OF_DAY, 16);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        //warningAnalyseService.warningOperationStorage(calendar.getTime());
    }
}
src/main/java/com/yssh/config/Knife4jConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
package com.yssh.config;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
/**
 * @author wMeng
 * @ClassName SwaggerConfig
 * @Description TODO
 * @date 2022/10/31 18:55
 * @Version 1.0
 */
@Configuration
@EnableKnife4j
public class Knife4jConfig {
    @Value("${knife4j.enabled}")
    private boolean enabled;
    /**
     * è®¾ç½®è¯·æ±‚的统一前缀
     */
    @Value("${knife4j.pathMapping}")
    private String pathMapping;
    @Bean
    public Docket createRestApi() {
        return new Docket(new DocumentationType("openApi", "3.0"))
                // æ˜¯å¦å¯ç”¨Swagger
                .enable(enabled)
                // ç”¨æ¥åˆ›å»ºè¯¥API的基本信息,展示在文档的页面中(自定义展示的信息)
                .apiInfo(apiInfo())
                // åˆ†ç»„名称
                .groupName("服务")
                // è®¾ç½®å“ªäº›æŽ¥å£æš´éœ²ç»™Swagger展示
                .select()
                // æ‰«ææ‰€æœ‰æœ‰æ³¨è§£çš„api,用这种方式更灵活
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                // æ‰«ææŒ‡å®šåŒ…中的swagger注解
                // .apis(RequestHandlerSelectors.basePackage("com.cn.project.tool.swagger"))
                // æ‰«ææ‰€æœ‰ .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                /* è®¾ç½®å®‰å…¨æ¨¡å¼ï¼Œswagger可以设置访问token */
                // .securitySchemes(securitySchemes())
                .pathMapping(pathMapping);
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                //描述字段支持Markdown语法
                .description("我的接口测试文档")
                .contact(new Contact("张腾飞", "http://127.0.0.1:9001/doc.html", "893732661@qq.com"))
                .version("2.0.0")
                .title("燕山石化API接口测试文档")
                .build();
    }
}
src/main/java/com/yssh/config/ScheduleConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,191 @@
package com.yssh.config;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.yssh.entity.DictRecord;
import com.yssh.entity.SuYuan;
import com.yssh.entity.VocVals;
import com.yssh.service.DictRecordService;
import com.yssh.service.SuYuanService;
import com.yssh.service.VocValsService;
import com.yssh.service.WarningAnalyseService;
import com.yssh.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.github.biyanwen.EasyCsv;
import javax.annotation.Resource;
@Component
@EnableScheduling
public class ScheduleConfig {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    private VocValsService vocValsService;
    @Resource
    private SuYuanService suYuanService;
    @Resource
    private CsvFilePathConfig csvFilePathConfig;
    @Resource
    private DictRecordService dictRecordService;
    @Resource
    private WarningAnalyseService warningAnalyseService;
    @Value("${csv.voc_max}")
    private int vocMax = 96;
    @Value("${csv.cron_max}")
    private int cronMax = 48;
    private static boolean isBusy = false;
    private final static List<String> md5List = new ArrayList<>();
    private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
    public void corpReserveDataSync() {
        loadVocSync();
        loadCsvSync();
    }
    @Scheduled(cron = "${csv.cron}")
    private void loadCsvSync() {
        if (isBusy) return;
        isBusy = true;
        logger.info("***************** å¼€å§‹æ‰§è¡ŒCSV入库 *****************" + "\n");
        Calendar calendar = getCalendar(1);
        for (int i = 0; i < cronMax; i++) {
            try {
                calendar.add(Calendar.HOUR, -1);
                String time = format.format(calendar.getTime());
                String filePath = csvFilePathConfig.getFilePath() + File.separator + time + ".csv";
                File file = new File(filePath);
                if (!file.exists()) {
                    //logger.info(file.getAbsolutePath() + " is not exist ï¼");
                    continue;
                }
                String newTableName = TableStrategy.getTableStrategy(time); // åˆ›å»ºè¡¨
                Integer rows = suYuanService.isTableExists(newTableName);
                if (rows > 0) {
                    continue;
                }
                suYuanService.createNewTable(newTableName);
                DictRecord dr = dictRecordService.selectByCreateTime(Long.parseLong(time));
                if (null == dr) {
                    dictRecordService.insertDictRecord(new DictRecord(1L, newTableName, Long.parseLong(time), ""));
                }
                logger.info("loadCsvSync: " + filePath);
                EasyCsv.read(filePath, SuYuan.class, new CsvParser(suYuanService, time)).doRead();
                warningAnalyseService.warningOperationStorage(calendar.getTime());
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("***************** CSV入库执行完成 *****************" + "\n");
        isBusy = false;
    }
    public Calendar getCalendar(int start) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.HOUR, start);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        // æµ‹è¯• -> 2023-04-23 19:00
        //calendar.set(Calendar.MONTH, 3);
        //calendar.set(Calendar.DAY_OF_MONTH, 23);
        //calendar.set(Calendar.HOUR_OF_DAY, 20);
        return calendar;
    }
    @Scheduled(cron = "${csv.voc}")
    private void loadVocSync() {
        logger.info("***************** å¼€å§‹å…¨åŸŸCSV入库 *****************" + "\n");
        vocValsService.deleteLastYear();
        Calendar calendar = getCalendar(96);
        for (int i = 0; i < vocMax; i++) {
            calendar.add(Calendar.HOUR, -1);
            String time = format.format(calendar.getTime());
            String filePath = csvFilePathConfig.getVocPath() + File.separator + time + ".csv";
            File file = new File(filePath);
            if (!file.exists()) {
                //logger.info(file.getAbsolutePath() + " is not exist ï¼");
                continue;
            }
            String md5 = FileUtils.getFileMd5(filePath);
            if (null != md5 && md5List.contains(md5)) {
                continue; // csv已入库
            }
            int count = vocValsService.countByTime(time);
            if (count > 0) {
                vocValsService.deleteByTime(time); // åˆ é™¤å·²å…¥åº“
            }
            try {
                addFileMd5(md5);
                logger.info("loadVocSync: " + filePath);
                Date date = (Date) calendar.getTime().clone();
                EasyCsv.read(filePath, VocVals.class, new VocParser(vocValsService, date)).doRead();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
        logger.info("***************** å…¨åŸŸCSV执行完成 *****************" + "\n");
    }
    private void addFileMd5(String md5) {
        md5List.add(md5);
        if (md5List.size() > 512) {
            md5List.remove(0);
        }
    }
    private void loadCsv_old() {
        Date date = DateUtils.getNowDate();
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        String filePath = csvFilePathConfig.getFilePath() + "\\\\" + time + ".csv";
        File file = new File(filePath);
        if (!file.exists()) {
            logger.info(file.getAbsolutePath() + " is not exist ï¼");
            return;
        }
        //创建表
        String newTableName = TableStrategy.getTableStrategy(time);
        suYuanService.createNewTable(newTableName);
        dictRecordService.insertDictRecord(new DictRecord(1L, newTableName, Long.parseLong(time), ""));
        EasyCsv.read(filePath, SuYuan.class, new CsvParser(suYuanService, time)).doRead();
        //计算预警/报警,并且进行入库操作
        try {
            Thread.sleep(60 * 1000);
        } catch (InterruptedException e) {
            logger.error("睡眠一分钟后执行预警/报警计算,并且进行入库操作出现异常,异常原因是:", e);
            e.printStackTrace();
        }
        warningAnalyseService.warningOperationStorage(date);
    }
}
src/main/java/com/yssh/config/ThreadPoolConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package com.yssh.config;
import java.util.concurrent.ThreadPoolExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
/**
 * çº¿ç¨‹æ± é…ç½®
 *
 * @author tam
 **/
@Configuration
@EnableAsync
public class ThreadPoolConfig {
    // æ ¸å¿ƒçº¿ç¨‹æ± å¤§å°
    private int corePoolSize = 50;
    // æœ€å¤§å¯åˆ›å»ºçš„线程数
    private int maxPoolSize = 200;
    // é˜Ÿåˆ—最大长度
    private int queueCapacity = 1000;
    // çº¿ç¨‹æ± ç»´æŠ¤çº¿ç¨‹æ‰€å…è®¸çš„空闲时间
    private int keepAliveSeconds = 300;
    //配置线程池中的线程的名称前缀
    private String threadNamePrefix = "async-importDB-";
    @Bean(name = "threadPoolTaskExecutor")
    public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setMaxPoolSize(maxPoolSize);
        executor.setCorePoolSize(corePoolSize);
        executor.setQueueCapacity(queueCapacity);
        executor.setKeepAliveSeconds(keepAliveSeconds);
        executor.setThreadNamePrefix(threadNamePrefix);
        // çº¿ç¨‹æ± å¯¹æ‹’绝任务(无线程可用)的处理策略
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
        return executor;
    }
}
src/main/java/com/yssh/config/WebSocketConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.yssh.config;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
 * WebSocket配置类
 * @author WWW
 */
@Component
public class WebSocketConfig {
    /**
     * è‡ªåŠ¨æ³¨å†Œä½¿ç”¨@ServerEndpoint
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}
src/main/java/com/yssh/controller/AlertConfigController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
package com.yssh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yssh.entity.AlertConfig;
import com.yssh.service.AlertConfigService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
@Api(tags="告警配置")
@RestController
@RequestMapping("/config")
@SuppressWarnings("rawtypes")
public class AlertConfigController {
    @Resource
    private AlertConfigService alertConfigService;
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "查询所有告警配置数据", notes = "查询所有告警配置数据")
    @GetMapping("/all")
    public Result getAll() {
        List<AlertConfig> list = alertConfigService.getAll();
        return Result.OK(list);
    }
    @ApiOperationSupport(order = 2)
    @ApiImplicitParam(name = "id", value = "告警配置编号", required = true, type = "int")
    @ApiOperation(value = "根据编号查询告警配置数据详情", notes = "根据编号查询告警配置数据详情")
    @GetMapping("/query/{id}")
    public Result query(@PathVariable("id") Integer id) {
        List<AlertConfig> data = alertConfigService.query(id);
        return Result.OK(data);
    }
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "更新告警配置数据", notes = "根据告警配置编号修改告警配置数据内容")
    @PutMapping
    public Result update(@RequestBody AlertConfig config) {
        int row = alertConfigService.update(config);
        if (row == 0) {
            return Result.error("更新失败");
        }
        return Result.OK("更新成功");
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增告警配置数据", notes = "新增告警配置详情数据")
    @PostMapping
    public Result add(@RequestBody AlertConfig alert) {
        int row = alertConfigService.insert(alert);
        if (row == 0) {
            return Result.error("新增失败");
        }
        return Result.OK("新增成功");
    }
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "删除告警配置数据", notes = "删除告警配置详情数据")
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id) {
        int row = alertConfigService.delete(id);
        if (row == 0) {
            return Result.error("删除失败");
        }
        return Result.OK("删除成功");
    }
}
src/main/java/com/yssh/controller/CountController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yssh.service.CountService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
@Api(tags="统计")
@RestController
@RequestMapping("/count")
@SuppressWarnings("rawtypes")
public class CountController {
    @Resource
    private CountService countService;
    @GetMapping("/accuracy")
    @ApiOperation(value = "查询准确率统计", notes = "查询准确率统计数据,返回参数中forecastRate为预测准确率,practicalRate为溯源准确率")
    public Result getAccuracyAvg() {
        Map<String, Double> accuracyAvg = countService.selectAccuracyAvg();
        return Result.OK(accuracyAvg);
    }
}
src/main/java/com/yssh/controller/EmissionController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
package com.yssh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yssh.entity.Emission;
import com.yssh.service.EmissionService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
/**
 * @author lishijia
 * @ClassName YsshPfshController
 * @Description TODO
 * @date 2022/11/24 14:44
 * @Version 1.0
 */
@Api(tags="排放点")
@RestController
@RequestMapping("/emission")
@SuppressWarnings("rawtypes")
public class EmissionController {
    @Resource
    private EmissionService emissionService;
    @ApiOperation(value = "名称查询排放数据", notes = "根据名称查询排放详细信息")
    @ApiImplicitParam(name = "name", value = "名称", required = true, type = "String")
    @GetMapping("/query/{name}")
    public Result query(@PathVariable("name") String name){
        List<Emission> data =  emissionService.query(name);
        return Result.OK(data);
    }
    @ApiOperation(value = "查询所有排放点数据", notes = "查询所有厂区排放点数据")
    @GetMapping("/getAll")
    public Result getAll(){
        List<Emission> list =  emissionService.getAll();
        return Result.OK(list);
    }
    @PostMapping("/insert")
    @ApiOperation("插入数据")
    public Result insert(@RequestBody Emission emission){
        int i = emissionService.insert(emission);
        if(i == 0){
            return Result.error("插入失败");
        }
        return Result.OK("插入成功");
    }
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除数据")
    public Result delete(@PathVariable("id") String id){
        int i = emissionService.delete(id);
        if(i == 0){
            return Result.error("删除失败");
        }
        return Result.OK("删除成功");
    }
}
src/main/java/com/yssh/controller/FeedbackController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yssh.service.FeedbackService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
@Api(tags="溯源反馈")
@RestController
@RequestMapping("/feedback")
@SuppressWarnings("rawtypes")
public class FeedbackController {
    @Resource
    private FeedbackService feedbackService;
    @GetMapping("/feedback")
    @ApiOperation(value = "溯源反馈", notes = "进行溯源反馈")
    public Result suYuanFeedback(
            @RequestParam(value = "id", required = true) Long id, @RequestParam(value = "practicalId", required = true) String practicalId,
            @RequestParam(value = "practicalVocsName", required = true) String practicalVocsName, @RequestParam(value = "practicalValue", required = true) double practicalValue) {
        return Result.OK(feedbackService.suYuanFeedback(id, practicalId, practicalVocsName, practicalValue));
    }
}
src/main/java/com/yssh/controller/ForecastAnalyseController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
package com.yssh.controller;
import com.yssh.entity.ForecastAnalyseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yssh.service.ForecastAnalyseService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
@Api(tags="预测分析")
@RestController
@RequestMapping("/forecast")
@SuppressWarnings("rawtypes")
public class ForecastAnalyseController {
    @Resource
    private ForecastAnalyseService forecastAnalyseService;
    @GetMapping("/forecastAnalyse")
    @ApiOperation(value = "查询预计及其实际监测数据", notes = "根据所选点位名称及其所选时间段,查询该点位在指定时间段内的监测数据及其预测数据")
    public Result getForecastAnalyse(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "beginTime", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date beginTime,
            @RequestParam(value = "endTime", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
        List<ForecastAnalyseVo> list = forecastAnalyseService.getForecastAnalyse(name, beginTime, endTime);
        return Result.OK(list);
    }
}
src/main/java/com/yssh/controller/LocationController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
package com.yssh.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yssh.entity.Location;
import com.yssh.service.LocationService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
/**
 * @author wMeng
 * @ClassName YsshLocationController
 * @Description YsshLocationController
 * @date 2022/10/30 13:21
 * @Version 1.0
 */
@Api(tags="厂区热点点位")
@RestController
@RequestMapping("/location")
@SuppressWarnings("rawtypes")
public class LocationController {
    @Resource
    private LocationService locationService;
    @ApiOperation(value = "条件查询点位数据", notes = "根据名称及其类型查询点位详细信息")
    @GetMapping("/query")
    public Result query(
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "type", required = true) String type) {
        List<Location> data = locationService.query(name, type);
        return Result.OK(data);
    }
    @GetMapping("/list")
    @ApiOperation(value = "查询所有点位数据", notes = "查询所有厂区热点点位数据")
    public Result list() {
        List<Location> list = locationService.getAll();
        return Result.OK(list);
    }
    @ApiOperation(value = "新增点位数据", notes = "新增点位详情数据")
    @PostMapping
    public Result insertLocation(@RequestBody Location location) {
        int i = locationService.insertLocation(location);
        if (i == 0) {
            return Result.error("插入失败");
        }
        return Result.OK("插入成功");
    }
    @ApiOperation(value = "删除点位数据", notes = "删除点位详情数据")
    @DeleteMapping("/{id}")
    public Result deleteLocation(@PathVariable String id) {
        int i = locationService.deleteLocation(id);
        if (i == 0) {
            return Result.error("删除失败");
        }
        return Result.OK("删除成功");
    }
}
src/main/java/com/yssh/controller/SuYuanController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,190 @@
package com.yssh.controller;
import com.yssh.entity.*;
import com.yssh.service.CommonService;
import com.yssh.service.VocValsService;
import com.yssh.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yssh.service.SuYuanService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
/**
 * @author lishijia
 * @ClassName Yssh2dreliController
 * @Description Yssh2dreliController
 * @date 2022/12/3 21:21
 * @Version 1.0
 */
@Api(tags="溯源信息")
@RestController
@RequestMapping("/suYuan")
@SuppressWarnings("rawtypes")
public class SuYuanController {
    @Resource
    private CommonService commonService;
    @Resource
    private SuYuanService suYuanService;
    @Resource
    private VocValsService vocValsService;
    private final static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
    @ApiOperation(value = "查询2d热力图数据", notes = "根据时间查询2d热力图数据")
    @ApiOperationSupport(order = 1)
    @GetMapping("/get2d")
    public Result get2d(
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        List<SuYuan2d> list = suYuanService.selectSuYuan2d(date);
        return Result.OK(list);
    }
    @ApiOperation(value = "查询3d热力图数据", notes = "根据时间查询3d热力图数据")
    @ApiOperationSupport(order = 2)
    @GetMapping("/get3d")
    public Result get3d(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        List<SuYuan3d> list = suYuanService.selectSuYuan3d(name, date);
        return Result.OK(list);
    }
    @ApiOperation(value = "查询溯源100热力图数据", notes = "根据时间查询溯源100热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递")
    @ApiOperationSupport(order = 3)
    @GetMapping("/get100")
    public Result get100(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date
    ) {
        return Result.OK(suYuanService.selectSuYuan100(name, date));
    }
    @ApiOperation(value = "查询溯源200热力图数据", notes = "根据时间查询溯源200热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递")
    @ApiOperationSupport(order = 4)
    @GetMapping("/get200")
    public Result get200(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date
    ) {
        return Result.OK(suYuanService.selectSuYuan200(name, date));
    }
    @ApiOperation(value = "查询溯源300热力图数据", notes = "根据时间查询溯源300热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递")
    @ApiOperationSupport(order = 5)
    @GetMapping("/get300")
    public Result get300(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date
    ) {
        return Result.OK(suYuanService.selectSuYuan300(name, date));
    }
    @ApiOperation(value = "查询溯源500热力图数据", notes = "根据时间查询溯源500热力图数据,result返回值中data对应值为热力图数据,feedbackId为反馈主键编号,在进行反馈中需要传递")
    @ApiOperationSupport(order = 6)
    @GetMapping("/get500")
    public Result get500(
            @RequestParam(value = "name", required = true) String name,
            @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date
    ) {
        return Result.OK(suYuanService.selectSuYuan500(name, date));
    }
    @ApiOperation(value = "获取所有监测数据", notes = "获取所有监测数据")
    @ApiOperationSupport(order = 7)
    @GetMapping("/query/{name}")
    public Result getMonitorData(@PathVariable("name") String name) {
        List<SuYuanMonitorData> list = suYuanService.getMonitorData(name);
        return Result.OK(list);
    }
    @ApiOperation(value = "更新Vocs名称", notes = "更新Vocs名称")
    @ApiOperationSupport(order = 8)
    @GetMapping("/updateVocsName")
    public Result updateVocsName(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date,
                                 @RequestParam(value = "id", required = true) String id,
                                 @RequestParam(value = "vocsName", required = true) String vocsName
    ) {
        return Result.OK(suYuanService.updateVocsName(date, id, vocsName));
    }
    @ApiOperation(value = "根据名称获取坐标值", notes = "根据名称获取坐标值")
    @ApiOperationSupport(order = 9)
    @GetMapping("/getCoordByName/{name}")
    public Result getCoordByName(@PathVariable("name") String name) {
        MonitorPointPosition point = StringUtils.isEmpty(name) ? null : commonService.select3dCheckPointByName(name);
        return Result.OK(point);
    }
    @ApiOperation(value = "根据Qxsh值", notes = "根据Qxsh值")
    @ApiOperationSupport(order = 10)
    @GetMapping("/queryQxsh")
    public Result queryQxsh(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        List<Qxsh> list = suYuanService.queryQxsh(date);
        return Result.OK(list);
    }
    @ApiOperation(value = "根据时间查询Voc值", notes = "根据时间查询Voc值")
    @ApiOperationSupport(order = 11)
    @GetMapping("/selectVocByTime")
    public Result selectVocByTime(@RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        List<VocVals> list = vocValsService.selectByTime(format.format(date));
        return Result.OK(list);
    }
    @ApiOperation(value = "根据X,Y值查询地址", notes = "根据X,Y值查询地址")
    @ApiOperationSupport(order = 12)
    @GetMapping("/selectCoords")
    public Result selectVocByTime(@RequestParam(value = "x", required = false) Integer x, @RequestParam(value = "y", required = false) Integer y) {
        return Result.OK(vocValsService.selectCoords(x, y));
    }
    @ApiOperation(value = "根据X、Y值查询矩形框", notes = "根据X、Y值查询矩形框")
    @ApiOperationSupport(order = 13)
    @GetMapping("/selectRects")
    public Result selectRects(@RequestParam(value = "x[]", required = true) Double[] x, @RequestParam(value = "y[]", required = true) Double[] y) {
        if (null == x || null == y || x.length == 0 || x.length != y.length) return Result.OK(null);
        return Result.OK(suYuanService.selectRects(x, y));
    }
    @ApiOperation(value = "根据ID和日期查询溯源700表", notes = "根据ID和日期查询溯源700表")
    @ApiOperationSupport(order = 14)
    @GetMapping("/selectSuYuan700ById")
    public Result selectSuYuan700ById(@RequestParam(value = "id", required = true) String id, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        return Result.OK(suYuanService.selectSuYuan700ById(id, date));
    }
    @ApiOperation(value = "根据ID和日期查询溯源46表", notes = "根据ID和日期查询溯源46表")
    @ApiOperationSupport(order = 15)
    @GetMapping("/selectSuYuan46ById")
    public Result selectSuYuan46ById(@RequestParam(value = "id", required = true) String id, @RequestParam(value = "date", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        return Result.OK(suYuanService.selectSuYuan46ById(id, date));
    }
    @ApiOperation(value = "根据经纬度查询地名", notes = "根据经纬度查询地名")
    @ApiOperationSupport(order = 16)
    @GetMapping("/selectAddrByXY")
    public Result selectAddrByXY(@RequestParam(value = "x", required = true) double x, @RequestParam(value = "y", required = true) double y) {
        return Result.OK(suYuanService.selectAddrByXY(x, y));
    }
}
src/main/java/com/yssh/controller/WarningAnalyseController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,134 @@
package com.yssh.controller;
import com.yssh.entity.Qxsh;
import com.yssh.utils.CacheUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yssh.service.WarningAnalyseService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Api(tags = "告警分析")
@RequestMapping("/warning")
@RestController
@SuppressWarnings("rawtypes")
public class WarningAnalyseController {
    @Resource
    private WarningAnalyseService warningService;
    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    /**
     * 1.查询当前时间的所有点位value值(以47.dat查询即可)
     * 2.筛选大于yssh_bjyj中的jcbj字段的值 è¿”回id+经纬度+value
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "获取实时报警", notes = "获取实时报警分析数据")
    @GetMapping("/runAlarm")
    public Result alarmAnalyse() {
        return Result.OK(warningService.getRunTimeAlarmAnalyse());
    }
    /**
     * 1.查询当前时间的所有点位value值(以47.dat查询即可)
     * 2.筛选大于yssh_bjyj中的jcyj字段的值 è¿”回id+经纬度+value
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "获取实时预警", notes = "获取实时预警分析数据")
    @GetMapping("/runWarning")
    public Result warningAnalyse() {
        return Result.OK(warningService.getRunTimeWarningAnalyse());
    }
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "本月预警、报警统计", notes = "本月预警、报警统计,返回参数alarmNumber对应值为本月报警数据量,参数warningNumber对应值为本月预警数据量")
    @GetMapping("/monthCount")
    public Result thisMonthCount() {
        return Result.OK(warningService.countThisMonthAlarmAndWarning());
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "每日预警、报警数量变化趋势", notes = "一周每日预警、报警数量统计,返回参数alarmDayCount为一周每日报警统计数量列表,参数warningDayCount为一周每日预警统计数量列表")
    @GetMapping("/everydayCount")
    public Result everydayCount() {
        return Result.OK(warningService.countEverydayAlarmAndWarning());
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "三小时监测站点数据变化趋势", notes = "返回值为三小时监测站点监测数据,返回值为map集合,其中key为站点名称,value为list集合,保存每天监测数值数据")
    @GetMapping("/locationDataChange")
    public Result locationDataChange() {
        //return Result.OK(warningService.selectEachLocationDataChange());
        String key = dateFormat.format(new Date()) + "_local";
        Object obj = CacheUtils.get(key);
        Map<String, List<Double>> map;
        //if (null != obj) {
        //    map = (Map<String, List<Double>>) obj;
        //} else {
        //map = warningService.selectEachLocationDataChange();
        map = warningService.select3Hours();
        //    if (null != map && map.size() > 0) {
        //        CacheUtils.put(key, map);
        //    }
        //}
        return Result.ok(map);
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "获取本月监测大数据站点最大值TOP10", notes = "获取本月监测大数据站点最大值TOP10数量列表")
    @GetMapping("/monthTop10")
    public Result monthTop10() {
        //return Result.OK(warningService.selectThisMonthLocationValueDataTop10());
        //String key = dateFormat.format(new Date()) + "_top10";
        //Object obj = CacheUtils.get(key);
        List<Qxsh> list;
        //if (null != obj) {
        //    list = (List<Qxsh>) obj;
        //} else {
        //list = warningService.selectThisMonthLocationValueDataTop10();
        list = warningService.selectMonthTop10();
        //    if (null != list && list.size() > 0) {
        //        CacheUtils.put(key, list);
        //    }
        //}
        return Result.ok(list);
    }
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "根据时间获取报警和预警信息", notes = "根据时间获取报警和预警信息")
    @GetMapping("/getAlarmAndWarnByTime")
    public Result getAlarmAndWarnByTime(
            @RequestParam(value = "begin", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date begin,
            @RequestParam(value = "end", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end) {
        if (null == begin || null == end) {
            return Result.error(null);
        }
        if (begin.getTime() > end.getTime()) {
            Date tmp = end;
            begin = end;
            end = tmp;
        }
        return Result.OK(warningService.getAlarmAndWarnByTime(begin, end));
    }
}
src/main/java/com/yssh/controller/WeatherController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,90 @@
package com.yssh.controller;
import com.yssh.entity.Weather;
import com.yssh.service.WeatherService;
import com.yssh.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * @author wMeng
 * @ClassName YsshWeatherController
 * @Description TODO
 * @date 2022/10/30 13:21
 * @Version 1.0
 */
@Api(tags="天气")
@RestController
@RequestMapping("/weather")
@SuppressWarnings("rawtypes")
public class WeatherController {
    @Resource
    private WeatherService weatherService;
    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:00:00");
    @ApiOperation(value = "时间查询天气数据", notes = "根据开始时间及其结束时间查询天气详细信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "begin", value = "点位名称", required = true, type = "String"),
            @ApiImplicitParam(name = "end", value = "点位类型", required = true, type = "String"),
    })
    @GetMapping("/query/{begin}/{end}")
    public Result query(@PathVariable("begin") String begin, @PathVariable("end") String end) {
        List<Weather> data = new ArrayList<>();
        try {
            if (null != begin && begin.length() != 19) {
                begin = null;
            }
            if (null != end && end.length() != 19) {
                end = null;
            }
            if (null == begin && null == end) {
                begin = dateFormat.format(new Date());
            }
            data = weatherService.query(begin, end);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
        return Result.OK(data);
    }
    @GetMapping("/getAll")
    @ApiOperation(value = "查询所有天气数据", notes = "查询所有天气详细数据")
    public Result getAll() {
        List<Weather> list = weatherService.getAll();
        return Result.OK(list);
    }
    @PostMapping("/insert")
    @ApiOperation("插入数据")
    public Result insert(@RequestBody Weather ysshWeather) {
        int i = weatherService.insert(ysshWeather);
        if (i == 0) {
            return Result.error("插入失败");
        }
        return Result.OK("插入成功");
    }
    @ApiOperation("删除数据")
    @ApiImplicitParam(name = "id", value = "编号", required = true, type = "String")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") String id) {
        int i = weatherService.delete(id);
        if (i == 0) {
            return Result.error("删除失败");
        }
        return Result.OK("删除成功");
    }
}
src/main/java/com/yssh/entity/AlertConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
package com.yssh.entity;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@ApiModel(value = "告警配置数据",description = "告警配置数据")
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Data
public class AlertConfig implements Serializable {
    private static final long serialVersionUID = -7332928315187861105L;
    @ApiModelProperty(value = "主键")
    private Integer id;
    @ApiModelProperty(value = "监测预警值")
    private Double jcyj;
    @ApiModelProperty(value = "监测报警值")
    private Double jcbj;
    @ApiModelProperty(value = "排放预警值")
    private Double pfyj;
    @ApiModelProperty(value = "排放报警值")
    private Double pfbj;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Double getJcyj() {
        return jcyj;
    }
    public void setJcyj(Double jcyj) {
        this.jcyj = jcyj;
    }
    public Double getJcbj() {
        return jcbj;
    }
    public void setJcbj(Double jcbj) {
        this.jcbj = jcbj;
    }
    public Double getPfyj() {
        return pfyj;
    }
    public void setPfyj(Double pfyj) {
        this.pfyj = pfyj;
    }
    public Double getPfbj() {
        return pfbj;
    }
    public void setPfbj(Double pfbj) {
        this.pfbj = pfbj;
    }
}
src/main/java/com/yssh/entity/Coordinate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package com.yssh.entity;
/**
 * åæ ‡
 * @author WWW
 * @date 2023-06-18
 */
public class Coordinate {
    private double x;
    private double y;
    public Coordinate() {
    }
    public Coordinate(double x, double y) {
        this.x = x;
        this.y = y;
    }
    public double getX() {
        return x;
    }
    public void setX(double x) {
        this.x = x;
    }
    public double getY() {
        return y;
    }
    public void setY(double y) {
        this.y = y;
    }
}
src/main/java/com/yssh/entity/DictRecord.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,88 @@
package com.yssh.entity;
import java.io.Serializable;
import lombok.Data;
import lombok.ToString;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
/**
 * å­—典记录对象 yssh_dict_record
 *
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
@ToString
@Data
public class DictRecord implements Serializable {
    /**
     * @Fields field:field:{todo}(用一句话描述这个变量表示什么)
     */
    private static final long serialVersionUID = -3279329060924610189L;
    /**
     * ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * è¡¨åç§°
     */
    private String tableName;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    private Long createTime;
    /**
     * å¤‡æ³¨
     */
    private String remarks;
    public DictRecord() {
    }
    public DictRecord(Long id, String tableName, Long createTime, String remarks) {
        this.id = id;
        this.tableName = tableName;
        this.createTime = createTime;
        this.remarks = remarks;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getTableName() {
        return tableName;
    }
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    public Long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    public String getRemarks() {
        return remarks;
    }
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
}
src/main/java/com/yssh/entity/DistanceSuYuan.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,149 @@
package com.yssh.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yssh.utils.CalculateUtils;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class DistanceSuYuan implements Serializable, Comparable<DistanceSuYuan> {
    private static final long serialVersionUID = -115407591473808022L;
    private String name;
    private String vocsName;
    private double vocsValue;
    private String id;
    @JsonIgnore
    private Integer x;
    @JsonIgnore
    private Integer y;
    @JsonIgnore
    private double u;
    @JsonIgnore
    private double v;
    private double windSpeed;
    private double windDirection;
    private double lon;
    private double lat;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public double getLon() {
        return CalculateUtils.getLon(x, y);
    }
    public double getLat() {
        return CalculateUtils.getLat(x, y);
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getVocsName() {
        return vocsName;
    }
    public void setVocsName(String vocsName) {
        this.vocsName = vocsName;
    }
    public double getVocsValue() {
        return vocsValue;
    }
    public void setVocsValue(double vocsValue) {
        this.vocsValue = vocsValue;
    }
    public void setU(double u) {
        this.u = u;
    }
    public void setV(double v) {
        this.v = v;
    }
    public double getWindSpeed() {
        return new BigDecimal(CalculateUtils.getWindSpeed(v, u)).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }
    public double getWindDirection() {
        return new BigDecimal(CalculateUtils.getWindDirection(v, u)).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }
    @Override
    public int compareTo(DistanceSuYuan o) {
        if (vocsValue > o.getVocsValue()) {
            return -1;
        } else if (vocsValue == o.getVocsValue()) {
            return 0;
        }
        return 1;
    }
    public double getU() {
        return u;
    }
    public double getV() {
        return v;
    }
    public void setWindSpeed(double windSpeed) {
        this.windSpeed = windSpeed;
    }
    public void setWindDirection(double windDirection) {
        this.windDirection = windDirection;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public void setLat(double lat) {
        this.lat = lat;
    }
}
src/main/java/com/yssh/entity/Emission.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,85 @@
package com.yssh.entity;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "排放点点位",description = "排放点点位")
public class Emission implements Serializable{
    private static final long serialVersionUID = -6398611940241117240L;
    @ApiModelProperty(value = "主键")
    private int id;
    @ApiModelProperty(value = "点位名称")
    private String name;
    @ApiModelProperty(value = "经度")
    private double lon;
    @ApiModelProperty(value = "纬度")
    private float lat;
    @ApiModelProperty(value = "数值")
    private String value;
    @ApiModelProperty(value = "时间")
    private String time;
    @ApiModelProperty(value = "状态值")
    private int property;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public double getLon() {
        return lon;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public float getLat() {
        return lat;
    }
    public void setLat(float lat) {
        this.lat = lat;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public int getProperty() {
        return property;
    }
    public void setProperty(int property) {
        this.property = property;
    }
}
src/main/java/com/yssh/entity/ExpPoint.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,144 @@
package com.yssh.entity;
import java.util.Date;
import lombok.Data;
@Data
public class ExpPoint {
    private Long id;
    private String expSiteNumber;
    private String expPointType;
    private double ordinateX;
    private double abscissaY;
    private double elevation;
    private double explorationDepth;
    private Date expStartDate;
    private Date expEndDate;
    private double groundwaterDepth;
    private String waveSpeedInstrument;
    private String waveVelocityMethod;
    private String waveVelocityExcitationDistance;
    private String waterDepth;
    private int isParticipate;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getExpSiteNumber() {
        return expSiteNumber;
    }
    public void setExpSiteNumber(String expSiteNumber) {
        this.expSiteNumber = expSiteNumber;
    }
    public String getExpPointType() {
        return expPointType;
    }
    public void setExpPointType(String expPointType) {
        this.expPointType = expPointType;
    }
    public double getOrdinateX() {
        return ordinateX;
    }
    public void setOrdinateX(double ordinateX) {
        this.ordinateX = ordinateX;
    }
    public double getAbscissaY() {
        return abscissaY;
    }
    public void setAbscissaY(double abscissaY) {
        this.abscissaY = abscissaY;
    }
    public double getElevation() {
        return elevation;
    }
    public void setElevation(double elevation) {
        this.elevation = elevation;
    }
    public double getExplorationDepth() {
        return explorationDepth;
    }
    public void setExplorationDepth(double explorationDepth) {
        this.explorationDepth = explorationDepth;
    }
    public Date getExpStartDate() {
        return expStartDate;
    }
    public void setExpStartDate(Date expStartDate) {
        this.expStartDate = expStartDate;
    }
    public Date getExpEndDate() {
        return expEndDate;
    }
    public void setExpEndDate(Date expEndDate) {
        this.expEndDate = expEndDate;
    }
    public double getGroundwaterDepth() {
        return groundwaterDepth;
    }
    public void setGroundwaterDepth(double groundwaterDepth) {
        this.groundwaterDepth = groundwaterDepth;
    }
    public String getWaveSpeedInstrument() {
        return waveSpeedInstrument;
    }
    public void setWaveSpeedInstrument(String waveSpeedInstrument) {
        this.waveSpeedInstrument = waveSpeedInstrument;
    }
    public String getWaveVelocityMethod() {
        return waveVelocityMethod;
    }
    public void setWaveVelocityMethod(String waveVelocityMethod) {
        this.waveVelocityMethod = waveVelocityMethod;
    }
    public String getWaveVelocityExcitationDistance() {
        return waveVelocityExcitationDistance;
    }
    public void setWaveVelocityExcitationDistance(String waveVelocityExcitationDistance) {
        this.waveVelocityExcitationDistance = waveVelocityExcitationDistance;
    }
    public String getWaterDepth() {
        return waterDepth;
    }
    public void setWaterDepth(String waterDepth) {
        this.waterDepth = waterDepth;
    }
    public int getIsParticipate() {
        return isParticipate;
    }
    public void setIsParticipate(int isParticipate) {
        this.isParticipate = isParticipate;
    }
}
src/main/java/com/yssh/entity/FeedbackDetail.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,136 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@ToString
@Data
@ApiModel(value = "溯源反馈",description = "溯源反馈")
public class FeedbackDetail implements Serializable{
    public FeedbackDetail() {
    }
    public FeedbackDetail(Long id, String tableName, String locationName, String detectionId, String detectionVocsName, Double detectionValue, String practicalId, String practicalVocsName, Double practicalValue, Date createTime) {
        this.id = id;
        this.tableName = tableName;
        this.locationName = locationName;
        this.detectionId = detectionId;
        this.detectionVocsName = detectionVocsName;
        this.detectionValue = detectionValue;
        this.practicalId = practicalId;
        this.practicalVocsName = practicalVocsName;
        this.practicalValue = practicalValue;
        this.createTime = createTime;
    }
    private static final long serialVersionUID = 6877008992053903605L;
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "表名")
    private String tableName;
    @ApiModelProperty(value = "点位名称")
    private String locationName;
    @ApiModelProperty(value = "检测编号")
    private String detectionId;
    @ApiModelProperty(value = "检测vocs名称")
    private String detectionVocsName;
    @ApiModelProperty(value = "检测值")
    private Double detectionValue;
    @ApiModelProperty(value = "实际编号")
    private String practicalId;
    @ApiModelProperty(value = "实际vocs名称")
    private String practicalVocsName;
    @ApiModelProperty(value = "实际值")
    private Double practicalValue;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getTableName() {
        return tableName;
    }
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    public String getLocationName() {
        return locationName;
    }
    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }
    public String getDetectionId() {
        return detectionId;
    }
    public void setDetectionId(String detectionId) {
        this.detectionId = detectionId;
    }
    public String getDetectionVocsName() {
        return detectionVocsName;
    }
    public void setDetectionVocsName(String detectionVocsName) {
        this.detectionVocsName = detectionVocsName;
    }
    public Double getDetectionValue() {
        return detectionValue;
    }
    public void setDetectionValue(Double detectionValue) {
        this.detectionValue = detectionValue;
    }
    public String getPracticalId() {
        return practicalId;
    }
    public void setPracticalId(String practicalId) {
        this.practicalId = practicalId;
    }
    public String getPracticalVocsName() {
        return practicalVocsName;
    }
    public void setPracticalVocsName(String practicalVocsName) {
        this.practicalVocsName = practicalVocsName;
    }
    public Double getPracticalValue() {
        return practicalValue;
    }
    public void setPracticalValue(Double practicalValue) {
        this.practicalValue = practicalValue;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/yssh/entity/ForecastAnalyseVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@ToString
@ApiModel(value="预测分析展示对象", description="预测分析展示对象")
@Data
public class ForecastAnalyseVo {
    public ForecastAnalyseVo() {
    }
    public ForecastAnalyseVo(Double forecastValue, Double practicalValue, Long time) {
        this.forecastValue = forecastValue;
        this.practicalValue = practicalValue;
        this.time = time;
    }
    @ApiModelProperty(value = "预测值")
    private Double forecastValue;
    @ApiModelProperty(value = "实际值")
    private Double practicalValue;
    @ApiModelProperty(value = "时间")
    private Long time;
    public Double getForecastValue() {
        return forecastValue;
    }
    public void setForecastValue(Double forecastValue) {
        this.forecastValue = forecastValue;
    }
    public Double getPracticalValue() {
        return practicalValue;
    }
    public void setPracticalValue(Double practicalValue) {
        this.practicalValue = practicalValue;
    }
    public Long getTime() {
        return time;
    }
    public void setTime(Long time) {
        this.time = time;
    }
}
src/main/java/com/yssh/entity/Location.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
package com.yssh.entity;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * åŽ‚åŒºçƒ­ç‚¹ç‚¹ä½
 * @author wMeng
 * @date 2022/10/30 13:16
 * @version 1.0
 */
@Data
@ApiModel(value = "厂区热点点位",description = "厂区热点点位")
public class Location implements Serializable {
    private static final long serialVersionUID = -2728687771987124891L;
    @ApiModelProperty(value = "主键")
    private int id;
    @ApiModelProperty(value = "点位名称")
    private String name;
    @ApiModelProperty(value = "点位类型")
    private String type;
    @ApiModelProperty(value = "点位经度")
    private double lon;
    @ApiModelProperty(value = "点位纬度")
    private double lat;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public double getLon() {
        return lon;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public double getLat() {
        return lat;
    }
    public void setLat(double lat) {
        this.lat = lat;
    }
}
src/main/java/com/yssh/entity/MonitorPointPosition.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="监测点位对象", description="监测点位对象")
public class MonitorPointPosition implements Serializable {
    private static final long serialVersionUID = -7054999641619312155L;
    private String id;
    @ApiModelProperty(value = "点位名称")
    private String name;
    private Integer x;
    private Integer y;
    private Integer z;
    @ApiModelProperty(value = "经度")
    private Double lon;
    @ApiModelProperty(value = "纬度")
    private Double lat;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public Integer getZ() {
        return z;
    }
    public void setZ(Integer z) {
        this.z = z;
    }
    public Double getLon() {
        return lon;
    }
    public void setLon(Double lon) {
        this.lon = lon;
    }
    public Double getLat() {
        return lat;
    }
    public void setLat(Double lat) {
        this.lat = lat;
    }
}
src/main/java/com/yssh/entity/Qxsh.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author WWW
 * @date 2023-05-18
 * qxsh
 */
@Data
@ApiModel(value = "Qxsh",description = "Qxsh")
public class Qxsh {
    @ApiModelProperty(value = "主键")
    private Integer id;
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "经度")
    private Double lon;
    @ApiModelProperty(value = "纬度")
    private Double lat;
    @ApiModelProperty(value = "数值")
    private Double value;
    @ApiModelProperty(value = "时间")
    private String time;
    public Qxsh() {
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Double getLon() {
        return lon;
    }
    public void setLon(Double lon) {
        this.lon = lon;
    }
    public Double getLat() {
        return lat;
    }
    public void setLat(Double lat) {
        this.lat = lat;
    }
    public Double getValue() {
        return value;
    }
    public void setValue(Double value) {
        this.value = value;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
}
src/main/java/com/yssh/entity/Report.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,199 @@
package com.yssh.entity;
import com.yssh.utils.CalculateUtils;
import io.swagger.annotations.ApiModelProperty;
/**
 * æŠ¥å‘Š
 * @author WWW
 * @date 2023-06-18
 */
public class Report {
    @ApiModelProperty(value = "溯源ID")
    private String id;
    @ApiModelProperty(value = "点位名称")
    private String name;
    @ApiModelProperty(value = "经度")
    private double lon;
    @ApiModelProperty(value = "纬度")
    private double lat;
    @ApiModelProperty(value = "数值")
    private double val;
    @ApiModelProperty(value = "去年数值")
    private Double lastVal;
    @ApiModelProperty(value = "时间")
    private String time;
    @ApiModelProperty(value = "风速")
    private double speed;
    @ApiModelProperty(value = "方向")
    private String dir;
    @ApiModelProperty(value = "500m范围最大值")
    private double maxVal;
    @ApiModelProperty(value = "距离")
    private double dis;
    @ApiModelProperty(value = "500m范围最大值的风向")
    private String maxDir;
    @ApiModelProperty(value = "是否一致")
    private int isSame;
    public Report() {
    }
    public Report(String id, String name, double lon, double lat, double val, String time, double speed, String dir, double maxVal, double dis, String maxDir, int isSame) {
        this.id = id;
        this.name = name;
        this.lon = lon;
        this.lat = lat;
        this.val = val;
        this.time = time;
        this.speed = speed;
        this.dir = dir;
        this.maxVal = maxVal;
        this.dis = dis;
        this.maxDir = maxDir;
        this.isSame = isSame;
    }
    /**
     * è®¡ç®—生成报告
     */
    public static Report calcReport(WarningDetail wd, DistanceSuYuan suYuan, DistanceSuYuan suMax) {
        Coordinate c1 = CalculateUtils.getCoordinate(suYuan);
        Coordinate c2 = CalculateUtils.getCoordinate(suMax);
        String time = wd.getTableName().replace("su_yuan_", "");
        double speed1 = CalculateUtils.round2(CalculateUtils.getWindSpeed(suYuan.getV(), suYuan.getU()));
        double direction1 = CalculateUtils.getWindDirection(suYuan.getV(), suYuan.getU());
        String dir = CalculateUtils.getDir(direction1);
        double maxVal = suMax.getVocsValue();
        //double dis = CalculateUtils.getDistance2(c1.getX(), c1.getY(), c2.getX(), c2.getY());
        double dis1 = CalculateUtils.getDistance1(c1.getX(), c1.getY(), c2.getX(), c2.getY());
        double angle = CalculateUtils.getAngle2(c1.getX(), c1.getY(), c2.getX(), c2.getY());
        double speed2 = CalculateUtils.getWindSpeed(suMax.getV(), suMax.getU());
        double direction2 = CalculateUtils.getWindDirection(suMax.getV(), suMax.getU());
        String maxDir = CalculateUtils.getDir(direction2); // CalculateUtils.getDir(angle);
        int isSame = (Math.abs(direction1 - direction2) <= 45 && Math.abs(speed1 - speed2) <= 0.5) ? 1 : 0;
        return new Report(wd.getSuYuanId(), wd.getLocationName(), c1.getX(), c1.getY(), wd.getValue(), time,
                speed1, dir, maxVal, dis1, maxDir, isSame);
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public double getLon() {
        return lon;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public double getLat() {
        return lat;
    }
    public void setLat(double lat) {
        this.lat = lat;
    }
    public double getVal() {
        return val;
    }
    public void setVal(double val) {
        this.val = val;
    }
    public Double getLastVal() {
        return lastVal;
    }
    public void setLastVal(Double lastVal) {
        this.lastVal = lastVal;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public double getSpeed() {
        return speed;
    }
    public void setSpeed(double speed) {
        this.speed = speed;
    }
    public String getDir() {
        return dir;
    }
    public void setDir(String dir) {
        this.dir = dir;
    }
    public double getMaxVal() {
        return maxVal;
    }
    public void setMaxVal(double maxVal) {
        this.maxVal = maxVal;
    }
    public double getDis() {
        return dis;
    }
    public void setDis(double dis) {
        this.dis = dis;
    }
    public String getMaxDir() {
        return maxDir;
    }
    public void setMaxDir(String maxDir) {
        this.maxDir = maxDir;
    }
    public int getIsSame() {
        return isSame;
    }
    public void setIsSame(int isSame) {
        this.isSame = isSame;
    }
}
src/main/java/com/yssh/entity/Stratum.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
package com.yssh.entity;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class Stratum {
    private Long id;
    private String expSiteNumber;
    private Integer primaryLayerNumber;
    private Integer sublayerNumber;
    private String geologicalEra;
    private String geologicalGenesis;
    private Double layerDepth;
    private String geotechnicalName;
    private String geotechnicalCategory;
    private String description;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getExpSiteNumber() {
        return expSiteNumber;
    }
    public void setExpSiteNumber(String expSiteNumber) {
        this.expSiteNumber = expSiteNumber;
    }
    public Integer getPrimaryLayerNumber() {
        return primaryLayerNumber;
    }
    public void setPrimaryLayerNumber(Integer primaryLayerNumber) {
        this.primaryLayerNumber = primaryLayerNumber;
    }
    public Integer getSublayerNumber() {
        return sublayerNumber;
    }
    public void setSublayerNumber(Integer sublayerNumber) {
        this.sublayerNumber = sublayerNumber;
    }
    public String getGeologicalEra() {
        return geologicalEra;
    }
    public void setGeologicalEra(String geologicalEra) {
        this.geologicalEra = geologicalEra;
    }
    public String getGeologicalGenesis() {
        return geologicalGenesis;
    }
    public void setGeologicalGenesis(String geologicalGenesis) {
        this.geologicalGenesis = geologicalGenesis;
    }
    public Double getLayerDepth() {
        return layerDepth;
    }
    public void setLayerDepth(Double layerDepth) {
        this.layerDepth = layerDepth;
    }
    public String getGeotechnicalName() {
        return geotechnicalName;
    }
    public void setGeotechnicalName(String geotechnicalName) {
        this.geotechnicalName = geotechnicalName;
    }
    public String getGeotechnicalCategory() {
        return geotechnicalCategory;
    }
    public void setGeotechnicalCategory(String geotechnicalCategory) {
        this.geotechnicalCategory = geotechnicalCategory;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
}
src/main/java/com/yssh/entity/SuYuan.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
package com.yssh.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.github.biyanwen.annotation.CsvProperty;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SuYuan implements Serializable {
    private static final long serialVersionUID = 2004641202487367361L;
    private String id;
    @CsvProperty(index = 0)
    private Integer x;
    @CsvProperty(index = 1)
    private Integer y;
    @CsvProperty(index = 2)
    private Integer z;
    @CsvProperty(index = 3)
    private Double u;
    @CsvProperty(index = 4)
    private Double v;
    @CsvProperty(index = 5)
    private Double w;
    @CsvProperty(index = 6)
    private Double c;
    /*private Double lon;
    private Double lat;
    private Date time;*/
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public Integer getZ() {
        return z;
    }
    public void setZ(Integer z) {
        this.z = z;
    }
    public Double getU() {
        return u;
    }
    public void setU(Double u) {
        this.u = u;
    }
    public Double getV() {
        return v;
    }
    public void setV(Double v) {
        this.v = v;
    }
    public Double getW() {
        return w;
    }
    public void setW(Double w) {
        this.w = w;
    }
    public Double getC() {
        return c;
    }
    public void setC(Double c) {
        this.c = c;
    }
}
src/main/java/com/yssh/entity/SuYuan2d.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yssh.utils.CalculateUtils;
import lombok.ToString;
@ToString
@ApiModel(value="溯源2d对象", description="溯源2d对象")
public class SuYuan2d implements Serializable {
    private static final long serialVersionUID = -4652224366972823014L;
    @ApiModelProperty(value = "主键")
    private String id;
    @JsonIgnore
    private Integer x;
    @JsonIgnore
    private Integer y;
    @ApiModelProperty(value = "经度")
    private double lon;
    @ApiModelProperty(value = "纬度")
    private double lat;
    @ApiModelProperty(value = "数值")
    private double value;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public double getLon() {
        return CalculateUtils.getLon(x, y);
    }
    public double getLat() {
        return CalculateUtils.getLat(x, y);
    }
    public double getValue() {
        return value;
    }
    public void setValue(double value) {
        this.value = value;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public void setLat(double lat) {
        this.lat = lat;
    }
}
src/main/java/com/yssh/entity/SuYuan3d.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,131 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yssh.utils.CalculateUtils;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.ToString;
@NoArgsConstructor
@AllArgsConstructor
@ToString
@ApiModel(value = "3d数据",description = "3d数据")
public class SuYuan3d implements Serializable{
    /**
     * @Fields field:field:{todo}(用一句话描述这个变量表示什么)
     */
    private static final long serialVersionUID = 5955771070977977633L;
    @ApiModelProperty(value = "主键")
    private String id;
    @JsonIgnore
    private Integer x;
    @JsonIgnore
    private Integer y;
    @ApiModelProperty(value = "经度")
    private double lon;
    @ApiModelProperty(value = "纬度")
    private double lat;
    private double height0 = 0.0;
    private double height10 = 0.0;
    private double height20 = 0.0;
    private double height30 = 0.0;
    private double height40 = 0.0;
    private double height50 = 0.0;
    private double height60 = 0.0;
    private double height70 = 0.0;
    private double height80 = 0.0;
    private double height90 = 0.0;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public double getLon() {
        return CalculateUtils.getLon(x, y);
    }
    public double getLat() {
        return CalculateUtils.getLat(x, y);
    }
    public double getHeight0() {
        return height0;
    }
    public void setHeight0(double height0) {
        this.height0 = height0;
    }
    public double getHeight10() {
        return height10;
    }
    public void setHeight10(double height10) {
        this.height10 = height10;
    }
    public double getHeight20() {
        return height20;
    }
    public void setHeight20(double height20) {
        this.height20 = height20;
    }
    public double getHeight30() {
        return height30;
    }
    public void setHeight30(double height30) {
        this.height30 = height30;
    }
    public double getHeight40() {
        return height40;
    }
    public void setHeight40(double height40) {
        this.height40 = height40;
    }
    public double getHeight50() {
        return height50;
    }
    public void setHeight50(double height50) {
        this.height50 = height50;
    }
    public double getHeight60() {
        return height60;
    }
    public void setHeight60(double height60) {
        this.height60 = height60;
    }
    public double getHeight70() {
        return height70;
    }
    public void setHeight70(double height70) {
        this.height70 = height70;
    }
    public double getHeight80() {
        return height80;
    }
    public void setHeight80(double height80) {
        this.height80 = height80;
    }
    public double getHeight90() {
        return height90;
    }
    public void setHeight90(double height90) {
        this.height90 = height90;
    }
}
src/main/java/com/yssh/entity/SuYuan700.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,187 @@
package com.yssh.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * æº¯æº700表
 * @author www
 * @date 2023-06-23
 */
@Data
public class SuYuan700 implements Serializable {
    private static final long serialVersionUID = 2023062302487367361L;
    @ApiModelProperty(value = "主键ID")
    private Long id;
    @ApiModelProperty(value = "溯源ID")
    private String suYuanId;
    @ApiModelProperty(value = "地址1")
    private String addr1;
    @ApiModelProperty(value = "概率1")
    private Double odds1;
    @ApiModelProperty(value = "X1")
    private Double x1;
    @ApiModelProperty(value = "Y1")
    private Double y1;
    @ApiModelProperty(value = "地址2")
    private String addr2;
    @ApiModelProperty(value = "概率2")
    private Double odds2;
    @ApiModelProperty(value = "X2")
    private Double x2;
    @ApiModelProperty(value = "Y2")
    private Double y2;
    @ApiModelProperty(value = "地址3")
    private String addr3;
    @ApiModelProperty(value = "概率3")
    private Double odds3;
    @ApiModelProperty(value = "X3")
    private Double x3;
    @ApiModelProperty(value = "Y3")
    private Double y3;
    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    public SuYuan700() {
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getSuYuanId() {
        return suYuanId;
    }
    public void setSuYuanId(String suYuanId) {
        this.suYuanId = suYuanId;
    }
    public String getAddr1() {
        return addr1;
    }
    public void setAddr1(String addr1) {
        this.addr1 = addr1;
    }
    public Double getOdds1() {
        return odds1;
    }
    public void setOdds1(Double odds1) {
        this.odds1 = odds1;
    }
    public Double getX1() {
        return x1;
    }
    public void setX1(Double x1) {
        this.x1 = x1;
    }
    public Double getY1() {
        return y1;
    }
    public void setY1(Double y1) {
        this.y1 = y1;
    }
    public String getAddr2() {
        return addr2;
    }
    public void setAddr2(String addr2) {
        this.addr2 = addr2;
    }
    public Double getOdds2() {
        return odds2;
    }
    public void setOdds2(Double odds2) {
        this.odds2 = odds2;
    }
    public Double getX2() {
        return x2;
    }
    public void setX2(Double x2) {
        this.x2 = x2;
    }
    public Double getY2() {
        return y2;
    }
    public void setY2(Double y2) {
        this.y2 = y2;
    }
    public String getAddr3() {
        return addr3;
    }
    public void setAddr3(String addr3) {
        this.addr3 = addr3;
    }
    public Double getOdds3() {
        return odds3;
    }
    public void setOdds3(Double odds3) {
        this.odds3 = odds3;
    }
    public Double getX3() {
        return x3;
    }
    public void setX3(Double x3) {
        this.x3 = x3;
    }
    public Double getY3() {
        return y3;
    }
    public void setY3(Double y3) {
        this.y3 = y3;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/yssh/entity/SuYuanMonitorData.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
package com.yssh.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "溯源监测数据",description = "溯源监测数据")
public class SuYuanMonitorData implements Serializable{
    private static final long serialVersionUID = -7472189043893753483L;
    @ApiModelProperty(value = "主键")
    private String id;
    @ApiModelProperty(value = "数值")
    private Double value;
    @ApiModelProperty(value = "时间")
    private Integer time;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public Double getValue() {
        return value;
    }
    public void setValue(Double value) {
        this.value = value;
    }
    public Integer getTime() {
        return time;
    }
    public void setTime(Integer time) {
        this.time = time;
    }
}
src/main/java/com/yssh/entity/Temporary.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,105 @@
package com.yssh.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import com.github.biyanwen.annotation.CsvProperty;
import com.yssh.utils.CalculateUtils;
@NoArgsConstructor
@AllArgsConstructor
public class Temporary implements Serializable {
    private static final long serialVersionUID = 8801687493177033295L;
    private Integer x;
    private Integer y;
    @CsvProperty(index = 0)
    private Double lon;
    @CsvProperty(index = 1)
    private Double lat;
    @CsvProperty(index = 2)
    private Integer z;
    @CsvProperty(index = 3)
    private Double u;
    @CsvProperty(index = 4)
    private Double v;
    @CsvProperty(index = 5)
    private Double w;
    @CsvProperty(index = 6)
    private Double c;
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public Integer getZ() {
        return z;
    }
    public void setZ(Integer z) {
        this.z = z;
    }
    public double getLon() {
        return CalculateUtils.getLon(x, y);
    }
    public double getLat() {
        return CalculateUtils.getLat(x, y);
    }
    public Double getU() {
        return u;
    }
    public void setU(Double u) {
        this.u = u;
    }
    public Double getV() {
        return v;
    }
    public void setV(Double v) {
        this.v = v;
    }
    public Double getW() {
        return w;
    }
    public void setW(Double w) {
        this.w = w;
    }
    public Double getC() {
        return c;
    }
    public void setC(Double c) {
        this.c = c;
    }
    public void setLon(Double lon) {
        this.lon = lon;
    }
    public void setLat(Double lat) {
        this.lat = lat;
    }
}
src/main/java/com/yssh/entity/ThuAccuracy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@
package com.yssh.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ThuAccuracy implements Serializable{
    private static final long serialVersionUID = 3859561604842988730L;
    private int id;
    private String name;
    private float lon;
    private float lat;
    private String value;
    private String time;
    private int property;
    private String wg100;
    private String wg200;
    private String wg300;
    private String wg500;
    private Double accuracy;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public float getLon() {
        return lon;
    }
    public void setLon(float lon) {
        this.lon = lon;
    }
    public float getLat() {
        return lat;
    }
    public void setLat(float lat) {
        this.lat = lat;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public int getProperty() {
        return property;
    }
    public void setProperty(int property) {
        this.property = property;
    }
    public String getWg100() {
        return wg100;
    }
    public void setWg100(String wg100) {
        this.wg100 = wg100;
    }
    public String getWg200() {
        return wg200;
    }
    public void setWg200(String wg200) {
        this.wg200 = wg200;
    }
    public String getWg300() {
        return wg300;
    }
    public void setWg300(String wg300) {
        this.wg300 = wg300;
    }
    public String getWg500() {
        return wg500;
    }
    public void setWg500(String wg500) {
        this.wg500 = wg500;
    }
    public Double getAccuracy() {
        return accuracy;
    }
    public void setAccuracy(Double accuracy) {
        this.accuracy = accuracy;
    }
}
src/main/java/com/yssh/entity/VocCoords.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.yssh.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.biyanwen.annotation.CsvProperty;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class VocCoords implements Serializable {
    private static final long serialVersionUID = -20230606150000000L;
    @JsonIgnore
    @ApiModelProperty(value = "主键")
    private Integer id;
    @CsvProperty(index = 0)
    @ApiModelProperty(value = "X")
    private Integer x;
    @CsvProperty(index = 1)
    @ApiModelProperty(value = "Y")
    private Integer y;
    @CsvProperty(index = 2)
    @ApiModelProperty(value = "地址")
    private String addr;
    public VocCoords() {
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public String getAddr() {
        return addr;
    }
    public void setAddr(String addr) {
        this.addr = addr;
    }
}
src/main/java/com/yssh/entity/VocVals.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
package com.yssh.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.biyanwen.annotation.CsvProperty;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
public class VocVals implements Serializable {
    private static final long serialVersionUID = -20230605145412000L;
    @JsonIgnore
    @ApiModelProperty(value = "主键")
    private BigInteger id;
    @ApiModelProperty(value = "溯源ID")
    private String suYuanId;
    @CsvProperty(index = 0)
    @ApiModelProperty(value = "X")
    private Integer x;
    @CsvProperty(index = 1)
    @ApiModelProperty(value = "Y")
    private Integer y;
    @CsvProperty(index = 2)
    @ApiModelProperty(value = "值")
    private Double val;
    @JsonIgnore
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "地址")
    private String addr;
    public VocVals() {
    }
    public BigInteger getId() {
        return id;
    }
    public void setId(BigInteger id) {
        this.id = id;
    }
    public String getSuYuanId() {
        return x + "_" + y + "_0";
    }
    public Integer getX() {
        return x;
    }
    public void setX(Integer x) {
        this.x = x;
    }
    public Integer getY() {
        return y;
    }
    public void setY(Integer y) {
        this.y = y;
    }
    public Double getVal() {
        return val;
    }
    public void setVal(Double val) {
        this.val = val;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getAddr() {
        return addr;
    }
    public void setAddr(String addr) {
        this.addr = addr;
    }
}
src/main/java/com/yssh/entity/WarningDetail.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,101 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
@ApiModel(value="报警/预警对象", description="报警/预警对象")
public class WarningDetail implements Serializable {
    public WarningDetail() {
    }
    public WarningDetail(Long id, String tableName, String suYuanId, String locationName, Date createTime, Integer type, Double value) {
        this.id = id;
        this.tableName = tableName;
        this.suYuanId = suYuanId;
        this.locationName = locationName;
        this.createTime = createTime;
        this.type = type;
        this.value = value;
    }
    private static final long serialVersionUID = 1610250573910282005L;
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "溯源数据表名")
    private String tableName;
    @ApiModelProperty(value = "溯源数据编号")
    private String suYuanId;
    @ApiModelProperty(value = "点位名称")
    private String locationName;
    ;
    @ApiModelProperty(value = "时间")
    private Date createTime;
    @ApiModelProperty(value = "类型")
    private Integer type;
    @ApiModelProperty(value = "数值")
    private Double value;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getTableName() {
        return tableName;
    }
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    public String getSuYuanId() {
        return suYuanId;
    }
    public void setSuYuanId(String suYuanId) {
        this.suYuanId = suYuanId;
    }
    public String getLocationName() {
        return locationName;
    }
    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public Double getValue() {
        return value;
    }
    public void setValue(Double value) {
        this.value = value;
    }
}
src/main/java/com/yssh/entity/WarningVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,95 @@
package com.yssh.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.ToString;
import com.yssh.utils.CalculateUtils;
@ToString
@ApiModel(value="报警/预警展示对象", description="报警/预警展示对象")
public class WarningVo implements Serializable {
    public WarningVo() {
    }
    public WarningVo(String locationName, String suYuanId, double lon, double lat, double value, String time) {
        this.locationName = locationName;
        this.suYuanId = suYuanId;
        this.lon = lon;
        this.lat = lat;
        this.value = value;
        this.time = time;
    }
    private static final long serialVersionUID = 3440478664982471286L;
    @ApiModelProperty(value = "点位名称")
    private String locationName;
    //@JsonIgnore
    private String suYuanId;
    @ApiModelProperty(value = "经度")
    private double lon;
    @ApiModelProperty(value = "纬度")
    private double lat;
    @ApiModelProperty(value = "数值")
    private double value;
    @ApiModelProperty(value = "时间")
    private String time;
    public String getLocationName() {
        return locationName;
    }
    public void setLocationName(String locationName) {
        this.locationName = locationName;
    }
    public void setSuYuanId(String suYuanId) {
        this.suYuanId = suYuanId;
    }
    public double getLon() {
        String[] split = suYuanId.split("_");
        return CalculateUtils.getLon(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
    }
    public double getLat() {
        String[] split = suYuanId.split("_");
        return CalculateUtils.getLat(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
    }
    public double getValue() {
        return value;
    }
    public void setValue(double value) {
        this.value = value;
    }
    public String getSuYuanId() {
        return suYuanId;
    }
    public void setLon(double lon) {
        this.lon = lon;
    }
    public void setLat(double lat) {
        this.lat = lat;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
}
src/main/java/com/yssh/entity/Weather.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.yssh.entity;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * @author wMeng
 * @ClassName YsshWeather
 * @Description å¤©æ°”数据
 * @date 2022/10/30 13:18
 * @Version 1.0
 */
@Data
@ApiModel(value = "天气数据",description = "天气数据")
public class Weather {
    @ApiModelProperty(value = "主键")
    private int id;
    @ApiModelProperty(value = "时间")
    private String time;
    @ApiModelProperty(value = "风速")
    private String windSpeed;
    @ApiModelProperty(value = "风向")
    private String windDirection;
    @ApiModelProperty(value = "天气状况")
    private String weatherCondition;
    @ApiModelProperty(value = "气温")
    private String temperature;
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public String getWindSpeed() {
        return windSpeed;
    }
    public void setWindSpeed(String windSpeed) {
        this.windSpeed = windSpeed;
    }
    public String getWindDirection() {
        return windDirection;
    }
    public void setWindDirection(String windDirection) {
        this.windDirection = windDirection;
    }
    public String getWeatherCondition() {
        return weatherCondition;
    }
    public void setWeatherCondition(String weatherCondition) {
        this.weatherCondition = weatherCondition;
    }
    public String getTemperature() {
        return temperature;
    }
    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }
}
src/main/java/com/yssh/mapper/AlertConfigMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.yssh.mapper;
import java.util.List;
import com.yssh.entity.AlertConfig;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AlertConfigMapper {
    List<AlertConfig> query(Integer id);
    List<AlertConfig> getAll();
    String getAlert();
    int update(AlertConfig alert);
    int insert(AlertConfig alert);
    int delete(Integer id);
}
src/main/java/com/yssh/mapper/BaseMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.yssh.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface BaseMapper {
    <T> int batchInsert(@Param("tableName") String tableName, @Param("datas") List<T> datas);
}
src/main/java/com/yssh/mapper/CommonMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.mapper;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * @ClassName: CommonMapper
 * @Description: é€šç”¨çš„mapper
 * @author zhangtengfei
 * @date 2023å¹´2月27日下午2:27:55
 */
@Mapper
public interface CommonMapper{
    /**
     * ä½¿ç”¨information_schema检查表是否存在
     * @param tableSchema
     * @param tableName
     * @return
     */
    Integer checkTableExistsWithSchema(@Param("tableSchema")String tableSchema, @Param("tableName")String tableName);
    /**
     * ä½¿ç”¨show tables检查表是否存在
     * @param tableName
     * @return
     */
    Map<String, String> checkTableExistsWithShow(@Param("tableName")String tableName);
}
src/main/java/com/yssh/mapper/DictRecordMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package com.yssh.mapper;
import java.util.List;
import com.yssh.entity.DictRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * å­—典记录Mapper接口
 *
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
@Mapper
public interface DictRecordMapper {
    /**
     * æŸ¥è¯¢å­—典记录列表
     * @param dictRecord å­—典记录
     * @return å­—典记录集合
     */
    public List<DictRecord> selectDictRecordList(DictRecord dictRecord);
    public List<DictRecord> selectByTimeDictRecordList(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
    public DictRecord selectByCreateTime(Long createTime);
    public List<DictRecord> selectByTime(String start, String end);
    /**
     * æ–°å¢žå­—典记录
     * @param dictRecord å­—典记录
     * @return ç»“æžœ
     */
    public int insertDictRecord(DictRecord dictRecord);
    /**
     * åˆ é™¤å­—典记录
     * @param id å­—典记录ID
     * @return ç»“æžœ
     */
    public int deleteDictRecordById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤å­—典记录
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ID
     * @return ç»“æžœ
     */
    public int deleteDictRecordByIds(Long[] ids);
    /**
     * åˆ›å»ºå­—典记录表接口
     */
    public int createDictRecoTable();
}
src/main/java/com/yssh/mapper/EmissionMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.yssh.mapper;
import java.util.List;
import com.yssh.entity.Emission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * @author wMeng
 * @ClassName YsshQxshMapper
 * @Description TODO
 * @date 2022/10/31 14:45
 * @Version 1.0
 */
@Mapper
public interface EmissionMapper {
    List<Emission> query(@Param("name") String name);
    List<Emission> getAll();
    int insert(Emission emission);
    int delete(String id);
}
src/main/java/com/yssh/mapper/ExpPointMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.yssh.mapper;
import java.util.List;
import com.yssh.entity.ExpPoint;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ExpPointMapper {
    List<ExpPoint> selectList();
    List<ExpPoint> selectByExpSiteNumbers(@Param("expSiteNumbers") List<String> expSiteNumbers);
}
src/main/java/com/yssh/mapper/FeedbackMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.yssh.mapper;
import com.yssh.entity.FeedbackDetail;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FeedbackMapper {
    int insert(FeedbackDetail feedbackDetail);
    FeedbackDetail selectById(Long id);
    int update(FeedbackDetail feedbackDetail);
    Double selectSevenDayAccuracyAvg(Long beginTime);
}
src/main/java/com/yssh/mapper/LocationMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.yssh.mapper;
import com.yssh.entity.Location;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author wMeng
 * @date 2022/10/30 13:37
 * @version 1.0
 */
@Mapper
public interface LocationMapper {
    List<Location> query(@Param("name") String name, @Param("type") String type);
    List<Location> getAll();
    int insertLocation(Location ysshLocation);
    int deleteLocation(String id);
    List<Location> selectByXY(@Param("x") double x, @Param("y") double y);
    List<Location> selectVocAddrs();
}
src/main/java/com/yssh/mapper/QxshMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.yssh.mapper;
import com.yssh.entity.Qxsh;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author WWW
 * @date 2023-05-18
 * QxshMapper
 */
@Mapper
public interface QxshMapper {
    public List<Qxsh> selectByTime(String time);
    public List<Qxsh> selectMonthTop10(String time);
    public List<Qxsh> select3Hours(@Param("times") List<String> times);
}
src/main/java/com/yssh/mapper/StratumMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.yssh.mapper;
import java.util.List;
import java.util.Map;
import com.yssh.entity.Stratum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface StratumMapper {
    //@Param("expSiteNumber") String expSiteNumber, @Param("begin") Integer begin, @Param("end") Integer end
    List<Stratum> select(Map<String, Object> param);
    List<Stratum> selectByExpSiteNumbers(@Param("expSiteNumbers") List<String> expSiteNumbers);
    //@Param("expSiteNumber") String expSiteNumber, @Param("geotechnicalName") String geotechnicalName
    Stratum selectByGeotechnicalName(Map<String, Object> param);
}
src/main/java/com/yssh/mapper/SuYuanMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package com.yssh.mapper;
import java.util.List;
import java.util.Map;
import com.yssh.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface SuYuanMapper extends BaseMapper {
    Integer isTableExists(String tableName);
    int createTable(@Param("tableName") String tableName);
    List<SuYuan2d> get2d(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    List<SuYuan3d> get3d(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    List<DistanceSuYuan> getDistanceSuYuan(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    DistanceSuYuan getSuYuan500Max(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    DistanceSuYuan getSuYuanById(@Param("tableName") String tableName, @Param("id") String id);
    List<Temporary> getTemporary(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    int update(@Param("tableName") String tableName, @Param("id") String id, @Param("value") String value);
    List<SuYuan2d> getAlarmsAnalyse(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    List<SuYuan2d> getWarningAnalyse(@Param("tableName") String tableName, @Param("ids") List<String> ids);
    List<SuYuanMonitorData> getMonitorData(@Param("tableNames") List<String> tableNames, @Param("id") String id);
    List<SuYuanMonitorData> getNewMonitorData(String name, String start, String end);
    //获取本月指定监测站点监测值对大的数据
    Map<String, Object> getMonthValueDataMax(@Param("tableNames") List<String> tableNames, @Param("id") String id);
    int updateVocsName(String table, String id, String vocsName);
    SuYuan700 selectSuYuan700ById(@Param("id") String id, @Param("time") String time);
    SuYuan700 selectSuYuan46ById(@Param("id") String id, @Param("time") String time);
}
src/main/java/com/yssh/mapper/ThuAccuracyMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.yssh.mapper;
import java.util.List;
import java.util.Map;
import com.yssh.entity.ThuAccuracy;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ThuAccuracyMapper {
    //查询过去七天精确平均值统计
    public Double selectSevenDayAccuracyAvg(Long beginTime);
    public List<ThuAccuracy> getForecastData(Map<String, Object> map);
}
src/main/java/com/yssh/mapper/VocValsMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
package com.yssh.mapper;
import com.yssh.entity.VocCoords;
import com.yssh.entity.VocVals;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * Voc值Mapper接口
 * @author WWW
 * @date 2023-06-05
 */
@Mapper
public interface VocValsMapper {
    /**
     * æ ¹æ®æ—¶é—´æŸ¥è¯¢
     *
     * @param time æ—¶é—´ï¼ˆç¤ºä¾‹ï¼š2023060514)
     * @return
     */
    public List<VocVals> selectByTime(@Param("time") String time);
    /**
     * æ ¹æ®æ—¶é—´ç»Ÿè®¡
     *
     * @param time æ—¶é—´ï¼ˆç¤ºä¾‹ï¼š2023060514)
     * @return è¡Œæ•°
     */
    public int countByTime(@Param("time") String time);
    /**
     * æ ¹æ®X,Y值查询地址
     *
     * @param x X值
     * @param y Y值
     * @return åœ°å€
     */
    public List<VocCoords> selectCoords(@Param("x") Integer x, @Param("y") Integer y);
    /**
     * æ’入一条数据
     *
     * @param vv Voc实体类
     * @return å½±å“è¡Œæ•°
     */
    public int insert(VocVals vv);
    /**
     * æ’入多条数据
     *
     * @param list Voc集合
     * @return å½±å“è¡Œæ•°
     */
    public int inserts(List<VocVals> list);
    /**
     * åˆ é™¤åŽ»å¹´çš„æ•°æ®
     *
     * @return å½±å“è¡Œæ•°
     */
    public int deleteLastYear();
    /**
     * æ ¹æ®æ—¶é—´åˆ é™¤æ•°æ®
     *
     * @param time æ—¶é—´ï¼ˆç¤ºä¾‹ï¼š2023060514)
     * @return å½±å“è¡Œæ•°
     */
    public int deleteByTime(@Param("time") String time);
}
src/main/java/com/yssh/mapper/WarningDetailMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.yssh.mapper;
import java.util.List;
import java.util.Map;
import com.yssh.entity.WarningDetail;
import com.yssh.entity.WarningVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WarningDetailMapper extends BaseMapper {
    //List<WarningVo> getRunTimeAlarmAnalyse();
    //@Param("startTime") Date startTime,
    List<WarningVo> selectWarningDetailByType(@Param("type") Integer type);
    List<WarningVo> selectWarningDetailByMap(Map<String, Object> param);
    List<Map<String, Object>> selectWarningDayCountByMap(Map<String, Object> param);
    List<WarningDetail> selectByTime(@Param("startTime") String startTime, @Param("endTime") String endTime);
    List<WarningDetail> selectByTimeForYj(@Param("startTime") String startTime, @Param("endTime") String endTime);
    List<WarningDetail> selectByTimeForBj(@Param("startTime") String startTime, @Param("endTime") String endTime);
    Double getLastYearVal(@Param("id") long id);
    Integer countWarnByMap(Map<String, Object> param);
    Integer countAlarmByMap(Map<String, Object> param);
}
src/main/java/com/yssh/mapper/WeatherMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.yssh.mapper;
import com.yssh.entity.Weather;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author wMeng
 * @ClassName YsshWeatherMapper
 * @Description TODO
 * @date 2022/10/30 14:16
 * @Version 1.0
 */
@Mapper
public interface WeatherMapper {
    List<Weather> query(@Param("begin") String begin, @Param("end") String end);
    List<Weather> getAll();
    int insert(Weather weather);
    int delete(String id);
}
src/main/java/com/yssh/service/AlertConfigService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package com.yssh.service;
import java.util.List;
import com.yssh.entity.AlertConfig;
import org.springframework.stereotype.Service;
import com.yssh.mapper.AlertConfigMapper;
import javax.annotation.Resource;
@Service
public class AlertConfigService {
    @Resource
    private AlertConfigMapper alertConfigMapper;
    public List<AlertConfig> getAll() {
        return alertConfigMapper.getAll();
    }
    public List<AlertConfig> query(Integer id) {
        return alertConfigMapper.query(id);
    }
    public int update(AlertConfig config) {
        return alertConfigMapper.update(config);
    }
    public int insert(AlertConfig config) {
        return alertConfigMapper.insert(config);
    }
    public int delete(Integer id) {
        return alertConfigMapper.delete(id);
    }
}
src/main/java/com/yssh/service/AsyncService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.yssh.service;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import org.springframework.stereotype.Service;
import com.yssh.mapper.BaseMapper;
@Service
public class AsyncService {
    public static final Integer BATCH_INSERT_NUMBER = 1000;
    public static final Integer BATCH_INSERT_500 = 500;
    public <T> void executeAsync(String tableName, List<T> lists, BaseMapper mapper, CountDownLatch countDownLatch) {
        try{
            //异步线程要做的事情
            mapper.batchInsert(tableName, lists);
        }finally {
            countDownLatch.countDown();// å¾ˆå…³é”®, æ— è®ºä¸Šé¢ç¨‹åºæ˜¯å¦å¼‚常必须执行countDown,否则await无法释放
        }
    }
}
src/main/java/com/yssh/service/CommonService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,166 @@
package com.yssh.service;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.yssh.config.DatFilePathConfig;
import com.yssh.entity.MonitorPointPosition;
import com.yssh.utils.CalculateUtils;
import com.yssh.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.yssh.mapper.CommonMapper;
import javax.annotation.Resource;
@Service
public class CommonService {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    private static final String TABLE_SCHEMA = "yssh";
    private List<MonitorPointPosition> checkPoints2d = new ArrayList<>();
    private List<MonitorPointPosition> checkPoints3d = new ArrayList<>();
    @Resource
    private CommonMapper commonMapper;
    @Resource
    protected DatFilePathConfig datFilePathConfig;
    /**
     * æ£€æŸ¥è¡¨æ˜¯å¦å­˜åœ¨
     */
    public boolean checkTableExists(String tableName) {
        try {
            Integer count = commonMapper.checkTableExistsWithSchema(TABLE_SCHEMA, tableName);
            return count == 1;
        } catch (Exception e) {
            logger.error("使用information_schema检测表失败", e);
            Map<String, String> list = commonMapper.checkTableExistsWithShow(tableName);
            if (StringUtils.isNotEmpty(list)) {
                return true;
            }
        }
        return false;
    }
    public void readDatData() throws Exception {
        File file2d = new File(datFilePathConfig.getFilePath2d());
        BufferedInputStream fis2d = new BufferedInputStream(new FileInputStream(file2d));
        BufferedReader reader2d = new BufferedReader(new InputStreamReader(fis2d, "utf-8"), 7 * 1024 * 1024);// ç”¨7M的缓冲读取文本文件
        long count2d = 1;
        String line2d = "";
        while ((line2d = reader2d.readLine()) != null) {
            String[] f2d = line2d.split(" ");
            Integer x = Integer.parseInt(f2d[0]);
            Integer y = Integer.parseInt(f2d[1]);
            int z = 0;
            try {
                z = new Double(Math.round(Integer.parseInt(f2d[2]) * 1.0 / 10)).intValue();
            } catch (Exception e) {
                System.out.println(e.getStackTrace());
            }
            //if (x <= 699 && y <= 699)
            {
                MonitorPointPosition monitorPointPosition = new MonitorPointPosition();
                monitorPointPosition.setId(x + "_" + y + "_" + z);
                monitorPointPosition.setName("AI-" + (count2d < 10 ? "0" + count2d : count2d + ""));
                monitorPointPosition.setX(x);
                monitorPointPosition.setY(y);
                monitorPointPosition.setZ(z);
                monitorPointPosition.setLon(CalculateUtils.getLon(monitorPointPosition.getX(), monitorPointPosition.getY()));
                monitorPointPosition.setLat(CalculateUtils.getLat(monitorPointPosition.getX(), monitorPointPosition.getY()));
                checkPoints2d.add(monitorPointPosition);
                count2d++;
            }
        }
        reader2d.close();
        File file = new File(datFilePathConfig.getFilePath3d());
        BufferedInputStream fis = new BufferedInputStream(new FileInputStream(file));
        BufferedReader reader = new BufferedReader(new InputStreamReader(fis, "utf-8"), 7 * 1024 * 1024);// ç”¨7M的缓冲读取文本文件
        long count3d = 1;
        String line = "";
        while ((line = reader.readLine()) != null) {
            String[] f3d = line.split(" ");
            Integer x = Integer.parseInt(f3d[0]);
            Integer y = Integer.parseInt(f3d[1]);
            int z = 0;
            try {
                z = new Double(Math.round(Integer.parseInt(f3d[2]) * 1.0 / 10)).intValue();
            } catch (Exception e) {
                System.out.println(e.getStackTrace());
            }
            if (count3d > 46) break;
            { //if (x <= 699 && y <= 699) {
                MonitorPointPosition monitorPointPosition = new MonitorPointPosition();
                monitorPointPosition.setId(x + "_" + y + "_" + z);
                monitorPointPosition.setName("AI-" + (count3d < 10 ? "0" + count3d : count3d + ""));
                monitorPointPosition.setX(x);
                monitorPointPosition.setY(y);
                monitorPointPosition.setZ(z);
                monitorPointPosition.setLon(CalculateUtils.getLon(monitorPointPosition.getX(), monitorPointPosition.getY()));
                monitorPointPosition.setLat(CalculateUtils.getLat(monitorPointPosition.getX(), monitorPointPosition.getY()));
                checkPoints3d.add(monitorPointPosition);
                count3d++;
            }
        }
        reader.close();
    }
    public List<MonitorPointPosition> getCheckPoints2d() {
        return checkPoints2d;
    }
    public List<MonitorPointPosition> getCheckPoints3d() {
        return checkPoints3d;
    }
    public MonitorPointPosition select2dCheckPointByName(String name) {
        for (MonitorPointPosition monitorPointPosition : checkPoints2d) {
            if (monitorPointPosition.getName().equals(name)) {
                return monitorPointPosition;
            }
        }
        return null;
    }
    public MonitorPointPosition select3dCheckPointByName(String name) {
        for (MonitorPointPosition monitorPointPosition : checkPoints3d) {
            if (monitorPointPosition.getName().equals(name)) {
                return monitorPointPosition;
            }
        }
        return null;
    }
    public MonitorPointPosition select2dCheckPointById(String id) {
        for (MonitorPointPosition monitorPointPosition : checkPoints2d) {
            if (monitorPointPosition.getName().equals(id)) {
                return monitorPointPosition;
            }
        }
        return null;
    }
    public MonitorPointPosition select3dCheckPointById(String id) {
        for (MonitorPointPosition monitorPointPosition : checkPoints3d) {
            //if (monitorPointPosition.getId().equals(id)) {
            String subId = id.substring(0, id.lastIndexOf("_") + 1);
            if (monitorPointPosition.getId().contains(subId)) {
                return monitorPointPosition;
            }
        }
        return null;
    }
}
src/main/java/com/yssh/service/CountService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.yssh.service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.yssh.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.yssh.mapper.FeedbackMapper;
import com.yssh.mapper.ThuAccuracyMapper;
import javax.annotation.Resource;
@Service
public class CountService {
    @Resource
    private ThuAccuracyMapper thuAccuracyMapper;
    @Resource
    private FeedbackMapper feedbackMapper;
    public Map<String, Double> selectAccuracyAvg() {
        Map<String, Double> result = new HashMap<String, Double>();
        Date nowDate = DateUtils.getNowDate();
        Long beginTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -7, Calendar.DATE)));
        Double thuAccuracy = thuAccuracyMapper.selectSevenDayAccuracyAvg(beginTime);
        Double tempForecast = thuAccuracy == null ? 0.0 : thuAccuracy;
        result.put("forecastRate", new BigDecimal(tempForecast).setScale(2, RoundingMode.HALF_UP).doubleValue());
        Double practical = feedbackMapper.selectSevenDayAccuracyAvg(beginTime);
        Double tempPractical = practical == null ? 0.0 : practical;
        result.put("practicalRate", new BigDecimal(tempPractical * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
        return result;
    }
}
src/main/java/com/yssh/service/DictRecordService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,77 @@
package com.yssh.service;
import java.util.List;
import com.yssh.entity.DictRecord;
import lombok.Synchronized;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yssh.mapper.DictRecordMapper;
import javax.annotation.Resource;
/**
 * å­—典记录Service业务层处理
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
@Service
public class DictRecordService {
    @Resource
    private DictRecordMapper dictRecordMapper;
    /**
     * æŸ¥è¯¢å­—典记录列表
     *
     * @param dictRecord å­—典记录
     * @return å­—典记录
     */
    public List<DictRecord> selectDictRecordList(DictRecord dictRecord) {
        return dictRecordMapper.selectDictRecordList(dictRecord);
    }
    public DictRecord selectByCreateTime(Long createTime) {
        return dictRecordMapper.selectByCreateTime(createTime);
    }
    /**
     * æ–°å¢žå­—典记录
     *
     * @param dictRecord å­—典记录
     * @return ç»“æžœ
     */
    public int insertDictRecord(DictRecord dictRecord) {
        return dictRecordMapper.insertDictRecord(dictRecord);
    }
    /**
     * åˆ é™¤å­—典记录对象
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ID
     * @return ç»“æžœ
     */
    public int deleteDictRecordByIds(Long[] ids) {
        return dictRecordMapper.deleteDictRecordByIds(ids);
    }
    /**
     * åˆ é™¤å­—典记录信息
     *
     * @param id å­—典记录ID
     * @return ç»“æžœ
     */
    public int deleteDictRecordById(Long id) {
        return dictRecordMapper.deleteDictRecordById(id);
    }
    /**
     * åˆ›å»ºå­—典记录信息表接口
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    public int createDictRecoTable() {
        return dictRecordMapper.createDictRecoTable();
    }
}
src/main/java/com/yssh/service/EmissionService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
package com.yssh.service;
import java.util.List;
import com.yssh.entity.Emission;
import org.springframework.stereotype.Service;
import com.yssh.mapper.EmissionMapper;
import javax.annotation.Resource;
/**
 * @author wMeng
 * @ClassName YsshQxshServiceImpl
 * @Description TODO
 * @date 2022/10/31 14:45
 * @Version 1.0
 */
@Service
public class EmissionService {
    @Resource
    private EmissionMapper emissionMapper;
    public List<Emission> query(String name) {
        return emissionMapper.query(name);
    }
    public List<Emission> getAll() {
        return emissionMapper.getAll();
    }
    public int insert(Emission emission) {
        return emissionMapper.insert(emission);
    }
    public int delete(String id) {
        return emissionMapper.delete(id);
    }
}
src/main/java/com/yssh/service/FeedbackService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.yssh.service;
import com.yssh.entity.FeedbackDetail;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yssh.mapper.FeedbackMapper;
import com.yssh.mapper.SuYuanMapper;
import javax.annotation.Resource;
@Service
public class FeedbackService {
    @Resource
    private FeedbackMapper feedbackMapper;
    @Resource
    private SuYuanMapper suYuanMapper;
    @Transactional
    public int suYuanFeedback(Long id, String practicalId, String practicalVocsName, double practicalValue) {
        FeedbackDetail feedback = feedbackMapper.selectById(id);
        int i = suYuanMapper.update(feedback.getTableName(), practicalId, String.valueOf(practicalValue));
        FeedbackDetail feedbackDetail = new FeedbackDetail();
        feedbackDetail.setId(id);
        feedbackDetail.setPracticalId(practicalId);
        feedbackDetail.setPracticalVocsName(practicalVocsName);
        feedbackDetail.setPracticalValue(practicalValue);
        return feedbackMapper.update(feedbackDetail) + i;
    }
}
src/main/java/com/yssh/service/ForecastAnalyseService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.yssh.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yssh.utils.DateUtils;
import com.yssh.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.yssh.mapper.DictRecordMapper;
import com.yssh.mapper.SuYuanMapper;
import com.yssh.mapper.ThuAccuracyMapper;
import com.yssh.entity.DictRecord;
import com.yssh.entity.MonitorPointPosition;
import com.yssh.entity.SuYuanMonitorData;
import com.yssh.entity.ThuAccuracy;
import com.yssh.entity.ForecastAnalyseVo;
import javax.annotation.Resource;
@Service
public class ForecastAnalyseService {
    @Resource
    private CommonService commonService;
    @Resource
    private SuYuanMapper suYuanMapper;
    @Resource
    private DictRecordMapper dictRecordMapper;
    @Resource
    private ThuAccuracyMapper thuAccuracyMapper;
    public List<ForecastAnalyseVo> getForecastAnalyse(String name, Date beginTime, Date endTime) {
        List<ForecastAnalyseVo> result = new ArrayList<ForecastAnalyseVo>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        List<DictRecord> dictRecordList = dictRecordMapper.selectByTimeDictRecordList(Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, beginTime)), Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, endTime)));
        List<String> tableNames = new ArrayList<String>();
        dictRecordList.forEach(r -> {
            tableNames.add(r.getTableName());
        });
        if (StringUtils.isNotEmpty(tableNames)) {
            List<SuYuanMonitorData> monitorDatas = suYuanMapper.getMonitorData(tableNames, checkPoint.getId());
            monitorDatas.forEach(m -> {
                result.add(new ForecastAnalyseVo(0.0, m.getValue(), new Long(m.getTime())));
            });
            Map<String, Object> param = new HashMap<String, Object>();
            param.put("name", name);
            param.put("beginTime", beginTime);
            param.put("endTime", endTime);
            List<ThuAccuracy> data = thuAccuracyMapper.getForecastData(param);
            data.forEach(s -> {
                result.forEach(r -> {
                    if (Long.valueOf(s.getTime()).longValue() == r.getTime().longValue()) {
                        r.setForecastValue(Double.valueOf(s.getValue()));
                    }
                });
            });
        }
        return result;
    }
}
src/main/java/com/yssh/service/LocationService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
package com.yssh.service;
import com.yssh.entity.Location;
import com.yssh.mapper.LocationMapper;
import com.yssh.utils.CalculateUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
 * @author wMeng
 * @date 2022/10/30 13:25
 * @version 1.0
 */
@Service
public class LocationService {
    @Resource
    private LocationMapper mapper;
    private static List<Location> vocAddrs = null;
    public List<Location> query(String name, String type) {
        return mapper.query(name, type);
    }
    public List<Location> getAll() {
        return mapper.getAll();
    }
    public int insertLocation(Location location) {
        return mapper.insertLocation(location);
    }
    public int deleteLocation(String id) {
        return mapper.deleteLocation(id);
    }
    public List<Location> selectVocAddrs(double x, double y) {
        if (null == vocAddrs) {
            vocAddrs = mapper.selectVocAddrs();
            for (Location loc : vocAddrs) {
                double X = CalculateUtils.getLon((int) loc.getLon(), (int) loc.getLat());
                double Y = CalculateUtils.getLat((int) loc.getLon(), (int) loc.getLat());
                loc.setLon(X);
                loc.setLat(Y);
            }
        }
        List<Location> list = new ArrayList<>();
        for (Location loc : vocAddrs) {
            if (Math.abs(loc.getLon() - x) <= 0.00009 && Math.abs(loc.getLat() - y) <= 0.00009) {
                list.add(loc);
            }
        }
        return list;
    }
}
src/main/java/com/yssh/service/SuYuanService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,313 @@
package com.yssh.service;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import com.yssh.entity.*;
import com.yssh.mapper.*;
import com.yssh.utils.CalculateUtils;
import com.yssh.utils.DateUtils;
import com.yssh.utils.StringUtils;
import com.yssh.utils.TableStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import javax.annotation.Resource;
@Service
public class SuYuanService {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    private SuYuanMapper suYuanMapper;
    @Resource
    private AsyncService asyncService;
    @Resource
    private DictRecordMapper dictRecordMapper;
    @Resource
    private CommonService commonService;
    @Resource
    private FeedbackMapper feedbackMapper;
    @Resource
    private QxshMapper qxshMapper;
    @Resource
    private LocationMapper locationMapper;
    @Resource
    private LocationService locService;
    //@Transactional
    @Async("threadPoolTaskExecutor")
    public void insertSuYuanDatasAsync(List<SuYuan> lists, String time) throws Exception {
        //插入数据
        List<List<SuYuan>> list = Lists.partition(lists, AsyncService.BATCH_INSERT_NUMBER);
        CountDownLatch countDownLatch = new CountDownLatch(list.size());
        for (List<SuYuan> corpReserveList : list) {
            asyncService.executeAsync(TableStrategy.getTableStrategy(time), corpReserveList, suYuanMapper, countDownLatch);
        }
        countDownLatch.await();
        logger.info(lists.size() + "条数据入库完成-----");
    }
    public void insertSuYuanDatas(List<SuYuan> lists, String time) {
        List<List<SuYuan>> subLists = Lists.partition(lists, AsyncService.BATCH_INSERT_NUMBER);
        for (List<SuYuan> sub : subLists) {
            suYuanMapper.batchInsert(TableStrategy.getTableStrategy(time), sub);
        }
        logger.info("------ " + time + ".csv," + lists.size() + " æ¡æ•°æ®å·²å…¥åº“ ------");
    }
    public Integer isTableExists(String tableName) {
        return suYuanMapper.isTableExists(tableName);
    }
    public int createNewTable(String tableName) {
        return suYuanMapper.createTable(tableName);
    }
    public List<SuYuan2d> selectSuYuan2d(Date date) {
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids2d = CalculateUtils.assembleId(commonService.getCheckPoints2d());
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        return suYuanMapper.get2d(dictRecord.getTableName(), ids2d);
    }
    public List<SuYuan3d> selectSuYuan3d(String name, Date date) {
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        int range = 10;
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(checkPoint, range);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        return suYuanMapper.get3d(dictRecord.getTableName(), ids3d);
    }
    public Map<String, Object> selectSuYuan100(String name, Date date) {
        Map<String, Object> result = new HashMap<String, Object>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        int range = 10;
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(checkPoint, range);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
            i.getAndIncrement();
            s.setVocsName(checkPoint.getName() + "-" + i.longValue());
        });
        if (StringUtils.isNotEmpty(list)) {
            Collections.sort(list);
            DistanceSuYuan max = list.get(0);
            FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(),
                    max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate());
            feedbackMapper.insert(feedbackDetail);
            result.put("feedbackId", feedbackDetail.getId());
        }
        result.put("data", list);
        return result;
    }
    public Map<String, Object> selectSuYuan200(String name, Date date) {
        Map<String, Object> result = new HashMap<String, Object>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        int range = 20;
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(checkPoint, range);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
            i.getAndIncrement();
            s.setVocsName(checkPoint.getName() + "-" + i.longValue());
        });
        if (StringUtils.isNotEmpty(list)) {
            Collections.sort(list);
            DistanceSuYuan max = list.get(0);
            FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(),
                    max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate());
            feedbackMapper.insert(feedbackDetail);
            result.put("feedbackId", feedbackDetail.getId());
        }
        result.put("data", list);
        return result;
    }
    public Map<String, Object> selectSuYuan300(String name, Date date) {
        Map<String, Object> result = new HashMap<String, Object>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        int range = 30;
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(checkPoint, range);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
            i.getAndIncrement();
            s.setVocsName(checkPoint.getName() + "-" + i.longValue());
        });
        if (StringUtils.isNotEmpty(list)) {
            Collections.sort(list);
            DistanceSuYuan max = list.get(0);
            FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(),
                    max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate());
            feedbackMapper.insert(feedbackDetail);
            result.put("feedbackId", feedbackDetail.getId());
        }
        result.put("data", list);
        return result;
    }
    public Map<String, Object> selectSuYuan500(String name, Date date) {
        Map<String, Object> result = new HashMap<String, Object>();
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        int range = 50;
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(checkPoint, range);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (StringUtils.isNull(dictRecord)) {
            return null;
        }
        List<DistanceSuYuan> list = suYuanMapper.getDistanceSuYuan(dictRecord.getTableName(), ids3d);
        AtomicInteger i = new AtomicInteger(0);
        list.stream().forEach(s -> {
            s.setName(checkPoint.getName());
            i.getAndIncrement();
            s.setVocsName(checkPoint.getName() + "-" + i.longValue());
        });
        if (StringUtils.isNotEmpty(list)) {
            Collections.sort(list);
            DistanceSuYuan max = list.get(0);
            FeedbackDetail feedbackDetail = new FeedbackDetail(null, dictRecord.getTableName(),
                    max.getName(), max.getId(), max.getVocsName(), max.getVocsValue(), null, null, null, DateUtils.getNowDate());
            feedbackMapper.insert(feedbackDetail);
            result.put("feedbackId", feedbackDetail.getId());
        }
        result.put("data", list);
        return result;
    }
    public List<SuYuanMonitorData> getMonitorData(String name) {
        MonitorPointPosition checkPoint = commonService.select3dCheckPointByName(name);
        if (StringUtils.isNull(checkPoint)) {
            return null;
        }
        /*List<DictRecord> recordList = dictRecordMapper.selectDictRecordList(new DictRecord());
        List<String> tableNames = new ArrayList<String>();
        for (DictRecord dr : recordList) {
            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
                tableNames.add(dr.getTableName());
            }
        }
        return suYuanMapper.getMonitorData(tableNames, checkPoint.getX() + "_" + checkPoint.getY() + "_" + checkPoint.getZ());*/
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        String end = DateUtils.getYyyyMmDdHh(calendar.getTime()); //dateFormat.format(calendar.getTime());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.add(Calendar.DATE, -7);
        String start = DateUtils.getYyyyMmDdHh(calendar.getTime());
        return suYuanMapper.getNewMonitorData(checkPoint.getName(), start, end);
    }
    public int updateVocsName(Date date, String id, String vocsName) {
        String table = "su_yuan_" + DateUtils.getYyyyMmDdHh(date); // new Date()
        if (isTableExists(table) == 0) {
            return 0;
        }
        //return suYuanMapper.updateVocsName(table, id, vocsName);
        return 1;
    }
    public List<Qxsh> queryQxsh(Date date) {
        String time = DateUtils.getYyyyMmDdHh(date);
        return qxshMapper.selectByTime(time);
    }
    public List<List<Coordinate>> selectRects(Double[] x, Double[] y) {
        List<List<Coordinate>> list = new ArrayList<>();
        for (int i = 0; i < x.length; i++) {
            list.add(CalculateUtils.calcRect(x[i], y[i]));
        }
        return list;
    }
    public SuYuan700 selectSuYuan700ById(String id, Date date) {
        id = id.substring(0, id.lastIndexOf("_") + 1) + "0";
        String time = DateUtils.getYyyyMmDdHhMmSs(date).substring(0, 13) + ":00:00";
        return suYuanMapper.selectSuYuan700ById(id, time);
    }
    public SuYuan700 selectSuYuan46ById(String id, Date date) {
        id = id.substring(0, id.lastIndexOf("_") + 1) + "0";
        String time = DateUtils.getYyyyMmDdHhMmSs(date).substring(0, 13) + ":00:00";
        return suYuanMapper.selectSuYuan46ById(id, time);
    }
    public String selectAddrByXY(double x, double y) {
        List<Location> locations = locationMapper.selectByXY(x, y);
        if (null != locations && locations.size() > 0) {
            return locations.get(0).getName();
        }
        locations = locService.selectVocAddrs(x, y);
        if (null != locations && locations.size() > 0) {
            return locations.get(0).getName();
        }
        return null;
    }
}
src/main/java/com/yssh/service/VocValsService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
package com.yssh.service;
import com.google.common.collect.Lists;
import com.yssh.entity.VocCoords;
import com.yssh.entity.VocVals;
import com.yssh.mapper.VocValsMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@Service
public class VocValsService {
    @Resource
    VocValsMapper vocValsMapper;
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    public List<VocVals> selectByTime(String time) {
        return vocValsMapper.selectByTime(time);
    }
    public int countByTime(String time) {
        return vocValsMapper.countByTime(time);
    }
    public List<VocCoords> selectCoords(Integer x, Integer y) {
        return vocValsMapper.selectCoords(x, y);
    }
    public int insert(VocVals vv) {
        return vocValsMapper.insert(vv);
    }
    public int inserts(List<VocVals> list) {
        return vocValsMapper.inserts(list);
    }
    public int deleteLastYear() {
        return vocValsMapper.deleteLastYear();
    }
    public int deleteByTime(String time) {
        return vocValsMapper.deleteByTime(time);
    }
    public void insertVocSync(List<VocVals> list) {
        List<List<VocVals>> subLists = Lists.partition(list, 100);
        for (List<VocVals> sub : subLists) {
            vocValsMapper.inserts(sub);
        }
        logger.info("------ VOC.csv," + list.size() + " æ¡æ•°æ®å·²å…¥åº“ ------");
    }
    @Async("threadPoolTaskExecutor")
    public void insertVocVals(List<VocVals> list) throws InterruptedException {
        List<List<VocVals>> lists = Lists.partition(list, AsyncService.BATCH_INSERT_500);
        CountDownLatch countDownLatch = new CountDownLatch(list.size());
        for (List<VocVals> corpList : lists) {
            executeAsync(corpList, countDownLatch);
        }
        countDownLatch.await();
        logger.info("------ VOC.csv," + lists.size() + " æ¡æ•°æ®å·²å…¥åº“ ------");
    }
    private void executeAsync(List<VocVals> corpList, CountDownLatch countDownLatch) {
        try {
            // å¼‚步线程要做的事情
            vocValsMapper.inserts(corpList);
        } finally {
            // å¾ˆå…³é”®, æ— è®ºä¸Šé¢ç¨‹åºæ˜¯å¦å¼‚常必须执行countDown,否则await无法释放
            countDownLatch.countDown();
        }
    }
}
src/main/java/com/yssh/service/WarningAnalyseService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,396 @@
package com.yssh.service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import com.yssh.entity.*;
import com.yssh.mapper.DictRecordMapper;
import com.yssh.mapper.QxshMapper;
import com.yssh.mapper.SuYuanMapper;
import com.yssh.mapper.WarningDetailMapper;
import com.yssh.utils.CalculateUtils;
import com.yssh.utils.DateUtils;
import com.yssh.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.yssh.entity.WarningVo;
import javax.annotation.Resource;
@Service
public class WarningAnalyseService {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    private WarningDetailMapper warningDetailMapper;
    @Resource
    private CommonService commonService;
    @Resource
    private SuYuanMapper suYuanMapper;
    @Resource
    private DictRecordMapper dictRecordMapper;
    @Resource
    private AsyncService asyncService;
    @Resource
    private QxshMapper qxshMapper;
    private SimpleDateFormat ym = new SimpleDateFormat("yyyyMM%");
    @Async("threadPoolTaskExecutor")
    public void insertWarningDetails(List<WarningDetail> warning) throws Exception {
        //插入数据
        List<List<WarningDetail>> list = Lists.partition(warning, AsyncService.BATCH_INSERT_NUMBER);
        CountDownLatch countDownLatch = new CountDownLatch(list.size());
        for (List<WarningDetail> corpReserveList : list) {
            asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch);
        }
        countDownLatch.await();
    }
    public List<WarningVo> getRunTimeAlarmAnalyse() {
        List<WarningVo> result = new ArrayList<>();
        Date nowDate = DateUtils.getNowDate();
        //String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
        //DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        //if (StringUtils.isNull(dictRecord)) {
        //    nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
        //}
        //List<WarningDetail> list = alarmAnalyseOperation(nowDate);
        List<WarningDetail> list = new ArrayList<>();
        Calendar calendar = getCalendar(nowDate);
        for (int i = 0; i < 6; i++) {
            calendar.add(Calendar.HOUR, -1);
            List<WarningDetail> rs = getAlarmWarnAnalyse(calendar.getTime(), false);
            if (null != rs && rs.size() > 0) {
                list.addAll(rs);
            }
        }
        list.forEach(s -> {
            String time = DateUtils.getYyyyMmDdHh(s.getCreateTime());
            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue(), time));
        });
        return result;
    }
    private Calendar getCalendar(Date nowDate) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(nowDate);
        calendar.add(Calendar.HOUR, 1);
        return calendar;
    }
    public List<WarningVo> getRunTimeWarningAnalyse() {
        List<WarningVo> result = new ArrayList<>();
        Date nowDate = DateUtils.getNowDate();
        //String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate);
        //DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        //if (StringUtils.isNull(dictRecord)) {
        //    nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY);
        //}
        //List<WarningDetail> list = warningAnalyseOperation(nowDate);
        List<WarningDetail> list = new ArrayList<>();
        Calendar calendar = getCalendar(nowDate);
        for (int i = 0; i < 6; i++) {
            calendar.add(Calendar.HOUR, -1);
            List<WarningDetail> rs = getAlarmWarnAnalyse(calendar.getTime(), true);
            if (null != rs && rs.size() > 0) {
                list.addAll(rs);
            }
        }
        list.forEach(s -> {
            String time = DateUtils.getYyyyMmDdHh(s.getCreateTime());
            result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue(), time));
        });
        return result;
    }
    private List<WarningDetail> getAlarmWarnAnalyse(Date date, boolean isWarn) {
        List<String> ids = CalculateUtils.assembleId(commonService.getCheckPoints3d());
        String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date);
        DictRecord dictRecord = dictRecordMapper.selectByCreateTime(Long.parseLong(time));
        if (null == dictRecord) return null;
        String tableName = dictRecord.getTableName();
        if (suYuanMapper.isTableExists(tableName) == 0) return null;
        List<SuYuan2d> list = isWarn ? suYuanMapper.getWarningAnalyse(tableName, ids) : suYuanMapper.getAlarmsAnalyse(tableName, ids);
        if (null == list || list.isEmpty()) {
            return null;
        }
        int type = isWarn ? 1 : 0;
        List<WarningDetail> result = new ArrayList<>();
        for (SuYuan2d s : list) {
            String locationName = commonService.select3dCheckPointById(s.getId()).getName();
            result.add(new WarningDetail(0L, tableName, s.getId(), locationName, date, type, s.getValue()));
        }
        return result;
    }
    public void warningOperationStorage(Date date) {
        List<WarningDetail> allData = new ArrayList<>();
        List<WarningDetail> alarms = this.getAlarmWarnAnalyse(date, false);
        if (StringUtils.isNotEmpty(alarms)) {
            allData.addAll(alarms);
        }
        List<WarningDetail> warnings = this.getAlarmWarnAnalyse(date, true);
        if (StringUtils.isNotEmpty(warnings)) {
            allData.addAll(warnings);
        }
        if (StringUtils.isNotEmpty(allData)) {
            try {
                insertWarningDetails(allData);
            } catch (Exception e) {
                logger.error("批量插入告警数据出现异常!!!", e);
                e.printStackTrace();
            }
        }
    }
    public Map<String, Integer> countThisMonthAlarmAndWarning() {
        Map<String, Integer> result = new HashMap<>();
        Map<String, Object> param = new HashMap<>();
        param.put("startTime", DateUtils.getYyyyMmDdHhMmSs(DateUtils.getMonthStart()));
        param.put("endTime", DateUtils.getYyyyMmDdHhMmSs(DateUtils.getMonthEnd()));
        /*param.put("type", 0);
        List<WarningVo> alarms = warningDetailMapper.selectWarningDetailByMap(param);
        if (StringUtils.isNull(alarms)) {
            alarms = new ArrayList<>();
        }
        result.put("alarmNumber", alarms.size());*/
        Integer alarmNum = warningDetailMapper.countAlarmByMap(param);
        result.put("alarmNumber", null == alarmNum ? 0 : alarmNum);
        param.put("type", 1);
        /*List<WarningVo> warnings = warningDetailMapper.selectWarningDetailByMap(param);
        if (StringUtils.isNull(warnings)) {
            warnings = new ArrayList<>();
        }
        result.put("warningNumber", warnings.size());*/
        Integer warnNum = warningDetailMapper.countWarnByMap(param);
        result.put("warningNumber", null == warnNum ? 0 : warnNum);
        return result;
    }
    public Map<String, List<Map<String, Object>>> countEverydayAlarmAndWarning() {
        Map<String, List<Map<String, Object>>> result = new HashMap<>();
        Map<String, Object> param = new HashMap<String, Object>();
        Date now = new Date();
        Date last = DateUtils.getAPeriodOfTime(now, -7, Calendar.DATE); // ä¸Šå‘¨çš„今天
        param.put("startTime", DateUtils.getYyyyMmDdHhMmSs(last));
        param.put("endTime", DateUtils.getYyyyMmDdHhMmSs(now));
        param.put("type", 0);
        List<Map<String, Object>> alarmDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
        result.put("alarmDayCount", alarmDayCount);
        param.put("type", 1);
        List<Map<String, Object>> warningDayCount = warningDetailMapper.selectWarningDayCountByMap(param);
        result.put("warningDayCount", warningDayCount);
        return result;
    }
    public Map<String, List<Double>> selectEachLocationDataChange() {
        /*Map<String, List<Double>> result = new LinkedHashMap<>();
        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
        Date nowDate = DateUtils.getNowDate();
        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate));
        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY)));
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        checkPoints.forEach(c -> {
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {
                tableNames.add(r.getTableName());
            });
            List<Double> values = new ArrayList<>();
            if (StringUtils.isNotNull(tableNames)) {
                List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId());
                data.forEach(v -> {
                    values.add(v.getValue());
                });
                result.put(c.getName(), values);
            }
        });
        return result;*/
        Map<String, List<Double>> result = new LinkedHashMap<>();
        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
        Date nowDate = DateUtils.getNowDate();
        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate));
        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY)));
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        List<String> tableNames = new ArrayList<>();
        for (DictRecord dr : recordList) {
            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
                tableNames.add(dr.getTableName());
            }
        }
        if (tableNames.isEmpty()) {
            return result;
        }
        for (MonitorPointPosition c : checkPoints) {
            List<Double> values = new ArrayList<>();
            List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId());
            if (null != data && data.size() > 0) {
                for (SuYuanMonitorData v : data) {
                    values.add(v.getValue());
                }
            }
            result.put(c.getName(), values);
        }
        return result;
    }
    public List<Map<String, Object>> selectThisMonthLocationValueDataTop10() {
        /*List<Map<String, Object>> result = new ArrayList<>();
        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart()));
        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd()));
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        checkPoints.forEach(c -> {
            List<String> tableNames = new ArrayList<>();
            recordList.forEach(r -> {
                tableNames.add(r.getTableName());
            });
            Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId());
            if (StringUtils.isNotNull(map) && StringUtils.isNotEmpty(map)) {
                String suYuanId = map.get("id").toString();
                map.put("name", commonService.select3dCheckPointById(suYuanId).getName());
                map.remove("id");
            }
            result.add(map);
        });
        return CalculateUtils.sort(result, "value", true).subList(0, 10);*/
        List<Map<String, Object>> result = new ArrayList<>();
        List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d();
        Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart()));
        Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd()));
        //startTime = 2023040100L;
        //endTime = 2023043023L;
        List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime);
        List<String> tableNames = new ArrayList<>();
        for (DictRecord dr : recordList) {
            if (suYuanMapper.isTableExists(dr.getTableName()) > 0) {
                tableNames.add(dr.getTableName());
            }
        }
        if (tableNames.isEmpty()) {
            return result;
        }
        /*List<String> idList = new ArrayList<>();
        for (MonitorPointPosition c : checkPoints) {
            idList.add("'" + c.getId() + "'");
        }
        String ids = String.join(",", idList);*/
        for (MonitorPointPosition c : checkPoints) {
            Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId());
            if (null != map && map.size() > 0) {
                //String suYuanId = map.get("id").toString();
                //map.put("name", commonService.select3dCheckPointById(suYuanId).getName());
                //map.remove("id");
                map.put("name", c.getName());
                result.add(map);
            }
        }
        return CalculateUtils.sort(result, "value", true).subList(0, 10);
    }
    public List<Qxsh> selectMonthTop10() {
        String time = DateUtils.getYyyyMm(new Date());
        List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%");
        return list;
    }
    public Map<String, List<Double>> select3Hours() {
        Map<String, List<Double>> map = new LinkedHashMap<>();
        List<String> times = DateUtils.get3Hours();
        List<Qxsh> list = qxshMapper.select3Hours(times);
        if (null == list || list.isEmpty()) {
            return map;
        }
        for (Qxsh qxsh : list) {
            String name = qxsh.getName();
            List<Double> values = map.computeIfAbsent(name, k -> new ArrayList<>());
            values.add(qxsh.getValue());
        }
        return map;
    }
    public List<Report> getAlarmAndWarnByTime(Date begin, Date end) {
        String startTime = DateUtils.getYyyyMmDdHhMmSs(begin);
        String endTime = DateUtils.getYyyyMmDdHhMmSs(end);
        List<WarningDetail> rs = new ArrayList<>();
        List<WarningDetail> rsYj = warningDetailMapper.selectByTimeForYj(startTime, endTime);
        if (null != rsYj && rsYj.size() > 0) rs.addAll(rsYj);
        List<WarningDetail> rsBj = warningDetailMapper.selectByTimeForBj(startTime, endTime);
        if (null != rsBj && rsBj.size() > 0) rs.addAll(rsBj);
        List<Report> list = new ArrayList<>();
        for (WarningDetail wd : rs) {
            //String time = ymdh.format(wd.getCreateTime());
            //list.add(new WarningVo(wd.getLocationName(), wd.getSuYuanId(), 0.0, 0.0, wd.getValue(), time));
            DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId());
            Double lastVal = warningDetailMapper.getLastYearVal(wd.getId());
            int rows = suYuanMapper.isTableExists(wd.getTableName());
            DistanceSuYuan suMax = null;
            if (rows > 0) {
                MonitorPointPosition point = commonService.select3dCheckPointByName(wd.getLocationName());
                List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50);
                suMax = suYuanMapper.getSuYuan500Max(wd.getTableName(), ids3d);
            } else {
                suMax = suYuan;
            }
            Report report = Report.calcReport(wd, suYuan, suMax);
            report.setLastVal(lastVal);
            list.add(report);
        }
        return list;
    }
}
src/main/java/com/yssh/service/WeatherService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.yssh.service;
import com.yssh.entity.Weather;
import com.yssh.mapper.WeatherMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author wMeng
 * @ClassName YsshWeatherServiceImpl
 * @Description TODO
 * @date 2022/10/30 14:11
 * @Version 1.0
 */
@Service
public class WeatherService {
    @Resource
    private WeatherMapper weatherMapper;
    public List<Weather> query(String begin, String end) {
        List<Weather> data = weatherMapper.query(begin, end);
        return data;
    }
    public List<Weather> getAll() {
        return weatherMapper.getAll();
    }
    public int insert(Weather weather) {
        return weatherMapper.insert(weather);
    }
    public int delete(String id) {
        return weatherMapper.delete(id);
    }
}
src/main/java/com/yssh/utils/AjaxResult.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,186 @@
package com.yssh.utils;
import java.util.HashMap;
/**
 * æ“ä½œæ¶ˆæ¯æé†’
 *
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
public class AjaxResult extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;
    /** çŠ¶æ€ç  */
    public static final String CODE_TAG = "code";
    /** è¿”回内容 */
    public static final String MSG_TAG = "msg";
    /** æ•°æ®å¯¹è±¡ */
    public static final String DATA_TAG = "data";
    /**
     * åˆå§‹åŒ–一个新创建的 AjaxResult å¯¹è±¡ï¼Œä½¿å…¶è¡¨ç¤ºä¸€ä¸ªç©ºæ¶ˆæ¯ã€‚
     */
    public AjaxResult() {
    }
    /**
     * åˆå§‹åŒ–一个新创建的 AjaxResult å¯¹è±¡
     *
     * @param code
     *            çŠ¶æ€ç 
     * @param msg
     *            è¿”回内容
     */
    public AjaxResult(int code, String msg) {
        super.put(CODE_TAG, code);
        super.put(MSG_TAG, msg);
    }
    /**
     * åˆå§‹åŒ–一个新创建的 AjaxResult å¯¹è±¡
     *
     * @param code
     *            çŠ¶æ€ç 
     * @param msg
     *            è¿”回内容
     * @param data
     *            æ•°æ®å¯¹è±¡
     */
    public AjaxResult(int code, String msg, Object data) {
        super.put(CODE_TAG, code);
        super.put(MSG_TAG, msg);
        if (StringUtils.isNotNull(data)) {
            super.put(DATA_TAG, data);
        }
    }
    /**
     * è¿”回成功消息
     *
     * @return æˆåŠŸæ¶ˆæ¯
     */
    public static AjaxResult success() {
        return AjaxResult.success("操作成功");
    }
    /**
     * è¿”回成功数据
     *
     * @return æˆåŠŸæ¶ˆæ¯
     */
    public static AjaxResult success(Object data) {
        return AjaxResult.success("操作成功", data);
    }
    /**
     * è¿”回成功消息
     *
     * @param msg
     *            è¿”回内容
     * @return æˆåŠŸæ¶ˆæ¯
     */
    public static AjaxResult success(String msg) {
        return AjaxResult.success(msg, null);
    }
    /**
     * è¿”回成功消息
     *
     * @param msg
     *            è¿”回内容
     * @param data
     *            æ•°æ®å¯¹è±¡
     * @return æˆåŠŸæ¶ˆæ¯
     */
    public static AjaxResult success(String msg, Object data) {
        return new AjaxResult(HttpStatus.SUCCESS, msg, data);
    }
    /**
     * è¿”回警告消息
     *
     * @param msg
     *            è¿”回内容
     * @return è­¦å‘Šæ¶ˆæ¯
     */
    public static AjaxResult warn(String msg) {
        return AjaxResult.warn(msg, null);
    }
    /**
     * è¿”回警告消息
     *
     * @param msg
     *            è¿”回内容
     * @param data
     *            æ•°æ®å¯¹è±¡
     * @return è­¦å‘Šæ¶ˆæ¯
     */
    public static AjaxResult warn(String msg, Object data) {
        return new AjaxResult(HttpStatus.WARN, msg, data);
    }
    /**
     * è¿”回错误消息
     *
     * @return é”™è¯¯æ¶ˆæ¯
     */
    public static AjaxResult error() {
        return AjaxResult.error("操作失败");
    }
    /**
     * è¿”回错误消息
     *
     * @param msg
     *            è¿”回内容
     * @return é”™è¯¯æ¶ˆæ¯
     */
    public static AjaxResult error(String msg) {
        return AjaxResult.error(msg, null);
    }
    /**
     * è¿”回错误消息
     *
     * @param msg
     *            è¿”回内容
     * @param data
     *            æ•°æ®å¯¹è±¡
     * @return é”™è¯¯æ¶ˆæ¯
     */
    public static AjaxResult error(String msg, Object data) {
        return new AjaxResult(HttpStatus.ERROR, msg, data);
    }
    /**
     * è¿”回错误消息
     *
     * @param code
     *            çŠ¶æ€ç 
     * @param msg
     *            è¿”回内容
     * @return é”™è¯¯æ¶ˆæ¯
     */
    public static AjaxResult error(int code, String msg) {
        return new AjaxResult(code, msg, null);
    }
    /**
     * æ–¹ä¾¿é“¾å¼è°ƒç”¨
     *
     * @param key
     *            é”®
     * @param value
     *            å€¼
     * @return æ•°æ®å¯¹è±¡
     */
    @Override
    public AjaxResult put(String key, Object value) {
        super.put(key, value);
        return this;
    }
}
src/main/java/com/yssh/utils/CacheUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.yssh.utils;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.TimeUnit;
public class CacheUtils {
    private static @NonNull Cache<String, Object> cache;
    public static void init() {
        cache = Caffeine.newBuilder()
                .initialCapacity(2)
                .maximumSize(1024)
                .expireAfterWrite(24, TimeUnit.HOURS)
                .build();
    }
    public static Object get(String key) {
        return cache.getIfPresent(key);
    }
    public static void put(String key, Object obj) {
        cache.put(key, obj);
    }
    public static void remove(String key) {
        cache.invalidate(key);
    }
    public static void clear() {
        cache.invalidateAll();
    }
}
src/main/java/com/yssh/utils/CalculateUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,371 @@
package com.yssh.utils;
import java.awt.geom.Point2D;
import java.util.*;
import com.yssh.entity.Coordinate;
import com.yssh.entity.DistanceSuYuan;
import com.yssh.entity.MonitorPointPosition;
import org.geotools.geometry.DirectPosition2D;
import org.geotools.referencing.CRS;
import org.geotools.referencing.GeodeticCalculator;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
public class CalculateUtils {
    /**
     * é»˜è®¤åœ°çƒåŠå¾„,赤道半径(单位m)
     */
    private final static double EARTH_RADIUS1 = 6371000;
    /**
     * è½¬åŒ–为弧度(rad)
     */
    private static double rad(double d) {
        return d * Math.PI / 180.0;
    }
    /**
     * è®¡ç®—距离1
     */
    public static double getDistance1(double lon1, double lat1, double lon2, double lat2) {
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double a = radLat1 - radLat2;
        double b = rad(lon1) - rad(lon2);
        double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
        s = s * EARTH_RADIUS1;
        return round2(s);
    }
    /**
     * è®¡ç®—距离2
     */
    public static double getDistance2(double x1, double y1, double x2, double y2) {
        // 84坐标系构造GeodeticCalculator
        GeodeticCalculator geodeticCalculator = new GeodeticCalculator(DefaultGeographicCRS.WGS84);
        // èµ·ç‚¹ç»çº¬åº¦
        geodeticCalculator.setStartingGeographicPoint(x1, y1);
        // æœ«ç‚¹ç»çº¬åº¦
        geodeticCalculator.setDestinationGeographicPoint(x2, y2);
        // è®¡ç®—距离,单位:米
        double distance = geodeticCalculator.getOrthodromicDistance();
        return round2(distance);
    }
    /**
     * ä¿ç•™2位小数
     */
    public static double round2(double d) {
        return ((long) (d * 100)) / 100D;
    }
    /**
     * ä¿ç•™6位小数
     */
    public static double round6(double d) {
        return ((long) (d * 1000000)) / 1000000D;
    }
    /**
     * è®¡ç®—角度
     */
    public static double getAngle(double x1, double y1, double x2, double y2) {
        try {
            CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
            DirectPosition2D p1 = new DirectPosition2D(crs, x1, y1);
            DirectPosition2D p2 = new DirectPosition2D(crs, x2, y2);
            GeodeticCalculator gc = new GeodeticCalculator();
            gc.setStartingGeographicPoint(p1);
            gc.setDestinationGeographicPoint(p2);
            double angle = gc.getAzimuth();
            return round2(angle);
        } catch (Exception ex) {
            return 0;
        }
    }
    /**
     * è®¡ç®—角度2
     */
    public static double getAngle2(double x1, double y1, double x2, double y2) {
        try {
            DirectPosition2D p1 = new DirectPosition2D(x1, y1);
            DirectPosition2D p2 = new DirectPosition2D(x2, y2);
            GeodeticCalculator gc = new GeodeticCalculator();
            gc.setStartingGeographicPoint(p1);
            gc.setDestinationGeographicPoint(p2);
            double angle = gc.getAzimuth();
            return round2(angle);
        } catch (Exception ex) {
            return 0;
        }
    }
    /**
     * èŽ·å–åæ ‡
     *
     * @param su
     * @return
     */
    public static Coordinate getCoordinate(DistanceSuYuan su) {
        String[] sirs = su.getId().split("_");
        int x = Integer.parseInt(sirs[0]);
        int y = Integer.parseInt(sirs[1]);
        double lon = CalculateUtils.getLon(x, y);
        double lat = CalculateUtils.getLat(x, y);
        return new Coordinate(lon, lat);
    }
    /**
     * è®¡ç®—经度
     *
     * @param @param  x
     * @param @param  y
     * @param @return å‚æ•°
     * @return double è¿”回类型
     * @throws
     * @Title: getLon
     * @Description: è®¡ç®—经度
     */
    public static double getLon(int x, int y) {
        double lon = 115.9165227 + 0.000116732 * (x - 0.5) + 0.00000116862 * (y - 0.5);
        if (lon < 115 || lon > 116) {
            System.out.println("lon is invalid");
        }
        return round6(lon);
    }
    /**
     * è®¡ç®—维度
     *
     * @param @param  x
     * @param @param  y
     * @param @return å‚æ•°
     * @return double è¿”回类型
     * @throws
     * @Title: getLat
     * @Description: è®¡ç®—维度
     */
    public static double getLat(int x, int y) {
        double lat = 39.77250000 + 0.000001000 * (x - 0.5) - 0.00009000000 * (y - 0.5);
        if (lat < 39 || lat > 40) {
            System.out.println("lat is invalid");
        }
        return round6(lat);
    }
    /**
     * @param @param  checkPoints
     * @param @return å‚æ•°
     * @return List<String> è¿”回类型
     * @throws
     * @Title: assembleId
     * @Description: ç»„装id
     */
    public static List<String> assembleId(List<MonitorPointPosition> checkPoints) {
        List<String> ids2d = new ArrayList<>();
        for (MonitorPointPosition point : checkPoints) {
            // ids2d.add(point.getX() + "_" + point.getY() + "_" + point.getZ());
            ids2d.add(point.getX() + "_" + point.getY() + "_" + 0);
        }
        return ids2d;
    }
    /**
     * @param @param  checkPoint
     * @param @param  range
     * @param @return å‚æ•°
     * @return List<String> è¿”回类型
     * @Title: aloneCrosswiseScope
     * @Description: å•独点位横向范围扩展
     * @backup å¼ºåˆ¶å°†å±‚级改为 0
     */
    public static List<String> aloneCrosswiseExtend(MonitorPointPosition checkPoint, int range) {
        List<String> ids = new ArrayList<>();
        Integer x = checkPoint.getX();
        Integer y = checkPoint.getY();
        for (int i = x - range / 2; i <= x + range / 2; i++) {
            for (int j = y - range / 2; j <= y + range / 2; j++) {
                // ids.add(i + "_" + j + "_" + checkPoint.getZ());
                ids.add(i + "_" + j + "_" + 0);
            }
        }
        return ids;
    }
    public static List<String> temporary(MonitorPointPosition point, int range) {
        List<String> ids3d = new ArrayList<>();
        Integer x = point.getX();
        Integer y = point.getY();
        Integer z = point.getZ();
        for (int i = x - range / 2; i <= x + range / 2; i++) {
            for (int j = y - range / 2; j <= y + range / 2; j++) {
                for (int k = z; k < 100; k++) {
                    ids3d.add(i + "_" + j + "_" + k);
                }
            }
        }
        return ids3d;
    }
    /**
     * èŽ·å–æ–¹å‘
     */
    public static String getDir(double direction) {
        if (direction < 0) {
            direction = direction + 360;
        }
        if (direction > 360) {
            direction = direction - 360;
        }
        if (direction >= 22.5 && direction < 67.5)
            return "东北";
        if (direction >= 67.5 && direction < 112.5)
            return "东";
        if (direction >= 112.5 && direction < 157.5)
            return "东南";
        if (direction >= 157.5 && direction < 202.5)
            return "南";
        if (direction >= 202.5 && direction < 247.5)
            return "西南";
        if (direction >= 247.5 && direction < 292.5)
            return "西";
        if (direction >= 292.5 && direction < 337.5)
            return "西北";
        return "北";
    }
    /**
     * è®¡ç®—X、Y值的矩形框
     */
    public static List<Coordinate> calcRect(double x, double y) {
        double buffer = 10;
        double dis = round6(Math.sqrt(Math.pow(buffer / 2, 2) * 2));
        List<Coordinate> list = new ArrayList<>();
        list.add(getPointByDisAndAngle(x, y, 315, dis));
        list.add(getPointByDisAndAngle(x, y, 45, dis));
        list.add(getPointByDisAndAngle(x, y, 135, dis));
        list.add(getPointByDisAndAngle(x, y, 225, dis));
        return list;
    }
    /**
     * æ ¹æ®è·ç¦»å’Œè§’度获取目标点
     */
    private static Coordinate getPointByDisAndAngle(double x, double y, double angle, double dis) {
        try {
            DirectPosition2D p1 = new DirectPosition2D(x, y);
            GeodeticCalculator gc = new GeodeticCalculator();
            gc.setStartingGeographicPoint(p1);
            gc.setDirection(angle, dis);
            Point2D dest = gc.getDestinationGeographicPoint();
            double newX = round6(dest.getX());
            double newY = round6(dest.getY());
            return new Coordinate(newX, newY);
        } catch (Exception ex) {
            return new Coordinate();
        }
    }
    /**
     * @param @return å‚æ•°
     * @return Double è¿”回类型
     * @throws
     * @Title: getWindSpeed
     * @Description: è®¡ç®—风速
     */
    public static Double getWindSpeed(double v, double u) {
        return round6(Math.sqrt(v * v + u * u));
    }
    /**
     * @param @param  v
     * @param @param  u
     * @param @return å‚æ•°
     * @return double è¿”回类型
     * @throws
     * @Title: getWindDirection
     * @Description: è®¡ç®—风向
     */
    public static double getWindDirection(double v, double u) {
        double result = Math.atan(u / (v + Math.pow(10, -5))) / Math.PI * 180;
        if (result < 0) {
            result += 180;
        } else if (u < 0 && v > 0) {
            result += 360;
        }
        return round6(result);
    }
    /**
     * @param @param  list æŽ’序对象
     * @param @param  property æŽ’序参数
     * @param @param  order æŽ’序顺序
     * @param @return å‚æ•°
     * @return List<Map < String, Object>> è¿”回类型
     * @throws
     * @Title: sort
     * @Description: æŽ’序
     */
    public static List<Map<String, Object>> sort(List<Map<String, Object>> list, final String property, final boolean order) {
        if (list == null || property == null) {
            return null;
        }
        Collections.sort(list, new Comparator<Map<String, Object>>() {
            @Override
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                try {
                    Object oo1 = o1.get(property);
                    Object oo2 = o2.get(property);
                    if (oo1 == null || "null".equals(oo1.toString()) || "".equals(oo1.toString()) || oo1.toString().endsWith("999")) {
                        oo1 = 0;
                    }
                    if (oo2 == null || "null".equals(oo2.toString()) || "".equals(oo2.toString()) || oo2.toString().endsWith("999")) {
                        oo2 = 0;
                    }
                    if (order) {
                        if (Double.parseDouble(oo1.toString()) < Double.parseDouble(oo2.toString())) {
                            return 1;
                        }
                    } else {
                        if (Double.parseDouble(oo1.toString()) > Double.parseDouble(oo2.toString())) {
                            return 1;
                        }
                    }
                    if (Double.parseDouble(oo1.toString()) == Double.parseDouble(oo2.toString())) {
                        return 0;
                    }
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
                }
                return -1;
            }
        });
        return list;
    }
}
src/main/java/com/yssh/utils/CommonConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.yssh.utils;
/**
 * @author wMeng
 * @ClassName CommonConstant
 * @Description TODO
 * @date 2022/10/30 13:30
 * @Version 1.0
 */
public interface CommonConstant {
    /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
    public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
    /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
    public static final Integer SC_OK_200 = 200;
    /**访问权限认证未通过 510*/
    public static final Integer SC_JEECG_NO_AUTHZ=510;
}
src/main/java/com/yssh/utils/CsvParser.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
package com.yssh.utils;
import java.util.ArrayList;
import java.util.List;
import com.yssh.entity.SuYuan;
import com.yssh.service.SuYuanService;
import com.github.biyanwen.impl.AbstractCsvFileParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CsvParser extends AbstractCsvFileParser<SuYuan> {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * æ¯éš”3000条存储数据库,然后清理list ï¼Œæ–¹ä¾¿å†…存回收
     */
    public static final int BATCH_COUNT = 100000;
    /**
     * ç¼“存的数据
     */
    private List<SuYuan> cachedData = new ArrayList<>(BATCH_COUNT);
    private SuYuanService suYuanService;
    private String time;
    public CsvParser(SuYuanService suYuanService, String time) {
        this.suYuanService = suYuanService;
        this.time = time;
    }
    /**
     * æ‰€æœ‰æ•°æ®è§£æžå®Œæˆäº† ä¼šæ¥è°ƒç”¨,防止有数据没有被保存
     */
    protected void doAfterAllAnalysed() {
        try {
            saveSuYuanData();
        } catch (Exception e) {
            logger.error("解析保存数据出现异常,异常原因是:" + e.getMessage(), e);
            e.printStackTrace();
        }
    }
    protected void invoke(SuYuan t) {
        t.setId(t.getX() + "_" + t.getY() + "_" + t.getZ());
        if ("0_0_0".equals(t.getId())) {
            return; // è§£å†³ä¸»é”®é‡å¤
        }
        //System.err.println(t.getId());
        cachedData.add(t);
        // è¾¾åˆ°BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
        if (cachedData.size() >= BATCH_COUNT) {
            try {
                saveSuYuanData();
            } catch (Exception e) {
                logger.error("解析保存数据出现异常,异常原因是:" + e.getMessage(), e);
                e.printStackTrace();
            }
            // å­˜å‚¨å®Œæˆæ¸…理 list
            cachedData = new ArrayList<>(BATCH_COUNT);
        }
    }
    private void saveSuYuanData() throws Exception {
        suYuanService.insertSuYuanDatas(cachedData, time);
    }
}
src/main/java/com/yssh/utils/DateUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,267 @@
package com.yssh.utils;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
 * æ—¶é—´å·¥å…·ç±»
 *
 * @author tam
 */
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
    public static String YYYY = "yyyy";
    public static String YYYY_MM = "yyyy-MM";
    public static String YYYY_MM_DD = "yyyy-MM-dd";
    public static String YYYYMM = "yyyyMM";
    public static String YYYYMMDDHH = "yyyyMMddHH";
    public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
    public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
    public static String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
    private static String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss",
            "yyyy.MM.dd HH:mm", "yyyy.MM" };
    /**
     * èŽ·å–å½“å‰Date型日期
     *
     * @return Date() å½“前日期
     */
    public static Date getNowDate() {
        return new Date();
    }
    /**
     * èŽ·å–å½“å‰æ—¥æœŸ, é»˜è®¤æ ¼å¼ä¸ºyyyy-MM-dd
     *
     * @return String
     */
    public static String getDate() {
        return dateTimeNow(YYYY_MM_DD);
    }
    public static final String getTime() {
        return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
    }
    public static final String dateTimeNow() {
        return dateTimeNow(YYYYMMDDHHMMSS);
    }
    public static final String dateTimeNow(final String format) {
        return parseDateToStr(format, new Date());
    }
    public static final String dateTime(final Date date) {
        return parseDateToStr(YYYY_MM_DD, date);
    }
    public static final String parseDateToStr(final String format, final Date date) {
        return new SimpleDateFormat(format).format(date);
    }
    public static final Date dateTime(final String format, final String ts) {
        try {
            return new SimpleDateFormat(format).parse(ts);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
    public static String getYyyyMm(Date date) {
        return new SimpleDateFormat(YYYYMM).format(date);
    }
    public static String getYyyyMmDdHh(Date date) {
        return new SimpleDateFormat(YYYYMMDDHH).format(date);
    }
    public static String getYyyyMmDdHhMmSs(Date date) {
        return new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS).format(date);
    }
    /**
     * æ—¥æœŸè·¯å¾„ å³å¹´/月/日 å¦‚2018/08/08
     */
    public static final String datePath() {
        Date now = new Date();
        return DateFormatUtils.format(now, "yyyy/MM/dd");
    }
    /**
     * æ—¥æœŸè·¯å¾„ å³å¹´/月/日 å¦‚20180808
     */
    public static final String dateTime() {
        Date now = new Date();
        return DateFormatUtils.format(now, "yyyyMMdd");
    }
    /**
     * æ—¥æœŸåž‹å­—符串转化为日期 æ ¼å¼
     */
    public static Date parseDate(Object str) {
        if (str == null) {
            return null;
        }
        try {
            return parseDate(str.toString(), parsePatterns);
        } catch (ParseException e) {
            return null;
        }
    }
    /**
     * èŽ·å–æœåŠ¡å™¨å¯åŠ¨æ—¶é—´
     */
    public static Date getServerStartDate() {
        long time = ManagementFactory.getRuntimeMXBean().getStartTime();
        return new Date(time);
    }
    /**
     * è®¡ç®—两个时间差
     */
    public static String getDatePoor(Date endDate, Date nowDate) {
        long nd = 1000 * 24 * 60 * 60;
        long nh = 1000 * 60 * 60;
        long nm = 1000 * 60;
        // long ns = 1000;
        // èŽ·å¾—ä¸¤ä¸ªæ—¶é—´çš„æ¯«ç§’æ—¶é—´å·®å¼‚
        long diff = endDate.getTime() - nowDate.getTime();
        // è®¡ç®—差多少天
        long day = diff / nd;
        // è®¡ç®—差多少小时
        long hour = diff % nd / nh;
        // è®¡ç®—差多少分钟
        long min = diff % nd % nh / nm;
        // è®¡ç®—差多少秒//输出结果
        // long sec = diff % nd % nh % nm / ns;
        return day + "天" + hour + "小时" + min + "分钟";
    }
    /**
     * @Title: differHour
     * @Description: èŽ·å–ä¸¤ä¸ªæ—¶é—´å·®å‡ ä¸ªå°æ—¶
     * @param: @param endDate
     * @param: @param nowDate
     * @param: @return
     * @return: long
     * @throws
     */
    public static int differDay(Date startDate, Date endDate){
        long nd = 1000 * 24 * 60 * 60;
        long diff = endDate.getTime() - startDate.getTime();
        double dd = Double.valueOf(String.valueOf(diff)) / nd;
        // è®¡ç®—差多少天
        return Double.valueOf(Math.ceil(dd)).intValue();
    }
    /**
     * @Description: èŽ·å–ä¸€æ®µæ—¶é—´é—´éš”
     * @param:date éœ€è¦æ“ä½œçš„æ—¶é—´å¯¹è±¡
     * @param:day æ“ä½œçš„æ—¶é—´é—´éš”
     *     æ­£æ•°ä¸ºä¹‹åŽä¸€æ®µæ—¶é—´
     *     è´Ÿæ•°ä¸ºä¹‹å‰ä¸€æ®µæ—¶é—´
     * @param:dateType æ“ä½œçš„æ—¶é—´æ—¶åˆ†ç§’天选择
     * å¸¸ç”¨æœ‰ï¼š
     *     Calendar.MINUTE åˆ†
     *     Calendar.HOUR_OF_DAY æ—¶
     *     Calendar.DATE å¤©
     *     Calendar.MONTH æœˆ
     */
    public static Date getAPeriodOfTime(Date date, int day,int dateType) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        calendar.add(dateType, day);
        return calendar.getTime();
    }
    public static List<String> get3Hours() {
        List<String> times = new ArrayList<>();
        SimpleDateFormat ymdh = new SimpleDateFormat(YYYYMMDDHH);
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.HOUR_OF_DAY, 1);
        for (int i = 0; i < 3; i++) {
            calendar.add(Calendar.HOUR_OF_DAY, -1);
            String time = ymdh.format(calendar.getTime());
            // times.add(time);
            times.add(0, time);
        }
        return times;
    }
    /**
     */
    public static Map<Date, Date> segmentationDateByTimeQuantum(Date startDate, Date endDate, int timeQuantum,int dateType){
        LinkedHashMap<Date, Date> result = new LinkedHashMap<Date, Date>();
        long startTimeMillisecond= startDate.getTime();
        long endTimeMillisecond = endDate.getTime();
        Long quantumTimeMillisecond = 0L;
        switch (dateType) {
        case Calendar.DATE:
            quantumTimeMillisecond = new Integer(1000 * 60 * 60 * 24 * timeQuantum).longValue();
            break;
        case Calendar.HOUR_OF_DAY:
            quantumTimeMillisecond = new Integer(1000 * 60 * 60 * timeQuantum).longValue();
            break;
        case Calendar.MINUTE:
            quantumTimeMillisecond = new Integer(1000 * 60 * timeQuantum).longValue();
            break;
        default:
            break;
        }
        for (long time = startTimeMillisecond; time < endTimeMillisecond; time += quantumTimeMillisecond) {
            Date beginDate = new Date(time);
            Date finishDate = new Date(time + quantumTimeMillisecond);
            if (finishDate.getTime() > endTimeMillisecond) {
                finishDate = endDate;
            }
            result.put(beginDate, finishDate);
        }
        return result;
    }
    /**
     * èŽ·å–æœ¬æœˆç¬¬ä¸€å¤©
     * @return String
     **/
    public static Date getMonthStart() {
        Calendar cal = Calendar.getInstance();
        //cal.set(Calendar.MONTH, 3);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        return dateTime(YYYY_MM_DD_HH_MM_SS, parseDateToStr(YYYY_MM_DD, cal.getTime()) + " 00:00:00");
    }
    /**
     * èŽ·å–æœ¬æœˆæœ€åŽä¸€å¤©
     * @return String
     **/
    public static Date getMonthEnd() {
        Calendar cal = Calendar.getInstance();
        //cal.set(Calendar.MONTH, 3);
        cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
        return dateTime(YYYY_MM_DD_HH_MM_SS, parseDateToStr(YYYY_MM_DD, cal.getTime()) + " 23:59:59");
    }
    public static void main(String[] args) {
        //System.out.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getMonthStart()));
        //System.err.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getMonthEnd()));
        System.out.println(parseDateToStr(YYYY_MM_DD_HH_MM_SS, getAPeriodOfTime(getNowDate(), -7, Calendar.DATE)));
    }
}
src/main/java/com/yssh/utils/FileUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,76 @@
package com.yssh.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
/**
 * æ–‡ä»¶å·¥å…·ç±»
 * @author WWW
 * @date 2023-06-06
 */
public class FileUtils {
    public final static int SIXTEEN = 16;
    public static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
    /**
     * 1.获取文件的MD5
     */
    @SuppressWarnings("unused")
    public static String getFileMd5(String filePath) {
        FileInputStream fis = null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            fis = new FileInputStream(new File(filePath));
            FileChannel fChannel = fis.getChannel();
            ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024);
            while (fChannel.read(buffer) != -1) {
                buffer.flip();
                md.update(buffer);
                buffer.compact();
            }
            byte[] b = md.digest();
            return byteToHexString(b);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        } finally {
            try {
                if (null != fis) {
                    fis.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
    /**
     * å­—节码转16进制
     */
    public static String byteToHexString(byte[] tmp) {
        // æ¯ä¸ªå­—节用 16 è¿›åˆ¶è¡¨ç¤ºçš„话,使用两个字符,
        char[] str = new char[16 * 2];
        // æ‰€ä»¥è¡¨ç¤ºæˆ 16 è¿›åˆ¶éœ€è¦ 32 ä¸ªå­—符,表示转换结果中对应的字符位置
        int k = 0;
        // ä»Žç¬¬ä¸€ä¸ªå­—节开始,对 MD5 çš„æ¯ä¸€ä¸ªå­—节
        for (int i = 0; i < SIXTEEN; i++) {
            // è½¬æ¢æˆ 16 è¿›åˆ¶å­—符的转换
            byte byte0 = tmp[i];
            // å–字节中高 4 ä½çš„æ•°å­—转换
            str[k++] = HEX_DIGITS[byte0 >>> 4 & 0xf];
            // >>> ä¸ºé€»è¾‘右移,将符号位一起右移, å–字节中低 4 ä½çš„æ•°å­—转换
            str[k++] = HEX_DIGITS[byte0 & 0xf];
        }
        // æ¢åŽçš„结果转换为字符串
        return new String(str);
    }
}
src/main/java/com/yssh/utils/GisUtil.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package com.yssh.utils;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.Coordinate;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
public class GisUtil {
    /**
     * @param srcNo
     *            æºåæ ‡ç³»EPSG代号
     * @param targetNo
     *            ç›®æ ‡åæ ‡ç³»EPSG代号
     * @param x
     *            æºåæ ‡x
     * @param y
     *            æºåæ ‡y
     * @Description: åæ ‡ç³»è½¬æ¢
     */
    public static Coordinate coordinateTransform(String sourceCRS, String targetCRS,
            double x, double y) {
        Coordinate tar = new Coordinate();
        try {
            CoordinateReferenceSystem src = CRS.decode(sourceCRS);
            CoordinateReferenceSystem target = CRS.decode(targetCRS);
            MathTransform transform = CRS.findMathTransform(src, target, true);
            Coordinate sour = new Coordinate(x, y);
            return JTS.transform(sour, tar, transform);
        } catch (Exception e) {
        }
        return tar;
    }
}
src/main/java/com/yssh/utils/HttpStatus.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package com.yssh.utils;
/**
 * è¿”回状态码
 *
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
public class HttpStatus
{
    /**
     * æ“ä½œæˆåŠŸ
     */
    public static final int SUCCESS = 200;
    /**
     * å¯¹è±¡åˆ›å»ºæˆåŠŸ
     */
    public static final int CREATED = 201;
    /**
     * è¯·æ±‚已经被接受
     */
    public static final int ACCEPTED = 202;
    /**
     * æ“ä½œå·²ç»æ‰§è¡ŒæˆåŠŸï¼Œä½†æ˜¯æ²¡æœ‰è¿”å›žæ•°æ®
     */
    public static final int NO_CONTENT = 204;
    /**
     * èµ„源已被移除
     */
    public static final int MOVED_PERM = 301;
    /**
     * é‡å®šå‘
     */
    public static final int SEE_OTHER = 303;
    /**
     * èµ„源没有被修改
     */
    public static final int NOT_MODIFIED = 304;
    /**
     * å‚数列表错误(缺少,格式不匹配)
     */
    public static final int BAD_REQUEST = 400;
    /**
     * æœªæŽˆæƒ
     */
    public static final int UNAUTHORIZED = 401;
    /**
     * è®¿é—®å—限,授权过期
     */
    public static final int FORBIDDEN = 403;
    /**
     * èµ„源,服务未找到
     */
    public static final int NOT_FOUND = 404;
    /**
     * ä¸å…è®¸çš„http方法
     */
    public static final int BAD_METHOD = 405;
    /**
     * èµ„源冲突,或者资源被锁
     */
    public static final int CONFLICT = 409;
    /**
     * ä¸æ”¯æŒçš„æ•°æ®ï¼Œåª’体类型
     */
    public static final int UNSUPPORTED_TYPE = 415;
    /**
     * ç³»ç»Ÿå†…部错误
     */
    public static final int ERROR = 500;
    /**
     * æŽ¥å£æœªå®žçް
     */
    public static final int NOT_IMPLEMENTED = 501;
    /**
     * ç³»ç»Ÿè­¦å‘Šæ¶ˆæ¯
     */
    public static final int WARN = 601;
}
src/main/java/com/yssh/utils/Result.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,154 @@
package com.yssh.utils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * @author wMeng
 * @ClassName Result
 * @Description TODO
 * @date 2022/10/30 13:29
 * @Version 1.0
 */
@Data
@ApiModel(value = "通用结果集",description = "通用结果集")
public class Result<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * æˆåŠŸæ ‡å¿—
     */
    @ApiModelProperty(value = "成功标志符")
    private boolean success = true;
    /**
     * è¿”回处理消息
     */
    @ApiModelProperty(value = "处理消息")
    private String message = "操作成功!";
    /**
     * è¿”回代码
     */
    @ApiModelProperty(value = "结果代码")
    private Integer code = 0;
    /**
     * è¿”回数据对象 data
     */
    @ApiModelProperty(value = "数据对象")
    private T result;
    /**
     * æ—¶é—´æˆ³
     */
    @ApiModelProperty(value = "时间戳")
    private long timestamp = System.currentTimeMillis();
    public Result() {
    }
    public Result<T> success(String message) {
        this.message = message;
        this.code = CommonConstant.SC_OK_200;
        this.success = true;
        return this;
    }
    @Deprecated
    public static Result<Object> ok() {
        Result<Object> r = new Result<Object>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setMessage("成功");
        return r;
    }
    @Deprecated
    public static Result<Object> ok(String msg) {
        Result<Object> r = new Result<Object>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setMessage(msg);
        return r;
    }
    @Deprecated
    public static Result<Object> ok(Object data) {
        Result<Object> r = new Result<Object>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setResult(data);
        return r;
    }
    public static<T> Result<T> OK() {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setMessage("成功");
        return r;
    }
    public static<T> Result<T> OK(T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setResult(data);
        return r;
    }
    public static<T> Result<T> OK(String msg, T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(true);
        r.setCode(CommonConstant.SC_OK_200);
        r.setMessage(msg);
        r.setResult(data);
        return r;
    }
    public static<T> Result<T> error(String msg, T data) {
        Result<T> r = new Result<T>();
        r.setSuccess(false);
        r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
        r.setMessage(msg);
        r.setResult(data);
        return r;
    }
    public static Result<Object> error(String msg) {
        return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
    }
    public static Result<Object> error(int code, String msg) {
        Result<Object> r = new Result<Object>();
        r.setCode(code);
        r.setMessage(msg);
        r.setSuccess(false);
        return r;
    }
    public Result<T> error500(String message) {
        this.message = message;
        this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
        this.success = false;
        return this;
    }
    /**
     * æ— æƒé™è®¿é—®è¿”回结果
     */
    public static Result<Object> noauth(String msg) {
        return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
    }
    @JsonIgnore
    private String onlTable;
}
src/main/java/com/yssh/utils/ServletInitializer.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.yssh.utils;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import com.yssh.Application;
/**
 * @author wMeng
 * @ClassName ServletInitializer
 * @Description TODO
 * @date 2022/10/31 18:46
 * @Version 1.0
 */
public class ServletInitializer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        // ä»£ç è®¾ç½®æ—¥å¿—
        //System.setProperty("logging.config", "classpath:logback.xml");
        return application.sources(Application.class);
    }
}
src/main/java/com/yssh/utils/SpringUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,135 @@
package com.yssh.utils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
 * spring工具类 æ–¹ä¾¿åœ¨éžspring管理环境中获取bean
 *
 * @author tam
 */
@Component
public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware {
    /** Spring应用上下文环境 */
    private static ConfigurableListableBeanFactory beanFactory;
    private static ApplicationContext applicationContext;
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        SpringUtils.beanFactory = beanFactory;
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        SpringUtils.applicationContext = applicationContext;
    }
    /**
     * èŽ·å–å¯¹è±¡
     *
     * @param name
     * @return Object ä¸€ä¸ªä»¥æ‰€ç»™åå­—注册的bean的实例
     * @throws org.springframework.beans.BeansException
     *
     */
    @SuppressWarnings("unchecked")
    public static <T> T getBean(String name) throws BeansException {
        return (T) beanFactory.getBean(name);
    }
    /**
     * èŽ·å–ç±»åž‹ä¸ºrequiredType的对象
     *
     * @param clz
     * @return
     * @throws org.springframework.beans.BeansException
     *
     */
    public static <T> T getBean(Class<T> clz) throws BeansException {
        T result = (T) beanFactory.getBean(clz);
        return result;
    }
    /**
     * å¦‚æžœBeanFactory包含一个与所给名称匹配的bean定义,则返回true
     *
     * @param name
     * @return boolean
     */
    public static boolean containsBean(String name) {
        return beanFactory.containsBean(name);
    }
    /**
     * åˆ¤æ–­ä»¥ç»™å®šåå­—注册的bean定义是一个singleton还是一个prototype。
     * å¦‚果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
     *
     * @param name
     * @return boolean
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
     *
     */
    public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
        return beanFactory.isSingleton(name);
    }
    /**
     * @param name
     * @return Class æ³¨å†Œå¯¹è±¡çš„类型
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
     *
     */
    public static Class<?> getType(String name) throws NoSuchBeanDefinitionException {
        return beanFactory.getType(name);
    }
    /**
     * å¦‚果给定的bean名字在bean定义中有别名,则返回这些别名
     *
     * @param name
     * @return
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
     *
     */
    public static String[] getAliases(String name) throws NoSuchBeanDefinitionException {
        return beanFactory.getAliases(name);
    }
    /**
     * èŽ·å–aop代理对象
     *
     * @param invoker
     * @return
     */
    @SuppressWarnings("unchecked")
    public static <T> T getAopProxy(T invoker) {
        return (T) AopContext.currentProxy();
    }
    /**
     * èŽ·å–å½“å‰çš„çŽ¯å¢ƒé…ç½®ï¼Œæ— é…ç½®è¿”å›žnull
     *
     * @return å½“前的环境配置
     */
    public static String[] getActiveProfiles() {
        return applicationContext.getEnvironment().getActiveProfiles();
    }
    /**
     * èŽ·å–å½“å‰çš„çŽ¯å¢ƒé…ç½®ï¼Œå½“æœ‰å¤šä¸ªçŽ¯å¢ƒé…ç½®æ—¶ï¼ŒåªèŽ·å–ç¬¬ä¸€ä¸ª
     *
     * @return å½“前的环境配置
     */
    public static String getActiveProfile() {
        final String[] activeProfiles = getActiveProfiles();
        return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
    }
}
src/main/java/com/yssh/utils/StringUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,528 @@
package com.yssh.utils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.util.AntPathMatcher;
/**
 * å­—符串工具类
 *
 * @author xingjinshuang@smartearth.cn
 * @date 2023-02-06
 */
public class StringUtils extends org.apache.commons.lang3.StringUtils {
    /** ç©ºå­—符串 */
    private static final String NULLSTR = "";
    /** ä¸‹åˆ’线 */
    private static final char SEPARATOR = '_';
    /**
     * èŽ·å–å‚æ•°ä¸ä¸ºç©ºå€¼
     *
     * @param value
     *            defaultValue è¦åˆ¤æ–­çš„value
     * @return value è¿”回值
     */
    public static <T> T nvl(T value, T defaultValue) {
        return value != null ? value : defaultValue;
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªCollection是否为空, åŒ…含List,Set,Queue
     *
     * @param coll
     *            è¦åˆ¤æ–­çš„Collection
     * @return true:为空 false:非空
     */
    public static boolean isEmpty(Collection<?> coll) {
        return isNull(coll) || coll.isEmpty();
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªCollection是否非空,包含List,Set,Queue
     *
     * @param coll
     *            è¦åˆ¤æ–­çš„Collection
     * @return true:非空 false:空
     */
    public static boolean isNotEmpty(Collection<?> coll) {
        return !isEmpty(coll);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå¯¹è±¡æ•°ç»„是否为空
     *
     * @param objects
     *            è¦åˆ¤æ–­çš„对象数组
     ** @return true:为空 false:非空
     */
    public static boolean isEmpty(Object[] objects) {
        return isNull(objects) || (objects.length == 0);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå¯¹è±¡æ•°ç»„是否非空
     *
     * @param objects
     *            è¦åˆ¤æ–­çš„对象数组
     * @return true:非空 false:空
     */
    public static boolean isNotEmpty(Object[] objects) {
        return !isEmpty(objects);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªMap是否为空
     *
     * @param map
     *            è¦åˆ¤æ–­çš„Map
     * @return true:为空 false:非空
     */
    public static boolean isEmpty(Map<?, ?> map) {
        return isNull(map) || map.isEmpty();
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªMap是否为空
     *
     * @param map
     *            è¦åˆ¤æ–­çš„Map
     * @return true:非空 false:空
     */
    public static boolean isNotEmpty(Map<?, ?> map) {
        return !isEmpty(map);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå­—符串是否为空串
     *
     * @param str
     *            String
     * @return true:为空 false:非空
     */
    public static boolean isEmpty(String str) {
        return isNull(str) || NULLSTR.equals(str.trim());
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå­—符串是否为非空串
     *
     * @param str
     *            String
     * @return true:非空串 false:空串
     */
    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå¯¹è±¡æ˜¯å¦ä¸ºç©º
     *
     * @param object
     *            Object
     * @return true:为空 false:非空
     */
    public static boolean isNull(Object object) {
        return object == null;
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå¯¹è±¡æ˜¯å¦éžç©º
     *
     * @param object
     *            Object
     * @return true:非空 false:空
     */
    public static boolean isNotNull(Object object) {
        return !isNull(object);
    }
    /**
     * * åˆ¤æ–­ä¸€ä¸ªå¯¹è±¡æ˜¯å¦æ˜¯æ•°ç»„类型(Java基本型别的数组)
     *
     * @param object
     *            å¯¹è±¡
     * @return true:是数组 false:不是数组
     */
    public static boolean isArray(Object object) {
        return isNotNull(object) && object.getClass().isArray();
    }
    /**
     * åŽ»ç©ºæ ¼
     */
    public static String trim(String str) {
        return (str == null ? "" : str.trim());
    }
    /**
     * æˆªå–字符串
     *
     * @param str
     *            å­—符串
     * @param start
     *            å¼€å§‹
     * @return ç»“æžœ
     */
    public static String substring(final String str, int start) {
        if (str == null) {
            return NULLSTR;
        }
        if (start < 0) {
            start = str.length() + start;
        }
        if (start < 0) {
            start = 0;
        }
        if (start > str.length()) {
            return NULLSTR;
        }
        return str.substring(start);
    }
    /**
     * æˆªå–字符串
     *
     * @param str
     *            å­—符串
     * @param start
     *            å¼€å§‹
     * @param end
     *            ç»“束
     * @return ç»“æžœ
     */
    public static String substring(final String str, int start, int end) {
        if (str == null) {
            return NULLSTR;
        }
        if (end < 0) {
            end = str.length() + end;
        }
        if (start < 0) {
            start = str.length() + start;
        }
        if (end > str.length()) {
            end = str.length();
        }
        if (start > end) {
            return NULLSTR;
        }
        if (start < 0) {
            start = 0;
        }
        if (end < 0) {
            end = 0;
        }
        return str.substring(start, end);
    }
    /**
     * å­—符串转set
     *
     * @param str
     *            å­—符串
     * @param sep
     *            åˆ†éš”符
     * @return set集合
     */
    public static final Set<String> str2Set(String str, String sep) {
        return new HashSet<String>(str2List(str, sep, true, false));
    }
    /**
     * å­—符串转list
     *
     * @param str
     *            å­—符串
     * @param sep
     *            åˆ†éš”符
     * @param filterBlank
     *            è¿‡æ»¤çº¯ç©ºç™½
     * @param trim
     *            åŽ»æŽ‰é¦–å°¾ç©ºç™½
     * @return list集合
     */
    public static final List<String> str2List(String str, String sep,
            boolean filterBlank, boolean trim) {
        List<String> list = new ArrayList<String>();
        if (StringUtils.isEmpty(str)) {
            return list;
        }
        // è¿‡æ»¤ç©ºç™½å­—符串
        if (filterBlank && StringUtils.isBlank(str)) {
            return list;
        }
        String[] split = str.split(sep);
        for (String string : split) {
            if (filterBlank && StringUtils.isBlank(string)) {
                continue;
            }
            if (trim) {
                string = string.trim();
            }
            list.add(string);
        }
        return list;
    }
    /**
     * åˆ¤æ–­ç»™å®šçš„set列表中是否包含数组array åˆ¤æ–­ç»™å®šçš„æ•°ç»„array中是否包含给定的元素value
     *
     * @param ç»™å®šçš„集合
     * @param array
     *            ç»™å®šçš„æ•°ç»„
     * @return boolean ç»“æžœ
     */
    public static boolean containsAny(Collection<String> collection,
            String... array) {
        if (isEmpty(collection) || isEmpty(array)) {
            return false;
        } else {
            for (String str : array) {
                if (collection.contains(str)) {
                    return true;
                }
            }
            return false;
        }
    }
    /**
     * æŸ¥æ‰¾æŒ‡å®šå­—符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
     *
     * @param cs
     *            æŒ‡å®šå­—符串
     * @param searchCharSequences
     *            éœ€è¦æ£€æŸ¥çš„字符串数组
     * @return æ˜¯å¦åŒ…含任意一个字符串
     */
    public static boolean containsAnyIgnoreCase(CharSequence cs,
            CharSequence... searchCharSequences) {
        if (isEmpty(cs) || isEmpty(searchCharSequences)) {
            return false;
        }
        for (CharSequence testStr : searchCharSequences) {
            if (containsIgnoreCase(cs, testStr)) {
                return true;
            }
        }
        return false;
    }
    /**
     * é©¼å³°è½¬ä¸‹åˆ’线命名
     */
    public static String toUnderScoreCase(String str) {
        if (str == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        // å‰ç½®å­—符是否大写
        boolean preCharIsUpperCase = true;
        // å½“前字符是否大写
        boolean curreCharIsUpperCase = true;
        // ä¸‹ä¸€å­—符是否大写
        boolean nexteCharIsUpperCase = true;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (i > 0) {
                preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
            } else {
                preCharIsUpperCase = false;
            }
            curreCharIsUpperCase = Character.isUpperCase(c);
            if (i < (str.length() - 1)) {
                nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
            }
            if (preCharIsUpperCase && curreCharIsUpperCase
                    && !nexteCharIsUpperCase) {
                sb.append(SEPARATOR);
            } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
                sb.append(SEPARATOR);
            }
            sb.append(Character.toLowerCase(c));
        }
        return sb.toString();
    }
    /**
     * æ˜¯å¦åŒ…含字符串
     *
     * @param str
     *            éªŒè¯å­—符串
     * @param strs
     *            å­—符串组
     * @return åŒ…含返回true
     */
    public static boolean inStringIgnoreCase(String str, String... strs) {
        if (str != null && strs != null) {
            for (String s : strs) {
                if (str.equalsIgnoreCase(trim(s))) {
                    return true;
                }
            }
        }
        return false;
    }
    /**
     * å°†ä¸‹åˆ’线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。
     * ä¾‹å¦‚:HELLO_WORLD->HelloWorld
     *
     * @param name
     *            è½¬æ¢å‰çš„下划线大写方式命名的字符串
     * @return è½¬æ¢åŽçš„驼峰式命名的字符串
     */
    public static String convertToCamelCase(String name) {
        StringBuilder result = new StringBuilder();
        // å¿«é€Ÿæ£€æŸ¥
        if (name == null || name.isEmpty()) {
            // æ²¡å¿…要转换
            return "";
        } else if (!name.contains("_")) {
            // ä¸å«ä¸‹åˆ’线,仅将首字母大写
            return name.substring(0, 1).toUpperCase() + name.substring(1);
        }
        // ç”¨ä¸‹åˆ’线将原始字符串分割
        String[] camels = name.split("_");
        for (String camel : camels) {
            // è·³è¿‡åŽŸå§‹å­—ç¬¦ä¸²ä¸­å¼€å¤´ã€ç»“å°¾çš„ä¸‹æ¢çº¿æˆ–åŒé‡ä¸‹åˆ’çº¿
            if (camel.isEmpty()) {
                continue;
            }
            // é¦–字母大写
            result.append(camel.substring(0, 1).toUpperCase());
            result.append(camel.substring(1).toLowerCase());
        }
        return result.toString();
    }
    /**
     * é©¼å³°å¼å‘½åæ³• ä¾‹å¦‚:user_name->userName
     */
    public static String toCamelCase(String s) {
        if (s == null) {
            return null;
        }
        s = s.toLowerCase();
        StringBuilder sb = new StringBuilder(s.length());
        boolean upperCase = false;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == SEPARATOR) {
                upperCase = true;
            } else if (upperCase) {
                sb.append(Character.toUpperCase(c));
                upperCase = false;
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
    /**
     * æŸ¥æ‰¾æŒ‡å®šå­—符串是否匹配指定字符串列表中的任意一个字符串
     *
     * @param str
     *            æŒ‡å®šå­—符串
     * @param strs
     *            éœ€è¦æ£€æŸ¥çš„字符串数组
     * @return æ˜¯å¦åŒ¹é…
     */
    public static boolean matches(String str, List<String> strs) {
        if (isEmpty(str) || isEmpty(strs)) {
            return false;
        }
        for (String pattern : strs) {
            if (isMatch(pattern, str)) {
                return true;
            }
        }
        return false;
    }
    /**
     * åˆ¤æ–­url是否与规则配置: ? è¡¨ç¤ºå•个字符; * è¡¨ç¤ºä¸€å±‚路径内的任意字符串,不可跨层级; ** è¡¨ç¤ºä»»æ„å±‚路径;
     *
     * @param pattern
     *            åŒ¹é…è§„则
     * @param url
     *            éœ€è¦åŒ¹é…çš„url
     * @return
     */
    public static boolean isMatch(String pattern, String url) {
        AntPathMatcher matcher = new AntPathMatcher();
        return matcher.match(pattern, url);
    }
    @SuppressWarnings("unchecked")
    public static <T> T cast(Object obj) {
        return (T) obj;
    }
    /**
     * æ•°å­—左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 æœ€åŽsize个字符。
     *
     * @param num
     *            æ•°å­—对象
     * @param size
     *            å­—符串指定长度
     * @return è¿”回数字的字符串格式,该字符串为指定长度。
     */
    public static final String padl(final Number num, final int size) {
        return padl(num.toString(), size, '0');
    }
    /**
     * å­—符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
     *
     * @param s
     *            åŽŸå§‹å­—ç¬¦ä¸²
     * @param size
     *            å­—符串指定长度
     * @param c
     *            ç”¨äºŽè¡¥é½çš„字符
     * @return è¿”回指定长度的字符串,由原字符串左补齐或截取得到。
     */
    public static final String padl(final String s, final int size, final char c) {
        final StringBuilder sb = new StringBuilder(size);
        if (s != null) {
            final int len = s.length();
            if (s.length() <= size) {
                for (int i = size - len; i > 0; i--) {
                    sb.append(c);
                }
                sb.append(s);
            } else {
                return s.substring(len - size, len);
            }
        } else {
            for (int i = size; i > 0; i--) {
                sb.append(c);
            }
        }
        return sb.toString();
    }
}
src/main/java/com/yssh/utils/TableStrategy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package com.yssh.utils;
public class TableStrategy {
    public static final String SU_YUNA_TABLE_PREFIX = "su_yuan";
    public static String getTableStrategy(String time){
        return SU_YUNA_TABLE_PREFIX + "_" + time;
    }
}
src/main/java/com/yssh/utils/VocParser.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
package com.yssh.utils;
import com.github.biyanwen.impl.AbstractCsvFileParser;
import com.yssh.entity.VocVals;
import com.yssh.service.VocValsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * VOC转换类
 * @author WWW
 * @date 2023-06-05
 */
public class VocParser extends AbstractCsvFileParser<VocVals> {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    private final SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH0000");
    /**
     * æ¯éš”5000条入库一次
     */
    public static final int BATCH_COUNT = 100000;
    private BigInteger startId;
    private VocValsService vocValsService;
    private Date date;
    private List<VocVals> list = new ArrayList<>(BATCH_COUNT);
    public VocParser(VocValsService vocValsService, Date date) {
        this.vocValsService = vocValsService;
        this.date = date;
        this.startId = new BigInteger(format.format(date));
    }
    public BigInteger getId() {
        startId = startId.add(BigInteger.valueOf(1));
        return startId;
    }
    @Override
    protected void doAfterAllAnalysed() {
        inserts();
    }
    @Override
    protected void invoke(VocVals vv) {
        if (null == vv.getX() || vv.getX() < 0 || null == vv.getY() || vv.getY() < 0 || null == vv.getVal() || vv.getVal() <= 0) {
            return;
        }
        vv.setCreateTime(this.date);
        vv.setId(getId());
        list.add(vv);
        if (list.size() >= BATCH_COUNT) {
            inserts();
            list = new ArrayList<>(BATCH_COUNT);
        }
    }
    private void inserts() {
        try {
            if (list.size() > 0) {
                //this.vocValsService.insertVocVals(list);
                this.vocValsService.insertVocSync(list);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            e.printStackTrace();
        }
    }
}
src/main/resources/application-dev.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
# æ•°æ®æºé…ç½®
spring:
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://192.168.20.228:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        username: root
        password: 123456
        # åˆå§‹è¿žæŽ¥æ•°
        initialSize: 10
        # æœ€å°è¿žæŽ¥æ± æ•°é‡
        minIdle: 20
        # æœ€å¤§è¿žæŽ¥æ± æ•°é‡
        maxActive: 100
        # é…ç½®èŽ·å–è¿žæŽ¥ç­‰å¾…è¶…æ—¶çš„æ—¶é—´
        maxWait: 600000
        # é…ç½®é—´éš”多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
        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: admin
            login-password: admiN_1@#
        filter:
            stat:
                enabled: true
                # æ…¢SQL记录
                log-slow-sql: true
                slow-sql-millis: 1000
                merge-sql: true
            wall:
                config:
                    multi-statement-allow: true
src/main/resources/application-file.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
#dat配置路径
dat:
  filePath2d: 'D:\2022\dat\extract_mesh.dat'
  filePath3d: 'D:\2022\dat\correct_jk_47.dat'
#csv配置路径
csv:
  filePath: 'D:\2022\LBM_New'
  vocPath: 'D:\2022\voc_all'
src/main/resources/application-prod.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
# æ•°æ®æºé…ç½®
spring:
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://10.101.5.98:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        username: root
        password: 123456
        # åˆå§‹è¿žæŽ¥æ•°
        initialSize: 10
        # æœ€å°è¿žæŽ¥æ± æ•°é‡
        minIdle: 20
        # æœ€å¤§è¿žæŽ¥æ± æ•°é‡
        maxActive: 100
        # é…ç½®èŽ·å–è¿žæŽ¥ç­‰å¾…è¶…æ—¶çš„æ—¶é—´
        maxWait: 600000
        # é…ç½®é—´éš”多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
        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: admin
            login-password: admin
        filter:
            stat:
                enabled: true
                # æ…¢SQL记录
                log-slow-sql: true
                slow-sql-millis: 1000
                merge-sql: true
            wall:
                config:
                    multi-statement-allow: true
src/main/resources/application-scheduled.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
csv:
  # 221Mb CSV入库时间
  cron: '0 42 * * * ? '
  cron_max: 720
  # 112Kb CSV入库时间
  voc: '0 37 * * * ? '
  voc_max: 720
src/main/resources/application-test.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
# æ•°æ®æºé…ç½®
spring:
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        driverClassName: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://127.0.0.1:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
        username: root
        password: mysql
        # åˆå§‹è¿žæŽ¥æ•°
        initialSize: 10
        # æœ€å°è¿žæŽ¥æ± æ•°é‡
        minIdle: 20
        # æœ€å¤§è¿žæŽ¥æ± æ•°é‡
        maxActive: 100
        # é…ç½®èŽ·å–è¿žæŽ¥ç­‰å¾…è¶…æ—¶çš„æ—¶é—´
        maxWait: 600000
        # é…ç½®é—´éš”多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
        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: admin
            login-password: admin
        filter:
            stat:
                enabled: true
                # æ…¢SQL记录
                log-slow-sql: true
                slow-sql-millis: 1000
                merge-sql: true
            wall:
                config:
                    multi-statement-allow: true
src/main/resources/application.yml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
server:
  tomcat:
    uri-encoding: UTF-8
    max-connections: 1000
    threads:
      # tomcat最大线程数,默认为200
      max: 1000
      # Tomcat启动初始化的线程数,默认值25
      min-spare: 25
  port: 9001
  servlet:
    context-path: /
spring:
  application:
    name: yssh
  # session
  session:
    timeout: PT20M # 20分钟
  profiles:
    active: dev
    include: scheduled,file
  # è®¾ç½®ä¸Šä¼ æ–‡ä»¶å¤§å°
  servlet:
    multipart:
      enabled: true
      max-file-size: 204800MB
      max-request-size: 1048576MB
  # jackson
  jackson:
    time-zone: GMT+8
    date-format: yyyy-MM-dd HH:mm:ss
    locale: zh_CN
  thymeleaf:
    cache: false
  # æœåŠ¡æ¨¡å—
  devtools:
    restart:
      # çƒ­éƒ¨ç½²å¼€å…³
      enabled: true
mybatis-plus:
  type-aliases-package: com.yssh.entity
  config-location: classpath:mybatis.xml
  mapper-locations: classpath:mapper/**/*.xml
# logging
logging:
  level:
    com.yssh: info
    org.springframework: warn
  #config: classpath:logback-spring.xml
knife4j:
  # æ˜¯å¦å¼€å¯Swagger
  enabled: true
  # è¯·æ±‚前缀
  pathMapping:
  # æ˜¯å¦å¼€å¯Knife4j增强模式,默认是 false
  enable: true
src/main/resources/logback.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- æ—¥å¿—存放路径 -->
    <property name="log.path" value="logs/" />
    <!-- æ—¥å¿—输出格式 -->
    <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
    <!-- æŽ§åˆ¶å°è¾“出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>
    <appender name="file_debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/sys-debug.log</file>
        <!-- å¾ªçŽ¯æ”¿ç­–ï¼šåŸºäºŽæ—¶é—´åˆ›å»ºæ—¥å¿—æ–‡ä»¶ -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- æ—¥å¿—文件名格式 -->
            <fileNamePattern>${log.path}/sys-debug.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- æ—¥å¿—最大的历史 60天 -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!-- è¿‡æ»¤çš„级别 -->
            <level>DEBUG</level>
            <!-- åŒ¹é…æ—¶çš„æ“ä½œï¼šæŽ¥æ”¶ï¼ˆè®°å½•) -->
            <onMatch>ACCEPT</onMatch>
            <!-- ä¸åŒ¹é…æ—¶çš„æ“ä½œï¼šæ‹’绝(不记录) -->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <!-- ç³»ç»Ÿæ—¥å¿—输出 -->
    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/sys-info.log</file>
        <!-- å¾ªçŽ¯æ”¿ç­–ï¼šåŸºäºŽæ—¶é—´åˆ›å»ºæ—¥å¿—æ–‡ä»¶ -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- æ—¥å¿—文件名格式 -->
            <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- æ—¥å¿—最大的历史 60天 -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!-- è¿‡æ»¤çš„级别 -->
            <level>INFO</level>
            <!-- åŒ¹é…æ—¶çš„æ“ä½œï¼šæŽ¥æ”¶ï¼ˆè®°å½•) -->
            <onMatch>ACCEPT</onMatch>
            <!-- ä¸åŒ¹é…æ—¶çš„æ“ä½œï¼šæ‹’绝(不记录) -->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/sys-error.log</file>
        <!-- å¾ªçŽ¯æ”¿ç­–ï¼šåŸºäºŽæ—¶é—´åˆ›å»ºæ—¥å¿—æ–‡ä»¶ -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- æ—¥å¿—文件名格式 -->
            <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!-- æ—¥å¿—最大的历史 60天 -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!-- è¿‡æ»¤çš„级别 -->
            <level>ERROR</level>
            <!-- åŒ¹é…æ—¶çš„æ“ä½œï¼šæŽ¥æ”¶ï¼ˆè®°å½•) -->
            <onMatch>ACCEPT</onMatch>
            <!-- ä¸åŒ¹é…æ—¶çš„æ“ä½œï¼šæ‹’绝(不记录) -->
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
        </encoder>
    </appender>
    <!-- ç³»ç»Ÿæ¨¡å—日志级别控制  -->
    <logger name="com.yssh" level="info" />
    <!-- Spring日志级别控制  -->
    <logger name="org.springframework" level="error" />
    <!--系统操作日志-->
    <root level="info">
        <appender-ref ref="file_info" />
        <appender-ref ref="file_error" />
        <appender-ref ref="console" />
    </root>
</configuration>
src/main/resources/mapper/AlertConfigMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.AlertConfigMapper">
    <resultMap id="AlertConfigResult" type="com.yssh.entity.AlertConfig">
        <id column="id" property="id" />
        <result column="jcyj" property="jcyj" />
        <result column="jcbj" property="jcbj" />
        <result column="pfyj" property="pfyj" />
        <result column="pfbj" property="pfbj" />
    </resultMap>
    <sql id="alertConfigSQL">
        SELECT id, jcyj, jcbj, pfyj, pfbj
        FROM alert_config
    </sql>
    <select id="getAll" resultMap="AlertConfigResult">
        <include refid="alertConfigSQL"></include>
    </select>
    <select id="query" resultMap="AlertConfigResult" parameterType="Integer">
        <include refid="alertConfigSQL"></include>
        WHERE id= #{id}
    </select>
     <insert id="insert" parameterType="com.yssh.entity.AlertConfig">
        insert into alert_config (
            jcyj, jcbj, pfyj, pfbj
        )
        values (
            #{jcyj},#{jcbj},#{pfyj},#{pfbj}
        )
    </insert>
     <update id="update" parameterType="com.yssh.entity.AlertConfig">
        update alert_config
        <set >
            <if test="jcyj != null and jcyj != ''">
                jcyj = #{jcyj},
            </if>
            <if test="jcbj != null and jcbj != ''">
                jcbj = #{jcbj},
            </if>
            <if test="pfbj != null and pfbj != ''">
                pfbj = #{pfbj},
            </if>
            <if test="pfyj != null and pfyj != ''">
                pfyj = #{pfyj},
            </if>
        </set>
        where id = #{id}
    </update>
    <delete id="delete" parameterType="Integer">
        DELETE FROM alert_config WHERE id = #{id}
    </delete>
</mapper>
src/main/resources/mapper/CommonMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.CommonMapper">
    <select id="checkTableExistsWithSchema" resultType="java.lang.Integer">
        SELECT COUNT(1) FROM information_schema.tables WHERE
        table_schema=#{tableSchema} AND table_name = #{tableName}
    </select>
    <select id="checkTableExistsWithShow" parameterType="String"  resultType="java.util.Map">
        show tables like #{tableName}
    </select>
</mapper>
src/main/resources/mapper/DictRecordMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.DictRecordMapper">
    <resultMap id="DictRecordResult" type="com.yssh.entity.DictRecord">
        <id property="id"    column="id"    />
        <result property="tableName"    column="table_name"    />
        <result property="createTime"    column="create_time"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>
    <sql id="selectDictRecordVo">
        SELECT id, table_name, create_time
        FROM dict_record
    </sql>
    <select id="selectDictRecordList" parameterType="com.yssh.entity.DictRecord" resultMap="DictRecordResult">
        <include refid="selectDictRecordVo"/>
        <where>
            <if test="tableName != null  and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
        </where>
        ORDER BY create_time ASC
    </select>
    <select id="selectByCreateTime" parameterType="Long" resultMap="DictRecordResult">
        SELECT id, table_name, create_time
        FROM dict_record
        WHERE create_time = #{createTime}
        LIMIT 0, 1
    </select>
    <select id="selectByTime" resultMap="DictRecordResult">
        SELECT id, table_name, create_time
        FROM dict_record
        where str_to_date(create_time, '%Y%m%d%H') between #{start} and #{end}
        order by create_time;
    </select>
    <select id="selectByTimeDictRecordList" resultMap="DictRecordResult">
        SELECT id, table_name, create_time
        FROM dict_record
        WHERE create_time &gt; #{startTime}
        AND create_time &lt;= #{endTime}
        ORDER BY create_time ASC
    </select>
    <insert id="insertDictRecord" parameterType="com.yssh.entity.DictRecord" useGeneratedKeys="true" keyProperty="id">
        insert into dict_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="tableName != null and tableName != ''">table_name,</if>
            <if test="createTime != null">create_time,</if>
            <if test="remarks != null">remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="tableName != null and tableName != ''">#{tableName},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="remarks != null">#{remarks},</if>
        </trim>
    </insert>
    <delete id="deleteDictRecordById" parameterType="Long">
        delete from dict_record where id = #{id}
    </delete>
    <delete id="deleteDictRecordByIds" parameterType="Long">
        delete from dict_record where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <!--创建表的 SQL è¯­å¥-->
    <update id="createDictRecoTable">
        CREATE TABLE `dict_record`  (
          `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
          `table_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '表名称',
          `create_time` bigint(20) NULL DEFAULT NULL COMMENT '创建时间',
          `remarks` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
          PRIMARY KEY (`id`) USING BTREE
        ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    </update>
</mapper>
src/main/resources/mapper/EmissionMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.EmissionMapper">
    <resultMap id="EmissionResult" type="com.yssh.entity.Emission">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="lon" property="lon" />
        <result column="lat" property="lat" />
        <result column="value" property="value" />
        <result column="time" property="time" />
        <result column="property" property="property" />
    </resultMap>
    <select id="query" resultMap="EmissionResult">
        select id, name, lon, lat, format(value, 2) "value", time, property
        from emission
        <where>
             <if test="name != null and name != ''">
                   and name = #{name}
             </if>
        </where>
        order by time desc
    </select>
    <select id="getAll" resultMap="EmissionResult">
        select id, name, lon, lat, format(value, 2) "value", time, property
        from emission
    </select>
    <insert id="insert" parameterType="com.yssh.entity.Emission">
        insert into emission (
            name, lon, lat, value, time, property
        )
        values (
            #{name},#{lon},#{lat},#{value},#{time},#{property}
        )
    </insert>
    <delete id="delete">
        delete from emission where id = #{id}
    </delete>
</mapper>
src/main/resources/mapper/FeedbackMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.FeedbackMapper">
    <resultMap id="FeedbackDetailResult" type="com.yssh.entity.FeedbackDetail">
        <id property="id"    column="id"    />
        <result property="tableName"    column="table_name"    />
        <result property="locationName"    column="location_name"    />
        <result property="detectionId"    column="detection_id"    />
        <result property="detectionVocsName"    column="detection_vocs_name"    />
        <result property="detectionValue"    column="detection_value"    />
        <result property="practicalId"    column="practical_id"    />
        <result property="practicalVocsName"    column="practical_vocs_name"    />
        <result property="practicalValue"    column="practical_value"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
    <sql id="feedbackDetailSql">
        SELECT id, table_name, location_name, detection_id, detection_vocs_name, format(detection_value, 2) detection_value,
             practical_id, practical_vocs_name, format(practical_value, 2) practical_value, create_time
        FROM feedback
    </sql>
    <select id="selectById" parameterType="java.lang.Long" resultMap="FeedbackDetailResult">
        <include refid="feedbackDetailSql"></include>
        WHERE id = #{id}
    </select>
    <select id="selectSevenDayAccuracyAvg" parameterType="java.lang.Long" resultType="java.lang.Double">
        SELECT COUNT(id)/(SELECT COUNT(id) FROM feedback
        WHERE CONVERT(date_format(create_time, '%Y%m%d%H%'), SIGNED) &gt;= #{beginTime}) FROM feedback
        WHERE CONVERT(date_format(create_time, '%Y%m%d%H%'), SIGNED) &gt;= #{beginTime}
        AND practical_id IS NULL
    </select>
    <insert id="insert" parameterType="com.yssh.entity.FeedbackDetail" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO feedback
            (table_name, location_name, detection_id,
            detection_vocs_name, detection_value, practical_id,
            practical_vocs_name, practical_value, create_time)
        VALUES
            (#{tableName}, #{locationName}, #{detectionId},
            #{detectionVocsName}, #{detectionValue}, #{practicalId},
            #{practicalVocsName}, #{practicalValue}, #{createTime})
    </insert>
    <update id="update" parameterType="com.yssh.entity.FeedbackDetail">
        UPDATE feedback SET
        practical_id = #{practicalId}, practical_vocs_name = #{practicalVocsName}, practical_value = #{practicalValue}
        WHERE id = #{id}
    </update>
</mapper>
src/main/resources/mapper/LocationMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.LocationMapper">
    <resultMap id="locationResult" type="com.yssh.entity.Location">
        <id column="id" property="id" javaType="java.lang.Integer" />
        <id column="name" property="name" javaType="java.lang.String" jdbcType="VARCHAR" />
        <id column="type" property="type" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="lon" property="lon" javaType="java.lang.Float" jdbcType="DOUBLE"/>
        <id column="lat" property="lat" javaType="java.lang.Float" jdbcType="DOUBLE"/>
    </resultMap>
    <sql id="locationSql">
        SELECT id, name, type, format(lon, 6) lon, format(lat, 6) lat FROM location
    </sql>
    <select id="selectByXY" resultMap="locationResult">
        <include refid="locationSql"></include>
        <where>
            lon between (#{x} - 0.000045) and (#{x} + 0.000045)
            and
            lat between (#{y} - 0.000045) and (#{y} + 0.000045)
        </where>
    </select>
    <select id="selectVocAddrs" resultMap="locationResult">
        select id, x "lon", y "lat", addr "name"
        from voc_addr
        where length(addr) > 0;
    </select>
    <select id="query" resultMap="locationResult">
        <include refid="locationSql"></include>
        <where>
            <if test="name != null and name != ''">
                AND name LIKE concat('%', #{name}, '%')
            </if>
            <if test="type != null and type != ''">
                AND type = #{type}
            </if>
        </where>
    </select>
    <select id="getAll" resultMap="locationResult">
        <include refid="locationSql"></include>
    </select>
    <insert id="insertLocation" parameterType="com.yssh.entity.Location">
        insert into location(
            name, type, lon, lat
        )
        values (
            #{name},#{type},#{lon},#{lat}
        )
    </insert>
    <delete id="deleteLocation">
        delete from location where id = #{id}
    </delete>
</mapper>
src/main/resources/mapper/QxshMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.QxshMapper">
    <select id="selectByTime" resultType="com.yssh.entity.Qxsh">
        select id, name, lon, lat, format(value, 2) "value", time
        from yssh_qxsh
        where time = #{time}
        order by name;
    </select>
    <select id="selectMonthTop10" resultType="com.yssh.entity.Qxsh">
        with rs as (
            select id, name, format(value, 2) "value", time
            from yssh_qxsh
            where time like #{time} and name like 'AI-%'
        )
        select id, name, value, time from rs
        order by value desc
        limit 10;
    </select>
    <select id="select3Hours" resultType="com.yssh.entity.Qxsh">
        select id, name, format(value, 2) "value", time
        from yssh_qxsh
        where name like 'AI-%' and time in
            <foreach collection="times" item="time" open="(" separator="," close=")">
                #{time}
            </foreach>
        order by name, time;
    </select>
</mapper>
src/main/resources/mapper/StratumMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.StratumMapper">
    <resultMap id="StratumResult" type="com.yssh.entity.Stratum">
        <id column="id" property="id" />
        <result column="exp_site_number" property="expSiteNumber" />
        <result column="primary_layer_number" property="primaryLayerNumber" />
        <result column="sublayer_number" property="sublayerNumber" />
        <result column="geological_era" property="geologicalEra" />
        <result column="geological_genesis" property="geologicalGenesis" />
        <result column="layer_depth" property="layerDepth" />
        <result column="geotechnical_name" property="geotechnicalName" />
        <result column="geotechnical_category" property="geotechnicalCategory" />
        <result column="description" property="description" />
    </resultMap>
    <select id="select" parameterType="java.util.Map" resultMap="StratumResult">
        SELECT *
        FROM stratum
        WHERE exp_site_number = #{expSiteNumber}
        LIMIT #{begin},#{end}
    </select>
    <select id="selectByExpSiteNumbers" resultMap="StratumResult">
        SELECT *
        FROM stratum
        WHERE exp_site_number IN
        <foreach collection="expSiteNumbers" item="expSiteNumber" open="(" separator="," close=")">
            #{expSiteNumber}
        </foreach>
        GROUP BY exp_site_number
    </select>
    <select id="selectByGeotechnicalName" parameterType="java.util.Map" resultMap="StratumResult">
        SELECT *
        FROM stratum
        WHERE exp_site_number = #{expSiteNumber}
        AND geotechnical_name = #{geotechnicalName}
        LIMIT #{start}, #{rows}
    </select>
</mapper>
src/main/resources/mapper/SuYuanMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.SuYuanMapper">
    <resultMap id="SuYuan2dResult" type="com.yssh.entity.SuYuan2d">
        <result property="id"    column="id"    />
        <result property="x"    column="x"    />
        <result property="y"    column="y"    />
        <result property="value"    column="c"    />
    </resultMap>
    <resultMap id="SuYuan3dResult" type="com.yssh.entity.SuYuan3d">
        <result property="id"    column="id"    />
        <result property="x"    column="x"    />
        <result property="y"    column="y"    />
        <result property="height0"    column="height0"    />
        <result property="height10"    column="height10"    />
        <result property="height20"    column="height20"    />
        <result property="height30"    column="height30"    />
        <result property="height40"    column="height40"    />
        <result property="height50"    column="height50"    />
        <result property="height60"    column="height60"    />
        <result property="height70"    column="height70"    />
        <result property="height80"    column="height80"    />
        <result property="height90"    column="height90"    />
    </resultMap>
    <resultMap id="DistanceSuYuanResult" type="com.yssh.entity.DistanceSuYuan">
        <result property="id"    column="id"    />
        <result property="x"    column="x"    />
        <result property="y"    column="y"    />
        <result property="u"    column="u"    />
        <result property="v"    column="v"    />
        <result property="vocsValue"    column="c"    />
    </resultMap>
    <resultMap id="TemporaryResult" type="com.yssh.entity.Temporary">
        <result property="id"    column="id"    />
        <result property="x"    column="x"    />
        <result property="y"    column="y"    />
        <result property="z"    column="z"    />
        <result property="u"    column="u"    />
        <result property="v"    column="v"    />
        <result property="w"    column="w"    />
        <result property="c"    column="c"    />
    </resultMap>
    <resultMap id="SuYuanMonitorDataResult" type="com.yssh.entity.SuYuanMonitorData">
        <result property="id"    column="id"    />
        <result property="value"    column="c"    />
        <result property="time"    column="time"    />
    </resultMap>
    <select id="get2d" resultMap="SuYuan2dResult">
        SELECT id, x, y, format(c, 2) "c"
        FROM ${tableName}
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        ORDER BY z ASC, x ASC, y DESC
    </select>
    <select id="get3d" resultMap="SuYuan3dResult">
        SELECT sy.id, sy.x, sy.y,  sy.id, sy.x, sy.y, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  0)
        ) AS height0, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  1)
        ) AS height10, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  2)
        ) AS height20, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  3)
        ) AS height30, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  4)
        ) AS height40, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  5)
        ) AS height50, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  6)
        ) AS height60, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  7)
        ) AS height70, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  8)
        ) AS height80, (
            SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2),  9)
        ) AS height90
        FROM ${tableName} AS sy
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        ORDER BY sy.z ASC, sy.x ASC, sy.y DESC
    </select>
    <select id="getDistanceSuYuan" resultMap="DistanceSuYuanResult">
        SELECT id, x, y, format(c, 2) "c", u, v
        FROM ${tableName}
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        ORDER BY z ASC, x ASC, y DESC
    </select>
    <select id="getSuYuan500Max" resultMap="DistanceSuYuanResult">
        select id, x, y, format(c, 2) "c", u, v
        from ${tableName}
        where id in
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        order by c desc
        limit 1;
    </select>
    <select id="getSuYuanById" resultMap="DistanceSuYuanResult">
        select id, x, y, format(c, 2) "c", u, v
        from ${tableName}
        where id = #{id}
    </select>
    <select id="getAlarmsAnalyse" resultMap="SuYuan2dResult">
        SELECT id, x, y, format(c, 2) "c"
        FROM ${tableName}
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        AND c >= (SELECT jcbj FROM alert_config LIMIT 1)
    </select>
    <select id="getWarningAnalyse" resultMap="SuYuan2dResult">
        SELECT id, x, y, format(c, 2) "c"
        FROM ${tableName}
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        and c >= (select jcyj from alert_config limit 1) and c &lt; (select jcbj from alert_config limit 1)
    </select>
    <select id="getMonitorData" resultMap="SuYuanMonitorDataResult">
        <foreach collection="tableNames" item="tableName" separator=" UNION ">
            SELECT id, format(c, 2) "c", SUBSTRING_INDEX(#{tableName}, '_', -1) AS time
            FROM ${tableName}
            WHERE id = #{id}
        </foreach>
    </select>
    <select id="getNewMonitorData" resultType="com.yssh.entity.SuYuanMonitorData">
        select id, format(value, 2) "value", time
        from yssh_qxsh
        where name = #{name} and Cast(time as signed) between ${start} and ${end}
        order by time desc;
    </select>
    <select id="getMonthValueDataMax" resultType="java.util.Map">
        <foreach collection="tableNames" item="tableName" separator=" UNION ">
            SELECT format(c, 2) AS value, SUBSTRING_INDEX(#{tableName}, '_', -1) AS time
            FROM ${tableName}
            WHERE id = #{id}
        </foreach>
        ORDER BY value DESC
        LIMIT 1
    </select>
    <select id="selectSuYuan700ById" resultType="com.yssh.entity.SuYuan700">
        select * from suyuan_700
        where su_yuan_id = #{id} and create_time = #{time}
        limit 1;
    </select>
    <select id="selectSuYuan46ById" resultType="com.yssh.entity.SuYuan700">
        select * from suyuan_46
        where su_yuan_id = #{id} and create_time = #{time}
        limit 1;
    </select>
    <select id="getTemporary" resultMap="TemporaryResult">
        SELECT  x, y, z, u, v, w, format(c, 2) "c"
        FROM ${tableName}
        WHERE id IN
        <foreach collection="ids" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        ORDER BY z ASC, x ASC, y DESC
    </select>
    <insert id="batchInsert">
        INSERT INTO ${tableName} (
            id,x,y,z,u,v,w,c
        )VALUES
        <foreach collection="datas" item="item" separator=",">
            (
                #{item.id},
                #{item.x},
                #{item.y},
                #{item.z},
                #{item.u},
                #{item.v},
                #{item.w},
                #{item.c}
            )
        </foreach>
    </insert>
    <select id="isTableExists" resultType="java.lang.Integer">
        select count(*) from information_schema.tables where table_name = #{tableName};
    </select>
    <update id="createTable" parameterType="java.lang.String">
       CREATE TABLE ${tableName}  (
             `id` varchar(255) NOT NULL COMMENT '主键',
          `x` int(7) NULL DEFAULT NULL,
          `y` int(7) NULL DEFAULT NULL,
          `z` int(7) NULL DEFAULT NULL,
          `u` double NULL DEFAULT NULL,
          `v` double NULL DEFAULT NULL,
          `w` double NULL DEFAULT NULL,
          `c` double NULL DEFAULT NULL,
          PRIMARY KEY (`id`) USING BTREE
        ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
    </update>
    <update id="update" >
        UPDATE ${tableName} SET c = #{value} WHERE id = #{id}
    </update>
    <update id="updateVocsName">
        update ${table} set vocsName = #{vocsName} where id = #{id};
    </update>
</mapper>
src/main/resources/mapper/ThuAccuracyMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.ThuAccuracyMapper">
    <resultMap id="ThuAccuracyResult" type="com.yssh.entity.ThuAccuracy">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="lon" property="lon" />
        <result column="lat" property="lat" />
        <result column="value" property="value" />
        <result column="time" property="time" />
        <result column="property" property="property" />
        <result column="wg100" property="wg100" />
        <result column="wg200" property="wg200" />
        <result column="wg300" property="wg300" />
        <result column="wg500" property="wg500" />
        <result column="accuracy" property="accuracy" />
    </resultMap>
    <sql id="ThuAccuracySql">
        SELECT id, name, lon, lat, value, time, property, wg100, wg200, wg300, wg500, accuracy
        FROM thu_accuracy
    </sql>
    <select id="selectSevenDayAccuracyAvg" parameterType="java.lang.Long" resultType="java.lang.Double">
        SELECT sum(accuracy)/count(id) AS accuracy
        FROM thu_accuracy
        <!-- WHERE accuracy > 0 -->
        WHERE CONVERT(time, unsigned) &gt;= #{beginTime}
    </select>
    <select id="getForecastData" parameterType="java.util.Map" resultMap="ThuAccuracyResult">
        SELECT TRIM(ta.name), ta.value, ta.time
        FROM thu_accuracy AS ta
        WHERE CONVERT(TRIM(ta.time), SIGNED) &gt;= CONVERT(date_format(#{beginTime}, '%Y%m%d%H%'), SIGNED)
        AND CONVERT(TRIM(ta.time), SIGNED) &lt;= CONVERT(date_format(#{endTime}, '%Y%m%d%H%'), SIGNED)
        AND ta.name = #{name}
    </select>
    <delete id="delete">
        delete from thu_accuracy where id = #{id}
    </delete>
</mapper>
src/main/resources/mapper/VocValsMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.VocValsMapper">
    <resultMap id="selectMap" type="com.yssh.entity.VocVals">
        <id property="id" column="id" />
        <result property="x" column="x" />
        <result property="y" column="y" />
        <result property="val" column="val" />
        <result property="createTime" column="create_time" />
        <result property="addr" column="addr" />
    </resultMap>
    <select id="selectByTime" resultMap="selectMap">
        select a.x, a.y, format(a.val, 2) "val", b.addr
        from voc_vals a inner join voc_addr b
        on a.x = b.x and a.y = b.y
        where date_format(a.create_time, '%Y%m%d%H') = ${time}
            and a.val > (select jcyj from alert_config);
    </select>
    <select id="countByTime" resultType="java.lang.Integer">
        select count(*)
        from voc_vals
        where date_format(create_time, '%Y%m%d%H') = ${time};
    </select>
    <select id="selectCoords" resultType="com.yssh.entity.VocCoords">
        select x, y, addr
        from voc_addr
        <where>
            1 = 1
            <if test="x != null">
                and x = ${x}
            </if>
            <if test="y != null">
                and y = ${y}
            </if>
        </where>
    </select>
    <insert id="insert" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="false" keyProperty="id">
        insert into voc_vals (id, x, y, val, create_time) values
        (${id}, ${x}, ${y}, ${val}, ${createTime});
    </insert>
    <insert id="inserts" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="false" keyProperty="id">
        insert into voc_vals (id, x, y, val, create_time) values
        <foreach collection="list" item="item" index="index" separator=",">
            (${item.id}, #{item.x},#{item.y},#{item.val},#{item.createTime})
        </foreach>
    </insert>
    <delete id="deleteLastYear">
        delete from voc_vals
        where create_time &lt; date_sub(now(), interval 1 year);
    </delete>
    <delete id="deleteByTime">
        delete from voc_vals
        where date_format(create_time, '%Y%m%d%H') = ${time};
    </delete>
</mapper>
src/main/resources/mapper/WarningDetailMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.WarningDetailMapper">
    <resultMap id="WarningDetailResult" type="com.yssh.entity.WarningDetail">
        <id property="id"    column="id"    />
        <result property="tableName"    column="table_name"    />
        <result property="suYuanId"    column="su_yuan_id"    />
        <result property="locationName"    column="location_name"    />
        <result property="type"    column="type"    />
        <result property="createTime"    column="create_time"    />
        <result property="value"    column="value"    />
    </resultMap>
    <resultMap id="WarningVoResult" type="com.yssh.entity.WarningVo">
        <result property="location_name"    column="locationName"    />
        <result property="suYuanId"    column="su_yuan_id"    />
        <result property="value"    column="value"    />
    </resultMap>
    <select id="selectWarningDetailByType" resultMap="WarningVoResult">
        SELECT location_name, su_yuan_id, format(value, 2) "value"
        FROM warning_detail
        WHERE date_format(create_time, '%Y%m%d%H%I') &gt;= date_format(NOW(), '%Y%m%d%H%I')
        AND type = #{type}
    </select>
    <select id="selectWarningDetailByMap_old" parameterType="java.util.Map" resultMap="WarningVoResult">
        SELECT location_name, su_yuan_id, format(value, 2) "value"
        FROM warning_detail
        WHERE date_format(create_time, '%Y%m%d%H%I%S') &gt;= date_format(#{startTime}, '%Y%m%d%H%I%S')
        AND date_format(create_time, '%Y%m%d%H%I%S') &lt;= date_format(#{endTime}, '%Y%m%d%H%I%S')
        AND type = #{type}
    </select>
    <select id="selectWarningDetailByMap" parameterType="java.util.Map" resultMap="WarningVoResult">
        select location_name, su_yuan_id, format(value, 2) "value"
        from warning_detail
        where create_time between #{startTime} and #{endTime} and type = #{type};
    </select>
    <select id="countWarnByMap" resultType="java.lang.Integer">
        with rs as (select jcyj, jcbj from alert_config limit 1)
        select count(*)
        from warning_detail
        where create_time between #{startTime} and #{endTime}
            and value >= (select jcyj from rs) and value &lt; (select jcbj from rs);
    </select>
    <select id="countAlarmByMap" resultType="java.lang.Integer">
        with rs as (select jcyj, jcbj from alert_config limit 1)
        select count(*)
        from warning_detail
        where create_time between #{startTime} and #{endTime}
            and value >= (select jcbj from rs);
    </select>
    <select id="selectWarningDayCountByMap_old" parameterType="java.util.Map" resultType="java.util.Map">
        SELECT date_format(create_time,'%Y%m%d') AS createTime, count(id) AS num
        FROM warning_detail
        WHERE date_format(create_time, '%Y%m%d%H%I%S') &gt;= date_format(#{startTime}, '%Y%m%d%H%I%S')
        AND date_format(create_time, '%Y%m%d%H%I%S') &lt;= date_format(#{endTime}, '%Y%m%d%H%I%S')
        AND type = #{type}
        GROUP BY DATE_FORMAT(create_time,'%Y%m%d%')
        ORDER BY create_time ASC
    </select>
    <select id="selectWarningDayCountByMap" parameterType="java.util.Map" resultType="java.util.Map">
        with rs as (
              select date_format(create_time, '%Y%m%d') AS ct, id, type
              from warning_detail
              where create_time between #{startTime} and #{endTime} and type = #{type}
        )
        select ct as createTime, count(id) as num
        from rs
        group by ct
        order by ct asc;
    </select>
    <select id="selectByTime" resultMap="WarningDetailResult">
        select id, table_name, su_yuan_id, location_name, type, create_time, format(value, 2) "value"
        from warning_detail
        where create_time between #{startTime} and #{endTime}
        order by create_time;
    </select>
    <select id="selectByTimeForYj" resultMap="WarningDetailResult">
        with rs as (select jcyj, jcbj from alert_config limit 1)
        select id, table_name, su_yuan_id, location_name, 1 "type", create_time, format(value, 2) "value"
        from warning_detail
        where create_time between #{startTime} and #{endTime}
            and value >= (select jcyj from rs) and value &lt; (select jcbj from rs)
        order by value;
    </select>
    <select id="selectByTimeForBj" resultMap="WarningDetailResult">
        with rs as (select jcyj, jcbj from alert_config limit 1)
        select id, table_name, su_yuan_id, location_name, 0 "type", create_time, format(value, 2) "value"
        from warning_detail
        where create_time between #{startTime} and #{endTime}
            and value >= (select jcbj from rs)
        order by value;
    </select>
    <select id="getLastYearVal" resultType="java.lang.Double">
        with rs as (
            select su_yuan_id "id", date_sub(create_time, interval 1 year) "time"
            from warning_detail where id = ${id})
        select format(value, 2) "val"
        from warning_detail
        where su_yuan_id = (select id from rs) and create_time = (select time from rs);
    </select>
    <insert id="batchInsert">
        INSERT INTO warning_detail (table_name, su_yuan_id, location_name, type, create_time, value)VALUES
        <foreach collection="datas" item="item" separator=",">
            (
                #{item.tableName},
                #{item.suYuanId},
                #{item.locationName},
                #{item.type},
                #{item.createTime},
                #{item.value}
            )
        </foreach>
    </insert>
</mapper>
src/main/resources/mapper/WeatherMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yssh.mapper.WeatherMapper">
    <resultMap id="WeatherResult" type="com.yssh.entity.Weather">
        <id column="id" property="id" javaType="java.lang.Integer" />
        <id column="time" property="time" javaType="java.lang.String" jdbcType="VARCHAR" />
        <id column="wind_Speed" property="windSpeed" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="wind_direction" property="windDirection" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="weather_condition" property="weatherCondition" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <id column="temperature" property="temperature" javaType="java.lang.String" jdbcType="VARCHAR"/>
    </resultMap>
    <select id="query" resultMap="WeatherResult">
        select id, time, format(wind_speed, 2) "wind_speed", wind_direction, weather_condition, format(temperature, 2) "temperature"
        from yssh_weather
        <where>
            1 = 1
            <if test="begin != null">
                and str_to_date(time, '%Y-%m-%d-%H:%i:%S') >= #{begin}
            </if>
            <if test="end != null">
                and str_to_date(time, '%Y-%m-%d-%H:%i:%S') &lt;= #{end}
            </if>
        </where>
    </select>
    <select id="getAll" resultMap="WeatherResult">
        select id, time, format(wind_speed, 2) "wind_speed", wind_direction, weather_condition, format(temperature, 2) "temperature"
        from yssh_weather
    </select>
    <insert id="insert" parameterType="com.yssh.entity.Weather">
        insert into yssh_weather (
            time, wind_speed, wind_direction, weather_condition, temperature
        )
        values (
            #{time},#{windSpeed},#{windDirection},#{weatherCondition},#{temperature}
        )
    </insert>
    <delete id="delete">
        delete from yssh_weather where id = #{id}
    </delete>
</mapper>
src/main/resources/mybatis.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <!--配置影响所有映射器中配置缓存-->
        <setting name="cacheEnabled" value="true"/>
        <!--延迟加载-->
        <setting name="lazyLoadingEnabled" value="true"/>
        <!--是否允许单一语句返回多结果集-->
        <setting name="multipleResultSetsEnabled" value="true"/>
        <!--使用列标签代替列名-->
        <setting name="useColumnLabel" value="true"/>
        <!--允许JDBC æ”¯æŒè‡ªåŠ¨ç”Ÿæˆä¸»é”®-->
        <setting name="useGeneratedKeys" value="false"/>
        <!--设置SQL超时时间,秒-->
        <setting name="defaultStatementTimeout" value="360"/>
        <!--默认返回的条数限制-->
        <setting name="defaultFetchSize" value="1000"/>
        <!--是否开启自动驼峰命名规则映射,即从经典数据库列名 A_COLUMN åˆ°ç»å…¸ Java å±žæ€§å aColumn çš„类似映射-->
        <setting name="mapUnderscoreToCamelCase" value="true"/>
        <!--MyBatis åˆ©ç”¨æœ¬åœ°ç¼“存机制(Local Cache)防止循环引用(circular references)和加速联复嵌套査询。-->
        <setting name="localCacheScope" value="SESSION"/>
        <!--当没有为参数提供特定的 JDBC ç±»åž‹æ—¶ï¼Œä¸ºç©ºå€¼æŒ‡å®š JDBC ç±»åž‹-->
        <setting name="jdbcTypeForNull" value="NULL"/>
        <!--指定哪个对象的方法触发一次延迟加载-->
        <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
        <!--指定当结果集中值为 null æ—¶ï¼Œæ˜¯å¦è°ƒç”¨æ˜ å°„对象的 setter(map å¯¹è±¡æ—¶ä¸º put)方法-->
        <setting name="callSettersOnNulls" value="true"/>
        <!--指定 MyBatis æ‰€ç”¨æ—¥å¿—的具体实现:LOG4J/LOG4J2/SLF4J/STDOUT_LOGGING/NO_LOGGING-->
        <setting name="logImpl" value="NO_LOGGING" />
    </settings>
    <typeAliases>
        <package name="com.yssh.entity"/>
    </typeAliases>
</configuration>