¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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("å 餿å"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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("å 餿å"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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("å 餿å"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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("å 餿å"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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æ æ³éæ¾ |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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))); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°æ®æºé
ç½® |
| | | 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 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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' |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°æ®æºé
ç½® |
| | | 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 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | csv: |
| | | # 221Mb CSVå
¥åºæ¶é´ |
| | | cron: '0 42 * * * ? ' |
| | | cron_max: 720 |
| | | |
| | | # 112Kb CSVå
¥åºæ¶é´ |
| | | voc: '0 37 * * * ? ' |
| | | voc_max: 720 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # æ°æ®æºé
ç½® |
| | | 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 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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 > #{startTime} |
| | | AND create_time <= #{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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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) >= #{beginTime}) FROM feedback |
| | | WHERE CONVERT(date_format(create_time, '%Y%m%d%H%'), SIGNED) >= #{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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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 < (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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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) >= #{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) >= CONVERT(date_format(#{beginTime}, '%Y%m%d%H%'), SIGNED) |
| | | AND CONVERT(TRIM(ta.time), SIGNED) <= 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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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 < 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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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') >= 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') >= date_format(#{startTime}, '%Y%m%d%H%I%S') |
| | | AND date_format(create_time, '%Y%m%d%H%I%S') <= 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 < (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') >= date_format(#{startTime}, '%Y%m%d%H%I%S') |
| | | AND date_format(create_time, '%Y%m%d%H%I%S') <= 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 < (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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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') <= #{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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |