Commit 03e6def0fcc286d78a278acea0d1f611e18bbfd6
Merge branch 'pudong_jdk8' of http://192.168.168.201:8888/panzhaov5/bsth_control into pudong_jdk8
Showing
19 changed files
with
2974 additions
and
1286 deletions
Too many changes to show.
To preserve performance only 19 of 21 files are displayed.
pom.xml
| ... | ... | @@ -400,6 +400,12 @@ |
| 400 | 400 | <version>1.0.0</version> |
| 401 | 401 | </dependency> |
| 402 | 402 | |
| 403 | + <!-- geotool --> | |
| 404 | + <dependency> | |
| 405 | + <groupId>org.locationtech.jts</groupId> | |
| 406 | + <artifactId>jts-core</artifactId> | |
| 407 | + <version>1.16.1</version> | |
| 408 | + </dependency> | |
| 403 | 409 | </dependencies> |
| 404 | 410 | |
| 405 | 411 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/controller/InoutCarparkController.java
0 → 100644
| 1 | +package com.bsth.controller; | |
| 2 | + | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 4 | +import com.bsth.entity.LsInoutSectionRoute; | |
| 5 | +import com.bsth.repository.StationRouteCacheRepository; | |
| 6 | +import com.bsth.repository.StationRouteRepository; | |
| 7 | +import com.bsth.service.InoutCarparkService; | |
| 8 | +import com.bsth.service.StationRouteService; | |
| 9 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.util.StringUtils; | |
| 14 | +import org.springframework.web.bind.annotation.*; | |
| 15 | + | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.Map; | |
| 18 | + | |
| 19 | +@RestController | |
| 20 | +@RequestMapping("inout") | |
| 21 | +public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{ | |
| 22 | + | |
| 23 | + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class); | |
| 24 | + | |
| 25 | + @Autowired | |
| 26 | + InoutCarparkService inoutCarparkService; | |
| 27 | + | |
| 28 | + @RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET) | |
| 29 | + public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) { | |
| 30 | + return inoutCarparkService.getStartEndByLine(lineId, version); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET) | |
| 34 | + public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) { | |
| 35 | + return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 新增路段信息 | |
| 40 | + * | |
| 41 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | |
| 42 | + * | |
| 43 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | |
| 44 | + * | |
| 45 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | |
| 46 | + * | |
| 47 | + * @return map<SUCCESS:成功;ERROR:异常> | |
| 48 | + */ | |
| 49 | + @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | |
| 50 | + public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { | |
| 51 | + map.put("createBy", ""); | |
| 52 | + map.put("updateBy", ""); | |
| 53 | + return inoutCarparkService.sectionSave(map); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * @Description :TODO(编辑线路走向) | |
| 58 | + * | |
| 59 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | |
| 60 | + * | |
| 61 | + * @return Map<String, Object> <SUCCESS ; ERROR> | |
| 62 | + */ | |
| 63 | + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | |
| 64 | + public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | |
| 65 | + | |
| 66 | + map.put("updateBy", ""); | |
| 67 | + | |
| 68 | + map.put("createBy", ""); | |
| 69 | + | |
| 70 | + map.put("createDate", ""); | |
| 71 | + | |
| 72 | + return inoutCarparkService.sectionUpdate(map); | |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * @param id //路段路由id | |
| 78 | + * @Description: TODO(撤销路段) | |
| 79 | + */ | |
| 80 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | |
| 81 | + public Map<String, Object> destroy(@RequestParam Map<String, Object> map) { | |
| 82 | + return inoutCarparkService.destroy(map); | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 从历史轨迹做进场路径规划 | |
| 87 | + * @Description: TODO(撤销路段) | |
| 88 | + */ | |
| 89 | + @RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST) | |
| 90 | + public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){ | |
| 91 | + Map<String, Object> result = new HashMap<>(); | |
| 92 | + result.put("status", ResponseCode.SUCCESS); | |
| 93 | + try { | |
| 94 | + String schId = (String)map.get("schId"), version = (String)map.get("version"); | |
| 95 | + if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) { | |
| 96 | + throw new RuntimeException("无效的参数"); | |
| 97 | + } | |
| 98 | + inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version)); | |
| 99 | + } catch (Exception e) { | |
| 100 | + result.put("status", ResponseCode.ERROR); | |
| 101 | + logger.error("路径规划异常", e); | |
| 102 | + } | |
| 103 | + | |
| 104 | + return result; | |
| 105 | + } | |
| 106 | +} | ... | ... |
src/main/java/com/bsth/entity/CarPark.java
| ... | ... | @@ -40,7 +40,7 @@ public class CarPark { |
| 40 | 40 | |
| 41 | 41 | // 地理位置(百度坐标) |
| 42 | 42 | private String bParkPoint; |
| 43 | - | |
| 43 | + | |
| 44 | 44 | // 地理位置中心点(百度坐标) |
| 45 | 45 | private String bCenterPoint; |
| 46 | 46 | |
| ... | ... | @@ -81,7 +81,7 @@ public class CarPark { |
| 81 | 81 | private String brancheCompany; |
| 82 | 82 | |
| 83 | 83 | /** 组合公司分公司编码 */ |
| 84 | - @Formula(" concat(company, '_', branche_company) ") | |
| 84 | + @Transient | |
| 85 | 85 | private String cgsbm; |
| 86 | 86 | |
| 87 | 87 | // 是否撤销 |
| ... | ... | @@ -106,14 +106,6 @@ public class CarPark { |
| 106 | 106 | // 修改日期 |
| 107 | 107 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 108 | 108 | private Date updateDate; |
| 109 | - | |
| 110 | - public String getCgsbm() { | |
| 111 | - return cgsbm; | |
| 112 | - } | |
| 113 | - | |
| 114 | - public void setCgsbm(String cgsbm) { | |
| 115 | - this.cgsbm = cgsbm; | |
| 116 | - } | |
| 117 | 109 | |
| 118 | 110 | public Integer getId() { |
| 119 | 111 | return id; |
| ... | ... | @@ -219,6 +211,14 @@ public class CarPark { |
| 219 | 211 | this.company = company; |
| 220 | 212 | } |
| 221 | 213 | |
| 214 | + public String getCgsbm() { | |
| 215 | + return this.company + "_" + this.brancheCompany; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setCgsbm(String cgsbm) { | |
| 219 | + this.cgsbm = cgsbm; | |
| 220 | + } | |
| 221 | + | |
| 222 | 222 | public Integer getDestroy() { |
| 223 | 223 | return destroy; |
| 224 | 224 | } | ... | ... |
src/main/java/com/bsth/entity/LsInoutSectionRoute.java
0 → 100644
| 1 | +package com.bsth.entity; | |
| 2 | + | |
| 3 | +import javax.persistence.*; | |
| 4 | +import java.util.Date; | |
| 5 | + | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * | |
| 9 | + * @ClassName : LsInoutSectionRoute(历史进出场路段路由实体类) | |
| 10 | + * | |
| 11 | + * @Author : bsth@lq | |
| 12 | + * | |
| 13 | + * @Description : TODO(历史路段路由) | |
| 14 | + * | |
| 15 | + * @Version 公交调度系统BS版 0.1 | |
| 16 | + * | |
| 17 | + */ | |
| 18 | + | |
| 19 | +@Entity | |
| 20 | +@Table(name = "bsth_c_ls_inout_sectionroute") | |
| 21 | +public class LsInoutSectionRoute { | |
| 22 | + | |
| 23 | + @Id | |
| 24 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 25 | + private Long id; | |
| 26 | + | |
| 27 | + // 路段路由序号 | |
| 28 | + private Integer sectionrouteCode; | |
| 29 | + | |
| 30 | + // 线路编号 | |
| 31 | + private String lineCode; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 进出场起点编码 | |
| 35 | + */ | |
| 36 | + private String start; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 进出场终点编码 | |
| 40 | + */ | |
| 41 | + private String end; | |
| 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 | + // 描述 | |
| 56 | + private String descriptions; | |
| 57 | + | |
| 58 | + // 创建人 | |
| 59 | + private Integer createBy; | |
| 60 | + | |
| 61 | + // 修改人 | |
| 62 | + private Integer updateBy; | |
| 63 | + | |
| 64 | + // 创建日期 | |
| 65 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 66 | + private Date createDate; | |
| 67 | + | |
| 68 | + // 修改日期 | |
| 69 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 70 | + private Date updateDate; | |
| 71 | + | |
| 72 | + // 路段信息 | |
| 73 | + @OneToOne | |
| 74 | + private Section section; | |
| 75 | + | |
| 76 | + // 线路信息 | |
| 77 | + @ManyToOne | |
| 78 | + private Line line; | |
| 79 | + | |
| 80 | + public Long getId() { | |
| 81 | + return id; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setId(Long id) { | |
| 85 | + this.id = id; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public Integer getSectionrouteCode() { | |
| 89 | + return sectionrouteCode; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setSectionrouteCode(Integer sectionrouteCode) { | |
| 93 | + this.sectionrouteCode = sectionrouteCode; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getLineCode() { | |
| 97 | + return lineCode; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setLineCode(String lineCode) { | |
| 101 | + this.lineCode = lineCode; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getStart() { | |
| 105 | + return start; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setStart(String start) { | |
| 109 | + this.start = start; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public String getEnd() { | |
| 113 | + return end; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public void setEnd(String end) { | |
| 117 | + this.end = end; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public String getSectionCode() { | |
| 121 | + return sectionCode; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public void setSectionCode(String sectionCode) { | |
| 125 | + this.sectionCode = sectionCode; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public Integer getDirections() { | |
| 129 | + return directions; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public void setDirections(Integer directions) { | |
| 133 | + this.directions = directions; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public Integer getVersions() { | |
| 137 | + return versions; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public void setVersions(Integer versions) { | |
| 141 | + this.versions = versions; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public Integer getDestroy() { | |
| 145 | + return destroy; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setDestroy(Integer destroy) { | |
| 149 | + this.destroy = destroy; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public String getDescriptions() { | |
| 153 | + return descriptions; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public void setDescriptions(String descriptions) { | |
| 157 | + this.descriptions = descriptions; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public Integer getCreateBy() { | |
| 161 | + return createBy; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public void setCreateBy(Integer createBy) { | |
| 165 | + this.createBy = createBy; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public Integer getUpdateBy() { | |
| 169 | + return updateBy; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public void setUpdateBy(Integer updateBy) { | |
| 173 | + this.updateBy = updateBy; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public Date getCreateDate() { | |
| 177 | + return createDate; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public void setCreateDate(Date createDate) { | |
| 181 | + this.createDate = createDate; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public Date getUpdateDate() { | |
| 185 | + return updateDate; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setUpdateDate(Date updateDate) { | |
| 189 | + this.updateDate = updateDate; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public Section getSection() { | |
| 193 | + return section; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public void setSection(Section section) { | |
| 197 | + this.section = section; | |
| 198 | + } | |
| 199 | + | |
| 200 | + public Line getLine() { | |
| 201 | + return line; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public void setLine(Line line) { | |
| 205 | + this.line = line; | |
| 206 | + } | |
| 207 | +} | ... | ... |
src/main/java/com/bsth/entity/Section.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import org.hibernate.annotations.Formula; | |
| 4 | + | |
| 3 | 5 | import java.util.Date; |
| 4 | 6 | |
| 5 | 7 | import javax.persistence.Column; |
| ... | ... | @@ -53,12 +55,15 @@ public class Section{ |
| 53 | 55 | private String sectionType; |
| 54 | 56 | |
| 55 | 57 | // 路段矢量(空间坐标点集合)--GPS坐标点 |
| 58 | + @Formula("ST_AsText(gsection_vector)") | |
| 56 | 59 | private String gsectionVector; |
| 57 | 60 | |
| 58 | 61 | // 路段矢量(空间坐标点集合)--百度原始坐标坐标点 |
| 62 | + @Formula("ST_AsText(bsection_vector)") | |
| 59 | 63 | private String bsectionVector; |
| 60 | 64 | |
| 61 | 65 | // 路段矢量(空间坐标点集合)--城建坐标点 |
| 66 | + @Formula("ST_AsText(csection_vector)") | |
| 62 | 67 | private String csectionVector; |
| 63 | 68 | |
| 64 | 69 | // 交叉路 | ... | ... |
src/main/java/com/bsth/entity/Station.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import com.bsth.util.Geo.Point; | |
| 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | +import org.hibernate.annotations.Formula; | |
| 6 | +import org.locationtech.jts.geom.Geometry; | |
| 7 | +import org.locationtech.jts.io.WKBReader; | |
| 4 | 8 | |
| 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.Table; | |
| 9 | +import javax.persistence.*; | |
| 11 | 10 | |
| 12 | 11 | import java.util.Arrays; |
| 13 | 12 | import java.util.Date; |
| 13 | +import java.util.List; | |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | /** |
| ... | ... | @@ -89,6 +89,9 @@ public class Station { |
| 89 | 89 | |
| 90 | 90 | // 多边形空间原坐标坐标点集合 |
| 91 | 91 | private byte[] bPolygonGrid; |
| 92 | + | |
| 93 | + @Transient | |
| 94 | + private String bdPolygon; | |
| 92 | 95 | |
| 93 | 96 | /** |
| 94 | 97 | * 是否撤销 |
| ... | ... | @@ -272,6 +275,17 @@ public class Station { |
| 272 | 275 | this.bPolygonGrid = bPolygonGrid; |
| 273 | 276 | } |
| 274 | 277 | |
| 278 | + public String getBdPolygon() { | |
| 279 | + if (bPolygonGrid == null) { | |
| 280 | + return null; | |
| 281 | + } | |
| 282 | + Geometry geometry = getGeometryFromBytes(getbPolygonGrid()); | |
| 283 | + if (geometry == null) { | |
| 284 | + return null; | |
| 285 | + } | |
| 286 | + return geometry.toString(); | |
| 287 | + } | |
| 288 | + | |
| 275 | 289 | public Integer getDestroy() { |
| 276 | 290 | return destroy; |
| 277 | 291 | } |
| ... | ... | @@ -328,6 +342,48 @@ public class Station { |
| 328 | 342 | this.updateDate = updateDate; |
| 329 | 343 | } |
| 330 | 344 | |
| 345 | + private static Geometry getGeometryFromBytes(byte[] geometryAsBytes) { | |
| 346 | + Geometry geometry = null; | |
| 347 | + try { | |
| 348 | + // 字节数组小于5,说明geometry有问题 | |
| 349 | + if (geometryAsBytes.length < 5) { | |
| 350 | + throw new Exception("Invalid geometry inputStream - less than five bytes"); | |
| 351 | + } | |
| 352 | + | |
| 353 | + //first four bytes of the geometry are the SRID, | |
| 354 | + //followed by the actual WKB. Determine the SRID | |
| 355 | + //这里是取字节数组的前4个来解析srid | |
| 356 | + byte[] sridBytes = new byte[4]; | |
| 357 | + System.arraycopy(geometryAsBytes, 0, sridBytes, 0, 4); | |
| 358 | + boolean bigEndian = (geometryAsBytes[4] == 0x00); | |
| 359 | + // 解析srid | |
| 360 | + int srid = 0; | |
| 361 | + if (bigEndian) { | |
| 362 | + for (int i = 0; i < sridBytes.length; i++) { | |
| 363 | + srid = (srid << 8) + (sridBytes[i] & 0xff); | |
| 364 | + } | |
| 365 | + } else { | |
| 366 | + for (int i = 0; i < sridBytes.length; i++) { | |
| 367 | + srid += (sridBytes[i] & 0xff) << (8 * i); | |
| 368 | + } | |
| 369 | + } | |
| 370 | + | |
| 371 | + //use the JTS WKBReader for WKB parsing | |
| 372 | + WKBReader wkbReader = new WKBReader(); | |
| 373 | + // 使用geotool的WKBReader 把字节数组转成geometry对象。 | |
| 374 | + //copy the byte array, removing the first four | |
| 375 | + //SRID bytes | |
| 376 | + byte[] wkb = new byte[geometryAsBytes.length - 4]; | |
| 377 | + System.arraycopy(geometryAsBytes, 4, wkb, 0, wkb.length); | |
| 378 | + geometry = wkbReader.read(wkb); | |
| 379 | + geometry.setSRID(srid); | |
| 380 | + } catch (Exception e) { | |
| 381 | + e.printStackTrace(); | |
| 382 | + } | |
| 383 | + | |
| 384 | + return geometry; | |
| 385 | + } | |
| 386 | + | |
| 331 | 387 | @Override |
| 332 | 388 | public String toString() { |
| 333 | 389 | return "Station [id=" + id + ", stationCod=" + stationCod + ", stationName=" + stationName + ", roadCoding=" | ... | ... |
src/main/java/com/bsth/repository/CarParkRepository.java
| 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.CarPark; | |
| 11 | - | |
| 12 | -@Repository | |
| 13 | -public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ | |
| 14 | - | |
| 15 | - // 查询最大ID | |
| 16 | - @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k" | |
| 17 | - , nativeQuery=true) | |
| 18 | - public long carParkMaxId(); | |
| 19 | - | |
| 20 | - @Transactional | |
| 21 | - @Modifying | |
| 22 | - @Query(value="INSERT INTO bsth_c_car_park (" + | |
| 23 | - " area , company , park_code , park_name , branche_company , " + | |
| 24 | - | |
| 25 | - "create_by , create_date , descriptions , destroy, update_by, " + | |
| 26 | - | |
| 27 | - "update_date , versions , b_center_point , b_park_point ,db_type, " + | |
| 28 | - | |
| 29 | - "g_center_point, g_park_point, radius, shapes_type) " + | |
| 30 | - | |
| 31 | - " VALUES(" + | |
| 32 | - "?1 , ?2 , ?3 , ?4 , ?5," + | |
| 33 | - | |
| 34 | - "?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," + | |
| 35 | - | |
| 36 | - "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " + | |
| 37 | - | |
| 38 | - "?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true) | |
| 39 | - public void carParkSave(Double area,String company,String parkCode,String parkName, | |
| 40 | - | |
| 41 | - String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy, | |
| 42 | - | |
| 43 | - Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint, | |
| 44 | - | |
| 45 | - String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType); | |
| 46 | - | |
| 47 | - | |
| 48 | - /** | |
| 49 | - * @Description :TODO(查询路段信息) | |
| 50 | - * | |
| 51 | - * @param map <id:路段路由ID> | |
| 52 | - * | |
| 53 | - * @return List<Object[]> | |
| 54 | - */ | |
| 55 | - @Query(value ="SELECT k.id AS carParkId," + | |
| 56 | - "k.area AS carParkArea," + | |
| 57 | - "k.company AS carParkCompany," + | |
| 58 | - "k.park_code AS carParkCode," + | |
| 59 | - "k.park_name AS carParkName," + | |
| 60 | - "k.branche_company AS carParkBrancheCompany," + | |
| 61 | - "k.create_by AS carParkCreateBy," + | |
| 62 | - "k.create_date AS carParkCreateDate," + | |
| 63 | - "k.descriptions AS carParkDescriptions," + | |
| 64 | - "k.destroy AS carParkDestroy," + | |
| 65 | - "k.update_by AS carParkUpdate," + | |
| 66 | - "k.update_date AS carParkUpdateDate," + | |
| 67 | - "k.versions AS carParkVersions," + | |
| 68 | - "k.b_center_point AS carParkBcenterPoint," + | |
| 69 | - "ST_AsText(k.b_park_point) AS carParkBparkPoint," + | |
| 70 | - "k.g_center_point AS carParkGcenterPoint," + | |
| 71 | - "ST_AsText(k.g_park_point) AS carParkGparkPoint, " + | |
| 72 | - "k.db_type AS carParkDBtype," + | |
| 73 | - "k.radius AS carParkRadius," + | |
| 74 | - "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true) | |
| 75 | - List<Object[]> findCarParkInfoFormId(int id); | |
| 76 | - | |
| 77 | - @Transactional | |
| 78 | - @Modifying | |
| 79 | - @Query(value="UPDATE bsth_c_car_park SET " + | |
| 80 | - "area = ?1 , " + | |
| 81 | - "company = ?2 , " + | |
| 82 | - "park_code = ?3 , " + | |
| 83 | - "park_name = ?4 , " + | |
| 84 | - "branche_company = ?5 , " + | |
| 85 | - "create_by = ?6 , " + | |
| 86 | - "create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " + | |
| 87 | - "descriptions = ?8 , " + | |
| 88 | - "destroy = ?9 , " + | |
| 89 | - "update_by = ?10 , " + | |
| 90 | - "update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " + | |
| 91 | - "versions = ?12 , " + | |
| 92 | - "b_center_point = ?13 , " + | |
| 93 | - "g_center_point = ?14 , " + | |
| 94 | - "b_park_point = ST_GeomFromText(?15) , " + | |
| 95 | - "g_park_point = ST_GeomFromText(?16) , " + | |
| 96 | - "db_type = ?17 , " + | |
| 97 | - "radius = ?18 , " + | |
| 98 | - "shapes_type = ?19 " + | |
| 99 | - " WHERE id = ?20 ", nativeQuery=true) | |
| 100 | - public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany, | |
| 101 | - | |
| 102 | - Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy, | |
| 103 | - | |
| 104 | - String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint, | |
| 105 | - | |
| 106 | - String gParkPoint,String dbType,Integer radius,String shapesType,Integer id ); | |
| 107 | - | |
| 108 | - @Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true) | |
| 109 | - public Object[][] bufferAera(String parkCode); | |
| 110 | - | |
| 111 | - @Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true) | |
| 112 | - List<Object[]> selectTccInfoByCode(String parkCode); | |
| 113 | -} | |
| 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.CarPark; | |
| 11 | + | |
| 12 | +@Repository | |
| 13 | +public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ | |
| 14 | + | |
| 15 | + // 查询最大ID | |
| 16 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k" | |
| 17 | + , nativeQuery=true) | |
| 18 | + public long carParkMaxId(); | |
| 19 | + | |
| 20 | + @Transactional | |
| 21 | + @Modifying | |
| 22 | + @Query(value="INSERT INTO bsth_c_car_park (" + | |
| 23 | + " area , company , park_code , park_name , branche_company , " + | |
| 24 | + | |
| 25 | + "create_by , create_date , descriptions , destroy, update_by, " + | |
| 26 | + | |
| 27 | + "update_date , versions , b_center_point , b_park_point ,db_type, " + | |
| 28 | + | |
| 29 | + "g_center_point, g_park_point, radius, shapes_type) " + | |
| 30 | + | |
| 31 | + " VALUES(" + | |
| 32 | + "?1 , ?2 , ?3 , ?4 , ?5," + | |
| 33 | + | |
| 34 | + "?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," + | |
| 35 | + | |
| 36 | + "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " + | |
| 37 | + | |
| 38 | + "?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true) | |
| 39 | + public void carParkSave(Double area,String company,String parkCode,String parkName, | |
| 40 | + | |
| 41 | + String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy, | |
| 42 | + | |
| 43 | + Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint, | |
| 44 | + | |
| 45 | + String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType); | |
| 46 | + | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * @Description :TODO(查询路段信息) | |
| 50 | + * | |
| 51 | + * @param map <id:路段路由ID> | |
| 52 | + * | |
| 53 | + * @return List<Object[]> | |
| 54 | + */ | |
| 55 | + @Query(value ="SELECT k.id AS carParkId," + | |
| 56 | + "k.area AS carParkArea," + | |
| 57 | + "k.company AS carParkCompany," + | |
| 58 | + "k.park_code AS carParkCode," + | |
| 59 | + "k.park_name AS carParkName," + | |
| 60 | + "k.branche_company AS carParkBrancheCompany," + | |
| 61 | + "k.create_by AS carParkCreateBy," + | |
| 62 | + "k.create_date AS carParkCreateDate," + | |
| 63 | + "k.descriptions AS carParkDescriptions," + | |
| 64 | + "k.destroy AS carParkDestroy," + | |
| 65 | + "k.update_by AS carParkUpdate," + | |
| 66 | + "k.update_date AS carParkUpdateDate," + | |
| 67 | + "k.versions AS carParkVersions," + | |
| 68 | + "k.b_center_point AS carParkBcenterPoint," + | |
| 69 | + "ST_AsText(k.b_park_point) AS carParkBparkPoint," + | |
| 70 | + "k.g_center_point AS carParkGcenterPoint," + | |
| 71 | + "ST_AsText(k.g_park_point) AS carParkGparkPoint, " + | |
| 72 | + "k.db_type AS carParkDBtype," + | |
| 73 | + "k.radius AS carParkRadius," + | |
| 74 | + "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true) | |
| 75 | + List<Object[]> findCarParkInfoFormId(int id); | |
| 76 | + | |
| 77 | + @Transactional | |
| 78 | + @Modifying | |
| 79 | + @Query(value="UPDATE bsth_c_car_park SET " + | |
| 80 | + "area = ?1 , " + | |
| 81 | + "company = ?2 , " + | |
| 82 | + "park_code = ?3 , " + | |
| 83 | + "park_name = ?4 , " + | |
| 84 | + "branche_company = ?5 , " + | |
| 85 | + "create_by = ?6 , " + | |
| 86 | + "create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " + | |
| 87 | + "descriptions = ?8 , " + | |
| 88 | + "destroy = ?9 , " + | |
| 89 | + "update_by = ?10 , " + | |
| 90 | + "update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " + | |
| 91 | + "versions = ?12 , " + | |
| 92 | + "b_center_point = ?13 , " + | |
| 93 | + "g_center_point = ?14 , " + | |
| 94 | + "b_park_point = ST_GeomFromText(?15) , " + | |
| 95 | + "g_park_point = ST_GeomFromText(?16) , " + | |
| 96 | + "db_type = ?17 , " + | |
| 97 | + "radius = ?18 , " + | |
| 98 | + "shapes_type = ?19 " + | |
| 99 | + " WHERE id = ?20 ", nativeQuery=true) | |
| 100 | + public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany, | |
| 101 | + | |
| 102 | + Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy, | |
| 103 | + | |
| 104 | + String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint, | |
| 105 | + | |
| 106 | + String gParkPoint,String dbType,Integer radius,String shapesType,Integer id ); | |
| 107 | + | |
| 108 | + @Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true) | |
| 109 | + public Object[][] bufferAera(String parkCode); | |
| 110 | + | |
| 111 | + @Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true) | |
| 112 | + List<Object[]> selectTccInfoByCode(String parkCode); | |
| 113 | + | |
| 114 | + @Query(value ="select c.id, c.area,c.company,c.park_code,c.park_name,c.branche_company,c.create_by,c.create_date,c.descriptions,c.destroy,c.update_by,c.update_date,c.versions,c.b_center_point,ST_AsText(c.b_park_point) b_park_point,c.g_center_point,ST_AsText(c.g_park_point) g_park_point,c.db_type,c.radius,c.shapes_type from bsth_c_line_information l left join bsth_c_car_park c on l.car_park = c.park_code where l.line = ?1", nativeQuery=true) | |
| 115 | + CarPark findByLineId(int lineId); | |
| 116 | +} | ... | ... |
src/main/java/com/bsth/repository/LsInoutSectionRouteRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | |
| 2 | + | |
| 3 | +import com.bsth.entity.LsInoutSectionRoute; | |
| 4 | +import com.bsth.entity.LsSectionRoute; | |
| 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 java.util.List; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * | |
| 14 | + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口) | |
| 15 | + * | |
| 16 | + * @Extends : BaseRepository | |
| 17 | + * | |
| 18 | + * @Description: TODO(路段路由Repository数据持久层接口) | |
| 19 | + * | |
| 20 | + * @Author bsth@lq | |
| 21 | + * | |
| 22 | + * @Version 公交调度系统BS版 0.1 | |
| 23 | + * | |
| 24 | + */ | |
| 25 | + | |
| 26 | +@Repository | |
| 27 | +public interface LsInoutSectionRouteRepository extends BaseRepository<LsInoutSectionRoute, Long> { | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 查询待更新线路的路段路由 | |
| 31 | + */ | |
| 32 | + @Query(value = "SELECT sr FROM LsInoutSectionRoute sr where sr.line.id =?1 and sr.versions=?2 and sr.start=?3 and sr.end=?4 and sr.destroy=0") | |
| 33 | + List<LsInoutSectionRoute> getRouteByStartEnd(int lineId, int version, String start, String end); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * | |
| 37 | + * @param lineCode | |
| 38 | + * @param version | |
| 39 | + * @param start | |
| 40 | + * @param end | |
| 41 | + * @param sectionrouteCode | |
| 42 | + */ | |
| 43 | + @Modifying | |
| 44 | + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4 and sectionroute_code >=?5 and destroy = 0", nativeQuery=true) | |
| 45 | + public void sectionUpdSectionRouteCode(String lineCode, int version, String start, String end, Integer sectionrouteCode); | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 撤销线路某版本进出场 | |
| 49 | + * @param lineCode | |
| 50 | + * @param version | |
| 51 | + * @param start | |
| 52 | + * @param end | |
| 53 | + */ | |
| 54 | + @Modifying | |
| 55 | + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4", nativeQuery=true) | |
| 56 | + public void destroy(String lineCode, int version, String start, String end); | |
| 57 | +} | ... | ... |
src/main/java/com/bsth/repository/LsStationRouteRepository.java
| 1 | -package com.bsth.repository; | |
| 2 | - | |
| 3 | -import java.util.List; | |
| 4 | -import java.util.Map; | |
| 5 | - | |
| 6 | -import org.springframework.data.jpa.repository.EntityGraph; | |
| 7 | -import org.springframework.data.jpa.repository.Modifying; | |
| 8 | -import org.springframework.data.jpa.repository.Query; | |
| 9 | -import org.springframework.stereotype.Repository; | |
| 10 | -import org.springframework.transaction.annotation.Transactional; | |
| 11 | - | |
| 12 | -import com.bsth.entity.LsStationRoute; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * | |
| 16 | - * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | |
| 17 | - * | |
| 18 | - * @Extends : BaseRepository | |
| 19 | - * | |
| 20 | - * @Description: TODO(站点路由Repository数据持久层接口) | |
| 21 | - * | |
| 22 | - * @Author bsth@lq | |
| 23 | - * | |
| 24 | - * @Version 公交调度系统BS版 0.1 | |
| 25 | - * | |
| 26 | - */ | |
| 27 | - | |
| 28 | -@Repository | |
| 29 | -public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> { | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 查询待更新线路的站点路由 | |
| 33 | - */ | |
| 34 | - @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | |
| 35 | - @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") | |
| 36 | - List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions); | |
| 37 | - | |
| 38 | - @Query(value = "SELECT a.`stationRoute.id`," + | |
| 39 | - "a.`stationRoute.line`," + | |
| 40 | - "a.`stationRoute.station`," + | |
| 41 | - "a.`stationRoute.stationName`," + | |
| 42 | - "a.`stationRoute.stationRouteCode`," + | |
| 43 | - "a.`stationRoute.lineCode`," + | |
| 44 | - "a.`stationRoute.stationMark`," + | |
| 45 | - "a.`stationRoute.outStationNmber`," + | |
| 46 | - "a.`stationRoute.directions`," + | |
| 47 | - "a.`stationRoute.distances`," + | |
| 48 | - "a.`stationRoute.toTime`," + | |
| 49 | - "a.`stationRoute.firstTime`," + | |
| 50 | - "a.`stationRoute.endTime`," + | |
| 51 | - "a.`stationRoute.descriptions`," + | |
| 52 | - "a.`stationRoute.versions`," + | |
| 53 | - "b.id AS 'station.id'," + | |
| 54 | - "b.station_cod AS 'station.stationCod'," + | |
| 55 | - "b.station_name AS 'station.stationName'," + | |
| 56 | - "b.road_coding AS 'station.roadCoding'," + | |
| 57 | - "b.db_type AS 'station.dbType'," + | |
| 58 | - "b.b_jwpoints AS 'station.bJwpoints'," + | |
| 59 | - "b.g_lonx AS 'station.gLonx'," + | |
| 60 | - "b.g_lonx AS 'station.gLaty'," + | |
| 61 | - "b.x AS 'station.x'," + | |
| 62 | - "b.y AS 'station.y'," + | |
| 63 | - "b.shapes_type AS 'station.shapesType'," + | |
| 64 | - "b.radius AS 'station.radius'," + | |
| 65 | - "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," + | |
| 66 | - "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + | |
| 67 | - "b.destroy AS 'station.destroy'," + | |
| 68 | - "b.versions AS 'station.versions'," + | |
| 69 | - "b.descriptions AS 'station.descriptions', " + | |
| 70 | - "a.`stationRoute.industryCode` " + | |
| 71 | - " FROM (" + | |
| 72 | - "SELECT r.id AS 'stationRoute.id'," + | |
| 73 | - " r.line AS 'stationRoute.line'," + | |
| 74 | - "r.station AS 'stationRoute.station'," + | |
| 75 | - "r.station_name AS 'stationRoute.stationName'," + | |
| 76 | - "r.station_route_code as 'stationRoute.stationRouteCode'," + | |
| 77 | - "r.line_code AS 'stationRoute.lineCode'," + | |
| 78 | - "r.station_mark AS 'stationRoute.stationMark'," + | |
| 79 | - "r.out_station_nmber AS 'stationRoute.outStationNmber'," + | |
| 80 | - "r.directions AS 'stationRoute.directions'," + | |
| 81 | - "r.distances AS 'stationRoute.distances'," + | |
| 82 | - "r.to_time AS 'stationRoute.toTime'," + | |
| 83 | - "r.first_time AS 'stationRoute.firstTime'," + | |
| 84 | - "r.end_time AS 'stationRoute.endTime'," + | |
| 85 | - "r.descriptions AS 'stationRoute.descriptions'," + | |
| 86 | - "r.versions AS 'stationRoute.versions', " + | |
| 87 | - "r.industry_code AS 'stationRoute.industryCode' " + | |
| 88 | - " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " + | |
| 89 | - "LEFT JOIN bsth_c_station b " + | |
| 90 | - "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) | |
| 91 | - List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions); | |
| 92 | - | |
| 93 | - | |
| 94 | - @Query(value = "SELECT a.stationRouteLine," + | |
| 95 | - " a.stationRouteStation," + | |
| 96 | - " a.stationRouteCode," + | |
| 97 | - " a.stationRouteLIneCode," + | |
| 98 | - " a.stationRouteStationMark," + | |
| 99 | - " a.stationOutStationNmber," + | |
| 100 | - " a.stationRoutedirections," + | |
| 101 | - " a.stationRouteDistances," + | |
| 102 | - " a.stationRouteToTime," + | |
| 103 | - " a.staitonRouteFirstTime," + | |
| 104 | - " a.stationRouteEndTime," + | |
| 105 | - " a.stationRouteDescriptions," + | |
| 106 | - " a.stationRouteDestroy," + | |
| 107 | - " a.stationRouteVersions," + | |
| 108 | - " a.stationRouteCreateBy," + | |
| 109 | - " a.stationRouteCreateDate," + | |
| 110 | - " a.stationRouteUpdateBy," + | |
| 111 | - " a.stationRouteUpdateDate," + | |
| 112 | - " b.id AS stationId," + | |
| 113 | - " b.station_cod AS stationCode," + | |
| 114 | - " a.stationRouteName," + | |
| 115 | - " b.road_coding AS stationRoadCoding," + | |
| 116 | - " b.db_type AS stationDbType," + | |
| 117 | - " b.b_jwpoints AS stationJwpoints," + | |
| 118 | - " b.g_lonx AS stationGlonx," + | |
| 119 | - " b.g_laty AS stationGlaty," + | |
| 120 | - " b.x AS stationX," + | |
| 121 | - " b.y AS stationY," + | |
| 122 | - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 123 | - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 124 | - " b.destroy AS stationDestroy," + | |
| 125 | - " b.radius AS stationRadius," + | |
| 126 | - " b.shapes_type AS stationShapesType," + | |
| 127 | - " b.versions AS stationVersions," + | |
| 128 | - " b.descriptions AS sttationDescriptions," + | |
| 129 | - " b.create_by AS stationCreateBy," + | |
| 130 | - " b.create_date AS stationCreateDate," + | |
| 131 | - " b.update_by AS stationUpdateBy," + | |
| 132 | - " b.update_date AS stationUpdateDate," + | |
| 133 | - " a.stationRouteId," + | |
| 134 | - "b.station_name as zdmc, "+ | |
| 135 | - "a.industryCode "+ | |
| 136 | - " FROM ( SELECT s.id AS stationRouteId," + | |
| 137 | - " s.line AS stationRouteLine," + | |
| 138 | - " s.station as stationRouteStation," + | |
| 139 | - " s.station_name AS stationRouteName," + | |
| 140 | - " s.station_route_code as stationRouteCode," + | |
| 141 | - " s.industry_code as industryCode," + | |
| 142 | - " s.line_code AS stationRouteLIneCode," + | |
| 143 | - " s.station_mark AS stationRouteStationMark," + | |
| 144 | - " s.out_station_nmber AS stationOutStationNmber," + | |
| 145 | - " s.directions AS stationRoutedirections," + | |
| 146 | - " s.distances AS stationRouteDistances," + | |
| 147 | - " s.to_time AS stationRouteToTime," + | |
| 148 | - " s.first_time AS staitonRouteFirstTime," + | |
| 149 | - " s.end_time AS stationRouteEndTime," + | |
| 150 | - " s.descriptions AS stationRouteDescriptions," + | |
| 151 | - " s.destroy AS stationRouteDestroy," + | |
| 152 | - " s.versions AS stationRouteVersions," + | |
| 153 | - " s.create_by AS stationRouteCreateBy," + | |
| 154 | - " s.create_date AS stationRouteCreateDate," + | |
| 155 | - " s.update_by AS stationRouteUpdateBy," + | |
| 156 | - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " + | |
| 157 | - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true) | |
| 158 | - List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version); | |
| 159 | - /** | |
| 160 | - * 更新路线前删除线路版本号历史原有站点路由 | |
| 161 | - * | |
| 162 | - * @param line | |
| 163 | - * @param dir | |
| 164 | - */ | |
| 165 | - @Modifying | |
| 166 | - @Transactional | |
| 167 | - @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | |
| 168 | - public void batchDelete(Integer line,Integer dir, Integer versions); | |
| 169 | - | |
| 170 | - /** | |
| 171 | - * 更新路线前撤销线路版本号历史原有站点路由 | |
| 172 | - * | |
| 173 | - * @param line | |
| 174 | - * @param dir | |
| 175 | - */ | |
| 176 | - @Modifying | |
| 177 | - @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | |
| 178 | - public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * 按线路编码查询各站点的顺序号 | |
| 182 | - * @param lineCode 线路编码 | |
| 183 | - * @param lineVersion 版本号 | |
| 184 | - * @return | |
| 185 | - */ | |
| 186 | - @Query("SELECT new map(" + | |
| 187 | - "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | |
| 188 | - "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | |
| 189 | - "FROM " + | |
| 190 | - "LsStationRoute s " + | |
| 191 | - "WHERE " + | |
| 192 | - "s.destroy = 0 AND s.lineCode = ?1 AND s.versions = ?2 " + | |
| 193 | - "ORDER BY " + | |
| 194 | - "lineCode,directions,stationRouteCode") | |
| 195 | - List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion); | |
| 196 | - /** | |
| 197 | - * @Description : TODO(根据站点路由Id查询详情) | |
| 198 | - * | |
| 199 | - * @param id:站点路由ID | |
| 200 | - * | |
| 201 | - * @return List<Object[]> | |
| 202 | - */ | |
| 203 | - @Query(value = "SELECT a.stationRouteLine," + | |
| 204 | - " a.stationRouteStation," + | |
| 205 | - " a.stationRouteCode," + | |
| 206 | - " a.stationRouteLIneCode," + | |
| 207 | - " a.stationRouteStationMark," + | |
| 208 | - " a.stationOutStationNmber," + | |
| 209 | - " a.stationRoutedirections," + | |
| 210 | - " a.stationRouteDistances," + | |
| 211 | - " a.stationRouteToTime," + | |
| 212 | - " a.staitonRouteFirstTime," + | |
| 213 | - " a.stationRouteEndTime," + | |
| 214 | - " a.stationRouteDescriptions," + | |
| 215 | - " a.stationRouteDestroy," + | |
| 216 | - " a.stationRouteVersions," + | |
| 217 | - " a.stationRouteCreateBy," + | |
| 218 | - " a.stationRouteCreateDate," + | |
| 219 | - " a.stationRouteUpdateBy," + | |
| 220 | - " a.stationRouteUpdateDate," + | |
| 221 | - " b.id AS stationId," + | |
| 222 | - " b.station_cod AS stationCode," + | |
| 223 | - " a.stationRouteName," + | |
| 224 | - " b.road_coding AS stationRoadCoding," + | |
| 225 | - " b.db_type AS stationDbType," + | |
| 226 | - " b.b_jwpoints AS stationJwpoints," + | |
| 227 | - " b.g_lonx AS stationGlonx," + | |
| 228 | - " b.g_laty AS stationGlaty," + | |
| 229 | - " b.x AS stationX," + | |
| 230 | - " b.y AS stationY," + | |
| 231 | - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 232 | - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 233 | - " b.destroy AS stationDestroy," + | |
| 234 | - " b.radius AS stationRadius," + | |
| 235 | - " b.shapes_type AS stationShapesType," + | |
| 236 | - " b.versions AS stationVersions," + | |
| 237 | - " b.descriptions AS sttationDescriptions," + | |
| 238 | - " b.create_by AS stationCreateBy," + | |
| 239 | - " b.create_date AS stationCreateDate," + | |
| 240 | - " b.update_by AS stationUpdateBy," + | |
| 241 | - " b.update_date AS stationUpdateDate," + | |
| 242 | - " a.stationRouteId,b.station_name as zdmc, " + | |
| 243 | - " a.industryCode "+ | |
| 244 | - " FROM " + | |
| 245 | - "( SELECT s.id AS stationRouteId," + | |
| 246 | - " s.line AS stationRouteLine," + | |
| 247 | - " s.station as stationRouteStation," + | |
| 248 | - " s.station_name AS stationRouteName," + | |
| 249 | - " s.station_route_code as stationRouteCode," + | |
| 250 | - " s.industry_code as industryCode," + | |
| 251 | - " s.line_code AS stationRouteLIneCode," + | |
| 252 | - " s.station_mark AS stationRouteStationMark," + | |
| 253 | - " s.out_station_nmber AS stationOutStationNmber," + | |
| 254 | - " s.directions AS stationRoutedirections," + | |
| 255 | - " s.distances AS stationRouteDistances," + | |
| 256 | - " s.to_time AS stationRouteToTime," + | |
| 257 | - " s.first_time AS staitonRouteFirstTime," + | |
| 258 | - " s.end_time AS stationRouteEndTime," + | |
| 259 | - " s.descriptions AS stationRouteDescriptions," + | |
| 260 | - " s.destroy AS stationRouteDestroy," + | |
| 261 | - " s.versions AS stationRouteVersions," + | |
| 262 | - " s.create_by AS stationRouteCreateBy," + | |
| 263 | - " s.create_date AS stationRouteCreateDate," + | |
| 264 | - " s.update_by AS stationRouteUpdateBy," + | |
| 265 | - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " + | |
| 266 | - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | |
| 267 | - List<Object[]> findStationRouteInfo(Integer id); | |
| 268 | - | |
| 269 | - // 批量修改站点行业编码 | |
| 270 | - @Modifying | |
| 271 | - @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true) | |
| 272 | - void updIndustryCode(Integer id, String industryCode); | |
| 273 | - | |
| 274 | - @Modifying | |
| 275 | - @Query(value="UPDATE bsth_c_ls_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) | |
| 276 | - void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | |
| 277 | - | |
| 278 | - @Modifying | |
| 279 | - @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | |
| 280 | - void stationRouteDir(Integer line); | |
| 281 | - | |
| 282 | - @Query("select r from LsStationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | |
| 283 | - List<LsStationRoute> findByLine(int lineId, int dir); | |
| 284 | - | |
| 285 | - @Modifying | |
| 286 | - @Query(value="update bsth_c_ls_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | |
| 287 | - void upddis(Integer id,Double dis); | |
| 288 | - | |
| 289 | - @Query(value="select * from bsth_c_ls_stationroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | |
| 290 | - Iterable<LsStationRoute> page(int start , int end , int line ,int dir, int version); | |
| 291 | - | |
| 292 | - @Query(value="select count(*) from bsth_c_ls_stationroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | |
| 293 | - int count(int line, int dir, int version); | |
| 294 | - | |
| 295 | - @Query(value = " select r.station_code, r.station_name, r.versions " + | |
| 296 | - "from bsth_c_ls_stationroute r where r.line_code = ?1 " + | |
| 297 | - "and r.directions=?2 and r.destroy = 0 and r.versions in(" + | |
| 298 | - "select v.versions from bsth_c_line_versions v where v.line_code=?1 " + | |
| 299 | - "and ((date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.start_date, '%Y-%m-%d') <= ?4) " + | |
| 300 | - " or (date_format(v.start_date, '%Y-%m-%d') <= ?4 and date_format(v.end_date, '%Y-%m-%d') >= ?4) " + | |
| 301 | - " or (date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.end_date, '%Y-%m-%d') <= ?4))" + | |
| 302 | - ") order by r.versions desc, r.station_route_code asc ", nativeQuery = true) | |
| 303 | - List<Object[]> findHistory(String lineCode, Integer updown, String date1, String date2); | |
| 304 | -} | |
| 1 | +package com.bsth.repository; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import org.springframework.data.jpa.repository.EntityGraph; | |
| 7 | +import org.springframework.data.jpa.repository.Modifying; | |
| 8 | +import org.springframework.data.jpa.repository.Query; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | +import org.springframework.transaction.annotation.Transactional; | |
| 11 | + | |
| 12 | +import com.bsth.entity.LsStationRoute; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | |
| 17 | + * | |
| 18 | + * @Extends : BaseRepository | |
| 19 | + * | |
| 20 | + * @Description: TODO(站点路由Repository数据持久层接口) | |
| 21 | + * | |
| 22 | + * @Author bsth@lq | |
| 23 | + * | |
| 24 | + * @Version 公交调度系统BS版 0.1 | |
| 25 | + * | |
| 26 | + */ | |
| 27 | + | |
| 28 | +@Repository | |
| 29 | +public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> { | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 查询待更新线路的站点路由 | |
| 33 | + */ | |
| 34 | + @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | |
| 35 | + @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") | |
| 36 | + List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions); | |
| 37 | + | |
| 38 | + @Query(value = "SELECT a.`stationRoute.id`," + | |
| 39 | + "a.`stationRoute.line`," + | |
| 40 | + "a.`stationRoute.station`," + | |
| 41 | + "a.`stationRoute.stationName`," + | |
| 42 | + "a.`stationRoute.stationRouteCode`," + | |
| 43 | + "a.`stationRoute.lineCode`," + | |
| 44 | + "a.`stationRoute.stationMark`," + | |
| 45 | + "a.`stationRoute.outStationNmber`," + | |
| 46 | + "a.`stationRoute.directions`," + | |
| 47 | + "a.`stationRoute.distances`," + | |
| 48 | + "a.`stationRoute.toTime`," + | |
| 49 | + "a.`stationRoute.firstTime`," + | |
| 50 | + "a.`stationRoute.endTime`," + | |
| 51 | + "a.`stationRoute.descriptions`," + | |
| 52 | + "a.`stationRoute.versions`," + | |
| 53 | + "b.id AS 'station.id'," + | |
| 54 | + "b.station_cod AS 'station.stationCod'," + | |
| 55 | + "b.station_name AS 'station.stationName'," + | |
| 56 | + "b.road_coding AS 'station.roadCoding'," + | |
| 57 | + "b.db_type AS 'station.dbType'," + | |
| 58 | + "b.b_jwpoints AS 'station.bJwpoints'," + | |
| 59 | + "b.g_lonx AS 'station.gLonx'," + | |
| 60 | + "b.g_lonx AS 'station.gLaty'," + | |
| 61 | + "b.x AS 'station.x'," + | |
| 62 | + "b.y AS 'station.y'," + | |
| 63 | + "b.shapes_type AS 'station.shapesType'," + | |
| 64 | + "b.radius AS 'station.radius'," + | |
| 65 | + "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," + | |
| 66 | + "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + | |
| 67 | + "b.destroy AS 'station.destroy'," + | |
| 68 | + "b.versions AS 'station.versions'," + | |
| 69 | + "b.descriptions AS 'station.descriptions', " + | |
| 70 | + "a.`stationRoute.industryCode` " + | |
| 71 | + " FROM (" + | |
| 72 | + "SELECT r.id AS 'stationRoute.id'," + | |
| 73 | + " r.line AS 'stationRoute.line'," + | |
| 74 | + "r.station AS 'stationRoute.station'," + | |
| 75 | + "r.station_name AS 'stationRoute.stationName'," + | |
| 76 | + "r.station_route_code as 'stationRoute.stationRouteCode'," + | |
| 77 | + "r.line_code AS 'stationRoute.lineCode'," + | |
| 78 | + "r.station_mark AS 'stationRoute.stationMark'," + | |
| 79 | + "r.out_station_nmber AS 'stationRoute.outStationNmber'," + | |
| 80 | + "r.directions AS 'stationRoute.directions'," + | |
| 81 | + "r.distances AS 'stationRoute.distances'," + | |
| 82 | + "r.to_time AS 'stationRoute.toTime'," + | |
| 83 | + "r.first_time AS 'stationRoute.firstTime'," + | |
| 84 | + "r.end_time AS 'stationRoute.endTime'," + | |
| 85 | + "r.descriptions AS 'stationRoute.descriptions'," + | |
| 86 | + "r.versions AS 'stationRoute.versions', " + | |
| 87 | + "r.industry_code AS 'stationRoute.industryCode' " + | |
| 88 | + " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " + | |
| 89 | + "LEFT JOIN bsth_c_station b " + | |
| 90 | + "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) | |
| 91 | + List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions); | |
| 92 | + | |
| 93 | + | |
| 94 | + @Query(value = "SELECT a.stationRouteLine," + | |
| 95 | + " a.stationRouteStation," + | |
| 96 | + " a.stationRouteCode," + | |
| 97 | + " a.stationRouteLIneCode," + | |
| 98 | + " a.stationRouteStationMark," + | |
| 99 | + " a.stationOutStationNmber," + | |
| 100 | + " a.stationRoutedirections," + | |
| 101 | + " a.stationRouteDistances," + | |
| 102 | + " a.stationRouteToTime," + | |
| 103 | + " a.staitonRouteFirstTime," + | |
| 104 | + " a.stationRouteEndTime," + | |
| 105 | + " a.stationRouteDescriptions," + | |
| 106 | + " a.stationRouteDestroy," + | |
| 107 | + " a.stationRouteVersions," + | |
| 108 | + " a.stationRouteCreateBy," + | |
| 109 | + " a.stationRouteCreateDate," + | |
| 110 | + " a.stationRouteUpdateBy," + | |
| 111 | + " a.stationRouteUpdateDate," + | |
| 112 | + " b.id AS stationId," + | |
| 113 | + " b.station_cod AS stationCode," + | |
| 114 | + " a.stationRouteName," + | |
| 115 | + " b.road_coding AS stationRoadCoding," + | |
| 116 | + " b.db_type AS stationDbType," + | |
| 117 | + " b.b_jwpoints AS stationJwpoints," + | |
| 118 | + " b.g_lonx AS stationGlonx," + | |
| 119 | + " b.g_laty AS stationGlaty," + | |
| 120 | + " b.x AS stationX," + | |
| 121 | + " b.y AS stationY," + | |
| 122 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 123 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 124 | + " b.destroy AS stationDestroy," + | |
| 125 | + " b.radius AS stationRadius," + | |
| 126 | + " b.shapes_type AS stationShapesType," + | |
| 127 | + " b.versions AS stationVersions," + | |
| 128 | + " b.descriptions AS sttationDescriptions," + | |
| 129 | + " b.create_by AS stationCreateBy," + | |
| 130 | + " b.create_date AS stationCreateDate," + | |
| 131 | + " b.update_by AS stationUpdateBy," + | |
| 132 | + " b.update_date AS stationUpdateDate," + | |
| 133 | + " a.stationRouteId," + | |
| 134 | + "b.station_name as zdmc, "+ | |
| 135 | + "a.industryCode "+ | |
| 136 | + " FROM ( SELECT s.id AS stationRouteId," + | |
| 137 | + " s.line AS stationRouteLine," + | |
| 138 | + " s.station as stationRouteStation," + | |
| 139 | + " s.station_name AS stationRouteName," + | |
| 140 | + " s.station_route_code as stationRouteCode," + | |
| 141 | + " s.industry_code as industryCode," + | |
| 142 | + " s.line_code AS stationRouteLIneCode," + | |
| 143 | + " s.station_mark AS stationRouteStationMark," + | |
| 144 | + " s.out_station_nmber AS stationOutStationNmber," + | |
| 145 | + " s.directions AS stationRoutedirections," + | |
| 146 | + " s.distances AS stationRouteDistances," + | |
| 147 | + " s.to_time AS stationRouteToTime," + | |
| 148 | + " s.first_time AS staitonRouteFirstTime," + | |
| 149 | + " s.end_time AS stationRouteEndTime," + | |
| 150 | + " s.descriptions AS stationRouteDescriptions," + | |
| 151 | + " s.destroy AS stationRouteDestroy," + | |
| 152 | + " s.versions AS stationRouteVersions," + | |
| 153 | + " s.create_by AS stationRouteCreateBy," + | |
| 154 | + " s.create_date AS stationRouteCreateDate," + | |
| 155 | + " s.update_by AS stationRouteUpdateBy," + | |
| 156 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " + | |
| 157 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true) | |
| 158 | + List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version); | |
| 159 | + /** | |
| 160 | + * 更新路线前删除线路版本号历史原有站点路由 | |
| 161 | + * | |
| 162 | + * @param line | |
| 163 | + * @param dir | |
| 164 | + */ | |
| 165 | + @Modifying | |
| 166 | + @Transactional | |
| 167 | + @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | |
| 168 | + public void batchDelete(Integer line,Integer dir, Integer versions); | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 更新路线前撤销线路版本号历史原有站点路由 | |
| 172 | + * | |
| 173 | + * @param line | |
| 174 | + * @param dir | |
| 175 | + */ | |
| 176 | + @Modifying | |
| 177 | + @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | |
| 178 | + public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * 按线路编码查询各站点的顺序号 | |
| 182 | + * @param lineCode 线路编码 | |
| 183 | + * @param lineVersion 版本号 | |
| 184 | + * @return | |
| 185 | + */ | |
| 186 | + @Query("SELECT new map(" + | |
| 187 | + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | |
| 188 | + "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | |
| 189 | + "FROM " + | |
| 190 | + "LsStationRoute s " + | |
| 191 | + "WHERE " + | |
| 192 | + "s.destroy = 0 AND s.lineCode = ?1 AND s.versions = ?2 " + | |
| 193 | + "ORDER BY " + | |
| 194 | + "lineCode,directions,stationRouteCode") | |
| 195 | + List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion); | |
| 196 | + /** | |
| 197 | + * @Description : TODO(根据站点路由Id查询详情) | |
| 198 | + * | |
| 199 | + * @param id:站点路由ID | |
| 200 | + * | |
| 201 | + * @return List<Object[]> | |
| 202 | + */ | |
| 203 | + @Query(value = "SELECT a.stationRouteLine," + | |
| 204 | + " a.stationRouteStation," + | |
| 205 | + " a.stationRouteCode," + | |
| 206 | + " a.stationRouteLIneCode," + | |
| 207 | + " a.stationRouteStationMark," + | |
| 208 | + " a.stationOutStationNmber," + | |
| 209 | + " a.stationRoutedirections," + | |
| 210 | + " a.stationRouteDistances," + | |
| 211 | + " a.stationRouteToTime," + | |
| 212 | + " a.staitonRouteFirstTime," + | |
| 213 | + " a.stationRouteEndTime," + | |
| 214 | + " a.stationRouteDescriptions," + | |
| 215 | + " a.stationRouteDestroy," + | |
| 216 | + " a.stationRouteVersions," + | |
| 217 | + " a.stationRouteCreateBy," + | |
| 218 | + " a.stationRouteCreateDate," + | |
| 219 | + " a.stationRouteUpdateBy," + | |
| 220 | + " a.stationRouteUpdateDate," + | |
| 221 | + " b.id AS stationId," + | |
| 222 | + " b.station_cod AS stationCode," + | |
| 223 | + " a.stationRouteName," + | |
| 224 | + " b.road_coding AS stationRoadCoding," + | |
| 225 | + " b.db_type AS stationDbType," + | |
| 226 | + " b.b_jwpoints AS stationJwpoints," + | |
| 227 | + " b.g_lonx AS stationGlonx," + | |
| 228 | + " b.g_laty AS stationGlaty," + | |
| 229 | + " b.x AS stationX," + | |
| 230 | + " b.y AS stationY," + | |
| 231 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | |
| 232 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | |
| 233 | + " b.destroy AS stationDestroy," + | |
| 234 | + " b.radius AS stationRadius," + | |
| 235 | + " b.shapes_type AS stationShapesType," + | |
| 236 | + " b.versions AS stationVersions," + | |
| 237 | + " b.descriptions AS sttationDescriptions," + | |
| 238 | + " b.create_by AS stationCreateBy," + | |
| 239 | + " b.create_date AS stationCreateDate," + | |
| 240 | + " b.update_by AS stationUpdateBy," + | |
| 241 | + " b.update_date AS stationUpdateDate," + | |
| 242 | + " a.stationRouteId,b.station_name as zdmc, " + | |
| 243 | + " a.industryCode "+ | |
| 244 | + " FROM " + | |
| 245 | + "( SELECT s.id AS stationRouteId," + | |
| 246 | + " s.line AS stationRouteLine," + | |
| 247 | + " s.station as stationRouteStation," + | |
| 248 | + " s.station_name AS stationRouteName," + | |
| 249 | + " s.station_route_code as stationRouteCode," + | |
| 250 | + " s.industry_code as industryCode," + | |
| 251 | + " s.line_code AS stationRouteLIneCode," + | |
| 252 | + " s.station_mark AS stationRouteStationMark," + | |
| 253 | + " s.out_station_nmber AS stationOutStationNmber," + | |
| 254 | + " s.directions AS stationRoutedirections," + | |
| 255 | + " s.distances AS stationRouteDistances," + | |
| 256 | + " s.to_time AS stationRouteToTime," + | |
| 257 | + " s.first_time AS staitonRouteFirstTime," + | |
| 258 | + " s.end_time AS stationRouteEndTime," + | |
| 259 | + " s.descriptions AS stationRouteDescriptions," + | |
| 260 | + " s.destroy AS stationRouteDestroy," + | |
| 261 | + " s.versions AS stationRouteVersions," + | |
| 262 | + " s.create_by AS stationRouteCreateBy," + | |
| 263 | + " s.create_date AS stationRouteCreateDate," + | |
| 264 | + " s.update_by AS stationRouteUpdateBy," + | |
| 265 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " + | |
| 266 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | |
| 267 | + List<Object[]> findStationRouteInfo(Integer id); | |
| 268 | + | |
| 269 | + // 批量修改站点行业编码 | |
| 270 | + @Modifying | |
| 271 | + @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true) | |
| 272 | + void updIndustryCode(Integer id, String industryCode); | |
| 273 | + | |
| 274 | + @Modifying | |
| 275 | + @Query(value="UPDATE bsth_c_ls_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) | |
| 276 | + void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | |
| 277 | + | |
| 278 | + @Modifying | |
| 279 | + @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | |
| 280 | + void stationRouteDir(Integer line); | |
| 281 | + | |
| 282 | + @Query("select r from LsStationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | |
| 283 | + List<LsStationRoute> findByLine(int lineId, int dir); | |
| 284 | + | |
| 285 | + @Modifying | |
| 286 | + @Query(value="update bsth_c_ls_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | |
| 287 | + void upddis(Integer id,Double dis); | |
| 288 | + | |
| 289 | + @Query(value="select * from bsth_c_ls_stationroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | |
| 290 | + Iterable<LsStationRoute> page(int start , int end , int line ,int dir, int version); | |
| 291 | + | |
| 292 | + @Query(value="select count(*) from bsth_c_ls_stationroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | |
| 293 | + int count(int line, int dir, int version); | |
| 294 | + | |
| 295 | + @Query(value = " select r.station_code, r.station_name, r.versions " + | |
| 296 | + "from bsth_c_ls_stationroute r where r.line_code = ?1 " + | |
| 297 | + "and r.directions=?2 and r.destroy = 0 and r.versions in(" + | |
| 298 | + "select v.versions from bsth_c_line_versions v where v.line_code=?1 " + | |
| 299 | + "and ((date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.start_date, '%Y-%m-%d') <= ?4) " + | |
| 300 | + " or (date_format(v.start_date, '%Y-%m-%d') <= ?4 and date_format(v.end_date, '%Y-%m-%d') >= ?4) " + | |
| 301 | + " or (date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.end_date, '%Y-%m-%d') <= ?4))" + | |
| 302 | + ") order by r.versions desc, r.station_route_code asc ", nativeQuery = true) | |
| 303 | + List<Object[]> findHistory(String lineCode, Integer updown, String date1, String date2); | |
| 304 | + | |
| 305 | + @Query("select r from LsStationRoute r where r.line.id=?1 and r.versions=?2 and r.directions=?3 and r.destroy=0 order by r.stationRouteCode") | |
| 306 | + List<LsStationRoute> findByLineVersion(int lineId, int version, int dir); | |
| 307 | +} | ... | ... |
src/main/java/com/bsth/service/InoutCarparkService.java
0 → 100644
| 1 | +package com.bsth.service; | |
| 2 | + | |
| 3 | +import com.bsth.entity.LsStationRoute; | |
| 4 | +import com.bsth.entity.StationRoute; | |
| 5 | +import com.bsth.entity.StationRouteCache; | |
| 6 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 7 | + | |
| 8 | +import javax.servlet.http.HttpServletResponse; | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +public interface InoutCarparkService { | |
| 13 | + | |
| 14 | + Map<String, Object> getStartEndByLine(int lineId, int version); | |
| 15 | + | |
| 16 | + Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end); | |
| 17 | + | |
| 18 | + Map<String, Object> sectionSave(Map<String, Object> map); | |
| 19 | + | |
| 20 | + Map<String, Object> sectionUpdate(Map<String, Object> map); | |
| 21 | + | |
| 22 | + Map<String, Object> destroy(Map<String, Object> map); | |
| 23 | + | |
| 24 | + void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException; | |
| 25 | +} | ... | ... |
src/main/java/com/bsth/service/impl/InoutCarparkServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.impl; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.bsth.common.ResponseCode; | |
| 5 | +import com.bsth.data.BasicData; | |
| 6 | +import com.bsth.entity.*; | |
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 8 | +import com.bsth.repository.*; | |
| 9 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 10 | +import com.bsth.service.InoutCarparkService; | |
| 11 | +import com.bsth.service.gps.GpsService; | |
| 12 | +import com.bsth.util.TransGPS; | |
| 13 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 14 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 15 | +import org.joda.time.DateTime; | |
| 16 | +import org.joda.time.format.DateTimeFormat; | |
| 17 | +import org.joda.time.format.DateTimeFormatter; | |
| 18 | +import org.slf4j.Logger; | |
| 19 | +import org.slf4j.LoggerFactory; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import org.springframework.stereotype.Service; | |
| 22 | +import org.springframework.transaction.annotation.Transactional; | |
| 23 | + | |
| 24 | +import javax.persistence.EntityManager; | |
| 25 | +import java.text.SimpleDateFormat; | |
| 26 | +import java.util.*; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * @author Hill | |
| 30 | + */ | |
| 31 | +@Service | |
| 32 | +public class InoutCarparkServiceImpl extends BaseServiceImpl<LsInoutSectionRoute, Long> implements InoutCarparkService { | |
| 33 | + | |
| 34 | + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkServiceImpl.class); | |
| 35 | + | |
| 36 | + @Autowired | |
| 37 | + private LsStationRouteRepository lsStationRouteRepository; | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + private CarParkRepository carParkRepository; | |
| 41 | + | |
| 42 | + @Autowired | |
| 43 | + private LsInoutSectionRouteRepository lsInoutSectionRouteRepository; | |
| 44 | + | |
| 45 | + @Autowired | |
| 46 | + private SectionRepository sectionRepository; | |
| 47 | + | |
| 48 | + @Autowired | |
| 49 | + LineRepository lineRepository; | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 53 | + | |
| 54 | + @Autowired | |
| 55 | + private GpsService gpsService; | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public Map<String, Object> getStartEndByLine(int lineId, int version) { | |
| 59 | + Map<String, Object> result = new HashMap<>(), data = new HashMap<>(); | |
| 60 | + result.put("code", 0); | |
| 61 | + result.put("msg", ""); | |
| 62 | + result.put("data", data); | |
| 63 | + | |
| 64 | + List<LsStationRoute> upRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 0), downRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 1); | |
| 65 | + CarPark carPark = carParkRepository.findByLineId(lineId); | |
| 66 | + if (carPark == null) { | |
| 67 | + result.put("code", 500); | |
| 68 | + result.put("msg", "线路标准信息中无相应的停车场信息"); | |
| 69 | + | |
| 70 | + return result; | |
| 71 | + } | |
| 72 | + if (upRoutes.size() < 2) { | |
| 73 | + result.put("code", 500); | |
| 74 | + result.put("msg", "线路上行站级少于2"); | |
| 75 | + | |
| 76 | + return result; | |
| 77 | + } | |
| 78 | + LsStationRoute upFirst = upRoutes.get(0), upLast = upRoutes.get(upRoutes.size() - 1); | |
| 79 | + LsStationRoute downFirst = downRoutes.get(0), downLast = downRoutes.get(downRoutes.size() - 1); | |
| 80 | + // 环线或双环线只需提取一个起点站 | |
| 81 | + if (upFirst.getStationCode().equals(upLast.getStationCode())) { | |
| 82 | + data.put("start", new LsStationRoute[]{ upFirst }); | |
| 83 | + data.put("end", new LsStationRoute[]{ upFirst }); | |
| 84 | + } else { | |
| 85 | + if (downRoutes.size() < 2) { | |
| 86 | + result.put("code", 500); | |
| 87 | + result.put("msg", "非环线线路下行站级少于2"); | |
| 88 | + | |
| 89 | + return result; | |
| 90 | + } | |
| 91 | + data.put("start", new LsStationRoute[]{ upFirst, downFirst }); | |
| 92 | + data.put("end", new LsStationRoute[]{ upLast, downLast }); | |
| 93 | + } | |
| 94 | + data.put("carpark", carPark); | |
| 95 | + | |
| 96 | + return result; | |
| 97 | + } | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end) { | |
| 101 | + Map<String, Object> result = new HashMap<>(), data = new HashMap<>(); | |
| 102 | + result.put("code", 0); | |
| 103 | + result.put("msg", ""); | |
| 104 | + result.put("data", data); | |
| 105 | + data.put("routes", lsInoutSectionRouteRepository.getRouteByStartEnd(lineId, version, start, end)); | |
| 106 | + | |
| 107 | + return result; | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * 新增路段信息 | |
| 112 | + * | |
| 113 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | |
| 114 | + * | |
| 115 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | |
| 116 | + * | |
| 117 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | |
| 118 | + * | |
| 119 | + * @return map<SUCCESS:成功;ERROR:异常> | |
| 120 | + */ | |
| 121 | + @Override | |
| 122 | + @Transactional | |
| 123 | + public Map<String, Object> sectionSave(Map<String, Object> map) { | |
| 124 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 125 | + try { | |
| 126 | + // 线路ID. | |
| 127 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); | |
| 128 | + // 线路编码. | |
| 129 | + String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | |
| 130 | + // 路段名称. | |
| 131 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | |
| 132 | + // 路段编码. | |
| 133 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | |
| 134 | + // 道路编码. | |
| 135 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 136 | + // 原始坐标类型. | |
| 137 | + String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); | |
| 138 | + // 路段几何图形坐标. | |
| 139 | + String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); | |
| 140 | + // 路段序号 | |
| 141 | + String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); | |
| 142 | + // 路段时长. | |
| 143 | + Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString()); | |
| 144 | + // 路段距离. | |
| 145 | + Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString()); | |
| 146 | + // 路段限速. | |
| 147 | + Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString()); | |
| 148 | + // 版本. | |
| 149 | + Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString()); | |
| 150 | + // 是否撤销. | |
| 151 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString()); | |
| 152 | + // 路段方向. | |
| 153 | + Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString()); | |
| 154 | + // 描述与说明. | |
| 155 | + String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); | |
| 156 | + // 起始 | |
| 157 | + String start = map.get("start").equals("")? "" : map.get("start").toString(); | |
| 158 | + // 结束 | |
| 159 | + String end = map.get("end").equals("")? "" : map.get("end").toString(); | |
| 160 | + // 原始线状图形坐标集合 | |
| 161 | + String sectionsBpoints = ""; | |
| 162 | + // WGS线状图形坐标集合 | |
| 163 | + String sectionsWJPpoints = ""; | |
| 164 | + if(!sectionJSON.equals("")) { | |
| 165 | + // 转换成JSON数组 | |
| 166 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | |
| 167 | + // 遍历 | |
| 168 | + for(int s = 0 ;s<sectionsArray.size();s++) { | |
| 169 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | |
| 170 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | |
| 171 | + String WGSLngStr = ""; | |
| 172 | + String WGSLatStr = ""; | |
| 173 | + TransGPS.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | |
| 174 | + WGSLngStr = String.valueOf(resultPoint.getLng()); | |
| 175 | + WGSLatStr = String.valueOf(resultPoint.getLat()); | |
| 176 | + if(s==0) { | |
| 177 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | |
| 178 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | |
| 179 | + }else { | |
| 180 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | |
| 181 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | |
| 182 | + } | |
| 183 | + } | |
| 184 | + } | |
| 185 | + // WGS坐标点集合 | |
| 186 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 187 | + // 原坐标点集合 | |
| 188 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | |
| 189 | + String crosesRoad=""; | |
| 190 | + String endNode =""; | |
| 191 | + String startNode=""; | |
| 192 | + String middleNode=""; | |
| 193 | + String sectionType=""; | |
| 194 | + String csectionVector=null; | |
| 195 | + Integer id = Integer.valueOf(sectionCode); | |
| 196 | + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); | |
| 197 | + Section section = sectionRepository.findById(id).get(); | |
| 198 | + | |
| 199 | + Line line = lineRepository.findById(lineId).get(); | |
| 200 | + | |
| 201 | + | |
| 202 | + if (map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | |
| 203 | + | |
| 204 | + LsInoutSectionRoute sectionRoute = new LsInoutSectionRoute(); | |
| 205 | + Integer routeCode = null; | |
| 206 | + if(!sectionrouteCode.equals("")){ | |
| 207 | + String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | |
| 208 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; | |
| 209 | + }else { | |
| 210 | + routeCode = 1; | |
| 211 | + } | |
| 212 | + sectionRoute.setSectionrouteCode(routeCode); | |
| 213 | + sectionRoute.setLineCode(lineCode); | |
| 214 | + sectionRoute.setSection(section); | |
| 215 | + sectionRoute.setSectionCode(sectionCode); | |
| 216 | + sectionRoute.setDirections(directions); | |
| 217 | + sectionRoute.setDescriptions(descriptions); | |
| 218 | + sectionRoute.setDestroy(destroy); | |
| 219 | + sectionRoute.setVersions(versions); | |
| 220 | + sectionRoute.setLine(line); | |
| 221 | + sectionRoute.setStart(start); | |
| 222 | + sectionRoute.setEnd(end); | |
| 223 | + lsInoutSectionRouteRepository.save(sectionRoute); | |
| 224 | + } | |
| 225 | + | |
| 226 | + | |
| 227 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 228 | + } catch (Exception e) { | |
| 229 | + resultMap.put("status", ResponseCode.ERROR); | |
| 230 | + logger.error("save erro.", e); | |
| 231 | + } | |
| 232 | + return resultMap; | |
| 233 | + } | |
| 234 | + | |
| 235 | + /** 百度坐标转WGS坐标 */ | |
| 236 | + public TransGPS.Location FromBDPointToWGSPoint(String bLonx, String bLatx) { | |
| 237 | + | |
| 238 | + double lng = Double.parseDouble(bLonx); | |
| 239 | + | |
| 240 | + double lat = Double.parseDouble(bLatx); | |
| 241 | + | |
| 242 | + TransGPS.Location bdLoc = TransGPS.LocationMake(lng, lat); | |
| 243 | + | |
| 244 | + TransGPS.Location location = TransGPS.bd_decrypt(bdLoc); | |
| 245 | + | |
| 246 | + TransGPS.Location WGSPoint = TransGPS.transformFromGCJToWGS(location); | |
| 247 | + | |
| 248 | + return WGSPoint; | |
| 249 | + | |
| 250 | + } | |
| 251 | + | |
| 252 | + /** | |
| 253 | + * @Description :TODO(编辑线路走向) | |
| 254 | + * | |
| 255 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | |
| 256 | + * | |
| 257 | + * @return Map<String, Object> <SUCCESS ; ERROR> | |
| 258 | + */ | |
| 259 | + @Override | |
| 260 | + @Transactional | |
| 261 | + public Map<String, Object> sectionUpdate(Map<String, Object> map) { | |
| 262 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 263 | + try { | |
| 264 | + String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); | |
| 265 | + // 原始线状图形坐标集合 | |
| 266 | + String sectionsBpoints = ""; | |
| 267 | + // WGS线状图形坐标集合 | |
| 268 | + String sectionsWJPpoints = ""; | |
| 269 | + if(!bsectionVector.equals("")) { | |
| 270 | + // 转换成JSON数组 | |
| 271 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | |
| 272 | + // 遍历 | |
| 273 | + for(int s = 0 ;s<sectionsArray.size();s++) { | |
| 274 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | |
| 275 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | |
| 276 | + /** to WGS坐标 */ | |
| 277 | + TransGPS.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | |
| 278 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | |
| 279 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | |
| 280 | + if(s==0) { | |
| 281 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | |
| 282 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | |
| 283 | + }else { | |
| 284 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | |
| 285 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | |
| 286 | + } | |
| 287 | + } | |
| 288 | + } | |
| 289 | + // 原坐标类型 | |
| 290 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | |
| 291 | + // 说明 | |
| 292 | + String descriptions = ""; | |
| 293 | + // 是否撤销 | |
| 294 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | |
| 295 | + // 方向 | |
| 296 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | |
| 297 | + // 线路ID | |
| 298 | + Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | |
| 299 | + // 道路编码 | |
| 300 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 301 | + // 路段编码 | |
| 302 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | |
| 303 | + // 路段长度 | |
| 304 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | |
| 305 | + // 路段ID | |
| 306 | + Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); | |
| 307 | + // 路段名称 | |
| 308 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | |
| 309 | + // 路段路由Id | |
| 310 | + Long sectionRouteId = map.get("sectionRouteId").equals("") ? null : Long.valueOf(map.get("sectionRouteId").toString()); | |
| 311 | + // 线路编码 | |
| 312 | + String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | |
| 313 | + // 路段时长 | |
| 314 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | |
| 315 | + // 路段路由 | |
| 316 | + Integer sectionrouteCode = "".equals(map.get("sectionrouteCode")) ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | |
| 317 | + // 限速 | |
| 318 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | |
| 319 | + // 版本 | |
| 320 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | |
| 321 | + // 起始 | |
| 322 | + String start = map.get("start").equals("")? "" : map.get("start").toString(); | |
| 323 | + // 结束 | |
| 324 | + String end = map.get("end").equals("")? "" : map.get("end").toString(); | |
| 325 | + // WGS坐标点集合 | |
| 326 | + String gsectionVector = null; | |
| 327 | + if(!sectionsWJPpoints.equals("")) { | |
| 328 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 329 | + } | |
| 330 | + // 原坐标点集合 | |
| 331 | + String bsectionVectorS = null; | |
| 332 | + if(!sectionsBpoints.equals("")) { | |
| 333 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | |
| 334 | + } | |
| 335 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | |
| 336 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | |
| 337 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | |
| 338 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | |
| 339 | + Date date = new Date(); | |
| 340 | + // 修改日期 | |
| 341 | + String updateDate = formatter.format(date); | |
| 342 | + String crosesRoad=""; | |
| 343 | + String endNode=""; | |
| 344 | + String startNode=""; | |
| 345 | + String middleNode=""; | |
| 346 | + String sectionType=""; | |
| 347 | + // 更新 | |
| 348 | + sectionRepository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | |
| 349 | + | |
| 350 | + Line line = lineRepository.findById(sectionRouteLine).get(); | |
| 351 | + Section section = sectionRepository.findById(sectionId).get(); | |
| 352 | + | |
| 353 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | |
| 354 | + | |
| 355 | + LsInoutSectionRoute resultS = lsInoutSectionRouteRepository.findById(sectionRouteId).get(); | |
| 356 | + int old_code = resultS.getSectionrouteCode(); | |
| 357 | + // 是否修改路段序号标记 | |
| 358 | + boolean type = false; | |
| 359 | + if(sectionrouteCode!=null) { | |
| 360 | + if(++sectionrouteCode == old_code) { | |
| 361 | + type = true; | |
| 362 | + } | |
| 363 | + // 默认是最前面路段 | |
| 364 | + }else { | |
| 365 | + sectionrouteCode = 1; | |
| 366 | + } | |
| 367 | + if(!type) | |
| 368 | + lsInoutSectionRouteRepository.sectionUpdSectionRouteCode(lineCode, version, start, end,sectionrouteCode); | |
| 369 | + LsInoutSectionRoute route = new LsInoutSectionRoute(); | |
| 370 | + route.setId(sectionRouteId); | |
| 371 | + route.setSectionrouteCode(sectionrouteCode); | |
| 372 | + route.setLineCode(lineCode); | |
| 373 | + route.setSectionCode(sectionCode); | |
| 374 | + route.setDirections(directions); | |
| 375 | + route.setVersions(version); | |
| 376 | + route.setDestroy(destroy); | |
| 377 | + route.setCreateBy(createBy); | |
| 378 | + route.setUpdateBy(updateBy); | |
| 379 | + route.setSection(section); | |
| 380 | + route.setLine(line); | |
| 381 | + route.setStart(start); | |
| 382 | + route.setEnd(end); | |
| 383 | + lsInoutSectionRouteRepository.save(route); | |
| 384 | + } | |
| 385 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 386 | + } catch (Exception e) { | |
| 387 | + resultMap.put("status", ResponseCode.ERROR); | |
| 388 | + logger.error("save erro.", e); | |
| 389 | + } | |
| 390 | + return resultMap; | |
| 391 | + } | |
| 392 | + | |
| 393 | + @Override | |
| 394 | + public Map<String, Object> destroy(Map<String, Object> map) { | |
| 395 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 396 | + try { | |
| 397 | + long id = Long.parseLong(map.get("id").toString()); | |
| 398 | + | |
| 399 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | |
| 400 | + lsInoutSectionRouteRepository.deleteById(id); | |
| 401 | + } | |
| 402 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 403 | + } catch (Exception e) { | |
| 404 | + resultMap.put("status", ResponseCode.ERROR); | |
| 405 | + logger.error("destroy erro.", e); | |
| 406 | + } | |
| 407 | + return resultMap; | |
| 408 | + } | |
| 409 | + | |
| 410 | + @Override | |
| 411 | + @Transactional | |
| 412 | + public void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException { | |
| 413 | + ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findById(schId).get(); | |
| 414 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 415 | + DateTime start = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getFcsjActual()); | |
| 416 | + DateTime end = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getZdsjActual()); | |
| 417 | + if (start.isAfter(end)) { | |
| 418 | + end = end.plusDays(1); | |
| 419 | + } | |
| 420 | + Map<String, Object> map = gpsService.history(new String[]{ scheduleRealInfo.getClZbh() }, start.getMillis() / 1000 - 20, end.getMillis() / 1000 + 20); | |
| 421 | + List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("list"); | |
| 422 | + List<Map<String, Object>> bsectionVector = new ArrayList<>(); | |
| 423 | + for (Map<String, Object> m : list) { | |
| 424 | + Map<String, Object> m1 = new HashMap<>(); | |
| 425 | + Float lng = (Float)m.get("lon"), lat = (Float)m.get("lat"); | |
| 426 | + if (lng == 0 || lat == 0) { | |
| 427 | + continue; | |
| 428 | + } | |
| 429 | + m1.put("lng", m.get("bd_lon")); | |
| 430 | + m1.put("lat", m.get("bd_lat")); | |
| 431 | + bsectionVector.add(m1); | |
| 432 | + } | |
| 433 | + map.clear(); | |
| 434 | + map.put("lineId", scheduleRealInfo.getXlBm()); | |
| 435 | + map.put("lineCode", scheduleRealInfo.getXlBm()); | |
| 436 | + map.put("sectionName", scheduleRealInfo.getQdzName() + "-" + scheduleRealInfo.getZdzName()); | |
| 437 | + map.put("sectionCode", sectionRepository.sectionMaxId() + 1); | |
| 438 | + map.put("roadCoding", ""); | |
| 439 | + map.put("dbType", "b"); | |
| 440 | + map.put("sectionrouteCode", "1"); | |
| 441 | + map.put("sectionTime", ""); | |
| 442 | + map.put("sectionDistance", ""); | |
| 443 | + map.put("speedLimit", "60"); | |
| 444 | + map.put("versions", versions); | |
| 445 | + map.put("destroy", 0); | |
| 446 | + map.put("directions", 3); | |
| 447 | + map.put("descriptions", ""); | |
| 448 | + map.put("start", scheduleRealInfo.getQdzCode()); | |
| 449 | + map.put("end", scheduleRealInfo.getZdzCode()); | |
| 450 | + map.put("bsectionVector", new ObjectMapper().writeValueAsString(bsectionVector)); | |
| 451 | + | |
| 452 | + lsInoutSectionRouteRepository.destroy(scheduleRealInfo.getXlBm(), versions, scheduleRealInfo.getQdzCode(), scheduleRealInfo.getZdzCode()); | |
| 453 | + sectionSave(map); | |
| 454 | + } | |
| 455 | +} | ... | ... |
src/main/resources/logback.xml
| ... | ... | @@ -359,6 +359,10 @@ |
| 359 | 359 | <level value="INFO" /> |
| 360 | 360 | <appender-ref ref="STDOUT" /> |
| 361 | 361 | </logger> |
| 362 | + <!--<logger name="org.hibernate.type.descriptor.sql.BasicBinder" additivity="true"> | |
| 363 | + <level value="TRACE" /> | |
| 364 | + <appender-ref ref="STDOUT" /> | |
| 365 | + </logger>--> | |
| 362 | 366 | |
| 363 | 367 | <!-- 日志输出级别 --> |
| 364 | 368 | <root level="info"> | ... | ... |
src/main/resources/static/pages/base/stationroute/editsection_inout.html
0 → 100644
| 1 | +<!-- 编辑路段 --> | |
| 2 | +<div class="modal fade" id="edit_section_mobal" 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" action="/module" 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="section.id"> | |
| 16 | + <input type="hidden" name="sectionRouteId" id="id"> | |
| 17 | + <input type="hidden" name="sectionCode" id="section.sectionCode"> | |
| 18 | + <input type="hidden" name="sectionRouteLine" id="lineId"> | |
| 19 | + <input type="hidden" name="lineCode" id="lineCode"> | |
| 20 | + <input type="hidden" name="bsectionVector" id="bsectionVector" /> | |
| 21 | + <input type="hidden" name="csectionVector" id="csectionVector" value=""/> | |
| 22 | + <input type="hidden" name="dbType" id="dbType" value="b"/> | |
| 23 | + <input type="hidden" name="directions" id="dir"> | |
| 24 | + <input type="hidden" name="speedLimit" id="speedLimit" > | |
| 25 | + <input type="hidden" name="roadCoding" id="roadCoding"/> | |
| 26 | + <input type="hidden" name="versions" id="versions"/> | |
| 27 | + <input type="hidden" name="start" id="start"/> | |
| 28 | + <input type="hidden" name="end" id="end"/> | |
| 29 | + <!-- 路段名称 --> | |
| 30 | + <div class="form-body"> | |
| 31 | + <div class="form-group"> | |
| 32 | + <label class="control-label col-md-3"> | |
| 33 | + <span class="required"> * </span> 路段名称: | |
| 34 | + </label> | |
| 35 | + <div class="col-md-6"> | |
| 36 | + <input type="text" class="form-control" name="sectionName" id="sectionName" placeholder="路段名称"> | |
| 37 | + </div> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + <!-- 路段序号 --> | |
| 41 | + <div class="form-body"> | |
| 42 | + <div class="form-group"> | |
| 43 | + <label class="control-label col-md-3"> | |
| 44 | + 上一路段: | |
| 45 | + </label> | |
| 46 | + <div class="col-md-6"> | |
| 47 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCode" style="width:100%"></select> | |
| 48 | + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | |
| 49 | + </div> | |
| 50 | + </div> | |
| 51 | + </div> | |
| 52 | + </form> | |
| 53 | + </div> | |
| 54 | + <div class="modal-footer"> | |
| 55 | + <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button> | |
| 56 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | +</div> | |
| 61 | +<script type="text/javascript"> | |
| 62 | +debugger; | |
| 63 | +$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){ | |
| 64 | + function setSectionFormValue(section) { | |
| 65 | + $('#edit_section_form input').each(function() { | |
| 66 | + $(this).val(eval('section.' + this.id)); | |
| 67 | + }); | |
| 68 | + } | |
| 69 | + let section = p.data; | |
| 70 | + let lineId = section.lineCode, version = section.versions, start = section.start, end = section.end; | |
| 71 | + setSectionFormValue(section); | |
| 72 | + // 获取路段号元素,并添加下拉属性值 | |
| 73 | + ajaxd.getRouteByStartEnd(lineId,version,start, end,function(result) { | |
| 74 | + let routes = result.data.routes,paramsD =new Array(); | |
| 75 | + var eq_scetionRouteCode = section.sectionrouteCode; | |
| 76 | + paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'}); | |
| 77 | + // 遍历 | |
| 78 | + $.each(routes, function(i, g){ | |
| 79 | + // 判断. | |
| 80 | + if(g.section.sectionName) { | |
| 81 | + let ptions_v = g.sectionrouteCode; | |
| 82 | + if(eq_scetionRouteCode != ptions_v) { | |
| 83 | + // 添加拼音检索下拉框格式数据数组. | |
| 84 | + paramsD.push({'id':ptions_v, | |
| 85 | + 'text':g.section.sectionName + '(' + ptions_v + ')'}); | |
| 86 | + } | |
| 87 | + } | |
| 88 | + }); | |
| 89 | + // 初始化上一个路段拼音检索下拉框. | |
| 90 | + initPinYinSelect2($('#sectionrouteCode'),paramsD,function(selector) { | |
| 91 | + if(paramsD.length > 0) { | |
| 92 | + var upStationRouteCode = paramsD[paramsD.length - 1].sectionrouteCode; | |
| 93 | + $('#sectionrouteCode').select2('val',upStationRouteCode); | |
| 94 | + }else { | |
| 95 | + $('#sectionrouteCode').select2('val','请选择...'); | |
| 96 | + } | |
| 97 | + }); | |
| 98 | + }); | |
| 99 | + // 显示mobal | |
| 100 | + $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});// | |
| 101 | + // 当调用 hide 实例方法时触发 | |
| 102 | + $('#edit_section_mobal').on('hide.bs.modal', function () { | |
| 103 | + closeMobleSetClean(); | |
| 104 | + }); | |
| 105 | + function closeMobleSetClean() { | |
| 106 | + // 清除地图覆盖物 | |
| 107 | + map_.clearMarkAndOverlays(); | |
| 108 | + $('#inoutSearch').click(); | |
| 109 | + fun.editAChangeCssRemoveDisabled(); | |
| 110 | + //ajaxd.getSectionRouteInfo(lineId,dir,$("#versions").val(),function(data) { | |
| 111 | + // fun.linePanlThree(lineId,data,dir); | |
| 112 | + //}); | |
| 113 | + setTimeout(function () { | |
| 114 | + map_.openSectionInfoWin_inout(p); | |
| 115 | + },1000); | |
| 116 | + } | |
| 117 | + // 编辑表单元素 | |
| 118 | + var form = $('#edit_section_form'); | |
| 119 | + // 获取错误提示元素 | |
| 120 | + var error = $('.alert-danger', form); | |
| 121 | + // 提交数据按钮事件 | |
| 122 | + $('#editSectionButton').on('click', function() { | |
| 123 | + // 表单提交 | |
| 124 | + form.submit(); | |
| 125 | + }); | |
| 126 | + // 表单验证 | |
| 127 | + form.validate({ | |
| 128 | + errorElement : 'span', | |
| 129 | + errorClass : 'help-block help-block-error', | |
| 130 | + focusInvalid : false, | |
| 131 | + rules : { | |
| 132 | + 'sectionName' : {required : true,maxlength:50} | |
| 133 | + }, | |
| 134 | + invalidHandler : function(event, validator) { | |
| 135 | + error.show(); | |
| 136 | + App.scrollTo(error, -200); | |
| 137 | + }, | |
| 138 | + highlight : function(element) { | |
| 139 | + $(element).closest('.form-group').addClass('has-error'); | |
| 140 | + }, | |
| 141 | + unhighlight : function(element) { | |
| 142 | + $(element).closest('.form-group').removeClass('has-error'); | |
| 143 | + }, | |
| 144 | + success : function(label) { | |
| 145 | + label.closest('.form-group').removeClass('has-error'); | |
| 146 | + }, | |
| 147 | + submitHandler : function(f) { | |
| 148 | + // 获取折线坐标集合 | |
| 149 | + var editPloyLineArray = p.getPath(); | |
| 150 | + // 折线坐标集合 | |
| 151 | + $('#bsectionVector').val(JSON.stringify(editPloyLineArray)); | |
| 152 | + var params = form.serializeJSON(); | |
| 153 | + params.destroy=0; | |
| 154 | + params.sectionDistance=0; | |
| 155 | + params.sectionTime=0; | |
| 156 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | |
| 157 | + error.hide(); | |
| 158 | + debugger | |
| 159 | + if(params.sectionrouteCode=='请选择...') | |
| 160 | + params.sectionrouteCode=''; | |
| 161 | + ajaxd.inoutSectionUpdate(params,function(resuntDate) { | |
| 162 | + if(resuntDate.status=='SUCCESS') { | |
| 163 | + // 弹出添加成功提示消息 | |
| 164 | + layer.msg('修改成功...'); | |
| 165 | + }else { | |
| 166 | + // 弹出添加失败提示消息 | |
| 167 | + layer.msg('修改失败...'); | |
| 168 | + } | |
| 169 | + $('#edit_section_mobal').modal('hide'); | |
| 170 | + var dir = params.directions | |
| 171 | + closeMobleSetClean(); | |
| 172 | + }); | |
| 173 | + } | |
| 174 | + }); | |
| 175 | +}); | |
| 176 | +</script> | |
| 0 | 177 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
| ... | ... | @@ -196,6 +196,41 @@ var GetAjaxData = function(){ |
| 196 | 196 | |
| 197 | 197 | }); |
| 198 | 198 | |
| 199 | + }, | |
| 200 | + | |
| 201 | + // 编辑线路走向保存 | |
| 202 | + inoutSectionUpdate:function(section,callback) { | |
| 203 | + $post('/inout/sectionUpdate',section,function(data) { | |
| 204 | + callback && callback(data); | |
| 205 | + }) | |
| 206 | + }, | |
| 207 | + | |
| 208 | + // 生成线路走向 | |
| 209 | + inoutSectionSave:function(section,callback){ | |
| 210 | + $post('/inout/sectionSave',section,function(data) { | |
| 211 | + callback && callback(data); | |
| 212 | + }) | |
| 213 | + }, | |
| 214 | + | |
| 215 | + // 根据线路查找进出场的起终点信息 | |
| 216 | + getStartEndByLine: function (lineId, version, cb) { | |
| 217 | + $get('/inout/getStartEndByLine', {lineId : lineId, version : version}, function (r) { | |
| 218 | + return cb && cb(r); | |
| 219 | + }); | |
| 220 | + }, | |
| 221 | + | |
| 222 | + // 根据起终点查找对应的路段信息 | |
| 223 | + getRouteByStartEnd: function (lineId, version, start, end, cb) { | |
| 224 | + $get('/inout/getRouteByStartEnd', {lineId : lineId, version : version, start : start, end : end}, function (r) { | |
| 225 | + return cb && cb(r); | |
| 226 | + }); | |
| 227 | + }, | |
| 228 | + | |
| 229 | + // 根据ID查询路段信息. | |
| 230 | + getRouteInfoById : function(sectionRouteId,callback){ | |
| 231 | + $get('/inout/' + sectionRouteId,{},function(r) { | |
| 232 | + return callback && callback(r); | |
| 233 | + }); | |
| 199 | 234 | } |
| 200 | 235 | }; |
| 201 | 236 | return ajaxData; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| 1 | -$(function(){ | |
| 2 | - | |
| 3 | - // 上行方向(0:上行;1:下行) | |
| 4 | - var directionUpValue = $('#stationUp').data('direction'); | |
| 5 | - | |
| 6 | - // 下行方向 (0:上行;1:下行) | |
| 7 | - var directionDownValue = $('.downSystem').data('direction'); | |
| 8 | - | |
| 9 | - | |
| 10 | - | |
| 11 | - // 系统规划上行站点点击事件 | |
| 12 | - $('.upSystem').on('click',function() { | |
| 13 | - // 隐藏上行规划 | |
| 14 | - $('#upToolsMobal').hide(); | |
| 15 | - // 弹出正在加载层 | |
| 16 | - var i = layer.load(0,{offset:['200px', '280px']}); | |
| 17 | - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | |
| 18 | - PublicFunctions.lineNameIsHaveInterval(directionUpValue); | |
| 19 | - | |
| 20 | - }); | |
| 21 | - | |
| 22 | - // 上行站点其它规划点击事件 | |
| 23 | - $('.upManual').on('click',function() { | |
| 24 | - // 加载模板手动添加站点页面 | |
| 25 | - $.get('addstationstemplate.html', function(m){ | |
| 26 | - $(pjaxContainer).append(m); | |
| 27 | - $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | |
| 28 | - }); | |
| 29 | - /*// 加载其它规划选择弹出层mobal页面 | |
| 30 | - $.get('add_manual_select.html', function(m){ | |
| 31 | - $(pjaxContainer).append(m); | |
| 32 | - $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | |
| 33 | - });*/ | |
| 34 | - | |
| 35 | - }); | |
| 36 | - $('.gpsRoute').on('click',function() { | |
| 37 | - var Line = LineObj.getLineObj(); | |
| 38 | - // 加载其它规划选择弹出层mobal页面 | |
| 39 | - $.get('editRoute.html', function(m){ | |
| 40 | - $(pjaxContainer).append(m); | |
| 41 | - $('#edit_route_mobal').trigger('editRouteMobal.show', [WorldsBMap,GetAjaxData,Line,PublicFunctions]); | |
| 42 | - }); | |
| 43 | - }); | |
| 44 | - | |
| 45 | - // 上行站点新增事件 | |
| 46 | - $('.module_tools #addUpStation').on('click', function() { | |
| 47 | - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 48 | - AddStationObj.setAddStationDiraction(directionUpValue); | |
| 49 | - // 加载选择新增方式mobal | |
| 50 | - $.get('add_select.html', function(m){ | |
| 51 | - $(pjaxContainer).append(m); | |
| 52 | - $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | |
| 53 | - }); | |
| 54 | - }); | |
| 55 | - | |
| 56 | - // 修改上行站点mobal页面 | |
| 57 | - $('.module_tools #editUpStation').on('click', function(){ | |
| 58 | - var sel = PublicFunctions.getCurrSelNode(directionUpValue); | |
| 59 | - if(sel.length==0 || sel[0].original.chaildredType !='station'){ | |
| 60 | - layer.msg('请先选择要编辑的上行站点!'); | |
| 61 | - return; | |
| 62 | - } | |
| 63 | - $.get('edit_select.html', function(m){ | |
| 64 | - $(pjaxContainer).append(m); | |
| 65 | - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]); | |
| 66 | - }); | |
| 67 | - }); | |
| 68 | - | |
| 69 | - // 撤销上行站点 | |
| 70 | - $('.module_tools #deleteUpStation').on('click', function() { | |
| 71 | - PublicFunctions.stationRevoke(directionUpValue); | |
| 72 | - }); | |
| 73 | - | |
| 74 | - // 上行批量撤销事件 | |
| 75 | - $('.module_tools #batchUpDelete').on('click', function() { | |
| 76 | - var Line = LineObj.getLineObj(); | |
| 77 | - /** 设置批量删除的线路方向 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 78 | - DeleteBatchObj.setDeteleBatchDiraction(directionUpValue); | |
| 79 | - // 加载选择新增方式mobal | |
| 80 | - $.get('delete_select.html', function(m){ | |
| 81 | - $(pjaxContainer).append(m); | |
| 82 | - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | |
| 83 | - }); | |
| 84 | - }); | |
| 85 | - | |
| 86 | - // 切换上下行. | |
| 87 | - $('.retweet').on('click',function() { | |
| 88 | - layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', { | |
| 89 | - btn : [ '确认提示并提交', '取消' ] | |
| 90 | - },function () { | |
| 91 | - // 关闭所有提示弹出层. | |
| 92 | - layer.closeAll(); | |
| 93 | - // 弹出提示层. | |
| 94 | - var index = layer.load(1, { | |
| 95 | - shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 96 | - }); | |
| 97 | - var Line = LineObj.getLineObj(); | |
| 98 | - $post('/stationroute/updSwitchDir?lineIds='+ Line.id + "&status=" + $($("#versions").find("option:selected")[0]).attr("status") ,null,function(data) { | |
| 99 | - layer.close(index); | |
| 100 | - if(data.status=='SUCCESS') { | |
| 101 | - // 弹出操作成功提示消息 | |
| 102 | - layer.msg('操作成功...'); | |
| 103 | - }else { | |
| 104 | - // 弹出操作失败提示消息 | |
| 105 | - layer.msg('操作成功...'); | |
| 106 | - } | |
| 107 | - WorldsBMap.clearMarkAndOverlays(); | |
| 108 | - $('#stationDown').removeClass('active'); | |
| 109 | - $('#stationDown').removeClass('in'); | |
| 110 | - $('#stationDown').addClass('fade'); | |
| 111 | - $('#stationUp').addClass('active in'); | |
| 112 | - $('#downLine').parent().removeClass('active'); | |
| 113 | - $('#upLine').parent().addClass('active'); | |
| 114 | - // 刷新左边树 | |
| 115 | - PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val()); | |
| 116 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 117 | -// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | |
| 118 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 119 | -// PublicFunctions.linePanlThree(Line.id,data,0); | |
| 120 | -// }); | |
| 121 | - }); | |
| 122 | - }); | |
| 123 | - }); | |
| 124 | - | |
| 125 | - $('#wrenchUpDis').on('click',function() { | |
| 126 | - var Line = LineObj.getLineObj(); | |
| 127 | - GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) { | |
| 128 | - // 加载其它规划选择弹出层mobal页面 | |
| 129 | - $.get('tzzj.html', function(m){ | |
| 130 | - $(pjaxContainer).append(m); | |
| 131 | - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions,rd[0].children[0].children]); | |
| 132 | - }); | |
| 133 | - }); | |
| 134 | - }) | |
| 135 | - | |
| 136 | - $('#wrenchDownDis').on('click',function() { | |
| 137 | - var Line = LineObj.getLineObj(); | |
| 138 | - GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) { | |
| 139 | - // 加载其它规划选择弹出层mobal页面 | |
| 140 | - $.get('tzzj.html', function(m){ | |
| 141 | - $(pjaxContainer).append(m); | |
| 142 | - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions,rd[0].children[0].children]); | |
| 143 | - }); | |
| 144 | - }); | |
| 145 | - }); | |
| 146 | - | |
| 147 | - $('#quoteDown').on('click',function() { | |
| 148 | - // 弹出提示层. | |
| 149 | - var index = layer.load(1, { | |
| 150 | - shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 151 | - }); | |
| 152 | - var Line = LineObj.getLineObj(); | |
| 153 | - var params = {'lineId':Line.id ,'dir':1,'toDir':0,status:$($("#versions").find("option:selected")[0]).attr("status")} ; | |
| 154 | - quote(params,index); | |
| 155 | - }); | |
| 156 | - | |
| 157 | - $('#quoteUp').on('click',function() { | |
| 158 | - // 弹出提示层. | |
| 159 | - var index = layer.load(1, { | |
| 160 | - shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 161 | - }); | |
| 162 | - var Line = LineObj.getLineObj(); | |
| 163 | - console.log($($("#versions").find("option:selected")[0]).attr("status")); | |
| 164 | - var params = {'lineId':Line.id ,'dir':0,'toDir':1,status:$($("#versions").find("option:selected")[0]).attr("status")}; | |
| 165 | - quote(params,index); | |
| 166 | - }); | |
| 167 | - | |
| 168 | - $('#batchUpdateIndustryCode').on('click',function() { | |
| 169 | - var Line = LineObj.getLineObj(); | |
| 170 | - // 加载其它规划选择弹出层mobal页面 | |
| 171 | - $.get('batch_update_industryCode.html', function(m){ | |
| 172 | - $(pjaxContainer).append(m); | |
| 173 | - $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions]); | |
| 174 | - }); | |
| 175 | - }); | |
| 176 | - $('#batchDowndateIndustryCode').on('click',function() { | |
| 177 | - var Line = LineObj.getLineObj(); | |
| 178 | - // 加载其它规划选择弹出层mobal页面 | |
| 179 | - $.get('batch_update_industryCode.html', function(m){ | |
| 180 | - $(pjaxContainer).append(m); | |
| 181 | - $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions]); | |
| 182 | - }); | |
| 183 | - }); | |
| 184 | - | |
| 185 | - function quote(params,index) { | |
| 186 | - $post('/sectionroute/quoteSection',params,function(data) { | |
| 187 | - layer.close(index); | |
| 188 | - if(data.status=='SUCCESS') { | |
| 189 | - // 弹出操作成功提示消息 | |
| 190 | - layer.msg('操作成功...'); | |
| 191 | - }else { | |
| 192 | - // 弹出操作失败提示消息 | |
| 193 | - layer.msg('操作成功...'); | |
| 194 | - } | |
| 195 | - WorldsBMap.clearMarkAndOverlays(); | |
| 196 | - | |
| 197 | - var dir = params.dir; | |
| 198 | - if(dir == 0){ | |
| 199 | - dir = 1; | |
| 200 | - }else{ | |
| 201 | - dir = 0; | |
| 202 | - } | |
| 203 | - // 刷新左边树 | |
| 204 | - PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val()); | |
| 205 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 206 | -// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | |
| 207 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 208 | -// PublicFunctions.linePanlThree(params.lineId,data,params.dir); | |
| 209 | -// }); | |
| 210 | - }); | |
| 211 | - } | |
| 212 | - // 编辑线路上行走向 | |
| 213 | - $('.module_tools #editUplineTrend').on('click', function() {PublicFunctions.editLinePlan(directionUpValue);}); | |
| 214 | - | |
| 215 | - // 线路上行 | |
| 216 | - $('#leftUpOrDown #upLine').on('click', function(){ | |
| 217 | - var lineIdEvents = LineObj.getLineObj(); | |
| 218 | - | |
| 219 | - var val = $("#versions").val(); | |
| 220 | - | |
| 221 | - /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | |
| 222 | - PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val); | |
| 223 | - | |
| 224 | - }); | |
| 225 | - | |
| 226 | - // 系统规划下行站点 | |
| 227 | - $('.downSystem').on('click',function() { | |
| 228 | - // 隐藏下行规划 | |
| 229 | - $('#downToolsMobal').hide(); | |
| 230 | - // 弹出正在加载层 | |
| 231 | - var i = layer.load(0,{offset:['200px', '280px']}); | |
| 232 | - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | |
| 233 | - PublicFunctions.lineNameIsHaveInterval(directionDownValue); | |
| 234 | - }); | |
| 235 | - | |
| 236 | - // 下行站点其它规划点击事件 | |
| 237 | - $('.downManual').on('click',function() { | |
| 238 | - // 加载模板手动添加站点页面 | |
| 239 | - $.get('addstationstemplate.html', function(m){ | |
| 240 | - $(pjaxContainer).append(m); | |
| 241 | - $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | |
| 242 | - }); | |
| 243 | - /*// 加载其它规划选择弹出层mobal页面 | |
| 244 | - $.get('add_manual_select.html', function(m){ | |
| 245 | - $(pjaxContainer).append(m); | |
| 246 | - $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | |
| 247 | - });*/ | |
| 248 | - }); | |
| 249 | - | |
| 250 | - // 下行站点新增事件 | |
| 251 | - $('.module_tools #addDownStation').on('click', function() { | |
| 252 | - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 253 | - AddStationObj.setAddStationDiraction(directionDownValue); | |
| 254 | - // 加载选择新增方式mobal | |
| 255 | - $.get('add_select.html', function(m){ | |
| 256 | - $(pjaxContainer).append(m); | |
| 257 | - $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | |
| 258 | - }); | |
| 259 | - }); | |
| 260 | - | |
| 261 | - // 修改下行站点mobal页面 | |
| 262 | - $('.module_tools #editDownStation').on('click', function(){ | |
| 263 | - var sel = PublicFunctions.getCurrSelNode(directionDownValue); | |
| 264 | - if(sel.length==0 || sel[0].original.chaildredType !='station'){ | |
| 265 | - layer.msg('请先选择要编辑的下行站点!'); | |
| 266 | - return; | |
| 267 | - } | |
| 268 | - $.get('edit_select.html', function(m){ | |
| 269 | - $(pjaxContainer).append(m); | |
| 270 | - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]); | |
| 271 | - }); | |
| 272 | - }); | |
| 273 | - | |
| 274 | - // 撤销下行站点 | |
| 275 | - $('.module_tools #deleteDownStation').on('click', function() { | |
| 276 | - PublicFunctions.stationRevoke(directionDownValue); | |
| 277 | - }); | |
| 278 | - | |
| 279 | - // 下行批量撤销事件 | |
| 280 | - $('.module_tools #batchDownDelete').on('click', function() { | |
| 281 | - var Line = LineObj.getLineObj(); | |
| 282 | - /** 设置批量删除的线路方向 @param:<directionDownValue:方向(0:上行;1:下行)> */ | |
| 283 | - DeleteBatchObj.setDeteleBatchDiraction(directionDownValue); | |
| 284 | - // 加载选择新增方式mobal | |
| 285 | - $.get('delete_select.html', function(m){ | |
| 286 | - $(pjaxContainer).append(m); | |
| 287 | - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | |
| 288 | - }); | |
| 289 | - }); | |
| 290 | - | |
| 291 | - // 编辑线路下行走向 | |
| 292 | - $('.module_tools #editDownlineTrend').on('click', function() { | |
| 293 | - PublicFunctions.editLinePlan(directionDownValue); | |
| 294 | - }); | |
| 295 | - | |
| 296 | - // 线路下行 | |
| 297 | - $('#leftUpOrDown #downLine').on('click', function(){ | |
| 298 | - var lineIdEvents = LineObj.getLineObj(); | |
| 299 | - | |
| 300 | - | |
| 301 | - var val = $("#versions").val(); | |
| 302 | - /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | |
| 303 | - PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val); | |
| 304 | - }); | |
| 305 | - | |
| 306 | - // 生成行单 | |
| 307 | - $('.module_tools #createUsingSingle').on('click', function() { | |
| 308 | - var lineIdEvents = LineObj.getLineObj(); | |
| 309 | - var params = {lineId:lineIdEvents.id}; | |
| 310 | - GetAjaxData.createUsingSingle(params,function(data) { | |
| 311 | - if(data.status=='SUCCESS') { | |
| 312 | - // 弹出生成成功提示消息 | |
| 313 | - layer.msg('生成成功...'); | |
| 314 | - }else { | |
| 315 | - // 弹出生成失败提示消息 | |
| 316 | - layer.msg('生成失败...'); | |
| 317 | - } | |
| 318 | - }); | |
| 319 | - }); | |
| 320 | - $('#scrllmouseEvent').on('mousemove',function() { | |
| 321 | - $('.defeat-scroll').css('overflow','auto'); | |
| 322 | - }).on('mouseleave',function() { | |
| 323 | - $('.defeat-scroll').css('overflow','hidden'); | |
| 324 | - }); | |
| 325 | - | |
| 326 | - $(".match_station_bnt").on("click",function () { | |
| 327 | - var index = layer.open({ | |
| 328 | - title: '提示', | |
| 329 | - content:'是否匹配外部上下行站点行业编码!', | |
| 330 | - // type: 1, | |
| 331 | - // area: ['600px', '360px'], | |
| 332 | - // scrollbar: false, | |
| 333 | - | |
| 334 | - btn:['确定','取消'], | |
| 335 | - yes: function(index){ | |
| 336 | - var lineId = LineObj.getLineObj().id; | |
| 337 | - GetAjaxData.matchIndustryCode(lineId,function (rs) { | |
| 338 | - // $post("/stationroute/matchIndustryCode",{"lineId":lineId},function (rs) { | |
| 339 | - if(rs.status == "SUCCESS"){ | |
| 340 | - var map = new Map(); | |
| 341 | - var upMatch = rs.upMatch, downMatch = rs.downMatch; | |
| 342 | - if(upMatch !=null && upMatch.length>0){ | |
| 343 | - map.set("up",upMatch); | |
| 344 | - } | |
| 345 | - if(downMatch !=null && downMatch.length>0){ | |
| 346 | - map.set("down",downMatch); | |
| 347 | - } | |
| 348 | - if(map.size>0){ | |
| 349 | - $('.portlet-title .match_station').addClass('hidden'); | |
| 350 | - PublicFunctions.resjtreeDate(lineId,0,$("#versions").val()); | |
| 351 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 352 | -// GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | |
| 353 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 354 | -// PublicFunctions.linePanlThree(lineId,data,0); | |
| 355 | -// }); | |
| 356 | - $('#stationDown').removeClass('active'); | |
| 357 | - $('#stationDown').removeClass('in'); | |
| 358 | - $('#stationDown').addClass('fade'); | |
| 359 | - $('#stationUp').addClass('active in'); | |
| 360 | - $('#downLine').parent().removeClass('active'); | |
| 361 | - $('#upLine').parent().addClass('active'); | |
| 362 | - $.get('match_station_industryCode.html', function(m){ | |
| 363 | - $(pjaxContainer).append(m); | |
| 364 | - $('#match_station_industryCode_mobal').trigger('match_station_industryCodeMobal.show', map); | |
| 365 | - }); | |
| 366 | - } else { | |
| 367 | - layer.msg("没有匹配到外部站点数据,请手动添加!") | |
| 368 | - } | |
| 369 | - } else | |
| 370 | - layer.msg("匹配出错,请手动添加!") | |
| 371 | - }); | |
| 372 | - layer.close(index); | |
| 373 | - }, | |
| 374 | - btn2:function(){ | |
| 375 | - layer.closeAll(index); //关闭当前窗口 | |
| 376 | - } | |
| 377 | - }); | |
| 378 | - }) | |
| 1 | +$(function(){ | |
| 2 | + | |
| 3 | + // 上行方向(0:上行;1:下行) | |
| 4 | + var directionUpValue = $('#stationUp').data('direction'); | |
| 5 | + | |
| 6 | + // 下行方向 (0:上行;1:下行) | |
| 7 | + var directionDownValue = $('.downSystem').data('direction'); | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + // 系统规划上行站点点击事件 | |
| 12 | + $('.upSystem').on('click',function() { | |
| 13 | + // 隐藏上行规划 | |
| 14 | + $('#upToolsMobal').hide(); | |
| 15 | + // 弹出正在加载层 | |
| 16 | + var i = layer.load(0,{offset:['200px', '280px']}); | |
| 17 | + /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | |
| 18 | + PublicFunctions.lineNameIsHaveInterval(directionUpValue); | |
| 19 | + | |
| 20 | + }); | |
| 21 | + | |
| 22 | + // 上行站点其它规划点击事件 | |
| 23 | + $('.upManual').on('click',function() { | |
| 24 | + // 加载模板手动添加站点页面 | |
| 25 | + $.get('addstationstemplate.html', function(m){ | |
| 26 | + $(pjaxContainer).append(m); | |
| 27 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | |
| 28 | + }); | |
| 29 | + /*// 加载其它规划选择弹出层mobal页面 | |
| 30 | + $.get('add_manual_select.html', function(m){ | |
| 31 | + $(pjaxContainer).append(m); | |
| 32 | + $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | |
| 33 | + });*/ | |
| 34 | + | |
| 35 | + }); | |
| 36 | + $('.gpsRoute').on('click',function() { | |
| 37 | + var Line = LineObj.getLineObj(); | |
| 38 | + // 加载其它规划选择弹出层mobal页面 | |
| 39 | + $.get('editRoute.html', function(m){ | |
| 40 | + $(pjaxContainer).append(m); | |
| 41 | + $('#edit_route_mobal').trigger('editRouteMobal.show', [WorldsBMap,GetAjaxData,Line,PublicFunctions]); | |
| 42 | + }); | |
| 43 | + }); | |
| 44 | + | |
| 45 | + // 上行站点新增事件 | |
| 46 | + $('.module_tools #addUpStation').on('click', function() { | |
| 47 | + /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 48 | + AddStationObj.setAddStationDiraction(directionUpValue); | |
| 49 | + // 加载选择新增方式mobal | |
| 50 | + $.get('add_select.html', function(m){ | |
| 51 | + $(pjaxContainer).append(m); | |
| 52 | + $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | |
| 53 | + }); | |
| 54 | + }); | |
| 55 | + | |
| 56 | + // 修改上行站点mobal页面 | |
| 57 | + $('.module_tools #editUpStation').on('click', function(){ | |
| 58 | + var sel = PublicFunctions.getCurrSelNode(directionUpValue); | |
| 59 | + if(sel.length==0 || sel[0].original.chaildredType !='station'){ | |
| 60 | + layer.msg('请先选择要编辑的上行站点!'); | |
| 61 | + return; | |
| 62 | + } | |
| 63 | + $.get('edit_select.html', function(m){ | |
| 64 | + $(pjaxContainer).append(m); | |
| 65 | + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]); | |
| 66 | + }); | |
| 67 | + }); | |
| 68 | + | |
| 69 | + // 撤销上行站点 | |
| 70 | + $('.module_tools #deleteUpStation').on('click', function() { | |
| 71 | + PublicFunctions.stationRevoke(directionUpValue); | |
| 72 | + }); | |
| 73 | + | |
| 74 | + // 上行批量撤销事件 | |
| 75 | + $('.module_tools #batchUpDelete').on('click', function() { | |
| 76 | + var Line = LineObj.getLineObj(); | |
| 77 | + /** 设置批量删除的线路方向 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 78 | + DeleteBatchObj.setDeteleBatchDiraction(directionUpValue); | |
| 79 | + // 加载选择新增方式mobal | |
| 80 | + $.get('delete_select.html', function(m){ | |
| 81 | + $(pjaxContainer).append(m); | |
| 82 | + $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | |
| 83 | + }); | |
| 84 | + }); | |
| 85 | + | |
| 86 | + // 切换上下行. | |
| 87 | + $('.retweet').on('click',function() { | |
| 88 | + layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', { | |
| 89 | + btn : [ '确认提示并提交', '取消' ] | |
| 90 | + },function () { | |
| 91 | + // 关闭所有提示弹出层. | |
| 92 | + layer.closeAll(); | |
| 93 | + // 弹出提示层. | |
| 94 | + var index = layer.load(1, { | |
| 95 | + shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 96 | + }); | |
| 97 | + var Line = LineObj.getLineObj(); | |
| 98 | + $post('/stationroute/updSwitchDir?lineIds='+ Line.id + "&status=" + $($("#versions").find("option:selected")[0]).attr("status") ,null,function(data) { | |
| 99 | + layer.close(index); | |
| 100 | + if(data.status=='SUCCESS') { | |
| 101 | + // 弹出操作成功提示消息 | |
| 102 | + layer.msg('操作成功...'); | |
| 103 | + }else { | |
| 104 | + // 弹出操作失败提示消息 | |
| 105 | + layer.msg('操作成功...'); | |
| 106 | + } | |
| 107 | + WorldsBMap.clearMarkAndOverlays(); | |
| 108 | + $('#stationDown').removeClass('active'); | |
| 109 | + $('#stationDown').removeClass('in'); | |
| 110 | + $('#stationDown').addClass('fade'); | |
| 111 | + $('#stationUp').addClass('active in'); | |
| 112 | + $('#downLine').parent().removeClass('active'); | |
| 113 | + $('#upLine').parent().addClass('active'); | |
| 114 | + // 刷新左边树 | |
| 115 | + PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val()); | |
| 116 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 117 | +// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | |
| 118 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 119 | +// PublicFunctions.linePanlThree(Line.id,data,0); | |
| 120 | +// }); | |
| 121 | + }); | |
| 122 | + }); | |
| 123 | + }); | |
| 124 | + | |
| 125 | + $('#wrenchUpDis').on('click',function() { | |
| 126 | + var Line = LineObj.getLineObj(); | |
| 127 | + GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) { | |
| 128 | + // 加载其它规划选择弹出层mobal页面 | |
| 129 | + $.get('tzzj.html', function(m){ | |
| 130 | + $(pjaxContainer).append(m); | |
| 131 | + $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions,rd[0].children[0].children]); | |
| 132 | + }); | |
| 133 | + }); | |
| 134 | + }) | |
| 135 | + | |
| 136 | + $('#wrenchDownDis').on('click',function() { | |
| 137 | + var Line = LineObj.getLineObj(); | |
| 138 | + GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) { | |
| 139 | + // 加载其它规划选择弹出层mobal页面 | |
| 140 | + $.get('tzzj.html', function(m){ | |
| 141 | + $(pjaxContainer).append(m); | |
| 142 | + $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions,rd[0].children[0].children]); | |
| 143 | + }); | |
| 144 | + }); | |
| 145 | + }); | |
| 146 | + | |
| 147 | + $('#quoteDown').on('click',function() { | |
| 148 | + // 弹出提示层. | |
| 149 | + var index = layer.load(1, { | |
| 150 | + shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 151 | + }); | |
| 152 | + var Line = LineObj.getLineObj(); | |
| 153 | + var params = {'lineId':Line.id ,'dir':1,'toDir':0,status:$($("#versions").find("option:selected")[0]).attr("status")} ; | |
| 154 | + quote(params,index); | |
| 155 | + }); | |
| 156 | + | |
| 157 | + $('#quoteUp').on('click',function() { | |
| 158 | + // 弹出提示层. | |
| 159 | + var index = layer.load(1, { | |
| 160 | + shade: [0.1,'#fff'] // 透明度的白色背景 | |
| 161 | + }); | |
| 162 | + var Line = LineObj.getLineObj(); | |
| 163 | + console.log($($("#versions").find("option:selected")[0]).attr("status")); | |
| 164 | + var params = {'lineId':Line.id ,'dir':0,'toDir':1,status:$($("#versions").find("option:selected")[0]).attr("status")}; | |
| 165 | + quote(params,index); | |
| 166 | + }); | |
| 167 | + | |
| 168 | + $('#batchUpdateIndustryCode').on('click',function() { | |
| 169 | + var Line = LineObj.getLineObj(); | |
| 170 | + // 加载其它规划选择弹出层mobal页面 | |
| 171 | + $.get('batch_update_industryCode.html', function(m){ | |
| 172 | + $(pjaxContainer).append(m); | |
| 173 | + $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions]); | |
| 174 | + }); | |
| 175 | + }); | |
| 176 | + $('#batchDowndateIndustryCode').on('click',function() { | |
| 177 | + var Line = LineObj.getLineObj(); | |
| 178 | + // 加载其它规划选择弹出层mobal页面 | |
| 179 | + $.get('batch_update_industryCode.html', function(m){ | |
| 180 | + $(pjaxContainer).append(m); | |
| 181 | + $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions]); | |
| 182 | + }); | |
| 183 | + }); | |
| 184 | + | |
| 185 | + function quote(params,index) { | |
| 186 | + $post('/sectionroute/quoteSection',params,function(data) { | |
| 187 | + layer.close(index); | |
| 188 | + if(data.status=='SUCCESS') { | |
| 189 | + // 弹出操作成功提示消息 | |
| 190 | + layer.msg('操作成功...'); | |
| 191 | + }else { | |
| 192 | + // 弹出操作失败提示消息 | |
| 193 | + layer.msg('操作成功...'); | |
| 194 | + } | |
| 195 | + WorldsBMap.clearMarkAndOverlays(); | |
| 196 | + | |
| 197 | + var dir = params.dir; | |
| 198 | + if(dir == 0){ | |
| 199 | + dir = 1; | |
| 200 | + }else{ | |
| 201 | + dir = 0; | |
| 202 | + } | |
| 203 | + // 刷新左边树 | |
| 204 | + PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val()); | |
| 205 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 206 | +// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | |
| 207 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 208 | +// PublicFunctions.linePanlThree(params.lineId,data,params.dir); | |
| 209 | +// }); | |
| 210 | + }); | |
| 211 | + } | |
| 212 | + // 编辑线路上行走向 | |
| 213 | + $('.module_tools #editUplineTrend').on('click', function() {PublicFunctions.editLinePlan(directionUpValue);}); | |
| 214 | + | |
| 215 | + // 线路上行 | |
| 216 | + $('#leftUpOrDown #upLine').on('click', function(){ | |
| 217 | + var lineIdEvents = LineObj.getLineObj(); | |
| 218 | + | |
| 219 | + var val = $("#versions").val(); | |
| 220 | + | |
| 221 | + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | |
| 222 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val); | |
| 223 | + | |
| 224 | + }); | |
| 225 | + | |
| 226 | + // 系统规划下行站点 | |
| 227 | + $('.downSystem').on('click',function() { | |
| 228 | + // 隐藏下行规划 | |
| 229 | + $('#downToolsMobal').hide(); | |
| 230 | + // 弹出正在加载层 | |
| 231 | + var i = layer.load(0,{offset:['200px', '280px']}); | |
| 232 | + /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | |
| 233 | + PublicFunctions.lineNameIsHaveInterval(directionDownValue); | |
| 234 | + }); | |
| 235 | + | |
| 236 | + // 下行站点其它规划点击事件 | |
| 237 | + $('.downManual').on('click',function() { | |
| 238 | + // 加载模板手动添加站点页面 | |
| 239 | + $.get('addstationstemplate.html', function(m){ | |
| 240 | + $(pjaxContainer).append(m); | |
| 241 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | |
| 242 | + }); | |
| 243 | + /*// 加载其它规划选择弹出层mobal页面 | |
| 244 | + $.get('add_manual_select.html', function(m){ | |
| 245 | + $(pjaxContainer).append(m); | |
| 246 | + $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | |
| 247 | + });*/ | |
| 248 | + }); | |
| 249 | + | |
| 250 | + // 下行站点新增事件 | |
| 251 | + $('.module_tools #addDownStation').on('click', function() { | |
| 252 | + /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | |
| 253 | + AddStationObj.setAddStationDiraction(directionDownValue); | |
| 254 | + // 加载选择新增方式mobal | |
| 255 | + $.get('add_select.html', function(m){ | |
| 256 | + $(pjaxContainer).append(m); | |
| 257 | + $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | |
| 258 | + }); | |
| 259 | + }); | |
| 260 | + | |
| 261 | + // 修改下行站点mobal页面 | |
| 262 | + $('.module_tools #editDownStation').on('click', function(){ | |
| 263 | + var sel = PublicFunctions.getCurrSelNode(directionDownValue); | |
| 264 | + if(sel.length==0 || sel[0].original.chaildredType !='station'){ | |
| 265 | + layer.msg('请先选择要编辑的下行站点!'); | |
| 266 | + return; | |
| 267 | + } | |
| 268 | + $.get('edit_select.html', function(m){ | |
| 269 | + $(pjaxContainer).append(m); | |
| 270 | + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]); | |
| 271 | + }); | |
| 272 | + }); | |
| 273 | + | |
| 274 | + // 撤销下行站点 | |
| 275 | + $('.module_tools #deleteDownStation').on('click', function() { | |
| 276 | + PublicFunctions.stationRevoke(directionDownValue); | |
| 277 | + }); | |
| 278 | + | |
| 279 | + // 下行批量撤销事件 | |
| 280 | + $('.module_tools #batchDownDelete').on('click', function() { | |
| 281 | + var Line = LineObj.getLineObj(); | |
| 282 | + /** 设置批量删除的线路方向 @param:<directionDownValue:方向(0:上行;1:下行)> */ | |
| 283 | + DeleteBatchObj.setDeteleBatchDiraction(directionDownValue); | |
| 284 | + // 加载选择新增方式mobal | |
| 285 | + $.get('delete_select.html', function(m){ | |
| 286 | + $(pjaxContainer).append(m); | |
| 287 | + $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | |
| 288 | + }); | |
| 289 | + }); | |
| 290 | + | |
| 291 | + // 编辑线路下行走向 | |
| 292 | + $('.module_tools #editDownlineTrend').on('click', function() { | |
| 293 | + PublicFunctions.editLinePlan(directionDownValue); | |
| 294 | + }); | |
| 295 | + | |
| 296 | + // 线路下行 | |
| 297 | + $('#leftUpOrDown #downLine').on('click', function(){ | |
| 298 | + var lineIdEvents = LineObj.getLineObj(); | |
| 299 | + | |
| 300 | + | |
| 301 | + var val = $("#versions").val(); | |
| 302 | + /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | |
| 303 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val); | |
| 304 | + }); | |
| 305 | + | |
| 306 | + // 生成行单 | |
| 307 | + $('.module_tools #createUsingSingle').on('click', function() { | |
| 308 | + var lineIdEvents = LineObj.getLineObj(); | |
| 309 | + var params = {lineId:lineIdEvents.id}; | |
| 310 | + GetAjaxData.createUsingSingle(params,function(data) { | |
| 311 | + if(data.status=='SUCCESS') { | |
| 312 | + // 弹出生成成功提示消息 | |
| 313 | + layer.msg('生成成功...'); | |
| 314 | + }else { | |
| 315 | + // 弹出生成失败提示消息 | |
| 316 | + layer.msg('生成失败...'); | |
| 317 | + } | |
| 318 | + }); | |
| 319 | + }); | |
| 320 | + $('#scrllmouseEvent').on('mousemove',function() { | |
| 321 | + $('.defeat-scroll').css('overflow','auto'); | |
| 322 | + }).on('mouseleave',function() { | |
| 323 | + $('.defeat-scroll').css('overflow','hidden'); | |
| 324 | + }); | |
| 325 | + | |
| 326 | + $(".match_station_bnt").on("click",function () { | |
| 327 | + var index = layer.open({ | |
| 328 | + title: '提示', | |
| 329 | + content:'是否匹配外部上下行站点行业编码!', | |
| 330 | + // type: 1, | |
| 331 | + // area: ['600px', '360px'], | |
| 332 | + // scrollbar: false, | |
| 333 | + | |
| 334 | + btn:['确定','取消'], | |
| 335 | + yes: function(index){ | |
| 336 | + var lineId = LineObj.getLineObj().id; | |
| 337 | + GetAjaxData.matchIndustryCode(lineId,function (rs) { | |
| 338 | + // $post("/stationroute/matchIndustryCode",{"lineId":lineId},function (rs) { | |
| 339 | + if(rs.status == "SUCCESS"){ | |
| 340 | + var map = new Map(); | |
| 341 | + var upMatch = rs.upMatch, downMatch = rs.downMatch; | |
| 342 | + if(upMatch !=null && upMatch.length>0){ | |
| 343 | + map.set("up",upMatch); | |
| 344 | + } | |
| 345 | + if(downMatch !=null && downMatch.length>0){ | |
| 346 | + map.set("down",downMatch); | |
| 347 | + } | |
| 348 | + if(map.size>0){ | |
| 349 | + $('.portlet-title .match_station').addClass('hidden'); | |
| 350 | + PublicFunctions.resjtreeDate(lineId,0,$("#versions").val()); | |
| 351 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | |
| 352 | +// GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | |
| 353 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | |
| 354 | +// PublicFunctions.linePanlThree(lineId,data,0); | |
| 355 | +// }); | |
| 356 | + $('#stationDown').removeClass('active'); | |
| 357 | + $('#stationDown').removeClass('in'); | |
| 358 | + $('#stationDown').addClass('fade'); | |
| 359 | + $('#stationUp').addClass('active in'); | |
| 360 | + $('#downLine').parent().removeClass('active'); | |
| 361 | + $('#upLine').parent().addClass('active'); | |
| 362 | + $.get('match_station_industryCode.html', function(m){ | |
| 363 | + $(pjaxContainer).append(m); | |
| 364 | + $('#match_station_industryCode_mobal').trigger('match_station_industryCodeMobal.show', map); | |
| 365 | + }); | |
| 366 | + } else { | |
| 367 | + layer.msg("没有匹配到外部站点数据,请手动添加!") | |
| 368 | + } | |
| 369 | + } else | |
| 370 | + layer.msg("匹配出错,请手动添加!") | |
| 371 | + }); | |
| 372 | + layer.close(index); | |
| 373 | + }, | |
| 374 | + btn2:function(){ | |
| 375 | + layer.closeAll(index); //关闭当前窗口 | |
| 376 | + } | |
| 377 | + }); | |
| 378 | + }) | |
| 379 | + | |
| 380 | + // 进出场规划 | |
| 381 | + $('#leftUpOrDown #inoutLine').on('click', function(){ | |
| 382 | + var lineIdEvents = LineObj.getLineObj(); | |
| 383 | + | |
| 384 | + var val = $("#versions").val(); | |
| 385 | + | |
| 386 | + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | |
| 387 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'3',val); | |
| 388 | + | |
| 389 | + }); | |
| 379 | 390 | }); |
| 380 | 391 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
| ... | ... | @@ -25,6 +25,7 @@ |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | var PublicFunctions = function () { |
| 28 | + var mapData = {}; | |
| 28 | 29 | var PubFun = { |
| 29 | 30 | /** 初始化线路标题与ID */ |
| 30 | 31 | setTiteText : function(lineId) { |
| ... | ... | @@ -55,12 +56,131 @@ var PublicFunctions = function () { |
| 55 | 56 | // 返回Obj |
| 56 | 57 | return array; |
| 57 | 58 | }, |
| 59 | + startOrEndPoint: function(points, carpark) { | |
| 60 | + var harr = new Array, i = 0; | |
| 61 | + for (i = 0;i < points.length;i++) { | |
| 62 | + harr.push('<option value="', points[i].stationCode, '_station">', points[i].stationName, '</option>'); | |
| 63 | + points[i].bdPoint = points[i].station.bJwpoints; | |
| 64 | + points[i].bdPoints = points[i].station.bdPolygon; | |
| 65 | + points[i].shapesType = points[i].station.shapesType; | |
| 66 | + points[i].radius = points[i].station.radius; | |
| 67 | + mapData[points[i].stationCode + '_station'] = points[i]; | |
| 68 | + } | |
| 69 | + harr.push('<option value="', carpark.parkCode, '_park">', carpark.parkName, '</option>'); | |
| 70 | + carpark.bdPoint = carpark.bCenterPoint; | |
| 71 | + carpark.bdPoints = carpark.bParkPoint; | |
| 72 | + carpark.stationName = carpark.parkName; | |
| 73 | + mapData[carpark.parkCode + '_park'] = carpark; | |
| 74 | + | |
| 75 | + return harr.join(''); | |
| 76 | + }, | |
| 58 | 77 | /** @param id:线路ID ;directionData:方向 */ |
| 59 | 78 | resjtreeDate : function(id,directionData,version){ |
| 60 | 79 | |
| 61 | 80 | if(!version){ |
| 62 | 81 | version = $("#versions").val(); |
| 63 | 82 | } |
| 83 | + | |
| 84 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 85 | + if (directionData == 3) { | |
| 86 | + // 隐藏上行规划 | |
| 87 | + $('#upToolsMobal').hide(); | |
| 88 | + // 隐藏上行树 | |
| 89 | + $('#uptreeMobal').hide(); | |
| 90 | + // 隐藏下行规划 | |
| 91 | + $('#downToolsMobal').hide(); | |
| 92 | + // 隐藏下行树 | |
| 93 | + $('#DowntreeMobal').hide(); | |
| 94 | + // | |
| 95 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | |
| 96 | + | |
| 97 | + GetAjaxData.getStartEndByLine(id, version, function (result) { | |
| 98 | + if (result.data) { | |
| 99 | + $('#InoutCarparktreeMobal').show(); | |
| 100 | + var formHtml = template('inout-carpark-search-form'); | |
| 101 | + $('.inout-search').html(formHtml); | |
| 102 | + | |
| 103 | + $('#startPoint').html(PubFun.startOrEndPoint(result.data.start, result.data.carpark)); | |
| 104 | + $('#endPoint').html(PubFun.startOrEndPoint(result.data.end, result.data.carpark)); | |
| 105 | + $('#startPoint').on('change', function () { | |
| 106 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | |
| 107 | + }); | |
| 108 | + $('#endPoint').on('change', function () { | |
| 109 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | |
| 110 | + }); | |
| 111 | + $('#inoutSearch').on('click', function () { | |
| 112 | + var start = $('#startPoint').val().split('_'), end = $('#endPoint').val().split('_'); | |
| 113 | + if (start[1] == end[1]) { | |
| 114 | + layer.msg('进出场的站点不可能同时为站点或停车场'); | |
| 115 | + return; | |
| 116 | + } | |
| 117 | + | |
| 118 | + $('#inout_carpark_tree').show(); | |
| 119 | + $('#InoutCarparktreeMobal .table-toolbar').show(); | |
| 120 | + | |
| 121 | + GetAjaxData.getRouteByStartEnd(id, version, start[0], end[0], (result1) => { | |
| 122 | + var routes = result1.data.routes, rootNode; | |
| 123 | + WorldsBMap.clearMarkAndOverlays(); | |
| 124 | + var startPoint = mapData[start.join('_')], endPoint = mapData[end.join('_')], point, points; | |
| 125 | + if (startPoint.shapesType === 'r') { | |
| 126 | + point = startPoint.bdPoint.split(' '); | |
| 127 | + WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, startPoint.radius, startPoint.stationName, true); | |
| 128 | + } else if (startPoint.shapesType === 'd') { | |
| 129 | + points = startPoint.bdPoints; | |
| 130 | + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', ''); | |
| 131 | + points = points.split(',') | |
| 132 | + WorldsBMap.drawPolygon(points, startPoint.stationName, true); | |
| 133 | + } | |
| 134 | + | |
| 135 | + if (endPoint.shapesType === 'r') { | |
| 136 | + point = endPoint.bdPoint.split(' '); | |
| 137 | + WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, endPoint.radius, endPoint.stationName, true); | |
| 138 | + } else if (endPoint.shapesType === 'd') { | |
| 139 | + points = endPoint.bdPoints; | |
| 140 | + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', ''); | |
| 141 | + points = points.split(',') | |
| 142 | + WorldsBMap.drawPolygon(points, endPoint.stationName, true); | |
| 143 | + } | |
| 144 | + | |
| 145 | + rootNode = {id: -1, pId: null, name: '路段', text: '路段', icon: null, groupType: 2, container : 'pjax-container', enable : true, children: routes}; | |
| 146 | + if (routes.length > 0) { | |
| 147 | + for (let i = 0,route;i < routes.length;i++) { | |
| 148 | + route = routes[i]; | |
| 149 | + route.pId = 1; | |
| 150 | + route.name = route.section.sectionName; | |
| 151 | + route.text = route.section.sectionName; | |
| 152 | + route.icon = null; | |
| 153 | + route.groupType = 3; | |
| 154 | + route.chaildredType = 'section'; | |
| 155 | + route.enable = true; | |
| 156 | + route.lineId = id; | |
| 157 | + route.lineCode = id; | |
| 158 | + route.versions = version; | |
| 159 | + route.dir = 3; | |
| 160 | + route.start = start[0]; | |
| 161 | + route.end = end[0]; | |
| 162 | + route.sectionrouteId = route.id; | |
| 163 | + route.sectionName = route.section.sectionName; | |
| 164 | + route.sectionBsectionVector = route.section.bsectionVector; | |
| 165 | + points = route.section.bsectionVector.replace('LINESTRING(', '').replace(')', ''); | |
| 166 | + points = points.split(','); | |
| 167 | + WorldsBMap.drawPolyLine(points, route, start[0], end[0]); | |
| 168 | + } | |
| 169 | + } else { | |
| 170 | + rootNode.children = [{id: 0, pId: -1, name: '添加路段', text: '添加路段', lineId: id, lineCode: id, versions: version, dir: 3, start: start[0], end: end[0], icon: null, groupType: 3, container : 'pjax-container', enable : true, chaildredType: status > 0 ? 'addSection' : '', sectionBsectionVector: 'LINESTRING(' + startPoint.bdPoint + ')'}]; | |
| 171 | + } | |
| 172 | + StationTreeData.inoutInit([rootNode]); | |
| 173 | + StationTreeData.inoutreloadeTree([rootNode]); | |
| 174 | + }); | |
| 175 | + }); | |
| 176 | + } else { | |
| 177 | + layer.msg(result.msg); | |
| 178 | + } | |
| 179 | + }); | |
| 180 | + } else { | |
| 181 | + $('#InoutCarparktreeMobal').hide(); | |
| 182 | + $('#inout_carpark_tree').hide(); | |
| 183 | + } | |
| 64 | 184 | |
| 65 | 185 | // 获取树数据 |
| 66 | 186 | GetAjaxData.getStation(id,directionData,version,function(treeDateJson) { |
| ... | ... | @@ -77,7 +197,7 @@ var PublicFunctions = function () { |
| 77 | 197 | // 刷新树 |
| 78 | 198 | StationTreeData.upreloadeTree(treeDateJson); |
| 79 | 199 | }else { |
| 80 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 200 | + if (status > 0) { | |
| 81 | 201 | // 显示上行规划 |
| 82 | 202 | $('#upToolsMobal').show(); |
| 83 | 203 | }else{ |
| ... | ... | @@ -99,7 +219,7 @@ var PublicFunctions = function () { |
| 99 | 219 | // 跟新树 |
| 100 | 220 | StationTreeData.dwonreloadeTree(treeDateJson); |
| 101 | 221 | }else { |
| 102 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 222 | + if (status > 0) { | |
| 103 | 223 | // 显示下行规划 |
| 104 | 224 | $('#downToolsMobal').show(); |
| 105 | 225 | }else{ |
| ... | ... | @@ -461,6 +581,7 @@ var PublicFunctions = function () { |
| 461 | 581 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 462 | 582 | linePanlThree : function(lineId,data,direction,version,callback) { |
| 463 | 583 | /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ |
| 584 | + debugger | |
| 464 | 585 | var polyline_center; |
| 465 | 586 | GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) { |
| 466 | 587 | WorldsBMap.clearMarkAndOverlays(); |
| ... | ... | @@ -536,6 +657,7 @@ var PublicFunctions = function () { |
| 536 | 657 | }, |
| 537 | 658 | // 地图处于编辑状态 |
| 538 | 659 | editMapStatus : function (dir) { |
| 660 | + debugger | |
| 539 | 661 | WorldsBMap.setMap_status(1); |
| 540 | 662 | // 有方向就显示退出编辑模式按钮 |
| 541 | 663 | if(dir!=null && dir!='null'){ | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -31,6 +31,8 @@ window.WorldsBMap = function () { |
| 31 | 31 | sectionArray = [], stationArray = new Map(), |
| 32 | 32 | map_status = 0,drawingManager,topOverlay; |
| 33 | 33 | |
| 34 | + let currentSection = {}; | |
| 35 | + | |
| 34 | 36 | /** |
| 35 | 37 | * 编辑缓冲区 |
| 36 | 38 | * stationMarkers: 站点图标集合 |
| ... | ... | @@ -533,7 +535,7 @@ window.WorldsBMap = function () { |
| 533 | 535 | }, |
| 534 | 536 | |
| 535 | 537 | /** 在地图上画点 @param:<point_center:中心坐标点> */ |
| 536 | - drawingUpStationPoint: function (station, s) { | |
| 538 | + drawingUpStationPoint: function (station, s, isView) { | |
| 537 | 539 | // 中心点坐标字符串 |
| 538 | 540 | var bJwpointsStr = station.stationJwpoints; |
| 539 | 541 | var stationName = station.stationRouteName; |
| ... | ... | @@ -558,7 +560,7 @@ window.WorldsBMap = function () { |
| 558 | 560 | myRichMarker1.ct_source = '1'; |
| 559 | 561 | mapBValue.addOverlay(myRichMarker1); |
| 560 | 562 | myRichMarker1.addEventListener('click', function () { |
| 561 | - if(map_status != 1) | |
| 563 | + if(map_status != 1 && !isView) | |
| 562 | 564 | WorldsBMap.openStationInfoWin(station); |
| 563 | 565 | }); |
| 564 | 566 | stationArray[station.stationRouteId] = station; |
| ... | ... | @@ -922,8 +924,15 @@ window.WorldsBMap = function () { |
| 922 | 924 | focusSection: function(sectionRoudId) { |
| 923 | 925 | for (var i = 0, p; p = sectionArray[i++];) { |
| 924 | 926 | if (p.data.sectionrouteId == sectionRoudId) { |
| 925 | - WorldsBMap.openSectionInfoWin(p); | |
| 926 | - break; | |
| 927 | + switch (p.data.dir) { | |
| 928 | + case 3: | |
| 929 | + WorldsBMap.openSectionInfoWin_inout(p); | |
| 930 | + break; | |
| 931 | + default: | |
| 932 | + WorldsBMap.openSectionInfoWin(p); | |
| 933 | + break; | |
| 934 | + } | |
| 935 | + | |
| 927 | 936 | } |
| 928 | 937 | } |
| 929 | 938 | }, |
| ... | ... | @@ -1026,23 +1035,44 @@ window.WorldsBMap = function () { |
| 1026 | 1035 | params.destroy = 0; |
| 1027 | 1036 | params.directions = dir; |
| 1028 | 1037 | params.descriptions = ''; |
| 1038 | + params.start = stecion.start; | |
| 1039 | + params.end = stecion.end; | |
| 1029 | 1040 | |
| 1030 | 1041 | params.status=$($("#versions").find("option:selected")[0]).attr("status"); |
| 1031 | - GetAjaxData.sectionSave(params, function (result) { | |
| 1032 | - if(result.status =="SUCCESS"){ | |
| 1033 | - $('.main_left_panel_m_layer').hide(); | |
| 1034 | - $(btn).parents('.buffer_edit_body').parent().remove(); | |
| 1035 | - PublicFunctions.editMapStatusRemove(); | |
| 1036 | - PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | |
| 1037 | - PublicFunctions.editAChangeCssRemoveDisabled(); | |
| 1042 | + if (dir == 3) { | |
| 1043 | + GetAjaxData.inoutSectionSave(params, function (result) { | |
| 1044 | + if(result.status =="SUCCESS"){ | |
| 1045 | + $('.main_left_panel_m_layer').hide(); | |
| 1046 | + $(btn).parents('.buffer_edit_body').parent().remove(); | |
| 1047 | + PublicFunctions.editMapStatusRemove(); | |
| 1048 | + //PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | |
| 1049 | + $('#inoutSearch').click(); | |
| 1050 | + PublicFunctions.editAChangeCssRemoveDisabled(); | |
| 1038 | 1051 | // GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { |
| 1039 | 1052 | // PublicFunctions.linePanlThree(lineId,data,dir); |
| 1040 | 1053 | // }); |
| 1041 | - layer.msg("添加成功!"); | |
| 1042 | - } else if(result.status =="ERROR") { | |
| 1043 | - layer.msg("添加失败!"); | |
| 1044 | - } | |
| 1045 | - }); | |
| 1054 | + layer.msg("添加成功!"); | |
| 1055 | + } else if(result.status =="ERROR") { | |
| 1056 | + layer.msg("添加失败!"); | |
| 1057 | + } | |
| 1058 | + }); | |
| 1059 | + } else { | |
| 1060 | + GetAjaxData.sectionSave(params, function (result) { | |
| 1061 | + if(result.status =="SUCCESS"){ | |
| 1062 | + $('.main_left_panel_m_layer').hide(); | |
| 1063 | + $(btn).parents('.buffer_edit_body').parent().remove(); | |
| 1064 | + PublicFunctions.editMapStatusRemove(); | |
| 1065 | + PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | |
| 1066 | + PublicFunctions.editAChangeCssRemoveDisabled(); | |
| 1067 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1068 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1069 | +// }); | |
| 1070 | + layer.msg("添加成功!"); | |
| 1071 | + } else if(result.status =="ERROR") { | |
| 1072 | + layer.msg("添加失败!"); | |
| 1073 | + } | |
| 1074 | + }); | |
| 1075 | + } | |
| 1046 | 1076 | }); |
| 1047 | 1077 | } else if(!sectionName){ |
| 1048 | 1078 | layer.msg('请填写路段名字!'); |
| ... | ... | @@ -1322,6 +1352,7 @@ window.WorldsBMap = function () { |
| 1322 | 1352 | // 清楚地图覆盖物 |
| 1323 | 1353 | mapBValue.clearOverlays(); |
| 1324 | 1354 | mapBValue.removeOverlay(); |
| 1355 | + sectionArray = []; | |
| 1325 | 1356 | }, |
| 1326 | 1357 | clearMark: function () { |
| 1327 | 1358 | // 清楚地图覆盖物 |
| ... | ... | @@ -1458,6 +1489,338 @@ window.WorldsBMap = function () { |
| 1458 | 1489 | })(); |
| 1459 | 1490 | |
| 1460 | 1491 | }, |
| 1492 | + | |
| 1493 | + /** | |
| 1494 | + * 画圆 | |
| 1495 | + * point(lng,lat) 中心点 | |
| 1496 | + * radius 半径(m) | |
| 1497 | + * isMark 是否加站名 | |
| 1498 | + */ | |
| 1499 | + drawCircle: function (point, radius, stationName, isMark) { | |
| 1500 | + let center = new BMap.Point(point.lng, point.lat); | |
| 1501 | + let circle = new BMap.Circle(center, radius ,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 1502 | + mapBValue.addOverlay(circle); | |
| 1503 | + if (isMark) { | |
| 1504 | + let html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">' | |
| 1505 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 1506 | + + '</div>' | |
| 1507 | + + '<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: 20px; top: -30px;">' + stationName + '</label>'; | |
| 1508 | + | |
| 1509 | + let myRichMarker = new BMapLib.RichMarker(html, center, { | |
| 1510 | + "title": stationName, | |
| 1511 | + "anchor": new BMap.Size(-10, 8), | |
| 1512 | + "enableDragging": true | |
| 1513 | + }); | |
| 1514 | + myRichMarker.disableDragging(); | |
| 1515 | + myRichMarker.ct_source = '1'; | |
| 1516 | + mapBValue.addOverlay(myRichMarker); | |
| 1517 | + } | |
| 1518 | + }, | |
| 1519 | + | |
| 1520 | + /** | |
| 1521 | + * 画多边形 | |
| 1522 | + * points 点数组 | |
| 1523 | + */ | |
| 1524 | + drawPolygon: function (points, stationName, isMark) { | |
| 1525 | + let bdPoints = new Array(), i = 0, point; | |
| 1526 | + for (i = 0;i < points.length;i++) { | |
| 1527 | + point = points[i].split(' '); | |
| 1528 | + bdPoints.push(new BMap.Point(point[0], point[1])); | |
| 1529 | + } | |
| 1530 | + let polygon = new BMap.Polygon(bdPoints), center = bdPoints[0]; | |
| 1531 | + mapBValue.addOverlay(polygon); | |
| 1532 | + if (isMark) { | |
| 1533 | + let html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">' | |
| 1534 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 1535 | + + '</div>' | |
| 1536 | + + '<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: 20px; top: -30px;">' + stationName + '</label>'; | |
| 1537 | + | |
| 1538 | + let myRichMarker = new BMapLib.RichMarker(html, center, { | |
| 1539 | + "title": stationName, | |
| 1540 | + "anchor": new BMap.Size(-10, 8), | |
| 1541 | + "enableDragging": true | |
| 1542 | + }); | |
| 1543 | + myRichMarker.disableDragging(); | |
| 1544 | + myRichMarker.ct_source = '1'; | |
| 1545 | + mapBValue.addOverlay(myRichMarker); | |
| 1546 | + } | |
| 1547 | + }, | |
| 1548 | + | |
| 1549 | + drawPolyLine: function (points, data, start, end) { | |
| 1550 | + debugger | |
| 1551 | + let bdPoints = new Array(), i = 0, point, polyline; | |
| 1552 | + for (i = 0;i < points.length;i++) { | |
| 1553 | + point = points[i].split(' '); | |
| 1554 | + bdPoints.push(new BMap.Point(point[0], point[1])); | |
| 1555 | + } | |
| 1556 | + // 创建线路走向 | |
| 1557 | + polyline = new BMap.Polyline(bdPoints, { | |
| 1558 | + strokeColor: 'red', | |
| 1559 | + strokeWeight: 6, | |
| 1560 | + strokeOpacity: 0.7 | |
| 1561 | + }); | |
| 1562 | + | |
| 1563 | + polyline.data = data; | |
| 1564 | + polyline.start = start; | |
| 1565 | + polyline.end = end; | |
| 1566 | + polyline.ct_source = '1'; | |
| 1567 | + // 把折线添加到地图上 | |
| 1568 | + mapBValue.addOverlay(polyline); | |
| 1569 | + // 聚焦事件 | |
| 1570 | + polyline.addEventListener('mousemove', function (e) { | |
| 1571 | + if (this != editPolyline) | |
| 1572 | + this.setStrokeColor("#20bd26"); | |
| 1573 | + }); | |
| 1574 | + // 失去焦点 | |
| 1575 | + polyline.addEventListener('mouseout', function (e) { | |
| 1576 | + if (this != editPolyline && this != road_win_show_p) | |
| 1577 | + this.setStrokeColor("red"); | |
| 1578 | + }); | |
| 1579 | + // 添加单击事件 | |
| 1580 | + polyline.addEventListener('onclick', function (e) { | |
| 1581 | + // 打开信息窗口 | |
| 1582 | + if (map_status != 1) | |
| 1583 | + WorldsBMap.openSectionInfoWin_inout(this); | |
| 1584 | + }); | |
| 1585 | + // 添加右击事件 | |
| 1586 | + polyline.addEventListener('rightclick', function (e) { | |
| 1587 | + if (currentSection.enableEditing) { | |
| 1588 | + this.disableEditing(); | |
| 1589 | + WorldsBMap.saveSection_inout(this); | |
| 1590 | + } | |
| 1591 | + }); | |
| 1592 | + sectionArray.push(polyline); | |
| 1593 | + }, | |
| 1594 | + | |
| 1595 | + // 打开路段信息窗口 | |
| 1596 | + openSectionInfoWin_inout: function(p) { | |
| 1597 | + var section = p.data; | |
| 1598 | + var dir = section.sectionrouteDirections; | |
| 1599 | + var width = WorldsBMap.strGetLength(section.sectionName) * 10; | |
| 1600 | + // 信息窗口参数属性 | |
| 1601 | + var opts = { | |
| 1602 | + // 信息窗口宽度 | |
| 1603 | + width: (width < 200 ? 200 : width), | |
| 1604 | + // 信息窗口高度 | |
| 1605 | + height: 150, | |
| 1606 | + //设置不允许信窗发送短息 | |
| 1607 | + enableMessage: false, | |
| 1608 | + //是否开启点击地图关闭信息窗口 | |
| 1609 | + enableCloseOnClick: false, | |
| 1610 | + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 1611 | + enableAutoPan: false | |
| 1612 | + }; | |
| 1613 | + var htm = '<span style="color: #ff8355;font-size: 18px;">' + section.sectionName + '</span>' + | |
| 1614 | + '<span class="help-block" >路段编码:' + section.sectionCode + '</span>' + | |
| 1615 | + '<span class="help-block" >路段序号:' + section.sectionrouteCode + '</span>' + | |
| 1616 | + '<span class="help-block" >版本号  :' + section.versions + '</span>' + | |
| 1617 | + '<div >'; | |
| 1618 | + | |
| 1619 | + if($($("#versions").find("option:selected")[0]).attr("status") > 0){ | |
| 1620 | + htm += '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection_inout(' + section.sectionrouteId +','+dir+ ')">修改</button>' + | |
| 1621 | + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection_inout('+ section.sectionrouteId + ','+section.sectionrouteLine+','+section.sectionrouteDirections+')">撤销</button>' + | |
| 1622 | + '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter_inout('+section.sectionrouteId+')">添加路段(之后)</button>' + | |
| 1623 | + '</div>'; | |
| 1624 | + } | |
| 1625 | + | |
| 1626 | + // 创建信息窗口 | |
| 1627 | + var infoWindow_target = new BMap.InfoWindow(htm, opts); | |
| 1628 | + // 切割段折线坐标字符串 | |
| 1629 | + var sectionStr = section.sectionBsectionVector.substring(11, section.sectionBsectionVector.length - 1); | |
| 1630 | + // 分割折线坐标字符串 | |
| 1631 | + var lineArray = sectionStr.split(','); | |
| 1632 | + var sectionArray = []; | |
| 1633 | + for (var i = 0; i < lineArray.length; i++) { | |
| 1634 | + sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1])); | |
| 1635 | + } | |
| 1636 | + // 计算中间点 | |
| 1637 | + var index = parseInt(sectionArray.length / 2); | |
| 1638 | + var centerPoint = sectionArray[index]; | |
| 1639 | + //close event | |
| 1640 | + infoWindow_target.addEventListener('close', function (e) { | |
| 1641 | + p.setStrokeColor("red"); | |
| 1642 | + road_win_show_p = null; | |
| 1643 | + }); | |
| 1644 | + //open event | |
| 1645 | + infoWindow_target.addEventListener('open', function (e) { | |
| 1646 | + p.setStrokeColor("#20bd26"); | |
| 1647 | + road_win_show_p = p; | |
| 1648 | + }); | |
| 1649 | + //开启信息窗口 | |
| 1650 | + mapBValue.openInfoWindow(infoWindow_target, centerPoint); | |
| 1651 | + mapBValue.panTo(centerPoint); | |
| 1652 | + }, | |
| 1653 | + | |
| 1654 | + /** | |
| 1655 | + * 进出场路段设置为编辑状态 | |
| 1656 | + */ | |
| 1657 | + editSection_inout: function(sectionRoudId) { | |
| 1658 | + layer.confirm('进入编辑状态', { | |
| 1659 | + btn : [ '确定','返回' ], icon: 3, title:'提示' | |
| 1660 | + }, function() { | |
| 1661 | + PublicFunctions.editMapStatus(dir); | |
| 1662 | + layer.msg('双击保存路段'); | |
| 1663 | + var p; | |
| 1664 | + for (var i = 0; p = sectionArray[i++];) { | |
| 1665 | + if (p.data.sectionrouteId == sectionRoudId) { | |
| 1666 | + mapBValue.closeInfoWindow();//关闭infoWindow | |
| 1667 | + p.enableEditing(); | |
| 1668 | + p.setStrokeColor('blue'); | |
| 1669 | + editPolyline = p; | |
| 1670 | + break; | |
| 1671 | + } | |
| 1672 | + } | |
| 1673 | + // 路段中间点为中心 | |
| 1674 | + var section = p.data; | |
| 1675 | + var sectionStr = section.sectionBsectionVector.substring(11, section.sectionBsectionVector.length - 1); | |
| 1676 | + // 分割折线坐标字符串 | |
| 1677 | + var lineArray = sectionStr.split(','); | |
| 1678 | + var sectionPointArray = []; | |
| 1679 | + for (var i = 0; i < lineArray.length; i++) { | |
| 1680 | + sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1])); | |
| 1681 | + } | |
| 1682 | + // 计算中间点 | |
| 1683 | + var index = parseInt(sectionPointArray.length / 2); | |
| 1684 | + var centerPoint = sectionPointArray[index]; | |
| 1685 | + mapBValue.centerAndZoom(centerPoint, 17); | |
| 1686 | + // var c = p.ia[Math.floor(p.ia.length/2)]; | |
| 1687 | + // mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18); | |
| 1688 | + p.addEventListener('dblclick', function () { | |
| 1689 | + /** 设置修改路段集合对象为空 */ | |
| 1690 | + editPolyline = ''; | |
| 1691 | + PublicFunctions.editMapStatusRemove(); | |
| 1692 | + $.get('editsection_inout.html', function(m){ | |
| 1693 | + $('body').append(m); | |
| 1694 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,p,PublicFunctions]); | |
| 1695 | + }); | |
| 1696 | + }); | |
| 1697 | + }); | |
| 1698 | + }, | |
| 1699 | + | |
| 1700 | + // 撤销路段 | |
| 1701 | + destroySection_inout : function(sectionRoudId) { | |
| 1702 | + layer.confirm('你确定要撤销此路段吗?', { | |
| 1703 | + btn : [ '撤销','返回' ], icon: 3, title:'提示' | |
| 1704 | + }, function(){ | |
| 1705 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | |
| 1706 | + $.post('/inout/destroy',{'id': sectionRoudId,status:status},function(resuntDate) { | |
| 1707 | + if (resuntDate.status == 'SUCCESS') { | |
| 1708 | + // 弹出添加成功提示消息 | |
| 1709 | + layer.msg('撤销成功!'); | |
| 1710 | + } else { | |
| 1711 | + // 弹出添加失败提示消息 | |
| 1712 | + layer.msg('撤销失败!'); | |
| 1713 | + } | |
| 1714 | + // 刷新左边树 | |
| 1715 | + $('#inoutSearch').click(); | |
| 1716 | + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */ | |
| 1717 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1718 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | |
| 1719 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1720 | +// }); | |
| 1721 | + }); | |
| 1722 | + }); | |
| 1723 | + }, | |
| 1724 | + | |
| 1725 | + // 添加在路段之后 | |
| 1726 | + addSectionAfter_inout : function(sectionRoudId) { | |
| 1727 | + //order = after before; | |
| 1728 | + var beforeSection; | |
| 1729 | + // 关闭信息窗口 | |
| 1730 | + mapBValue.closeInfoWindow(); | |
| 1731 | + PublicFunctions.editMapStatus(); | |
| 1732 | + // 把数据填充到模版中 | |
| 1733 | + var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRoudId}); | |
| 1734 | + $('body .mian-portlet-body').append(addSectionHTML); | |
| 1735 | + //暂停和开始绘制 | |
| 1736 | + $('.draw_polyline_switch>a').on('click', function () { | |
| 1737 | + var t = $(this).text(); | |
| 1738 | + if(t=='暂停绘制'){ | |
| 1739 | + WorldsBMap.exitDrawStatus(); | |
| 1740 | + $(this).text('开始绘制'); | |
| 1741 | + } | |
| 1742 | + else{ | |
| 1743 | + WorldsBMap.openDrawStatus(); | |
| 1744 | + $(this).text('暂停绘制'); | |
| 1745 | + } | |
| 1746 | + }); | |
| 1747 | + | |
| 1748 | + //取消 | |
| 1749 | + $('#addSectionCancelBtn').on('click', function () { | |
| 1750 | + $('.main_left_panel_m_layer').hide(); | |
| 1751 | + $(this).parents('.buffer_edit_body').parent().remove(); | |
| 1752 | + WorldsBMap.exitDrawStatus(); | |
| 1753 | + PublicFunctions.editMapStatusRemove(); | |
| 1754 | + }); | |
| 1755 | + GetAjaxData.getRouteInfoById(sectionRoudId, function(data){ | |
| 1756 | + beforeSection = data; | |
| 1757 | + beforeSection.sectionBsectionVector = beforeSection.section.bsectionVector; | |
| 1758 | + WorldsBMap.showAddSectionPanel(beforeSection); | |
| 1759 | + }); | |
| 1760 | + | |
| 1761 | + //确定 | |
| 1762 | + $('#addSectionSbmintBtn').on('click', function () { | |
| 1763 | + var btn = this; | |
| 1764 | + $('#addSectionSbmintBtn').addClass("disabled"); | |
| 1765 | + var sectionName = $('#sectionNameInput').val(); | |
| 1766 | + var bsectionVector = $('#bsectionVectorInput').val(); | |
| 1767 | + var params = {}; | |
| 1768 | + if(sectionName && bsectionVector) { | |
| 1769 | + WorldsBMap.exitDrawStatus(); | |
| 1770 | + GetAjaxData.getSectionCode(function(sectionCode) { | |
| 1771 | + params.lineId = beforeSection.line.id; | |
| 1772 | + params.lineCode = beforeSection.lineCode; | |
| 1773 | + params.sectionCode = sectionCode;// 设值路段编码. | |
| 1774 | + params.sectionName = sectionName; | |
| 1775 | + params.roadCoding = ''; | |
| 1776 | + params.dbType = 'b'; | |
| 1777 | + params.bsectionVector = bsectionVector; | |
| 1778 | + params.sectionrouteCode = beforeSection.sectionrouteCode+"_0"; | |
| 1779 | + params.sectionTime = 0; | |
| 1780 | + params.sectionDistance = 60; | |
| 1781 | + params.speedLimit = 0; | |
| 1782 | + params.versions = beforeSection.versions; | |
| 1783 | + params.destroy = 0; | |
| 1784 | + params.directions = beforeSection.directions; | |
| 1785 | + params.descriptions = ''; | |
| 1786 | + params.start = beforeSection.start; | |
| 1787 | + params.end = beforeSection.end; | |
| 1788 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | |
| 1789 | + | |
| 1790 | + GetAjaxData.inoutSectionSave(params, function (result) { | |
| 1791 | + if(result.status =="SUCCESS"){ | |
| 1792 | + $('.main_left_panel_m_layer').hide(); | |
| 1793 | + $(btn).parents('.buffer_edit_body').parent().remove(); | |
| 1794 | + PublicFunctions.editMapStatusRemove(); | |
| 1795 | + $('#inoutSearch').click(); | |
| 1796 | + PublicFunctions.editAChangeCssRemoveDisabled(); | |
| 1797 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | |
| 1798 | +// PublicFunctions.linePanlThree(lineId,data,dir); | |
| 1799 | +// }); | |
| 1800 | + layer.msg("添加成功!"); | |
| 1801 | + } else if(result.status =="ERROR") { | |
| 1802 | + layer.msg("添加失败!"); | |
| 1803 | + } | |
| 1804 | + }); | |
| 1805 | + }); | |
| 1806 | + } else if(!sectionName){ | |
| 1807 | + layer.msg('请填写路段名字!'); | |
| 1808 | + } else if(!bsectionVector) | |
| 1809 | + layer.msg('请先绘制路段!'); | |
| 1810 | + setTimeout(function () { | |
| 1811 | + $("#addSectionSbmintBtn").removeClass("disabled"); | |
| 1812 | + },1000); | |
| 1813 | + }); | |
| 1814 | + }, | |
| 1815 | + /** | |
| 1816 | + * 保存进出场路段 | |
| 1817 | + */ | |
| 1818 | + saveSection_inout: function () { | |
| 1819 | + $.get('editsection_inout.html', function(m){ | |
| 1820 | + $('body').append(m); | |
| 1821 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,currentSection,PublicFunctions]); | |
| 1822 | + }); | |
| 1823 | + }, | |
| 1461 | 1824 | }; |
| 1462 | 1825 | |
| 1463 | 1826 | return Bmap; | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| 1 | -/** | |
| 2 | - * reload事件 | |
| 3 | - * | |
| 4 | - * | |
| 5 | - */ | |
| 6 | - | |
| 7 | -$(function() { | |
| 8 | - | |
| 9 | - // 关闭左侧栏 | |
| 10 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 11 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 12 | - } | |
| 13 | - // 获取参数线路ID | |
| 14 | - var idAndDir = $.url().param('no'); | |
| 15 | - var param = idAndDir.split(","); | |
| 16 | - var dir = 0, id; | |
| 17 | - if (param.length == 1) { | |
| 18 | - id = param[0]; | |
| 19 | - } else { | |
| 20 | - id = param[0]; | |
| 21 | - dir = param[1]; | |
| 22 | - } | |
| 23 | - if (dir == 1) { | |
| 24 | - $('#stationUp').removeClass('active'); | |
| 25 | - $('#stationUp').removeClass('in'); | |
| 26 | - $('#stationUp').addClass('fade'); | |
| 27 | - $('#stationDown').addClass('active in'); | |
| 28 | - $('#upLine').parent().removeClass('active'); | |
| 29 | - $('#downLine').parent().addClass('active'); | |
| 30 | - } | |
| 31 | - // 如果线路ID不为空 | |
| 32 | - if (id) { | |
| 33 | - var styleOptions = { | |
| 34 | - strokeColor : "blue",// 边线颜色。 | |
| 35 | - fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 36 | - strokeWeight : 3,// 边线的宽度,以像素为单位。 | |
| 37 | - strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。 | |
| 38 | - fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。 | |
| 39 | - strokeStyle : 'solid' // 边线的样式,solid或dashed。 | |
| 40 | - }; | |
| 41 | - | |
| 42 | - // 等候500毫秒执行 | |
| 43 | - setTimeout(function() { | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 初始化线路对象,这里只初始化线路Id属性 | |
| 47 | - * | |
| 48 | - * @param:<id:线路ID> | |
| 49 | - * @return:Line | |
| 50 | - */ | |
| 51 | - var Line = LineObj.init(id); | |
| 52 | - | |
| 53 | - $("#versions").change( | |
| 54 | - function() { | |
| 55 | - var val = $(this).val(); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * 初始化上行树 | |
| 59 | - * | |
| 60 | - * @param:<Line.id:线路Id;0:上行> | |
| 61 | - */ | |
| 62 | - PublicFunctions.resjtreeDate(Line.id, '0', val); | |
| 63 | - | |
| 64 | - | |
| 65 | - LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status")); | |
| 66 | - /** | |
| 67 | - * 初始化下行树 | |
| 68 | - * | |
| 69 | - * @param:<Line.id:线路Id;1:下行> | |
| 70 | - */ | |
| 71 | - // PublicFunctions.resjtreeDate(Line.id,'1',val); | |
| 72 | - $('#stationDown').removeClass('active'); | |
| 73 | - $('#stationDown').removeClass('in'); | |
| 74 | - $('#stationDown').addClass('fade'); | |
| 75 | - $('#stationUp').addClass('active in'); | |
| 76 | - $('#downLine').parent().removeClass('active'); | |
| 77 | - $('#upLine').parent().addClass('active'); | |
| 78 | - | |
| 79 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 80 | - $(".table-toolbar").show(); | |
| 81 | - } else { | |
| 82 | - $(".table-toolbar").hide(); | |
| 83 | - } | |
| 84 | - | |
| 85 | - }); | |
| 86 | - | |
| 87 | - /** | |
| 88 | - * 初始化线路标题 | |
| 89 | - * | |
| 90 | - * @param:<Line.id:线路ID> | |
| 91 | - */ | |
| 92 | - PublicFunctions.setTiteText(Line.id); | |
| 93 | - | |
| 94 | - /** | |
| 95 | - * 初始化地图对象map | |
| 96 | - * | |
| 97 | - * @return:Map对象 | |
| 98 | - */ | |
| 99 | - var map_ = WorldsBMap.init(); | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * 初始化绘图工具类 | |
| 103 | - * | |
| 104 | - * @param:<map_:map对象;styleOptions:绘图样式对象> | |
| 105 | - * @return:DrawingManager对象 | |
| 106 | - */ | |
| 107 | - var drawingManager_ = DrawingManagerObj.init(map_, styleOptions); | |
| 108 | - | |
| 109 | - GetAjaxData.getAllLineVersions(Line.id, function(data) { | |
| 110 | - | |
| 111 | - $("#versions option").remove(); | |
| 112 | - | |
| 113 | - var reqData = false; | |
| 114 | - | |
| 115 | - for (var i = 0; i < data.length; i++) { | |
| 116 | - | |
| 117 | - var ver = data[i]; | |
| 118 | - | |
| 119 | - if (ver.status == 1) { | |
| 120 | - | |
| 121 | - /** | |
| 122 | - * 初始化上行树 | |
| 123 | - * | |
| 124 | - * @param:<Line.id:线路Id;0:上行> | |
| 125 | - */ | |
| 126 | - PublicFunctions | |
| 127 | - .TreeUpOrDown(Line.id, '0', ver.versions); | |
| 128 | - | |
| 129 | - /** | |
| 130 | - * 初始化下行树 | |
| 131 | - * | |
| 132 | - * @param:<Line.id:线路Id;1:下行> | |
| 133 | - */ | |
| 134 | - PublicFunctions | |
| 135 | - .TreeUpOrDown(Line.id, '1', ver.versions); | |
| 136 | - | |
| 137 | - reqData = true; | |
| 138 | - | |
| 139 | - var option = "<option value=" + ver.versions | |
| 140 | - + " status=" + ver.status + " selected>" | |
| 141 | - + ver.name + " (" + ver.versions + ")" | |
| 142 | - + "</option>" | |
| 143 | - $("#versions").append(option); | |
| 144 | - LineObj.setStatus(ver.status); | |
| 145 | - continue; | |
| 146 | - } | |
| 147 | - | |
| 148 | - var option = "<option value=" + ver.versions + " status=" | |
| 149 | - + ver.status + ">" + ver.name + " (" + ver.versions | |
| 150 | - + ")" + "</option>" | |
| 151 | - $("#versions").append(option); | |
| 152 | - } | |
| 153 | - | |
| 154 | - if (!reqData) { | |
| 155 | - for (var i = 0; i < data.length; i++) { | |
| 156 | - if (ver.status == 2) { | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * 初始化上行树 | |
| 160 | - * | |
| 161 | - * @param:<Line.id:线路Id;0:上行> | |
| 162 | - */ | |
| 163 | - PublicFunctions.TreeUpOrDown(Line.id, '0', | |
| 164 | - ver.versions); | |
| 165 | - | |
| 166 | - /** | |
| 167 | - * 初始化下行树 | |
| 168 | - * | |
| 169 | - * @param:<Line.id:线路Id;1:下行> | |
| 170 | - */ | |
| 171 | - PublicFunctions.TreeUpOrDown(Line.id, '1', | |
| 172 | - ver.versions); | |
| 173 | - | |
| 174 | - GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 175 | - ver.versions, function(data) { | |
| 176 | - /** | |
| 177 | - * 在地图上画出线路走向 | |
| 178 | - * | |
| 179 | - * @param:<Line.id:线路Id;0:上行;data:路段数据> | |
| 180 | - */ | |
| 181 | - PublicFunctions.linePanlThree(Line.id, | |
| 182 | - data, dir, function( | |
| 183 | - polyline_center) { | |
| 184 | - var map = WorldsBMap | |
| 185 | - .getmapBValue(); | |
| 186 | - map.panTo(polyline_center); | |
| 187 | - }); | |
| 188 | - | |
| 189 | - }); | |
| 190 | - reqData = true; | |
| 191 | - | |
| 192 | - LineObj.setStatus(ver.status); | |
| 193 | - break; | |
| 194 | - } | |
| 195 | - } | |
| 196 | - | |
| 197 | - } | |
| 198 | - | |
| 199 | - }); | |
| 200 | - | |
| 201 | - GetAjaxData.getLineMatchStationIsUpdate(Line.id, function(data) { | |
| 202 | - if (data.status == 'SUCCESS' && data.data == "1") { | |
| 203 | - $('.portlet-title .match_station').removeClass('hidden'); | |
| 204 | - } | |
| 205 | - }); | |
| 206 | - | |
| 207 | - $('#esc_edit_div').on( | |
| 208 | - 'click', | |
| 209 | - function() { | |
| 210 | - var index = layer.open({ | |
| 211 | - title : '退出提示', | |
| 212 | - content : '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | |
| 213 | - // type: 1, | |
| 214 | - // area: ['600px', '360px'], | |
| 215 | - // scrollbar: false, | |
| 216 | - | |
| 217 | - btn : [ '确定', '取消' ], | |
| 218 | - yes : function(index) { | |
| 219 | - | |
| 220 | - // 刷新左边树 | |
| 221 | - | |
| 222 | - | |
| 223 | - var dir = WorldsBMap.getDir(); | |
| 224 | - | |
| 225 | - PublicFunctions.resjtreeDate(Line.id,dir,$("#versions").val()); | |
| 226 | - // PublicFunctions.resjtreeDate(Line.id,dir); | |
| 227 | - // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> | |
| 228 | - // @return:data:路段数据 | |
| 229 | -// GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 230 | -// function(data) { | |
| 231 | -// // 在地图上画出线路走向 | |
| 232 | -// // @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | |
| 233 | -// PublicFunctions.linePanlThree( | |
| 234 | -// Line.id, data, dir); | |
| 235 | -// }); | |
| 236 | - PublicFunctions.editMapStatusRemove(); | |
| 237 | - layer.msg("已退出编辑模式!"); | |
| 238 | - layer.close(index); | |
| 239 | - }, | |
| 240 | - btn2 : function() { | |
| 241 | - layer.closeAll(index); // 关闭当前窗口 | |
| 242 | - layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | |
| 243 | - } | |
| 244 | - }); | |
| 245 | - }); | |
| 246 | - }, 500); | |
| 247 | - | |
| 248 | - } else { | |
| 249 | - | |
| 250 | - // 缺少ID | |
| 251 | - layer.confirm('【ID缺失,请点击返回,重新进行操作】', { | |
| 252 | - btn : [ '返回' ], | |
| 253 | - icon : 3, | |
| 254 | - title : '提示' | |
| 255 | - }, function(index) { | |
| 256 | - | |
| 257 | - // 关闭提示弹出层 | |
| 258 | - layer.close(index); | |
| 259 | - | |
| 260 | - // 返回线路list页面 | |
| 261 | - loadPage('/pages/base/line/list.html'); | |
| 262 | - | |
| 263 | - }); | |
| 264 | - | |
| 265 | - } | |
| 266 | - $('.green-seagreen dropdown-toggle').click(function() { | |
| 267 | - $('.dropdown-menu').css("display", "block"); | |
| 268 | - }); | |
| 1 | +/** | |
| 2 | + * reload事件 | |
| 3 | + * | |
| 4 | + * | |
| 5 | + */ | |
| 6 | + | |
| 7 | +$(function() { | |
| 8 | + | |
| 9 | + // 关闭左侧栏 | |
| 10 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 11 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 12 | + } | |
| 13 | + // 获取参数线路ID | |
| 14 | + var idAndDir = $.url().param('no'); | |
| 15 | + var param = idAndDir.split(","); | |
| 16 | + var dir = 0, id; | |
| 17 | + if (param.length == 1) { | |
| 18 | + id = param[0]; | |
| 19 | + } else { | |
| 20 | + id = param[0]; | |
| 21 | + dir = param[1]; | |
| 22 | + } | |
| 23 | + if (dir == 1) { | |
| 24 | + $('#stationUp').removeClass('active'); | |
| 25 | + $('#stationUp').removeClass('in'); | |
| 26 | + $('#stationUp').addClass('fade'); | |
| 27 | + $('#stationDown').addClass('active in'); | |
| 28 | + $('#upLine').parent().removeClass('active'); | |
| 29 | + $('#downLine').parent().addClass('active'); | |
| 30 | + } | |
| 31 | + // 如果线路ID不为空 | |
| 32 | + if (id) { | |
| 33 | + var styleOptions = { | |
| 34 | + strokeColor : "blue",// 边线颜色。 | |
| 35 | + fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 36 | + strokeWeight : 3,// 边线的宽度,以像素为单位。 | |
| 37 | + strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。 | |
| 38 | + fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。 | |
| 39 | + strokeStyle : 'solid' // 边线的样式,solid或dashed。 | |
| 40 | + }; | |
| 41 | + | |
| 42 | + // 等候500毫秒执行 | |
| 43 | + setTimeout(function() { | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 初始化线路对象,这里只初始化线路Id属性 | |
| 47 | + * | |
| 48 | + * @param:<id:线路ID> | |
| 49 | + * @return:Line | |
| 50 | + */ | |
| 51 | + var Line = LineObj.init(id); | |
| 52 | + | |
| 53 | + $("#versions").change( | |
| 54 | + function() { | |
| 55 | + var val = $(this).val(); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 初始化上行树 | |
| 59 | + * | |
| 60 | + * @param:<Line.id:线路Id;0:上行> | |
| 61 | + */ | |
| 62 | + PublicFunctions.resjtreeDate(Line.id, '0', val); | |
| 63 | + | |
| 64 | + | |
| 65 | + LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status")); | |
| 66 | + /** | |
| 67 | + * 初始化下行树 | |
| 68 | + * | |
| 69 | + * @param:<Line.id:线路Id;1:下行> | |
| 70 | + */ | |
| 71 | + // PublicFunctions.resjtreeDate(Line.id,'1',val); | |
| 72 | + $('#stationDown').removeClass('active'); | |
| 73 | + $('#stationDown').removeClass('in'); | |
| 74 | + $('#stationDown').addClass('fade'); | |
| 75 | + $('#inoutCarpark').removeClass('active'); | |
| 76 | + $('#inoutCarpark').removeClass('in'); | |
| 77 | + $('#inoutCarpark').addClass('fade'); | |
| 78 | + $('#stationUp').addClass('active in'); | |
| 79 | + $('#downLine').parent().removeClass('active'); | |
| 80 | + $('#inoutLine').parent().removeClass('active'); | |
| 81 | + $('#upLine').parent().addClass('active'); | |
| 82 | + | |
| 83 | + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | |
| 84 | + $(".table-toolbar").show(); | |
| 85 | + } else { | |
| 86 | + $(".table-toolbar").hide(); | |
| 87 | + } | |
| 88 | + | |
| 89 | + }); | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 初始化线路标题 | |
| 93 | + * | |
| 94 | + * @param:<Line.id:线路ID> | |
| 95 | + */ | |
| 96 | + PublicFunctions.setTiteText(Line.id); | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 初始化地图对象map | |
| 100 | + * | |
| 101 | + * @return:Map对象 | |
| 102 | + */ | |
| 103 | + var map_ = WorldsBMap.init(); | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * 初始化绘图工具类 | |
| 107 | + * | |
| 108 | + * @param:<map_:map对象;styleOptions:绘图样式对象> | |
| 109 | + * @return:DrawingManager对象 | |
| 110 | + */ | |
| 111 | + var drawingManager_ = DrawingManagerObj.init(map_, styleOptions); | |
| 112 | + | |
| 113 | + GetAjaxData.getAllLineVersions(Line.id, function(data) { | |
| 114 | + | |
| 115 | + $("#versions option").remove(); | |
| 116 | + | |
| 117 | + var reqData = false; | |
| 118 | + | |
| 119 | + for (var i = 0; i < data.length; i++) { | |
| 120 | + | |
| 121 | + var ver = data[i]; | |
| 122 | + | |
| 123 | + if (ver.status == 1) { | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * 初始化上行树 | |
| 127 | + * | |
| 128 | + * @param:<Line.id:线路Id;0:上行> | |
| 129 | + */ | |
| 130 | + PublicFunctions | |
| 131 | + .TreeUpOrDown(Line.id, '0', ver.versions); | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * 初始化下行树 | |
| 135 | + * | |
| 136 | + * @param:<Line.id:线路Id;1:下行> | |
| 137 | + */ | |
| 138 | + PublicFunctions | |
| 139 | + .TreeUpOrDown(Line.id, '1', ver.versions); | |
| 140 | + | |
| 141 | + reqData = true; | |
| 142 | + | |
| 143 | + var option = "<option value=" + ver.versions | |
| 144 | + + " status=" + ver.status + " selected>" | |
| 145 | + + ver.name + " (" + ver.versions + ")" | |
| 146 | + + "</option>" | |
| 147 | + $("#versions").append(option); | |
| 148 | + LineObj.setStatus(ver.status); | |
| 149 | + continue; | |
| 150 | + } | |
| 151 | + | |
| 152 | + var option = "<option value=" + ver.versions + " status=" | |
| 153 | + + ver.status + ">" + ver.name + " (" + ver.versions | |
| 154 | + + ")" + "</option>" | |
| 155 | + $("#versions").append(option); | |
| 156 | + } | |
| 157 | + | |
| 158 | + if (!reqData) { | |
| 159 | + for (var i = 0; i < data.length; i++) { | |
| 160 | + if (ver.status == 2) { | |
| 161 | + | |
| 162 | + /** | |
| 163 | + * 初始化上行树 | |
| 164 | + * | |
| 165 | + * @param:<Line.id:线路Id;0:上行> | |
| 166 | + */ | |
| 167 | + PublicFunctions.TreeUpOrDown(Line.id, '0', | |
| 168 | + ver.versions); | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 初始化下行树 | |
| 172 | + * | |
| 173 | + * @param:<Line.id:线路Id;1:下行> | |
| 174 | + */ | |
| 175 | + PublicFunctions.TreeUpOrDown(Line.id, '1', | |
| 176 | + ver.versions); | |
| 177 | + | |
| 178 | + GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 179 | + ver.versions, function(data) { | |
| 180 | + /** | |
| 181 | + * 在地图上画出线路走向 | |
| 182 | + * | |
| 183 | + * @param:<Line.id:线路Id;0:上行;data:路段数据> | |
| 184 | + */ | |
| 185 | + PublicFunctions.linePanlThree(Line.id, | |
| 186 | + data, dir, function( | |
| 187 | + polyline_center) { | |
| 188 | + var map = WorldsBMap | |
| 189 | + .getmapBValue(); | |
| 190 | + map.panTo(polyline_center); | |
| 191 | + }); | |
| 192 | + | |
| 193 | + }); | |
| 194 | + reqData = true; | |
| 195 | + | |
| 196 | + LineObj.setStatus(ver.status); | |
| 197 | + break; | |
| 198 | + } | |
| 199 | + } | |
| 200 | + | |
| 201 | + } | |
| 202 | + | |
| 203 | + }); | |
| 204 | + | |
| 205 | + GetAjaxData.getLineMatchStationIsUpdate(Line.id, function(data) { | |
| 206 | + if (data.status == 'SUCCESS' && data.data == "1") { | |
| 207 | + $('.portlet-title .match_station').removeClass('hidden'); | |
| 208 | + } | |
| 209 | + }); | |
| 210 | + | |
| 211 | + $('#esc_edit_div').on( | |
| 212 | + 'click', | |
| 213 | + function() { | |
| 214 | + var index = layer.open({ | |
| 215 | + title : '退出提示', | |
| 216 | + content : '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | |
| 217 | + // type: 1, | |
| 218 | + // area: ['600px', '360px'], | |
| 219 | + // scrollbar: false, | |
| 220 | + | |
| 221 | + btn : [ '确定', '取消' ], | |
| 222 | + yes : function(index) { | |
| 223 | + | |
| 224 | + // 刷新左边树 | |
| 225 | + | |
| 226 | + | |
| 227 | + var dir = WorldsBMap.getDir(); | |
| 228 | + | |
| 229 | + PublicFunctions.resjtreeDate(Line.id,dir,$("#versions").val()); | |
| 230 | + // PublicFunctions.resjtreeDate(Line.id,dir); | |
| 231 | + // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> | |
| 232 | + // @return:data:路段数据 | |
| 233 | +// GetAjaxData.getSectionRouteInfo(Line.id, dir, | |
| 234 | +// function(data) { | |
| 235 | +// // 在地图上画出线路走向 | |
| 236 | +// // @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | |
| 237 | +// PublicFunctions.linePanlThree( | |
| 238 | +// Line.id, data, dir); | |
| 239 | +// }); | |
| 240 | + PublicFunctions.editMapStatusRemove(); | |
| 241 | + layer.msg("已退出编辑模式!"); | |
| 242 | + layer.close(index); | |
| 243 | + }, | |
| 244 | + btn2 : function() { | |
| 245 | + layer.closeAll(index); // 关闭当前窗口 | |
| 246 | + layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | |
| 247 | + } | |
| 248 | + }); | |
| 249 | + }); | |
| 250 | + }, 500); | |
| 251 | + | |
| 252 | + } else { | |
| 253 | + | |
| 254 | + // 缺少ID | |
| 255 | + layer.confirm('【ID缺失,请点击返回,重新进行操作】', { | |
| 256 | + btn : [ '返回' ], | |
| 257 | + icon : 3, | |
| 258 | + title : '提示' | |
| 259 | + }, function(index) { | |
| 260 | + | |
| 261 | + // 关闭提示弹出层 | |
| 262 | + layer.close(index); | |
| 263 | + | |
| 264 | + // 返回线路list页面 | |
| 265 | + loadPage('/pages/base/line/list.html'); | |
| 266 | + | |
| 267 | + }); | |
| 268 | + | |
| 269 | + } | |
| 270 | + $('.green-seagreen dropdown-toggle').click(function() { | |
| 271 | + $('.dropdown-menu').css("display", "block"); | |
| 272 | + }); | |
| 269 | 273 | }); |
| 270 | 274 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| 1 | -/** | |
| 2 | - * | |
| 3 | - * 左边树Obj : StationTreeData | |
| 4 | - * | |
| 5 | - * - - - - - - 》 upInit : 初始化上行树 | |
| 6 | - * | |
| 7 | - * - - - - - - 》 downInit : 初始化下行树 | |
| 8 | - * | |
| 9 | - * - - - - - - 》 upreloadeTree : 刷行上行树 | |
| 10 | - * | |
| 11 | - * - - - - - - 》 dwonreloadeTree : 刷行下行树 | |
| 12 | - */ | |
| 13 | - | |
| 14 | -var StationTreeData = function(){ | |
| 15 | - | |
| 16 | - function parmasObj() { | |
| 17 | - | |
| 18 | - AddStationObj.setAddStation({}); | |
| 19 | - | |
| 20 | - EditStationObj.setEitdStation({}); | |
| 21 | - | |
| 22 | - EditSectionObj.setEitdSection({}); | |
| 23 | - | |
| 24 | - } | |
| 25 | - | |
| 26 | - function TreeOnclickEvent(treeOjb) { | |
| 27 | - if(treeOjb==null) | |
| 28 | - return; | |
| 29 | - // 节点个数 | |
| 30 | - var len = treeOjb.length; | |
| 31 | - if(len<0) { | |
| 32 | - return; | |
| 33 | - } | |
| 34 | - | |
| 35 | - // 获取数据 | |
| 36 | - var stationData = treeOjb[0].original; | |
| 37 | - // 选中的节点类型 | |
| 38 | - var chaildredType_ = stationData.chaildredType; | |
| 39 | - | |
| 40 | - if(chaildredType_ == "section") { | |
| 41 | - WorldsBMap.focusSection(stationData.sectionrouteId); | |
| 42 | - } else if(chaildredType_ == "station") { | |
| 43 | - WorldsBMap.openStationInfoWin(stationData); | |
| 44 | - } else if(chaildredType_ == "addSection") { | |
| 45 | - WorldsBMap.addSection(stationData); | |
| 46 | - } | |
| 47 | - } | |
| 48 | - var stationTree = { | |
| 49 | - upInit : function(treeDateJson) { | |
| 50 | - // 如果不为空 | |
| 51 | - if(treeDateJson) { | |
| 52 | - // 加载树load事件 | |
| 53 | - $('#station_Up_tree').on('loaded.jstree', function(e, data){ | |
| 54 | - // 展开树 | |
| 55 | - $.jstree.reference("#station_Up_tree").open_all(); | |
| 56 | - }).jstree({ | |
| 57 | - 'core' : { | |
| 58 | - 'themes' : { | |
| 59 | - 'responsive': false | |
| 60 | - }, | |
| 61 | - | |
| 62 | - 'data': treeDateJson, | |
| 63 | - | |
| 64 | - 'multiple':false | |
| 65 | - | |
| 66 | - }, | |
| 67 | - | |
| 68 | - 'types' : { | |
| 69 | - | |
| 70 | - "default" : { | |
| 71 | - | |
| 72 | - "icon" : false | |
| 73 | - | |
| 74 | - }, | |
| 75 | - | |
| 76 | - 'enable_true' : { | |
| 77 | - | |
| 78 | - "icon" : 'fa fa-check icon-lg' | |
| 79 | - | |
| 80 | - }, | |
| 81 | - | |
| 82 | - 'enable_false' : { | |
| 83 | - | |
| 84 | - 'icon' : 'fa fa-close icon-lg' | |
| 85 | - | |
| 86 | - }, | |
| 87 | - | |
| 88 | - 'group':{ | |
| 89 | - | |
| 90 | - 'icon' : 'fa fa-object-group icon-lg' | |
| 91 | - | |
| 92 | - } | |
| 93 | - }, | |
| 94 | - | |
| 95 | - 'plugins': ['types'] | |
| 96 | - | |
| 97 | - // 树节点单击事件 | |
| 98 | - }).bind('click.jstree', function(event) { | |
| 99 | - // 获取上行选中树节点 | |
| 100 | - var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true); | |
| 101 | - TreeOnclickEvent(treeOjb); | |
| 102 | - | |
| 103 | - }); | |
| 104 | - } | |
| 105 | - }, | |
| 106 | - downInit : function(treeDateJson) { | |
| 107 | - // 如果不为空 | |
| 108 | - if(treeDateJson) { | |
| 109 | - // 树初始化load事件 | |
| 110 | - $('#station_Down_tree').on('loaded.jstree', function(e, data){ | |
| 111 | - // 展开树 | |
| 112 | - $.jstree.reference("#station_Down_tree").open_all(); | |
| 113 | - }).jstree({ | |
| 114 | - 'core' : { | |
| 115 | - 'themes' : { | |
| 116 | - | |
| 117 | - 'responsive': false | |
| 118 | - | |
| 119 | - }, | |
| 120 | - | |
| 121 | - 'data': treeDateJson, | |
| 122 | - | |
| 123 | - 'multiple':false | |
| 124 | - | |
| 125 | - }, | |
| 126 | - | |
| 127 | - 'types' : { | |
| 128 | - | |
| 129 | - "default" : { | |
| 130 | - | |
| 131 | - "icon" : false | |
| 132 | - | |
| 133 | - }, | |
| 134 | - | |
| 135 | - 'enable_true' : { | |
| 136 | - | |
| 137 | - "icon" : 'fa fa-check icon-lg' | |
| 138 | - | |
| 139 | - }, | |
| 140 | - | |
| 141 | - 'enable_false' : { | |
| 142 | - | |
| 143 | - 'icon' : 'fa fa-close icon-lg' | |
| 144 | - | |
| 145 | - }, | |
| 146 | - | |
| 147 | - 'group':{ | |
| 148 | - | |
| 149 | - 'icon' : 'fa fa-object-group icon-lg' | |
| 150 | - | |
| 151 | - } | |
| 152 | - }, | |
| 153 | - 'plugins': ['types'] | |
| 154 | - // 树节点单击事件 | |
| 155 | - }).bind('click.jstree', function(event) { | |
| 156 | - // 获取下行选中树节点 | |
| 157 | - var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true); | |
| 158 | - TreeOnclickEvent(treeOjb); | |
| 159 | - }); | |
| 160 | - } | |
| 161 | - }, | |
| 162 | - upreloadeTree : function (treeDateJson) { | |
| 163 | - // 获取上行树 | |
| 164 | - var tree = $.jstree.reference('#station_Up_tree'); | |
| 165 | - // 赋值数据 | |
| 166 | - tree.settings.core.data = treeDateJson; | |
| 167 | - // 刷新上行树 | |
| 168 | - tree.refresh(); | |
| 169 | - // 展开树 | |
| 170 | - setTimeout(function () { | |
| 171 | - tree.open_all(); | |
| 172 | - },500); | |
| 173 | - }, | |
| 174 | - dwonreloadeTree : function (treeDateJson) { | |
| 175 | - // 获取下行树 | |
| 176 | - var tree = $.jstree.reference('#station_Down_tree'); | |
| 177 | - // 赋值数据 | |
| 178 | - tree.settings.core.data = treeDateJson; | |
| 179 | - // 刷行下行树 | |
| 180 | - tree.refresh(); | |
| 181 | - // 展开树 | |
| 182 | - setTimeout(function () { | |
| 183 | - tree.open_all(); | |
| 184 | - },500); | |
| 185 | - } | |
| 186 | - } | |
| 187 | - | |
| 188 | - return stationTree; | |
| 189 | - | |
| 1 | +/** | |
| 2 | + * | |
| 3 | + * 左边树Obj : StationTreeData | |
| 4 | + * | |
| 5 | + * - - - - - - 》 upInit : 初始化上行树 | |
| 6 | + * | |
| 7 | + * - - - - - - 》 downInit : 初始化下行树 | |
| 8 | + * | |
| 9 | + * - - - - - - 》 upreloadeTree : 刷行上行树 | |
| 10 | + * | |
| 11 | + * - - - - - - 》 dwonreloadeTree : 刷行下行树 | |
| 12 | + */ | |
| 13 | + | |
| 14 | +var StationTreeData = function(){ | |
| 15 | + | |
| 16 | + function parmasObj() { | |
| 17 | + | |
| 18 | + AddStationObj.setAddStation({}); | |
| 19 | + | |
| 20 | + EditStationObj.setEitdStation({}); | |
| 21 | + | |
| 22 | + EditSectionObj.setEitdSection({}); | |
| 23 | + | |
| 24 | + } | |
| 25 | + | |
| 26 | + function TreeOnclickEvent(treeOjb) { | |
| 27 | + if(treeOjb==null) | |
| 28 | + return; | |
| 29 | + // 节点个数 | |
| 30 | + var len = treeOjb.length; | |
| 31 | + if(len<0) { | |
| 32 | + return; | |
| 33 | + } | |
| 34 | + | |
| 35 | + // 获取数据 | |
| 36 | + var stationData = treeOjb[0].original; | |
| 37 | + // 选中的节点类型 | |
| 38 | + var chaildredType_ = stationData.chaildredType; | |
| 39 | + | |
| 40 | + if(chaildredType_ == "section") { | |
| 41 | + WorldsBMap.focusSection(stationData.sectionrouteId); | |
| 42 | + } else if(chaildredType_ == "station") { | |
| 43 | + WorldsBMap.openStationInfoWin(stationData); | |
| 44 | + } else if(chaildredType_ == "addSection") { | |
| 45 | + WorldsBMap.addSection(stationData); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + var stationTree = { | |
| 49 | + upInit : function(treeDateJson) { | |
| 50 | + // 如果不为空 | |
| 51 | + if(treeDateJson) { | |
| 52 | + // 加载树load事件 | |
| 53 | + $('#station_Up_tree').on('loaded.jstree', function(e, data){ | |
| 54 | + // 展开树 | |
| 55 | + $.jstree.reference("#station_Up_tree").open_all(); | |
| 56 | + }).jstree({ | |
| 57 | + 'core' : { | |
| 58 | + 'themes' : { | |
| 59 | + 'responsive': false | |
| 60 | + }, | |
| 61 | + | |
| 62 | + 'data': treeDateJson, | |
| 63 | + | |
| 64 | + 'multiple':false | |
| 65 | + | |
| 66 | + }, | |
| 67 | + | |
| 68 | + 'types' : { | |
| 69 | + | |
| 70 | + "default" : { | |
| 71 | + | |
| 72 | + "icon" : false | |
| 73 | + | |
| 74 | + }, | |
| 75 | + | |
| 76 | + 'enable_true' : { | |
| 77 | + | |
| 78 | + "icon" : 'fa fa-check icon-lg' | |
| 79 | + | |
| 80 | + }, | |
| 81 | + | |
| 82 | + 'enable_false' : { | |
| 83 | + | |
| 84 | + 'icon' : 'fa fa-close icon-lg' | |
| 85 | + | |
| 86 | + }, | |
| 87 | + | |
| 88 | + 'group':{ | |
| 89 | + | |
| 90 | + 'icon' : 'fa fa-object-group icon-lg' | |
| 91 | + | |
| 92 | + } | |
| 93 | + }, | |
| 94 | + | |
| 95 | + 'plugins': ['types'] | |
| 96 | + | |
| 97 | + // 树节点单击事件 | |
| 98 | + }).bind('click.jstree', function(event) { | |
| 99 | + // 获取上行选中树节点 | |
| 100 | + var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true); | |
| 101 | + TreeOnclickEvent(treeOjb); | |
| 102 | + | |
| 103 | + }); | |
| 104 | + } | |
| 105 | + }, | |
| 106 | + downInit : function(treeDateJson) { | |
| 107 | + // 如果不为空 | |
| 108 | + if(treeDateJson) { | |
| 109 | + // 树初始化load事件 | |
| 110 | + $('#station_Down_tree').on('loaded.jstree', function(e, data){ | |
| 111 | + // 展开树 | |
| 112 | + $.jstree.reference("#station_Down_tree").open_all(); | |
| 113 | + }).jstree({ | |
| 114 | + 'core' : { | |
| 115 | + 'themes' : { | |
| 116 | + | |
| 117 | + 'responsive': false | |
| 118 | + | |
| 119 | + }, | |
| 120 | + | |
| 121 | + 'data': treeDateJson, | |
| 122 | + | |
| 123 | + 'multiple':false | |
| 124 | + | |
| 125 | + }, | |
| 126 | + | |
| 127 | + 'types' : { | |
| 128 | + | |
| 129 | + "default" : { | |
| 130 | + | |
| 131 | + "icon" : false | |
| 132 | + | |
| 133 | + }, | |
| 134 | + | |
| 135 | + 'enable_true' : { | |
| 136 | + | |
| 137 | + "icon" : 'fa fa-check icon-lg' | |
| 138 | + | |
| 139 | + }, | |
| 140 | + | |
| 141 | + 'enable_false' : { | |
| 142 | + | |
| 143 | + 'icon' : 'fa fa-close icon-lg' | |
| 144 | + | |
| 145 | + }, | |
| 146 | + | |
| 147 | + 'group':{ | |
| 148 | + | |
| 149 | + 'icon' : 'fa fa-object-group icon-lg' | |
| 150 | + | |
| 151 | + } | |
| 152 | + }, | |
| 153 | + 'plugins': ['types'] | |
| 154 | + // 树节点单击事件 | |
| 155 | + }).bind('click.jstree', function(event) { | |
| 156 | + // 获取下行选中树节点 | |
| 157 | + var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true); | |
| 158 | + TreeOnclickEvent(treeOjb); | |
| 159 | + }); | |
| 160 | + } | |
| 161 | + }, | |
| 162 | + inoutInit : function(treeDateJson) { | |
| 163 | + // 如果不为空 | |
| 164 | + if(treeDateJson) { | |
| 165 | + // 树初始化load事件 | |
| 166 | + $('#inout_carpark_tree').on('loaded.jstree', function(e, data){ | |
| 167 | + // 展开树 | |
| 168 | + $.jstree.reference("#inout_carpark_tree").open_all(); | |
| 169 | + }).jstree({ | |
| 170 | + 'core' : { | |
| 171 | + 'themes' : { | |
| 172 | + 'responsive': false | |
| 173 | + }, | |
| 174 | + 'data': treeDateJson, | |
| 175 | + 'multiple':false | |
| 176 | + }, | |
| 177 | + 'types' : { | |
| 178 | + "default" : { | |
| 179 | + "icon" : false | |
| 180 | + }, | |
| 181 | + 'enable_true' : { | |
| 182 | + "icon" : 'fa fa-check icon-lg' | |
| 183 | + }, | |
| 184 | + 'enable_false' : { | |
| 185 | + 'icon' : 'fa fa-close icon-lg' | |
| 186 | + }, | |
| 187 | + 'group':{ | |
| 188 | + 'icon' : 'fa fa-object-group icon-lg' | |
| 189 | + } | |
| 190 | + }, | |
| 191 | + 'plugins': ['types'] | |
| 192 | + // 树节点单击事件 | |
| 193 | + }).bind('click.jstree', function(event) { | |
| 194 | + // 获取下行选中树节点 | |
| 195 | + var treeOjb = $.jstree.reference("#inout_carpark_tree").get_selected(true); | |
| 196 | + TreeOnclickEvent(treeOjb); | |
| 197 | + }); | |
| 198 | + } | |
| 199 | + }, | |
| 200 | + upreloadeTree : function (treeDateJson) { | |
| 201 | + // 获取上行树 | |
| 202 | + var tree = $.jstree.reference('#station_Up_tree'); | |
| 203 | + // 赋值数据 | |
| 204 | + tree.settings.core.data = treeDateJson; | |
| 205 | + // 刷新上行树 | |
| 206 | + tree.refresh(); | |
| 207 | + // 展开树 | |
| 208 | + setTimeout(function () { | |
| 209 | + tree.open_all(); | |
| 210 | + },500); | |
| 211 | + }, | |
| 212 | + dwonreloadeTree : function (treeDateJson) { | |
| 213 | + // 获取下行树 | |
| 214 | + var tree = $.jstree.reference('#station_Down_tree'); | |
| 215 | + // 赋值数据 | |
| 216 | + tree.settings.core.data = treeDateJson; | |
| 217 | + // 刷行下行树 | |
| 218 | + tree.refresh(); | |
| 219 | + // 展开树 | |
| 220 | + setTimeout(function () { | |
| 221 | + tree.open_all(); | |
| 222 | + },500); | |
| 223 | + }, | |
| 224 | + inoutreloadeTree : function (treeDateJson) { | |
| 225 | + // 获取下行树 | |
| 226 | + var tree = $.jstree.reference('#inout_carpark_tree'); | |
| 227 | + // 赋值数据 | |
| 228 | + tree.settings.core.data = treeDateJson; | |
| 229 | + // 刷行下行树 | |
| 230 | + tree.refresh(); | |
| 231 | + // 展开树 | |
| 232 | + setTimeout(function () { | |
| 233 | + tree.open_all(); | |
| 234 | + },500); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + | |
| 238 | + return stationTree; | |
| 239 | + | |
| 190 | 240 | }(); |
| 191 | 241 | \ No newline at end of file | ... | ... |