| | |
| | | @ApiModelProperty("防汛最大Y") |
| | | private Double floodMaxy; |
| | | |
| | | @ApiModelProperty("坐标系ID") |
| | | private Integer epsg; |
| | | |
| | | public DataPo() { |
| | | } |
| | | |
| | | public void setPath(String inPath, String outPath) { |
| | | this.inPath = inPath; |
| | | this.outPath = outPath; |
| | | } |
| | | |
| | | public String getBbox() { |
| | | // "116.64388473935195,39.884315914604464,116.64754729082588,39.887069143903496"; |
| | | return minx + "," + miny + "," + maxx + "," + maxy; |
| | | } |
| | | |
| | | public DataPo(String name, String inPath, String outPath, Double total, Integer duration, Integer isFlood) { |
| | |
| | | this.maxy = maxy; |
| | | this.total = total; |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public void setPath(String inPath, String outPath) { |
| | | this.inPath = inPath; |
| | | this.outPath = outPath; |
| | | } |
| | | |
| | | public boolean setExtent(Double minx, Double miny, Double maxx, Double maxy) { |
| | |
| | | public void setFloodMaxy(Double floodMaxy) { |
| | | this.floodMaxy = floodMaxy; |
| | | } |
| | | |
| | | public Integer getEpsg() { |
| | | return epsg; |
| | | } |
| | | |
| | | public void setEpsg(Integer epsg) { |
| | | this.epsg = epsg; |
| | | } |
| | | } |
| | |
| | | import com.se.simu.domain.dto.GeField; |
| | | import com.se.simu.domain.dto.GeFile; |
| | | import com.se.simu.domain.dto.GeLayer; |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.helper.RsaHelper; |
| | | import com.se.simu.helper.ShpHelper; |
| | | import com.se.simu.helper.StringHelper; |
| | |
| | | return true; |
| | | } |
| | | |
| | | private void createPath(String basePath) { |
| | | File f = new File(basePath); |
| | | if (f.exists() && f.isDirectory()) { |
| | | FileUtil.del(f); |
| | | } |
| | | f.mkdirs(); |
| | | } |
| | | |
| | | public String getToken() throws Exception { |
| | | Map<String, Object> map = new HashMap<>(2); |
| | | map.put("userid", user); |
| | |
| | | return data.getStr("token"); |
| | | } |
| | | |
| | | public String getPassword() throws Exception { |
| | | private String getPassword() throws Exception { |
| | | if (StringHelper.isEmpty(password)) { |
| | | String key = getPublicKey(); |
| | | RsaHelper.setPublicKey(key); |
| | |
| | | return password; |
| | | } |
| | | |
| | | public String getPublicKey() { |
| | | 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); |
| | | |
| | |
| | | return data.getJSONArray("features"); |
| | | } |
| | | |
| | | public void createShps(String basePath, List<GeLayer> layers) throws Exception { |
| | | public void copeVectors(DataPo data, List<GeLayer> layers) throws Exception { |
| | | String basePath = inPath + File.separator + data.getInPath(); |
| | | createShps(basePath, layers); |
| | | } |
| | | |
| | | private void createShps(String basePath, List<GeLayer> layers) throws Exception { |
| | | for (GeLayer layer : layers) { |
| | | String path = String.format("%s\\%s.shp", basePath, layer.getShpName()); |
| | | if (!ShpHelper.createShp(path, layer)) { |
| | |
| | | } |
| | | } |
| | | |
| | | public GeDb getFileDb(String token) { |
| | | public void copeDem(String token, DataPo data) throws Exception { |
| | | GeDb fileDb = getFileDb(token); |
| | | String fileId = getFileId(token, fileDb.getDbid()); |
| | | List<GeFile> files = getFileNames(token, fileDb.getDbid(), fileId); |
| | | |
| | | String basePath = inPath + File.separator + data.getInPath(); |
| | | String filePath = inPath + File.separator + fileDb.getDbid(); |
| | | downloadFiles(token, filePath, files, fileDb.getDbid(), fileId); |
| | | clipDemFile(filePath, files, basePath, data.getBbox(), 0); |
| | | } |
| | | |
| | | private GeDb getFileDb(String token) { |
| | | String uri = String.format("%sfile-service/docdb/query/canview?token=%s", host, token); |
| | | JSONObject obj = restTemplate.getForObject(uri, JSONObject.class); |
| | | JSONArray data = obj.getJSONArray("data"); |
| | |
| | | return list.stream().filter(db -> null != db.getName() && db.getName().contains(dbName)).findFirst().orElse(null); |
| | | } |
| | | |
| | | public String getFileId(String token, String dbid) { |
| | | 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); |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public List<GeFile> getFileNames(String token, String dbid, String fileId) { |
| | | 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); |
| | | |
| | |
| | | return JSONUtil.toList(data, GeFile.class); |
| | | } |
| | | |
| | | public void downloadFiles(String token, String path, List<GeFile> files, String dbid, String fileId) throws IOException { |
| | | private void downloadFiles(String token, String path, List<GeFile> files, String dbid, String fileId) throws IOException { |
| | | File f = new File(path); |
| | | if (!f.exists() || !f.isDirectory()) { |
| | | f.mkdirs(); |
| | |
| | | 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.domain.dto.GeDb; |
| | | import com.se.simu.domain.dto.GeLayer; |
| | | import com.se.simu.domain.po.DataPo; |
| | | import com.se.simu.domain.po.SimuPo; |
| | | import com.se.simu.domain.vo.CreateSimuVo; |
| | |
| | | } |
| | | |
| | | private void createDir(String path) { |
| | | File dir = new File(path); |
| | | if (!dir.exists() || !dir.isDirectory()) { |
| | | dir.mkdirs(); |
| | | File f = new File(path); |
| | | if (f.exists() && f.isDirectory()) { |
| | | FileUtil.del(f); |
| | | } |
| | | f.mkdirs(); |
| | | } |
| | | |
| | | private void asyncCall(SimuPo simu) { |
| | |
| | | private void scope(SimuPo simu) { |
| | | try { |
| | | DataPo data = JSONUtil.toBean(simu.getData(), DataPo.class); |
| | | |
| | | update(simu, 1, null); |
| | | String token = gedbService.getToken(); |
| | | GeDb db = gedbService.getSeDb(token); |
| | | db.setBbox(data.getBbox()); |
| | | data.setEpsg(db.getEpsg()); |
| | | |
| | | //boolean flag = tifService.splitTif(dsd); |
| | | //update(simu, flag ? 2 : 20, flag ? null : "切分数据出错"); |
| | | //if (!flag) return; |
| | | update(simu, 2, null); |
| | | List<GeLayer> layers = gedbService.getLayers(token, db); |
| | | gedbService.queryData(token, db, layers); |
| | | gedbService.copeVectors(data, layers); |
| | | |
| | | //flag = aiService.sendRequest(task.getDataType(), dsd.getDataTime()); |
| | | //update(simu, flag ? 3 : 20, flag ? null : "识别数据出错"); |
| | | //if (!flag) return; |
| | | update(simu, 3, null); |
| | | gedbService.copeDem(token, data); |
| | | |
| | | //flag = geoJsonService.processResults(task, dsd); |
| | | //update(simu, flag ? 10 : 20, flag ? "执行完成" : "处理结果出错"); |
| | | update(simu, 4, null); |
| | | // 模拟内涝仿真 |
| | | |
| | | //update(simu, 5, null); |
| | | // 处理仿真数据 |
| | | |
| | | //update(simu, 10, "完成"); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | update(simu, -10, ex.getMessage()); |