Commit 4484a9f1813172ab3e48ada72d654682724c8048
1 parent
e706c519
基础信息功能修订
Showing
21 changed files
with
254 additions
and
759 deletions
Too many changes to show.
To preserve performance only 21 of 88 files are displayed.
src/main/java/com/bsth/controller/BusinessController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
| 5 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 4 | 6 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 7 | |
| 6 | 8 | import com.bsth.entity.Business; |
| 9 | +import com.bsth.service.BusinessService; | |
| 10 | +import com.bsth.util.GetUIDAndCode; | |
| 7 | 11 | |
| 8 | 12 | /** |
| 9 | 13 | * |
| ... | ... | @@ -23,5 +27,11 @@ import com.bsth.entity.Business; |
| 23 | 27 | @RestController |
| 24 | 28 | @RequestMapping("business") |
| 25 | 29 | public class BusinessController extends BaseController<Business, Integer> { |
| 26 | - | |
| 30 | + @Autowired | |
| 31 | + private BusinessService businessService; | |
| 32 | + | |
| 33 | + @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | |
| 34 | + public long getLineCode() { | |
| 35 | + return businessService.getCompCode(); | |
| 36 | + } | |
| 27 | 37 | } | ... | ... |
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -48,13 +48,9 @@ public class SectionController extends BaseController<Section, Integer> { |
| 48 | 48 | */ |
| 49 | 49 | @RequestMapping(value="sectionSave" , method = RequestMethod.POST) |
| 50 | 50 | public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { |
| 51 | - | |
| 52 | 51 | map.put("createBy", ""); |
| 53 | - | |
| 54 | 52 | map.put("updateBy", ""); |
| 55 | - | |
| 56 | 53 | return service.sectionSave(map); |
| 57 | - | |
| 58 | 54 | } |
| 59 | 55 | |
| 60 | 56 | /** | ... | ... |
src/main/java/com/bsth/controller/SectionRouteController.java
| ... | ... | @@ -57,7 +57,6 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 57 | 57 | */ |
| 58 | 58 | @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET) |
| 59 | 59 | public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) { |
| 60 | - | |
| 61 | 60 | return routeService.findSectionRouteInfoFormId(map); |
| 62 | 61 | } |
| 63 | 62 | ... | ... |
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -60,16 +60,12 @@ public class StationController extends BaseController<Station, Integer> { |
| 60 | 60 | */ |
| 61 | 61 | @RequestMapping(value="collectionSave" , method = RequestMethod.POST) |
| 62 | 62 | public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { |
| 63 | - | |
| 64 | 63 | return service.systemSaveStations(map); |
| 65 | - | |
| 66 | 64 | } |
| 67 | 65 | |
| 68 | 66 | @RequestMapping(value="manualSave" , method = RequestMethod.POST) |
| 69 | 67 | public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { |
| 70 | - | |
| 71 | 68 | return service.manualSave(map); |
| 72 | - | |
| 73 | 69 | } |
| 74 | 70 | |
| 75 | 71 | /** |
| ... | ... | @@ -89,13 +85,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 89 | 85 | */ |
| 90 | 86 | @RequestMapping(value="stationSave" , method = RequestMethod.POST) |
| 91 | 87 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 92 | - | |
| 93 | 88 | map.put("createBy", ""); |
| 94 | - | |
| 95 | 89 | map.put("updateBy", ""); |
| 96 | - | |
| 97 | 90 | return service.stationSaveMap(map); |
| 98 | - | |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | /** | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -36,6 +36,17 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 36 | 36 | @Autowired |
| 37 | 37 | StationRouteRepository stationRouteRepository; |
| 38 | 38 | |
| 39 | + /** | |
| 40 | + * @param @param map | |
| 41 | + * @throws | |
| 42 | + * @Title: list | |
| 43 | + * @Description: TODO(多条件查询) | |
| 44 | + */ | |
| 45 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 46 | + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) { | |
| 47 | + return service.list(map); | |
| 48 | + } | |
| 49 | + | |
| 39 | 50 | /** |
| 40 | 51 | * @Description :TODO(查询树站点与路段数据) |
| 41 | 52 | * | ... | ... |
src/main/java/com/bsth/entity/Business.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Column; | |
| 3 | 6 | import javax.persistence.Entity; |
| 4 | 7 | import javax.persistence.GeneratedValue; |
| 5 | 8 | import javax.persistence.GenerationType; |
| ... | ... | @@ -40,6 +43,29 @@ public class Business { |
| 40 | 43 | |
| 41 | 44 | // 描述 |
| 42 | 45 | private String descriptions; |
| 46 | + | |
| 47 | + // 创建日期 | |
| 48 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 49 | + private Date createDate; | |
| 50 | + | |
| 51 | + // 修改日期 | |
| 52 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 53 | + private Date updateDate; | |
| 54 | + public Date getCreateDate() { | |
| 55 | + return createDate; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setCreateDate(Date createDate) { | |
| 59 | + this.createDate = createDate; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Date getUpdateDate() { | |
| 63 | + return updateDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setUpdateDate(Date updateDate) { | |
| 67 | + this.updateDate = updateDate; | |
| 68 | + } | |
| 43 | 69 | |
| 44 | 70 | public Integer getId() { |
| 45 | 71 | return id; | ... | ... |
src/main/java/com/bsth/entity/LineInformation.java
| ... | ... | @@ -64,6 +64,12 @@ public class LineInformation { |
| 64 | 64 | // 晚高峰结束时间 00:00 |
| 65 | 65 | private String lateEndTime; |
| 66 | 66 | |
| 67 | + // 小夜高峰开始时间 00:00 | |
| 68 | + private String xygfkssj; | |
| 69 | + | |
| 70 | + // 小夜高峰结束时间 00:00 | |
| 71 | + private String xygfjssj; | |
| 72 | + | |
| 67 | 73 | // 早高峰上行行驶时间 |
| 68 | 74 | private Double earlyUpTime; |
| 69 | 75 | |
| ... | ... | @@ -91,15 +97,6 @@ public class LineInformation { |
| 91 | 97 | // 停车场 |
| 92 | 98 | private String carPark; |
| 93 | 99 | |
| 94 | - // 进场时间 | |
| 95 | - private Double paradeTime; | |
| 96 | - | |
| 97 | - // 出场时间 | |
| 98 | - private Double outTime; | |
| 99 | - | |
| 100 | - // 进场里程 | |
| 101 | - private Double paradeMileage; | |
| 102 | - | |
| 103 | 100 | // 上行进场时间 |
| 104 | 101 | private Double upInTimer; |
| 105 | 102 | |
| ... | ... | @@ -123,7 +120,82 @@ public class LineInformation { |
| 123 | 120 | |
| 124 | 121 | // 下行出场里程 |
| 125 | 122 | private Double downOutMileage; |
| 123 | + | |
| 124 | + // 早高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 125 | + private Double earlyIntervalLg; | |
| 126 | + | |
| 127 | + // 晚高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 128 | + private Double lateIntervalLg; | |
| 129 | + | |
| 130 | + // 平时大间隔(分钟)老调度系统字段,暂时保留 | |
| 131 | + private Double intervalLg; | |
| 132 | + | |
| 133 | + // 限速(平时)老调度系统字段,暂时保留 | |
| 134 | + private Double speedLimit; | |
| 135 | + | |
| 136 | + // 限速(雨天)老调度系统字段,暂时保留 | |
| 137 | + private Double rainLimit; | |
| 138 | + | |
| 139 | + // 限速(大雾)老调度系统字段,暂时保留 | |
| 140 | + private Double fogLimit; | |
| 126 | 141 | |
| 142 | + // 限速(冰雪)老调度系统字段,暂时保留 | |
| 143 | + private Double snowLimit; | |
| 144 | + | |
| 145 | + // 限速(节庆)老调度系统字段,暂时保留 | |
| 146 | + private Double festivalSpeedLimit; | |
| 147 | + | |
| 148 | + // 滞站 | |
| 149 | + private Integer lagStation; | |
| 150 | + | |
| 151 | + // 越站 | |
| 152 | + private Integer skip; | |
| 153 | + | |
| 154 | + // 超速 | |
| 155 | + private Integer speeding; | |
| 156 | + | |
| 157 | + // 串线 | |
| 158 | + private Integer crossedLine; | |
| 159 | + | |
| 160 | + // 越界 | |
| 161 | + private Integer overflights; | |
| 162 | + | |
| 163 | + // 描述 | |
| 164 | + private String descriptions; | |
| 165 | + | |
| 166 | + // 创建人 | |
| 167 | + private Integer createBy; | |
| 168 | + | |
| 169 | + // 修改人 | |
| 170 | + private Integer updateBy; | |
| 171 | + | |
| 172 | + // 创建日期 | |
| 173 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 174 | + private Date createDate; | |
| 175 | + | |
| 176 | + // 修改日期 | |
| 177 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 178 | + private Date updateDate; | |
| 179 | + | |
| 180 | + @ManyToOne | |
| 181 | + private Line line; | |
| 182 | + | |
| 183 | + public String getXygfkssj() { | |
| 184 | + return xygfkssj; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setXygfkssj(String xygfkssj) { | |
| 188 | + this.xygfkssj = xygfkssj; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public String getXygfjssj() { | |
| 192 | + return xygfjssj; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setXygfjssj(String xygfjssj) { | |
| 196 | + this.xygfjssj = xygfjssj; | |
| 197 | + } | |
| 198 | + | |
| 127 | 199 | public Double getUpInTimer() { |
| 128 | 200 | return upInTimer; |
| 129 | 201 | } |
| ... | ... | @@ -188,68 +260,6 @@ public class LineInformation { |
| 188 | 260 | this.downOutMileage = downOutMileage; |
| 189 | 261 | } |
| 190 | 262 | |
| 191 | - // 出场里程 | |
| 192 | - private Double outMileage; | |
| 193 | - | |
| 194 | - // 早高峰大间隔(分钟) | |
| 195 | - private Double earlyIntervalLg; | |
| 196 | - | |
| 197 | - // 晚高峰大间隔(分钟) | |
| 198 | - private Double lateIntervalLg; | |
| 199 | - | |
| 200 | - // 平时大间隔(分钟) | |
| 201 | - private Double intervalLg; | |
| 202 | - | |
| 203 | - // 限速(平时) | |
| 204 | - private Double speedLimit; | |
| 205 | - | |
| 206 | - // 限速(雨天) | |
| 207 | - private Double rainLimit; | |
| 208 | - | |
| 209 | - // 限速(大雾) | |
| 210 | - private Double fogLimit; | |
| 211 | - | |
| 212 | - // 限速(冰雪) | |
| 213 | - private Double snowLimit; | |
| 214 | - | |
| 215 | - // 限速(节庆) | |
| 216 | - private Double festivalSpeedLimit; | |
| 217 | - | |
| 218 | - // 滞站 | |
| 219 | - private Integer lagStation; | |
| 220 | - | |
| 221 | - // 越站 | |
| 222 | - private Integer skip; | |
| 223 | - | |
| 224 | - // 超速 | |
| 225 | - private Integer speeding; | |
| 226 | - | |
| 227 | - // 串线 | |
| 228 | - private Integer crossedLine; | |
| 229 | - | |
| 230 | - // 越界 | |
| 231 | - private Integer overflights; | |
| 232 | - | |
| 233 | - // 描述 | |
| 234 | - private String descriptions; | |
| 235 | - | |
| 236 | - // 创建人 | |
| 237 | - private Integer createBy; | |
| 238 | - | |
| 239 | - // 修改人 | |
| 240 | - private Integer updateBy; | |
| 241 | - | |
| 242 | - // 创建日期 | |
| 243 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 244 | - private Date createDate; | |
| 245 | - | |
| 246 | - // 修改日期 | |
| 247 | - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 248 | - private Date updateDate; | |
| 249 | - | |
| 250 | - @ManyToOne | |
| 251 | - private Line line; | |
| 252 | - | |
| 253 | 263 | public Integer getId() { |
| 254 | 264 | return id; |
| 255 | 265 | } |
| ... | ... | @@ -416,39 +426,6 @@ public class LineInformation { |
| 416 | 426 | public void setCarPark(String carPark) { |
| 417 | 427 | this.carPark = carPark; |
| 418 | 428 | } |
| 419 | - | |
| 420 | - public Double getParadeTime() { | |
| 421 | - return paradeTime; | |
| 422 | - } | |
| 423 | - | |
| 424 | - public void setParadeTime(Double paradeTime) { | |
| 425 | - this.paradeTime = paradeTime; | |
| 426 | - } | |
| 427 | - | |
| 428 | - public Double getOutTime() { | |
| 429 | - return outTime; | |
| 430 | - } | |
| 431 | - | |
| 432 | - public void setOutTime(Double outTime) { | |
| 433 | - this.outTime = outTime; | |
| 434 | - } | |
| 435 | - | |
| 436 | - public Double getParadeMileage() { | |
| 437 | - return paradeMileage; | |
| 438 | - } | |
| 439 | - | |
| 440 | - public void setParadeMileage(Double paradeMileage) { | |
| 441 | - this.paradeMileage = paradeMileage; | |
| 442 | - } | |
| 443 | - | |
| 444 | - public Double getOutMileage() { | |
| 445 | - return outMileage; | |
| 446 | - } | |
| 447 | - | |
| 448 | - public void setOutMileage(Double outMileage) { | |
| 449 | - this.outMileage = outMileage; | |
| 450 | - } | |
| 451 | - | |
| 452 | 429 | public Double getEarlyIntervalLg() { |
| 453 | 430 | return earlyIntervalLg; |
| 454 | 431 | } | ... | ... |
src/main/java/com/bsth/entity/SectionRoute.java
src/main/java/com/bsth/repository/BusinessRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | +import org.springframework.data.jpa.repository.Query; | |
| 3 | 4 | import org.springframework.stereotype.Repository; |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.Business; |
| ... | ... | @@ -28,5 +29,7 @@ public interface BusinessRepository extends BaseRepository<Business, Integer> { |
| 28 | 29 | List<Business> findByBusinessCode(String code); |
| 29 | 30 | |
| 30 | 31 | List<Business> findByUpCodeAndBusinessCode(String c1, String c2); |
| 31 | - | |
| 32 | + | |
| 33 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_business) k" , nativeQuery=true) | |
| 34 | + long getMaxId(); | |
| 32 | 35 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
src/main/java/com/bsth/repository/SectionRouteRepository.java
| ... | ... | @@ -121,7 +121,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 121 | 121 | "b.create_date AS sectionCreateDate," + |
| 122 | 122 | "b.update_by AS sectionUpdateBy," + |
| 123 | 123 | "b.update_date AS sectionUpdateDate," + |
| 124 | - "b.versions AS sectionVersion FROM (" + | |
| 124 | + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" + | |
| 125 | 125 | " SELECT s.id AS sectionRouteId," + |
| 126 | 126 | "s.line_code AS sectionRouteLineCode," + |
| 127 | 127 | "s.sectionroute_code AS sectionRouteCode," + |
| ... | ... | @@ -134,7 +134,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 134 | 134 | "s.update_by AS sectionRouteUpdateBy," + |
| 135 | 135 | "s.update_date AS sectionRouteUpdateDate," + |
| 136 | 136 | "s.versions AS sectionRouteVersions," + |
| 137 | - "s.destroy AS sectionRouteDestroy" + | |
| 137 | + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " + | |
| 138 | 138 | " FROM bsth_c_sectionroute s where s.id =?1) a " + |
| 139 | 139 | " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) |
| 140 | 140 | List<Object[]> findSectionRouteInfoFormId(int id); |
| ... | ... | @@ -171,6 +171,10 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 171 | 171 | @Query(value="UPDATE bsth_c_sectionroute set is_roade_speed = ?1 where line= ?2 and directions=?3 ",nativeQuery = true) |
| 172 | 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); |
| 173 | 173 | |
| 174 | + @Modifying | |
| 175 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | |
| 176 | + public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); | |
| 177 | + | |
| 174 | 178 | @Modifying |
| 175 | 179 | @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) |
| 176 | 180 | public void sectionRouteDir(Integer line); | ... | ... |
src/main/java/com/bsth/repository/StationRepository.java
| ... | ... | @@ -37,7 +37,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> { |
| 37 | 37 | , nativeQuery=true) |
| 38 | 38 | long stationMaxId(); |
| 39 | 39 | |
| 40 | - @Query(value = "SELECT * FROM bsth_c_station s where s.station_name = ?1" | |
| 40 | + @Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?1" | |
| 41 | 41 | , nativeQuery=true) |
| 42 | 42 | List<Object[]> findStationName(String stationName); |
| 43 | 43 | ... | ... |
src/main/java/com/bsth/service/BusinessService.java
src/main/java/com/bsth/service/StationRouteService.java
| ... | ... | @@ -23,6 +23,14 @@ import com.bsth.entity.StationRoute; |
| 23 | 23 | public interface StationRouteService extends BaseService<StationRoute, Integer> { |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | + * | |
| 27 | + * @Title: list | |
| 28 | + * @Description: TODO(多条件查询) | |
| 29 | + * @throws | |
| 30 | + */ | |
| 31 | + Iterable<StationRoute> list(Map<String, Object> map); | |
| 32 | + | |
| 33 | + /** | |
| 26 | 34 | * @Description :TODO(查询树站点与路段数据) |
| 27 | 35 | * |
| 28 | 36 | * @param map <line.id_eq:线路ID; directions_eq:方向> | ... | ... |
src/main/java/com/bsth/service/impl/BusinessServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.stereotype.Service; |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.Business; |
| 7 | +import com.bsth.repository.BusinessRepository; | |
| 6 | 8 | import com.bsth.service.BusinessService; |
| 7 | 9 | |
| 8 | 10 | /** |
| ... | ... | @@ -23,5 +25,12 @@ import com.bsth.service.BusinessService; |
| 23 | 25 | |
| 24 | 26 | @Service |
| 25 | 27 | public class BusinessServiceImpl extends BaseServiceImpl<Business, Integer> implements BusinessService{ |
| 28 | + @Autowired | |
| 29 | + private BusinessRepository businessRepository; | |
| 30 | + @Override | |
| 31 | + public long getCompCode() { | |
| 32 | + // TODO Auto-generated method stub | |
| 33 | + return businessRepository.getMaxId(); | |
| 34 | + } | |
| 26 | 35 | |
| 27 | 36 | } | ... | ... |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| ... | ... | @@ -16,6 +16,7 @@ import com.bsth.repository.LineRepository; |
| 16 | 16 | import com.bsth.repository.SectionRepository; |
| 17 | 17 | import com.bsth.repository.SectionRouteRepository; |
| 18 | 18 | import com.bsth.service.SectionRouteService; |
| 19 | +import com.bsth.util.GetUIDAndCode; | |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * |
| ... | ... | @@ -185,6 +186,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 185 | 186 | |
| 186 | 187 | tempM.put("sectionVersion", objects.get(i)[33]); |
| 187 | 188 | |
| 189 | + tempM.put("isRoadeSpeed", objects.get(i)[34]); | |
| 188 | 190 | resultList.add(tempM); |
| 189 | 191 | } |
| 190 | 192 | |
| ... | ... | @@ -203,32 +205,19 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 203 | 205 | */ |
| 204 | 206 | @Override |
| 205 | 207 | public List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map) { |
| 206 | - | |
| 207 | 208 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 208 | - | |
| 209 | 209 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); |
| 210 | - | |
| 211 | 210 | Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString()); |
| 212 | - | |
| 213 | 211 | List<Object[]> reslutList = repository.findUpSectionRouteCode(lineId, direction, stationRouteCode); |
| 214 | - | |
| 215 | 212 | List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); |
| 216 | - | |
| 217 | 213 | if(reslutList.get(0)!=null) { |
| 218 | - | |
| 219 | 214 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 220 | - | |
| 221 | 215 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 222 | - | |
| 223 | 216 | System.out.println(reslutList.get(i)); |
| 224 | - | |
| 225 | 217 | tempM.put("sectionrouteCode", reslutList.get(i)); |
| 226 | - | |
| 227 | 218 | list.add(tempM); |
| 228 | - | |
| 229 | 219 | } |
| 230 | 220 | } |
| 231 | - | |
| 232 | 221 | return list; |
| 233 | 222 | } |
| 234 | 223 | |
| ... | ... | @@ -243,8 +232,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 243 | 232 | List<Object[]> list = repository.getSectionRoute(line, dir); |
| 244 | 233 | int src = repository.sectionRouteCodeMaxId(); |
| 245 | 234 | for(int i = 0 ; i<list.size() ; i++) { |
| 246 | - int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ; | |
| 247 | - String sectionCode = String.valueOf(sectionId); | |
| 235 | + /*int sectionId = Integer.parseInt(String.valueOf(repository2.sectionMaxId())) + 1 ;*/ | |
| 236 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | |
| 237 | + String sectionCode = String.valueOf(sectionMaxId); | |
| 238 | + int sectionId = (int)sectionMaxId; | |
| 248 | 239 | String sectionName = list.get(i)[9] == null ? null : list.get(i)[9].toString(); |
| 249 | 240 | String crosesRoad = list.get(i)[10] == null ? null : list.get(i)[10].toString(); |
| 250 | 241 | String endNode = list.get(i)[11] == null ? null : list.get(i)[11].toString(); |
| ... | ... | @@ -267,12 +258,12 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 267 | 258 | gsectionVector, bsectionVector, |
| 268 | 259 | sectionType, csectionVector, roadCoding, |
| 269 | 260 | sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId); |
| 270 | - int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; | |
| 261 | + // int sectionRouteId = Integer.parseInt(String.valueOf(repository.sectionRouteMaxId())) + 1 ; | |
| 271 | 262 | SectionRoute sr = new SectionRoute(); |
| 272 | 263 | Line lineObject = lineRepository.findOne(line); |
| 273 | 264 | Section section = repository2.findOne(sectionId); |
| 274 | 265 | Integer xh = (src == 0 ? (toDir ==1? (list.size()-i)*10 : (list.size()+i)*10) : toDir==1? (src + (list.size()-i)*10) : (src + (list.size()+i)*10)) ; |
| 275 | - sr.setId(sectionRouteId); | |
| 266 | + // sr.setId(sectionRouteId); | |
| 276 | 267 | sr.setSectionrouteCode(xh); |
| 277 | 268 | sr.setLineCode(lineObject.getLineCode()); |
| 278 | 269 | sr.setSectionCode(sectionCode); |
| ... | ... | @@ -294,5 +285,4 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ |
| 294 | 285 | } |
| 295 | 286 | return resultMap; |
| 296 | 287 | } |
| 297 | - | |
| 298 | -} | |
| 288 | +} | |
| 299 | 289 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -7,6 +7,7 @@ import java.util.Map; |
| 7 | 7 | |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.stereotype.Service; |
| 10 | +import org.springframework.transaction.annotation.Transactional; | |
| 10 | 11 | |
| 11 | 12 | import com.alibaba.fastjson.JSONArray; |
| 12 | 13 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -57,210 +58,122 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 57 | 58 | */ |
| 58 | 59 | @Override |
| 59 | 60 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { |
| 60 | - | |
| 61 | 61 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 62 | - | |
| 63 | 62 | try { |
| 64 | - | |
| 65 | 63 | String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); |
| 66 | - | |
| 67 | 64 | // 原始线状图形坐标集合 |
| 68 | 65 | String sectionsBpoints = ""; |
| 69 | - | |
| 70 | 66 | // WGS线状图形坐标集合 |
| 71 | 67 | String sectionsWJPpoints = ""; |
| 72 | - | |
| 73 | 68 | if(!bsectionVector.equals("")) { |
| 74 | - | |
| 75 | 69 | // 转换成JSON数组 |
| 76 | 70 | JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); |
| 77 | - | |
| 78 | 71 | // 遍历 |
| 79 | 72 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 80 | - | |
| 81 | 73 | String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); |
| 82 | - | |
| 83 | 74 | String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); |
| 84 | - | |
| 85 | 75 | /** to WGS坐标 */ |
| 86 | 76 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 87 | - | |
| 88 | 77 | String WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 89 | - | |
| 90 | 78 | String WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 91 | - | |
| 92 | 79 | if(s==0) { |
| 93 | - | |
| 94 | 80 | sectionsBpoints = pointsLngStr + " " + pointsLatStr; |
| 95 | - | |
| 96 | 81 | sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; |
| 97 | - | |
| 98 | 82 | }else { |
| 99 | - | |
| 100 | 83 | sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; |
| 101 | - | |
| 102 | 84 | sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; |
| 103 | - | |
| 104 | 85 | } |
| 105 | - | |
| 106 | - | |
| 107 | 86 | } |
| 108 | - | |
| 109 | 87 | } |
| 110 | - | |
| 111 | 88 | // 原坐标类型 |
| 112 | 89 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 113 | - | |
| 114 | 90 | // 说明 |
| 115 | 91 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 116 | - | |
| 117 | 92 | // 是否撤销 |
| 118 | 93 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 119 | - | |
| 120 | 94 | // 方向 |
| 121 | 95 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 122 | - | |
| 123 | 96 | // 线路ID |
| 124 | 97 | Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); |
| 125 | - | |
| 126 | 98 | // 道路编码 |
| 127 | 99 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 128 | - | |
| 129 | 100 | // 路段编码 |
| 130 | 101 | String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); |
| 131 | - | |
| 132 | 102 | // 路段长度 |
| 133 | 103 | Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); |
| 134 | - | |
| 135 | 104 | // 路段ID |
| 136 | 105 | Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); |
| 137 | - | |
| 138 | 106 | // 路段名称 |
| 139 | 107 | String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); |
| 140 | - | |
| 141 | 108 | // 路段路由Id |
| 142 | 109 | Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); |
| 143 | - | |
| 144 | 110 | // 线路编码 |
| 145 | 111 | String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); |
| 146 | - | |
| 147 | 112 | // 路段时长 |
| 148 | 113 | Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); |
| 149 | - | |
| 150 | 114 | // 路段路由 |
| 151 | 115 | Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); |
| 152 | - | |
| 153 | 116 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); |
| 154 | - | |
| 155 | 117 | int old_code = resultS.getSectionrouteCode(); |
| 156 | - | |
| 157 | 118 | if(sectionrouteCode!=null) { |
| 158 | - | |
| 159 | 119 | int new_code = sectionrouteCode+100; |
| 160 | - | |
| 161 | 120 | if(new_code==old_code){ |
| 162 | - | |
| 163 | 121 | sectionrouteCode = new_code; |
| 164 | - | |
| 165 | 122 | }else { |
| 166 | - | |
| 167 | 123 | sectionrouteCode = new_code-100+1; |
| 168 | - | |
| 169 | 124 | } |
| 170 | - | |
| 171 | 125 | }else { |
| 172 | - | |
| 173 | 126 | sectionrouteCode = old_code; |
| 174 | - | |
| 175 | 127 | } |
| 176 | - | |
| 177 | 128 | // 限速 |
| 178 | 129 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 179 | - | |
| 180 | 130 | // 版本 |
| 181 | 131 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 182 | - | |
| 183 | 132 | // WGS坐标点集合 |
| 184 | 133 | String gsectionVector = null; |
| 185 | 134 | if(!sectionsWJPpoints.equals("")) |
| 186 | 135 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 187 | - | |
| 188 | 136 | // 原坐标点集合 |
| 189 | 137 | String bsectionVectorS = null; |
| 190 | 138 | if(!sectionsBpoints.equals("")) |
| 191 | 139 | bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; |
| 192 | - | |
| 193 | 140 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 194 | - | |
| 195 | 141 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 196 | - | |
| 197 | 142 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 198 | - | |
| 143 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | |
| 199 | 144 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 200 | - | |
| 201 | 145 | Date date = new Date(); |
| 202 | - | |
| 203 | 146 | // 修改日期 |
| 204 | 147 | String updateDate = formatter.format(date); |
| 205 | - | |
| 206 | 148 | String crosesRoad=""; |
| 207 | - | |
| 208 | 149 | String endNode=""; |
| 209 | - | |
| 210 | 150 | String startNode=""; |
| 211 | - | |
| 212 | 151 | String middleNode=""; |
| 213 | - | |
| 214 | 152 | String sectionType=""; |
| 215 | - | |
| 216 | - // String csectionVector=""; | |
| 217 | - | |
| 218 | 153 | // 更新 |
| 219 | - /*repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);*/ | |
| 220 | 154 | repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); |
| 221 | - | |
| 222 | 155 | SectionRoute route = new SectionRoute(); |
| 223 | - | |
| 224 | 156 | Line line = lineRepository.findOne(sectionRouteLine); |
| 225 | - | |
| 226 | 157 | Section section = repository.findOne(sectionId); |
| 227 | - | |
| 228 | 158 | route.setId(sectionRouteId); |
| 229 | - | |
| 230 | 159 | route.setSectionrouteCode(sectionrouteCode); |
| 231 | - | |
| 232 | 160 | route.setLineCode(lineCode); |
| 233 | - | |
| 234 | 161 | route.setSectionCode(sectionCode); |
| 235 | - | |
| 236 | 162 | route.setDirections(directions); |
| 237 | - | |
| 238 | 163 | route.setVersions(version); |
| 239 | - | |
| 240 | 164 | route.setDestroy(destroy); |
| 241 | - | |
| 242 | 165 | route.setDescriptions(descriptions); |
| 243 | - | |
| 244 | 166 | route.setCreateBy(createBy); |
| 245 | - | |
| 246 | 167 | route.setUpdateBy(updateBy); |
| 247 | - | |
| 248 | 168 | route.setLine(line); |
| 249 | - | |
| 250 | 169 | route.setSection(section); |
| 251 | - | |
| 170 | + route.setIsRoadeSpeed(isRoadeSpeed); | |
| 252 | 171 | routeRepository.save(route); |
| 253 | - | |
| 254 | 172 | resultMap.put("status", ResponseCode.SUCCESS); |
| 255 | - | |
| 256 | 173 | } catch (Exception e) { |
| 257 | - | |
| 258 | 174 | resultMap.put("status", ResponseCode.ERROR); |
| 259 | - | |
| 260 | 175 | logger.error("save erro.", e); |
| 261 | - | |
| 262 | 176 | } |
| 263 | - | |
| 264 | 177 | return resultMap; |
| 265 | 178 | } |
| 266 | 179 | |
| ... | ... | @@ -294,164 +207,105 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 294 | 207 | * @return map<SUCCESS:成功;ERROR:异常> |
| 295 | 208 | */ |
| 296 | 209 | @Override |
| 210 | + @Transactional | |
| 297 | 211 | public Map<String, Object> sectionSave(Map<String, Object> map) { |
| 298 | - | |
| 299 | 212 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 300 | - | |
| 301 | 213 | try { |
| 302 | - | |
| 303 | - /** 线路ID */ | |
| 214 | + // 线路ID. | |
| 304 | 215 | Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); |
| 305 | - | |
| 306 | - /** 线路编码 */ | |
| 216 | + // 线路编码. | |
| 307 | 217 | String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); |
| 308 | - | |
| 218 | + // 路段名称. | |
| 309 | 219 | String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); |
| 310 | - | |
| 220 | + // 路段编码. | |
| 311 | 221 | String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); |
| 312 | - | |
| 222 | + // 道路编码. | |
| 313 | 223 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 314 | - | |
| 224 | + // 原始坐标类型. | |
| 315 | 225 | String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); |
| 316 | - | |
| 226 | + // 路段几何图形坐标. | |
| 317 | 227 | String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); |
| 318 | - | |
| 228 | + // 路段序号 | |
| 319 | 229 | String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); |
| 320 | - | |
| 321 | - Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | |
| 322 | - | |
| 323 | - Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | |
| 324 | - | |
| 325 | - Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | |
| 326 | - | |
| 327 | - Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | |
| 328 | - | |
| 329 | - Integer destroy = map.get("destroy").equals("") ? null : Integer.valueOf(map.get("destroy").toString()); | |
| 330 | - | |
| 331 | - Integer directions = map.get("directions").equals("") ? null : Integer.valueOf(map.get("directions").toString()); | |
| 332 | - | |
| 230 | + // 路段时长. | |
| 231 | + Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString()); | |
| 232 | + // 路段距离. | |
| 233 | + Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString()); | |
| 234 | + // 路段限速. | |
| 235 | + Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString()); | |
| 236 | + // 版本. | |
| 237 | + Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString()); | |
| 238 | + // 是否撤销. | |
| 239 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString()); | |
| 240 | + // 路段方向. | |
| 241 | + Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString()); | |
| 242 | + // 描述与说明. | |
| 333 | 243 | String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); |
| 334 | - | |
| 335 | 244 | // 原始线状图形坐标集合 |
| 336 | 245 | String sectionsBpoints = ""; |
| 337 | - | |
| 338 | 246 | // WGS线状图形坐标集合 |
| 339 | 247 | String sectionsWJPpoints = ""; |
| 340 | - | |
| 341 | 248 | if(!sectionJSON.equals("")) { |
| 342 | - | |
| 343 | 249 | // 转换成JSON数组 |
| 344 | 250 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 345 | - | |
| 346 | 251 | // 遍历 |
| 347 | 252 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 348 | - | |
| 349 | 253 | String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); |
| 350 | - | |
| 351 | 254 | String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); |
| 352 | - | |
| 353 | 255 | String WGSLngStr = ""; |
| 354 | - | |
| 355 | 256 | String WGSLatStr = ""; |
| 356 | - | |
| 357 | 257 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 358 | - | |
| 359 | 258 | WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 360 | - | |
| 361 | 259 | WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 362 | - | |
| 363 | 260 | if(s==0) { |
| 364 | - | |
| 365 | 261 | sectionsBpoints = pointsLngStr + " " + pointsLatStr; |
| 366 | - | |
| 367 | 262 | sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; |
| 368 | - | |
| 369 | 263 | }else { |
| 370 | - | |
| 371 | 264 | sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; |
| 372 | - | |
| 373 | 265 | sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; |
| 374 | - | |
| 375 | 266 | } |
| 376 | - | |
| 377 | 267 | } |
| 378 | - | |
| 379 | 268 | } |
| 380 | - | |
| 381 | 269 | // WGS坐标点集合 |
| 382 | 270 | String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 383 | - | |
| 384 | 271 | // 原坐标点集合 |
| 385 | 272 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 386 | - | |
| 387 | 273 | String crosesRoad=""; |
| 388 | - | |
| 389 | 274 | String endNode =""; |
| 390 | - | |
| 391 | 275 | String startNode=""; |
| 392 | - | |
| 393 | 276 | String middleNode=""; |
| 394 | - | |
| 395 | 277 | String sectionType=""; |
| 396 | - | |
| 397 | 278 | String csectionVector=null; |
| 398 | - | |
| 399 | 279 | Integer id = Integer.valueOf(sectionCode); |
| 400 | - | |
| 401 | 280 | repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); |
| 402 | - | |
| 403 | 281 | Section section = repository.findOne(id); |
| 404 | - | |
| 405 | 282 | Line line = lineRepository.findOne(lineId); |
| 406 | - | |
| 407 | 283 | // 路段路由 |
| 408 | 284 | SectionRoute sectionRoute = new SectionRoute(); |
| 409 | - | |
| 410 | 285 | Integer routeCode = null; |
| 411 | - | |
| 412 | 286 | if(!sectionrouteCode.equals("")){ |
| 413 | - | |
| 414 | 287 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); |
| 415 | - | |
| 416 | 288 | routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; |
| 417 | - | |
| 418 | 289 | }else { |
| 419 | - | |
| 420 | 290 | routeCode = 100; |
| 421 | - | |
| 422 | 291 | } |
| 423 | - | |
| 292 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode); | |
| 424 | 293 | sectionRoute.setSectionrouteCode(routeCode); |
| 425 | - | |
| 426 | 294 | sectionRoute.setLineCode(lineCode); |
| 427 | - | |
| 428 | 295 | sectionRoute.setSection(section); |
| 429 | - | |
| 430 | 296 | sectionRoute.setSectionCode(sectionCode); |
| 431 | - | |
| 432 | 297 | sectionRoute.setDirections(directions); |
| 433 | - | |
| 434 | 298 | sectionRoute.setDescriptions(descriptions); |
| 435 | - | |
| 436 | 299 | sectionRoute.setDestroy(destroy); |
| 437 | - | |
| 438 | 300 | sectionRoute.setVersions(versions); |
| 439 | - | |
| 440 | 301 | sectionRoute.setLine(line); |
| 441 | - | |
| 302 | + sectionRoute.setIsRoadeSpeed(0); | |
| 442 | 303 | routeRepository.save(sectionRoute); |
| 443 | - | |
| 444 | 304 | resultMap.put("status", ResponseCode.SUCCESS); |
| 445 | - | |
| 446 | 305 | } catch (Exception e) { |
| 447 | - | |
| 448 | 306 | resultMap.put("status", ResponseCode.ERROR); |
| 449 | - | |
| 450 | 307 | logger.error("save erro.", e); |
| 451 | - | |
| 452 | 308 | } |
| 453 | - | |
| 454 | 309 | return resultMap; |
| 455 | 310 | } |
| 456 | - | |
| 457 | -} | |
| 311 | +} | |
| 458 | 312 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.entity.Line; |
| 5 | 5 | import com.bsth.entity.Station; |
| 6 | 6 | import com.bsth.entity.StationRoute; |
| 7 | +import com.bsth.entity.search.CustomerSpecs; | |
| 7 | 8 | import com.bsth.repository.LineRepository; |
| 8 | 9 | import com.bsth.repository.SectionRouteRepository; |
| 9 | 10 | import com.bsth.repository.StationRepository; |
| ... | ... | @@ -16,6 +17,8 @@ import com.bsth.util.Geo.Point; |
| 16 | 17 | import com.bsth.util.db.DBUtils_MS; |
| 17 | 18 | import com.google.common.base.Splitter; |
| 18 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | +import org.springframework.data.domain.Sort; | |
| 21 | +import org.springframework.data.domain.Sort.Direction; | |
| 19 | 22 | import org.springframework.stereotype.Service; |
| 20 | 23 | import org.springframework.transaction.annotation.Transactional; |
| 21 | 24 | |
| ... | ... | @@ -56,6 +59,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 56 | 59 | @Autowired |
| 57 | 60 | private StationRepository stationRepository; |
| 58 | 61 | |
| 62 | + @Override | |
| 63 | + public Iterable<StationRoute> list(Map<String, Object> map) { | |
| 64 | + List<Sort.Order> orderList = new ArrayList<>(); | |
| 65 | + orderList.add(new Sort.Order(Direction.ASC, "directions")); | |
| 66 | + orderList.add(new Sort.Order(Direction.ASC, "stationRouteCode")); | |
| 67 | + return repository.findAll(new CustomerSpecs<StationRoute>(map), new Sort(orderList)); | |
| 68 | + } | |
| 69 | + | |
| 59 | 70 | /** |
| 60 | 71 | * @Description :TODO(查询树站点与路段数据) |
| 61 | 72 | * | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -31,6 +31,8 @@ import com.bsth.service.StationService; |
| 31 | 31 | import com.bsth.util.GetUIDAndCode; |
| 32 | 32 | import com.bsth.util.TransGPS; |
| 33 | 33 | import com.bsth.util.TransGPS.Location; |
| 34 | +import com.bsth.util.Geo.GeoUtils; | |
| 35 | +import com.bsth.util.Geo.Point; | |
| 34 | 36 | |
| 35 | 37 | /** |
| 36 | 38 | * |
| ... | ... | @@ -82,62 +84,41 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 82 | 84 | */ |
| 83 | 85 | @Override |
| 84 | 86 | public Map<String, Object> systemSaveStations(Map<String, Object> map) { |
| 85 | - | |
| 86 | 87 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 87 | - | |
| 88 | 88 | try { |
| 89 | - | |
| 90 | 89 | // 站点信息字符传 |
| 91 | 90 | String stationJSON = map.get("stationJSON").toString().equals("") ? "" : map.get("stationJSON").toString(); |
| 92 | - | |
| 93 | 91 | // 路段信息字符串 |
| 94 | 92 | String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString(); |
| 95 | - | |
| 96 | 93 | // 方向 |
| 97 | 94 | int directions = Integer.parseInt(map.get("directions").toString()); |
| 98 | - | |
| 99 | 95 | // 是否撤销 |
| 100 | 96 | int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); |
| 101 | - | |
| 102 | 97 | // 版本 |
| 103 | 98 | int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); |
| 104 | - | |
| 105 | 99 | // 坐标类型 |
| 106 | 100 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 107 | - | |
| 108 | 101 | // 限速 |
| 109 | 102 | String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); |
| 110 | - | |
| 111 | 103 | // 线路ID |
| 112 | 104 | int lineId = map.get("lineId").toString().equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 113 | - | |
| 114 | 105 | // 半径 |
| 115 | 106 | int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); |
| 116 | - | |
| 117 | 107 | // 图形类型 |
| 118 | 108 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 119 | - | |
| 120 | 109 | // 路段距离 |
| 121 | 110 | Double sectionDistance = 0.0d; |
| 122 | - | |
| 123 | 111 | // 路段时长 |
| 124 | 112 | Double sectionDuration = 0.0d; |
| 125 | - | |
| 126 | 113 | // 里程(上或者下) |
| 127 | 114 | double sumUpOrDownMileage = 0.0d; |
| 128 | - | |
| 129 | 115 | // 线路信息 |
| 130 | 116 | Line resultLine = lineRepository.findOne(lineId); |
| 131 | - | |
| 132 | 117 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 133 | - | |
| 134 | 118 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 135 | - | |
| 136 | 119 | if(!stationJSON.equals("")) { |
| 137 | - | |
| 138 | 120 | // 保存站点与站点路由信息 |
| 139 | 121 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 140 | - | |
| 141 | 122 | } |
| 142 | 123 | |
| 143 | 124 | // 路段长度 |
| ... | ... | @@ -259,275 +240,148 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 259 | 240 | * @throws Exception |
| 260 | 241 | */ |
| 261 | 242 | public Map<String, Object> savaStationAndStationRouteInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType, |
| 262 | - | |
| 263 | 243 | int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{ |
| 264 | - | |
| 265 | 244 | Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>(); |
| 266 | - | |
| 267 | 245 | JSONArray stationsArray = JSONArray.parseArray(stationJSON); |
| 268 | - | |
| 269 | 246 | if(stationsArray.size()>0) { |
| 270 | - | |
| 271 | 247 | for(int i = 0;i <stationsArray.size();i++) { |
| 272 | - | |
| 273 | 248 | // 站点名称 |
| 274 | 249 | String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); |
| 275 | - | |
| 276 | 250 | Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); |
| 277 | - | |
| 278 | 251 | // 转成公里 |
| 279 | 252 | distance = distance/1000; |
| 280 | - | |
| 281 | 253 | BigDecimal d = new BigDecimal(distance); |
| 282 | - | |
| 283 | 254 | distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 284 | - | |
| 285 | 255 | sectionDistance= distance + sectionDistance; |
| 286 | - | |
| 287 | 256 | Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); |
| 288 | - | |
| 289 | 257 | // 转成分钟 |
| 290 | 258 | duration = duration/60; |
| 291 | - | |
| 292 | 259 | BigDecimal t = new BigDecimal(duration); |
| 293 | - | |
| 294 | 260 | duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 295 | - | |
| 296 | 261 | sectionDuration = duration + sectionDuration; |
| 297 | - | |
| 298 | 262 | // 百度经纬度坐标 |
| 299 | 263 | String bJwpoints = ""; |
| 300 | - | |
| 301 | 264 | // 百度坐标经度 |
| 302 | 265 | String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); |
| 303 | - | |
| 266 | + bLonx = bLonx==null || bLonx.equals("") ? "0" : bLonx; | |
| 304 | 267 | // 百度坐标纬度 |
| 305 | 268 | String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); |
| 306 | - | |
| 269 | + bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; | |
| 307 | 270 | List<Object[]> stationNameList = repository.findStationName(stationName); |
| 308 | - | |
| 309 | - boolean isHave = isHaveStationname(bJwpoints,stationNameList); | |
| 310 | - | |
| 271 | + Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); | |
| 311 | 272 | // 初始化站点对象 |
| 312 | 273 | Station arg0 = new Station(); |
| 313 | - | |
| 314 | - // 站点编码 | |
| 315 | - long stationCode = 0L; | |
| 316 | - | |
| 317 | - if(isHave) { | |
| 318 | - | |
| 319 | - Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString()); | |
| 320 | - | |
| 274 | + if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) { | |
| 275 | + /*Integer stationId = Integer.parseInt(stationNameList.get(0)[1].toString());*/ | |
| 276 | + Integer stationId = Integer.parseInt(isHaveMap.get("id").toString()); | |
| 321 | 277 | arg0 = repository.findOne(stationId); |
| 322 | - | |
| 323 | 278 | }else { |
| 324 | - | |
| 325 | - stationCode = GetUIDAndCode.getStationId(); | |
| 326 | - | |
| 279 | + // 站点编码 | |
| 280 | + long stationCode = GetUIDAndCode.getStationId(); | |
| 327 | 281 | arg0.setStationCod(String.valueOf(stationCode)); |
| 328 | - | |
| 329 | 282 | arg0.setId((int)stationCode); |
| 330 | - | |
| 331 | 283 | arg0.setStationName(stationName); |
| 332 | - | |
| 333 | 284 | // 原坐标类型 |
| 334 | 285 | arg0.setDbType(dbType); |
| 335 | - | |
| 336 | - | |
| 337 | 286 | String gLonxStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("x").toString(); |
| 338 | - | |
| 339 | 287 | String gLatyStr = JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").equals("") ? null : JSONObject.parseObject(stationsArray.getJSONObject(i).get("wgs").toString()).get("y").toString(); |
| 340 | - | |
| 341 | 288 | float gLonx = 0.0f; |
| 342 | - | |
| 343 | 289 | float gLaty = 0.0f; |
| 344 | - | |
| 345 | 290 | Location resultPoint = null; |
| 346 | - | |
| 347 | 291 | if(baseRes.equals("No")){ |
| 348 | - | |
| 349 | 292 | /** BD to WGS坐标 */ |
| 350 | 293 | resultPoint = FromBDPointToWGSPoint(bLonx,bLatx); |
| 351 | - | |
| 352 | 294 | if(gLonxStr==null) |
| 353 | 295 | gLonx = (float)resultPoint.getLng(); |
| 354 | 296 | else |
| 355 | 297 | gLonx = Float.valueOf(gLonxStr); |
| 356 | - | |
| 357 | 298 | if(gLatyStr==null) |
| 358 | 299 | gLaty = (float)resultPoint.getLat(); |
| 359 | 300 | else |
| 360 | 301 | gLaty = Float.valueOf(gLatyStr); |
| 361 | - | |
| 362 | 302 | arg0.setgLonx(gLonx); |
| 363 | - | |
| 364 | 303 | arg0.setgLaty(gLaty); |
| 365 | - | |
| 366 | 304 | // 百度经纬度 |
| 367 | 305 | bJwpoints = bLonx + " " + bLatx; |
| 368 | - | |
| 369 | 306 | arg0.setbJwpoints(bJwpoints); |
| 370 | - | |
| 371 | 307 | }else if(baseRes.equals("GCJ02")){ |
| 372 | - | |
| 373 | 308 | Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); |
| 374 | - | |
| 375 | 309 | Location location = TransGPS.bd_encrypt(bdLoc); |
| 376 | - | |
| 377 | 310 | String GCJLng = String.valueOf(location.getLng()); |
| 378 | - | |
| 379 | 311 | String GCJLat = String.valueOf(location.getLat()); |
| 380 | - | |
| 381 | 312 | resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat); |
| 382 | - | |
| 383 | 313 | bJwpoints = GCJLng + " " +GCJLat; |
| 384 | - | |
| 385 | 314 | arg0.setgLonx((float)location.getLng()); |
| 386 | - | |
| 387 | 315 | arg0.setgLaty((float)location.getLat()); |
| 388 | - | |
| 389 | 316 | arg0.setbJwpoints(bJwpoints); |
| 390 | - | |
| 391 | - | |
| 392 | 317 | }else if(baseRes.equals("BD09")){ |
| 393 | - | |
| 394 | 318 | resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr); |
| 395 | - | |
| 396 | 319 | bJwpoints = gLonxStr+ " " + gLatyStr; |
| 397 | - | |
| 398 | 320 | arg0.setgLonx((float)resultPoint.getLng()); |
| 399 | - | |
| 400 | 321 | arg0.setgLaty((float)resultPoint.getLat()); |
| 401 | - | |
| 402 | 322 | }else if(baseRes.equals("WGS84")){ |
| 403 | - | |
| 404 | 323 | Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); |
| 405 | - | |
| 406 | 324 | Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc); |
| 407 | - | |
| 408 | 325 | Location bdEn = TransGPS.bd_encrypt(gcjLoc); |
| 409 | - | |
| 410 | 326 | bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat()); |
| 411 | - | |
| 412 | 327 | arg0.setbJwpoints(bJwpoints); |
| 413 | - | |
| 414 | 328 | arg0.setgLonx(Float.valueOf(gLonxStr)); |
| 415 | - | |
| 416 | 329 | arg0.setgLaty(Float.valueOf(gLatyStr)); |
| 417 | - | |
| 418 | 330 | } |
| 419 | - | |
| 420 | - | |
| 421 | - | |
| 422 | - /* if(gLonxStr==null) | |
| 423 | - gLonx = (float)resultPoint.getLng(); | |
| 424 | - else | |
| 425 | - gLonx = Float.valueOf(gLonxStr); | |
| 426 | - | |
| 427 | - if(gLatyStr==null) | |
| 428 | - gLaty = (float)resultPoint.getLat(); | |
| 429 | - else | |
| 430 | - gLaty = Float.valueOf(gLatyStr); | |
| 431 | - | |
| 432 | - arg0.setgLonx(gLonx); | |
| 433 | - | |
| 434 | - arg0.setgLaty(gLaty);*/ | |
| 435 | - | |
| 436 | - // 站点地理位置WGS坐标经度 | |
| 437 | - // String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString(); | |
| 438 | - // arg0.setgLonx(Float.parseFloat(gLonx)); | |
| 439 | - | |
| 440 | - // 站点地理位置WGS坐标纬度 | |
| 441 | - // String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString(); | |
| 442 | - // arg0.setgLaty(Float.parseFloat(gLaty)); | |
| 443 | - | |
| 444 | 331 | arg0.setRadius(radius); |
| 445 | - | |
| 446 | - | |
| 447 | 332 | arg0.setShapesType(shapesType); |
| 448 | - | |
| 449 | 333 | // 是否想撤销 |
| 450 | 334 | arg0.setDestroy(destroy); |
| 451 | - | |
| 452 | 335 | // 版本号 |
| 453 | 336 | arg0.setVersions(versions); |
| 454 | - | |
| 455 | 337 | /*arg0.setbJwpoints(bJwpoints);*/ |
| 456 | - | |
| 457 | 338 | // 插入站点信息 |
| 458 | 339 | repository.save(arg0); |
| 459 | 340 | |
| 460 | 341 | } |
| 461 | - | |
| 462 | 342 | // 站点路由对象 |
| 463 | 343 | StationRoute route = new StationRoute(); |
| 464 | - | |
| 465 | 344 | // 站点名称 |
| 466 | 345 | route.setStationName(stationName); |
| 467 | - | |
| 468 | 346 | route.setDistances(distance); |
| 469 | - | |
| 470 | 347 | sumUpOrDownMileage = sumUpOrDownMileage + distance; |
| 471 | - | |
| 472 | 348 | route.setToTime(duration); |
| 473 | - | |
| 474 | - | |
| 475 | 349 | // 站点编码 |
| 476 | 350 | route.setStationCode(arg0.getStationCod()); |
| 477 | - | |
| 478 | 351 | // 站点序号 |
| 479 | 352 | route.setStationRouteCode((i+1)*100); |
| 480 | - | |
| 481 | 353 | // 站点类型 |
| 482 | 354 | if(i==0) { |
| 483 | - | |
| 484 | 355 | // 起始站 |
| 485 | 356 | route.setStationMark("B"); |
| 486 | - | |
| 487 | 357 | }else if(i==stationsArray.size()-1) { |
| 488 | - | |
| 489 | 358 | // 终点站 |
| 490 | 359 | route.setStationMark("E"); |
| 491 | - | |
| 492 | 360 | }else { |
| 493 | - | |
| 494 | 361 | // 中途站 |
| 495 | 362 | route.setStationMark("Z"); |
| 496 | - | |
| 497 | 363 | } |
| 498 | - | |
| 499 | 364 | // 版本号 |
| 500 | 365 | route.setVersions(versions); |
| 501 | - | |
| 502 | 366 | // 站点ID |
| 503 | 367 | route.setStation(arg0); |
| 504 | - | |
| 505 | 368 | // 方向 |
| 506 | 369 | route.setDirections(directions); |
| 507 | - | |
| 508 | 370 | // 线路ID |
| 509 | 371 | route.setLine(resultLine); |
| 510 | - | |
| 511 | 372 | // 线路编码 |
| 512 | 373 | route.setLineCode(resultLine.getLineCode()); |
| 513 | - | |
| 514 | 374 | route.setDestroy(destroy); |
| 515 | - | |
| 516 | 375 | // 插入站点路由信息 |
| 517 | 376 | routeRepository.save(route); |
| 518 | 377 | |
| 519 | 378 | } |
| 520 | - | |
| 521 | 379 | paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage); |
| 522 | - | |
| 523 | 380 | paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance); |
| 524 | - | |
| 525 | 381 | paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration); |
| 526 | - | |
| 382 | + paramsMeleageAndDistncDura.put("stationdata",stationsArray); | |
| 527 | 383 | } |
| 528 | - | |
| 529 | 384 | return paramsMeleageAndDistncDura; |
| 530 | - | |
| 531 | 385 | } |
| 532 | 386 | |
| 533 | 387 | /** |
| ... | ... | @@ -784,68 +638,52 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 784 | 638 | |
| 785 | 639 | |
| 786 | 640 | Section section = sectionRepository.findOne(sectionid); |
| 787 | - | |
| 788 | 641 | // 路段路由 |
| 789 | 642 | SectionRoute sectionRoute = new SectionRoute(); |
| 790 | - | |
| 791 | 643 | // 路段序号 |
| 792 | 644 | sectionRoute.setSectionrouteCode(100); |
| 793 | - | |
| 794 | 645 | // 线路编码 |
| 795 | 646 | sectionRoute.setLineCode(resultLine.getLineCode()); |
| 796 | - | |
| 797 | 647 | // 路段ID |
| 798 | 648 | sectionRoute.setSection(section); |
| 799 | - | |
| 800 | 649 | sectionRoute.setDestroy(destroy); |
| 801 | - | |
| 802 | 650 | // 线路ID |
| 803 | 651 | sectionRoute.setLine(resultLine); |
| 804 | - | |
| 805 | 652 | // 路段编码 |
| 806 | 653 | sectionRoute.setSectionCode(sectionCode); |
| 807 | - | |
| 808 | 654 | // 版本 |
| 809 | 655 | sectionRoute.setVersions(versions); |
| 810 | - | |
| 811 | 656 | // 方向 |
| 812 | 657 | sectionRoute.setDirections(directions); |
| 813 | - | |
| 814 | 658 | // 路段路由保存 |
| 815 | 659 | sectionRouteRepository.save(sectionRoute); |
| 816 | 660 | |
| 817 | 661 | } |
| 818 | - | |
| 819 | - public boolean isHaveStationname(String bJwpoints,List<Object[]> stationNameList) { | |
| 820 | - | |
| 821 | - boolean temp = true; | |
| 822 | - | |
| 662 | + public Map<String, Object> isHaveStationname(String jd,String wd,List<Object[]> stationNameList) { | |
| 663 | + Map<String, Object> rsM = new HashMap<String ,Object>(); | |
| 664 | + boolean temp = false; | |
| 823 | 665 | if(stationNameList.size()>0) { |
| 824 | - | |
| 825 | - for(int k = 0 ; k <stationNameList.size();k++) { | |
| 826 | - | |
| 827 | - if(bJwpoints.equals(stationNameList.get(k)[0])){ | |
| 828 | - | |
| 829 | - return temp; | |
| 830 | - | |
| 831 | - }else { | |
| 832 | - | |
| 833 | - temp = false; | |
| 834 | - | |
| 666 | + if(jd.equals("0") || wd.equals("0")) { | |
| 667 | + rsM.put("id", stationNameList.get(0)[1]); | |
| 668 | + temp = true; | |
| 669 | + }else{ | |
| 670 | + Point p1 = new Point(Double.parseDouble(jd),Double.parseDouble(wd)); | |
| 671 | + for(int k = 0 ; k <stationNameList.size();k++) { | |
| 672 | + String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); | |
| 673 | + Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); | |
| 674 | + double jl = GeoUtils.getDistance(p1, p2); | |
| 675 | + if(jl<=120d) { | |
| 676 | + rsM.put("id", stationNameList.get(k)[1]); | |
| 677 | + temp = true; | |
| 678 | + break; | |
| 679 | + } | |
| 835 | 680 | } |
| 836 | - | |
| 837 | 681 | } |
| 838 | - | |
| 839 | - }else { | |
| 840 | - | |
| 841 | - temp = false; | |
| 842 | - } | |
| 843 | - | |
| 844 | - return temp; | |
| 682 | + } | |
| 683 | + rsM.put("isHave", temp); | |
| 684 | + return rsM; | |
| 845 | 685 | } |
| 846 | 686 | |
| 847 | - | |
| 848 | - | |
| 849 | 687 | /** |
| 850 | 688 | * @Description :TODO(新增站点保存) |
| 851 | 689 | * |
| ... | ... | @@ -863,246 +701,134 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 863 | 701 | */ |
| 864 | 702 | @Override |
| 865 | 703 | public Map<String, Object> stationSaveMap(Map<String, Object> map) { |
| 866 | - | |
| 867 | 704 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 868 | - | |
| 869 | 705 | try { |
| 870 | - | |
| 871 | 706 | // 站点编码 |
| 872 | 707 | String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString(); |
| 873 | - | |
| 874 | 708 | // 站点ID |
| 875 | 709 | int stationId = Integer.valueOf(stationCod); |
| 876 | - | |
| 877 | 710 | // 站点名称 |
| 878 | 711 | String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); |
| 879 | - | |
| 880 | 712 | // 道路编码 |
| 881 | 713 | String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); |
| 882 | - | |
| 883 | 714 | // 原坐标类型 |
| 884 | 715 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 885 | - | |
| 886 | 716 | // 原坐标点 |
| 887 | 717 | String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); |
| 888 | - | |
| 889 | 718 | String bJwpointsArray[] = null; |
| 890 | - | |
| 891 | 719 | if(bJwpoints!=null) { |
| 892 | - | |
| 893 | 720 | bJwpointsArray = bJwpoints.split(" "); |
| 894 | - | |
| 895 | 721 | } |
| 896 | - | |
| 897 | 722 | // WGS经纬度 |
| 898 | 723 | Float gLonx = null; |
| 899 | - | |
| 900 | 724 | // WGS纬度 |
| 901 | 725 | Float gLaty = null; |
| 902 | - | |
| 903 | 726 | if(bJwpointsArray.length>0) { |
| 904 | - | |
| 905 | 727 | Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); |
| 906 | - | |
| 907 | 728 | gLonx = (float)resultPoint.getLng(); |
| 908 | - | |
| 909 | 729 | gLaty = (float)resultPoint.getLat(); |
| 910 | - | |
| 911 | 730 | } |
| 912 | - | |
| 913 | - /*// WGS经纬度 | |
| 914 | - String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString(); | |
| 915 | - | |
| 916 | - String gJwpointsArray []= null; | |
| 917 | - | |
| 918 | - if(gJwpoints!=null) { | |
| 919 | - | |
| 920 | - gJwpointsArray = gJwpoints.split(" "); | |
| 921 | - | |
| 922 | - }*/ | |
| 923 | - | |
| 924 | 731 | // 方向 |
| 925 | 732 | Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); |
| 926 | - | |
| 927 | 733 | // 距离 |
| 928 | 734 | Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); |
| 929 | - | |
| 930 | 735 | // 时间 |
| 931 | 736 | Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); |
| 932 | - | |
| 933 | - /*// WGS经纬度 | |
| 934 | - Float gLonx = Float.parseFloat(gJwpointsArray[0]); | |
| 935 | - | |
| 936 | - // WGS纬度 | |
| 937 | - Float gLaty = Float.parseFloat(gJwpointsArray[1]);*/ | |
| 938 | - | |
| 939 | 737 | // 城建坐标经度 |
| 940 | 738 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 941 | - | |
| 942 | 739 | // 城建坐标纬度 |
| 943 | 740 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); |
| 944 | - | |
| 945 | - // 多边形WGS坐标点集合 | |
| 946 | - // String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString(); | |
| 947 | - | |
| 948 | 741 | // 多边形原坐标点集合 |
| 949 | 742 | String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); |
| 950 | - | |
| 951 | 743 | // 多边形WGS坐标点集合 |
| 952 | 744 | String gPloygonGrid =""; |
| 953 | - | |
| 954 | 745 | if(!bPloygonGrid.equals("")) { |
| 955 | - | |
| 956 | 746 | String bPloygonGridArray[] = bPloygonGrid.split(","); |
| 957 | - | |
| 958 | 747 | int bLen_ = bPloygonGridArray.length; |
| 959 | - | |
| 960 | 748 | for(int b = 0 ;b<bLen_;b++) { |
| 961 | - | |
| 962 | 749 | String tempArray[]= bPloygonGridArray[b].split(" "); |
| 963 | - | |
| 964 | 750 | Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); |
| 965 | - | |
| 966 | 751 | if(b==0) { |
| 967 | - | |
| 968 | 752 | gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 969 | - | |
| 970 | 753 | }else { |
| 971 | - | |
| 972 | 754 | gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); |
| 973 | - | |
| 974 | 755 | } |
| 975 | - | |
| 976 | 756 | } |
| 977 | - | |
| 978 | 757 | } |
| 979 | - | |
| 980 | - /* bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 981 | - | |
| 982 | - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";*/ | |
| 983 | - | |
| 984 | 758 | // 是否撤销 |
| 985 | 759 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 986 | - | |
| 987 | 760 | // 圆半径 |
| 988 | 761 | Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString()); |
| 989 | - | |
| 990 | 762 | // 图形类型 |
| 991 | 763 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 992 | - | |
| 993 | 764 | // 版本 |
| 994 | 765 | Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString()); |
| 995 | - | |
| 996 | 766 | // 说明 |
| 997 | 767 | String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); |
| 998 | - | |
| 999 | 768 | // 创建人 |
| 1000 | 769 | Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString()); |
| 1001 | - | |
| 1002 | 770 | // 修改人 |
| 1003 | 771 | Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); |
| 1004 | - | |
| 1005 | 772 | // 线路ID |
| 1006 | 773 | int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 1007 | - | |
| 1008 | 774 | // 线路信息 |
| 1009 | 775 | Line resultLine = lineRepository.findOne(line); |
| 1010 | - | |
| 1011 | 776 | // 站点路由序号 |
| 1012 | 777 | String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString(); |
| 1013 | - | |
| 1014 | 778 | // 站点类型 |
| 1015 | 779 | String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); |
| 1016 | - | |
| 1017 | 780 | Integer stationRouteCode = null; |
| 1018 | - | |
| 1019 | 781 | if(stationRouteCodeStr!="") { |
| 1020 | - | |
| 1021 | 782 | String stationRouteCodeArray [] = stationRouteCodeStr.split("_"); |
| 1022 | - | |
| 1023 | 783 | stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1; |
| 1024 | - | |
| 1025 | - | |
| 1026 | 784 | }else { |
| 1027 | - | |
| 1028 | 785 | stationRouteCode = 100; |
| 1029 | - | |
| 1030 | 786 | } |
| 1031 | - | |
| 1032 | 787 | if(bPloygonGrid.equals("")) |
| 1033 | 788 | bPloygonGrid = null; |
| 1034 | 789 | else |
| 1035 | 790 | bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; |
| 1036 | - | |
| 1037 | 791 | if(gPloygonGrid.equals("")) |
| 1038 | 792 | gPloygonGrid = null; |
| 1039 | 793 | else |
| 1040 | 794 | gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; |
| 1041 | - | |
| 1042 | 795 | // 保存站点 |
| 1043 | 796 | repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, |
| 1044 | - | |
| 1045 | 797 | gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, |
| 1046 | - | |
| 1047 | 798 | shapesType, versions, descriptions, createBy, updateBy,stationId); |
| 1048 | - | |
| 1049 | - | |
| 1050 | - | |
| 1051 | - | |
| 1052 | 799 | Station station = repository.findOne(stationId); |
| 1053 | - | |
| 1054 | 800 | StationRoute arg0 = new StationRoute(); |
| 1055 | - | |
| 1056 | 801 | // 线路 |
| 1057 | 802 | arg0.setLine(resultLine); |
| 1058 | - | |
| 1059 | 803 | arg0.setLineCode(resultLine.getLineCode()); |
| 1060 | - | |
| 1061 | 804 | // 站点 |
| 1062 | 805 | arg0.setStation(station); |
| 1063 | - | |
| 1064 | 806 | // 站点路由名称 |
| 1065 | 807 | arg0.setStationName(stationName); |
| 1066 | - | |
| 1067 | 808 | // 站点路由编码 |
| 1068 | 809 | arg0.setStationCode(stationCod); |
| 1069 | - | |
| 1070 | 810 | // 站点路由序号 |
| 1071 | 811 | arg0.setStationRouteCode(stationRouteCode); |
| 1072 | - | |
| 1073 | 812 | // 站点路由类型 |
| 1074 | 813 | arg0.setStationMark(stationMark); |
| 1075 | - | |
| 1076 | 814 | // 站点路由站点方向 |
| 1077 | 815 | arg0.setDirections(directions); |
| 1078 | - | |
| 1079 | 816 | // 站点路由到站距离 |
| 1080 | 817 | arg0.setDistances(distances); |
| 1081 | - | |
| 1082 | 818 | // 站点路由到站时间 |
| 1083 | 819 | arg0.setToTime(toTime); |
| 1084 | - | |
| 1085 | 820 | // 站点版本号 |
| 1086 | 821 | arg0.setVersions(versions); |
| 1087 | - | |
| 1088 | 822 | // 是否撤销 |
| 1089 | 823 | arg0.setDestroy(destroy); |
| 1090 | - | |
| 1091 | 824 | // 站点路由说明 |
| 1092 | 825 | arg0.setDescriptions(descriptions); |
| 1093 | - | |
| 1094 | 826 | routeRepository.save(arg0); |
| 1095 | - | |
| 1096 | 827 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1097 | - | |
| 1098 | 828 | } catch (Exception e) { |
| 1099 | - | |
| 1100 | 829 | resultMap.put("status", ResponseCode.ERROR); |
| 1101 | - | |
| 1102 | 830 | logger.error("save erro.", e); |
| 1103 | - | |
| 1104 | 831 | } |
| 1105 | - | |
| 1106 | 832 | return resultMap; |
| 1107 | 833 | } |
| 1108 | 834 | |
| ... | ... | @@ -1373,101 +1099,64 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1373 | 1099 | |
| 1374 | 1100 | @Override |
| 1375 | 1101 | public Map<String, Object> manualSave(Map<String, Object> map) { |
| 1376 | - | |
| 1377 | 1102 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 1378 | - | |
| 1379 | 1103 | try { |
| 1380 | - | |
| 1381 | 1104 | // 站点信息字符传 |
| 1382 | 1105 | String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); |
| 1383 | - | |
| 1384 | 1106 | // 路段信息字符串 |
| 1385 | 1107 | String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); |
| 1386 | - | |
| 1387 | 1108 | // 方向 |
| 1388 | 1109 | int directions = Integer.parseInt(map.get("directions").toString()); |
| 1389 | - | |
| 1390 | 1110 | // 是否撤销 |
| 1391 | 1111 | int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); |
| 1392 | - | |
| 1393 | 1112 | // 版本 |
| 1394 | 1113 | int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); |
| 1395 | - | |
| 1396 | 1114 | // 坐标类型 |
| 1397 | 1115 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| 1398 | - | |
| 1399 | 1116 | // 限速 |
| 1400 | 1117 | String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); |
| 1401 | - | |
| 1402 | 1118 | // 线路ID |
| 1403 | 1119 | int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 1404 | - | |
| 1405 | 1120 | // 半径 |
| 1406 | 1121 | int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); |
| 1407 | - | |
| 1408 | 1122 | // 图形类型 |
| 1409 | 1123 | String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); |
| 1410 | - | |
| 1411 | 1124 | // 线路信息 |
| 1412 | 1125 | Line resultLine = lineRepository.findOne(lineId); |
| 1413 | - | |
| 1414 | 1126 | // 路段距离 |
| 1415 | 1127 | Double sectionDistance = 0.0d; |
| 1416 | - | |
| 1417 | 1128 | // 路段时长 |
| 1418 | 1129 | Double sectionDuration = 0.0d; |
| 1419 | - | |
| 1420 | 1130 | // 里程(上或者下) |
| 1421 | 1131 | double sumUpOrDownMileage = 0.0d; |
| 1422 | - | |
| 1423 | 1132 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 1424 | - | |
| 1425 | 1133 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 1426 | - | |
| 1427 | 1134 | if(!stationJSON.equals("")) { |
| 1428 | - | |
| 1429 | 1135 | // 保存站点与站点路由信息 |
| 1430 | 1136 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 1431 | - | |
| 1432 | 1137 | } |
| 1433 | - | |
| 1434 | 1138 | // 路段长度 |
| 1435 | 1139 | sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); |
| 1436 | - | |
| 1437 | 1140 | // 路段时长 |
| 1438 | 1141 | sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); |
| 1439 | - | |
| 1440 | 1142 | // 如果路段信息JSON字符串不为空 |
| 1441 | 1143 | if(!sectionJSON.equals("")) { |
| 1442 | - | |
| 1443 | 1144 | manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); |
| 1444 | - | |
| 1445 | 1145 | } |
| 1446 | - | |
| 1447 | 1146 | // 里程 |
| 1448 | 1147 | sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); |
| 1449 | - | |
| 1450 | 1148 | BigDecimal s = new BigDecimal(sumUpOrDownMileage); |
| 1451 | - | |
| 1452 | 1149 | sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| 1453 | - | |
| 1454 | 1150 | // 更新里程 |
| 1455 | 1151 | // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); |
| 1456 | - | |
| 1457 | 1152 | if(directions==0) { |
| 1458 | - | |
| 1459 | 1153 | // lineUpdateStationName(resultLine); |
| 1460 | - | |
| 1461 | 1154 | } |
| 1462 | - | |
| 1463 | 1155 | resultMap.put("status", ResponseCode.SUCCESS); |
| 1464 | - | |
| 1156 | + resultMap.put("stationData", resultSaveMapm.get("stationdata")); | |
| 1465 | 1157 | } catch (Exception e) { |
| 1466 | - | |
| 1467 | 1158 | resultMap.put("status", ResponseCode.ERROR); |
| 1468 | - | |
| 1469 | 1159 | logger.error("save erro.", e); |
| 1470 | - | |
| 1471 | 1160 | } |
| 1472 | 1161 | |
| 1473 | 1162 | return resultMap; |
| ... | ... | @@ -1478,103 +1167,61 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1478 | 1167 | double sectionTime,String dbType,Integer versions,Line resultLine, |
| 1479 | 1168 | |
| 1480 | 1169 | Integer destroy,Integer directions) { |
| 1481 | - | |
| 1482 | 1170 | // 转换成JSON数组 |
| 1483 | 1171 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 1484 | - | |
| 1485 | 1172 | // 遍历 |
| 1486 | 1173 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 1487 | - | |
| 1488 | 1174 | // 站点名称 |
| 1489 | 1175 | String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); |
| 1490 | - | |
| 1491 | 1176 | String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); |
| 1492 | - | |
| 1493 | 1177 | // 原始线状图形坐标集合 |
| 1494 | 1178 | String sectionsBpoints = ""; |
| 1495 | - | |
| 1496 | 1179 | // WGS线状图形坐标集合 |
| 1497 | 1180 | String sectionsWJPpoints = ""; |
| 1498 | - | |
| 1499 | 1181 | if(!pointsStr.equals("")){ |
| 1500 | - | |
| 1501 | 1182 | JSONArray pointsArray = JSONArray.parseArray(pointsStr); |
| 1502 | - | |
| 1503 | 1183 | for(int p =0;p<pointsArray.size();p++){ |
| 1504 | - | |
| 1505 | 1184 | String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString(); |
| 1506 | - | |
| 1507 | 1185 | String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString(); |
| 1508 | - | |
| 1509 | 1186 | Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); |
| 1510 | - | |
| 1511 | 1187 | String WGSLngStr = String.valueOf(resultPoint.getLng()); |
| 1512 | - | |
| 1513 | 1188 | String WGSLatStr = String.valueOf(resultPoint.getLat()); |
| 1514 | - | |
| 1515 | 1189 | if(p==pointsArray.size()-1){ |
| 1516 | - | |
| 1517 | 1190 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; |
| 1518 | - | |
| 1519 | 1191 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; |
| 1520 | - | |
| 1521 | 1192 | // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); |
| 1522 | - | |
| 1523 | 1193 | }else { |
| 1524 | - | |
| 1525 | 1194 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; |
| 1526 | - | |
| 1527 | 1195 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; |
| 1528 | - | |
| 1529 | 1196 | // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; |
| 1530 | - | |
| 1531 | - | |
| 1532 | 1197 | } |
| 1533 | - | |
| 1534 | 1198 | } |
| 1535 | - | |
| 1536 | 1199 | } |
| 1537 | - | |
| 1538 | 1200 | long sectionMaxId = GetUIDAndCode.getSectionId(); |
| 1539 | - | |
| 1540 | 1201 | String sectionCode = String.valueOf(sectionMaxId); |
| 1541 | - | |
| 1542 | 1202 | int sectionId = (int) (sectionMaxId); |
| 1543 | - | |
| 1544 | 1203 | // 交出路 |
| 1545 | 1204 | String crosesRoad = ""; |
| 1546 | - | |
| 1547 | 1205 | // 终止节点 |
| 1548 | 1206 | String endNode = ""; |
| 1549 | - | |
| 1550 | 1207 | // 开始节点 |
| 1551 | 1208 | String startNode = ""; |
| 1552 | - | |
| 1553 | 1209 | // 中间节点 |
| 1554 | 1210 | String middleNode = ""; |
| 1555 | - | |
| 1556 | 1211 | // WGS坐标点集合 |
| 1557 | 1212 | String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 1558 | - | |
| 1559 | 1213 | // 原坐标点集合 |
| 1560 | 1214 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 1561 | - | |
| 1562 | 1215 | // 城建坐标点集合 |
| 1563 | 1216 | String csectionVector = ""; |
| 1564 | - | |
| 1565 | 1217 | // 路段类型 |
| 1566 | 1218 | String sectionType = ""; |
| 1567 | - | |
| 1568 | 1219 | // 道路编码 |
| 1569 | 1220 | String roadCoding = ""; |
| 1570 | - | |
| 1571 | 1221 | // 限速 |
| 1572 | 1222 | double speedLimit = Double.parseDouble(speedLimitStr); |
| 1573 | - | |
| 1574 | 1223 | // 说明 |
| 1575 | 1224 | String descriptions = ""; |
| 1576 | - | |
| 1577 | - | |
| 1578 | 1225 | sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, |
| 1579 | 1226 | |
| 1580 | 1227 | middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, |
| ... | ... | @@ -1582,37 +1229,24 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1582 | 1229 | roadCoding, sectionDistance, sectionTime, dbType, speedLimit, |
| 1583 | 1230 | |
| 1584 | 1231 | descriptions, versions,sectionId); |
| 1585 | - | |
| 1586 | - | |
| 1587 | - | |
| 1588 | 1232 | Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); |
| 1589 | - | |
| 1590 | 1233 | // 路段路由 |
| 1591 | 1234 | SectionRoute sectionRoute = new SectionRoute(); |
| 1592 | - | |
| 1593 | 1235 | // 路段序号 |
| 1594 | 1236 | sectionRoute.setSectionrouteCode((s+1)*100); |
| 1595 | - | |
| 1596 | 1237 | // 线路编码 |
| 1597 | 1238 | sectionRoute.setLineCode(resultLine.getLineCode()); |
| 1598 | - | |
| 1599 | 1239 | // 路段ID |
| 1600 | 1240 | sectionRoute.setSection(section); |
| 1601 | - | |
| 1602 | 1241 | // 线路ID |
| 1603 | 1242 | sectionRoute.setLine(resultLine); |
| 1604 | - | |
| 1605 | 1243 | // 路段编码 |
| 1606 | 1244 | sectionRoute.setSectionCode(sectionCode); |
| 1607 | - | |
| 1608 | 1245 | // 版本 |
| 1609 | 1246 | sectionRoute.setVersions(versions); |
| 1610 | - | |
| 1611 | 1247 | sectionRoute.setDestroy(destroy); |
| 1612 | - | |
| 1613 | 1248 | // 方向 |
| 1614 | 1249 | sectionRoute.setDirections(directions); |
| 1615 | - | |
| 1616 | 1250 | sectionRouteRepository.save(sectionRoute); |
| 1617 | 1251 | } |
| 1618 | 1252 | ... | ... |
src/main/java/com/bsth/util/GetUIDAndCode.java
| ... | ... | @@ -26,80 +26,47 @@ import com.bsth.repository.StationRepository; |
| 26 | 26 | */ |
| 27 | 27 | @Component |
| 28 | 28 | public class GetUIDAndCode { |
| 29 | - | |
| 30 | 29 | @Autowired |
| 31 | 30 | private LineRepository lineRepository; |
| 32 | - | |
| 33 | 31 | @Autowired |
| 34 | 32 | private StationRepository stationRepository; |
| 35 | - | |
| 36 | 33 | @Autowired |
| 37 | 34 | private SectionRepository sectionRepository; |
| 38 | - | |
| 39 | 35 | @Autowired |
| 40 | 36 | private CarParkRepository carParkRepository; |
| 41 | - | |
| 42 | 37 | /** 线路ID */ |
| 43 | 38 | private static long lineId = 0L; |
| 44 | - | |
| 45 | 39 | /** 站点ID */ |
| 46 | 40 | private static long stationId = 0L; |
| 47 | - | |
| 48 | 41 | /** 路段ID */ |
| 49 | 42 | private static long sectionId = 0L; |
| 50 | - | |
| 51 | 43 | /** 停车长ID*/ |
| 52 | 44 | private static long carParkId = 0L; |
| 53 | - | |
| 54 | 45 | public GetUIDAndCode() { |
| 55 | - | |
| 56 | 46 | new Timer().schedule(new TimerTask() { |
| 57 | - | |
| 58 | 47 | @Override |
| 59 | 48 | public void run() { |
| 60 | - | |
| 61 | 49 | lineId = lineRepository.selectMaxIdToLineCode(); |
| 62 | - | |
| 63 | 50 | stationId = stationRepository.stationMaxId(); |
| 64 | - | |
| 65 | 51 | sectionId = sectionRepository.sectionMaxId(); |
| 66 | - | |
| 67 | 52 | carParkId = carParkRepository.carParkMaxId(); |
| 68 | - | |
| 69 | 53 | } |
| 70 | 54 | }, 1000 * 30); |
| 71 | - | |
| 72 | 55 | } |
| 73 | - | |
| 74 | 56 | public static synchronized long getLineId() { |
| 75 | - | |
| 76 | 57 | ++lineId; |
| 77 | - | |
| 78 | 58 | return lineId; |
| 79 | - | |
| 80 | 59 | } |
| 81 | - | |
| 82 | 60 | public static synchronized long getStationId() { |
| 83 | - | |
| 84 | 61 | ++stationId; |
| 85 | - | |
| 86 | 62 | return stationId; |
| 87 | 63 | } |
| 88 | - | |
| 89 | 64 | public static synchronized long getSectionId() { |
| 90 | - | |
| 91 | 65 | ++sectionId; |
| 92 | - | |
| 93 | 66 | return sectionId; |
| 94 | - | |
| 95 | 67 | } |
| 96 | - | |
| 97 | 68 | public static synchronized long getCarParkId() { |
| 98 | - | |
| 99 | 69 | ++carParkId; |
| 100 | - | |
| 101 | 70 | return carParkId; |
| 102 | - | |
| 103 | 71 | } |
| 104 | - | |
| 105 | -} | |
| 72 | +} | |
| 106 | 73 | \ No newline at end of file | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -68,13 +68,20 @@ |
| 68 | 68 | <!-- handsontable样式 --> |
| 69 | 69 | <link rel="stylesheet" |
| 70 | 70 | href="/assets/bower_components/handsontable/dist/handsontable.full.css" /> |
| 71 | -<!-- sweetalert样式 --> | |
| 72 | -<link rel="stylesheet" | |
| 73 | - href="/assets/bower_components/sweetalert/dist/sweetalert.css" /> | |
| 74 | 71 | <!-- schedule计划调度AngularJS模块主css --> |
| 75 | 72 | <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" |
| 76 | 73 | type="text/css" /> |
| 77 | 74 | |
| 75 | +<!-- CSS动画 --> | |
| 76 | +<link | |
| 77 | + href="/metronic_v4.5.4/plugins/tipso/css/animate.css" | |
| 78 | + rel="stylesheet" type="text/css" /> | |
| 79 | + | |
| 80 | +<!-- 提示工具样式 --> | |
| 81 | +<link | |
| 82 | + href="/metronic_v4.5.4/plugins/tipso/css/tipso.css" | |
| 83 | + rel="stylesheet" type="text/css" /> | |
| 84 | + | |
| 78 | 85 | <style type="text/css"> |
| 79 | 86 | .searchForm { |
| 80 | 87 | |
| ... | ... | @@ -388,10 +395,11 @@ tr.row-active td { |
| 388 | 395 | <script src="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script> |
| 389 | 396 | <!-- 统计图控件 --> |
| 390 | 397 | <!--<script src="/assets/global/getEchart.js"></script> |
| 391 | -<script src="/assets/global/echarts.js"></script> --> | |
| 398 | + <script src="/assets/global/echarts.js"></script> --> | |
| 392 | 399 | <script src="/assets/js/common.js"></script> |
| 393 | 400 | <script src="/assets/js/dictionary.js"></script> |
| 394 | - | |
| 401 | + <!-- tipso JS --> | |
| 402 | + <script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | |
| 395 | 403 | <script data-exclude=1> |
| 396 | 404 | //初始打开的片段地址 |
| 397 | 405 | var initFragment = "^_^initFragment^_^"; |
| ... | ... | @@ -538,7 +546,7 @@ tr.row-active td { |
| 538 | 546 | <script src="/assets/js/d3.min.js" data-exclude=1></script> |
| 539 | 547 | <!-- webSocket JS --> |
| 540 | 548 | <script src="/assets/js/sockjs.min.js"></script> |
| 541 | - | |
| 549 | + | |
| 542 | 550 | <!-- TODO:angularJS相关库 --> |
| 543 | 551 | |
| 544 | 552 | <!-- angularJS相关库 --> |
| ... | ... | @@ -567,9 +575,6 @@ tr.row-active td { |
| 567 | 575 | src="/assets/bower_components/handsontable/dist/handsontable.full.js"></script> |
| 568 | 576 | <script |
| 569 | 577 | src="/assets/bower_components/ngHandsontable/dist/ngHandsontable.js"></script> |
| 570 | - <!-- sweetalert相关js --> | |
| 571 | - <script src="/assets/bower_components/sweetalert/dist/sweetalert.min.js"></script> | |
| 572 | - <script src="/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js"></script> | |
| 573 | 578 | |
| 574 | 579 | <!-- schedule计划调度AngularJS模块主JS --> |
| 575 | 580 | <script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script> | ... | ... |