1
13693261870
2024-09-30 b2b9e959447664bceb4381630358230a2ee5a1ab
src/main/java/com/se/simu/domain/dto/ConfigDto.java
@@ -1,5 +1,8 @@
package com.se.simu.domain.dto;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.helper.WebHelper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -82,12 +85,26 @@
    // 结果保存频率,相对report_step来说,比如save_step=3就表示每间隔2个report_step保存一次结果
    private Integer save_step = 1;
    public void setCalcTime(Integer minutes) {
    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.buildings_file = config.getShpNames().get(2);
        this.nodes_file = config.getShpNames().get(0);
        this.links_file = config.getShpNames().get(1);
        this.junctions_file = config.getJunctionName();
        this.raingage_file = config.getRaingage();
        this.barrier_file = config.getBarrierName();
        this.drainage_outfile = dirName + ".h5";
        this.sww_outfile = dirName + ".sww";
        this.flow_units = config.getFlowUnits();
        this.threads = WebHelper.getCpuCores();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR, 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());