Commit 93bddee325b6461db38b177bb02f00e157ceaa2b
1 parent
b5436d64
Signed-off-by: yrf123456 <463058651@qq.com>
Showing
31 changed files
with
3125 additions
and
47 deletions
src/main/java/com/bsth/controller/SectionController.java
| @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 60 | * | 60 | * |
| 61 | * @return Map<String, Object> <SUCCESS ; ERROR> | 61 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 62 | */ | 62 | */ |
| 63 | + @RequestMapping(value="sectionCut" , method = RequestMethod.POST) | ||
| 64 | + public Map<String, Object> sectionCut(@RequestParam Map<String, Object> map) { | ||
| 65 | + | ||
| 66 | + map.put("updateBy", ""); | ||
| 67 | + | ||
| 68 | + map.put("createBy", ""); | ||
| 69 | + | ||
| 70 | + map.put("createDate", ""); | ||
| 71 | + | ||
| 72 | + return service.sectionCut(map); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(编辑线路走向) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 63 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | 83 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) |
| 64 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | 84 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { |
| 65 | 85 | ||
| @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 74 | } | 94 | } |
| 75 | 95 | ||
| 76 | /** | 96 | /** |
| 97 | + * @Description :TODO(编辑缓存线路走向) | ||
| 98 | + */ | ||
| 99 | + @RequestMapping(value="sectionCacheUpdate" , method = RequestMethod.POST) | ||
| 100 | + public Map<String, Object> sectionCacheUpdate(@RequestParam Map<String, Object> map) { | ||
| 101 | + | ||
| 102 | + map.put("updateBy", ""); | ||
| 103 | + | ||
| 104 | + map.put("createBy", ""); | ||
| 105 | + | ||
| 106 | + map.put("createDate", ""); | ||
| 107 | + | ||
| 108 | + return service.sectionCacheUpdate(map); | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 77 | * @Description :TODO(查询路段编码) | 113 | * @Description :TODO(查询路段编码) |
| 78 | * | 114 | * |
| 79 | * @return int <sectionCode路段编码> | 115 | * @return int <sectionCode路段编码> |
src/main/java/com/bsth/controller/SectionRouteController.java
| @@ -70,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -70,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | + * @Description :TODO(查询路段信息) | ||
| 74 | + * | ||
| 75 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 76 | + * | ||
| 77 | + * @return Map<String, Object> | ||
| 78 | + */ | ||
| 79 | + @RequestMapping(value = "/findSectionCache" , method = RequestMethod.GET) | ||
| 80 | + public List<Map<String, Object>> findPointsCache(@RequestParam Map<String, Object> map) { | ||
| 81 | + return routeService.getSectionRouteCache(map); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 73 | * @Description : TODO(根据路段路由Id查询详情) | 85 | * @Description : TODO(根据路段路由Id查询详情) |
| 74 | * | 86 | * |
| 75 | * @param map <id:路段路由ID> | 87 | * @param map <id:路段路由ID> |
src/main/java/com/bsth/controller/StationController.java
| @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | ||
| 11 | +import antlr.collections.List; | ||
| 12 | + | ||
| 11 | import com.bsth.entity.Station; | 13 | import com.bsth.entity.Station; |
| 12 | import com.bsth.service.StationService; | 14 | import com.bsth.service.StationService; |
| 13 | import com.bsth.util.GetUIDAndCode; | 15 | import com.bsth.util.GetUIDAndCode; |
| @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 36 | private StationService service; | 38 | private StationService service; |
| 37 | 39 | ||
| 38 | /** | 40 | /** |
| 41 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 42 | + * | ||
| 43 | + * @param map: <point:坐标点; name:站点名> | ||
| 44 | + * | ||
| 45 | + */ | ||
| 46 | + @RequestMapping(value="matchStation" , method = RequestMethod.GET) | ||
| 47 | + public Map<String, Object> matchStation(@RequestParam Map<String, Object> map) { | ||
| 48 | + return service.matchStation(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 39 | * @Description :TODO(系统规划保存数据) | 52 | * @Description :TODO(系统规划保存数据) |
| 40 | * | 53 | * |
| 41 | * @param map <stationJSON:站点信息; | 54 | * @param map <stationJSON:站点信息; |
| @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 68 | return service.manualSave(map); | 81 | return service.manualSave(map); |
| 69 | } | 82 | } |
| 70 | 83 | ||
| 84 | + @RequestMapping(value="cacheSave" , method = RequestMethod.POST) | ||
| 85 | + public Map<String, Object> cacheSave(@RequestParam Map<String, Object> map) { | ||
| 86 | + return service.cacheSave(map); | ||
| 87 | + } | ||
| 88 | + | ||
| 71 | /** | 89 | /** |
| 72 | * @Description :TODO(新增站点保存) | 90 | * @Description :TODO(新增站点保存) |
| 73 | * | 91 | * |
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -99,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -99,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | /** | 101 | /** |
| 102 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 103 | + * | ||
| 104 | + * @param map <lineId:线路ID; direction:方向> | ||
| 105 | + * | ||
| 106 | + * @return List<Map<String, Object>> | ||
| 107 | + */ | ||
| 108 | + @RequestMapping(value = "/getStationRouteCacheCenterPoints" , method = RequestMethod.GET) | ||
| 109 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(@RequestParam Map<String, Object> map) { | ||
| 110 | + return service.getStationRouteCacheCenterPoints(map); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 102 | * @Description :TODO(撤销站点) | 114 | * @Description :TODO(撤销站点) |
| 103 | * | 115 | * |
| 104 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | 116 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> |
src/main/java/com/bsth/entity/SectionRouteCache.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Column; | ||
| 6 | +import javax.persistence.Entity; | ||
| 7 | +import javax.persistence.GeneratedValue; | ||
| 8 | +import javax.persistence.GenerationType; | ||
| 9 | +import javax.persistence.Id; | ||
| 10 | +import javax.persistence.ManyToOne; | ||
| 11 | +import javax.persistence.OneToOne; | ||
| 12 | +import javax.persistence.Table; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * @ClassName : SectionRoute(路段路由缓存实体类) | ||
| 18 | + * | ||
| 19 | + * @Author : bsth@lq | ||
| 20 | + * | ||
| 21 | + * @Description : TODO(路段路由) | ||
| 22 | + * | ||
| 23 | + * @Data :2016-04-21 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@Entity | ||
| 30 | +@Table(name = "bsth_c_sectionroute_cache") | ||
| 31 | +public class SectionRouteCache { | ||
| 32 | + | ||
| 33 | + @Id | ||
| 34 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 35 | + private Integer id; | ||
| 36 | + | ||
| 37 | + // 路段路由序号 | ||
| 38 | + private Integer sectionrouteCode; | ||
| 39 | + | ||
| 40 | + // 线路编号 | ||
| 41 | + private String lineCode; | ||
| 42 | + | ||
| 43 | + // 路段编号 | ||
| 44 | + private String sectionCode; | ||
| 45 | + | ||
| 46 | + // 路段路由方向 | ||
| 47 | + private Integer directions; | ||
| 48 | + | ||
| 49 | + // 版本号 | ||
| 50 | + private Integer versions; | ||
| 51 | + | ||
| 52 | + // 是否撤销 | ||
| 53 | + private Integer destroy; | ||
| 54 | + | ||
| 55 | + /** 是否有路段限速数据 <0:分段;1:未分段>*/ | ||
| 56 | + private Integer isRoadeSpeed; | ||
| 57 | + | ||
| 58 | + // 描述 | ||
| 59 | + private String descriptions; | ||
| 60 | + | ||
| 61 | + // 创建人 | ||
| 62 | + private Integer createBy; | ||
| 63 | + | ||
| 64 | + // 修改人 | ||
| 65 | + private Integer updateBy; | ||
| 66 | + | ||
| 67 | + // 创建日期 | ||
| 68 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 69 | + private Date createDate; | ||
| 70 | + | ||
| 71 | + // 修改日期 | ||
| 72 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 73 | + private Date updateDate; | ||
| 74 | + | ||
| 75 | + // 路段信息 | ||
| 76 | + @OneToOne | ||
| 77 | + private Section section; | ||
| 78 | + | ||
| 79 | + // 线路信息 | ||
| 80 | + @ManyToOne | ||
| 81 | + private Line line; | ||
| 82 | + | ||
| 83 | + public Integer getIsRoadeSpeed() { | ||
| 84 | + return isRoadeSpeed; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setIsRoadeSpeed(Integer isRoadeSpeed) { | ||
| 88 | + this.isRoadeSpeed = isRoadeSpeed; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Integer getId() { | ||
| 92 | + return id; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setId(Integer id) { | ||
| 96 | + this.id = id; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public Integer getSectionrouteCode() { | ||
| 100 | + return sectionrouteCode; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setSectionrouteCode(Integer sectionrouteCode) { | ||
| 104 | + this.sectionrouteCode = sectionrouteCode; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getLineCode() { | ||
| 108 | + return lineCode; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public void setLineCode(String lineCode) { | ||
| 112 | + this.lineCode = lineCode; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public String getSectionCode() { | ||
| 116 | + return sectionCode; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void setSectionCode(String sectionCode) { | ||
| 120 | + this.sectionCode = sectionCode; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Integer getDirections() { | ||
| 124 | + return directions; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public void setDirections(Integer directions) { | ||
| 128 | + this.directions = directions; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public Integer getVersions() { | ||
| 132 | + return versions; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setVersions(Integer versions) { | ||
| 136 | + this.versions = versions; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public Integer getDestroy() { | ||
| 140 | + return destroy; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public void setDestroy(Integer destroy) { | ||
| 144 | + this.destroy = destroy; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public String getDescriptions() { | ||
| 148 | + return descriptions; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setDescriptions(String descriptions) { | ||
| 152 | + this.descriptions = descriptions; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public Integer getCreateBy() { | ||
| 156 | + return createBy; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setCreateBy(Integer createBy) { | ||
| 160 | + this.createBy = createBy; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public Integer getUpdateBy() { | ||
| 164 | + return updateBy; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public void setUpdateBy(Integer updateBy) { | ||
| 168 | + this.updateBy = updateBy; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public Date getCreateDate() { | ||
| 172 | + return createDate; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public void setCreateDate(Date createDate) { | ||
| 176 | + this.createDate = createDate; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public Date getUpdateDate() { | ||
| 180 | + return updateDate; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public void setUpdateDate(Date updateDate) { | ||
| 184 | + this.updateDate = updateDate; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public Section getSection() { | ||
| 188 | + return section; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public void setSection(Section section) { | ||
| 192 | + this.section = section; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public Line getLine() { | ||
| 196 | + return line; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public void setLine(Line line) { | ||
| 200 | + this.line = line; | ||
| 201 | + } | ||
| 202 | +} |
src/main/java/com/bsth/entity/StationRouteCache.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import javax.persistence.*; | ||
| 4 | + | ||
| 5 | +import java.util.Date; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + * @ClassName : StationRouteCache(站点路由缓存实体类) | ||
| 10 | + * | ||
| 11 | + * @Author : bsth@lq | ||
| 12 | + * | ||
| 13 | + * @Description : TODO(站点路由) | ||
| 14 | + * | ||
| 15 | + * @Data :2016-04-19 | ||
| 16 | + * | ||
| 17 | + * @Version 公交调度系统BS版 0.1 | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +@Entity | ||
| 22 | +@Table(name = "bsth_c_stationroute_cache") | ||
| 23 | +@NamedEntityGraphs({ | ||
| 24 | + @NamedEntityGraph(name = "stationRoute_station_cache", attributeNodes = { | ||
| 25 | + @NamedAttributeNode("station"), | ||
| 26 | + @NamedAttributeNode("line") | ||
| 27 | + }) | ||
| 28 | +}) | ||
| 29 | +public class StationRouteCache { | ||
| 30 | + | ||
| 31 | + //站点路由ID | ||
| 32 | + @Id | ||
| 33 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 34 | + private Integer id; | ||
| 35 | + | ||
| 36 | + // 站点路由序号 | ||
| 37 | + private Integer stationRouteCode; | ||
| 38 | + | ||
| 39 | + // 站点编码 | ||
| 40 | + private String stationCode; | ||
| 41 | + | ||
| 42 | + // 站点名称 | ||
| 43 | + private String stationName; | ||
| 44 | + | ||
| 45 | + // 线路编码 | ||
| 46 | + private String lineCode; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 站点类型 | ||
| 50 | + * | ||
| 51 | + * ------ B:起点站 | ||
| 52 | + * | ||
| 53 | + * ------ Z:中途站 | ||
| 54 | + * | ||
| 55 | + * ------ E:终点站 | ||
| 56 | + * | ||
| 57 | + * ------ T:停车场 | ||
| 58 | + * | ||
| 59 | + */ | ||
| 60 | + private String stationMark; | ||
| 61 | + | ||
| 62 | + // 站点路由出站序号 | ||
| 63 | + private Integer outStationNmber; | ||
| 64 | + | ||
| 65 | + // 站点路由到站距离 | ||
| 66 | + private Double distances; | ||
| 67 | + | ||
| 68 | + // 站点路由到站时间 | ||
| 69 | + private Double toTime; | ||
| 70 | + | ||
| 71 | + // 首班时间 | ||
| 72 | + private String firstTime; | ||
| 73 | + | ||
| 74 | + // 末班时间 | ||
| 75 | + private String endTime; | ||
| 76 | + | ||
| 77 | + // 站点路由方向 | ||
| 78 | + private Integer directions; | ||
| 79 | + | ||
| 80 | + // 版本号 | ||
| 81 | + private Integer versions; | ||
| 82 | + | ||
| 83 | + // 是否撤销 | ||
| 84 | + private Integer destroy; | ||
| 85 | + | ||
| 86 | + // 描述 | ||
| 87 | + private String descriptions; | ||
| 88 | + | ||
| 89 | + // 创建人 | ||
| 90 | + private Integer createBy; | ||
| 91 | + | ||
| 92 | + // 修改人 | ||
| 93 | + private Integer updateBy; | ||
| 94 | + | ||
| 95 | + // 创建日期 | ||
| 96 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 97 | + private Date createDate; | ||
| 98 | + | ||
| 99 | + // 修改日期 | ||
| 100 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 101 | + private Date updateDate; | ||
| 102 | + | ||
| 103 | + // 站点信息 | ||
| 104 | + @ManyToOne(fetch = FetchType.LAZY) | ||
| 105 | + private Station station; | ||
| 106 | + | ||
| 107 | + // 线路信息 | ||
| 108 | + @ManyToOne | ||
| 109 | + private Line line; | ||
| 110 | + | ||
| 111 | + public Integer getId() { | ||
| 112 | + return id; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public void setId(Integer id) { | ||
| 116 | + this.id = id; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public Integer getStationRouteCode() { | ||
| 120 | + return stationRouteCode; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setStationRouteCode(Integer stationRouteCode) { | ||
| 124 | + this.stationRouteCode = stationRouteCode; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public String getStationCode() { | ||
| 128 | + return stationCode; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setStationCode(String stationCode) { | ||
| 132 | + this.stationCode = stationCode; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public String getStationName() { | ||
| 136 | + return stationName; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setStationName(String stationName) { | ||
| 140 | + this.stationName = stationName; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getLineCode() { | ||
| 144 | + return lineCode; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setLineCode(String lineCode) { | ||
| 148 | + this.lineCode = lineCode; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public String getStationMark() { | ||
| 152 | + return stationMark; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setStationMark(String stationMark) { | ||
| 156 | + this.stationMark = stationMark; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public Integer getOutStationNmber() { | ||
| 160 | + return outStationNmber; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setOutStationNmber(Integer outStationNmber) { | ||
| 164 | + this.outStationNmber = outStationNmber; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + public Double getDistances() { | ||
| 168 | + return distances; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public void setDistances(Double distances) { | ||
| 172 | + this.distances = distances; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + public Double getToTime() { | ||
| 176 | + return toTime; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setToTime(Double toTime) { | ||
| 180 | + this.toTime = toTime; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public String getFirstTime() { | ||
| 184 | + return firstTime; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setFirstTime(String firstTime) { | ||
| 188 | + this.firstTime = firstTime; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public String getEndTime() { | ||
| 192 | + return endTime; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public void setEndTime(String endTime) { | ||
| 196 | + this.endTime = endTime; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + public Integer getDirections() { | ||
| 200 | + return directions; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + public void setDirections(Integer directions) { | ||
| 204 | + this.directions = directions; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + public Integer getVersions() { | ||
| 208 | + return versions; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public void setVersions(Integer versions) { | ||
| 212 | + this.versions = versions; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + public Integer getDestroy() { | ||
| 216 | + return destroy; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + public void setDestroy(Integer destroy) { | ||
| 220 | + this.destroy = destroy; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + public String getDescriptions() { | ||
| 224 | + return descriptions; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + public void setDescriptions(String descriptions) { | ||
| 228 | + this.descriptions = descriptions; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public Integer getCreateBy() { | ||
| 232 | + return createBy; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + public void setCreateBy(Integer createBy) { | ||
| 236 | + this.createBy = createBy; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public Integer getUpdateBy() { | ||
| 240 | + return updateBy; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public void setUpdateBy(Integer updateBy) { | ||
| 244 | + this.updateBy = updateBy; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public Date getCreateDate() { | ||
| 248 | + return createDate; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + public void setCreateDate(Date createDate) { | ||
| 252 | + this.createDate = createDate; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + public Date getUpdateDate() { | ||
| 256 | + return updateDate; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + public void setUpdateDate(Date updateDate) { | ||
| 260 | + this.updateDate = updateDate; | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + public Station getStation() { | ||
| 264 | + return station; | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + public void setStation(Station station) { | ||
| 268 | + this.station = station; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + public Line getLine() { | ||
| 272 | + return line; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + public void setLine(Line line) { | ||
| 276 | + this.line = line; | ||
| 277 | + } | ||
| 278 | +} | ||
| 0 | \ No newline at end of file | 279 | \ No newline at end of file |
src/main/java/com/bsth/repository/SectionRouteCacheRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import com.bsth.entity.SectionRoute; | ||
| 11 | +import com.bsth.entity.SectionRouteCache; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * | ||
| 15 | + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口) | ||
| 16 | + * | ||
| 17 | + * @Extends : BaseRepository | ||
| 18 | + * | ||
| 19 | + * @Description: TODO(路段路由Repository数据持久层接口) | ||
| 20 | + * | ||
| 21 | + * @Author bsth@lq | ||
| 22 | + * | ||
| 23 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@Repository | ||
| 30 | +public interface SectionRouteCacheRepository extends BaseRepository<SectionRouteCache, Integer> { | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * @Description :TODO(查询路段信息) | ||
| 34 | + * | ||
| 35 | + * @param map <lineId:线路ID; directions:方向> | ||
| 36 | + * | ||
| 37 | + * @return List<Object[]> | ||
| 38 | + */ | ||
| 39 | + @Query(value ="SELECT a.sectionrouteId," + | ||
| 40 | + "a.sectionrouteLine," + | ||
| 41 | + " a.sectionrouteLineCode," + | ||
| 42 | + " a.sectionrouteSection," + | ||
| 43 | + " a.sectionrouteSectionCode," + | ||
| 44 | + " a.sectionrouteCode," + | ||
| 45 | + " a.sectionrouteDirections," + | ||
| 46 | + " b.id AS sectionId," + | ||
| 47 | + " b.section_code AS sectionCode," + | ||
| 48 | + " b.section_name AS sectionName," + | ||
| 49 | + " b.croses_road AS sectionRoad," + | ||
| 50 | + " b.end_node AS sectionEndNode," + | ||
| 51 | + " b.start_node AS sectionStartNode," + | ||
| 52 | + " b.middle_node AS sectionMiddleNode," + | ||
| 53 | + " b.section_type AS sectionType," + | ||
| 54 | + " b.csection_vector AS sectionCsectionVector," + | ||
| 55 | + " ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | ||
| 56 | + " ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | ||
| 57 | + " b.road_coding AS sectionRoadCoding," + | ||
| 58 | + " b.section_distance AS sectionDistance," + | ||
| 59 | + " b.section_time AS sectionTime," + | ||
| 60 | + " b.db_type AS sectiondbType," + | ||
| 61 | + " b.speed_limit AS sectionSpeedLimet ,a.destroy,a.versions,a.descriptions,a.isRoadeSpeed FROM (" + | ||
| 62 | + "SELECT r.id AS sectionrouteId," + | ||
| 63 | + "r.line AS sectionrouteLine," + | ||
| 64 | + "r.line_code AS sectionrouteLineCode," + | ||
| 65 | + "r.section AS sectionrouteSection," + | ||
| 66 | + "r.section_code AS sectionrouteSectionCode," + | ||
| 67 | + "r.sectionroute_code AS sectionrouteCode," + | ||
| 68 | + "r.directions AS sectionrouteDirections," + | ||
| 69 | + "r.destroy AS destroy," + | ||
| 70 | + "r.versions AS versions," + | ||
| 71 | + "r.descriptions AS descriptions, r.is_roade_speed AS isRoadeSpeed" + | ||
| 72 | + " FROM bsth_c_sectionroute_cache r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + | ||
| 73 | + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | ||
| 74 | + List<Object[]> getSectionRouteCache(int lineId, int directions); | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * @Description :TODO(查询路段信息) | ||
| 79 | + * | ||
| 80 | + * @param map <id:路段路由ID> | ||
| 81 | + * | ||
| 82 | + * @return List<Object[]> | ||
| 83 | + */ | ||
| 84 | + @Query(value ="SELECT a.sectionRouteId," + | ||
| 85 | + "a.sectionRouteLineCode," + | ||
| 86 | + "a.sectionRouteCode," + | ||
| 87 | + "a.sectionRouteDirections," + | ||
| 88 | + "a.sectionRouteLine," + | ||
| 89 | + "a.sectionRouteSection," + | ||
| 90 | + "a.sectionRouteDescriptions," + | ||
| 91 | + "a.sectionRouteCreateBy," + | ||
| 92 | + "a.sectionRouteCreateDate," + | ||
| 93 | + "a.sectionRouteUpdateBy," + | ||
| 94 | + "a.sectionRouteUpdateDate," + | ||
| 95 | + "a.sectionRouteVersions," + | ||
| 96 | + "a.sectionRouteDestroy," + | ||
| 97 | + "b.id AS sectionId," + | ||
| 98 | + "b.section_code AS sectionCode," + | ||
| 99 | + "b.section_name AS sectionName," + | ||
| 100 | + "b.road_coding AS sectionRoadCoding," + | ||
| 101 | + "b.end_node AS sectionEndCode," + | ||
| 102 | + "b.start_node AS sectionStartNode," + | ||
| 103 | + "b.middle_node AS sectionMiddleNode," + | ||
| 104 | + "b.section_type AS sectionType," + | ||
| 105 | + "ST_AsText(b.csection_vector) AS sectionCsectionVector," + | ||
| 106 | + "ST_AsText(b.bsection_vector) AS sectionBsectionVector," + | ||
| 107 | + "ST_AsText(b.gsection_vector) AS sectionGsectionVector," + | ||
| 108 | + "b.section_distance AS sectionDistance," + | ||
| 109 | + "b.section_time AS sectionTime," + | ||
| 110 | + "b.db_type AS sectionDbtype," + | ||
| 111 | + "b.speed_limit AS sectionSpeedLimit," + | ||
| 112 | + "b.descriptions AS sectionDescriptions," + | ||
| 113 | + "b.create_by AS sectionCreateBy," + | ||
| 114 | + "b.create_date AS sectionCreateDate," + | ||
| 115 | + "b.update_by AS sectionUpdateBy," + | ||
| 116 | + "b.update_date AS sectionUpdateDate," + | ||
| 117 | + "b.versions AS sectionVersion , a.isRoadeSpeed FROM (" + | ||
| 118 | + " SELECT s.id AS sectionRouteId," + | ||
| 119 | + "s.line_code AS sectionRouteLineCode," + | ||
| 120 | + "s.sectionroute_code AS sectionRouteCode," + | ||
| 121 | + "s.directions AS sectionRouteDirections," + | ||
| 122 | + "s.line AS sectionRouteLine," + | ||
| 123 | + "s.section AS sectionRouteSection," + | ||
| 124 | + "s.descriptions AS sectionRouteDescriptions," + | ||
| 125 | + "s.create_by AS sectionRouteCreateBy," + | ||
| 126 | + "s.create_date AS sectionRouteCreateDate," + | ||
| 127 | + "s.update_by AS sectionRouteUpdateBy," + | ||
| 128 | + "s.update_date AS sectionRouteUpdateDate," + | ||
| 129 | + "s.versions AS sectionRouteVersions," + | ||
| 130 | + "s.destroy AS sectionRouteDestroy, s.is_roade_speed AS isRoadeSpeed " + | ||
| 131 | + " FROM bsth_c_sectionroute s where s.id =?1) a " + | ||
| 132 | + " LEFT JOIN bsth_c_section b on a.sectionRouteSection = b.id", nativeQuery=true) | ||
| 133 | + List<Object[]> findSectionRouteInfoFormId(int id); | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 更新路线删除线路缓存路段 | ||
| 137 | + * | ||
| 138 | + * @param line | ||
| 139 | + * @param dir | ||
| 140 | + */ | ||
| 141 | + @Modifying | ||
| 142 | + @Query(value="delete from bsth_c_sectionroute_cache where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 143 | + public void sectionRouteCacheDel(Integer line,Integer dir); | ||
| 144 | +} |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -177,7 +177,17 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -177,7 +177,17 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 177 | 177 | ||
| 178 | @Modifying | 178 | @Modifying |
| 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) | 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 180 | - public void sectionRouteIsDestroyUpdBatch(Integer ids); | 180 | + public void sectionRouteIsDestroyUpdBatch(Integer id); |
| 181 | + | ||
| 182 | + /** | ||
| 183 | + * 更新路线前撤销线路原有路段 | ||
| 184 | + * | ||
| 185 | + * @param line | ||
| 186 | + * @param dir | ||
| 187 | + */ | ||
| 188 | + @Modifying | ||
| 189 | + @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 190 | + public void sectionRouteUpdDestroy(Integer line,Integer dir); | ||
| 181 | 191 | ||
| 182 | @Modifying | 192 | @Modifying |
| 183 | @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) | 193 | @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) |
src/main/java/com/bsth/repository/StationRepository.java
| @@ -40,17 +40,10 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | @@ -40,17 +40,10 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | ||
| 40 | /*@Query(value = "SELECT s.b_jwpoints,s.id FROM bsth_c_station s where s.station_name like ?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 | - /*@Query(value = " SELECT t.b_jwpoints,t.id FROM (" + | ||
| 44 | - " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + | ||
| 45 | - " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + | ||
| 46 | - " LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2" | ||
| 47 | - , nativeQuery=true)*/ | ||
| 48 | @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + | 43 | @Query(value = " SELECT t.b_jwpoints,t.id FROM (" + |
| 49 | " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + | 44 | " SELECT b.id,b.b_jwpoints,b.station_name,a.directions FROM (" + |
| 50 | " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + | 45 | " SELECT s.station,s.station_name,s.directions FROM bsth_c_stationroute s where s.destroy = 0 and s.directions = ?1) a " + |
| 51 | - " LEFT JOIN " + | ||
| 52 | - " (SELECT r.id,r.b_jwpoints,r.station_name from bsth_c_station r where r.destroy = 0 and r.station_name LIKE ?2 ) " + | ||
| 53 | - " b on a.station = b. id) t where t.station_name LIKE ?2 " | 46 | + " LEFT JOIN bsth_c_station b on a.station = b. id) t where t.station_name LIKE ?2" |
| 54 | , nativeQuery=true) | 47 | , nativeQuery=true) |
| 55 | List<Object[]> findStationName(Integer dir , String stationName); | 48 | List<Object[]> findStationName(Integer dir , String stationName); |
| 56 | 49 | ||
| @@ -108,24 +101,18 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | @@ -108,24 +101,18 @@ public interface StationRepository extends BaseRepository<Station, Integer> { | ||
| 108 | "y = ?9 , " + | 101 | "y = ?9 , " + |
| 109 | "b_polygon_grid = ST_GeomFromText(?10) , " + | 102 | "b_polygon_grid = ST_GeomFromText(?10) , " + |
| 110 | "g_polygon_grid = ST_GeomFromText(?11) , " + | 103 | "g_polygon_grid = ST_GeomFromText(?11) , " + |
| 111 | - /*"destroy = ?12 , " +*/ | ||
| 112 | - "radius = ?12 , " + | ||
| 113 | - "shapes_type = ?13 , " + | ||
| 114 | - "versions = ?14 , " + | ||
| 115 | - "descriptions = ?15 " + | ||
| 116 | - " WHERE id = ?16 ", nativeQuery=true) | 104 | + "destroy = ?12 , " + |
| 105 | + "radius = ?13 , " + | ||
| 106 | + "shapes_type = ?14 , " + | ||
| 107 | + "versions = ?15 , " + | ||
| 108 | + "descriptions = ?16 " + | ||
| 109 | + " WHERE id = ?17 ", nativeQuery=true) | ||
| 117 | public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, | 110 | public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, |
| 118 | - | ||
| 119 | - Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, | ||
| 120 | - | ||
| 121 | - Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); | ||
| 122 | - | ||
| 123 | - /*public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints, | ||
| 124 | 111 | ||
| 125 | Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, | 112 | Float gLonx,Float gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid, |
| 126 | 113 | ||
| 127 | Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); | 114 | Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId); |
| 128 | - */ | 115 | + |
| 129 | 116 | ||
| 130 | @Query(value = "select st_astext(g_polygon_grid) as g_polygon_grid, shapes_type,concat(g_lonx, ' ', g_laty) as g_center_point ,radius, station_cod,station_name from bsth_c_station where station_cod=?1", nativeQuery = true) | 117 | @Query(value = "select st_astext(g_polygon_grid) as g_polygon_grid, shapes_type,concat(g_lonx, ' ', g_laty) as g_center_point ,radius, station_cod,station_name from bsth_c_station where station_cod=?1", nativeQuery = true) |
| 131 | public Object[][] bufferAera(String stationCode); | 118 | public Object[][] bufferAera(String stationCode); |
src/main/java/com/bsth/repository/StationRouteCacheRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.data.domain.Page; | ||
| 7 | +import org.springframework.data.domain.Pageable; | ||
| 8 | +import org.springframework.data.domain.Sort; | ||
| 9 | +import org.springframework.data.jpa.domain.Specification; | ||
| 10 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 11 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 12 | +import org.springframework.data.jpa.repository.Query; | ||
| 13 | +import org.springframework.stereotype.Repository; | ||
| 14 | +import org.springframework.transaction.annotation.Transactional; | ||
| 15 | + | ||
| 16 | +import com.bsth.entity.Line; | ||
| 17 | +import com.bsth.entity.StationRoute; | ||
| 18 | +import com.bsth.entity.StationRouteCache; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * | ||
| 22 | + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | ||
| 23 | + * | ||
| 24 | + * @Extends : BaseRepository | ||
| 25 | + * | ||
| 26 | + * @Description: TODO(站点路由Repository数据持久层接口) | ||
| 27 | + * | ||
| 28 | + * @Author bsth@lq | ||
| 29 | + * | ||
| 30 | + * @Date 2016年5月03日 上午9:21:17 | ||
| 31 | + * | ||
| 32 | + * @Version 公交调度系统BS版 0.1 | ||
| 33 | + * | ||
| 34 | + */ | ||
| 35 | + | ||
| 36 | +@Repository | ||
| 37 | +public interface StationRouteCacheRepository extends BaseRepository<StationRouteCache, Integer> { | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * @Description :TODO(站点中心点坐标查询) | ||
| 41 | + * | ||
| 42 | + * @param map <lineId:线路ID; direction:方向> | ||
| 43 | + * | ||
| 44 | + * @return List<Object[]> | ||
| 45 | + */ | ||
| 46 | + /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + | ||
| 47 | + "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | ||
| 48 | + "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ | ||
| 49 | + @Query(value = "SELECT s.b_jwpoints,r.station_name,r.station_route_code FROM (" + | ||
| 50 | + "SELECT b.station,b.station_route_code,b.station_name FROM bsth_c_stationroute_cache b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | ||
| 51 | + "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) | ||
| 52 | + List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 查询站点路由 | ||
| 56 | + */ | ||
| 57 | + @Query("select r from StationRouteCache r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | ||
| 58 | + public List<StationRouteCache> findstationRoute(String lineCode,Integer dir); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 更新路线删除线路缓存站点 | ||
| 62 | + * | ||
| 63 | + * @param line | ||
| 64 | + * @param dir | ||
| 65 | + */ | ||
| 66 | + @Modifying | ||
| 67 | + @Query(value="delete from bsth_c_stationroute_cache where line = ?1 and directions = ?2 ", nativeQuery=true) | ||
| 68 | + public void stationRouteCacheDel(Integer line,Integer dir); | ||
| 69 | + | ||
| 70 | +} |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -266,6 +266,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -266,6 +266,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 266 | "StationRoute s " + | 266 | "StationRoute s " + |
| 267 | "WHERE " + | 267 | "WHERE " + |
| 268 | "s.destroy = 0 " + | 268 | "s.destroy = 0 " + |
| 269 | + "and s.lineCode in(select lineCode from Line where inUse = 1) " + | ||
| 269 | "ORDER BY " + | 270 | "ORDER BY " + |
| 270 | "lineCode,directions,stationRouteCode") | 271 | "lineCode,directions,stationRouteCode") |
| 271 | List<Map<String, String>> findAllLineWithYgc(); | 272 | List<Map<String, String>> findAllLineWithYgc(); |
| @@ -282,7 +283,27 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -282,7 +283,27 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 282 | @Query(value="UPDATE bsth_c_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | 283 | @Query(value="UPDATE bsth_c_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) |
| 283 | public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | 284 | public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); |
| 284 | 285 | ||
| 286 | + /** | ||
| 287 | + * 更新路线前撤销线路原有站点 | ||
| 288 | + * | ||
| 289 | + * @param line | ||
| 290 | + * @param dir | ||
| 291 | + */ | ||
| 292 | + @Modifying | ||
| 293 | + @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where line = ?1 and directions = ?2", nativeQuery=true) | ||
| 294 | + public void stationRouteUpdDestroy(Integer line,Integer dir); | ||
| 295 | + | ||
| 285 | @Modifying | 296 | @Modifying |
| 286 | @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where id = ?1", nativeQuery=true) | 297 | @Query(value="UPDATE bsth_c_stationroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 287 | public void stationRouteIsDestroyUpdBatch(Integer ids); | 298 | public void stationRouteIsDestroyUpdBatch(Integer ids); |
| 299 | + | ||
| 300 | + /** | ||
| 301 | + * 更新路线前撤销线路原有站点 | ||
| 302 | + * | ||
| 303 | + * @param line | ||
| 304 | + * @param dir | ||
| 305 | + */ | ||
| 306 | + @Modifying | ||
| 307 | + @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true) | ||
| 308 | + public void stationRouteUpdate(Integer line,Integer dir); | ||
| 288 | } | 309 | } |
src/main/java/com/bsth/service/SectionRouteService.java
| @@ -32,6 +32,8 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | @@ -32,6 +32,8 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | ||
| 32 | 32 | ||
| 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); | 33 | List<Map<String, Object>> getSectionRoute(Map<String, Object> map); |
| 34 | 34 | ||
| 35 | + List<Map<String, Object>> getSectionRouteCache(Map<String, Object> map); | ||
| 36 | + | ||
| 35 | /** | 37 | /** |
| 36 | * @Description : TODO(根据路段路由Id批量撤销路段) | 38 | * @Description : TODO(根据路段路由Id批量撤销路段) |
| 37 | * | 39 | * |
| @@ -60,4 +62,5 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | @@ -60,4 +62,5 @@ public interface SectionRouteService extends BaseService<SectionRoute, Integer> | ||
| 60 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); | 62 | List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); |
| 61 | 63 | ||
| 62 | Map<String, Object> quoteSection(Map<String, Object> map); | 64 | Map<String, Object> quoteSection(Map<String, Object> map); |
| 65 | + | ||
| 63 | } | 66 | } |
src/main/java/com/bsth/service/SectionService.java
| @@ -31,4 +31,8 @@ public interface SectionService extends BaseService<Section, Integer> { | @@ -31,4 +31,8 @@ public interface SectionService extends BaseService<Section, Integer> { | ||
| 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); | 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); |
| 32 | 32 | ||
| 33 | Map<String, Object> sectionSave(Map<String, Object> map); | 33 | Map<String, Object> sectionSave(Map<String, Object> map); |
| 34 | + | ||
| 35 | + Map<String, Object> sectionCut(Map<String, Object> map); | ||
| 36 | + | ||
| 37 | + Map<String, Object> sectionCacheUpdate(Map<String, Object> map); | ||
| 34 | } | 38 | } |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -77,6 +77,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -77,6 +77,9 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 77 | */ | 77 | */ |
| 78 | Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); | 78 | Map<String, Object> stationRouteIsDestroy(Map<String, Object> map); |
| 79 | 79 | ||
| 80 | + | ||
| 81 | + List<Map<String, Object>> getStationRouteCacheCenterPoints(Map<String, Object> map); | ||
| 82 | + | ||
| 80 | /** | 83 | /** |
| 81 | * @Description : TODO(根据线路ID生成行单) | 84 | * @Description : TODO(根据线路ID生成行单) |
| 82 | * | 85 | * |
| @@ -102,4 +105,5 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -102,4 +105,5 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 102 | 105 | ||
| 103 | Map<String, Object> upddis(Map<String, Object> map); | 106 | Map<String, Object> upddis(Map<String, Object> map); |
| 104 | 107 | ||
| 108 | + | ||
| 105 | } | 109 | } |
src/main/java/com/bsth/service/StationService.java
| @@ -69,4 +69,17 @@ public interface StationService extends BaseService<Station, Integer> { | @@ -69,4 +69,17 @@ public interface StationService extends BaseService<Station, Integer> { | ||
| 69 | */ | 69 | */ |
| 70 | Map<String, Object> stationUpdate(Map<String, Object> map); | 70 | Map<String, Object> stationUpdate(Map<String, Object> map); |
| 71 | 71 | ||
| 72 | + /** | ||
| 73 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 74 | + * | ||
| 75 | + * @param map: <point:坐标点; name:站点名> | ||
| 76 | + * | ||
| 77 | + */ | ||
| 78 | + Map<String, Object> matchStation(Map<String, Object> map); | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 上传的GPS点生成的路线保存在缓存表 | ||
| 82 | + */ | ||
| 83 | + Map<String, Object> cacheSave(Map<String, Object> map); | ||
| 84 | + | ||
| 72 | } | 85 | } |
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
| @@ -22,6 +22,7 @@ import com.bsth.entity.SectionRoute; | @@ -22,6 +22,7 @@ import com.bsth.entity.SectionRoute; | ||
| 22 | import com.bsth.entity.search.CustomerSpecs; | 22 | import com.bsth.entity.search.CustomerSpecs; |
| 23 | import com.bsth.repository.LineRepository; | 23 | import com.bsth.repository.LineRepository; |
| 24 | import com.bsth.repository.SectionRepository; | 24 | import com.bsth.repository.SectionRepository; |
| 25 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 25 | import com.bsth.repository.SectionRouteRepository; | 26 | import com.bsth.repository.SectionRouteRepository; |
| 26 | import com.bsth.service.SectionRouteService; | 27 | import com.bsth.service.SectionRouteService; |
| 27 | import com.bsth.util.GetUIDAndCode; | 28 | import com.bsth.util.GetUIDAndCode; |
| @@ -49,6 +50,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -49,6 +50,9 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 49 | SectionRouteRepository repository; | 50 | SectionRouteRepository repository; |
| 50 | 51 | ||
| 51 | @Autowired | 52 | @Autowired |
| 53 | + SectionRouteCacheRepository Cacherepository; | ||
| 54 | + | ||
| 55 | + @Autowired | ||
| 52 | SectionRepository repository2; | 56 | SectionRepository repository2; |
| 53 | 57 | ||
| 54 | @Autowired | 58 | @Autowired |
| @@ -117,7 +121,55 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -117,7 +121,55 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 117 | return resultList; | 121 | return resultList; |
| 118 | } | 122 | } |
| 119 | 123 | ||
| 120 | - | 124 | + /** |
| 125 | + * @Description :TODO(查询路段信息) | ||
| 126 | + * | ||
| 127 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 128 | + * | ||
| 129 | + * @return Map<String, Object> | ||
| 130 | + */ | ||
| 131 | + @Transactional | ||
| 132 | + @Override | ||
| 133 | + public List<Map<String, Object>> getSectionRouteCache(Map<String, Object> map) { | ||
| 134 | + int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString()); | ||
| 135 | + int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString()); | ||
| 136 | + List<Object[]> listObjArray = Cacherepository.getSectionRouteCache(lineId, directions); | ||
| 137 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 138 | + if(listObjArray.size()>0) { | ||
| 139 | + for(int i = 0 ; i<listObjArray.size() ; i++){ | ||
| 140 | + Map<String, Object> tempM = new HashMap<String, Object>(); | ||
| 141 | + tempM.put("sectionrouteId",listObjArray.get(i)[0]); | ||
| 142 | + tempM.put("sectionrouteLine",listObjArray.get(i)[1]); | ||
| 143 | + tempM.put("sectionrouteLineCode",listObjArray.get(i)[2]); | ||
| 144 | + tempM.put("sectionrouteSection",listObjArray.get(i)[3]); | ||
| 145 | + tempM.put("sectionrouteSectionCode",listObjArray.get(i)[4]); | ||
| 146 | + tempM.put("sectionrouteCode",listObjArray.get(i)[5]); | ||
| 147 | + tempM.put("sectionrouteDirections",listObjArray.get(i)[6]); | ||
| 148 | + tempM.put("sectionId",listObjArray.get(i)[7]); | ||
| 149 | + tempM.put("sectionCode",listObjArray.get(i)[8]); | ||
| 150 | + tempM.put("sectionName",listObjArray.get(i)[9]); | ||
| 151 | + tempM.put("sectionCrosesRoad",listObjArray.get(i)[10]); | ||
| 152 | + tempM.put("sectionEndNode",listObjArray.get(i)[11]); | ||
| 153 | + tempM.put("sectionStartNode",listObjArray.get(i)[12]); | ||
| 154 | + tempM.put("sectionMiddleNode",listObjArray.get(i)[13]); | ||
| 155 | + tempM.put("sectionType",listObjArray.get(i)[14]); | ||
| 156 | + tempM.put("sectionCsectionVector",listObjArray.get(i)[15]); | ||
| 157 | + tempM.put("sectionBsectionVector",listObjArray.get(i)[16]); | ||
| 158 | + tempM.put("sectionGsectionVector",listObjArray.get(i)[17]); | ||
| 159 | + tempM.put("sectionRoadCoding",listObjArray.get(i)[18]); | ||
| 160 | + tempM.put("sectionDistance",listObjArray.get(i)[19]); | ||
| 161 | + tempM.put("sectionTime",listObjArray.get(i)[20]); | ||
| 162 | + tempM.put("sectiondbType",listObjArray.get(i)[21]); | ||
| 163 | + tempM.put("sectionSpeedLimet",listObjArray.get(i)[22]); | ||
| 164 | + tempM.put("destroy",listObjArray.get(i)[23]); | ||
| 165 | + tempM.put("versions",listObjArray.get(i)[24]); | ||
| 166 | + tempM.put("descriptions",listObjArray.get(i)[25]); | ||
| 167 | + tempM.put("isRoadeSpeed",listObjArray.get(i)[26]); | ||
| 168 | + resultList.add(tempM); | ||
| 169 | + } | ||
| 170 | + } | ||
| 171 | + return resultList; | ||
| 172 | + } | ||
| 121 | 173 | ||
| 122 | 174 | ||
| 123 | /** | 175 | /** |
| @@ -239,7 +291,6 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -239,7 +291,6 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 239 | if(reslutList.get(0)!=null) { | 291 | if(reslutList.get(0)!=null) { |
| 240 | for(int i = 0 ; i <reslutList.size() ;i++){ | 292 | for(int i = 0 ; i <reslutList.size() ;i++){ |
| 241 | Map<String, Object> tempM = new HashMap<String, Object>(); | 293 | Map<String, Object> tempM = new HashMap<String, Object>(); |
| 242 | - System.out.println(reslutList.get(i)); | ||
| 243 | tempM.put("sectionrouteCode", reslutList.get(i)); | 294 | tempM.put("sectionrouteCode", reslutList.get(i)); |
| 244 | list.add(tempM); | 295 | list.add(tempM); |
| 245 | } | 296 | } |
| @@ -325,13 +376,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | @@ -325,13 +376,7 @@ public class SectionRouteServiceImpl extends BaseServiceImpl<SectionRoute, Integ | ||
| 325 | //int i = 0; | 376 | //int i = 0; |
| 326 | String[] idsStr = map.get("ids").toString().split(",") ; | 377 | String[] idsStr = map.get("ids").toString().split(",") ; |
| 327 | for (String id : idsStr) { | 378 | for (String id : idsStr) { |
| 328 | - /* entityManager.persist(Integer.parseInt(id));*/ | ||
| 329 | repository.sectionRouteIsDestroyUpdBatch(Integer.parseInt(id)); | 379 | repository.sectionRouteIsDestroyUpdBatch(Integer.parseInt(id)); |
| 330 | -/* i++; | ||
| 331 | - if (i % batchSize == 0) { | ||
| 332 | - entityManager.flush(); | ||
| 333 | - entityManager.clear(); | ||
| 334 | - }*/ | ||
| 335 | } | 380 | } |
| 336 | resultMap.put("status", ResponseCode.SUCCESS); | 381 | resultMap.put("status", ResponseCode.SUCCESS); |
| 337 | } catch (Exception e) { | 382 | } catch (Exception e) { |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 4 | +import java.util.ArrayList; | ||
| 4 | import java.util.Date; | 5 | import java.util.Date; |
| 5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
| 7 | +import java.util.List; | ||
| 6 | import java.util.Map; | 8 | import java.util.Map; |
| 7 | 9 | ||
| 10 | +import org.mozilla.javascript.ObjArray; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | +import org.springframework.data.jpa.domain.Specification; | ||
| 9 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; |
| 11 | 15 | ||
| 12 | import com.alibaba.fastjson.JSONArray; | 16 | import com.alibaba.fastjson.JSONArray; |
| 17 | +import com.alibaba.fastjson.JSONObject; | ||
| 13 | import com.bsth.common.ResponseCode; | 18 | import com.bsth.common.ResponseCode; |
| 14 | import com.bsth.entity.Line; | 19 | import com.bsth.entity.Line; |
| 15 | import com.bsth.entity.Section; | 20 | import com.bsth.entity.Section; |
| 16 | import com.bsth.entity.SectionRoute; | 21 | import com.bsth.entity.SectionRoute; |
| 22 | +import com.bsth.entity.SectionRouteCache; | ||
| 23 | +import com.bsth.entity.StationRoute; | ||
| 24 | +import com.bsth.entity.StationRouteCache; | ||
| 17 | import com.bsth.repository.LineRepository; | 25 | import com.bsth.repository.LineRepository; |
| 18 | import com.bsth.repository.SectionRepository; | 26 | import com.bsth.repository.SectionRepository; |
| 27 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 19 | import com.bsth.repository.SectionRouteRepository; | 28 | import com.bsth.repository.SectionRouteRepository; |
| 29 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 30 | +import com.bsth.repository.StationRouteRepository; | ||
| 20 | import com.bsth.service.SectionService; | 31 | import com.bsth.service.SectionService; |
| 32 | +import com.bsth.util.GetUIDAndCode; | ||
| 21 | import com.bsth.util.TransGPS; | 33 | import com.bsth.util.TransGPS; |
| 22 | import com.bsth.util.TransGPS.Location; | 34 | import com.bsth.util.TransGPS.Location; |
| 35 | +import com.bsth.util.Geo.GeoUtils; | ||
| 36 | +import com.bsth.util.Geo.Point; | ||
| 37 | +import com.google.gson.JsonObject; | ||
| 23 | 38 | ||
| 24 | /** | 39 | /** |
| 25 | * | 40 | * |
| @@ -49,6 +64,265 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -49,6 +64,265 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 49 | @Autowired | 64 | @Autowired |
| 50 | SectionRouteRepository routeRepository; | 65 | SectionRouteRepository routeRepository; |
| 51 | 66 | ||
| 67 | + @Autowired | ||
| 68 | + SectionRouteCacheRepository routeCacheRepository; | ||
| 69 | + | ||
| 70 | + @Autowired | ||
| 71 | + StationRouteRepository stationRouteRepository; | ||
| 72 | + | ||
| 73 | + @Autowired | ||
| 74 | + StationRouteCacheRepository stationRouteCacheRepository; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(生成新的线路走向) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 83 | + @Override | ||
| 84 | + @Transactional | ||
| 85 | + public Map<String, Object> sectionCut(Map<String, Object> map) { | ||
| 86 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 87 | + try { | ||
| 88 | + // 路段点List | ||
| 89 | + List<Point> bPointsList = new ArrayList<>(); | ||
| 90 | + // 截取路段点List | ||
| 91 | + List<Point> bPointsCutList = new ArrayList<>(); | ||
| 92 | + // 截取后的路段 | ||
| 93 | + List<Map<String, String>> sectionArrayList = new ArrayList<>(); | ||
| 94 | + String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString(); | ||
| 95 | + String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString(); | ||
| 96 | + if(!bsectionVector.equals("")) { | ||
| 97 | + // 转换成JSON数组 | ||
| 98 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | ||
| 99 | + // 遍历 | ||
| 100 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 101 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 102 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 103 | + bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr))); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + if(!bsectionVectorCutList.equals("")) { | ||
| 107 | + // 转换成JSON数组 | ||
| 108 | + JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList); | ||
| 109 | + // 截取路段在总路段中的下表 | ||
| 110 | + int firstTemp = 0; | ||
| 111 | + int lastTemp = 0; | ||
| 112 | + // 每个截取的路段去总路段中获取 | ||
| 113 | + for (int i = 0; i < sectionsArrayList.size(); i++) { | ||
| 114 | + // 切点列表 | ||
| 115 | + JSONObject sectionsArray = sectionsArrayList.getJSONObject(i); | ||
| 116 | + String sectionName = sectionsArray.get("name").toString(); | ||
| 117 | + JSONArray sectionPoints = sectionsArray.getJSONArray("section"); | ||
| 118 | + // 用两个坐标点去截取总路段 | ||
| 119 | + if (i == 0) { | ||
| 120 | + for(int s = 0 ;s<sectionPoints.size();s++) { | ||
| 121 | + String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString(); | ||
| 122 | + String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString(); | ||
| 123 | + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr)); | ||
| 124 | + double distance = 0; | ||
| 125 | + // 寻找最近点 | ||
| 126 | + for (int index = firstTemp; index < bPointsList.size(); index++) { | ||
| 127 | + if (index == firstTemp) { | ||
| 128 | + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index)); | ||
| 129 | + } else { | ||
| 130 | + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index)); | ||
| 131 | + if(distance > distanceTemp) { | ||
| 132 | + distance = distanceTemp; | ||
| 133 | + lastTemp = index; | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + if (s == 0) { | ||
| 138 | + // 第一个点作为路段的起点 | ||
| 139 | + firstTemp = lastTemp; | ||
| 140 | + } | ||
| 141 | + // 用切点替换最近点 | ||
| 142 | + if(lastTemp == firstTemp) { | ||
| 143 | + bPointsList.add(++lastTemp, bPointcut); | ||
| 144 | + } else { | ||
| 145 | + bPointsList.set(lastTemp, bPointcut); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } else { | ||
| 149 | + String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString(); | ||
| 150 | + String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString(); | ||
| 151 | + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr)); | ||
| 152 | + double distance = 0; | ||
| 153 | + // 寻找最近点 | ||
| 154 | + for (int index = firstTemp; index < bPointsList.size(); index++) { | ||
| 155 | + if (index == firstTemp) { | ||
| 156 | + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index)); | ||
| 157 | + } else { | ||
| 158 | + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index)); | ||
| 159 | + if(distance > distanceTemp) { | ||
| 160 | + distance = distanceTemp; | ||
| 161 | + lastTemp = index; | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + // 用切点替换最近点 | ||
| 166 | + if(lastTemp == firstTemp) { | ||
| 167 | + bPointsList.add(++lastTemp, bPointcut); | ||
| 168 | + } else { | ||
| 169 | + bPointsList.set(lastTemp, bPointcut); | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + // 切路段 | ||
| 173 | + if (sectionName != "" && sectionName != null ) { | ||
| 174 | + // 原始线状图形坐标集合 | ||
| 175 | + String sectionsBpoints = ""; | ||
| 176 | + // WGS线状图形坐标集合 | ||
| 177 | + String sectionsWJPpoints = ""; | ||
| 178 | + for (int j = firstTemp; j <= lastTemp; j++) { | ||
| 179 | + Point point = bPointsList.get(j); | ||
| 180 | + String pointsLngStr = String.valueOf(point.getLon()); | ||
| 181 | + String pointsLatStr = String.valueOf(point.getLat()); | ||
| 182 | + /** to WGS坐标 */ | ||
| 183 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 184 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 185 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 186 | + if(j == firstTemp) { | ||
| 187 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 188 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 189 | + }else { | ||
| 190 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 191 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + Map<String, String> sectionCutMap = new HashMap<String, String>(); | ||
| 195 | + sectionCutMap.put("sectionName", sectionName); | ||
| 196 | + sectionCutMap.put("sectionsBpoints", sectionsBpoints); | ||
| 197 | + sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints); | ||
| 198 | + sectionArrayList.add(sectionCutMap); | ||
| 199 | + } | ||
| 200 | + // 上一个路段的终点作为下一个路段的起点 | ||
| 201 | + firstTemp = lastTemp; | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + // 原坐标类型 | ||
| 206 | + String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString(); | ||
| 207 | + // 说明 | ||
| 208 | + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | ||
| 209 | + // 是否撤销 | ||
| 210 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ||
| 211 | + // 方向 | ||
| 212 | + Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString()); | ||
| 213 | + // 线路ID | ||
| 214 | + Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString()); | ||
| 215 | + // 道路编码 | ||
| 216 | + String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString(); | ||
| 217 | + // 路段长度 | ||
| 218 | + Double sectionDistance = 0.0; | ||
| 219 | + // 路段路由Id | ||
| 220 | + Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString()); | ||
| 221 | + // 线路编码 | ||
| 222 | + String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString(); | ||
| 223 | + // 路段时长 | ||
| 224 | + Double sectionTime = 0.0; | ||
| 225 | + // 路段路由 | ||
| 226 | + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | ||
| 227 | + // 限速 | ||
| 228 | + Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString()); | ||
| 229 | + // 版本 | ||
| 230 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | ||
| 231 | + | ||
| 232 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | ||
| 233 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | ||
| 234 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | ||
| 235 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | ||
| 236 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ||
| 237 | + Date date = new Date(); | ||
| 238 | + // 修改日期 | ||
| 239 | + String updateDate = formatter.format(date); | ||
| 240 | + String crosesRoad=""; | ||
| 241 | + String endNode=""; | ||
| 242 | + String startNode=""; | ||
| 243 | + String middleNode=""; | ||
| 244 | + String sectionType=""; | ||
| 245 | + String csectionVector=""; | ||
| 246 | + // 撤销原有路段 | ||
| 247 | + routeRepository.sectionRouteUpdDestroy(Integer.parseInt(lineCode),directions); | ||
| 248 | + // 路段保存 | ||
| 249 | + for (int i = 0; i < sectionArrayList.size(); i++) { | ||
| 250 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 251 | + // 路段编码 | ||
| 252 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 253 | + // 路段ID | ||
| 254 | + int sectionId = (int)sectionMaxId; | ||
| 255 | + String sectionName = sectionArrayList.get(i).get("sectionName").toString(); | ||
| 256 | + String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString(); | ||
| 257 | + String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString(); | ||
| 258 | + // WGS坐标点集合 | ||
| 259 | + String gsectionVector = null; | ||
| 260 | + if(!sectionsWJPpoints.equals("")) | ||
| 261 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 262 | + // 原坐标点集合 | ||
| 263 | + String bsectionVectorS = null; | ||
| 264 | + if(!sectionsBpoints.equals("")) | ||
| 265 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 266 | + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, sectionId); | ||
| 267 | + SectionRoute route = new SectionRoute(); | ||
| 268 | + Line line = lineRepository.findOne(sectionRouteLine); | ||
| 269 | + Section section = repository.findOne(sectionId); | ||
| 270 | + route.setSectionrouteCode(sectionrouteCode+i*100); | ||
| 271 | + route.setLineCode(lineCode); | ||
| 272 | + route.setSectionCode(sectionCode); | ||
| 273 | + route.setDirections(directions); | ||
| 274 | + route.setVersions(version); | ||
| 275 | + route.setDestroy(destroy); | ||
| 276 | + route.setDescriptions(descriptions); | ||
| 277 | + route.setCreateBy(createBy); | ||
| 278 | + route.setUpdateBy(updateBy); | ||
| 279 | + route.setLine(line); | ||
| 280 | + route.setSection(section); | ||
| 281 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 282 | + routeRepository.save(route); | ||
| 283 | + } | ||
| 284 | + // 删除缓存路段 | ||
| 285 | + routeCacheRepository.sectionRouteCacheDel(Integer.parseInt(lineCode),directions); | ||
| 286 | + // 撤销原有站点 | ||
| 287 | + stationRouteRepository.stationRouteUpdDestroy(Integer.parseInt(lineCode),directions); | ||
| 288 | + // 站点保存 | ||
| 289 | + List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions); | ||
| 290 | + for(int i=0; i < stationRouteList.size(); i++) { | ||
| 291 | + StationRouteCache stationRouteCache = stationRouteList.get(i); | ||
| 292 | + StationRoute stationRoute = new StationRoute(); | ||
| 293 | + stationRoute.setLine(stationRouteCache.getLine()); | ||
| 294 | + stationRoute.setStation(stationRouteCache.getStation()); | ||
| 295 | + stationRoute.setStationName(stationRouteCache.getStationName()); | ||
| 296 | + stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode()); | ||
| 297 | + stationRoute.setLineCode(stationRouteCache.getLineCode()); | ||
| 298 | + stationRoute.setStationCode(stationRouteCache.getStationCode()); | ||
| 299 | + stationRoute.setStationMark(stationRouteCache.getStationMark()); | ||
| 300 | + stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber()); | ||
| 301 | + stationRoute.setDirections(stationRouteCache.getDirections()); | ||
| 302 | + stationRoute.setDistances(stationRouteCache.getDistances()); | ||
| 303 | + stationRoute.setToTime(stationRouteCache.getToTime()); | ||
| 304 | + stationRoute.setFirstTime(stationRouteCache.getFirstTime()); | ||
| 305 | + stationRoute.setEndTime(stationRouteCache.getEndTime()); | ||
| 306 | + stationRoute.setDescriptions(stationRouteCache.getDescriptions()); | ||
| 307 | + stationRoute.setDestroy(stationRouteCache.getDestroy()); | ||
| 308 | + stationRoute.setVersions(stationRouteCache.getVersions()); | ||
| 309 | + stationRoute.setCreateBy(stationRouteCache.getCreateBy()); | ||
| 310 | + stationRoute.setCreateDate(stationRouteCache.getCreateDate()); | ||
| 311 | + stationRoute.setUpdateBy(stationRouteCache.getCreateBy()); | ||
| 312 | + stationRoute.setUpdateDate(stationRouteCache.getUpdateDate()); | ||
| 313 | + stationRouteRepository.save(stationRoute); | ||
| 314 | + } | ||
| 315 | + // 删除缓存站点 | ||
| 316 | + stationRouteCacheRepository.stationRouteCacheDel(Integer.parseInt(lineCode),directions); | ||
| 317 | + | ||
| 318 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 319 | + } catch (Exception e) { | ||
| 320 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 321 | + logger.error("save erro.", e); | ||
| 322 | + } | ||
| 323 | + return resultMap; | ||
| 324 | + } | ||
| 325 | + | ||
| 52 | /** | 326 | /** |
| 53 | * @Description :TODO(编辑线路走向) | 327 | * @Description :TODO(编辑线路走向) |
| 54 | * | 328 | * |
| @@ -177,6 +451,130 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -177,6 +451,130 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 177 | return resultMap; | 451 | return resultMap; |
| 178 | } | 452 | } |
| 179 | 453 | ||
| 454 | + /** | ||
| 455 | + * @Description :TODO(编辑缓存线路走向) | ||
| 456 | + */ | ||
| 457 | + @Override | ||
| 458 | + public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { | ||
| 459 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 460 | + try { | ||
| 461 | + String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); | ||
| 462 | + // 原始线状图形坐标集合 | ||
| 463 | + String sectionsBpoints = ""; | ||
| 464 | + // WGS线状图形坐标集合 | ||
| 465 | + String sectionsWJPpoints = ""; | ||
| 466 | + if(!bsectionVector.equals("")) { | ||
| 467 | + // 转换成JSON数组 | ||
| 468 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | ||
| 469 | + // 遍历 | ||
| 470 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 471 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 472 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 473 | + /** to WGS坐标 */ | ||
| 474 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 475 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 476 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 477 | + if(s==0) { | ||
| 478 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 479 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 480 | + }else { | ||
| 481 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 482 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 483 | + } | ||
| 484 | + } | ||
| 485 | + } | ||
| 486 | + // 原坐标类型 | ||
| 487 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 488 | + // 说明 | ||
| 489 | + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | ||
| 490 | + // 是否撤销 | ||
| 491 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ||
| 492 | + // 方向 | ||
| 493 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | ||
| 494 | + // 线路ID | ||
| 495 | + Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | ||
| 496 | + // 道路编码 | ||
| 497 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 498 | + // 路段编码 | ||
| 499 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | ||
| 500 | + // 路段长度 | ||
| 501 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | ||
| 502 | + // 路段ID | ||
| 503 | + Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); | ||
| 504 | + // 路段名称 | ||
| 505 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | ||
| 506 | + // 路段路由Id | ||
| 507 | + Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); | ||
| 508 | + // 线路编码 | ||
| 509 | + String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | ||
| 510 | + // 路段时长 | ||
| 511 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | ||
| 512 | + // 路段路由 | ||
| 513 | + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | ||
| 514 | + SectionRouteCache resultS = routeCacheRepository.findOne(sectionRouteId); | ||
| 515 | + int old_code = resultS.getSectionrouteCode(); | ||
| 516 | + if(sectionrouteCode!=null) { | ||
| 517 | + int new_code = sectionrouteCode+100; | ||
| 518 | + if(new_code==old_code){ | ||
| 519 | + sectionrouteCode = new_code; | ||
| 520 | + }else { | ||
| 521 | + sectionrouteCode = new_code-100+1; | ||
| 522 | + } | ||
| 523 | + }else { | ||
| 524 | + sectionrouteCode = old_code; | ||
| 525 | + } | ||
| 526 | + // 限速 | ||
| 527 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | ||
| 528 | + // 版本 | ||
| 529 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | ||
| 530 | + // WGS坐标点集合 | ||
| 531 | + String gsectionVector = null; | ||
| 532 | + if(!sectionsWJPpoints.equals("")) | ||
| 533 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 534 | + // 原坐标点集合 | ||
| 535 | + String bsectionVectorS = null; | ||
| 536 | + if(!sectionsBpoints.equals("")) | ||
| 537 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 538 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | ||
| 539 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | ||
| 540 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | ||
| 541 | + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | ||
| 542 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ||
| 543 | + Date date = new Date(); | ||
| 544 | + // 修改日期 | ||
| 545 | + String updateDate = formatter.format(date); | ||
| 546 | + String crosesRoad=""; | ||
| 547 | + String endNode=""; | ||
| 548 | + String startNode=""; | ||
| 549 | + String middleNode=""; | ||
| 550 | + String sectionType=""; | ||
| 551 | + // 更新 | ||
| 552 | + repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | ||
| 553 | + SectionRouteCache route = new SectionRouteCache(); | ||
| 554 | + Line line = lineRepository.findOne(sectionRouteLine); | ||
| 555 | + Section section = repository.findOne(sectionId); | ||
| 556 | + route.setId(sectionRouteId); | ||
| 557 | + route.setSectionrouteCode(sectionrouteCode); | ||
| 558 | + route.setLineCode(lineCode); | ||
| 559 | + route.setSectionCode(sectionCode); | ||
| 560 | + route.setDirections(directions); | ||
| 561 | + route.setVersions(version); | ||
| 562 | + route.setDestroy(destroy); | ||
| 563 | + route.setDescriptions(descriptions); | ||
| 564 | + route.setCreateBy(createBy); | ||
| 565 | + route.setUpdateBy(updateBy); | ||
| 566 | + route.setLine(line); | ||
| 567 | + route.setSection(section); | ||
| 568 | + route.setIsRoadeSpeed(isRoadeSpeed); | ||
| 569 | + routeCacheRepository.save(route); | ||
| 570 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 571 | + } catch (Exception e) { | ||
| 572 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 573 | + logger.error("save erro.", e); | ||
| 574 | + } | ||
| 575 | + return resultMap; | ||
| 576 | + } | ||
| 577 | + | ||
| 180 | /** 百度坐标转WGS坐标 */ | 578 | /** 百度坐标转WGS坐标 */ |
| 181 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { | 579 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { |
| 182 | 580 |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -8,6 +8,7 @@ import com.bsth.entity.search.CustomerSpecs; | @@ -8,6 +8,7 @@ import com.bsth.entity.search.CustomerSpecs; | ||
| 8 | import com.bsth.repository.LineRepository; | 8 | import com.bsth.repository.LineRepository; |
| 9 | import com.bsth.repository.SectionRouteRepository; | 9 | import com.bsth.repository.SectionRouteRepository; |
| 10 | import com.bsth.repository.StationRepository; | 10 | import com.bsth.repository.StationRepository; |
| 11 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 11 | import com.bsth.repository.StationRouteRepository; | 12 | import com.bsth.repository.StationRouteRepository; |
| 12 | import com.bsth.service.StationRouteService; | 13 | import com.bsth.service.StationRouteService; |
| 13 | import com.bsth.util.FTPClientUtils; | 14 | import com.bsth.util.FTPClientUtils; |
| @@ -51,6 +52,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -51,6 +52,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 51 | private StationRouteRepository repository; | 52 | private StationRouteRepository repository; |
| 52 | 53 | ||
| 53 | @Autowired | 54 | @Autowired |
| 55 | + private StationRouteCacheRepository cacheRepository; | ||
| 56 | + | ||
| 57 | + @Autowired | ||
| 54 | private SectionRouteRepository routeRepository; | 58 | private SectionRouteRepository routeRepository; |
| 55 | 59 | ||
| 56 | @Autowired | 60 | @Autowired |
| @@ -493,6 +497,46 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -493,6 +497,46 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 493 | return resultList; | 497 | return resultList; |
| 494 | } | 498 | } |
| 495 | 499 | ||
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 503 | + * | ||
| 504 | + * @param map <lineId:线路ID; direction:方向> | ||
| 505 | + * | ||
| 506 | + * @return List<Map<String, Object>> | ||
| 507 | + */ | ||
| 508 | + @Override | ||
| 509 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(Map<String, Object> map) { | ||
| 510 | + | ||
| 511 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 512 | + | ||
| 513 | + // 线路ID | ||
| 514 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 515 | + | ||
| 516 | + // 方向 | ||
| 517 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 518 | + | ||
| 519 | + List<Object[]> list = cacheRepository.getSelectStationRouteCenterPoints(lineId, direction); | ||
| 520 | + | ||
| 521 | + if(list.size()>0) { | ||
| 522 | + | ||
| 523 | + for(int i = 0;i<list.size();i++) { | ||
| 524 | + | ||
| 525 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 526 | + | ||
| 527 | + tempM.put("bJwpoints", list.get(i)[0]); | ||
| 528 | + | ||
| 529 | + tempM.put("stationName", list.get(i)[1]); | ||
| 530 | + | ||
| 531 | + resultList.add(tempM); | ||
| 532 | + | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + return resultList; | ||
| 538 | + } | ||
| 539 | + | ||
| 496 | /** | 540 | /** |
| 497 | * @Description :TODO(撤销站点) | 541 | * @Description :TODO(撤销站点) |
| 498 | * | 542 | * |
| @@ -668,6 +712,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -668,6 +712,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 668 | * @return String | 712 | * @return String |
| 669 | */ | 713 | */ |
| 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 714 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 715 | + | ||
| 671 | // 返回值String | 716 | // 返回值String |
| 672 | String stationRStr = ""; | 717 | String stationRStr = ""; |
| 673 | // windows下的文本文件换行符 | 718 | // windows下的文本文件换行符 |
| @@ -771,6 +816,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -771,6 +816,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 771 | 816 | ||
| 772 | } | 817 | } |
| 773 | return stationRStr; | 818 | return stationRStr; |
| 819 | + | ||
| 774 | } | 820 | } |
| 775 | 821 | ||
| 776 | public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { | 822 | public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| @@ -2,6 +2,7 @@ package com.bsth.service.impl; | @@ -2,6 +2,7 @@ package com.bsth.service.impl; | ||
| 2 | 2 | ||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | import java.util.HashMap; | 4 | import java.util.HashMap; |
| 5 | +import java.util.Iterator; | ||
| 5 | import java.util.List; | 6 | import java.util.List; |
| 6 | import java.util.Map; | 7 | import java.util.Map; |
| 7 | 8 | ||
| @@ -20,18 +21,23 @@ import com.bsth.entity.Line; | @@ -20,18 +21,23 @@ import com.bsth.entity.Line; | ||
| 20 | import com.bsth.entity.LineInformation; | 21 | import com.bsth.entity.LineInformation; |
| 21 | import com.bsth.entity.Section; | 22 | import com.bsth.entity.Section; |
| 22 | import com.bsth.entity.SectionRoute; | 23 | import com.bsth.entity.SectionRoute; |
| 24 | +import com.bsth.entity.SectionRouteCache; | ||
| 23 | import com.bsth.entity.Station; | 25 | import com.bsth.entity.Station; |
| 24 | import com.bsth.entity.StationRoute; | 26 | import com.bsth.entity.StationRoute; |
| 27 | +import com.bsth.entity.StationRouteCache; | ||
| 25 | import com.bsth.repository.LineInformationRepository; | 28 | import com.bsth.repository.LineInformationRepository; |
| 26 | import com.bsth.repository.LineRepository; | 29 | import com.bsth.repository.LineRepository; |
| 27 | import com.bsth.repository.SectionRepository; | 30 | import com.bsth.repository.SectionRepository; |
| 31 | +import com.bsth.repository.SectionRouteCacheRepository; | ||
| 28 | import com.bsth.repository.SectionRouteRepository; | 32 | import com.bsth.repository.SectionRouteRepository; |
| 29 | import com.bsth.repository.StationRepository; | 33 | import com.bsth.repository.StationRepository; |
| 34 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 30 | import com.bsth.repository.StationRouteRepository; | 35 | import com.bsth.repository.StationRouteRepository; |
| 31 | import com.bsth.service.StationService; | 36 | import com.bsth.service.StationService; |
| 32 | import com.bsth.util.GetUIDAndCode; | 37 | import com.bsth.util.GetUIDAndCode; |
| 33 | import com.bsth.util.TransGPS; | 38 | import com.bsth.util.TransGPS; |
| 34 | import com.bsth.util.TransGPS.Location; | 39 | import com.bsth.util.TransGPS.Location; |
| 40 | +import com.bsth.util.Geo.Circle; | ||
| 35 | import com.bsth.util.Geo.GeoUtils; | 41 | import com.bsth.util.Geo.GeoUtils; |
| 36 | import com.bsth.util.Geo.Point; | 42 | import com.bsth.util.Geo.Point; |
| 37 | 43 | ||
| @@ -61,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -61,6 +67,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 61 | private StationRouteRepository routeRepository; | 67 | private StationRouteRepository routeRepository; |
| 62 | 68 | ||
| 63 | @Autowired | 69 | @Autowired |
| 70 | + private StationRouteCacheRepository routeCacheRepository; | ||
| 71 | + | ||
| 72 | + @Autowired | ||
| 64 | private LineInformationRepository informationRepository; | 73 | private LineInformationRepository informationRepository; |
| 65 | 74 | ||
| 66 | @Autowired | 75 | @Autowired |
| @@ -72,6 +81,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -72,6 +81,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 72 | @Autowired | 81 | @Autowired |
| 73 | private SectionRouteRepository sectionRouteRepository; | 82 | private SectionRouteRepository sectionRouteRepository; |
| 74 | 83 | ||
| 84 | + @Autowired | ||
| 85 | + private SectionRouteCacheRepository sectionRouteCacheRepository; | ||
| 86 | + | ||
| 87 | + private GeoUtils geoUtils; | ||
| 88 | + | ||
| 75 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 89 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 76 | 90 | ||
| 77 | /** | 91 | /** |
| @@ -118,6 +132,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -118,6 +132,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 118 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); | 132 | Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); |
| 119 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); | 133 | String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); |
| 120 | if(!stationJSON.equals("")) { | 134 | if(!stationJSON.equals("")) { |
| 135 | + // 保存前先撤销原有站点 | ||
| 136 | + | ||
| 121 | // 保存站点与站点路由信息 | 137 | // 保存站点与站点路由信息 |
| 122 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); | 138 | resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); |
| 123 | } | 139 | } |
| @@ -930,8 +946,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -930,8 +946,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 930 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); | 946 | Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); |
| 931 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); | 947 | Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); |
| 932 | // 更新 | 948 | // 更新 |
| 933 | - /*repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId);*/ | ||
| 934 | - repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, radius, shapesType, versions, descriptions, stationId); | 949 | + repository.stationUpdate(stationCod, zdmc, roadCoding, dbType, bJwpoints, gLonx, gLaty, x, y, bPloygonGrid, gPloygonGrid, destroy, radius, shapesType, versions, descriptions, stationId); |
| 935 | // 站点路由Id | 950 | // 站点路由Id |
| 936 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); | 951 | Integer stationRouteId = map.get("stationRouteId").equals("") ? null : Integer.parseInt(map.get("stationRouteId").toString()); |
| 937 | StationRoute resultS = routeRepository.findOne(stationRouteId); | 952 | StationRoute resultS = routeRepository.findOne(stationRouteId); |
| @@ -1000,7 +1015,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1000,7 +1015,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1000 | 1015 | ||
| 1001 | } | 1016 | } |
| 1002 | 1017 | ||
| 1003 | - | 1018 | + @Transactional |
| 1004 | @Override | 1019 | @Override |
| 1005 | public Map<String, Object> manualSave(Map<String, Object> map) { | 1020 | public Map<String, Object> manualSave(Map<String, Object> map) { |
| 1006 | Map<String, Object> resultMap = new HashMap<String,Object>(); | 1021 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| @@ -1073,6 +1088,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1073,6 +1088,8 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1073 | Integer destroy,Integer directions) { | 1088 | Integer destroy,Integer directions) { |
| 1074 | // 转换成JSON数组 | 1089 | // 转换成JSON数组 |
| 1075 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | 1090 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 1091 | + // 更新路线前撤销线路原有路段 | ||
| 1092 | + sectionRouteRepository.sectionRouteUpdDestroy(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1076 | // 遍历 | 1093 | // 遍历 |
| 1077 | for(int s = 0 ;s<sectionsArray.size();s++) { | 1094 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 1078 | // 站点名称 | 1095 | // 站点名称 |
| @@ -1093,11 +1110,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1093,11 +1110,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1093 | if(p==pointsArray.size()-1){ | 1110 | if(p==pointsArray.size()-1){ |
| 1094 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; | 1111 | sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; |
| 1095 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; | 1112 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; |
| 1096 | - // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat"); | ||
| 1097 | }else { | 1113 | }else { |
| 1098 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; | 1114 | sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; |
| 1099 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; | 1115 | sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; |
| 1100 | - // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +","; | ||
| 1101 | } | 1116 | } |
| 1102 | } | 1117 | } |
| 1103 | } | 1118 | } |
| @@ -1150,10 +1165,369 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -1150,10 +1165,369 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 1150 | sectionRoute.setVersions(versions); | 1165 | sectionRoute.setVersions(versions); |
| 1151 | sectionRoute.setDestroy(destroy); | 1166 | sectionRoute.setDestroy(destroy); |
| 1152 | // 方向 | 1167 | // 方向 |
| 1153 | - sectionRoute.setDirections(directions); | 1168 | + sectionRoute.setDirections(directions); |
| 1169 | + // 保存路段 | ||
| 1154 | sectionRouteRepository.save(sectionRoute); | 1170 | sectionRouteRepository.save(sectionRoute); |
| 1155 | } | 1171 | } |
| 1156 | 1172 | ||
| 1157 | } | 1173 | } |
| 1158 | 1174 | ||
| 1175 | + /** | ||
| 1176 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 1177 | + * | ||
| 1178 | + * @param map: <point:坐标点; name:站点名> | ||
| 1179 | + * | ||
| 1180 | + */ | ||
| 1181 | + @Override | ||
| 1182 | + @Transactional | ||
| 1183 | + public Map<String, Object> matchStation(Map<String, Object> map) { | ||
| 1184 | + boolean isMatch = false; | ||
| 1185 | + double lat = Double.parseDouble(map.get("potion[lat]").toString()); | ||
| 1186 | + double lon = Double.parseDouble(map.get("potion[lng]").toString()); | ||
| 1187 | + Point point = new Point(lon, lat); | ||
| 1188 | + Iterable<Station> Stations = repository.findAll(); | ||
| 1189 | + for (Station s : Stations) { | ||
| 1190 | + String libraryPointstr = s.getbJwpoints(); | ||
| 1191 | + String points[] = libraryPointstr.toString().split(" "); | ||
| 1192 | + Point center = new Point(Double.parseDouble(points[0]), Double.parseDouble(points[1])); | ||
| 1193 | + // 在100m内认为是同一个站点 | ||
| 1194 | + Circle circle = new Circle(center, 100); | ||
| 1195 | + // 匹配到了用数据库中的点替换 | ||
| 1196 | + if (geoUtils.isPointInCircle(point, circle)) { | ||
| 1197 | + map.put("name", s.getStationName().toString()); | ||
| 1198 | + map.put("potion_lng", points[0]); | ||
| 1199 | + map.put("potion_lat", points[1]); | ||
| 1200 | + map.put("isHave", "true"); | ||
| 1201 | + map.put("id", s.getId()); | ||
| 1202 | + isMatch = true; | ||
| 1203 | + break; | ||
| 1204 | + } | ||
| 1205 | + } | ||
| 1206 | + // 如果没有匹配到站点就用这个点 | ||
| 1207 | + if (!isMatch) { | ||
| 1208 | + map.put("potion_lng", lon); | ||
| 1209 | + map.put("potion_lat", lat); | ||
| 1210 | + map.put("isHave", "false"); | ||
| 1211 | + map.put("id", ""); | ||
| 1212 | + } | ||
| 1213 | + return map; | ||
| 1214 | + } | ||
| 1215 | + | ||
| 1216 | + /** | ||
| 1217 | + * @Description :TODO(把上传Gps生成的路线放到缓存表中) | ||
| 1218 | + * | ||
| 1219 | + * @param map: 站点和坐标 | ||
| 1220 | + * | ||
| 1221 | + */ | ||
| 1222 | + @Transactional | ||
| 1223 | + @Override | ||
| 1224 | + public Map<String, Object> cacheSave(Map<String, Object> map) { | ||
| 1225 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 1226 | + try { | ||
| 1227 | + // 站点信息字符传 | ||
| 1228 | + String stationJSON = map.get("stationJSON").equals("") ? "" : map.get("stationJSON").toString(); | ||
| 1229 | + // 路段信息字符串 | ||
| 1230 | + String sectionJSON = map.get("sectionJSON").equals("") ? "" : map.get("sectionJSON").toString(); | ||
| 1231 | + // 方向 | ||
| 1232 | + int directions = Integer.parseInt(map.get("directions").toString()); | ||
| 1233 | + // 是否撤销 | ||
| 1234 | + int destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | ||
| 1235 | + // 版本 | ||
| 1236 | + int versions = map.get("versions").equals("") ? 0 : Integer.parseInt(map.get("versions").toString()); | ||
| 1237 | + // 坐标类型 | ||
| 1238 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 1239 | + // 限速 | ||
| 1240 | + String speedLimitStr = map.get("speedLimit").equals("") ? "" : map.get("speedLimit").toString(); | ||
| 1241 | + // 线路ID | ||
| 1242 | + int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | ||
| 1243 | + // 半径 | ||
| 1244 | + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString()); | ||
| 1245 | + // 图形类型 | ||
| 1246 | + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString(); | ||
| 1247 | + // 线路信息 | ||
| 1248 | + Line resultLine = lineRepository.findOne(lineId); | ||
| 1249 | + // 路段距离 | ||
| 1250 | + Double sectionDistance = 0.0d; | ||
| 1251 | + // 路段时长 | ||
| 1252 | + Double sectionDuration = 0.0d; | ||
| 1253 | + // 里程(上或者下) | ||
| 1254 | + double sumUpOrDownMileage = 0.0d; | ||
| 1255 | + Map<String, Object> resultSaveMapm = new HashMap<String,Object>(); | ||
| 1256 | + String baseRes = map.get("baseRes").equals("") ? "" : map.get("baseRes").toString(); | ||
| 1257 | + | ||
| 1258 | + if(!stationJSON.equals("")) { | ||
| 1259 | + // 保存站点与站点路由信息 | ||
| 1260 | + resultSaveMapm = savaStationAndStationRouteCacheInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine,baseRes); | ||
| 1261 | + } | ||
| 1262 | + // 路段长度 | ||
| 1263 | + sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); | ||
| 1264 | + // 路段时长 | ||
| 1265 | + sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); | ||
| 1266 | + // 如果路段信息JSON字符串不为空 | ||
| 1267 | + if(!sectionJSON.equals("")) { | ||
| 1268 | + SaveSectionAndSectionRouteCache(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions); | ||
| 1269 | + } | ||
| 1270 | + // 里程 | ||
| 1271 | + sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); | ||
| 1272 | + BigDecimal s = new BigDecimal(sumUpOrDownMileage); | ||
| 1273 | + sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1274 | + // 更新里程 | ||
| 1275 | + // updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); | ||
| 1276 | + if(directions==0) { | ||
| 1277 | + // lineUpdateStationName(resultLine); | ||
| 1278 | + } | ||
| 1279 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 1280 | + resultMap.put("stationData", resultSaveMapm.get("stationdata")); | ||
| 1281 | + } catch (Exception e) { | ||
| 1282 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 1283 | + logger.error("save erro.", e); | ||
| 1284 | + } | ||
| 1285 | + | ||
| 1286 | + return resultMap; | ||
| 1287 | + } | ||
| 1288 | + | ||
| 1289 | + /** | ||
| 1290 | + * @param isHaveId 存在站点的id | ||
| 1291 | + * @param isHave 是否存在站点 | ||
| 1292 | + * @Description :TODO(保存站点和缓存站点路由信息) | ||
| 1293 | + * | ||
| 1294 | + */ | ||
| 1295 | + public Map<String, Object> savaStationAndStationRouteCacheInfo(String stationJSON,double sectionDistance,double sectionDuration,String dbType, | ||
| 1296 | + int radius,String shapesType,int destroy,int versions,double sumUpOrDownMileage,int directions,Line resultLine,String baseRes) throws Exception{ | ||
| 1297 | + Map<String, Object> paramsMeleageAndDistncDura = new HashMap<String,Object>(); | ||
| 1298 | + JSONArray stationsArray = JSONArray.parseArray(stationJSON); | ||
| 1299 | + if(stationsArray.size()>0) { | ||
| 1300 | + // 更新路线前删除线路缓存站点 | ||
| 1301 | + routeCacheRepository.stationRouteCacheDel(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1302 | + for(int i = 0;i <stationsArray.size();i++) { | ||
| 1303 | + // 站点名称 | ||
| 1304 | + String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); | ||
| 1305 | + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); | ||
| 1306 | + // 转成公里 | ||
| 1307 | + distance = distance/1000; | ||
| 1308 | + BigDecimal d = new BigDecimal(distance); | ||
| 1309 | + distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1310 | + sectionDistance= distance + sectionDistance; | ||
| 1311 | + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); | ||
| 1312 | + // 转成分钟 | ||
| 1313 | + duration = duration/60; | ||
| 1314 | + BigDecimal t = new BigDecimal(duration); | ||
| 1315 | + duration = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | ||
| 1316 | + sectionDuration = duration + sectionDuration; | ||
| 1317 | + // 百度经纬度坐标 | ||
| 1318 | + String bJwpoints = ""; | ||
| 1319 | + // 百度坐标经度 | ||
| 1320 | + String bLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lng").toString(); | ||
| 1321 | + bLonx = bLonx==null || bLonx.equals("") ? "0" : bLonx; | ||
| 1322 | + // 百度坐标纬度 | ||
| 1323 | + String bLatx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("potion").toString()).get("lat").toString(); | ||
| 1324 | + bLatx = bLatx==null || bLatx.equals("") ? "0" : bLatx; | ||
| 1325 | + List<Object[]> stationNameList = repository.findStationName(directions,stationName); | ||
| 1326 | + //Map<String, Object> isHaveMap = isHaveStationname(bLonx,bLatx,stationNameList); | ||
| 1327 | + // 初始化站点对象 | ||
| 1328 | + Station arg0 = new Station(); | ||
| 1329 | + // 存在的点就不添加到数据库 | ||
| 1330 | + if(Boolean.parseBoolean(stationsArray.getJSONObject(i).get("isHave").toString())) { | ||
| 1331 | + Integer stationId = Integer.parseInt(stationsArray.getJSONObject(i).get("id").toString()); | ||
| 1332 | + arg0 = repository.findOne(stationId); | ||
| 1333 | + }else { | ||
| 1334 | + // 站点编码 | ||
| 1335 | + long stationCode = GetUIDAndCode.getStationId(); | ||
| 1336 | + arg0.setStationCod(String.valueOf(stationCode)); | ||
| 1337 | + arg0.setId((int)stationCode); | ||
| 1338 | + arg0.setStationName(stationName); | ||
| 1339 | + // 原坐标类型 | ||
| 1340 | + arg0.setDbType(dbType); | ||
| 1341 | + 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(); | ||
| 1342 | + 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(); | ||
| 1343 | + float gLonx = 0.0f; | ||
| 1344 | + float gLaty = 0.0f; | ||
| 1345 | + Location resultPoint = null; | ||
| 1346 | + if(baseRes.equals("No")){ | ||
| 1347 | + /** BD to WGS坐标 */ | ||
| 1348 | + resultPoint = FromBDPointToWGSPoint(bLonx,bLatx); | ||
| 1349 | + if(gLonxStr==null) | ||
| 1350 | + gLonx = (float)resultPoint.getLng(); | ||
| 1351 | + else | ||
| 1352 | + gLonx = Float.valueOf(gLonxStr); | ||
| 1353 | + if(gLatyStr==null) | ||
| 1354 | + gLaty = (float)resultPoint.getLat(); | ||
| 1355 | + else | ||
| 1356 | + gLaty = Float.valueOf(gLatyStr); | ||
| 1357 | + arg0.setgLonx(gLonx); | ||
| 1358 | + arg0.setgLaty(gLaty); | ||
| 1359 | + // 百度经纬度 | ||
| 1360 | + bJwpoints = bLonx + " " + bLatx; | ||
| 1361 | + arg0.setbJwpoints(bJwpoints); | ||
| 1362 | + }else if(baseRes.equals("GCJ02")){ | ||
| 1363 | + Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); | ||
| 1364 | + Location location = TransGPS.bd_encrypt(bdLoc); | ||
| 1365 | + String GCJLng = String.valueOf(location.getLng()); | ||
| 1366 | + String GCJLat = String.valueOf(location.getLat()); | ||
| 1367 | + resultPoint = FromBDPointToWGSPoint(GCJLng,GCJLat); | ||
| 1368 | + bJwpoints = GCJLng + " " +GCJLat; | ||
| 1369 | + arg0.setgLonx((float)location.getLng()); | ||
| 1370 | + arg0.setgLaty((float)location.getLat()); | ||
| 1371 | + arg0.setbJwpoints(bJwpoints); | ||
| 1372 | + }else if(baseRes.equals("BD09")){ | ||
| 1373 | + resultPoint = FromBDPointToWGSPoint(gLonxStr, gLatyStr); | ||
| 1374 | + bJwpoints = gLonxStr+ " " + gLatyStr; | ||
| 1375 | + arg0.setgLonx((float)resultPoint.getLng()); | ||
| 1376 | + arg0.setgLaty((float)resultPoint.getLat()); | ||
| 1377 | + }else if(baseRes.equals("WGS84")){ | ||
| 1378 | + Location bdLoc = TransGPS.LocationMake(Double.valueOf(gLonxStr), Double.valueOf(gLatyStr)); | ||
| 1379 | + Location gcjLoc = TransGPS.transformFromWGSToGCJ(bdLoc); | ||
| 1380 | + Location bdEn = TransGPS.bd_encrypt(gcjLoc); | ||
| 1381 | + bJwpoints = String.valueOf(bdEn.getLng()) + " " + String.valueOf(bdEn.getLat()); | ||
| 1382 | + arg0.setbJwpoints(bJwpoints); | ||
| 1383 | + arg0.setgLonx(Float.valueOf(gLonxStr)); | ||
| 1384 | + arg0.setgLaty(Float.valueOf(gLatyStr)); | ||
| 1385 | + } | ||
| 1386 | + arg0.setRadius(radius); | ||
| 1387 | + arg0.setShapesType(shapesType); | ||
| 1388 | + // 是否想撤销 | ||
| 1389 | + arg0.setDestroy(destroy); | ||
| 1390 | + // 版本号 | ||
| 1391 | + arg0.setVersions(versions); | ||
| 1392 | + arg0.setbJwpoints(bJwpoints); | ||
| 1393 | + // 插入站点信息 | ||
| 1394 | + repository.save(arg0); | ||
| 1395 | + | ||
| 1396 | + } | ||
| 1397 | + // 站点路由对象 | ||
| 1398 | + StationRouteCache route = new StationRouteCache(); | ||
| 1399 | + // 站点名称 | ||
| 1400 | + route.setStationName(stationName); | ||
| 1401 | + route.setDistances(distance); | ||
| 1402 | + sumUpOrDownMileage = sumUpOrDownMileage + distance; | ||
| 1403 | + route.setToTime(duration); | ||
| 1404 | + // 站点编码 | ||
| 1405 | + route.setStationCode(arg0.getStationCod()); | ||
| 1406 | + // 站点序号 | ||
| 1407 | + route.setStationRouteCode((i+1)*100); | ||
| 1408 | + // 站点类型 | ||
| 1409 | + if(i==0) { | ||
| 1410 | + // 起始站 | ||
| 1411 | + route.setStationMark("B"); | ||
| 1412 | + }else if(i==stationsArray.size()-1) { | ||
| 1413 | + // 终点站 | ||
| 1414 | + route.setStationMark("E"); | ||
| 1415 | + }else { | ||
| 1416 | + // 中途站 | ||
| 1417 | + route.setStationMark("Z"); | ||
| 1418 | + } | ||
| 1419 | + // 版本号 | ||
| 1420 | + route.setVersions(versions); | ||
| 1421 | + // 站点ID | ||
| 1422 | + route.setStation(arg0); | ||
| 1423 | + // 方向 | ||
| 1424 | + route.setDirections(directions); | ||
| 1425 | + // 线路ID | ||
| 1426 | + route.setLine(resultLine); | ||
| 1427 | + // 线路编码 | ||
| 1428 | + route.setLineCode(resultLine.getLineCode()); | ||
| 1429 | + route.setDestroy(destroy); | ||
| 1430 | + // 插入站点路由信息 | ||
| 1431 | + routeCacheRepository.save(route); | ||
| 1432 | + | ||
| 1433 | + } | ||
| 1434 | + paramsMeleageAndDistncDura.put("sumUpOrDownMileage", sumUpOrDownMileage); | ||
| 1435 | + paramsMeleageAndDistncDura.put("sectionDistance", sectionDistance); | ||
| 1436 | + paramsMeleageAndDistncDura.put("sectionDuration", sectionDuration); | ||
| 1437 | + paramsMeleageAndDistncDura.put("stationdata",stationsArray); | ||
| 1438 | + } | ||
| 1439 | + return paramsMeleageAndDistncDura; | ||
| 1440 | + } | ||
| 1441 | + | ||
| 1442 | + /** | ||
| 1443 | + * @Description :TODO(保存路段和缓存路段路由信息) | ||
| 1444 | + * | ||
| 1445 | + */ | ||
| 1446 | + public void SaveSectionAndSectionRouteCache(String sectionJSON,String speedLimitStr,double sectionDistance, double sectionTime, | ||
| 1447 | + String dbType,Integer versions,Line resultLine,Integer destroy,Integer directions) { | ||
| 1448 | + // 转换成JSON数组 | ||
| 1449 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | ||
| 1450 | + // 更新路线前删除线路缓存路段 | ||
| 1451 | + sectionRouteCacheRepository.sectionRouteCacheDel(Integer.parseInt(resultLine.getLineCode()),directions); | ||
| 1452 | + // 遍历 | ||
| 1453 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 1454 | + // 站点名称 | ||
| 1455 | + String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); | ||
| 1456 | + String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); | ||
| 1457 | + // 原始线状图形坐标集合 | ||
| 1458 | + String sectionsBpoints = ""; | ||
| 1459 | + // WGS线状图形坐标集合 | ||
| 1460 | + String sectionsWJPpoints = ""; | ||
| 1461 | + if(!pointsStr.equals("")){ | ||
| 1462 | + JSONArray pointsArray = JSONArray.parseArray(pointsStr); | ||
| 1463 | + for(int p =0;p<pointsArray.size();p++){ | ||
| 1464 | + String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString(); | ||
| 1465 | + String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString(); | ||
| 1466 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 1467 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 1468 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 1469 | + if(p==pointsArray.size()-1){ | ||
| 1470 | + sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr; | ||
| 1471 | + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr; | ||
| 1472 | + }else { | ||
| 1473 | + sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+","; | ||
| 1474 | + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ","; | ||
| 1475 | + } | ||
| 1476 | + } | ||
| 1477 | + } | ||
| 1478 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 1479 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 1480 | + int sectionId = (int) (sectionMaxId); | ||
| 1481 | + // 交出路 | ||
| 1482 | + String crosesRoad = ""; | ||
| 1483 | + // 终止节点 | ||
| 1484 | + String endNode = ""; | ||
| 1485 | + // 开始节点 | ||
| 1486 | + String startNode = ""; | ||
| 1487 | + // 中间节点 | ||
| 1488 | + String middleNode = ""; | ||
| 1489 | + // WGS坐标点集合 | ||
| 1490 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 1491 | + // 原坐标点集合 | ||
| 1492 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 1493 | + // 城建坐标点集合 | ||
| 1494 | + String csectionVector = ""; | ||
| 1495 | + // 路段类型 | ||
| 1496 | + String sectionType = ""; | ||
| 1497 | + // 道路编码 | ||
| 1498 | + String roadCoding = ""; | ||
| 1499 | + // 限速 | ||
| 1500 | + double speedLimit = Double.parseDouble(speedLimitStr); | ||
| 1501 | + // 说明 | ||
| 1502 | + String descriptions = ""; | ||
| 1503 | + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, | ||
| 1504 | + | ||
| 1505 | + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, | ||
| 1506 | + | ||
| 1507 | + roadCoding, sectionDistance, sectionTime, dbType, speedLimit, | ||
| 1508 | + | ||
| 1509 | + descriptions, versions,sectionId); | ||
| 1510 | + Section section = sectionRepository.findOne(Integer.parseInt(sectionCode)); | ||
| 1511 | + // 路段路由 | ||
| 1512 | + SectionRouteCache sectionRoute = new SectionRouteCache(); | ||
| 1513 | + // 路段序号 | ||
| 1514 | + sectionRoute.setSectionrouteCode((s+1)*100); | ||
| 1515 | + // 线路编码 | ||
| 1516 | + sectionRoute.setLineCode(resultLine.getLineCode()); | ||
| 1517 | + // 路段ID | ||
| 1518 | + sectionRoute.setSection(section); | ||
| 1519 | + // 线路ID | ||
| 1520 | + sectionRoute.setLine(resultLine); | ||
| 1521 | + // 路段编码 | ||
| 1522 | + sectionRoute.setSectionCode(sectionCode); | ||
| 1523 | + // 版本 | ||
| 1524 | + sectionRoute.setVersions(versions); | ||
| 1525 | + sectionRoute.setDestroy(destroy); | ||
| 1526 | + // 方向 | ||
| 1527 | + sectionRoute.setDirections(directions); | ||
| 1528 | + // 保存路段 | ||
| 1529 | + sectionRouteCacheRepository.save(sectionRoute); | ||
| 1530 | + } | ||
| 1531 | + | ||
| 1532 | + } | ||
| 1159 | } | 1533 | } |
src/main/resources/static/pages/base/line/editRoute.html
0 → 100644
| 1 | +<!-- 手动添加站点 --> | ||
| 2 | +<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" aria-hidden="true"> | ||
| 3 | + | ||
| 4 | + <div class="modal-dialog"> | ||
| 5 | + | ||
| 6 | + <div class="modal-content"> | ||
| 7 | + | ||
| 8 | + <div class="modal-header"> | ||
| 9 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 10 | + <h4 class="modal-title">生成路线(站点和路段)</h4> | ||
| 11 | + </div> | ||
| 12 | + | ||
| 13 | + <div class="modal-body"> | ||
| 14 | + | ||
| 15 | + <form class="form-horizontal" role="form" id="save_route_template_form" action="" method=""> | ||
| 16 | + | ||
| 17 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 18 | + 您的输入有误,请检查下面的输入项 | ||
| 19 | + </div> | ||
| 20 | + | ||
| 21 | + <!-- 站点名称 --> | ||
| 22 | + <div class="form-body"> | ||
| 23 | + | ||
| 24 | + <div class="form-group"> | ||
| 25 | + <label class="control-label col-md-2"> | ||
| 26 | + <span class="required"> * </span> 坐标: | ||
| 27 | + </label> | ||
| 28 | + <div class="col-md-10"> | ||
| 29 | + <textarea class="form-control" rows="12" name="points" id="pointInput" placeholder="坐标点"></textarea> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + <div class="form-group"> | ||
| 34 | + <label class="col-md-3 control-label">选择方向:</label> | ||
| 35 | + <div class="col-md-9"> | ||
| 36 | + <div class="icheck-list"> | ||
| 37 | + <label> | ||
| 38 | + <input type="radio" class="icheck" name="dirCheck" value='0' checked> 上行 | ||
| 39 | + </label> | ||
| 40 | + <label> | ||
| 41 | + <input type="radio" class="icheck" name="dirCheck" value='1' > 下行 | ||
| 42 | + </label> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + </div> | ||
| 46 | + <div class="form-group"> | ||
| 47 | + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> | ||
| 48 | + <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 坐标生成路线规划说明: </span></h5> | ||
| 49 | + <p> | ||
| 50 | + <span class="help-block" style="color:#1bbc9b;"> | ||
| 51 | + 请在文本域中按顺序依次输坐标点(如果是站点,请将在坐标后面用【Tab】键隔开后加(站点名/stop);没有(站点名/stop)默认是路段点),每输入完一个坐标时请按回车键【Enter】换行. | ||
| 52 | + 例如:<br> | ||
| 53 | + 121.715623 31.224058 042408.000<br> | ||
| 54 | + 121.715623 31.224065 042409.000 Stop<br> | ||
| 55 | + 121.715623 31.224065 042410.000<br> | ||
| 56 | + </span> | ||
| 57 | + </p> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 60 | + </form> | ||
| 61 | + </div> | ||
| 62 | + <div class="modal-footer"> | ||
| 63 | + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button> | ||
| 64 | + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> | ||
| 65 | + </div> | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | +</div> | ||
| 69 | +<script type="text/javascript"> | ||
| 70 | + | ||
| 71 | +$('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,map,dra,ajaxd,fun){ | ||
| 72 | + // 延迟加载显示mobal | ||
| 73 | + setTimeout(function(){$('#edit_route_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 74 | + // 获取表单元素 | ||
| 75 | + var form = $('#save_route_template_form'); | ||
| 76 | + | ||
| 77 | + // 获取错误提示信息元素 | ||
| 78 | + var error = $('.alert-danger', form); | ||
| 79 | + | ||
| 80 | + // 提交数据点击事件 | ||
| 81 | + $('.modal-footer #templateSaveData').on('click',function() { | ||
| 82 | + form.submit(); | ||
| 83 | + }); | ||
| 84 | + // 表单验证 | ||
| 85 | + form.validate({ | ||
| 86 | + | ||
| 87 | + errorElement : 'span', | ||
| 88 | + | ||
| 89 | + errorClass : 'help-block help-block-error', | ||
| 90 | + | ||
| 91 | + focusInvalid : false, | ||
| 92 | + | ||
| 93 | + rules : { | ||
| 94 | + | ||
| 95 | + 'points' : { | ||
| 96 | + | ||
| 97 | + required : true, | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + }, | ||
| 102 | + | ||
| 103 | + invalidHandler : function(event, validator) { | ||
| 104 | + | ||
| 105 | + error.show(); | ||
| 106 | + | ||
| 107 | + App.scrollTo(error, -200); | ||
| 108 | + | ||
| 109 | + }, | ||
| 110 | + | ||
| 111 | + highlight : function(element) { | ||
| 112 | + | ||
| 113 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 114 | + | ||
| 115 | + }, | ||
| 116 | + | ||
| 117 | + unhighlight : function(element) { | ||
| 118 | + | ||
| 119 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 120 | + | ||
| 121 | + }, | ||
| 122 | + | ||
| 123 | + success : function(label) { | ||
| 124 | + | ||
| 125 | + label.closest('.form-group').removeClass('has-error'); | ||
| 126 | + | ||
| 127 | + }, | ||
| 128 | + submitHandler : function(f) { | ||
| 129 | + // 隐藏手动规划弹出层 | ||
| 130 | + $('#edit_route_mobal').modal('hide'); | ||
| 131 | + // 获取线路对象 | ||
| 132 | + var line = editRoute.getLineObj(); | ||
| 133 | + // 原坐标类型 | ||
| 134 | + var baseRes = "WGS84"; | ||
| 135 | + // 定义线路名称 | ||
| 136 | + var lineNameV = $('.portlet-title .caption').text(); | ||
| 137 | + var dirStr = ''; | ||
| 138 | + // 路线方向 | ||
| 139 | + var directionData = $("input[name='dirCheck']:checked").val(); | ||
| 140 | + editRoute.setLineDir(directionData); | ||
| 141 | + // 弹出正在加载层 | ||
| 142 | + var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 143 | + // 表单序列化 | ||
| 144 | + var paramsForm = form.serializeJSON(); | ||
| 145 | + // 切割坐标点 | ||
| 146 | + var array = paramsForm.points.split('\r\n'); | ||
| 147 | + // 把坐标点转换为站点或路段 | ||
| 148 | + var arrayFormat = inputStationValueFormat(array); | ||
| 149 | + var stationList = arrayFormat.stationList; | ||
| 150 | + var sectionListTemp = arrayFormat.sectionList; | ||
| 151 | + var sectionList = []; | ||
| 152 | + // 隔50个取一个点(相当于50s) | ||
| 153 | + for(var i = 0; i*40 < sectionListTemp.length; i++) { | ||
| 154 | + sectionList[i] = sectionListTemp[i*40]; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + var sectionListFinal = []; | ||
| 158 | + sectionListFinal.push({sectionName : lineNameV, points : sectionList}); | ||
| 159 | + // 根据站点名称获取百度坐标 | ||
| 160 | + map.stationsPointsToLibraryPoint(stationList,function(resultJson) { | ||
| 161 | + // 根据坐标点获取两点之间的时间与距离 | ||
| 162 | + map.getDistanceAndDuration(resultJson,function(stationdataList) { | ||
| 163 | + // 设置第一个站的距离 | ||
| 164 | + stationdataList[0].distance = ''; | ||
| 165 | + // 设置第一个站的时间 | ||
| 166 | + stationdataList[0].duration = ''; | ||
| 167 | + // 定义站点信息JSON字符串 | ||
| 168 | + var stationJSON = JSON.stringify(stationdataList); | ||
| 169 | + // 参数集合 | ||
| 170 | + var params = {}; | ||
| 171 | + params.baseRes = baseRes; | ||
| 172 | + // 是否添加该站点 | ||
| 173 | + | ||
| 174 | + // 站点信息JSON字符串 | ||
| 175 | + params.stationJSON = stationJSON; | ||
| 176 | + // 线路ID | ||
| 177 | + params.lineId = line.id; | ||
| 178 | + // 方向 | ||
| 179 | + params.directions = directionData; | ||
| 180 | + // 原始坐标类型 | ||
| 181 | + params.dbType = 'b'; | ||
| 182 | + // 圆形半径 | ||
| 183 | + params.radius = '100'; | ||
| 184 | + // 限速 | ||
| 185 | + params.speedLimit = '60'; | ||
| 186 | + // 图形类型(r:圆形;p:多边形) | ||
| 187 | + params.shapesType = 'r'; | ||
| 188 | + // destroy:是否撤销 | ||
| 189 | + params.destroy = '0'; | ||
| 190 | + // versions:版本号 | ||
| 191 | + params.versions = '1'; | ||
| 192 | + // 定义路段信息字符串 | ||
| 193 | + var sectionJSON = JSON.stringify(sectionListFinal); | ||
| 194 | + // 路段信息JSON字符串 | ||
| 195 | + params.sectionJSON = sectionJSON; | ||
| 196 | + addSave(params,line.id,directionData); | ||
| 197 | + }); | ||
| 198 | + | ||
| 199 | + }); | ||
| 200 | + }, | ||
| 201 | + | ||
| 202 | + }); | ||
| 203 | + | ||
| 204 | + function inputStationValueFormat(paramsStationsArray) { | ||
| 205 | + var stationList = []; | ||
| 206 | + var sectionList = []; | ||
| 207 | + var routeList = {"stationList":stationList, "sectionList":sectionList}; | ||
| 208 | + var len = paramsStationsArray.length; | ||
| 209 | + // 处理相同站点判断值 | ||
| 210 | + var isPush = true; | ||
| 211 | + for(var k =0;k<len;k++) { | ||
| 212 | + if(paramsStationsArray[k]=="") | ||
| 213 | + continue; | ||
| 214 | + var tempStr = paramsStationsArray[k].split('\t'); | ||
| 215 | + var tempPoint = transGpsLoc(tempStr[0],tempStr[1]); | ||
| 216 | + var point = {lng:tempPoint.lng, lat:tempPoint.lat}; | ||
| 217 | + if(tempStr.length < 4){ | ||
| 218 | + sectionList[k] = point; | ||
| 219 | + isPush = true; | ||
| 220 | + }else { | ||
| 221 | + if(isPush) { | ||
| 222 | + sectionList[k] = point; | ||
| 223 | + stationList.push({name:tempStr[3], potion:{lng:tempPoint.lng, lat:tempPoint.lat} , wgs:{x:tempStr[0], y:tempStr[1]}}); | ||
| 224 | + } | ||
| 225 | + isPush = false; | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + for(var i = 0 ;i<sectionList.length;i++) { | ||
| 229 | + if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { | ||
| 230 | + sectionList.splice(i,1); | ||
| 231 | + i= i-1; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + } | ||
| 235 | + return routeList; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + function transGpsLoc(lng,lat) { | ||
| 239 | + var bdLoc = transGPS.locationMake(lng, lat); | ||
| 240 | + var gcjLoc = transGPS.transformFromWGSToGCJ(bdLoc); | ||
| 241 | + var bdEn = transGPS.bd_encrypt(gcjLoc); | ||
| 242 | + return bdEn; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + function addSave(params,lineid,directionData) { | ||
| 246 | + // 保存 | ||
| 247 | + $post("/station/cacheSave",params,function(rd) { | ||
| 248 | + // 关闭弹出层 | ||
| 249 | + layer.closeAll(); | ||
| 250 | + if(rd.status='SUCCESS') { | ||
| 251 | + layer.msg('生成路线成功!'); | ||
| 252 | + var stationD = rd.stationData,isNullStr = ''; | ||
| 253 | + for(var t = 0 ;t<stationD.length;t++) { | ||
| 254 | + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null || | ||
| 255 | + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null) | ||
| 256 | + isNullStr = isNullStr + stationD[t].name + ' , '; | ||
| 257 | + } | ||
| 258 | + if(isNullStr!='') { | ||
| 259 | + layer.open({ | ||
| 260 | + title: '提示', | ||
| 261 | + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!' | ||
| 262 | + }); | ||
| 263 | + } | ||
| 264 | + // 清除地图覆盖物 | ||
| 265 | + map.clearMarkAndOverlays(); | ||
| 266 | + // 查询路段信息 | ||
| 267 | + $get('/sectionroute/findSectionCache',{'line.id_eq' : lineid , 'directions_eq' : directionData},function(data) { | ||
| 268 | + // 在地图上画出线路走向 | ||
| 269 | + fun.linePanlThree(lineid,data,directionData); | ||
| 270 | + }); | ||
| 271 | + $('#cutSection').removeClass('hidden'); | ||
| 272 | + $('#Undo').removeClass('hidden'); | ||
| 273 | + $('#uploadRoute').addClass('hidden'); | ||
| 274 | + layer.msg('请先编辑路段,然后放大地图切点,不然数据可能会有误差!!!'); | ||
| 275 | + }else { | ||
| 276 | + layer.msg('生成路线失败!'); | ||
| 277 | + } | ||
| 278 | + }); | ||
| 279 | + } | ||
| 280 | +}); | ||
| 281 | +</script> | ||
| 0 | \ No newline at end of file | 282 | \ No newline at end of file |
src/main/resources/static/pages/base/line/editsection.html
0 → 100644
| 1 | +<!-- 编辑路段 --> | ||
| 2 | +<div class="modal fade" id="edit_section_mobal_cache" role="basic" aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | + <h4 class="modal-title">路段修改</h4> | ||
| 8 | + </div> | ||
| 9 | + <div class="modal-body"> | ||
| 10 | + <form class="form-horizontal" role="form" id="edit_section_form_cache" action="" method="post"> | ||
| 11 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 12 | + 您的输入有误,请检查下面的输入项 | ||
| 13 | + </div> | ||
| 14 | + <!-- 线路ID --> | ||
| 15 | + <input type="hidden" name="sectionId" id="sectionIdInput"> | ||
| 16 | + <input type="hidden" name="sectionRouteId" id="sectionRouteIdInput"> | ||
| 17 | + <input type="hidden" name="sectionRouteLine" id="sectionRouteLineInput"> | ||
| 18 | + <input type="hidden" name="lineCode" id="lineCodeInput"> | ||
| 19 | + <input type="hidden" name="bsectionVector" id="bsectionVectorInput" /> | ||
| 20 | + <input type="hidden" name="csectionVector" id="csectionVectorInput" value=""/> | ||
| 21 | + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | ||
| 22 | + <input type="hidden" name="isRoadeSpeed" id="isRoadeSpeedInput"/> | ||
| 23 | + <!-- 路段名称 --> | ||
| 24 | + <div class="form-body"> | ||
| 25 | + <div class="form-group"> | ||
| 26 | + <label class="control-label col-md-3"> | ||
| 27 | + <span class="required"> * </span> 路段名称: | ||
| 28 | + </label> | ||
| 29 | + <div class="col-md-6"> | ||
| 30 | + <input type="text" class="form-control" name="sectionName" id="sectionNameInput" placeholder="路段名称"> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <!-- 路段编码 --> | ||
| 35 | + <div class="form-body"> | ||
| 36 | + <div class="form-group"> | ||
| 37 | + <label class="control-label col-md-3"> | ||
| 38 | + <span class="required"> * </span> 路段编码: | ||
| 39 | + </label> | ||
| 40 | + <div class="col-md-6"> | ||
| 41 | + <input type="text" class="form-control" name="sectionCode" id="sectionCodeInput" placeholder="路段编码" readonly="readonly"> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + <!-- 路段序号 --> | ||
| 46 | + <div class="form-body"> | ||
| 47 | + <div class="form-group"> | ||
| 48 | + <label class="control-label col-md-3"> | ||
| 49 | + 上一路段: | ||
| 50 | + </label> | ||
| 51 | + <div class="col-md-6"> | ||
| 52 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select> | ||
| 53 | + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + <!-- 路段方向 --> | ||
| 58 | + <div class="form-body"> | ||
| 59 | + <div class="form-group"> | ||
| 60 | + <label class="control-label col-md-3"> | ||
| 61 | + <span class="required"> * </span>路段方向: | ||
| 62 | + </label> | ||
| 63 | + <div class="col-md-6"> | ||
| 64 | + <select name="directions" class="form-control" id="directionsSection"> | ||
| 65 | + <option value="">-- 请选择路段类型 --</option> | ||
| 66 | + <option value="0">上行</option> | ||
| 67 | + <option value="1">下行</option> | ||
| 68 | + </select> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + <!-- 路段限速 --> | ||
| 73 | + <div class="form-body"> | ||
| 74 | + <div class="form-group"> | ||
| 75 | + <label class="control-label col-md-3"> | ||
| 76 | + <span class="required"> * </span> 路段限速: | ||
| 77 | + </label> | ||
| 78 | + <div class="col-md-6"> | ||
| 79 | + <input type="text" class="form-control" name="speedLimit" id="speedLimitInput" placeholder="路段限速"> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + <!-- 是否撤销 --> | ||
| 84 | + <div class="form-body"> | ||
| 85 | + <div class="form-group"> | ||
| 86 | + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销:</label> | ||
| 87 | + <div class="col-md-6"> | ||
| 88 | + <select name="destroy" class="form-control" id="destroySelect"> | ||
| 89 | + <option value="">-- 请选择撤销类型 --</option> | ||
| 90 | + <option value="0">否</option> | ||
| 91 | + <option value="1">是</option> | ||
| 92 | + </select> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + </div> | ||
| 96 | + <!-- 道路编码--> | ||
| 97 | + <div class="form-body"> | ||
| 98 | + <div class="form-group"> | ||
| 99 | + <label class="control-label col-md-3">道路编码:</label> | ||
| 100 | + <div class="col-md-6"> | ||
| 101 | + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码"> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + </div> | ||
| 105 | + <!-- 路段长度 --> | ||
| 106 | + <div class="form-body"> | ||
| 107 | + <div class="form-group"> | ||
| 108 | + <label class="col-md-3 control-label">路段长度:</label> | ||
| 109 | + <div class="col-md-6"> | ||
| 110 | + <input type="text" class="form-control" name="sectionDistance" id="sectionDistanceInput" placeholder="路段长度"> | ||
| 111 | + <span class="help-block">单位:公里(km)</span> | ||
| 112 | + </div> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + <!-- 路段历时 --> | ||
| 116 | + <div class="form-body"> | ||
| 117 | + <div class="form-group"> | ||
| 118 | + <label class="col-md-3 control-label">路段历时:</label> | ||
| 119 | + <div class="col-md-6"> | ||
| 120 | + <input type="text" class="form-control" name="sectionTime" id="sectionTimeInput" placeholder="路段历时"> | ||
| 121 | + <span class="help-block">单位:分钟(min)</span> | ||
| 122 | + </div> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + <!-- 版本号 --> | ||
| 126 | + <div class="form-body"> | ||
| 127 | + <div class="form-group"> | ||
| 128 | + <label class="col-md-3 control-label">版本号 :</label> | ||
| 129 | + <div class="col-md-6"> | ||
| 130 | + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | + </div> | ||
| 134 | + <!-- 描述/说明 --> | ||
| 135 | + <div class="form-group"> | ||
| 136 | + <label class="control-label col-md-3"> 描述/说明: </label> | ||
| 137 | + <div class="col-md-6"> | ||
| 138 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + </form> | ||
| 142 | + </div> | ||
| 143 | + <div class="modal-footer"> | ||
| 144 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 145 | + <button type="button" class="btn btn-primary" id="editSectionCacheButton">提交数据</button> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + </div> | ||
| 149 | +</div> | ||
| 150 | +<script type="text/javascript"> | ||
| 151 | + | ||
| 152 | +$('#edit_section_mobal_cache').on('editSectionMobalCache_show', function(e, map_,ajaxd,section,fun){ | ||
| 153 | + var Section = section.getEitdSection(); | ||
| 154 | + fun.setSectionFormValue(Section); | ||
| 155 | + // 方向 | ||
| 156 | + var dir = Section.sectionrouteDirections; | ||
| 157 | + var lineId = Section.sectionrouteLine; | ||
| 158 | + // 获取路段号元素,并添加下拉属性值 | ||
| 159 | + ajaxd.getStation(lineId,dir,function(treeData) { | ||
| 160 | + var array = treeData[0].children[1].children,paramsD =new Array(); | ||
| 161 | + var eq_scetionRouteCode = Section.sectionrouteCode; | ||
| 162 | + paramsD.push({'id':'请选择...','text':'请选择...'}); | ||
| 163 | + // 遍历. | ||
| 164 | + $.each(array, function(i, g){ | ||
| 165 | + // 判断. | ||
| 166 | + if(g.sectionName!='' || g.sectionName != null) { | ||
| 167 | + var ptions_v = g.sectionrouteCode; | ||
| 168 | + if(eq_scetionRouteCode != ptions_v){ | ||
| 169 | + // 添加拼音检索下拉框格式数据数组. | ||
| 170 | + paramsD.push({'id':ptions_v, | ||
| 171 | + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)}); | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + }); | ||
| 175 | + // 初始化上一个路段拼音检索下拉框. | ||
| 176 | + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) { | ||
| 177 | + $('#sectionDirSelect').val('');// 设值方向. | ||
| 178 | + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) { | ||
| 179 | + if(str.length>0){ | ||
| 180 | + var upStationRouteCode = str[0].sectionrouteCode; | ||
| 181 | + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode); | ||
| 182 | + }else { | ||
| 183 | + $('#sectionrouteCodeSelect').select2('val','请选择...'); | ||
| 184 | + } | ||
| 185 | + }); | ||
| 186 | + }); | ||
| 187 | + }); | ||
| 188 | + // 显示mobal | ||
| 189 | + $('#edit_section_mobal_cache').modal({show : true,backdrop: 'static',keyboard: false}); | ||
| 190 | + // 当调用 hide 实例方法时触发 | ||
| 191 | + $('#edit_section_mobal_cache').on('hide.bs.modal', function () { | ||
| 192 | + closeMobleSetClean(); | ||
| 193 | + }); | ||
| 194 | + function closeMobleSetClean() { | ||
| 195 | + // 清除地图覆盖物 | ||
| 196 | + map_.clearMarkAndOverlays(); | ||
| 197 | + /** 设置修改路段集合对象为空 */ | ||
| 198 | + section.setEitdSection({}); | ||
| 199 | + // fun.editAChangeCssRemoveDisabled(); | ||
| 200 | + $get('/sectionroute/findSectionCache',{'line.id_eq' : lineId , 'directions_eq' : dir},function(data) { | ||
| 201 | + fun.linePanlThree(lineId,data,dir); | ||
| 202 | + }); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + // 编辑表单元素 | ||
| 206 | + var form = $('#edit_section_form_cache'); | ||
| 207 | + // 获取错误提示元素 | ||
| 208 | + var error = $('.alert-danger', form); | ||
| 209 | + // 提交数据按钮事件 | ||
| 210 | + $('#editSectionCacheButton').on('click', function() { | ||
| 211 | + // 表单提交 | ||
| 212 | + form.submit(); | ||
| 213 | + }); | ||
| 214 | + // 表单验证 | ||
| 215 | + form.validate({ | ||
| 216 | + errorElement : 'span', | ||
| 217 | + errorClass : 'help-block help-block-error', | ||
| 218 | + focusInvalid : false, | ||
| 219 | + rules : { | ||
| 220 | + 'sectionName' : {required : true,maxlength:50},// 路段名称 必填项 | ||
| 221 | + 'sectionCode': {required : true,},// 路段编码 必填项 | ||
| 222 | + 'directions' : {required : true,},// 路段方向 必填项 | ||
| 223 | + 'speedLimit' : {required : true,number : true},// 路段限速 必须输入合法的数字(负数,小数)。 | ||
| 224 | + 'destroy' : {required : true,},// 是否撤销 必填项. | ||
| 225 | + 'roadCoding' : {number : true},// 道路编码 必须输入合法的数字(负数,小数)。 | ||
| 226 | + 'sectionTime' : {number : true},// 路段时长 必须输入合法的数字(负数,小数)。 | ||
| 227 | + 'sectionDistance' : {number : true},// 路段长度 必须输入合法的数字(负数,小数)。 | ||
| 228 | + 'descriptions' : {maxlength: 150}// 描述与说明 最大长度. | ||
| 229 | + }, | ||
| 230 | + invalidHandler : function(event, validator) { | ||
| 231 | + error.show(); | ||
| 232 | + App.scrollTo(error, -200); | ||
| 233 | + }, | ||
| 234 | + highlight : function(element) { | ||
| 235 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 236 | + }, | ||
| 237 | + unhighlight : function(element) { | ||
| 238 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 239 | + }, | ||
| 240 | + success : function(label) { | ||
| 241 | + label.closest('.form-group').removeClass('has-error'); | ||
| 242 | + }, | ||
| 243 | + submitHandler : function(f) { | ||
| 244 | + var params = form.serializeJSON(); | ||
| 245 | + error.hide(); | ||
| 246 | + if(params.sectionrouteCode=='请选择...') { | ||
| 247 | + params.sectionrouteCode=''; | ||
| 248 | + } | ||
| 249 | + $post('/section/sectionCacheUpdate',params,function(resuntDate) { | ||
| 250 | + if(resuntDate.status=='SUCCESS') { | ||
| 251 | + // 弹出添加成功提示消息 | ||
| 252 | + layer.msg('修改成功...'); | ||
| 253 | + }else { | ||
| 254 | + // 弹出添加失败提示消息 | ||
| 255 | + layer.msg('修改失败...'); | ||
| 256 | + } | ||
| 257 | + $('#edit_section_mobal_cache').modal('hide'); | ||
| 258 | + closeMobleSetClean(); | ||
| 259 | + }); | ||
| 260 | + } | ||
| 261 | + }); | ||
| 262 | +}); | ||
| 263 | +</script> | ||
| 0 | \ No newline at end of file | 264 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/editRoute.js
0 → 100644
| 1 | +/** 生成路线类 */ | ||
| 2 | +var EditRoute = function(){ | ||
| 3 | + | ||
| 4 | + var line={}; | ||
| 5 | + | ||
| 6 | + /** 定义修改线路对象 */ | ||
| 7 | + | ||
| 8 | + var editRoute = { | ||
| 9 | + getLineObj : function() { | ||
| 10 | + return line; | ||
| 11 | + }, | ||
| 12 | + setLineId : function(id) { | ||
| 13 | + line.id = id; | ||
| 14 | + }, | ||
| 15 | + setLineDir : function(dir) { | ||
| 16 | + | ||
| 17 | + line.dir = dir; | ||
| 18 | + }, | ||
| 19 | + }; | ||
| 20 | + | ||
| 21 | + return editRoute; | ||
| 22 | +}(); |
src/main/resources/static/pages/base/line/js/line-add-form.js
| @@ -94,7 +94,7 @@ $(function(){ | @@ -94,7 +94,7 @@ $(function(){ | ||
| 94 | // 需要验证的表单元素 | 94 | // 需要验证的表单元素 |
| 95 | rules : { | 95 | rules : { |
| 96 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. | 96 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 97 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | 97 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. |
| 98 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. | 98 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 99 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. | 99 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 100 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. | 100 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| @@ -116,7 +116,6 @@ $(function(){ | @@ -116,7 +116,6 @@ $(function(){ | ||
| 116 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. | 116 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 117 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. | 117 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 118 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. | 118 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 119 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | ||
| 120 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 | 119 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 121 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 | 120 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 122 | }, | 121 | }, |
src/main/resources/static/pages/base/line/js/line-edit-form.js
| @@ -149,7 +149,7 @@ | @@ -149,7 +149,7 @@ | ||
| 149 | // 需要验证的表单元素 | 149 | // 需要验证的表单元素 |
| 150 | rules : { | 150 | rules : { |
| 151 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. | 151 | 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. |
| 152 | - 'lineCode' : {required : true,maxlength: 30},// 线路编码 必填项、最大长度. | 152 | + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度. |
| 153 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. | 153 | 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. |
| 154 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. | 154 | 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. |
| 155 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. | 155 | 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. |
| @@ -171,7 +171,6 @@ | @@ -171,7 +171,6 @@ | ||
| 171 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. | 171 | 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度. |
| 172 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. | 172 | 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度. |
| 173 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. | 173 | 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度. |
| 174 | - 'warrantCar' : {number : true,digits : true,maxlength: 8}, | ||
| 175 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 | 174 | 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 176 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 | 175 | 'descriptions' : {maxlength: 200}// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。 |
| 177 | }, | 176 | }, |
src/main/resources/static/pages/base/line/js/line-list-function.js
0 → 100644
| 1 | +var PublicFunctions = function () { | ||
| 2 | + var PubFun = { | ||
| 3 | + /** 初始化线路标题与ID */ | ||
| 4 | + setTiteText : function(lineId) { | ||
| 5 | + // 根据线路ID获取线路名称 | ||
| 6 | + GetAjaxData.getIdLineName(lineId,function(data) { | ||
| 7 | + // 定义线路名称 | ||
| 8 | + var lineNameV = data.name; | ||
| 9 | + $('.portlet-title .caption').text(lineNameV); | ||
| 10 | + }); | ||
| 11 | + }, | ||
| 12 | + setSectionFormValue : function(Section) { | ||
| 13 | + $('#isRoadeSpeedInput').val(Section.isRoadeSpeed); | ||
| 14 | + // 路段ID | ||
| 15 | + $('#sectionIdInput').val(Section.sectionId); | ||
| 16 | + // 路段路由ID | ||
| 17 | + $('#sectionRouteIdInput').val(Section.sectionrouteId); | ||
| 18 | + // 线路ID | ||
| 19 | + $('#sectionRouteLineInput').val(Section.sectionrouteLine); | ||
| 20 | + // 线路编码 | ||
| 21 | + $('#lineCodeInput').val(Section.sectionrouteLineCode); | ||
| 22 | + // 折线坐标集合 | ||
| 23 | + $('#bsectionVectorInput').val(Section.sectionBsectionVector); | ||
| 24 | + // 路段名称 | ||
| 25 | + $('#sectionNameInput').val(Section.sectionName); | ||
| 26 | + // 路段编码 | ||
| 27 | + $('#sectionCodeInput').val(Section.sectionCode); | ||
| 28 | + // 路段序号 | ||
| 29 | + $('#sectionrouteCodeSelect').val(Section.sectionrouteCode); | ||
| 30 | + // 路段方向 | ||
| 31 | + $('#directionsSection').val(Section.sectionrouteDirections); | ||
| 32 | + // 道路编码 | ||
| 33 | + $('#roadCodingCodInput').val(Section.sectionRoadCoding); | ||
| 34 | + // 道路限速 | ||
| 35 | + $('#speedLimitInput').val(Section.sectionSpeedLimet); | ||
| 36 | + // 路段长度 | ||
| 37 | + $('#sectionDistanceInput').val(Section.sectionDistance); | ||
| 38 | + // 时长 | ||
| 39 | + $('#sectionTimeInput').val(Section.sectionTime); | ||
| 40 | + // 版本号 | ||
| 41 | + $('#versionsInput').val(Section.versions); | ||
| 42 | + // 是否撤销 | ||
| 43 | + $('#destroySelect').val(Section.destroy); | ||
| 44 | + // 描述/说明 | ||
| 45 | + $('#descriptionsTextarea').val(Section.descriptions); | ||
| 46 | + }, | ||
| 47 | + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 48 | + linePanlThree : function(lineId,data,direction) { | ||
| 49 | + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ | ||
| 50 | + $get('/stationroute/getStationRouteCacheCenterPoints',{lineId:lineId,direction:direction},function(resultdata) { | ||
| 51 | + WorldsBMapLine.clearMarkAndOverlays(); | ||
| 52 | + var polyline_center; | ||
| 53 | + // 如果站点路由数据不为空 | ||
| 54 | + if(resultdata.length>0) { | ||
| 55 | + var ceter_index = Math.floor(resultdata.length / 2); | ||
| 56 | + var ceterPointsStr = resultdata[ceter_index].bJwpoints; | ||
| 57 | + var ceterPointsArray = ceterPointsStr.split(' '); | ||
| 58 | + polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]); | ||
| 59 | + // 遍历站点路由数据 | ||
| 60 | + for(var s = 0 ; s<resultdata.length;s++) { | ||
| 61 | + // 中心点坐标字符串 | ||
| 62 | + var bJwpointsStr = resultdata[s].bJwpoints; | ||
| 63 | + var stationName = resultdata[s].stationName; | ||
| 64 | + // 起个中心点坐标字符串 | ||
| 65 | + var bJwpointsArray = bJwpointsStr.split(' '); | ||
| 66 | + // 设置中心点 | ||
| 67 | + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); | ||
| 68 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | ||
| 69 | + WorldsBMapLine.drawingUpStationPoint(point_center,stationName,s+1); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + } | ||
| 73 | + // 路段数据长度 | ||
| 74 | + var dataLen = data.length; | ||
| 75 | + //debugger; | ||
| 76 | + // 如果大于零 | ||
| 77 | + if(dataLen>0) { | ||
| 78 | + // 编辑路段数据 | ||
| 79 | + for(var d= 0; d<dataLen;d++){ | ||
| 80 | + // 地图折线坐标点集合 | ||
| 81 | + var polylineArray = []; | ||
| 82 | + // 获取路段折线坐标字符串 | ||
| 83 | + var sectionBsectionVectorStr = data[d].sectionBsectionVector; | ||
| 84 | + if(sectionBsectionVectorStr==null) | ||
| 85 | + continue; | ||
| 86 | + // 切割段折线坐标字符串 | ||
| 87 | + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | ||
| 88 | + // 分割折线坐标字符串 | ||
| 89 | + var lineArray = tempStr.split(','); | ||
| 90 | + for(var i = 0;i<lineArray.length;i++) { | ||
| 91 | + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | ||
| 92 | + } | ||
| 93 | + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */ | ||
| 94 | + WorldsBMapLine.drawingUpline01(polylineArray,polyline_center,data[d]); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + }); | ||
| 98 | + }, | ||
| 99 | + // 方向代码转名称. | ||
| 100 | + dirdmToName : function(value){ | ||
| 101 | + var srStr = ''; | ||
| 102 | + if(value=='0') | ||
| 103 | + srStr = '上行'; | ||
| 104 | + else if(value=='1') | ||
| 105 | + srStr = '下行'; | ||
| 106 | + return srStr; | ||
| 107 | + }, | ||
| 108 | +// editAChangeCssRemoveDisabled : function() { | ||
| 109 | +// $('#downLine').removeClass('btn disabled'); | ||
| 110 | +// $('.btn-circle').removeClass('disabled'); | ||
| 111 | +// $('#upLine').removeClass('btn disabled'); | ||
| 112 | +// }, | ||
| 113 | + } | ||
| 114 | + return PubFun ; | ||
| 115 | +}(); | ||
| 0 | \ No newline at end of file | 116 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-map.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 百度地图 | ||
| 3 | + * | ||
| 4 | + * - - - - - -》init:地图初始化 | ||
| 5 | + * | ||
| 6 | + * - - - - - -》getDistanceAndDuration:获取距离与时间 | ||
| 7 | + * | ||
| 8 | + * - - - - - -》drawingUpline:在地图上画出上行线路走向 | ||
| 9 | + * | ||
| 10 | + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +var WorldsBMapLine = function () { | ||
| 14 | + | ||
| 15 | + /** WorldsBMapLine 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | ||
| 16 | + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | ||
| 17 | + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | ||
| 18 | + | ||
| 19 | + var Bmap = { | ||
| 20 | + | ||
| 21 | + init : function() { | ||
| 22 | + | ||
| 23 | + // 设置中心点, | ||
| 24 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | ||
| 25 | + | ||
| 26 | + // 百度API Key | ||
| 27 | + var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | ||
| 28 | + | ||
| 29 | + // 初始化百度地图 | ||
| 30 | + mapBValue = new BMap.Map("bmap_basic"); | ||
| 31 | + | ||
| 32 | + //中心点和缩放级别 | ||
| 33 | + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | ||
| 34 | + | ||
| 35 | + //启用地图拖拽事件,默认启用(可不写) | ||
| 36 | + mapBValue.enableDragging(); | ||
| 37 | + | ||
| 38 | + //启用地图滚轮放大缩小 | ||
| 39 | + mapBValue.enableScrollWheelZoom(); | ||
| 40 | + | ||
| 41 | + //禁用鼠标双击放大 | ||
| 42 | + mapBValue.disableDoubleClickZoom(); | ||
| 43 | + | ||
| 44 | + //启用键盘上下左右键移动地图 | ||
| 45 | + mapBValue.enableKeyboard(); | ||
| 46 | + | ||
| 47 | + return mapBValue; | ||
| 48 | + }, | ||
| 49 | + /** 获取第一个切路段的点 @return Point*/ | ||
| 50 | + getFirstPoint : function() { | ||
| 51 | + return firstPoint; | ||
| 52 | + }, | ||
| 53 | + /** 获取地图对象 @return 地图对象map */ | ||
| 54 | + getmapBValue : function() { | ||
| 55 | + | ||
| 56 | + return mapBValue; | ||
| 57 | + | ||
| 58 | + }, | ||
| 59 | + | ||
| 60 | + getPolyUpline : function() { | ||
| 61 | + | ||
| 62 | + return polyUpline; | ||
| 63 | + }, | ||
| 64 | + | ||
| 65 | + /** 获取截取过的路段 @return 路段对象List */ | ||
| 66 | + getSectionList : function() { | ||
| 67 | + | ||
| 68 | + return sectionList; | ||
| 69 | + | ||
| 70 | + }, | ||
| 71 | + setSectionList : function(list) { | ||
| 72 | + | ||
| 73 | + sectionList = list; | ||
| 74 | + }, | ||
| 75 | + initCutSectionPoint : function() { | ||
| 76 | + sectionList = []; | ||
| 77 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 78 | + $('#section_table tbody').html(tbodyHtml); | ||
| 79 | + }, | ||
| 80 | + /** 获取切路段的点下标 @return int*/ | ||
| 81 | + setPointIndex : function(index) { | ||
| 82 | + pointIndex = index; | ||
| 83 | + }, | ||
| 84 | + getPointIndex : function() { | ||
| 85 | + | ||
| 86 | + return pointIndex; | ||
| 87 | + | ||
| 88 | + }, | ||
| 89 | + /** 获取路段是否在编辑状态 @return boolean*/ | ||
| 90 | + getIsEditStatus : function() { | ||
| 91 | + return iseditStatus; | ||
| 92 | + }, | ||
| 93 | + setIsEditStatus : function(v) { | ||
| 94 | + iseditStatus = v ; | ||
| 95 | + }, | ||
| 96 | + | ||
| 97 | + /** 获取路段是否在截取状态 @return boolean*/ | ||
| 98 | + getIsCutSection : function() { | ||
| 99 | + return isCutSection; | ||
| 100 | + }, | ||
| 101 | + setIsCutSection : function(v) { | ||
| 102 | + isCutSection = v ; | ||
| 103 | + }, | ||
| 104 | + | ||
| 105 | + /** 获取距离与时间 @param <points:坐标点集合> */ | ||
| 106 | + getDistanceAndDuration : function(points,callback){ | ||
| 107 | + | ||
| 108 | + // 获取长度 | ||
| 109 | + var len = points.length; | ||
| 110 | + (function(){ | ||
| 111 | + | ||
| 112 | + if (!arguments.callee.count) { | ||
| 113 | + | ||
| 114 | + arguments.callee.count = 0; | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + arguments.callee.count++; | ||
| 119 | + | ||
| 120 | + var index = parseInt(arguments.callee.count) - 1; | ||
| 121 | + | ||
| 122 | + if (index >= len-1) { | ||
| 123 | + | ||
| 124 | + callback && callback(points); | ||
| 125 | + | ||
| 126 | + return; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | ||
| 130 | + var f = arguments.callee; | ||
| 131 | + // 起点坐标 <坐标格式:40.056878,116.30815> | ||
| 132 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | ||
| 133 | + | ||
| 134 | + // 终点坐标 <坐标格式:40.056878,116.30815> | ||
| 135 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | ||
| 136 | + var region = '上海'; | ||
| 137 | + | ||
| 138 | + var origin_region = '上海'; | ||
| 139 | + | ||
| 140 | + var destination_region = '上海'; | ||
| 141 | + | ||
| 142 | + var output = 'json'; | ||
| 143 | + | ||
| 144 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | ||
| 145 | + | ||
| 146 | + /** | ||
| 147 | + * origin:起点名称或经纬度; | ||
| 148 | + * | ||
| 149 | + * destination:终点名称或经纬度; | ||
| 150 | + * | ||
| 151 | + * origin_region:起始点所在城市,驾车导航时必填。 | ||
| 152 | + * | ||
| 153 | + * destination_region:终点所在城市,驾车导航时必填。 | ||
| 154 | + * | ||
| 155 | + * output :表示输出类型,可设置为xml或json,默认为xml。 | ||
| 156 | + * | ||
| 157 | + **/ | ||
| 158 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | ||
| 159 | + | ||
| 160 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | ||
| 161 | + $.ajax({ | ||
| 162 | + | ||
| 163 | + // 百度地图根据坐标获取两点之间的时间与距离 | ||
| 164 | + url: 'http://api.map.baidu.com/direction/v1?mode=transit', | ||
| 165 | + | ||
| 166 | + data: paramsB, | ||
| 167 | + | ||
| 168 | + dataType: 'jsonp', | ||
| 169 | + | ||
| 170 | + success: function(r){ | ||
| 171 | + | ||
| 172 | + if(r) { | ||
| 173 | + | ||
| 174 | + if(r.message=='ok') { | ||
| 175 | + | ||
| 176 | + if(r.result.taxi==null) { | ||
| 177 | + | ||
| 178 | + // 获取距离(单位:米) | ||
| 179 | + points[index+1].distance = 0; | ||
| 180 | + | ||
| 181 | + // 获取时间(单位:秒) | ||
| 182 | + points[index+1].duration = 0; | ||
| 183 | + | ||
| 184 | + }else { | ||
| 185 | + | ||
| 186 | + // 获取距离(单位:米) | ||
| 187 | + points[index+1].distance = r.result.taxi.distance; | ||
| 188 | + | ||
| 189 | + // 获取时间(单位:秒) | ||
| 190 | + points[index+1].duration = r.result.taxi.duration; | ||
| 191 | + | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + f(); | ||
| 200 | + } | ||
| 201 | + }); | ||
| 202 | + | ||
| 203 | + })(); | ||
| 204 | + | ||
| 205 | + }, | ||
| 206 | + // 在地图上画出上行线路走向 | ||
| 207 | + drawingUpline01 : function (polylineArray,polyline_center,data) { | ||
| 208 | + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | ||
| 209 | + // 创建线路走向 | ||
| 210 | + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | ||
| 211 | + polyUpline01.data = data; | ||
| 212 | + // 把折线添加到地图上 | ||
| 213 | + mapBValue.addOverlay(polyUpline01); | ||
| 214 | + var sectionPoint = []; | ||
| 215 | + // 线路单击事件 | ||
| 216 | + polyUpline01.addEventListener('click',function(e) { | ||
| 217 | + if(WorldsBMapLine.getIsEditStatus()) { | ||
| 218 | + layer.msg('请先保存正在编辑的路段信息...'); | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + if(WorldsBMapLine.getIsCutSection()) { | ||
| 222 | + layer.msg('请先撤销所有切路段的点...'); | ||
| 223 | + return false; | ||
| 224 | + } | ||
| 225 | + polyUpline01.enableEditing(); | ||
| 226 | + WorldsBMapLine.setIsEditStatus(true); | ||
| 227 | + }); | ||
| 228 | + | ||
| 229 | + // 添加路段双击事件 | ||
| 230 | + polyUpline01.addEventListener("dblclick",function(e){ | ||
| 231 | + if(WorldsBMapLine.getIsCutSection()) { | ||
| 232 | + layer.msg('请先撤销所有切路段的点...'); | ||
| 233 | + return false; | ||
| 234 | + } | ||
| 235 | + WorldsBMapLine.setIsEditStatus(false); | ||
| 236 | + // 关闭 | ||
| 237 | + layer.closeAll(); | ||
| 238 | + polyUpline01.disableEditing(); | ||
| 239 | + EditSectionObj.setEitdSection(polyUpline01.data); | ||
| 240 | + // 获取折线坐标集合 | ||
| 241 | + var editPloyLineArray = polyUpline01.getPath(); | ||
| 242 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 243 | + sectionList = []; | ||
| 244 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 245 | + // 截取路段 | ||
| 246 | + $('#section_table tbody').html(tbodyHtml); | ||
| 247 | + // 加载修改路段弹出层mobal页面 | ||
| 248 | + $.get('editsection.html', function(m){ | ||
| 249 | + $(pjaxContainer).append(m); | ||
| 250 | + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [WorldsBMapLine,GetAjaxData,EditSectionObj,PublicFunctions]); | ||
| 251 | + }); | ||
| 252 | + }); | ||
| 253 | + | ||
| 254 | + // 路段右击事件 | ||
| 255 | + var editSection = function(e,ee,marker){ | ||
| 256 | + if(WorldsBMapLine.getIsEditStatus()) { | ||
| 257 | + layer.msg('请先保存正在编辑的路段信息...'); | ||
| 258 | + return false; | ||
| 259 | + } | ||
| 260 | + var lng = e.lng; | ||
| 261 | + var lat = e.lat; | ||
| 262 | + var sectionName = null; | ||
| 263 | + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | ||
| 264 | + marker.isFlag = true; | ||
| 265 | + if(pointIndex == 0) { | ||
| 266 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | ||
| 267 | + layer.msg('进入切路段状态,请选择本路段的终点!'); | ||
| 268 | + mapBValue.addOverlay(marker);// 添加覆盖物 | ||
| 269 | + firstPoint = {lng:lng, lat:lat}; | ||
| 270 | + pointIndex++; | ||
| 271 | + EditSectionObj.setEitdSection(polyUpline01.data); | ||
| 272 | + // 获取折线坐标集合 | ||
| 273 | + var editPloyLineArray = polyUpline01.getPath(); | ||
| 274 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 275 | + } else if (pointIndex > 0) { | ||
| 276 | + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | ||
| 277 | + pointList = []; | ||
| 278 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | ||
| 279 | + pointList[0] = sectionPoint[pointIndex-1]; | ||
| 280 | + pointList[1] = sectionPoint[pointIndex]; | ||
| 281 | + sectionList.push({name:sectionName, section:pointList}); | ||
| 282 | + layer.close(index); | ||
| 283 | + layer.msg('路段截取成功,请选择下一个路段的终点'); | ||
| 284 | + mapBValue.addOverlay(marker);// 添加覆盖物 | ||
| 285 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 286 | + // 截取路段 | ||
| 287 | + $('#section_table tbody').html(tbodyHtml); | ||
| 288 | + pointIndex++; | ||
| 289 | + }); | ||
| 290 | + } | ||
| 291 | + WorldsBMapLine.setIsCutSection(true); | ||
| 292 | + } | ||
| 293 | + var markerMenu=new BMap.ContextMenu(); | ||
| 294 | + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | ||
| 295 | + polyUpline01.addContextMenu(markerMenu); | ||
| 296 | + | ||
| 297 | + | ||
| 298 | + var PanOptions_ ={noAnimation :true}; | ||
| 299 | + mapBValue.reset(); | ||
| 300 | + mapBValue.panTo(polyline_center,PanOptions_); | ||
| 301 | + mapBValue.panBy(500,-510,PanOptions_); | ||
| 302 | + mapBValue.setZoom(14); | ||
| 303 | + }, | ||
| 304 | + // 删除点刷新cutSectionTable | ||
| 305 | + refreshCutSectionTable : function() { | ||
| 306 | + var tbodyHtml = template('section_list',{list : sectionList}); | ||
| 307 | + $('#section_table tbody').html(tbodyHtml); | ||
| 308 | + }, | ||
| 309 | + // 删除点刷新覆盖物 | ||
| 310 | + deleteCutSectionPoint : function(point) { | ||
| 311 | + var lng = point.lng; | ||
| 312 | + var lat = point.lat; | ||
| 313 | + var allOverlay = mapBValue.getOverlays(); | ||
| 314 | + // 删除最后一个点 | ||
| 315 | + for (var i = 0; i < allOverlay.length -1; i++){ | ||
| 316 | + if(allOverlay[i].isFlag) { | ||
| 317 | + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | ||
| 318 | + mapBValue.removeOverlay(allOverlay[i]); | ||
| 319 | + break; | ||
| 320 | + } | ||
| 321 | + } | ||
| 322 | + } | ||
| 323 | + }, | ||
| 324 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | ||
| 325 | + drawingUpStationPoint : function(point_center,stationName,s) { | ||
| 326 | + | ||
| 327 | + // 自定义标注物图片 | ||
| 328 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | ||
| 329 | + | ||
| 330 | + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | ||
| 331 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | ||
| 332 | + + '</div>' | ||
| 333 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | ||
| 334 | + | ||
| 335 | + | ||
| 336 | + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | ||
| 337 | + "anchor" : new BMap.Size(-10,8), | ||
| 338 | + "enableDragging" : true}); | ||
| 339 | + | ||
| 340 | + | ||
| 341 | + myRichMarker1.disableDragging(); | ||
| 342 | + mapBValue.addOverlay(myRichMarker1); | ||
| 343 | + | ||
| 344 | + | ||
| 345 | + // 创建标注物 | ||
| 346 | + marker = new BMap.Marker(point_center,{icon : icon_target}); | ||
| 347 | + | ||
| 348 | + // 允许覆盖物在map.clearOverlays方法中被清除。 | ||
| 349 | + marker.enableMassClear(); | ||
| 350 | + | ||
| 351 | + mapBValue.addOverlay(marker); | ||
| 352 | + }, | ||
| 353 | + | ||
| 354 | + // 根据站点坐标匹配库中的公交站点(手动规划) | ||
| 355 | + stationsPointsToLibraryPoint : function(arra,callback) { | ||
| 356 | + // 获取长度 | ||
| 357 | + var len = arra.length; | ||
| 358 | + var station = {}; | ||
| 359 | + var stationList = []; | ||
| 360 | + (function(){ | ||
| 361 | + if (!arguments.callee.count) { | ||
| 362 | + arguments.callee.count = 0; | ||
| 363 | + } | ||
| 364 | + arguments.callee.count++; | ||
| 365 | + var index = parseInt(arguments.callee.count) - 1; | ||
| 366 | + if (index >= len) { | ||
| 367 | + callback && callback(stationList); | ||
| 368 | + return ; | ||
| 369 | + } | ||
| 370 | + var f = arguments.callee; | ||
| 371 | + station = arra[index]; | ||
| 372 | + if(arra[index].name!=''){ | ||
| 373 | + | ||
| 374 | + $.get('/station/matchStation',station,function(resultStation) { | ||
| 375 | + stationList.push({name:resultStation.name ,wgs:arra[index].wgs,potion:{lng:resultStation.potion_lng, lat:resultStation.potion_lat}, isHave:resultStation.isHave , id:resultStation.id}); | ||
| 376 | + f(); | ||
| 377 | + }); | ||
| 378 | + }else { | ||
| 379 | + f(); | ||
| 380 | + } | ||
| 381 | + })() | ||
| 382 | + }, | ||
| 383 | + clearMarkAndOverlays : function() { | ||
| 384 | + | ||
| 385 | + // 清楚地图覆盖物 | ||
| 386 | + mapBValue.clearOverlays(); | ||
| 387 | + | ||
| 388 | + mapBValue.removeOverlay(); | ||
| 389 | + | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + return Bmap; | ||
| 395 | + | ||
| 396 | +}(); | ||
| 0 | \ No newline at end of file | 397 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -116,7 +116,7 @@ | @@ -116,7 +116,7 @@ | ||
| 116 | } | 116 | } |
| 117 | function getComp(cb) { | 117 | function getComp(cb) { |
| 118 | $.get('/user/companyData',null,function(rs) { | 118 | $.get('/user/companyData',null,function(rs) { |
| 119 | - return cb && cb(rs); | 119 | + return cb && cb(rs); |
| 120 | }); | 120 | }); |
| 121 | } | 121 | } |
| 122 | function getParams() { | 122 | function getParams() { |
| @@ -330,4 +330,44 @@ | @@ -330,4 +330,44 @@ | ||
| 330 | }); | 330 | }); |
| 331 | } | 331 | } |
| 332 | }); | 332 | }); |
| 333 | + /** 生成路线(路段和站点) */ | ||
| 334 | + $('#datatable_ajax_tools #editRoute').on('click', function() { | ||
| 335 | + // 获取选中行. | ||
| 336 | + var arrChk = $("input[type='checkbox']:checked"); | ||
| 337 | + var len = arrChk.length; | ||
| 338 | + // 选中行ID与线路名称 | ||
| 339 | + var id = '', lineName = ''; | ||
| 340 | + if(len>1) { | ||
| 341 | + // 弹出添加成功提示消息 | ||
| 342 | + layer.msg('存在多选,请只选中一行!'); | ||
| 343 | + return ; | ||
| 344 | + }else if(len==0) { | ||
| 345 | + // 弹出添加成功提示消息 | ||
| 346 | + layer.msg('请选中一条线路!'); | ||
| 347 | + return ; | ||
| 348 | + }else { | ||
| 349 | + id = arrChk.data('id'); | ||
| 350 | + /*$('#uploadRoute').on('click', function() { | ||
| 351 | + EditRoute.setLineId(id); | ||
| 352 | + EditRoute.setLineDir(direction); | ||
| 353 | + $.get('editRoute.html', function(m){ | ||
| 354 | + $(pjaxContainer).append(m); | ||
| 355 | + $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]); | ||
| 356 | + }); | ||
| 357 | + // 更新section_table 和缓存中的一切过的点数 | ||
| 358 | + WorldsBMapLine.initCutSectionPoint(); | ||
| 359 | + WorldsBMapLine.setPointIndex(0); | ||
| 360 | + });*/ | ||
| 361 | + // 设置路线的线路id | ||
| 362 | + //var a = EditRoute.setLineId(id); | ||
| 363 | + // 显示地图 | ||
| 364 | + /*var param = {}; | ||
| 365 | + var list = [1,2,3]; | ||
| 366 | + param.id = id; | ||
| 367 | + param.list = list; | ||
| 368 | + | ||
| 369 | + $get('/pages/base/line/map.html',param);*/ | ||
| 370 | + window.location.href = "/pages/base/line/map.html?no="+id; | ||
| 371 | + } | ||
| 372 | + }); | ||
| 333 | })(); | 373 | })(); |
| 334 | \ No newline at end of file | 374 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/transGPS.js
0 → 100644
| 1 | +/** 转换坐标点工具 */ | ||
| 2 | +var TransGPS = function () { | ||
| 3 | + | ||
| 4 | + var location = {lng:'', lat:''}; | ||
| 5 | + | ||
| 6 | + var pi = 3.14159265358979324; | ||
| 7 | + | ||
| 8 | + var a = 6378245.0; | ||
| 9 | + var ee = 0.00669342162296594323; | ||
| 10 | + | ||
| 11 | + var x_pi = 3.14159265358979324 * 3000.0 / 180.0; | ||
| 12 | + | ||
| 13 | + var transGPS = { | ||
| 14 | + getLocation : function(){ | ||
| 15 | + return location; | ||
| 16 | + }, | ||
| 17 | + locationMake : function(lng, lat) { | ||
| 18 | + var loc = transGPS.getLocation(); | ||
| 19 | + loc.lng = lng; | ||
| 20 | + loc.lat = lat; | ||
| 21 | + return loc; | ||
| 22 | + }, | ||
| 23 | + outOfChina : function(lat,lng) { | ||
| 24 | + if (lng < 72.004 || lng > 137.8347) | ||
| 25 | + return 1; | ||
| 26 | + if (lat < 0.8293 || lat > 55.8271) | ||
| 27 | + return 1; | ||
| 28 | + return 0; | ||
| 29 | + }, | ||
| 30 | + transformLat : function(x, y) { | ||
| 31 | + var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(x > 0 ? x : -x); | ||
| 32 | + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; | ||
| 33 | + ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0; | ||
| 34 | + ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0; | ||
| 35 | + return ret; | ||
| 36 | + }, | ||
| 37 | + transformlng : function(x, y) { | ||
| 38 | + var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(x > 0 ? x : -x); | ||
| 39 | + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; | ||
| 40 | + ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0; | ||
| 41 | + ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0; | ||
| 42 | + return ret; | ||
| 43 | + }, | ||
| 44 | + transformFromWGSToGCJ : function(wgLoc) { | ||
| 45 | + var mgLoc = {}; | ||
| 46 | + if (1 == transGPS.outOfChina(wgLoc.lat, wgLoc.lng)) { | ||
| 47 | + mgLoc = wgLoc; | ||
| 48 | + return mgLoc; | ||
| 49 | + } | ||
| 50 | + var dLat = transGPS.transformLat(wgLoc.lng - 105.0, wgLoc.lat - 35.0); | ||
| 51 | + var dlng = transGPS.transformlng(wgLoc.lng - 105.0, wgLoc.lat - 35.0); | ||
| 52 | + var radLat = wgLoc.lat / 180.0 * pi; | ||
| 53 | + var magic = Math.sin(radLat); | ||
| 54 | + magic = 1 - ee * magic * magic; | ||
| 55 | + var sqrtMagic = Math.sqrt(magic); | ||
| 56 | + dLat = parseFloat((dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi)); | ||
| 57 | + dlng = parseFloat((dlng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi)) ; | ||
| 58 | + mgLoc.lat = parseFloat(wgLoc.lat) + dLat; | ||
| 59 | + mgLoc.lng = parseFloat(wgLoc.lng) + dlng; | ||
| 60 | + | ||
| 61 | + return mgLoc; | ||
| 62 | + }, | ||
| 63 | + bd_encrypt : function(gcLoc) { | ||
| 64 | + var x = gcLoc.lng, y = gcLoc.lat; | ||
| 65 | + var z = Math.sqrt((x*x)+(y*y)) + 0.00002 * Math.sin((y * x_pi)); | ||
| 66 | + var theta = Math.atan2(y, x) + 0.000003 * Math.cos((x * x_pi)); | ||
| 67 | + var lng = (z*Math.cos(theta)+0.0065); | ||
| 68 | + var lat = (z*Math.sin(theta)+0.006); | ||
| 69 | + return transGPS.locationMake(lng, lat); | ||
| 70 | + }, | ||
| 71 | + /*bd_decrypt : function(bdLoc) { | ||
| 72 | + var x = bdLoc.lng - 0.0065, y = bdLoc.lat - 0.006; | ||
| 73 | + var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); | ||
| 74 | + var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); | ||
| 75 | + return transGPS.locationMake(z * Math.cos(theta), z * Math.sin(theta)); | ||
| 76 | + }*/ | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + return transGPS; | ||
| 80 | + | ||
| 81 | +}(); |
src/main/resources/static/pages/base/line/list.html
| @@ -37,6 +37,9 @@ | @@ -37,6 +37,9 @@ | ||
| 37 | <li> | 37 | <li> |
| 38 | <a href="javascript:;" data-action="0" id="createUsingSingle" class="tool-action"> <i class="fa fa-file-zip-o"></i> 生成路单文件</a> | 38 | <a href="javascript:;" data-action="0" id="createUsingSingle" class="tool-action"> <i class="fa fa-file-zip-o"></i> 生成路单文件</a> |
| 39 | </li> | 39 | </li> |
| 40 | + <li> | ||
| 41 | + <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a> | ||
| 42 | + </li> | ||
| 40 | <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 | 43 | <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 |
| 41 | </a></li> | 44 | </a></li> |
| 42 | <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制 | 45 | <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制 |
| @@ -353,6 +356,5 @@ | @@ -353,6 +356,5 @@ | ||
| 353 | </tr> | 356 | </tr> |
| 354 | {{/if}} | 357 | {{/if}} |
| 355 | </script> | 358 | </script> |
| 356 | -<!-- <script src="/pages/base/line/js/tipso.js"></script> --> | ||
| 357 | <!-- 线路信息片段JS模块 --> | 359 | <!-- 线路信息片段JS模块 --> |
| 358 | <script src="/pages/base/line/js/line-list-table.js"></script> | 360 | <script src="/pages/base/line/js/line-list-table.js"></script> |
| 359 | \ No newline at end of file | 361 | \ No newline at end of file |
src/main/resources/static/pages/base/line/map.html
0 → 100644
| 1 | +< <link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> | ||
| 2 | +<div class="portlet-body"> | ||
| 3 | + <!-- 地图 --> | ||
| 4 | + <div id="bmap_basic" class="bmaps"></div> | ||
| 5 | + <!-- 右边添加栏 --> | ||
| 6 | + <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;float:right;"> | ||
| 7 | + <div class="portlet-title" style="background-color:#12527f;"> | ||
| 8 | + <div class="caption"> | ||
| 9 | + <!-- 途径站点 --> | ||
| 10 | + </div> | ||
| 11 | + <div class="tools"> | ||
| 12 | + <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + <!-- 左边栏 --> | ||
| 16 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 300px"> | ||
| 17 | + <div class="row"> | ||
| 18 | + <div class="portlet-body"> | ||
| 19 | + <div class="table-toolbar" style="text-align:center;"> | ||
| 20 | + <button class="btn btn-circle blue" id="uploadRoute" ><i class="fa fa-plus"></i> 生成路线 </button> | ||
| 21 | + <button class="btn btn-circle blue hidden" id="cutSection"><i class="fa fa-level-up"></i> 提交路段</button> | ||
| 22 | + <button class="btn btn-circle blue hidden" id="Undo"><i class="fa fa-remove"></i> 撤销切点</button> | ||
| 23 | + </div> | ||
| 24 | + <div class="portlet-body" > | ||
| 25 | + <div class="defeat-scroll" style="height: auto;max-height: 400px;overflow-y:auto;"> | ||
| 26 | + <table class="table table-striped table-bordered table-hover table-checkable " id="section_table"> | ||
| 27 | + <thead> | ||
| 28 | + <tr role="row" class="heading"> | ||
| 29 | + <th >截取路段</th> | ||
| 30 | + </tr> | ||
| 31 | + </thead> | ||
| 32 | + <tbody ></tbody> | ||
| 33 | + </table> | ||
| 34 | + </div> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | +</div> | ||
| 41 | +<script type="text/html" id="section_list"> | ||
| 42 | + {{each list as obj i }} | ||
| 43 | + <tr> | ||
| 44 | + <td style="vertical-align: middle;"> | ||
| 45 | + {{obj.name}}:[{{obj.section[0].lng}},{{obj.section[0].lat}}],[{{obj.section[1].lng}},{{obj.section[1].lat}}] | ||
| 46 | + </td> | ||
| 47 | + {{/each}} | ||
| 48 | + {{if list.length == 0}} | ||
| 49 | + <tr> | ||
| 50 | + <td colspan=13><h6 class="muted">你还没有对路段进行截取</h6></td> | ||
| 51 | + </tr> | ||
| 52 | + {{/if}} | ||
| 53 | +</script> | ||
| 54 | +<!--上传GPS坐标生成路线监听事件 --> | ||
| 55 | +<<script type="text/javascript"> | ||
| 56 | +$(function(){ | ||
| 57 | + // 关闭左侧栏 | ||
| 58 | + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | ||
| 59 | + // 线路id | ||
| 60 | + var id = $.url().param('no'); | ||
| 61 | + // 方向 (0:上行;1:下行)默认上行 | ||
| 62 | + var direction = 0; | ||
| 63 | + // 如果线路ID不为空 | ||
| 64 | + if(id) { | ||
| 65 | + var styleOptions = { | ||
| 66 | + strokeColor : "blue",//边线颜色。 | ||
| 67 | + fillColor : "blue",//填充颜色。当参数为空时,圆形将没有填充效果。 | ||
| 68 | + strokeWeight : 3,//边线的宽度,以像素为单位。 | ||
| 69 | + strokeOpacity : 0.8,//边线透明度,取值范围0 - 1。 | ||
| 70 | + fillOpacity : 0.6,//填充的透明度,取值范围0 - 1。 | ||
| 71 | + strokeStyle : 'solid' //边线的样式,solid或dashed。 | ||
| 72 | + }; | ||
| 73 | + | ||
| 74 | + // 等候500毫秒执行 | ||
| 75 | + setTimeout(function(){ | ||
| 76 | + | ||
| 77 | + /** 初始化线路标题 @param:<id:线路ID> */ | ||
| 78 | + PublicFunctions.setTiteText(id); | ||
| 79 | + | ||
| 80 | + /** 初始化地图对象map @return:Map对象 */ | ||
| 81 | + var map_ = WorldsBMapLine.init(); | ||
| 82 | + | ||
| 83 | + /** 初始化绘图工具类 @param:<map_:map对象;styleOptions:绘图样式对象> @return:DrawingManager对象 */ | ||
| 84 | + DrawingManagerObj.init(map_,styleOptions); | ||
| 85 | + | ||
| 86 | + layer.msg('请生成路线!!!'); | ||
| 87 | + | ||
| 88 | + },500); | ||
| 89 | + }else { | ||
| 90 | + | ||
| 91 | + // 缺少ID | ||
| 92 | + layer.confirm('【ID缺失,请点击返回,重新进行操作】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | ||
| 93 | + | ||
| 94 | + // 关闭提示弹出层 | ||
| 95 | + layer.close(index); | ||
| 96 | + | ||
| 97 | + // 返回线路list页面 | ||
| 98 | + loadPage('/pages/base/line/list.html'); | ||
| 99 | + | ||
| 100 | + }); | ||
| 101 | + | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + // 上传GPS坐标生成路线事件 | ||
| 105 | + $('#uploadRoute').on('click', function() { | ||
| 106 | + EditRoute.setLineId(id); | ||
| 107 | + EditRoute.setLineDir(direction); | ||
| 108 | + $.get('editRoute.html', function(m){ | ||
| 109 | + $(pjaxContainer).append(m); | ||
| 110 | + $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]); | ||
| 111 | + }); | ||
| 112 | + // 更新section_table 和缓存中的一切过的点数 | ||
| 113 | + WorldsBMapLine.initCutSectionPoint(); | ||
| 114 | + WorldsBMapLine.setPointIndex(0); | ||
| 115 | + }); | ||
| 116 | + | ||
| 117 | + // 提交截取事件 | ||
| 118 | + $('#cutSection').on('click', function() { | ||
| 119 | + layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', { | ||
| 120 | + btn: ['提交','取消'] //按钮 | ||
| 121 | + }, function(){ | ||
| 122 | + if(WorldsBMapLine.getPointIndex() > 0) { | ||
| 123 | + var sectionList = WorldsBMapLine.getSectionList(); | ||
| 124 | + var data = {}; | ||
| 125 | + var section = EditSectionObj.getEitdSection(); | ||
| 126 | + var josnSectionList = JSON.stringify(sectionList); | ||
| 127 | + section.cutSectionList = josnSectionList; | ||
| 128 | + $.post('/section/sectionCut', section, function(resuntDate){ | ||
| 129 | + if(resuntDate.status=='SUCCESS') { | ||
| 130 | + // 弹出添加成功提示消息 | ||
| 131 | + layer.msg('提交成功,跳转到线路详情页面!'); | ||
| 132 | + window.location.href = "/pages/base/stationroute/list.html?no="+id+","+EditRoute.getLineObj().dir; | ||
| 133 | + WorldsBMapLine.initCutSectionPoint(); | ||
| 134 | + WorldsBMapLine.setPointIndex(0); | ||
| 135 | + }else { | ||
| 136 | + // 弹出添加失败提示消息 | ||
| 137 | + layer.msg('提交失败...'); | ||
| 138 | + } | ||
| 139 | + }); | ||
| 140 | + } else { | ||
| 141 | + layer.msg("请截取路段!!!"); | ||
| 142 | + } | ||
| 143 | + }); | ||
| 144 | + }); | ||
| 145 | + | ||
| 146 | + // 删除最后一个路段 | ||
| 147 | + $('#Undo').on('click', function() { | ||
| 148 | + if(WorldsBMapLine.getPointIndex() > 1) { | ||
| 149 | + // 点总数-1 | ||
| 150 | + var pointIndex = WorldsBMapLine.getPointIndex() - 1; | ||
| 151 | + WorldsBMapLine.setPointIndex(pointIndex); | ||
| 152 | + // 截取的路段list | ||
| 153 | + var sectionList = WorldsBMapLine.getSectionList(); | ||
| 154 | + var sectionListLen = sectionList.length; | ||
| 155 | + // 要删除的点 | ||
| 156 | + var point = sectionList[sectionListLen-1].section[1]; | ||
| 157 | + sectionList.splice(sectionListLen-1,1); | ||
| 158 | + WorldsBMapLine.setSectionList(sectionList); | ||
| 159 | + WorldsBMapLine.deleteCutSectionPoint(point); | ||
| 160 | + WorldsBMapLine.refreshCutSectionTable(); | ||
| 161 | + } else if(WorldsBMapLine.getPointIndex() == 1 ) { | ||
| 162 | + // 点总数-1 | ||
| 163 | + var pointIndex = WorldsBMapLine.getPointIndex() - 1; | ||
| 164 | + WorldsBMapLine.setPointIndex(pointIndex); | ||
| 165 | + var firstPoint = WorldsBMapLine.getFirstPoint(); | ||
| 166 | + WorldsBMapLine.deleteCutSectionPoint(firstPoint); | ||
| 167 | + WorldsBMapLine.setIsCutSection(false); | ||
| 168 | + } else { | ||
| 169 | + layer.msg("没有截取路段,不可以删除!!!"); | ||
| 170 | + } | ||
| 171 | + }); | ||
| 172 | +}); | ||
| 173 | +</script> | ||
| 174 | +<!--编辑路线类 --> | ||
| 175 | +<script src="/pages/base/line/js/editRoute.js"></script> | ||
| 176 | + <!--坐标转换类 --> | ||
| 177 | +<script src="/pages/base/line/js/transGPS.js"></script> | ||
| 178 | +<!-- 地图类 --> | ||
| 179 | +<script src="/pages/base/line/js/line-list-map.js"></script> | ||
| 180 | +<!-- 函数与方法 --> | ||
| 181 | +<script src="/pages/base/line/js/line-list-function.js"></script> | ||
| 182 | +<!-- 修改路段对象类 --> | ||
| 183 | +<script src="/pages/base/stationroute/js/editsection.js"></script> | ||
| 184 | +<!-- 绘图类 --> | ||
| 185 | +<script src="/pages/base/stationroute/js/drawingManager.js"></script> | ||
| 186 | +<!-- ajax请求类 --> | ||
| 187 | +<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> | ||
| 0 | \ No newline at end of file | 188 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| @@ -9,7 +9,23 @@ $(function(){ | @@ -9,7 +9,23 @@ $(function(){ | ||
| 9 | // 关闭左侧栏 | 9 | // 关闭左侧栏 |
| 10 | if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | 10 | if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} |
| 11 | // 获取参数线路ID | 11 | // 获取参数线路ID |
| 12 | - var id = $.url().param('no'); | 12 | + var idAndDir = $.url().param('no'); |
| 13 | + var param = idAndDir.split(","); | ||
| 14 | + var dir = 0, id; | ||
| 15 | + if(param.length == 1){ | ||
| 16 | + id = param[0]; | ||
| 17 | + } else { | ||
| 18 | + id = param[0]; | ||
| 19 | + dir = param[1]; | ||
| 20 | + } | ||
| 21 | + if(dir==1) { | ||
| 22 | + $('#stationUp').removeClass('active'); | ||
| 23 | + $('#stationUp').removeClass('in'); | ||
| 24 | + $('#stationUp').addClass('fade'); | ||
| 25 | + $('#stationDown').addClass('active in'); | ||
| 26 | + $('#upLine').parent().removeClass('active'); | ||
| 27 | + $('#downLine').parent().addClass('active'); | ||
| 28 | + } | ||
| 13 | // 如果线路ID不为空 | 29 | // 如果线路ID不为空 |
| 14 | if(id) { | 30 | if(id) { |
| 15 | var styleOptions = { | 31 | var styleOptions = { |
| @@ -39,13 +55,13 @@ $(function(){ | @@ -39,13 +55,13 @@ $(function(){ | ||
| 39 | /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | 55 | /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ |
| 40 | PublicFunctions.TreeUpOrDown(Line.id,'0'); | 56 | PublicFunctions.TreeUpOrDown(Line.id,'0'); |
| 41 | 57 | ||
| 42 | - /** 初始化下行树 @param:<Line.id:线路Id;0:下行> */ | 58 | + /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ |
| 43 | PublicFunctions.TreeUpOrDown(Line.id,'1'); | 59 | PublicFunctions.TreeUpOrDown(Line.id,'1'); |
| 44 | 60 | ||
| 45 | - /** 查询路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 46 | - GetAjaxData.getSectionRouteInfo(Line.id,'0',function(data) { | 61 | + /** 查询路段信息 @param:<Line.id:线路Id;dir:方向> @return:data:路段数据 */ |
| 62 | + GetAjaxData.getSectionRouteInfo(Line.id,dir,function(data) { | ||
| 47 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | 63 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 48 | - PublicFunctions.linePanlThree(Line.id,data,'0'); | 64 | + PublicFunctions.linePanlThree(Line.id,data,dir); |
| 49 | 65 | ||
| 50 | }); | 66 | }); |
| 51 | 67 |