| | |
| | | import com.se.simu.domain.SeLayer; |
| | | import com.se.simu.helper.RsaHelper; |
| | | import com.se.simu.helper.ShpHelper; |
| | | import com.se.simu.helper.StringHelper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | SeDb db = getSeDb(token); |
| | | db.setBbox(bbox); |
| | | |
| | | List<SeLayer> layers = getLayers(token, db.getDbid()); |
| | | List<SeLayer> layers = getLayers(token, db); |
| | | queryData(token, db, layers); |
| | | |
| | | createShps(inPath + "\\20240913", layers); |
| | |
| | | return list.stream().filter(db -> dbName.equals(db.getName())).findFirst().orElse(null); |
| | | } |
| | | |
| | | public List<SeLayer> getLayers(String token, String dbid) { |
| | | String uri = String.format("%sgeo-service/entitydb/map/config?dbid=%s&token=%s", host, dbid, token); |
| | | public List<SeLayer> getLayers(String token, SeDb db) { |
| | | String uri = String.format("%sgeo-service/entitydb/map/config?dbid=%s&token=%s", host, db.getDbid(), token); |
| | | JSONObject obj = restTemplate.getForObject(uri, JSONObject.class); |
| | | |
| | | JSONObject data = obj.getJSONObject("data"); |
| | |
| | | String name = jb.getStr("name"); |
| | | if (layerNames.contains(name)) { |
| | | String id = jb.getStr("id"); |
| | | Integer dataType = jb.getInt("_data_type"); |
| | | String queryType = getQueryType(jb); |
| | | List<SeField> fields = JSONUtil.toList(jb.getJSONArray("fields"), SeField.class); |
| | | fields = fields.stream().filter(f -> !sysFields.contains(f.getName())).collect(Collectors.toList()); |
| | | String shpName = shpNames.get(layerNames.indexOf(name)); |
| | | |
| | | layers.add(new SeLayer(id, name, shpName, dataType, fields)); |
| | | layers.add(new SeLayer(id, name, queryType, fields, shpName, db)); |
| | | } |
| | | } |
| | | |
| | | return layers; |
| | | } |
| | | |
| | | private String getQueryType(JSONObject jb) { |
| | | String qt = jb.getStr("pointlod"); |
| | | if (!StringHelper.isEmpty(qt)) { |
| | | return "point"; |
| | | } |
| | | |
| | | qt = jb.getStr("polylinelod"); |
| | | if (!StringHelper.isEmpty(qt)) { |
| | | return "polyline"; |
| | | } |
| | | |
| | | return "polygon"; |
| | | } |
| | | |
| | | public void queryData(String token, SeDb db, List<SeLayer> layers) throws Exception { |
| | | for (SeLayer layer : layers) { |
| | | int count = getCount(token, db, layer); |