From b2b9e959447664bceb4381630358230a2ee5a1ab Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 30 九月 2024 10:46:19 +0800 Subject: [PATCH] 1 --- /dev/null | 0 src/main/java/com/se/simu/domain/dto/ConfigDto.java | 10 ++-- libs/simu.jar | 0 src/main/java/com/se/simu/service/UwService.java | 4 +- pom.xml | 16 ++++++++ src/main/java/com/se/simu/domain/po/DataPo.java | 55 ++++++++------------------- src/main/java/com/se/simu/domain/vo/CreateSimuVo.java | 13 ++++++ src/main/java/com/se/simu/controller/SimuController.java | 3 + 8 files changed, 56 insertions(+), 45 deletions(-) diff --git a/libs/rainfall.jar b/libs/rainfall.jar deleted file mode 100644 index e941e0d..0000000 --- a/libs/rainfall.jar +++ /dev/null Binary files differ diff --git a/libs/simu.jar b/libs/simu.jar new file mode 100644 index 0000000..226ce80 --- /dev/null +++ b/libs/simu.jar Binary files differ diff --git a/pom.xml b/pom.xml index bdd02b0..ce8050b 100644 --- a/pom.xml +++ b/pom.xml @@ -120,6 +120,21 @@ <version>3.5.0</version> <!--version>3.2.0</version--> </dependency> + <!--rainfall--> + <dependency> + <groupId>com.mathworks.toolbox</groupId> + <artifactId>javabuilder</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/libs/javabuilder.jar</systemPath> + </dependency> + <dependency> + <groupId>com.se.simu</groupId> + <artifactId>Rainfall</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/libs/simu.jar</systemPath> + </dependency> </dependencies> <build> @@ -128,6 +143,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>2.4.1</version> <configuration> <mainClass>com.se.simu.SimuApplication</mainClass> <excludes> diff --git a/src/main/java/com/se/simu/controller/SimuController.java b/src/main/java/com/se/simu/controller/SimuController.java index 4d6fda0..e97b77d 100644 --- a/src/main/java/com/se/simu/controller/SimuController.java +++ b/src/main/java/com/se/simu/controller/SimuController.java @@ -64,6 +64,9 @@ if (null == vo.getPid() || vo.getPid() < 0) { vo.setPid(0); } + if (null == vo.getStartTime()) { + vo.setStartTime(new Date()); + } if (vo.getPid() > 0) { SimuPo pp = simuService.getSimuByPid(vo.getPid()); if (null == pp) { diff --git a/src/main/java/com/se/simu/domain/dto/ConfigDto.java b/src/main/java/com/se/simu/domain/dto/ConfigDto.java index 9ec206f..d86a28b 100644 --- a/src/main/java/com/se/simu/domain/dto/ConfigDto.java +++ b/src/main/java/com/se/simu/domain/dto/ConfigDto.java @@ -85,7 +85,7 @@ // 缁撴灉淇濆瓨棰戠巼锛岀浉瀵箁eport_step鏉ヨ锛屾瘮濡俿ave_step=3灏辫〃绀烘瘡闂撮殧2涓猺eport_step淇濆瓨涓�娆$粨鏋� private Integer save_step = 1; - public void setProperties(String dirName, Integer minutes, PropertiesConfig config) { + public void setProperties(String dirName, Date startTime, Integer minutes, PropertiesConfig config) { this.casedir = dirName; this.terrain_file = config.getDemFile(); this.studyzone_file = config.getZoneName(); @@ -101,10 +101,10 @@ this.threads = WebHelper.getCpuCores(); Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); + calendar.setTime(startTime); + //calendar.set(Calendar.HOUR_OF_DAY, 0); + //calendar.set(Calendar.MINUTE, 0); + //calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); String start = DATE_FORMAT.format(calendar.getTime()); diff --git a/src/main/java/com/se/simu/domain/po/DataPo.java b/src/main/java/com/se/simu/domain/po/DataPo.java index 40d82d4..fd04549 100644 --- a/src/main/java/com/se/simu/domain/po/DataPo.java +++ b/src/main/java/com/se/simu/domain/po/DataPo.java @@ -1,6 +1,10 @@ package com.se.simu.domain.po; +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; + +import java.util.Date; /** * 浠跨湡鏁版嵁瀹炰綋绫� @@ -20,6 +24,11 @@ @ApiModelProperty("杈撳嚭璺緞") private String outPath; + + @ApiModelProperty("寮�濮嬫椂闂�") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; @ApiModelProperty("鏈�灏廥") private Double minx; @@ -82,15 +91,6 @@ return minx + "," + miny + "," + maxx + "," + maxy; } - public DataPo(String name, String inPath, String outPath, Double total, Integer duration, Integer isFlood) { - this.name = name; - this.inPath = inPath; - this.outPath = outPath; - this.total = total; - this.duration = duration; - this.isFlood = isFlood; - } - public DataPo(String name, String inPath, String outPath, Double minx, Double miny, Double maxx, Double maxy, Double total, Integer duration) { this.name = name; this.inPath = inPath; @@ -101,35 +101,6 @@ this.maxy = maxy; this.total = total; this.duration = duration; - } - - public boolean setExtent(Double minx, Double miny, Double maxx, Double maxy) { - this.minx = minx; - this.miny = miny; - this.maxx = maxx; - this.maxy = maxy; - - return true; - } - - public boolean setFlood(Integer floodStart, Integer floodEnd, Double floodHeight, String floodType) { - this.isFlood = 1; - this.floodStart = floodStart; - this.floodEnd = floodEnd; - this.floodHeight = floodHeight; - this.floodType = floodType; - - return true; - } - - public boolean setFloodExtent(Double floodMinx, Double floodMiny, Double floodMaxx, Double floodMaxy) { - this.isFlood = 1; - this.floodMinx = floodMinx; - this.floodMiny = floodMiny; - this.floodMaxx = floodMaxx; - this.floodMaxy = floodMaxy; - - return true; } public Integer getPid() { @@ -164,6 +135,14 @@ this.outPath = outPath; } + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + public Double getMinx() { return minx; } diff --git a/src/main/java/com/se/simu/domain/vo/CreateSimuVo.java b/src/main/java/com/se/simu/domain/vo/CreateSimuVo.java index 0df9364..4fb7a50 100644 --- a/src/main/java/com/se/simu/domain/vo/CreateSimuVo.java +++ b/src/main/java/com/se/simu/domain/vo/CreateSimuVo.java @@ -5,6 +5,8 @@ import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.Date; + /** * 鍒涘缓浠跨湡瑙嗗浘绫� * @@ -39,6 +41,9 @@ @ApiModelProperty("浠跨湡鍚嶇О") private String name; + + @ApiModelProperty("寮�濮嬫椂闂�") + private Date startTime; @ApiModelProperty("浠跨湡澶囨敞") private String bak; @@ -213,4 +218,12 @@ public void setFloodMaxy(Double floodMaxy) { this.floodMaxy = floodMaxy; } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } } diff --git a/src/main/java/com/se/simu/service/UwService.java b/src/main/java/com/se/simu/service/UwService.java index 26fe954..de946bc 100644 --- a/src/main/java/com/se/simu/service/UwService.java +++ b/src/main/java/com/se/simu/service/UwService.java @@ -7,7 +7,7 @@ import com.se.simu.helper.WebHelper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import rainfall.Rainfall; +import com.se.simu.Rainfall; import javax.annotation.Resource; import java.io.*; @@ -32,7 +32,7 @@ public void createConfig(DataPo data) throws IOException { ConfigDto dto = new ConfigDto(); - dto.setProperties(data.getInPath(), data.getDuration(), config); + dto.setProperties(data.getInPath(), data.getStartTime(), data.getDuration(), config); String json = JSONUtil.toJsonPrettyStr(dto); String filePath = config.getInPath() + File.separator + data.getInPath() + ".json"; -- Gitblit v1.9.3