src/main/java/com/se/simu/config/InitConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/config/PropertiesConfig.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/domain/dto/ConfigDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/service/GedbService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/service/SimuService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/se/simu/service/WaterService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/application.yml | ●●●●● 补丁 | 查看 | 原始文档 | 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