Commit bd7fbe9f57c7282974a45872412f223654ba92eb
Merge branch 'pudong_jdk8' of http://192.168.168.245:8888/panzhaov5/bsth_control into pudong_jdk8
Showing
3 changed files
with
17 additions
and
1 deletions
src/main/java/com/bsth/controller/GeoPremiseController.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.controller; |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.entity.GeoPremise; |
| 5 | 5 | import com.bsth.service.GeoPremiseService; |
| 6 | +import com.bsth.util.GeoConverter; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -26,6 +27,8 @@ public class GeoPremiseController extends BaseController<GeoPremise, Integer> { |
| 26 | 27 | public Map<String, Object> save(GeoPremise geoPremise) { |
| 27 | 28 | Map<String, Object> result = new HashMap<>(); |
| 28 | 29 | try { |
| 30 | + String coords = geoPremise.getCoords(); | |
| 31 | + geoPremise.setCoordsWgs(GeoConverter.polygonBd2wgs(String.format("POLYGON((%s))", coords)).toString().replace("POLYGON((", "").replace("))", "")); | |
| 29 | 32 | result.putAll(geoPremiseService.save(geoPremise)); |
| 30 | 33 | result.put("status", ResponseCode.SUCCESS); |
| 31 | 34 | } catch (Exception e) { | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
| ... | ... | @@ -233,7 +233,7 @@ public class GeoCacheData { |
| 233 | 233 | private void loadPremiseGeoData() { |
| 234 | 234 | ArrayListMultimap<String, PreconditionGeo> premiseGeoMapCopy = ArrayListMultimap.create(); |
| 235 | 235 | |
| 236 | - String sql = "select * from bsth_f_geo_premise"; | |
| 236 | + String sql = "SELECT name, station_code, line_code, up_down, coords_wgs AS coords FROM bsth_f_geo_premise"; | |
| 237 | 237 | List<PreconditionGeo> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(PreconditionGeo.class)); |
| 238 | 238 | |
| 239 | 239 | List<String> coordList; | ... | ... |
src/main/java/com/bsth/entity/GeoPremise.java
| ... | ... | @@ -37,6 +37,11 @@ public class GeoPremise { |
| 37 | 37 | */ |
| 38 | 38 | private String coords; |
| 39 | 39 | |
| 40 | + /** | |
| 41 | + * wgs84坐标 | |
| 42 | + */ | |
| 43 | + private String coordsWgs; | |
| 44 | + | |
| 40 | 45 | public Integer getId() { |
| 41 | 46 | return id; |
| 42 | 47 | } |
| ... | ... | @@ -84,4 +89,12 @@ public class GeoPremise { |
| 84 | 89 | public void setCoords(String coords) { |
| 85 | 90 | this.coords = coords; |
| 86 | 91 | } |
| 92 | + | |
| 93 | + public String getCoordsWgs() { | |
| 94 | + return coordsWgs; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setCoordsWgs(String coordsWgs) { | |
| 98 | + this.coordsWgs = coordsWgs; | |
| 99 | + } | |
| 87 | 100 | } | ... | ... |