Commit bd2f6353380968a51d2e328cc57e9422747496ff

Authored by 李强
1 parent 4a5801f4

空间数据存储bug修复

src/main/java/com/bsth/repository/SectionRepository.java
... ... @@ -58,7 +58,7 @@ public interface SectionRepository extends BaseRepository<Section, Integer> {
58 58  
59 59 "VALUES (?1 , ?2 , ?3 , ?4 , ?5 , "+
60 60  
61   - "?6 , GEOMFROMTEXT(?7) , GEOMFROMTEXT(?8) , ?9 , ?10 ,"+
  61 + "?6 , ST_GeomFromText(?7) , ST_GeomFromText(?8) , ?9 , ?10 ,"+
62 62  
63 63 "?11 , ?12 , ?13 , ?14 , ?15 ,"+
64 64  
... ... @@ -83,8 +83,8 @@ public interface SectionRepository extends BaseRepository<Section, Integer> {
83 83 @Transactional
84 84 @Modifying
85 85 @Query(value="UPDATE bsth_c_section SET " +
86   - "gsection_vector = GEOMFROMTEXT(?2) , " +
87   - "bsection_vector = GEOMFROMTEXT(?3)," +
  86 + "gsection_vector = ST_GeomFromText(?2) , " +
  87 + "bsection_vector = ST_GeomFromText(?3)," +
88 88 "section_code = ?4," +
89 89 "section_name = ?5," +
90 90 "croses_road = ?6," +
... ...
src/main/java/com/bsth/repository/StationRepository.java
... ... @@ -61,7 +61,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> {
61 61 "create_by,update_by,id) " +
62 62 " VALUES(" +
63 63 "?1 , ?2 , ?3 , ?4 , ?5," +
64   - "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
  64 + "?6 , ?7 , ?8 , ?9 , ST_GeomFromText(?10),ST_GeomFromText(?11)," +
65 65 "?12 ,?13, ?14, ?15, ?16," +
66 66 "?17,?18,?19)", nativeQuery=true)
67 67 public void stationSave(String stationCode,String stationName,String roadCoding,String dbType,String bJwpoints,
... ... @@ -93,8 +93,8 @@ public interface StationRepository extends BaseRepository<Station, Integer> {
93 93 "g_laty = ?7 , " +
94 94 "x = ?8 , " +
95 95 "y = ?9 , " +
96   - "b_polygon_grid = GeomFromText(?10) , " +
97   - "g_polygon_grid = GeomFromText(?11) , " +
  96 + "b_polygon_grid = ST_GeomFromText(?10) , " +
  97 + "g_polygon_grid = ST_GeomFromText(?11) , " +
98 98 "destroy = ?12 , " +
99 99 "radius = ?13 , " +
100 100 "shapes_type = ?14 , " +
... ...
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
... ... @@ -181,10 +181,14 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem
181 181 Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
182 182  
183 183 // WGS坐标点集合
184   - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  184 + String gsectionVector = null;
  185 + if(!sectionsWJPpoints.equals(""))
  186 + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
185 187  
186 188 // 原坐标点集合
187   - String bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
  189 + String bsectionVectorS = null;
  190 + if(!sectionsBpoints.equals(""))
  191 + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
188 192  
189 193 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
190 194  
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -1029,6 +1029,16 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
1029 1029  
1030 1030 }
1031 1031  
  1032 + if(bPloygonGrid.equals(""))
  1033 + bPloygonGrid = null;
  1034 + else
  1035 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1036 +
  1037 + if(gPloygonGrid.equals(""))
  1038 + gPloygonGrid = null;
  1039 + else
  1040 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
  1041 +
1032 1042 // 保存站点
1033 1043 repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints,
1034 1044  
... ... @@ -1219,9 +1229,16 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
1219 1229  
1220 1230 }
1221 1231  
1222   - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1232 + if(bPloygonGrid.equals(""))
  1233 + bPloygonGrid = null;
  1234 + else
  1235 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  1236 +
  1237 + if(gPloygonGrid.equals(""))
  1238 + gPloygonGrid = null;
  1239 + else
  1240 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
1223 1241  
1224   - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
1225 1242  
1226 1243 // 是否撤销
1227 1244 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
... ...