pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/SimuApplication.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/config/WebConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/controller/WaterController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/helper/WebHelper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/service/WaterService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
pom.xml
@@ -13,7 +13,7 @@ <groupId>com.se</groupId> <artifactId>simu</artifactId> <version>1.0.0</version> <name>simuserver</name> <name>SimuServer</name> <description>å æ¶ä»¿çæå¡</description> <properties> @@ -32,6 +32,7 @@ <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.34</version> <optional>true</optional> </dependency> <!--hutool--> @@ -40,12 +41,17 @@ <artifactId>hutool-all</artifactId> <version>5.8.29</version> </dependency> <!--fastjson2--> <!--fastjson--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.83</version> </dependency> <!--dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> <version>2.0.52</version> </dependency> </dependency--> </dependencies> <build> src/main/java/com/se/simu/SimuApplication.java
@@ -3,6 +3,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; /** * å¯å¨ç¨åºç±» @@ -11,8 +13,13 @@ * @date 2024-07-16 */ @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.se.simu"}) public class SimuApplication { public class SimuApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(SimuApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) { return springApplicationBuilder.sources(SimuApplication.class); } } src/main/java/com/se/simu/config/WebConfig.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ package com.se.simu.config; import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import java.nio.charset.StandardCharsets; import java.util.List; /** * Webé 置类 * * @author WWW * @date 2024-07-17 */ @Configuration public class WebConfig extends WebMvcConfigurationSupport { /** * å¤çjsonæ ¼å¼ï¼å¼nullç转æ¢ä¸º"" */ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter(); FastJsonConfig config = new FastJsonConfig(); config.setSerializerFeatures( SerializerFeature.WriteNullListAsEmpty, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty, SerializerFeature.WriteNullNumberAsZero, SerializerFeature.WriteNullBooleanAsFalse); // ç»ææ¯å¦æ ¼å¼å,é»è®¤ä¸ºfalse //SerializerFeature.PrettyFormat); converter.setFastJsonConfig(config); converter.setDefaultCharset(StandardCharsets.UTF_8); converters.add(converter); } } src/main/java/com/se/simu/controller/WaterController.java
@@ -33,11 +33,17 @@ private final static long Y2000 = 949334400000L; /** * è·åå½åæ¶é´ */ @GetMapping("/getTime") public Object getTime() { return System.currentTimeMillis(); } /** * è·åå æ°æ®ä¿¡æ¯ */ @GetMapping("/{serviceName}/layer.json") public void getLayer(@PathVariable String serviceName, HttpServletResponse res) { try { @@ -54,6 +60,9 @@ } } /** * è·åå°å½¢é«åº¦å¾ */ @GetMapping("/{serviceName}/terrain") public void getTerraMap(@PathVariable String serviceName, Integer width, Integer height, HttpServletResponse res) { try { @@ -69,6 +78,9 @@ } } /** * è·åæ°´é¢é«åº¦å¾ */ @GetMapping("/{serviceName}/waterMap") public void getWaterMap(@PathVariable String serviceName, Integer width, Integer height, Long timestamp, HttpServletResponse res) { try { @@ -84,6 +96,9 @@ } } /** * è·åæ°´æµåæµéå¾ */ @GetMapping("/{serviceName}/flowMap") public void getFlowMap(@PathVariable String serviceName, Integer width, Integer height, Long timestamp, HttpServletResponse res) { try { src/main/java/com/se/simu/helper/WebHelper.java
@@ -1,6 +1,6 @@ package com.se.simu.helper; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.context.request.RequestContextHolder; src/main/java/com/se/simu/service/WaterService.java
@@ -21,9 +21,6 @@ @Value("${sys.ver}") String ver; @Value("${sys.path.gdal}") String gdalPath; @Value("${sys.path.data}") String dataPath; @@ -49,6 +46,10 @@ } public String getFlowMap(String serviceName, Integer width, Integer height, Long timestamp) { //com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; return null; } }