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