| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 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) { |
| | |
| | | // 结果保存频率,相对report_step来说,比如save_step=3就表示每间隔2个report_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(); |
| | |
| | | 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()); |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 仿真数据实体类 |
| | |
| | | |
| | | @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("最小X") |
| | | private Double minx; |
| | |
| | | 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; |
| | |
| | | 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() { |
| | |
| | | this.outPath = outPath; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Double getMinx() { |
| | | return minx; |
| | | } |
| | |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 创建仿真视图类 |
| | | * |
| | |
| | | |
| | | @ApiModelProperty("仿真名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("开始时间") |
| | | private Date startTime; |
| | | |
| | | @ApiModelProperty("仿真备注") |
| | | private String bak; |
| | |
| | | public void setFloodMaxy(Double floodMaxy) { |
| | | this.floodMaxy = floodMaxy; |
| | | } |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | } |
| | |
| | | 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.*; |
| | |
| | | |
| | | 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"; |