13693261870
2024-09-26 1e4cafb7b48c3aac7b6111ff496cac0a40807435
修改配置文件
已添加2个文件
已修改5个文件
783 ■■■■ 文件已修改
src/main/java/com/se/simu/config/InitConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/config/PropertiesConfig.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/ConfigDto.java 469 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/GedbService.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/SimuService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/WaterService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/config/InitConfig.java
@@ -34,7 +34,7 @@
        // noinspection AlibabaRemoveCommentedCode
        try {
            log.info("***************** åˆå§‹åŒ– GDAL *****************" + "\n");
            GdalHelper.init(env.getProperty("sys.path.gdalPath"));
            GdalHelper.init(env.getProperty("config.gdalPath"));
            String path = null != contextPath && contextPath.length() > 1 ? contextPath : "";
            log.info("API文档:http://localhost:" + serverPort + path + "/doc.html");
src/main/java/com/se/simu/config/PropertiesConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,159 @@
package com.se.simu.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.List;
/**
 * å±žæ€§é…ç½®ç±»
 *
 * @author WWW
 * @date 2024-09-26
 */
@Configuration
@SuppressWarnings("ALL")
@ConfigurationProperties(prefix = "config")
public class PropertiesConfig {
    private String ver;
    private String inPath;
    private String outPath;
    private String host;
    private String user;
    private String pwd;
    private String dbName;
    private Integer pageSize;
    private List<String> layerNames;
    private List<String > shpNames;
    private String demName;
    private String demType;
    private String demFile;
    //@Value("#{'${config.sysFields}'}")
    private List<String> sysFields;
    public String getVer() {
        return ver;
    }
    public void setVer(String ver) {
        this.ver = ver;
    }
    public String getInPath() {
        return inPath;
    }
    public void setInPath(String inPath) {
        this.inPath = inPath;
    }
    public String getOutPath() {
        return outPath;
    }
    public void setOutPath(String outPath) {
        this.outPath = outPath;
    }
    public String getHost() {
        return host;
    }
    public void setHost(String host) {
        this.host = host;
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public String getPwd() {
        return pwd;
    }
    public void setPwd(String pwd) {
        this.pwd = pwd;
    }
    public String getDbName() {
        return dbName;
    }
    public void setDbName(String dbName) {
        this.dbName = dbName;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public List<String> getLayerNames() {
        return layerNames;
    }
    public void setLayerNames(List<String> layerNames) {
        this.layerNames = layerNames;
    }
    public List<String> getShpNames() {
        return shpNames;
    }
    public void setShpNames(List<String> shpNames) {
        this.shpNames = shpNames;
    }
    public String getDemName() {
        return demName;
    }
    public void setDemName(String demName) {
        this.demName = demName;
    }
    public String getDemType() {
        return demType;
    }
    public void setDemType(String demType) {
        this.demType = demType;
    }
    public String getDemFile() {
        return demFile;
    }
    public void setDemFile(String demFile) {
        this.demFile = demFile;
    }
    public List<String> getSysFields() {
        return sysFields;
    }
    public void setSysFields(List<String> sysFields) {
        this.sysFields = sysFields;
    }
}
src/main/java/com/se/simu/domain/dto/ConfigDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,469 @@
package com.se.simu.domain.dto;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
 * uwsolver配置类
 *
 * @author WWW
 * @date 2024-09-26
 */
@SuppressWarnings("ALL")
public class ConfigDto {
    public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    // æ¡ˆä¾‹æ–‡ä»¶å¤¹ï¼Œå¿…须指定,可以是相对路径,默认在求解器当前目录下
    private String casedir = "case";
    // åœ°å½¢æ–‡ä»¶ï¼Œä»…需指定文件名(同下),无需指定路径,默认路径在案例文件夹下
    private String terrain_file = "DEM4548.tif";
    // ç½‘格文件,在不提供的情况下默认通过studyzone_file进行生成
    private String mesh_file = "tongzhou-mini.msh";
    // æ¼”算区域文件,在不提供网格文件的前提下必须指定
    private String studyzone_file = "studyzone_difference.shp";
    // ç»†åŒ–区域文件,通过studyzone_file生成网格文件时使用,可不提供,则默认均匀网格尺寸
    private String refinezones_file = "refinezones.shp";
    // å»ºç­‘区域文件,通过studyzone_file生成网格文件时使用,可不提供
    private String buildings_file = "buildings_inside.shp";
    // ç®¡ç½‘节点文件,必须指定,用于生成求解文件
    private String nodes_file = "pipeline-demo-point.shp";
    // ç®¡ç½‘管段文件,必须指定,用于生成求解文件
    private String links_file = "pipeline-demo-conduit.shp";
    // ç®¡ç½‘集水点文件,即具有汇集一定范围内降水的雨水箅、雨水井等,必须指定,用于生成求解文件
    private String junctions_file = "pipeline-demo-point-junctions.shp";
    // é™é›¨æ–‡ä»¶ï¼Œå¿…须指定,用于生成求解文件
    private String raingage_file = "RainGage.dat";
    // é˜²æ´ªéšœç¢ç‰©æ–‡ä»¶ï¼Œå¯ä¸æä¾›
    private String barrier_file = "barrier.shp";
    // æŽ’水系统结果文件,用于保存管段/管点的水位、流量等信息
    private String drainage_outfile = "tongzhou-mini-drainage.h5";
    // åœ°é¢æ°´ä½ç»“果文件,用于保存地面水位信息
    private String sww_outfile = "tongzhou-mini.sww";
    // æµé‡å•位,仅提供LPS(升/秒)、CMS(立方米/秒)、CFS(立方英尺/秒)三种单位
    private String flow_units = "LPS";
    private String infiltration = "HORTON";
    private String link_offsets = "DEPTH";
    private Double min_slope = 0.01;
    private String allow_ponding = "NO";
    private String skip_steady_state = "NO";
    private String flow_routing = "DYNWAVE";
    // æ¼”算开始时刻
    private String start_datetime = "06/12/2024 12:00:00";
    // æ¼”算结束时刻
    private String end_datetime = "06/12/2024 13:00:00";
    // ç»“果保存的起始时刻
    private String report_start_datetime = "06/12/2024 00:00:00";
    // ç»“果保存时间间隔
    private String report_step = "00:01:00";
    // æŽ’水管网演算时间步长,默认单位为s
    private String routing_step = "00:00:10";
    private String inertial_damping = "PARTIAL";
    private String normal_flow_limited = "BOTH";
    private String force_main_equation = "H-W";
    private Integer max_trials = 20;
    private Double minimum_step = 0.1;
    private Double min_surfarea = 0.5;
    private Integer threads = 8;
    private Double Manning = 0.014;
    private Integer areas_slope = 1;
    private Integer areas_imperv = 80;
    private Double areas_n_imperv = 0.015;
    private Double areas_n_perv = 0.24;
    private Double areas_storage_imperv = 0.06;
    private Integer areas_storage_perv = 3;
    private Integer areas_pct_zero = 25;
    private Integer init_depth = 0;
    private Double friction = 0.01;
    private Double terrain_smoothing = 0.1;
    private String flow_algorithm = "DE1";
    // ç½‘格单元最大面积,默认单位为m
    private Integer mesh_size = 5;
    // ç»“果保存频率,相对report_step来说,比如save_step=3就表示每间隔2个report_step保存一次结果
    private Integer save_step = 1;
    public void setCalcTime(Integer minutes) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        String start = DATE_FORMAT.format(calendar.getTime());
        calendar.add(Calendar.MINUTE, minutes);
        String end = DATE_FORMAT.format(calendar.getTime());
        this.start_datetime = start;
        this.report_start_datetime = start;
        this.end_datetime = end;
    }
    public String getCasedir() {
        return casedir;
    }
    public void setCasedir(String casedir) {
        this.casedir = casedir;
    }
    public String getTerrain_file() {
        return terrain_file;
    }
    public void setTerrain_file(String terrain_file) {
        this.terrain_file = terrain_file;
    }
    public String getMesh_file() {
        return mesh_file;
    }
    public void setMesh_file(String mesh_file) {
        this.mesh_file = mesh_file;
    }
    public String getStudyzone_file() {
        return studyzone_file;
    }
    public void setStudyzone_file(String studyzone_file) {
        this.studyzone_file = studyzone_file;
    }
    public String getRefinezones_file() {
        return refinezones_file;
    }
    public void setRefinezones_file(String refinezones_file) {
        this.refinezones_file = refinezones_file;
    }
    public String getBuildings_file() {
        return buildings_file;
    }
    public void setBuildings_file(String buildings_file) {
        this.buildings_file = buildings_file;
    }
    public String getNodes_file() {
        return nodes_file;
    }
    public void setNodes_file(String nodes_file) {
        this.nodes_file = nodes_file;
    }
    public String getLinks_file() {
        return links_file;
    }
    public void setLinks_file(String links_file) {
        this.links_file = links_file;
    }
    public String getJunctions_file() {
        return junctions_file;
    }
    public void setJunctions_file(String junctions_file) {
        this.junctions_file = junctions_file;
    }
    public String getRaingage_file() {
        return raingage_file;
    }
    public void setRaingage_file(String raingage_file) {
        this.raingage_file = raingage_file;
    }
    public String getBarrier_file() {
        return barrier_file;
    }
    public void setBarrier_file(String barrier_file) {
        this.barrier_file = barrier_file;
    }
    public String getDrainage_outfile() {
        return drainage_outfile;
    }
    public void setDrainage_outfile(String drainage_outfile) {
        this.drainage_outfile = drainage_outfile;
    }
    public String getSww_outfile() {
        return sww_outfile;
    }
    public void setSww_outfile(String sww_outfile) {
        this.sww_outfile = sww_outfile;
    }
    public String getFlow_units() {
        return flow_units;
    }
    public void setFlow_units(String flow_units) {
        this.flow_units = flow_units;
    }
    public String getInfiltration() {
        return infiltration;
    }
    public void setInfiltration(String infiltration) {
        this.infiltration = infiltration;
    }
    public String getLink_offsets() {
        return link_offsets;
    }
    public void setLink_offsets(String link_offsets) {
        this.link_offsets = link_offsets;
    }
    public Double getMin_slope() {
        return min_slope;
    }
    public void setMin_slope(Double min_slope) {
        this.min_slope = min_slope;
    }
    public String getAllow_ponding() {
        return allow_ponding;
    }
    public void setAllow_ponding(String allow_ponding) {
        this.allow_ponding = allow_ponding;
    }
    public String getSkip_steady_state() {
        return skip_steady_state;
    }
    public void setSkip_steady_state(String skip_steady_state) {
        this.skip_steady_state = skip_steady_state;
    }
    public String getFlow_routing() {
        return flow_routing;
    }
    public void setFlow_routing(String flow_routing) {
        this.flow_routing = flow_routing;
    }
    public String getStart_datetime() {
        return start_datetime;
    }
    public void setStart_datetime(String start_datetime) {
        this.start_datetime = start_datetime;
    }
    public String getEnd_datetime() {
        return end_datetime;
    }
    public void setEnd_datetime(String end_datetime) {
        this.end_datetime = end_datetime;
    }
    public String getReport_start_datetime() {
        return report_start_datetime;
    }
    public void setReport_start_datetime(String report_start_datetime) {
        this.report_start_datetime = report_start_datetime;
    }
    public String getReport_step() {
        return report_step;
    }
    public void setReport_step(String report_step) {
        this.report_step = report_step;
    }
    public String getRouting_step() {
        return routing_step;
    }
    public void setRouting_step(String routing_step) {
        this.routing_step = routing_step;
    }
    public String getInertial_damping() {
        return inertial_damping;
    }
    public void setInertial_damping(String inertial_damping) {
        this.inertial_damping = inertial_damping;
    }
    public String getNormal_flow_limited() {
        return normal_flow_limited;
    }
    public void setNormal_flow_limited(String normal_flow_limited) {
        this.normal_flow_limited = normal_flow_limited;
    }
    public String getForce_main_equation() {
        return force_main_equation;
    }
    public void setForce_main_equation(String force_main_equation) {
        this.force_main_equation = force_main_equation;
    }
    public Integer getMax_trials() {
        return max_trials;
    }
    public void setMax_trials(Integer max_trials) {
        this.max_trials = max_trials;
    }
    public Double getMinimum_step() {
        return minimum_step;
    }
    public void setMinimum_step(Double minimum_step) {
        this.minimum_step = minimum_step;
    }
    public Double getMin_surfarea() {
        return min_surfarea;
    }
    public void setMin_surfarea(Double min_surfarea) {
        this.min_surfarea = min_surfarea;
    }
    public Integer getThreads() {
        return threads;
    }
    public void setThreads(Integer threads) {
        this.threads = threads;
    }
    public Double getManning() {
        return Manning;
    }
    public void setManning(Double manning) {
        Manning = manning;
    }
    public Integer getAreas_slope() {
        return areas_slope;
    }
    public void setAreas_slope(Integer areas_slope) {
        this.areas_slope = areas_slope;
    }
    public Integer getAreas_imperv() {
        return areas_imperv;
    }
    public void setAreas_imperv(Integer areas_imperv) {
        this.areas_imperv = areas_imperv;
    }
    public Double getAreas_n_imperv() {
        return areas_n_imperv;
    }
    public void setAreas_n_imperv(Double areas_n_imperv) {
        this.areas_n_imperv = areas_n_imperv;
    }
    public Double getAreas_n_perv() {
        return areas_n_perv;
    }
    public void setAreas_n_perv(Double areas_n_perv) {
        this.areas_n_perv = areas_n_perv;
    }
    public Double getAreas_storage_imperv() {
        return areas_storage_imperv;
    }
    public void setAreas_storage_imperv(Double areas_storage_imperv) {
        this.areas_storage_imperv = areas_storage_imperv;
    }
    public Integer getAreas_storage_perv() {
        return areas_storage_perv;
    }
    public void setAreas_storage_perv(Integer areas_storage_perv) {
        this.areas_storage_perv = areas_storage_perv;
    }
    public Integer getAreas_pct_zero() {
        return areas_pct_zero;
    }
    public void setAreas_pct_zero(Integer areas_pct_zero) {
        this.areas_pct_zero = areas_pct_zero;
    }
    public Integer getInit_depth() {
        return init_depth;
    }
    public void setInit_depth(Integer init_depth) {
        this.init_depth = init_depth;
    }
    public Double getFriction() {
        return friction;
    }
    public void setFriction(Double friction) {
        this.friction = friction;
    }
    public Double getTerrain_smoothing() {
        return terrain_smoothing;
    }
    public void setTerrain_smoothing(Double terrain_smoothing) {
        this.terrain_smoothing = terrain_smoothing;
    }
    public String getFlow_algorithm() {
        return flow_algorithm;
    }
    public void setFlow_algorithm(String flow_algorithm) {
        this.flow_algorithm = flow_algorithm;
    }
    public Integer getMesh_size() {
        return mesh_size;
    }
    public void setMesh_size(Integer mesh_size) {
        this.mesh_size = mesh_size;
    }
    public Integer getSave_step() {
        return save_step;
    }
    public void setSave_step(Integer save_step) {
        this.save_step = save_step;
    }
}
src/main/java/com/se/simu/service/GedbService.java
@@ -4,6 +4,7 @@
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.domain.dto.GeDb;
import com.se.simu.domain.dto.GeField;
import com.se.simu.domain.dto.GeFile;
@@ -42,49 +43,16 @@
@Service
@SuppressWarnings("ALL")
public class GedbService {
    @Value("${sys.path.in}")
    String inPath;
    @Value("${gedb.host}")
    String host;
    @Value("${gedb.user}")
    String user;
    @Value("${gedb.pwd}")
    String pwd;
    @Value("${gedb.dbName}")
    String dbName;
    @Value("${gedb.pageSize}")
    Integer pageSize;
    @Value("#{'${gedb.layerNames}'}")
    List<String> layerNames;
    @Value("#{'${gedb.shpNames}'}")
    List<String> shpNames;
    @Value("#{'${gedb.sysFields}'}")
    List<String> sysFields;
    @Value("${gedb.demFile}")
    String demFile;
    @Value("${gedb.demType}")
    String demType;
    @Value("${gedb.demName}")
    String demName;
    String password;
    @Resource
    PropertiesConfig config;
    @Resource
    RestTemplate restTemplate;
    public boolean test(DataPo data) throws Exception {
        createPath(inPath + File.separator + data.getInPath());
        createPath(config.getInPath() + File.separator + data.getInPath());
        String token = getToken();
        GeDb db = connectGedb(token, data);
@@ -106,10 +74,10 @@
    public String getToken() throws Exception {
        Map<String, Object> map = new HashMap<>(2);
        map.put("userid", user);
        map.put("userid", config.getUser());
        map.put("password", getPassword());
        JSONObject obj = restTemplate.postForObject(host + "account-service/security/login", map, JSONObject.class);
        JSONObject obj = restTemplate.postForObject(config.getHost() + "account-service/security/login", map, JSONObject.class);
        JSONObject data = obj.getJSONObject("data");
@@ -120,7 +88,7 @@
        if (StringHelper.isEmpty(password)) {
            String key = getPublicKey();
            RsaHelper.setPublicKey(key);
            password = RsaHelper.encrypt(pwd);
            password = RsaHelper.encrypt(config.getPwd());
        }
        return password;
@@ -128,7 +96,7 @@
    private String getPublicKey() {
        //{"datetime":"2024-09-12 17:24:38","code":200,"data":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtFwJCh2taVTEi05C8qT2oG7Y+rDmJhlO4zicpSeRtiro9LsytePeWI7BXM6sfDU0WeKun1izawcfgGkZgnoJuMBluAOKI1tL0uCrR+DreNLqMVtnXHwoWEIk/hGJedDWaf3q22aGDyEB5h9qCq0JklSShP1Ih4ppap4LmgxdTPQIDAQAB"}
        JSONObject obj = restTemplate.getForObject(host + "account-service/security/publickey", JSONObject.class);
        JSONObject obj = restTemplate.getForObject(config.getHost() + "account-service/security/publickey", JSONObject.class);
        return obj.getStr("data");
    }
@@ -145,17 +113,17 @@
        Map<String, Object> map = new HashMap<>(1);
        map.put("token", token);
        JSONObject obj = restTemplate.postForObject(host + "geo-service/entitydb/list/canview", map, JSONObject.class);
        JSONObject obj = restTemplate.postForObject(config.getHost() + "geo-service/entitydb/list/canview", map, JSONObject.class);
        JSONArray data = obj.getJSONArray("data");
        List<GeDb> list = JSONUtil.toList(data, GeDb.class);
        if (CollectionUtils.isEmpty(list)) return null;
        return list.stream().filter(db -> null != db.getName() && db.getName().contains(dbName)).findFirst().orElse(null);
        return list.stream().filter(db -> null != db.getName() && db.getName().contains(config.getDbName())).findFirst().orElse(null);
    }
    public List<GeLayer> getLayers(String token, GeDb db) {
        String uri = String.format("%sgeo-service/entitydb/map/config?dbid=%s&token=%s", host, db.getDbid(), token);
        String uri = String.format("%sgeo-service/entitydb/map/config?dbid=%s&token=%s", config.getHost(), db.getDbid(), token);
        JSONObject obj = restTemplate.getForObject(uri, JSONObject.class);
        JSONObject data = obj.getJSONObject("data");
@@ -166,12 +134,12 @@
        for (int i = 0, c = arr.size(); i < c; i++) {
            JSONObject jb = arr.getJSONObject(i);
            String name = jb.getStr("name");
            if (layerNames.contains(name)) {
            if (config.getLayerNames().contains(name)) {
                String id = jb.getStr("id");
                String queryType = getQueryType(jb);
                List<GeField> fields = JSONUtil.toList(jb.getJSONArray("fields"), GeField.class);
                fields = fields.stream().filter(f -> !sysFields.contains(f.getName())).collect(Collectors.toList());
                String shpName = shpNames.get(layerNames.indexOf(name));
                fields = fields.stream().filter(f -> !config.getSysFields().contains(f.getName())).collect(Collectors.toList());
                String shpName = config.getShpNames().get(config.getLayerNames().indexOf(name));
                layers.add(new GeLayer(id, name, queryType, fields, shpName, db));
            }
@@ -199,9 +167,9 @@
            int count = getCount(token, db, layer);
            if (0 == count) throw new Exception(layer.getName() + ",图层数据为空");
            int pageCount = (count - 1) / pageSize + 1;
            int pageCount = (count - 1) / config.getPageSize() + 1;
            for (int i = 0; i < pageCount; i++) {
                JSONArray data = query(token, db, layer, i + 1, pageSize);
                JSONArray data = query(token, db, layer, i + 1, config.getPageSize());
                if (null != data && data.size() > 0) {
                    layer.addData(data);
                }
@@ -218,7 +186,7 @@
        map.put("returnCountOnly", true);
        map.put("inSR", 4326);
        JSONObject obj = restTemplate.postForObject(host + "geo-service/entitydbdata/layer/query", map, JSONObject.class);
        JSONObject obj = restTemplate.postForObject(config.getHost() + "geo-service/entitydbdata/layer/query", map, JSONObject.class);
        if (null == obj || 200 != obj.getInt("code")) return 0;
        return obj.getInt("data");
@@ -236,7 +204,7 @@
        map.put("querytype", layer.getQueryType());
        map.put("inSR", 4326);
        JSONObject obj = restTemplate.postForObject(host + "geo-service/entitydbdata/layer/query", map, JSONObject.class);
        JSONObject obj = restTemplate.postForObject(config.getHost() + "geo-service/entitydbdata/layer/query", map, JSONObject.class);
        if (null == obj || 200 != obj.getInt("code")) return null;
        JSONObject data = obj.getJSONObject("data");
@@ -245,7 +213,7 @@
    }
    public void copeVectors(String token, DataPo data, GeDb db) throws Exception {
        String basePath = inPath + File.separator + data.getInPath();
        String basePath = config.getInPath() + File.separator + data.getInPath();
        List<GeLayer> layers = getLayers(token, db);
        queryData(token, db, layers);
@@ -266,32 +234,32 @@
        String fileId = getFileId(token, fileDb.getDbid());
        List<GeFile> files = getFileNames(token, fileDb.getDbid(), fileId);
        String filePath = inPath + File.separator + fileDb.getDbid();
        String filePath = config.getInPath() + File.separator + fileDb.getDbid();
        downloadFiles(token, filePath, files, fileDb.getDbid(), fileId);
        clipDemFile(filePath, files, data);
    }
    private GeDb getFileDb(String token) {
        String uri = String.format("%sfile-service/docdb/query/canview?token=%s", host, token);
        String uri = String.format("%sfile-service/docdb/query/canview?token=%s", config.getHost(), token);
        JSONObject obj = restTemplate.getForObject(uri, JSONObject.class);
        JSONArray data = obj.getJSONArray("data");
        List<GeDb> list = JSONUtil.toList(data, GeDb.class);
        if (CollectionUtils.isEmpty(list)) return null;
        return list.stream().filter(db -> null != db.getName() && db.getName().contains(dbName)).findFirst().orElse(null);
        return list.stream().filter(db -> null != db.getName() && db.getName().contains(config.getDbName())).findFirst().orElse(null);
    }
    private String getFileId(String token, String dbid) {
        String uri = String.format("%sfile-service/doc/catagory/file/query?token=%s&dbid=%s&catagory=%s&count=%d&start=%d&like=",
                host, token, dbid, "image", 9999, 1);
                config.getHost(), token, dbid, "image", 9999, 1);
        JSONObject obj = restTemplate.getForObject(uri, JSONObject.class);
        JSONArray items = obj.getJSONObject("data").getJSONArray("items");
        for (int i = 0, c = items.size(); i < c; i++) {
            JSONObject jb = items.getJSONObject(i);
            if (demName.equals(jb.getStr("filename"))) {
            if (config.getDemName().equals(jb.getStr("filename"))) {
                return jb.getStr("fileid");
            }
        }
@@ -301,7 +269,7 @@
    private List<GeFile> getFileNames(String token, String dbid, String fileId) {
        String uri = String.format("%sfile-service/doc/cluster/struct/list?token=%s&dbid=%s&cluster_fileid=%s&onlychild=true&folder_stairs=",
                host, token, dbid, fileId);
                config.getHost(), token, dbid, fileId);
        JSONObject obj = restTemplate.getForObject(uri, JSONObject.class);
        JSONArray data = obj.getJSONArray("data");
@@ -326,7 +294,7 @@
            }
            String uri = String.format("%sfile-service/fileparser/cluster/download/%s?token=%s&dbid=%s&cluster_fileid=%s",
                    host, geFile.getName(), token, dbid, fileId);
                    config.getHost(), geFile.getName(), token, dbid, fileId);
            downloadFile(uri, filePath);
        }
    }
@@ -351,9 +319,9 @@
    }
    private void clipDemFile(String filePath, List<GeFile> files, DataPo data) throws Exception {
        String target = inPath + File.separator + data.getInPath() + File.separator + demFile;
        String target = config.getInPath() + File.separator + data.getInPath() + File.separator + config.getDemFile();
        for (GeFile file : files) {
            if (file.getName().toLowerCase().endsWith(demType)) {
            if (file.getName().toLowerCase().endsWith(config.getDemType())) {
                String source = filePath + File.separator + file.getName();
                clipDem(source, target, data);
                break;
src/main/java/com/se/simu/service/SimuService.java
@@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.domain.dto.GeDb;
import com.se.simu.domain.dto.GeLayer;
import com.se.simu.domain.po.DataPo;
@@ -39,14 +40,11 @@
@Service
@SuppressWarnings("ALL")
public class SimuService {
    @Value("${sys.path.in}")
    String inPath;
    @Value("${sys.path.out}")
    String outPath;
    @Resource
    SimuMapper simuMapper;
    @Resource
    PropertiesConfig config;
    @Resource
    GedbService gedbService;
@@ -99,8 +97,8 @@
                    DataPo dp = JSONUtil.toBean(po.getData(), DataPo.class);
                    if (null == dp) continue;
                    delDir(inPath + File.separator + dp.getInPath());
                    delDir(outPath + File.separator + dp.getOutPath());
                    delDir(config.getInPath() + File.separator + dp.getInPath());
                    delDir(config.getOutPath() + File.separator + dp.getOutPath());
                } catch (Exception ex) {
                    log.error(ex.getMessage(), ex);
                }
@@ -146,8 +144,8 @@
    }
    private void initPath(DataPo data) {
        createDir(inPath + File.separator + data.getInPath());
        createDir(outPath + File.separator + data.getOutPath());
        createDir(config.getInPath() + File.separator + data.getInPath());
        createDir(config.getOutPath() + File.separator + data.getOutPath());
    }
    private void createDir(String path) {
src/main/java/com/se/simu/service/WaterService.java
@@ -1,10 +1,11 @@
package com.se.simu.service;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.domain.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
@@ -20,18 +21,15 @@
@Slf4j
@Service
public class WaterService {
    @Value("${sys.ver}")
    String ver;
    @Value("${sys.path.out}")
    String outPath;
    @Resource
    PropertiesConfig config;
    /**
     * èŽ·å–å…ƒæ•°æ®ä¿¡æ¯
     */
    public byte[] getLayerJson(String serviceName) {
        try {
            String filePath = outPath + File.separator + serviceName + File.separator + "layer.json";
            String filePath = config.getOutPath() + File.separator + serviceName + File.separator + "layer.json";
            File dat = new File(filePath);
            if (!dat.exists()) {
@@ -54,21 +52,21 @@
     * èŽ·å–åœ°å½¢é«˜åº¦å›¾
     */
    public String getTerraMap(String serviceName, Integer width, Integer height) {
        return outPath + File.separator + serviceName + File.separator + "terrain" + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "terrain" + File.separator + width + "_" + height + ".png";
    }
    /**
     * èŽ·å–æ°´é¢é«˜åº¦å›¾
     */
    public String getWaterMap(String serviceName, Integer width, Integer height, Long timestamp) {
        return outPath + File.separator + serviceName + File.separator + "waters" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "waters" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
    }
    /**
     * èŽ·å–æ°´æµå‘æµé€Ÿå›¾
     */
    public String getFlowMap(String serviceName, Integer width, Integer height, Long timestamp) {
        return outPath + File.separator + serviceName + File.separator + "flows" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
        return config.getOutPath() + File.separator + serviceName + File.separator + "flows" + File.separator + timestamp + File.separator + width + "_" + height + ".png";
    }
    /**
@@ -76,7 +74,7 @@
     */
    public Layer getLayer(String serviceName) {
        Layer layer = new Layer();
        layer.setVersion(ver);
        layer.setVersion(config.getVer());
        layer.setDuration(new Duration(1719812810225L, 1719812810225L));
        layer.setExtension(new Extension(2.11062743358, 0.53812160220, 2.11070827834, 0.53819799453, 1.151, 38.83));
src/main/resources/application.yml
@@ -91,21 +91,26 @@
  connectTimeout: -1
  readTimeout: -1
sys:
config:
  ver: 0.2
  path:
    in: D:\simu\in
    out: D:\simu\out
gedb:
  # Gdal驱动目录
  gdalPath: E:/terrait/TianJin/Zip/release-1928-x64-dev/release-1928-x64/bin
  inPath: D:\simu\in
  outPath: D:\simu\out
  host: http://106.120.22.26:8013/
  user: WUWEIWEI
  pwd: WUWEIWEI
  dbName: é€šå·žæ°´åˆ©ä»¿çœŸ
  pageSize: 2000
  layerNames: ç®¡ç‚¹,管线,建筑物
  shpNames: pipePoint,pipeLine,building
  sysFields: _ext_attr,_meta_id,_attach_files,_x,_y,_z,operatetime,operator,_is_latest,_data_type,groupid,id,shape_length,shape_area
  layerNames:
    - ç®¡ç‚¹
    - ç®¡çº¿
    - å»ºç­‘物
  shpNames:
    - pipePoint
    - pipeLine
    - building
  demName: DEM
  demType: .tif
  demFile: dem.tif
  demFile: dem.tif
  sysFields: _ext_attr,_meta_id,_attach_files,_x,_y,_z,operatetime,operator,_is_latest,_data_type,groupid,id,shape_length,shape_area