Commit e1790793a5011be926d170726fd5a546c14271a4
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
39 changed files
with
2209 additions
and
208 deletions
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -139,17 +139,17 @@ public class XDApplication implements CommandLineRunner { |
| 139 | 139 | |
| 140 | 140 | /** 线调业务 */ |
| 141 | 141 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| 142 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 70, 30, TimeUnit.SECONDS);//检查班次误点 | |
| 142 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点 | |
| 143 | 143 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 |
| 144 | 144 | |
| 145 | 145 | sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 |
| 146 | - sexec.scheduleWithFixedDelay(schedulePstThread, 120, 10, TimeUnit.SECONDS);//班次延迟入库线程 | |
| 147 | - sexec.scheduleWithFixedDelay(seiPstThread, 160, 60, TimeUnit.SECONDS);//班次修正日志入库 | |
| 146 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | |
| 147 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | |
| 148 | 148 | sexec.scheduleWithFixedDelay(directivesPstThread, 180, 120, TimeUnit.SECONDS);//调度指令延迟入库 |
| 149 | 149 | sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 150 | 150 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 151 | 151 | sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新 |
| 152 | - sexec.scheduleWithFixedDelay(autoExecScanThread, 160, 50, TimeUnit.SECONDS);//班次自动执行 | |
| 152 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | |
| 153 | 153 | DirectivePushQueue.start();//消息队列 -指令,系统下发的 |
| 154 | 154 | WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
| 155 | 155 | ... | ... |
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
0 → 100644
| 1 | +package com.bsth.controller.geo_data; | |
| 2 | + | |
| 3 | +import com.bsth.entity.geo_data.GeoStation; | |
| 4 | +import com.bsth.service.geo_data.GeoDataService; | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 9 | +import org.springframework.web.bind.annotation.RestController; | |
| 10 | + | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by panzhao on 2017/12/7. | |
| 15 | + */ | |
| 16 | +@RestController | |
| 17 | +@RequestMapping("/_geo_data") | |
| 18 | +public class GeoDataController { | |
| 19 | + | |
| 20 | + @Autowired | |
| 21 | + GeoDataService geoDataService; | |
| 22 | + | |
| 23 | + @RequestMapping("findGeoStations") | |
| 24 | + public Map<String, Object> findGeoStations(@RequestParam String lineCode){ | |
| 25 | + return geoDataService.findGeoStations(lineCode); | |
| 26 | + } | |
| 27 | + | |
| 28 | + | |
| 29 | + @RequestMapping("findGeoRoad") | |
| 30 | + public Map<String, Object> findGeoRoad(@RequestParam String lineCode){ | |
| 31 | + return geoDataService.findGeoRoad(lineCode); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST) | |
| 35 | + public Map<String, Object> updateBufferInfo(GeoStation station){ | |
| 36 | + return geoDataService.updateBufferInfo(station); | |
| 37 | + } | |
| 38 | +} | ... | ... |
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| ... | ... | @@ -49,7 +49,7 @@ public class DataHandleProcess { |
| 49 | 49 | static long lastTime; |
| 50 | 50 | |
| 51 | 51 | public static boolean isBlock() { |
| 52 | - return System.currentTimeMillis() - lastTime > 1000 * 20; | |
| 52 | + return System.currentTimeMillis() - lastTime > 1000 * 30; | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public void handle(List<GpsEntity> list) { | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
src/main/java/com/bsth/data/gpsdata_v2/handlers/AbnormalStateProcess.java
| ... | ... | @@ -25,34 +25,34 @@ public class AbnormalStateProcess { |
| 25 | 25 | */ |
| 26 | 26 | private static final double OUT_BOUNDS_THRESHOLD = 100; |
| 27 | 27 | |
| 28 | - | |
| 29 | 28 | public void process(GpsEntity gps) { |
| 30 | - if(isOffline(gps)) | |
| 29 | + if (isOffline(gps)) | |
| 31 | 30 | return; |
| 32 | 31 | |
| 33 | - if(overspeed(gps)) | |
| 32 | + if (overspeed(gps)) | |
| 34 | 33 | return; |
| 35 | 34 | |
| 36 | - if(outOfBounds((gps))) | |
| 35 | + if (outOfBounds((gps))) | |
| 37 | 36 | return; |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | - private boolean isOffline(GpsEntity gps){ | |
| 39 | + private boolean isOffline(GpsEntity gps) { | |
| 41 | 40 | return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline"); |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | |
| 45 | 44 | /** |
| 46 | 45 | * 是否超速 |
| 46 | + * | |
| 47 | 47 | * @param gps |
| 48 | 48 | * @return |
| 49 | 49 | */ |
| 50 | - private boolean overspeed(GpsEntity gps){ | |
| 50 | + private boolean overspeed(GpsEntity gps) { | |
| 51 | 51 | double maxSpeed = DEFAULT_SPEED_LIMIT; |
| 52 | - if(GeoCacheData.speedLimit(gps.getLineId()) != null) | |
| 52 | + if (GeoCacheData.speedLimit(gps.getLineId()) != null) | |
| 53 | 53 | maxSpeed = GeoCacheData.speedLimit(gps.getLineId()); |
| 54 | 54 | |
| 55 | - if(gps.getSpeed() > maxSpeed){ | |
| 55 | + if (gps.getSpeed() > maxSpeed) { | |
| 56 | 56 | gps.setAbnormalStatus("overspeed"); |
| 57 | 57 | return true; |
| 58 | 58 | } |
| ... | ... | @@ -62,12 +62,13 @@ public class AbnormalStateProcess { |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * 是否越界 |
| 65 | + * | |
| 65 | 66 | * @param gps |
| 66 | 67 | * @return |
| 67 | 68 | */ |
| 68 | - public boolean outOfBounds(GpsEntity gps){ | |
| 69 | + public boolean outOfBounds(GpsEntity gps) { | |
| 69 | 70 | //只处理场站外的车 |
| 70 | - if(gps.getInstation() != 0){ | |
| 71 | + if (gps.getInstation() != 0) { | |
| 71 | 72 | return false; |
| 72 | 73 | } |
| 73 | 74 | |
| ... | ... | @@ -76,15 +77,15 @@ public class AbnormalStateProcess { |
| 76 | 77 | |
| 77 | 78 | double min = -1, distance; |
| 78 | 79 | |
| 79 | - for(CtLineString lineString : list){ | |
| 80 | - distance = GeoUtils.getDistanceFromLine(lineString.getS(),lineString.getE(), point); | |
| 80 | + for (CtLineString lineString : list) { | |
| 81 | + distance = GeoUtils.getDistanceFromLine(lineString.getS(), lineString.getE(), point); | |
| 81 | 82 | |
| 82 | - if(min == -1 || min > distance) | |
| 83 | + if (min == -1 || min > distance) | |
| 83 | 84 | min = distance; |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | 87 | gps.setOutOfBoundDistance(min); |
| 87 | - if(min > OUT_BOUNDS_THRESHOLD){ | |
| 88 | + if (min > OUT_BOUNDS_THRESHOLD) { | |
| 88 | 89 | gps.setAbnormalStatus("outBounds"); |
| 89 | 90 | return true; |
| 90 | 91 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
| ... | ... | @@ -20,26 +20,26 @@ public class GpsStateProcess { |
| 20 | 20 | @Autowired |
| 21 | 21 | GpsStatusManager gpsStatusManager; |
| 22 | 22 | |
| 23 | - public void process(GpsEntity gps){ | |
| 23 | + public void process(GpsEntity gps) { | |
| 24 | 24 | //在执行的任务 |
| 25 | 25 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 26 | 26 | |
| 27 | - if(null == sch) | |
| 27 | + if (null == sch) | |
| 28 | 28 | return; |
| 29 | 29 | |
| 30 | 30 | byte upDown = Byte.parseByte(sch.getXlDir()); |
| 31 | 31 | |
| 32 | - if(gps.getUpDown() != upDown){ | |
| 32 | + if (gps.getUpDown() != upDown) { | |
| 33 | 33 | gps.setUpDown(upDown);//修正走向 |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if((!gps.isService() || gps.getUpDown() != upDown) && | |
| 37 | - !dayOfSchedule.emptyService(sch)){ | |
| 36 | + if ((!gps.isService() || gps.getUpDown() != upDown) && | |
| 37 | + !dayOfSchedule.emptyService(sch)) { | |
| 38 | 38 | //下发指令纠正车载的 营运状态 和 走向 |
| 39 | 39 | gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, 0, "同步@系统"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(!sch.getXlBm().equals(gps.getLineId())){ | |
| 42 | + if (!sch.getXlBm().equals(gps.getLineId())) { | |
| 43 | 43 | //切换车载的 线路编码 |
| 44 | 44 | gpsStatusManager.changeLine(gps.getNbbm(), sch.getXlBm(), "同步@系统"); |
| 45 | 45 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
| ... | ... | @@ -45,32 +45,32 @@ public class InStationProcess { |
| 45 | 45 | public void process(GpsEntity gps) { |
| 46 | 46 | //自动执行的班次信号,滚蛋 |
| 47 | 47 | LineConfig config = lineConfigData.get(gps.getLineId()); |
| 48 | - if(null != config && config.isAutoExec()) | |
| 48 | + if (null != config && config.isAutoExec()) | |
| 49 | 49 | return; |
| 50 | 50 | |
| 51 | 51 | GpsEntity prev = GpsCacheData.getPrev(gps); |
| 52 | 52 | |
| 53 | - if(null == prev) | |
| 53 | + if (null == prev) | |
| 54 | 54 | return; |
| 55 | 55 | |
| 56 | 56 | //从站外到站内 |
| 57 | - if(prev.getInstation() == 0 && gps.getInstation() > 0){ | |
| 57 | + if (prev.getInstation() == 0 && gps.getInstation() > 0) { | |
| 58 | 58 | inStation(gps, prev); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | //从站内到另一个站内 |
| 62 | - if(prev.getInstation() == 1 && gps.getInstation() == 1 | |
| 62 | + if (prev.getInstation() == 1 && gps.getInstation() == 1 | |
| 63 | 63 | && !prev.getStopNo().equals(gps.getStopNo()) |
| 64 | 64 | && !prev.getStation().getName().equals(gps.getStation().getName())) |
| 65 | 65 | inStation(gps, prev); |
| 66 | 66 | |
| 67 | 67 | //从场内到站内 |
| 68 | - if(prev.getInstation() == 2 && gps.getInstation() == 1){ | |
| 68 | + if (prev.getInstation() == 2 && gps.getInstation() == 1) { | |
| 69 | 69 | inStation(gps, prev); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | //被起点站覆盖的情况下进场 |
| 73 | - if(isInPark(gps, prev)) | |
| 73 | + if (isInPark(gps, prev)) | |
| 74 | 74 | inStation(gps, prev); |
| 75 | 75 | } |
| 76 | 76 | |
| ... | ... | @@ -96,7 +96,7 @@ public class InStationProcess { |
| 96 | 96 | |
| 97 | 97 | //进终点 |
| 98 | 98 | if (flow && null != sch && |
| 99 | - ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation()>0) || sch.getZdzCode().equals(gps.getCarparkNo()))) { | |
| 99 | + ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation() > 0) || sch.getZdzCode().equals(gps.getCarparkNo()))) { | |
| 100 | 100 | inEndStation(sch, gps); |
| 101 | 101 | isEnd = true; |
| 102 | 102 | } |
| ... | ... | @@ -267,8 +267,8 @@ public class InStationProcess { |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - private boolean isInPark(GpsEntity gps, GpsEntity prve){ | |
| 271 | - if(StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo())) | |
| 270 | + private boolean isInPark(GpsEntity gps, GpsEntity prve) { | |
| 271 | + if (StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo())) | |
| 272 | 272 | return true; |
| 273 | 273 | return false; |
| 274 | 274 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| ... | ... | @@ -42,7 +42,7 @@ public class OutStationProcess { |
| 42 | 42 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 120; |
| 43 | 43 | |
| 44 | 44 | public void process(GpsEntity gps) { |
| 45 | - //自动执行的班次信号,滚蛋 | |
| 45 | + //自动执行的线路,滚蛋 | |
| 46 | 46 | LineConfig config = lineConfigData.get(gps.getLineId()); |
| 47 | 47 | if (null != config && config.isAutoExec()) |
| 48 | 48 | return; | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/ReverseRouteProcess.java
| ... | ... | @@ -8,6 +8,8 @@ import com.bsth.data.gpsdata_v2.entity.StationRoute; |
| 8 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 9 | import com.bsth.entity.realcontrol.LineConfig; |
| 10 | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 11 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 14 | import org.springframework.stereotype.Component; |
| 13 | 15 | |
| ... | ... | @@ -30,54 +32,58 @@ public class ReverseRouteProcess { |
| 30 | 32 | @Autowired |
| 31 | 33 | LineConfigData lineConfigData; |
| 32 | 34 | |
| 33 | - public void process(GpsEntity gps){ | |
| 35 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 34 | 36 | |
| 37 | + public void process(GpsEntity gps) { | |
| 35 | 38 | LineConfig config = lineConfigData.get(gps.getLineId()); |
| 36 | - if(null != config && config.isReadReverse() && | |
| 37 | - reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){ | |
| 39 | + if (null != config && config.isReadReverse() && | |
| 40 | + reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())) { | |
| 38 | 41 | |
| 39 | 42 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 40 | - if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) | |
| 43 | + | |
| 44 | + if (null == sch) | |
| 45 | + return; | |
| 46 | + if (isInOut(sch) || !sch.getXlBm().equals(gps.getLineId())) | |
| 41 | 47 | return; |
| 42 | 48 | |
| 43 | 49 | //next |
| 44 | 50 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| 45 | - if(isInOut(next)) | |
| 51 | + if (isInOut(next)) | |
| 46 | 52 | return; |
| 47 | 53 | |
| 48 | 54 | //跳下一个班次 |
| 49 | - if(Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD) | |
| 55 | + if (Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD) | |
| 50 | 56 | dayOfSchedule.addExecPlan(next); |
| 51 | 57 | } |
| 52 | 58 | } |
| 53 | 59 | |
| 54 | 60 | private boolean reversRoute(GpsEntity gps) { |
| 55 | - if(gps.getInstation() != 1) | |
| 61 | + if (gps.getInstation() != 1) | |
| 56 | 62 | return false; |
| 57 | 63 | |
| 58 | 64 | int sortNo = gps.getStation().getRouteSort(); |
| 59 | - StationRoute prev = GpsCacheData.prevStation(gps); | |
| 65 | + StationRoute prev = GpsCacheData.prevStation(gps); | |
| 60 | 66 | //和上一个站点是反向 |
| 61 | - if(null != prev && sortNo < prev.getRouteSort()){ | |
| 67 | + if (null != prev && sortNo < prev.getRouteSort()) { | |
| 62 | 68 | |
| 63 | 69 | //满足3个进站反向信号 |
| 64 | 70 | List<StationRoute> prevs = GpsCacheData.prevMultiStation(gps); |
| 65 | 71 | |
| 66 | 72 | int count = 0; |
| 67 | - for(StationRoute s : prevs){ | |
| 68 | - if(sortNo < s.getRouteSort()) | |
| 69 | - count ++; | |
| 73 | + for (StationRoute s : prevs) { | |
| 74 | + if (sortNo < s.getRouteSort()) | |
| 75 | + count++; | |
| 70 | 76 | sortNo = s.getRouteSort(); |
| 71 | 77 | } |
| 72 | 78 | |
| 73 | - if(count >= REVER_THRESHOLD) | |
| 79 | + if (count >= REVER_THRESHOLD) | |
| 74 | 80 | return true; |
| 75 | 81 | } |
| 76 | 82 | |
| 77 | 83 | return false; |
| 78 | 84 | } |
| 79 | 85 | |
| 80 | - private boolean isInOut(ScheduleRealInfo sch){ | |
| 86 | + private boolean isInOut(ScheduleRealInfo sch) { | |
| 81 | 87 | return sch.getBcType().equals("in") || sch.getBcType().equals("out"); |
| 82 | 88 | } |
| 83 | 89 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/StationInsideProcess.java
| ... | ... | @@ -16,7 +16,7 @@ import java.util.List; |
| 16 | 16 | @Component |
| 17 | 17 | public class StationInsideProcess { |
| 18 | 18 | |
| 19 | - public void process(GpsEntity gps){ | |
| 19 | + public void process(GpsEntity gps) { | |
| 20 | 20 | //是否在场内 |
| 21 | 21 | String parkCode = GeoUtils.gpsInCarpark(gps); |
| 22 | 22 | |
| ... | ... | @@ -42,13 +42,13 @@ public class StationInsideProcess { |
| 42 | 42 | //上一个点位 |
| 43 | 43 | GpsEntity prev = GpsCacheData.getPrev(gps); |
| 44 | 44 | |
| 45 | - if(null != prev){ | |
| 45 | + if (null != prev) { | |
| 46 | 46 | //继承前置围栏状态 |
| 47 | - if(null == premiseCode && null != prev.getPremiseCode()) | |
| 47 | + if (null == premiseCode && null != prev.getPremiseCode()) | |
| 48 | 48 | gps.setPremiseCode(prev.getPremiseCode()); |
| 49 | 49 | |
| 50 | 50 | //在场,站外 |
| 51 | - if(gps.getInstation() == 0){ | |
| 51 | + if (gps.getInstation() == 0) { | |
| 52 | 52 | gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码 |
| 53 | 53 | } |
| 54 | 54 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
| ... | ... | @@ -67,10 +67,10 @@ public class SocketClientLoader { |
| 67 | 67 | |
| 68 | 68 | list = JSON.parseArray(sb.toString(), GpsEntity.class); |
| 69 | 69 | |
| 70 | + logger.info("load end ! size: " + list.size()); | |
| 70 | 71 | //过滤掉无效的点位 |
| 71 | 72 | list = GpsDataUtils.clearInvalid(list); |
| 72 | 73 | |
| 73 | - logger.info("load end!"); | |
| 74 | 74 | for (GpsEntity gps : list) { |
| 75 | 75 | gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId())); |
| 76 | 76 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
| 1 | 1 | package com.bsth.data.gpsdata_v2.utils; |
| 2 | 2 | |
| 3 | +import com.bsth.data.gpsdata_v2.GpsRealData; | |
| 3 | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 4 | 5 | import org.slf4j.Logger; |
| 5 | 6 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -24,7 +25,22 @@ public class GpsDataUtils { |
| 24 | 25 | List<GpsEntity> rs = new ArrayList<>(); |
| 25 | 26 | |
| 26 | 27 | try { |
| 28 | + GpsEntity prev; | |
| 27 | 29 | for (GpsEntity gps : list) { |
| 30 | + prev = GpsRealData.get(gps.getDeviceId()); | |
| 31 | + | |
| 32 | + //不接收过期数据 | |
| 33 | + if(prev != null){ | |
| 34 | + | |
| 35 | + if(gps.getTimestamp().longValue() < prev.getTimestamp().longValue()) | |
| 36 | + continue; | |
| 37 | + | |
| 38 | + if(prev.getTimestamp().equals(gps.getTimestamp())&& | |
| 39 | + prev.getLat().equals(gps.getLat()) && | |
| 40 | + prev.getLon().equals(gps.getLon())) | |
| 41 | + continue; | |
| 42 | + } | |
| 43 | + | |
| 28 | 44 | if (gps.getValid() == 0 && Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) < 1000 * 60 * 20) |
| 29 | 45 | rs.add(gps); |
| 30 | 46 | } | ... | ... |
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| 1 | 1 | package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | 3 | import com.bsth.data.schedule.DayOfSchedule; |
| 5 | 4 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | 5 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| ... | ... | @@ -45,35 +44,51 @@ public class SchedulePstThread extends Thread { |
| 45 | 44 | @Override |
| 46 | 45 | public void run() { |
| 47 | 46 | |
| 48 | - ScheduleRealInfo schedule; | |
| 49 | - for (int i = 0; i < 500; i++) { | |
| 50 | - schedule = DayOfSchedule.pstBuffer.poll(); | |
| 51 | - if (null == schedule) | |
| 52 | - break; | |
| 47 | + try{ | |
| 48 | + ScheduleRealInfo schedule; | |
| 49 | + for (int i = 0; i < 500; i++) { | |
| 50 | + schedule = DayOfSchedule.pstBuffer.poll(); | |
| 51 | + if (null == schedule) | |
| 52 | + break; | |
| 53 | + | |
| 54 | + if (schedule.isDeleted()) { | |
| 55 | + logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId()); | |
| 56 | + continue; | |
| 57 | + } | |
| 53 | 58 | |
| 54 | - if (schedule.isDeleted()) { | |
| 55 | - logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId()); | |
| 56 | - continue; | |
| 59 | + saveList.add(schedule); | |
| 57 | 60 | } |
| 58 | 61 | |
| 59 | - saveList.add(schedule); | |
| 62 | + //写入数据库 | |
| 63 | + save(); | |
| 64 | + }catch (Exception e){ | |
| 65 | + logger.error("", e); | |
| 60 | 66 | } |
| 61 | - | |
| 62 | - //写入数据库 | |
| 63 | - save(); | |
| 64 | 67 | } |
| 65 | 68 | |
| 69 | +/* PropertyFilter filter = new PropertyFilter() { | |
| 70 | + //过滤不需要的字段 | |
| 71 | + public boolean apply(Object source, String name, Object value) { | |
| 72 | + if("cTasks".equals(name)||"createBy".equals(name)||"updateBy".equals(name)){ | |
| 73 | + return false; | |
| 74 | + } | |
| 75 | + return true; | |
| 76 | + } | |
| 77 | + };*/ | |
| 66 | 78 | |
| 67 | 79 | private void save(){ |
| 80 | + if(saveList.size() == 0) | |
| 81 | + return; | |
| 68 | 82 | //记录同步数据 |
| 69 | 83 | logger.info("real schedule update size: " + saveList.size()); |
| 70 | - logger.info(JSON.toJSONString(saveList)); | |
| 84 | + //logger.info(JSON.toJSONString(saveList, filter)); | |
| 71 | 85 | |
| 72 | 86 | //批量入库 |
| 73 | 87 | update2Db(); |
| 74 | 88 | |
| 75 | 89 | //清空容器 |
| 76 | 90 | saveList.clear(); |
| 91 | + logger.info("update end! "); | |
| 77 | 92 | } |
| 78 | 93 | |
| 79 | 94 | private void update2Db(){ | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| ... | ... | @@ -77,11 +77,11 @@ public class ScheduleRefreshThread extends Thread{ |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | //校验一下数据库和缓存的数据 |
| 80 | - int dbCount = dayOfSchedule.dbCount(lineCode, currSchDate); | |
| 80 | + /*int dbCount = dayOfSchedule.dbCount(lineCode, currSchDate); | |
| 81 | 81 | logger.info(lineCode + " 数据库数量:" + dbCount); |
| 82 | 82 | if(dbCount != dayOfSchedule.findByLineCode(lineCode).size()){ |
| 83 | 83 | logger.error("异常异常异常,,数据库和缓存数量不一致," + lineCode); |
| 84 | - } | |
| 84 | + }*/ | |
| 85 | 85 | } |
| 86 | 86 | }catch (Exception e){ |
| 87 | 87 | logger.error("班次更新失败!! -" + lineCode, e); | ... | ... |
src/main/java/com/bsth/entity/geo_data/GeoRoad.java
0 → 100644
| 1 | +package com.bsth.entity.geo_data; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | + | |
| 5 | +import java.util.List; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by panzhao on 2017/12/8. | |
| 9 | + */ | |
| 10 | +public class GeoRoad { | |
| 11 | + | |
| 12 | + private int id; | |
| 13 | + | |
| 14 | + private Integer sectionrouteCode; | |
| 15 | + | |
| 16 | + private Integer directions; | |
| 17 | + | |
| 18 | + private String lineCode; | |
| 19 | + | |
| 20 | + private String sectionCode; | |
| 21 | + | |
| 22 | + private Integer versions; | |
| 23 | + | |
| 24 | + private String sectionName; | |
| 25 | + | |
| 26 | + private String crosesRoad; | |
| 27 | + | |
| 28 | + @JsonIgnore | |
| 29 | + private String gsectionVector; | |
| 30 | + | |
| 31 | + private List<String> bdCoords; | |
| 32 | + | |
| 33 | + public int getId() { | |
| 34 | + return id; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setId(int id) { | |
| 38 | + this.id = id; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public Integer getSectionrouteCode() { | |
| 42 | + return sectionrouteCode; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setSectionrouteCode(Integer sectionrouteCode) { | |
| 46 | + this.sectionrouteCode = sectionrouteCode; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public Integer getDirections() { | |
| 50 | + return directions; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setDirections(Integer directions) { | |
| 54 | + this.directions = directions; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public String getLineCode() { | |
| 58 | + return lineCode; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setLineCode(String lineCode) { | |
| 62 | + this.lineCode = lineCode; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getSectionCode() { | |
| 66 | + return sectionCode; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setSectionCode(String sectionCode) { | |
| 70 | + this.sectionCode = sectionCode; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Integer getVersions() { | |
| 74 | + return versions; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setVersions(Integer versions) { | |
| 78 | + this.versions = versions; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getSectionName() { | |
| 82 | + return sectionName; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setSectionName(String sectionName) { | |
| 86 | + this.sectionName = sectionName; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getCrosesRoad() { | |
| 90 | + return crosesRoad; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setCrosesRoad(String crosesRoad) { | |
| 94 | + this.crosesRoad = crosesRoad; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public String getGsectionVector() { | |
| 98 | + return gsectionVector; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setGsectionVector(String gsectionVector) { | |
| 102 | + this.gsectionVector = gsectionVector; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public List<String> getBdCoords() { | |
| 106 | + return bdCoords; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setBdCoords(List<String> bdCoords) { | |
| 110 | + this.bdCoords = bdCoords; | |
| 111 | + } | |
| 112 | +} | ... | ... |
src/main/java/com/bsth/entity/geo_data/GeoStation.java
0 → 100644
| 1 | +package com.bsth.entity.geo_data; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2017/12/7. | |
| 5 | + */ | |
| 6 | +public class GeoStation { | |
| 7 | + | |
| 8 | + private int id; | |
| 9 | + | |
| 10 | + private String stationName; | |
| 11 | + | |
| 12 | + private String stationRouteCode; | |
| 13 | + | |
| 14 | + private String lineCode; | |
| 15 | + | |
| 16 | + private Integer directions; | |
| 17 | + | |
| 18 | + private String stationCode; | |
| 19 | + | |
| 20 | + private String stationMark; | |
| 21 | + | |
| 22 | + private Integer version; | |
| 23 | + | |
| 24 | + private Float gLonx; | |
| 25 | + | |
| 26 | + private Float gLaty; | |
| 27 | + | |
| 28 | + private String gPolygonGrid; | |
| 29 | + | |
| 30 | + private Integer radius; | |
| 31 | + | |
| 32 | + private String shapesType; | |
| 33 | + | |
| 34 | + public int getId() { | |
| 35 | + return id; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setId(int id) { | |
| 39 | + this.id = id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public String getStationName() { | |
| 43 | + return stationName; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setStationName(String stationName) { | |
| 47 | + this.stationName = stationName; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public String getStationRouteCode() { | |
| 51 | + return stationRouteCode; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setStationRouteCode(String stationRouteCode) { | |
| 55 | + this.stationRouteCode = stationRouteCode; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getLineCode() { | |
| 59 | + return lineCode; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setLineCode(String lineCode) { | |
| 63 | + this.lineCode = lineCode; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public Integer getDirections() { | |
| 67 | + return directions; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setDirections(Integer directions) { | |
| 71 | + this.directions = directions; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public String getStationCode() { | |
| 75 | + return stationCode; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setStationCode(String stationCode) { | |
| 79 | + this.stationCode = stationCode; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getStationMark() { | |
| 83 | + return stationMark; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setStationMark(String stationMark) { | |
| 87 | + this.stationMark = stationMark; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public Integer getVersion() { | |
| 91 | + return version; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setVersion(Integer version) { | |
| 95 | + this.version = version; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public Float getgLonx() { | |
| 99 | + return gLonx; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setgLonx(Float gLonx) { | |
| 103 | + this.gLonx = gLonx; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public Float getgLaty() { | |
| 107 | + return gLaty; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setgLaty(Float gLaty) { | |
| 111 | + this.gLaty = gLaty; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public String getgPolygonGrid() { | |
| 115 | + return gPolygonGrid; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public void setgPolygonGrid(String gPolygonGrid) { | |
| 119 | + this.gPolygonGrid = gPolygonGrid; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public Integer getRadius() { | |
| 123 | + return radius; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public void setRadius(Integer radius) { | |
| 127 | + this.radius = radius; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public String getShapesType() { | |
| 131 | + return shapesType; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public void setShapesType(String shapesType) { | |
| 135 | + this.shapesType = shapesType; | |
| 136 | + } | |
| 137 | +} | ... | ... |
src/main/java/com/bsth/service/geo_data/GeoDataService.java
0 → 100644
| 1 | +package com.bsth.service.geo_data; | |
| 2 | + | |
| 3 | +import com.bsth.entity.geo_data.GeoStation; | |
| 4 | + | |
| 5 | +import java.util.Map; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by panzhao on 2017/12/7. | |
| 9 | + */ | |
| 10 | +public interface GeoDataService { | |
| 11 | + | |
| 12 | + | |
| 13 | + Map<String, Object> findGeoStations(String lineCode); | |
| 14 | + | |
| 15 | + | |
| 16 | + Map<String, Object> findGeoRoad(String lineCode); | |
| 17 | + | |
| 18 | + Map<String,Object> updateBufferInfo(GeoStation station); | |
| 19 | +} | ... | ... |
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.geo_data.impl; | |
| 2 | + | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 4 | +import com.bsth.entity.geo_data.GeoRoad; | |
| 5 | +import com.bsth.entity.geo_data.GeoStation; | |
| 6 | +import com.bsth.service.geo_data.GeoDataService; | |
| 7 | +import com.bsth.util.TransGPS; | |
| 8 | +import com.google.common.base.Splitter; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 14 | +import org.springframework.stereotype.Service; | |
| 15 | + | |
| 16 | +import java.util.ArrayList; | |
| 17 | +import java.util.HashMap; | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 21 | +/** | |
| 22 | + * Created by panzhao on 2017/12/8. | |
| 23 | + */ | |
| 24 | +@Service | |
| 25 | +public class GeoDataServiceImpl implements GeoDataService { | |
| 26 | + | |
| 27 | + @Autowired | |
| 28 | + JdbcTemplate jdbcTemplate; | |
| 29 | + | |
| 30 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public Map<String, Object> findGeoStations(String lineCode) { | |
| 34 | + | |
| 35 | + Map<String, Object> map = new HashMap(); | |
| 36 | + try{ | |
| 37 | + String sql = "select t1.*,t2.g_lonx,g_laty,ST_AsText(g_polygon_grid) as g_polygon_grid,radius,shapes_type from (select id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions from bsth_c_ls_stationroute where line="+lineCode+" and destroy=0 and versions in (select DISTINCT versions from bsth_c_stationroute where line="+lineCode+" and destroy=0)) t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod"; | |
| 38 | + | |
| 39 | + | |
| 40 | + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | |
| 41 | + | |
| 42 | + map.put("status", ResponseCode.SUCCESS); | |
| 43 | + map.put("list", list); | |
| 44 | + }catch (Exception e){ | |
| 45 | + logger.error("", e); | |
| 46 | + map.put("status", ResponseCode.ERROR); | |
| 47 | + map.put("msg", "服务器出现异常"); | |
| 48 | + } | |
| 49 | + return map; | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public Map<String, Object> findGeoRoad(String lineCode) { | |
| 54 | + Map<String, Object> map = new HashMap(); | |
| 55 | + try{ | |
| 56 | + String sql = "select t1.*,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector from (select id,sectionroute_code,directions,line_code,section_code,versions from bsth_c_ls_sectionroute where line="+lineCode+" and destroy=0 and versions in (select DISTINCT versions from bsth_c_sectionroute where line="+lineCode+" and destroy=0)) t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code"; | |
| 57 | + | |
| 58 | + | |
| 59 | + List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); | |
| 60 | + | |
| 61 | + for(GeoRoad road : list){ | |
| 62 | + road.setBdCoords(multiWgsToBd(road.getGsectionVector())); | |
| 63 | + } | |
| 64 | + map.put("status", ResponseCode.SUCCESS); | |
| 65 | + map.put("list", list); | |
| 66 | + }catch (Exception e){ | |
| 67 | + logger.error("", e); | |
| 68 | + map.put("status", ResponseCode.ERROR); | |
| 69 | + map.put("msg", "服务器出现异常"); | |
| 70 | + } | |
| 71 | + return map; | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 编辑缓冲区信息 | |
| 76 | + * @param station | |
| 77 | + * @return | |
| 78 | + */ | |
| 79 | + @Override | |
| 80 | + public Map<String, Object> updateBufferInfo(GeoStation station) { | |
| 81 | + Map<String, Object> rs = new HashMap<>(); | |
| 82 | + try{ | |
| 83 | + //坐标转换 | |
| 84 | + TransGPS.Location loc = TransGPS.LocationMake(station.getgLonx(), station.getgLaty()); | |
| 85 | + loc = TransGPS.bd_decrypt(loc); | |
| 86 | + loc = TransGPS.transformFromGCJToWGS(loc); | |
| 87 | + station.setgLaty(Float.parseFloat(String.valueOf(loc.getLat()))); | |
| 88 | + station.setgLonx(Float.parseFloat(String.valueOf(loc.getLng()))); | |
| 89 | + | |
| 90 | + String sql; | |
| 91 | + if(station.getShapesType().equals("r")){ | |
| 92 | + sql = "update bsth_c_station set g_lonx=?, g_laty=?, radius=? where station_cod=?"; | |
| 93 | + int rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getRadius(), station.getStationCode()); | |
| 94 | + | |
| 95 | + if(rsCount > 0){ | |
| 96 | + sql = "SELECT t1.*, t2.g_lonx,g_laty,ST_AsText (g_polygon_grid) AS g_polygon_grid,radius,shapes_type FROM (SELECT id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions FROM bsth_c_ls_stationroute WHERE id="+station.getId()+" AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod"; | |
| 97 | + List list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | |
| 98 | + | |
| 99 | + rs.put("station", list.get(0)); | |
| 100 | + rs.put("status", ResponseCode.SUCCESS); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + }catch (Exception e){ | |
| 105 | + logger.error("", e); | |
| 106 | + rs.put("status", ResponseCode.ERROR); | |
| 107 | + rs.put("msg", "服务器出现异常"); | |
| 108 | + } | |
| 109 | + return rs; | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * wgs 坐标数组转 百度 | |
| 114 | + * | |
| 115 | + * @return | |
| 116 | + */ | |
| 117 | + private List<String> multiWgsToBd(String crdStr) { | |
| 118 | + List<String> bdList = new ArrayList<>(); | |
| 119 | + | |
| 120 | + List<String> gList = Splitter.on(",").splitToList(crdStr.substring(11, crdStr.length() - 2)); | |
| 121 | + TransGPS.Location location; | |
| 122 | + //StringBuilder itemStr = new StringBuilder(); | |
| 123 | + String[] cds; | |
| 124 | + for(String gs : gList){ | |
| 125 | + cds = gs.split(" "); | |
| 126 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])))); | |
| 127 | + //itemStr.append(location.getLng() + " " + location.getLat() + ","); | |
| 128 | + | |
| 129 | + bdList.add(location.getLng() + " " + location.getLat()); | |
| 130 | + } | |
| 131 | + return bdList; | |
| 132 | + } | |
| 133 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -569,17 +569,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 569 | 569 | //公司 和 分公司名称 |
| 570 | 570 | t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); |
| 571 | 571 | t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm() + "_" + t.getGsBm())); |
| 572 | - | |
| 572 | + t.setCreateDate(new Date()); | |
| 573 | 573 | t.setScheduleDateStr(schDate); |
| 574 | 574 | t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); |
| 575 | 575 | t.setRealExecDate(schDate); |
| 576 | + | |
| 576 | 577 | t.setCreateBy(user); |
| 577 | 578 | t.setSflj(true); |
| 578 | 579 | t.setLate(false); |
| 579 | 580 | t.setDfsj(t.getFcsj()); |
| 580 | 581 | t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime()); |
| 581 | 582 | t.setJhlcOrig(t.getJhlc()); |
| 582 | - | |
| 583 | + t.setCreateDate(new Date()); | |
| 584 | + t.setUpdateDate(new Date()); | |
| 585 | + t.setSpId(-1L); | |
| 583 | 586 | //起终点名称 |
| 584 | 587 | String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; |
| 585 | 588 | t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | ... | ... |
src/main/resources/static/assets/js/TransGPS.js
| ... | ... | @@ -80,7 +80,7 @@ var TransGPS = (function(){ |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | function bd_decrypt(lat, lng){ |
| 83 | - var x = bdLoc.lng - 0.0065, y = bdLoc.lat - 0.006; | |
| 83 | + var x = lng - 0.0065, y = lat - 0.006; | |
| 84 | 84 | var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); |
| 85 | 85 | var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); |
| 86 | 86 | |
| ... | ... | @@ -92,8 +92,12 @@ var TransGPS = (function(){ |
| 92 | 92 | var gcj = transformFromWGSToGCJ(lat, lng); |
| 93 | 93 | return bd_encrypt(gcj.lat, gcj.lng); |
| 94 | 94 | }, |
| 95 | - transformFromWGSToGCJ: transformFromWGSToGCJ | |
| 96 | - } | |
| 95 | + transformFromWGSToGCJ: transformFromWGSToGCJ, | |
| 96 | + bdToWgs: function (lat, lng) { | |
| 97 | + var gcj = bd_decrypt(lat, lng); | |
| 98 | + return transformFromGCJToWGS(gcj.lat, gcj.lng); | |
| 99 | + } | |
| 100 | + }; | |
| 97 | 101 | |
| 98 | 102 | return transGPS; |
| 99 | 103 | })(); |
| 100 | 104 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
0 → 100644
| 1 | +/* ^_^ baidu map hide logo */ | |
| 2 | +.anchorBL, .anchorBL, .amap-logo, .amap-copyright { | |
| 3 | + display: none; | |
| 4 | +} | |
| 5 | + | |
| 6 | +html,body{ | |
| 7 | + height: 100%; | |
| 8 | +} | |
| 9 | +.ct_page{ | |
| 10 | + padding: 0; | |
| 11 | + height: 100%; | |
| 12 | +} | |
| 13 | + | |
| 14 | +div#map_wrap{ | |
| 15 | + height: 100%; | |
| 16 | +} | |
| 17 | + | |
| 18 | +.main_left_panel{ | |
| 19 | + position: absolute; | |
| 20 | + z-index: 999; | |
| 21 | + height: calc(100% - 20px); | |
| 22 | + width: 300px; | |
| 23 | + background: #fffffff5; | |
| 24 | + top: 7px; | |
| 25 | + left: 5px; | |
| 26 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 27 | +} | |
| 28 | +.main_lt_search_panel{ | |
| 29 | + position: absolute; | |
| 30 | + z-index: 99; | |
| 31 | + top: 10px; | |
| 32 | + left: 330px; | |
| 33 | + background: #fffffff5; | |
| 34 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 35 | +} | |
| 36 | +.main_rt_tools_panel{ | |
| 37 | + position: absolute; | |
| 38 | + z-index: 99; | |
| 39 | + top: 7px; | |
| 40 | + right: 7px; | |
| 41 | + background: #ffffff; | |
| 42 | + box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48); | |
| 43 | + padding: 0 12px; | |
| 44 | + text-align: center; | |
| 45 | + border-radius: 7px; | |
| 46 | + height: 28px; | |
| 47 | +} | |
| 48 | + | |
| 49 | +.main_rt_tools_panel>._icon{ | |
| 50 | + margin: 0 9px; | |
| 51 | +} | |
| 52 | +.search_input{ | |
| 53 | + width: 250px; | |
| 54 | + height: 42px; | |
| 55 | +} | |
| 56 | + | |
| 57 | +.search_input::placeholder{ | |
| 58 | + color: grey; | |
| 59 | + font-size: 12px; | |
| 60 | +} | |
| 61 | + | |
| 62 | +._line_info{ | |
| 63 | + width: 100%; | |
| 64 | + height: 90px; | |
| 65 | + background: white; | |
| 66 | + box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48); | |
| 67 | +} | |
| 68 | + | |
| 69 | +._line_name{ | |
| 70 | + padding: 10px 0 0 15px; | |
| 71 | + font-weight: 600; | |
| 72 | + font-family: 微软雅黑; | |
| 73 | + font-size: 18px; | |
| 74 | + color: #484848; | |
| 75 | + position: relative; | |
| 76 | +} | |
| 77 | + | |
| 78 | +._version_dropdown_wrap{ | |
| 79 | + padding: 4px 0 0 15px; | |
| 80 | +} | |
| 81 | +._version_text{ | |
| 82 | + font-size: 14px; | |
| 83 | + color: #0aae0a; | |
| 84 | +} | |
| 85 | +._version_dropdown_wrap li.uk-active>a{ | |
| 86 | + color: #0aae0a; | |
| 87 | +} | |
| 88 | +.uk-nav-header:not(:first-child) { | |
| 89 | + margin-top: 10px; | |
| 90 | +} | |
| 91 | +.add_line_version_icon{ | |
| 92 | + position: absolute; | |
| 93 | + right: 18px; | |
| 94 | + top: 10px; | |
| 95 | +} | |
| 96 | +.clock_enable_version{ | |
| 97 | + padding: 4px 0 0 15px; | |
| 98 | + font-size: 13px; | |
| 99 | + color: #ef4f4f; | |
| 100 | +} | |
| 101 | + | |
| 102 | +.clock_enable_version>a.uk-icon{ | |
| 103 | + vertical-align: top; | |
| 104 | + margin-top: 6px; | |
| 105 | +} | |
| 106 | +._route_info_wrap{ | |
| 107 | + height: calc(100% - 100px); | |
| 108 | + padding-top: 10px; | |
| 109 | +} | |
| 110 | + | |
| 111 | +._route_info_wrap .uk-tab>li>a{ | |
| 112 | + padding: 9px 5px; | |
| 113 | +} | |
| 114 | +._route_info_wrap>ul.uk-tab{ | |
| 115 | + padding-left: 10px; | |
| 116 | + margin-bottom: 0; | |
| 117 | +} | |
| 118 | +.rt_show_version_txt{ | |
| 119 | + position: absolute; | |
| 120 | + right: 7px; | |
| 121 | + bottom: 7px; | |
| 122 | + font-size: 12px; | |
| 123 | +} | |
| 124 | +.rt_show_version_txt{ | |
| 125 | + position: absolute; | |
| 126 | + right: 7px; | |
| 127 | + bottom: 7px; | |
| 128 | + font-size: 12px; | |
| 129 | + padding: 5px 8px; | |
| 130 | +} | |
| 131 | +.station_route>ul{ | |
| 132 | + padding: 0 0 0 30px; | |
| 133 | + font-size: 14px; | |
| 134 | + width: calc(100% - 38px); | |
| 135 | +} | |
| 136 | + | |
| 137 | +.station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { | |
| 138 | + margin-top: 0; | |
| 139 | +} | |
| 140 | + | |
| 141 | +.station_route>ul>li>a{ | |
| 142 | + color: #434343; | |
| 143 | + overflow: hidden; | |
| 144 | + text-overflow: ellipsis; | |
| 145 | + white-space: nowrap; | |
| 146 | + display: inline-block; | |
| 147 | + width: calc(100% - 53px); | |
| 148 | + padding: 4px 0; | |
| 149 | + vertical-align: middle;+0982/ | |
| 150 | +} | |
| 151 | + | |
| 152 | +.ct_route_badge{ | |
| 153 | + font-size: 11px; | |
| 154 | + height: 18px; | |
| 155 | + border-radius: 5px; | |
| 156 | + vertical-align: top; | |
| 157 | + margin-top: 1px; | |
| 158 | + padding: 0 4px; | |
| 159 | + margin-right: 3px; | |
| 160 | + min-width: 18px; | |
| 161 | +} | |
| 162 | + | |
| 163 | +.up_down_route_list>li:nth-of-type(2) .ct_route_badge{ | |
| 164 | + background: #fb6464; | |
| 165 | +} | |
| 166 | + | |
| 167 | +.ct_route_badge.start{ | |
| 168 | + margin-left: 0px; | |
| 169 | +} | |
| 170 | +.ct_route_badge.end{ | |
| 171 | + margin-left: 0px; | |
| 172 | +} | |
| 173 | +.road_route{ | |
| 174 | + padding-left: 30px; | |
| 175 | + width: calc(100% - 25px); | |
| 176 | + font-size: 14px; | |
| 177 | + color: #242424; | |
| 178 | + border-top: 1px solid #d5d5d5; | |
| 179 | + padding-top: 0; | |
| 180 | +} | |
| 181 | +._route_info_wrap>ul.uk-switcher{ | |
| 182 | + overflow: auto; | |
| 183 | + height: calc(100% - 62px); | |
| 184 | + margin-bottom: 0; | |
| 185 | + position: relative; | |
| 186 | + padding-top: 20px; | |
| 187 | + margin-top: 0 !important; | |
| 188 | +} | |
| 189 | + | |
| 190 | +.pos_tb_icon{ | |
| 191 | + position: absolute; | |
| 192 | + bottom: 15px; | |
| 193 | + right: 15px; | |
| 194 | +} | |
| 195 | +.ct_route_badge_wrap{ | |
| 196 | + display: inline-block; | |
| 197 | + width: 48px; | |
| 198 | + text-align: right; | |
| 199 | + vertical-align: top; | |
| 200 | + margin-top: 3px; | |
| 201 | +} | |
| 202 | + | |
| 203 | +.road_route>ul li a{ | |
| 204 | + color: #242424; | |
| 205 | + width: 100%; | |
| 206 | + display: block; | |
| 207 | + padding-left: 8px; | |
| 208 | +} | |
| 209 | + | |
| 210 | +.road_route>ul{ | |
| 211 | + border-left: 1px solid #cbcbcb; | |
| 212 | + padding-left: 0; | |
| 213 | + padding-top: 10px; | |
| 214 | +} | |
| 215 | + | |
| 216 | +span.sub_name { | |
| 217 | + font-size: 12px; | |
| 218 | + color: #777676; | |
| 219 | + margin-left: 5px; | |
| 220 | +} | |
| 221 | + | |
| 222 | +.road_route>ul>li{ | |
| 223 | + width: calc(100% - 10px); | |
| 224 | + overflow: hidden; | |
| 225 | + text-overflow: ellipsis; | |
| 226 | + white-space: nowrap; | |
| 227 | + display: inline-block; | |
| 228 | +} | |
| 229 | + | |
| 230 | +#map_wrap img { | |
| 231 | + max-width: none; | |
| 232 | +} | |
| 233 | + | |
| 234 | +ul.uk-list.station_info_win { | |
| 235 | + font-size: 14px; | |
| 236 | + padding-left: 5px; | |
| 237 | +} | |
| 238 | + | |
| 239 | +.uk-list.station_info_win>li:nth-child(n+2), .uk-list.station_info_win>li>ul { | |
| 240 | + margin-top: 7px; | |
| 241 | +} | |
| 242 | + | |
| 243 | +ul.uk-list.station_info_win>li.s_name{ | |
| 244 | + font-size: 16px; | |
| 245 | + font-weight: 600; | |
| 246 | + color: #e15428; | |
| 247 | +} | |
| 248 | + | |
| 249 | +.up_down_route_list li.ct_active{ | |
| 250 | + background: #91d9fa; | |
| 251 | +} | |
| 252 | + | |
| 253 | +.up_down_route_list li.ct_active.first_road_active{ | |
| 254 | + background: #fff; | |
| 255 | +} | |
| 256 | + | |
| 257 | +.up_down_route_list li.ct_active.first_road_active>a{ | |
| 258 | + background: #91d9fa; | |
| 259 | +} | |
| 260 | + | |
| 261 | +.road_route .uk-list ul{ | |
| 262 | + padding-left: 22px; | |
| 263 | +} | |
| 264 | + | |
| 265 | +.road_route>ul>li>ul>li{ | |
| 266 | + padding-left: 8px; | |
| 267 | +} | |
| 268 | + | |
| 269 | +.ct_coord_str{ | |
| 270 | + max-height: 300px; | |
| 271 | + overflow: auto; | |
| 272 | +} | |
| 273 | + | |
| 274 | +ul.context-menu-list.station-route-ct-menu.context-menu-root { | |
| 275 | + font-size: 14px; | |
| 276 | + width: 170px !important; | |
| 277 | + min-width: 70px; | |
| 278 | + border: 1px solid #d2d2d2; | |
| 279 | + overflow: hidden; | |
| 280 | + border-radius: 0; | |
| 281 | + background: #fff; | |
| 282 | + color: #666; | |
| 283 | + box-shadow: 0 5px 12px rgba(0,0,0,.15); | |
| 284 | +} | |
| 285 | + | |
| 286 | +.main_left_panel_m_layer{ | |
| 287 | + position: absolute; | |
| 288 | + z-index: 10000; | |
| 289 | + height: calc(100% - 20px); | |
| 290 | + width: 300px; | |
| 291 | + background: #ffffff85; | |
| 292 | + top: 7px; | |
| 293 | + left: 5px; | |
| 294 | + display: none; | |
| 295 | +} | |
| 296 | + | |
| 297 | +.buffer_edit_panel{ | |
| 298 | + position: absolute; | |
| 299 | + top: 5px; | |
| 300 | + width: 360px; | |
| 301 | + height: 120px; | |
| 302 | + background: #ffffff; | |
| 303 | + left: calc(50% - 170px); | |
| 304 | + z-index: 999; | |
| 305 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 306 | + display: none; | |
| 307 | +} | |
| 308 | +.buffer_edit_body{ | |
| 309 | + padding: 5px; | |
| 310 | +} | |
| 311 | + | |
| 312 | +.buffer_edit_body>.name{ | |
| 313 | + font-weight: 600; | |
| 314 | + color: #E91E63; | |
| 315 | + margin-bottom: 0; | |
| 316 | +} | |
| 317 | + | |
| 318 | +.buffer_edit_body .ct_row .uk-inline{ | |
| 319 | + width: 167px; | |
| 320 | + height: 30px; | |
| 321 | + margin-right: 7px; | |
| 322 | +} | |
| 323 | + | |
| 324 | +.buffer_edit_body .ct_row{ | |
| 325 | + margin-top: 12px; | |
| 326 | +} | |
| 327 | + | |
| 328 | +.buffer_edit_body .ct_row .uk-inline:last-child{ | |
| 329 | + margin-right: 0; | |
| 330 | +} | |
| 331 | + | |
| 332 | +.buffer_edit_body .ct_row .uk-inline input{ | |
| 333 | + height: 30px; | |
| 334 | +} | |
| 335 | + | |
| 336 | +.buffer_edit_body .ct_row .uk-form-icon-flip { | |
| 337 | + font-size: 12px; | |
| 338 | +} | |
| 339 | + | |
| 340 | +.buffer_edit_body .ct_row .uk-inline.btns{ | |
| 341 | + text-align: right; | |
| 342 | +} | |
| 343 | +.buffer_edit_body .ct_row .uk-inline.btns .uk-button{ | |
| 344 | + padding: 0 15px; | |
| 345 | + height: 28px; | |
| 346 | + line-height: 28px; | |
| 347 | + vertical-align: top; | |
| 348 | + margin-top: 2px; | |
| 349 | +} | |
| 350 | + | |
| 351 | +.loading{ | |
| 352 | + height: 100%; | |
| 353 | + text-align: center; | |
| 354 | + position: absolute; | |
| 355 | + z-index: 10000; | |
| 356 | + top: 0; | |
| 357 | + left: 0; | |
| 358 | + width: 100%; | |
| 359 | + background: #ffffff78; | |
| 360 | + display: flex; | |
| 361 | +} | |
| 362 | + | |
| 363 | +.loading>div{ | |
| 364 | + margin: auto; | |
| 365 | + margin-top: calc(25% - 100px); | |
| 366 | + background: #f9d56c; | |
| 367 | + padding: 12px; | |
| 368 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 369 | +} | |
| 370 | + | |
| 371 | +.loading>div>span{ | |
| 372 | + vertical-align: top; | |
| 373 | + margin-top: -6px; | |
| 374 | + margin-right: 5px; | |
| 375 | + font-size: 14px; | |
| 376 | +} | |
| 377 | +.uk-modal{ | |
| 378 | + z-index: 10001; | |
| 379 | +} | |
| 380 | + | |
| 381 | +.ct_route_badge.polygon{ | |
| 382 | + | |
| 383 | +} | |
| 384 | + | |
| 385 | +.shapes_type>div.uk-inline:nth-of-type(2){ | |
| 386 | + width: 80px; | |
| 387 | + margin-right: 0; | |
| 388 | +} | |
| 389 | + | |
| 390 | +.shapes_type>div.uk-inline:first-child{ | |
| 391 | + width: 84px; | |
| 392 | +} | |
| 393 | + | |
| 394 | +.shapes_type>div.uk-inline:first-child select{ | |
| 395 | + height: 30px; | |
| 396 | +} | |
| 397 | + | |
| 398 | +.shapes_type.st_d>div.uk-inline:nth-of-type(2){ | |
| 399 | + display: none; | |
| 400 | +} | |
| 401 | + | |
| 402 | +.shapes_type.st_d>div.uk-inline:first-child{ | |
| 403 | + width: 167px; | |
| 404 | +} | |
| 405 | + | |
| 406 | +.draw_polygon_switch{ | |
| 407 | + display: none; | |
| 408 | +} | |
| 409 | + | |
| 410 | +.shapes_type.st_d>div.uk-inline:first-child select{ | |
| 411 | + width: 107px; | |
| 412 | +} | |
| 413 | + | |
| 414 | +.shapes_type.st_d .draw_polygon_switch{ | |
| 415 | + display: inline-block; | |
| 416 | + font-size: 12px; | |
| 417 | + vertical-align: bottom; | |
| 418 | + margin-left: 5px; | |
| 419 | +} | |
| 420 | + | |
| 421 | +.shapes_type.st_d .draw_polygon_switch>a{ | |
| 422 | + color: red; | |
| 423 | +} | |
| 0 | 424 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html
0 → 100644
| 1 | +<div> | |
| 2 | + <script id="geo_d_e_road_route-temp" type="text/html"> | |
| 3 | + <ul class="uk-list"> | |
| 4 | + {{each list as subArr i}} | |
| 5 | + <li class="road_li_{{subArr[0].sectionCode}} first_road_active"> | |
| 6 | + <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> | |
| 7 | + | |
| 8 | + {{if subArr.length > 1}} | |
| 9 | + {{each subArr as obj j}} | |
| 10 | + <ul class="uk-list"> | |
| 11 | + {{if j > 0}} | |
| 12 | + <li class="road_li_{{obj.sectionCode}}"> | |
| 13 | + <a data-code="{{obj.sectionCode}}" data-updown="{{obj.directions}}">{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li> | |
| 14 | + {{/if}} | |
| 15 | + </ul> | |
| 16 | + {{/each}} | |
| 17 | + {{/if}} | |
| 18 | + </li> | |
| 19 | + {{/each}} | |
| 20 | + </ul> | |
| 21 | + </script> | |
| 22 | + | |
| 23 | + <script id="geo_d_e_road_info_win-temp" type="text/html"> | |
| 24 | + <ul class="uk-list station_info_win"> | |
| 25 | + <li class="s_name">{{sectionName}}</li> | |
| 26 | + <li>交叉路名: {{crosesRoad}}</li> | |
| 27 | + <li>路段编号:{{sectionCode}}</li> | |
| 28 | + <li>路由序号:{{sectionrouteCode}}</li> | |
| 29 | + <li>坐标: | |
| 30 | + <div class="ct_coord_str"> | |
| 31 | + {{each bdCoords as coord i}} | |
| 32 | + <code>{{coord}}</code><br> | |
| 33 | + {{/each}} | |
| 34 | + </div> | |
| 35 | + </li> | |
| 36 | + </ul> | |
| 37 | + </script> | |
| 38 | +</div> | |
| 0 | 39 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
0 → 100644
| 1 | +<div> | |
| 2 | + <script id="geo_d_e_station_route-temp" type="text/html"> | |
| 3 | + <ul class="uk-list"> | |
| 4 | + {{each list as s i}} | |
| 5 | + <li class="station_li_{{s.stationCode}}"> | |
| 6 | + <div class="ct_route_badge_wrap"> | |
| 7 | + <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}"> | |
| 8 | + {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span> | |
| 9 | + </div> | |
| 10 | + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> | |
| 11 | + </li> | |
| 12 | + {{/each}} | |
| 13 | + </ul> | |
| 14 | + </script> | |
| 15 | + | |
| 16 | + | |
| 17 | + <script id="geo_d_e_station_info_win-temp" type="text/html"> | |
| 18 | + <ul class="uk-list station_info_win"> | |
| 19 | + <li class="s_name">{{stationName}}</li> | |
| 20 | + <li>站点编码: {{stationCode}}</li> | |
| 21 | + <li>站点类型: | |
| 22 | + {{if stationMark=='B'}} | |
| 23 | + 起点站 | |
| 24 | + {{else if stationMark=='E'}} | |
| 25 | + 终点站 | |
| 26 | + {{else if stationMark=='Z'}} | |
| 27 | + 中途站 | |
| 28 | + {{/if}} | |
| 29 | + </li> | |
| 30 | + <li> | |
| 31 | + 经度: {{gLaty}} | |
| 32 | + </li> | |
| 33 | + <li>纬度: {{gLonx}}</li> | |
| 34 | + <li> | |
| 35 | + 电子围栏类型: | |
| 36 | + {{if shapesType=='r'}} | |
| 37 | + 圆形 | |
| 38 | + {{else if shapesType=='d'}} | |
| 39 | + 多边形 | |
| 40 | + {{/if}} | |
| 41 | + </li> | |
| 42 | + <li> | |
| 43 | + {{if shapesType=='r'}} | |
| 44 | + 半径:{{radius}} | |
| 45 | + {{/if}} | |
| 46 | + </li> | |
| 47 | + <li>站序:{{index + 1}}</li> | |
| 48 | + <li>路由序号:{{stationRouteCode}}</li> | |
| 49 | + </ul> | |
| 50 | + </script> | |
| 51 | + | |
| 52 | + <script id="geo_d_e_map_edit_buffer_panel-temp" type="text/html"> | |
| 53 | + <div class="buffer_edit_panel uk-animation-slide-top-small"> | |
| 54 | + <div class="buffer_edit_body" > | |
| 55 | + <h6 class="name">{{stationName}}(缓冲区编辑)</h6> | |
| 56 | + <form> | |
| 57 | + <input type="hidden" value="{{id}}" name="id"> | |
| 58 | + <input type="hidden" value="{{directions}}" name="directions"> | |
| 59 | + <input type="hidden" value="{{stationCode}}" name="stationCode"> | |
| 60 | + <input type="hidden" value="{{stationName}}" name="stationName"> | |
| 61 | + <div class="ct_row"> | |
| 62 | + <div class="uk-inline"> | |
| 63 | + <span class="uk-form-icon uk-form-icon-flip" >经度</span> | |
| 64 | + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly> | |
| 65 | + </div> | |
| 66 | + <div class="uk-inline"> | |
| 67 | + <span class="uk-form-icon uk-form-icon-flip" >纬度</span> | |
| 68 | + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly> | |
| 69 | + </div> | |
| 70 | + </div> | |
| 71 | + | |
| 72 | + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}"> | |
| 73 | + <div class="uk-inline" > | |
| 74 | + <select name="shapesType" class="uk-select"> | |
| 75 | + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option> | |
| 76 | + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option> | |
| 77 | + </select> | |
| 78 | + <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span> | |
| 79 | + </div> | |
| 80 | + <div class="uk-inline"> | |
| 81 | + <span class="uk-form-icon uk-form-icon-flip" >半径</span> | |
| 82 | + <input class="uk-input" name="radius" type="text" value="{{radius}}"> | |
| 83 | + </div> | |
| 84 | + <div class="uk-inline btns"> | |
| 85 | + <button class="uk-button uk-button-primary submit">确定</button> | |
| 86 | + <button class="uk-button uk-button-default cancel">取消</button> | |
| 87 | + </div> | |
| 88 | + </div> | |
| 89 | + </form> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + </script> | |
| 93 | +</div> | |
| 0 | 94 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/fragments/left_card.html
0 → 100644
src/main/resources/static/pages/base/geo_data_edit/fragments/rt_tools.html
0 → 100644
src/main/resources/static/pages/base/geo_data_edit/js/common_data.js
0 → 100644
src/main/resources/static/pages/base/geo_data_edit/js/history_edit_logs.js
0 → 100644
src/main/resources/static/pages/base/geo_data_edit/js/map.js
0 → 100644
| 1 | +<!-- 地图操作 --> | |
| 2 | + | |
| 3 | +var gb_ct_map = function () { | |
| 4 | + | |
| 5 | + //初始化地图 | |
| 6 | + if(!window.BMap){ | |
| 7 | + alert('地图没有加载成功,请确认是否能正常连接外网!!'); | |
| 8 | + } | |
| 9 | + var gb_map_consts = { | |
| 10 | + mapContainer: '#map_wrap', | |
| 11 | + center_point: { | |
| 12 | + lng: 121.544336, | |
| 13 | + lat: 31.221315 | |
| 14 | + } | |
| 15 | + }; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 地图状态 | |
| 19 | + * 1: 站点缓冲区编辑 | |
| 20 | + */ | |
| 21 | + var map_status=0; | |
| 22 | + var editCircle; | |
| 23 | + var editPolygon; | |
| 24 | + | |
| 25 | + map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); | |
| 26 | + //中心点和缩放级别 | |
| 27 | + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); | |
| 28 | + map.enableScrollWheelZoom(); | |
| 29 | + | |
| 30 | + var roadPolylines = [], stationMarkers=[]; | |
| 31 | + var _render = function (cb) { | |
| 32 | + //绘制路段 | |
| 33 | + _renderRoads(gb_road_route.getData()); | |
| 34 | + //绘制站点 | |
| 35 | + _renderStation(gb_station_route.getData()); | |
| 36 | + | |
| 37 | + changeUpDown(); | |
| 38 | + | |
| 39 | + //居中至上行中间站点 | |
| 40 | + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)]; | |
| 41 | + map.setCenter(cm.point); | |
| 42 | + | |
| 43 | + cb && cb(); | |
| 44 | + }; | |
| 45 | + | |
| 46 | + var updownColor = function (updown) { | |
| 47 | + return updown==0?'blue':'red'; | |
| 48 | + }; | |
| 49 | + var _renderRoads = function (data) { | |
| 50 | + _renderPolyline(data[0], updownColor(0));//上行路段 | |
| 51 | + _renderPolyline(data[1], updownColor(1));//下行路段 | |
| 52 | + }; | |
| 53 | + | |
| 54 | + var _renderStation = function (data) { | |
| 55 | + _renderStationMarket(data[0]);//上行站点 | |
| 56 | + _renderStationMarket(data[1]);//下行站点 | |
| 57 | + }; | |
| 58 | + | |
| 59 | + var _renderStationMarket = function (routes, color) { | |
| 60 | + var marker; | |
| 61 | + var array=[]; | |
| 62 | + $.each(routes, function (i) { | |
| 63 | + this.index = i; | |
| 64 | + transCoord(this); | |
| 65 | + marker=createStationMark(this); | |
| 66 | + marker.stationCode = this.stationCode; | |
| 67 | + marker.ct_data = this; | |
| 68 | + map.addOverlay(marker); | |
| 69 | + | |
| 70 | + array.push(marker); | |
| 71 | + }); | |
| 72 | + | |
| 73 | + stationMarkers.push(array); | |
| 74 | + }; | |
| 75 | + | |
| 76 | + function transCoord(obj) { | |
| 77 | + var coord = TransGPS.wgsToBD(obj.gLaty, obj.gLonx); | |
| 78 | + obj.bd_lat = coord.lat; | |
| 79 | + obj.bd_lon = coord.lng; | |
| 80 | + } | |
| 81 | + | |
| 82 | + var _renderPolyline = function (routes, color) { | |
| 83 | + var pos, temps; | |
| 84 | + var polyline, _pLines=[]; | |
| 85 | + var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7}; | |
| 86 | + $.each(routes, function (i, item) { | |
| 87 | + | |
| 88 | + pos = []; | |
| 89 | + $.each(item.bdCoords, function () { | |
| 90 | + temps = this.split(' '); | |
| 91 | + pos.push(new BMap.Point(temps[0], temps[1])); | |
| 92 | + }); | |
| 93 | + polyline = new BMap.Polyline(pos, style); | |
| 94 | + polyline.ct_data = item; | |
| 95 | + polyline.ct_data.oldColor = color; | |
| 96 | + map.addOverlay(polyline); | |
| 97 | + | |
| 98 | + polyline.addEventListener('mouseover', function(){ | |
| 99 | + this.setStrokeColor('#20bd26'); | |
| 100 | + }); | |
| 101 | + polyline.addEventListener('mouseout', function(){ | |
| 102 | + if(this!=road_win_show_p) | |
| 103 | + this.setStrokeColor(color); | |
| 104 | + }); | |
| 105 | + polyline.addEventListener('click', function(e){ | |
| 106 | + if(map_status!=1) | |
| 107 | + openRoadInfoWin(this, e.point); | |
| 108 | + }); | |
| 109 | + _pLines.push(polyline); | |
| 110 | + }); | |
| 111 | + | |
| 112 | + roadPolylines.push(_pLines); | |
| 113 | + }; | |
| 114 | + | |
| 115 | + var road_win_show_p; | |
| 116 | + function openRoadInfoWin(p, point) { | |
| 117 | + var data = p.ct_data; | |
| 118 | + var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data)); | |
| 119 | + | |
| 120 | + //close event | |
| 121 | + win.addEventListener('close', function (e) { | |
| 122 | + p.setStrokeColor(p.ct_data.oldColor); | |
| 123 | + gb_road_route.clearFocus(); | |
| 124 | + road_win_show_p = null; | |
| 125 | + }); | |
| 126 | + //open event | |
| 127 | + win.addEventListener('open', function (e) { | |
| 128 | + gb_road_route.focus(data); | |
| 129 | + p.setStrokeColor('#20bd26'); | |
| 130 | + road_win_show_p = p; | |
| 131 | + }); | |
| 132 | + | |
| 133 | + map.openInfoWindow(win, point); | |
| 134 | + } | |
| 135 | + | |
| 136 | + function createStationMark(statio) { | |
| 137 | + var point = new BMap.Point(statio.bd_lon, statio.bd_lat); | |
| 138 | + var marker = new BMap.Marker(point); | |
| 139 | + | |
| 140 | + //根据站点名称 计算marker 宽度 | |
| 141 | + var w = statio.stationName.length * 12 + 38 | |
| 142 | + ,iw=w-2; | |
| 143 | + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)}) | |
| 144 | + marker.setIcon(icon); | |
| 145 | + marker.setShadow(null); | |
| 146 | + //信息窗口 | |
| 147 | + //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)}); | |
| 148 | + //infoWin.ct_data = statio;//绑定数据 | |
| 149 | + //marker.infoWin = infoWin; | |
| 150 | + marker.addEventListener('click', function(){ | |
| 151 | + if(map_status!=1) | |
| 152 | + openStationInfoWin(this); | |
| 153 | + //map.openInfoWindow(this.infoWin, this.point); | |
| 154 | + }); | |
| 155 | + //close event | |
| 156 | + /*infoWin.addEventListener('close', function (e) { | |
| 157 | + //if(map_status!=1) | |
| 158 | + gb_station_route.clearFocus(); | |
| 159 | + }); | |
| 160 | + //open event | |
| 161 | + infoWin.addEventListener('open', function (e) { | |
| 162 | + gb_station_route.focus(this.ct_data); | |
| 163 | + });*/ | |
| 164 | + | |
| 165 | + //mouseover | |
| 166 | + marker.addEventListener('mouseover', function(){ | |
| 167 | + setTop(this); | |
| 168 | + }); | |
| 169 | + return marker; | |
| 170 | + } | |
| 171 | + | |
| 172 | + var openStationInfoWin = function (m) { | |
| 173 | + //ct_data | |
| 174 | + var win=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0,-13)}); | |
| 175 | + //close event | |
| 176 | + win.addEventListener('close', function (e) { | |
| 177 | + gb_station_route.clearFocus(); | |
| 178 | + }); | |
| 179 | + //open event | |
| 180 | + win.addEventListener('open', function (e) { | |
| 181 | + gb_station_route.focus(m.ct_data); | |
| 182 | + }); | |
| 183 | + | |
| 184 | + map.openInfoWindow(win, m.point); | |
| 185 | + }; | |
| 186 | + | |
| 187 | + //绘制站点icon | |
| 188 | + function createStationIcon(station, w) { | |
| 189 | + var canvas = $('<canvas></canvas>')[0]; | |
| 190 | + var ctx = canvas.getContext('2d'); | |
| 191 | + | |
| 192 | + var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c'; | |
| 193 | + //矩形 | |
| 194 | + //ctx.roundRect(0, 0, w, 17, 1).stroke(); | |
| 195 | + ctx.lineWidth="3"; | |
| 196 | + ctx.rect(0, 0, w - 2, 19); | |
| 197 | + ctx.fillStyle = '#fff'; | |
| 198 | + ctx.fill(); | |
| 199 | + ctx.strokeStyle = bg; | |
| 200 | + ctx.stroke(); | |
| 201 | + ctx.lineWidth="1"; | |
| 202 | + | |
| 203 | + //文字 | |
| 204 | + ctx.font = "12px arial"; | |
| 205 | + ctx.fillStyle = '#000'; | |
| 206 | + ctx.fillText(station.stationName, 27, 14); | |
| 207 | + | |
| 208 | + //序号 | |
| 209 | + ctx.beginPath(); | |
| 210 | + ctx.rect(0, 0, 20, 19); | |
| 211 | + ctx.fillStyle = bg; | |
| 212 | + ctx.fill(); | |
| 213 | + | |
| 214 | + ctx.font = "12px arial"; | |
| 215 | + ctx.fillStyle = '#fff'; | |
| 216 | + var i = station.index + 1; | |
| 217 | + var left = (i + '').length > 1?3:7; | |
| 218 | + ctx.fillText(i, left, 14); | |
| 219 | + | |
| 220 | + //角 | |
| 221 | + var c = w / 2; | |
| 222 | + ctx.beginPath(); | |
| 223 | + ctx.moveTo(c - 7, 16); | |
| 224 | + ctx.lineTo(c, 24); | |
| 225 | + ctx.lineTo(c + 7, 16); | |
| 226 | + ctx.closePath(); | |
| 227 | + | |
| 228 | + ctx.fillStyle = bg; | |
| 229 | + ctx.fill(); | |
| 230 | + ctx.strokeStyle = '#fff'; | |
| 231 | + ctx.stroke(); | |
| 232 | + return canvas.toDataURL(); | |
| 233 | + } | |
| 234 | + | |
| 235 | + var changeUpDown = function () { | |
| 236 | + var upDown = getUpDown(); | |
| 237 | + $.each(roadPolylines[upDown==0?1:0], function () { | |
| 238 | + this.hide(); | |
| 239 | + }); | |
| 240 | + $.each(roadPolylines[upDown], function () { | |
| 241 | + this.show(); | |
| 242 | + }); | |
| 243 | + | |
| 244 | + | |
| 245 | + $.each(stationMarkers[upDown==0?1:0], function () { | |
| 246 | + this.hide(); | |
| 247 | + }); | |
| 248 | + $.each(stationMarkers[upDown], function () { | |
| 249 | + this.show(); | |
| 250 | + }); | |
| 251 | + }; | |
| 252 | + | |
| 253 | + /** | |
| 254 | + * 定位到站点 | |
| 255 | + * @param code | |
| 256 | + */ | |
| 257 | + var focusStation = function (code, updown) { | |
| 258 | + var marker = getStationMarker(code, updown); | |
| 259 | + if(marker){ | |
| 260 | + openStationInfoWin(marker); | |
| 261 | + } | |
| 262 | + }; | |
| 263 | + | |
| 264 | + var getStationMarker = function (code, updown) { | |
| 265 | + var array = stationMarkers[updown], | |
| 266 | + marker; | |
| 267 | + for(var i=0,m;m=array[i++];){ | |
| 268 | + if(m.stationCode==code){ | |
| 269 | + marker = m; | |
| 270 | + break; | |
| 271 | + } | |
| 272 | + } | |
| 273 | + return marker; | |
| 274 | + } | |
| 275 | + | |
| 276 | + /** | |
| 277 | + * 定位到路段 | |
| 278 | + * @param code | |
| 279 | + * @param updown | |
| 280 | + */ | |
| 281 | + var focusRoad = function (code, updown) { | |
| 282 | + var array = roadPolylines[updown], | |
| 283 | + polyline; | |
| 284 | + for(var i=0,p;p=array[i++];){ | |
| 285 | + if(p.ct_data.sectionCode==code){ | |
| 286 | + polyline = p; | |
| 287 | + break; | |
| 288 | + } | |
| 289 | + } | |
| 290 | + | |
| 291 | + var cp = calcCenterPoint(p.ct_data.bdCoords); | |
| 292 | + openRoadInfoWin(p, new BMap.Point(cp.longitude, cp.latitude)); | |
| 293 | + } | |
| 294 | + | |
| 295 | + var calcCenterPoint = function (coords) { | |
| 296 | + var array = [], strs; | |
| 297 | + for(var i=0,item;item=coords[i++];){ | |
| 298 | + strs = item.split(' '); | |
| 299 | + array.push({latitude: strs[1], longitude: strs[0]}); | |
| 300 | + } | |
| 301 | + | |
| 302 | + return geolib.getCenter(array); | |
| 303 | + } | |
| 304 | + | |
| 305 | + var exitEditBufferStatus = function (s) { | |
| 306 | + map_status = 0; | |
| 307 | + enabledOtherElem(); | |
| 308 | + gb_station_route.hideEditPanel(); | |
| 309 | + | |
| 310 | + map.removeOverlay(editCircle); | |
| 311 | + | |
| 312 | + openStationInfoWin(getStationMarker(s.stationCode, s.directions)); | |
| 313 | + }; | |
| 314 | + | |
| 315 | + /** | |
| 316 | + * 编辑站点缓冲区 | |
| 317 | + * @param station | |
| 318 | + */ | |
| 319 | + var editStationBuffer = function (s) { | |
| 320 | + map_status = 1; | |
| 321 | + map.closeInfoWindow();//关闭infoWindow | |
| 322 | + gb_station_route.clearFocus(); | |
| 323 | + gb_station_route.focus(s); | |
| 324 | + clearOldOverlay(); | |
| 325 | + disabledOtherElem(); | |
| 326 | + gb_station_route.showEditPanel(s); | |
| 327 | + | |
| 328 | + var marker = getStationMarker(s.stationCode, s.directions); | |
| 329 | + map.centerAndZoom(marker.point, 18); | |
| 330 | + var bElem = openBufferOverlay(marker); | |
| 331 | + | |
| 332 | + if(s.shapesType=='r'){ | |
| 333 | + //lineupdate | |
| 334 | + bElem.addEventListener('lineupdate', function (e) { | |
| 335 | + //console.log('lineupdatelineupdate', e); | |
| 336 | + //var ec = e.target; | |
| 337 | + //var radius = ec.getRadius().toFixed(2); | |
| 338 | + //console.log('getRadius', ec.getRadius(), radius); | |
| 339 | + gb_station_route.reWriteEditPanel(e.target); | |
| 340 | + }); | |
| 341 | + } | |
| 342 | + }; | |
| 343 | + | |
| 344 | + var clearOldOverlay = function () { | |
| 345 | + map.removeOverlay(editCircle); | |
| 346 | + map.removeOverlay(editPolygon); | |
| 347 | + } | |
| 348 | + | |
| 349 | + /** | |
| 350 | + * 禁用其他元素 | |
| 351 | + */ | |
| 352 | + var disabledOtherElem = function () { | |
| 353 | + $('.main_left_panel_m_layer').show(); | |
| 354 | + } | |
| 355 | + | |
| 356 | + var enabledOtherElem = function () { | |
| 357 | + $('.main_left_panel_m_layer').hide(); | |
| 358 | + } | |
| 359 | + | |
| 360 | + var openBufferOverlay = function (m) { | |
| 361 | + var elem; | |
| 362 | + var data = m.ct_data; | |
| 363 | + if(data.shapesType=='r'){ | |
| 364 | + var circle = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/}); | |
| 365 | + map.addOverlay(circle); | |
| 366 | + circle.enableEditing(); | |
| 367 | + } | |
| 368 | + editCircle = circle; | |
| 369 | + return circle; | |
| 370 | + }; | |
| 371 | + | |
| 372 | + /** | |
| 373 | + * 更新站点 | |
| 374 | + * @param s | |
| 375 | + */ | |
| 376 | + function updateStation(s) { | |
| 377 | + var m = getStationMarker(s.stationCode, s.directions); | |
| 378 | + //更新位置 | |
| 379 | + transCoord(s); | |
| 380 | + m.ct_data = s; | |
| 381 | + m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat)); | |
| 382 | + } | |
| 383 | + | |
| 384 | + var topOverlay; | |
| 385 | + function setTop(overlay){ | |
| 386 | + if(topOverlay) | |
| 387 | + topOverlay.setTop(false); | |
| 388 | + overlay.setTop(true); | |
| 389 | + topOverlay = overlay; | |
| 390 | + } | |
| 391 | + | |
| 392 | + /** | |
| 393 | + * 切换缓冲区类型 | |
| 394 | + * @param v | |
| 395 | + */ | |
| 396 | + var _drawingManager; | |
| 397 | + var changeShapeType = function (v) { | |
| 398 | + if(v == 'd'){ | |
| 399 | + map.removeOverlay(editCircle); | |
| 400 | + | |
| 401 | + _drawingManager = new BMapLib.DrawingManager(map,{}); | |
| 402 | + _drawingManager.open(); | |
| 403 | + _drawingManager.setDrawingMode('polygon'); | |
| 404 | + | |
| 405 | + //绘制结束事件 | |
| 406 | + _drawingManager.addEventListener('polygoncomplete', function (e) { | |
| 407 | + console.log('end ', e); | |
| 408 | + gb_station_route.drawEnd(); | |
| 409 | + }); | |
| 410 | + } | |
| 411 | + }; | |
| 412 | + | |
| 413 | + var exitDrawStatus = function () { | |
| 414 | + if(_drawingManager) | |
| 415 | + _drawingManager.close(); | |
| 416 | + }; | |
| 417 | + | |
| 418 | + var openDrawStatus = function () { | |
| 419 | + if(_drawingManager) | |
| 420 | + _drawingManager.open(); | |
| 421 | + }; | |
| 422 | + res_load_ep.emitLater('load_map'); | |
| 423 | + return { | |
| 424 | + _render: _render, | |
| 425 | + changeUpDown:changeUpDown, | |
| 426 | + focusStation: focusStation, | |
| 427 | + focusRoad: focusRoad, | |
| 428 | + editStationBuffer: editStationBuffer, | |
| 429 | + updateStation: updateStation, | |
| 430 | + exitEditBufferStatus: exitEditBufferStatus, | |
| 431 | + changeShapeType: changeShapeType, | |
| 432 | + exitDrawStatus: exitDrawStatus, | |
| 433 | + openDrawStatus: openDrawStatus | |
| 434 | + }; | |
| 435 | +}(); | |
| 0 | 436 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
0 → 100644
| 1 | +<!-- 路段路由 --> | |
| 2 | +var gb_road_route = function () { | |
| 3 | + | |
| 4 | + var temps; | |
| 5 | + var road_maps; | |
| 6 | + //绘制线路路由 | |
| 7 | + var init = function (cb) { | |
| 8 | + var lineCode = storage.getItem("geo_data_edit_line_code"); | |
| 9 | + | |
| 10 | + var ep = EventProxy.create("data", "temp", function (data, temp) { | |
| 11 | + road_maps = data; | |
| 12 | + temps = temp; | |
| 13 | + console.log('roads', road_maps); | |
| 14 | + | |
| 15 | + //按顺序,名称分组 | |
| 16 | + var ups = _group(road_maps[0]); | |
| 17 | + var downs = _group(road_maps[1]); | |
| 18 | + console.log('upsupsups', ups, 'downsdownsdowns', downs); | |
| 19 | + //渲染 | |
| 20 | + var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups}); | |
| 21 | + $('.up_down_route_list>li:first>.road_route').html(upHtmlStr); | |
| 22 | + var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs}); | |
| 23 | + $('.up_down_route_list>li:last>.road_route').html(downHtmlStr); | |
| 24 | + | |
| 25 | + cb && cb(); | |
| 26 | + }); | |
| 27 | + | |
| 28 | + //加载数据 | |
| 29 | + gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode}, function (rs) { | |
| 30 | + rs.list.sort(function (a, b) { | |
| 31 | + return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode); | |
| 32 | + }); | |
| 33 | + ep.emit('data', gb_common.groupBy(rs.list, 'directions')); | |
| 34 | + }); | |
| 35 | + | |
| 36 | + //加载模板片段 | |
| 37 | + $.get('/pages/base/geo_data_edit/fragments/f_road_route.html', function (dom) { | |
| 38 | + ep.emit('temp', gb_common.compileTempByDom(dom, { | |
| 39 | + compress: true | |
| 40 | + })); | |
| 41 | + }); | |
| 42 | + }; | |
| 43 | + | |
| 44 | + //路段单击 | |
| 45 | + $('.up_down_route_list>li>.road_route').on('click', 'a[data-code]', function () { | |
| 46 | + var code = $(this).data('code'), | |
| 47 | + updown = $(this).data('updown'); | |
| 48 | + | |
| 49 | + clearFocus(); | |
| 50 | + gb_ct_map.focusRoad(code, updown); | |
| 51 | + }); | |
| 52 | + | |
| 53 | + var _group = function (list) { | |
| 54 | + var rs = [], tempArr = []; | |
| 55 | + | |
| 56 | + var name; | |
| 57 | + for (var i = 0, obj; obj = list[i++];) { | |
| 58 | + if (name && name != obj.sectionName) { | |
| 59 | + rs.push(tempArr); | |
| 60 | + tempArr = []; | |
| 61 | + } | |
| 62 | + tempArr.push(obj); | |
| 63 | + name = obj.sectionName | |
| 64 | + } | |
| 65 | + return rs; | |
| 66 | + }; | |
| 67 | + | |
| 68 | + var clearFocus = function () { | |
| 69 | + $('.up_down_route_list>li>.road_route li.ct_active').removeClass('ct_active'); | |
| 70 | + }; | |
| 71 | + | |
| 72 | + var focus = function (data) { | |
| 73 | + //sectionCode | |
| 74 | + var elem = $('.up_down_route_list>li>.road_route .road_li_' + data.sectionCode); | |
| 75 | + elem.addClass('ct_active'); | |
| 76 | + | |
| 77 | + if (!isShow(elem)) { | |
| 78 | + //定位滚动条 | |
| 79 | + var cont = $('.up_down_route_list'), | |
| 80 | + diff = cont.height() / 2; | |
| 81 | + cont.animate({ | |
| 82 | + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff | |
| 83 | + }, 500); | |
| 84 | + } | |
| 85 | + }; | |
| 86 | + | |
| 87 | + var isShow = function (elem) { | |
| 88 | + var wrap = $('.up_down_route_list'); | |
| 89 | + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; | |
| 90 | + }; | |
| 91 | + | |
| 92 | + res_load_ep.emitLater('load_road_route'); | |
| 93 | + return { | |
| 94 | + init: init, getData: function () { | |
| 95 | + return road_maps; | |
| 96 | + }, | |
| 97 | + getTemps: function () { | |
| 98 | + return temps; | |
| 99 | + }, | |
| 100 | + clearFocus: clearFocus, | |
| 101 | + focus: focus | |
| 102 | + }; | |
| 103 | +}(); | |
| 0 | 104 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
0 → 100644
| 1 | +<!-- 站点路由 --> | |
| 2 | +var gb_station_route = function () { | |
| 3 | + | |
| 4 | + var temps; | |
| 5 | + var station_maps; | |
| 6 | + //绘制线路路由 | |
| 7 | + var init = function (cb) { | |
| 8 | + var lineCode = storage.getItem("geo_data_edit_line_code"); | |
| 9 | + | |
| 10 | + var ep = EventProxy.create("data", "temp", function (data, temp) { | |
| 11 | + station_maps = data; | |
| 12 | + temps = temp; | |
| 13 | + console.log('station', station_maps); | |
| 14 | + //渲染页面 | |
| 15 | + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]}); | |
| 16 | + $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); | |
| 17 | + var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]}); | |
| 18 | + $('.up_down_route_list>li:last>.station_route').html(downHtmlStr); | |
| 19 | + | |
| 20 | + cb && cb(); | |
| 21 | + }); | |
| 22 | + | |
| 23 | + //加载数据 | |
| 24 | + gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) { | |
| 25 | + rs.list.sort(function (a, b) { | |
| 26 | + return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode); | |
| 27 | + }); | |
| 28 | + ep.emit('data', gb_common.groupBy(rs.list, 'directions')); | |
| 29 | + }); | |
| 30 | + | |
| 31 | + //加载模板片段 | |
| 32 | + $.get('/pages/base/geo_data_edit/fragments/f_station_route.html', function (dom) { | |
| 33 | + ep.emit('temp', gb_common.compileTempByDom(dom, { | |
| 34 | + compress: true | |
| 35 | + })); | |
| 36 | + }); | |
| 37 | + }; | |
| 38 | + | |
| 39 | + //站点单击 | |
| 40 | + $('.up_down_route_list>li>.station_route').on('click', 'a[data-code]', function () { | |
| 41 | + var code = $(this).data('code'), | |
| 42 | + updown = $(this).data('updown'); | |
| 43 | + | |
| 44 | + clearFocus(); | |
| 45 | + gb_ct_map.focusStation(code, updown); | |
| 46 | + }); | |
| 47 | + | |
| 48 | + var clearFocus = function () { | |
| 49 | + $('.up_down_route_list>li>.station_route li.ct_active').removeClass('ct_active'); | |
| 50 | + }; | |
| 51 | + | |
| 52 | + var focus = function (s) { | |
| 53 | + var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode); | |
| 54 | + elem.addClass('ct_active'); | |
| 55 | + | |
| 56 | + if (!isShow(elem)) { | |
| 57 | + //定位滚动条 | |
| 58 | + var cont = $('.up_down_route_list'), | |
| 59 | + diff = cont.height() / 2; | |
| 60 | + cont.animate({ | |
| 61 | + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff | |
| 62 | + }, 500); | |
| 63 | + } | |
| 64 | + }; | |
| 65 | + | |
| 66 | + var isShow = function (elem) { | |
| 67 | + var wrap = $('.up_down_route_list'); | |
| 68 | + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; | |
| 69 | + }; | |
| 70 | + | |
| 71 | + var getStation = function (code, updown) { | |
| 72 | + var array = station_maps[updown]; | |
| 73 | + for(var i=0,s;s=array[i++];){ | |
| 74 | + if(s.stationCode==code) | |
| 75 | + return s; | |
| 76 | + } | |
| 77 | + return null; | |
| 78 | + }; | |
| 79 | + | |
| 80 | + var callbackHandler = { | |
| 81 | + edit_buffer: function (station) { | |
| 82 | + //编辑缓冲区 | |
| 83 | + gb_ct_map.editStationBuffer(station); | |
| 84 | + } | |
| 85 | + }; | |
| 86 | + | |
| 87 | + $.contextMenu({ | |
| 88 | + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li', | |
| 89 | + className: 'station-route-ct-menu', | |
| 90 | + callback: function (key, options) { | |
| 91 | + var aLink = options.$trigger.find('a[data-code]'); | |
| 92 | + var code = aLink.data('code'), | |
| 93 | + updown = aLink.data('updown'); | |
| 94 | + var station = getStation(code, updown); | |
| 95 | + callbackHandler[key] && callbackHandler[key](station); | |
| 96 | + }, | |
| 97 | + items: { | |
| 98 | + 'edit_buffer': { | |
| 99 | + name: '编辑缓冲区' | |
| 100 | + }, | |
| 101 | + 'sep1': '---------', | |
| 102 | + 'edit': { | |
| 103 | + name: '编辑基础信息' | |
| 104 | + }, | |
| 105 | + 'insert_before': { | |
| 106 | + name: '新增站点(前)' | |
| 107 | + }, | |
| 108 | + 'insert_after': { | |
| 109 | + name: '新增站点(后)' | |
| 110 | + } | |
| 111 | + } | |
| 112 | + }); | |
| 113 | + | |
| 114 | + var showEditPanel = function (s) { | |
| 115 | + var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); | |
| 116 | + $('.ct_page').append(htmlStr); | |
| 117 | + $('.buffer_edit_panel').show(); | |
| 118 | + }; | |
| 119 | + | |
| 120 | + var hideEditPanel = function () { | |
| 121 | + $('.buffer_edit_panel').remove(); | |
| 122 | + }; | |
| 123 | + | |
| 124 | + var edPanelRunFlag; | |
| 125 | + var ecObj; | |
| 126 | + var reWriteEditPanel = function (ec) { | |
| 127 | + if(edPanelRunFlag){ | |
| 128 | + ecObj = ec; | |
| 129 | + return; | |
| 130 | + } | |
| 131 | + | |
| 132 | + edPanelRunFlag = true; | |
| 133 | + setTimeout(function () { | |
| 134 | + var panel = $('.buffer_edit_panel'); | |
| 135 | + $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径 | |
| 136 | + | |
| 137 | + var p = ecObj.getCenter(); | |
| 138 | + $('[name=gLaty]', panel).val(p.lat); | |
| 139 | + $('[name=gLonx]', panel).val(p.lng); | |
| 140 | + edPanelRunFlag = false; | |
| 141 | + }, 170); | |
| 142 | + }; | |
| 143 | + | |
| 144 | + var update = function (s) { | |
| 145 | + var array = station_maps[s.directions]; | |
| 146 | + for(var i=0,item; item=array[i++];){ | |
| 147 | + if(item.stationCode==s.stationCode){ | |
| 148 | + s.index = i; | |
| 149 | + array.splice(i, 1, s); | |
| 150 | + break; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + }; | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 缓冲区编辑 取消 | |
| 157 | + */ | |
| 158 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.cancel', function (e) { | |
| 159 | + var f = $(this).parents('form'); | |
| 160 | + var data = f.serializeJSON(); | |
| 161 | + | |
| 162 | + gb_ct_map.exitEditBufferStatus(data); | |
| 163 | + }); | |
| 164 | + | |
| 165 | + /** | |
| 166 | + * 缓冲区编辑 切换缓冲区类型(圆形,多边形) | |
| 167 | + */ | |
| 168 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body select[name=shapesType]', function (e) { | |
| 169 | + var v = $(this).val(); | |
| 170 | + | |
| 171 | + gb_ct_map.changeShapeType(v); | |
| 172 | + if(v=='d'){ | |
| 173 | + $('.buffer_edit_panel .shapes_type').addClass('st_d'); | |
| 174 | + | |
| 175 | + | |
| 176 | + // | |
| 177 | + //UIkit.notification("使用鼠标在地图上绘制多边形,可点击上发“暂停绘制”链接,退出绘制模式,以拖拽地图", {status: 'primary', pos: 'bottom-center'}) | |
| 178 | + } | |
| 179 | + else{ | |
| 180 | + $('.buffer_edit_panel .shapes_type').removeClass('st_d'); | |
| 181 | + } | |
| 182 | + }); | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * 缓冲区编辑 切换绘制模式 | |
| 186 | + */ | |
| 187 | + var drawPolygonSwitch = '.buffer_edit_panel>.buffer_edit_body .draw_polygon_switch'; | |
| 188 | + $(document).on('click', drawPolygonSwitch, function (e) { | |
| 189 | + var type = $(this).data('type'); | |
| 190 | + if(type==1){ | |
| 191 | + //退出绘制状态 | |
| 192 | + gb_ct_map.exitDrawStatus(); | |
| 193 | + $(this).data('type', 0).find('a').text('开始绘制'); | |
| 194 | + } | |
| 195 | + else if(type==0 || type==2){ | |
| 196 | + gb_ct_map.openDrawStatus(); | |
| 197 | + $(this).data('type', 1).find('a').text('暂停绘制'); | |
| 198 | + } | |
| 199 | + }); | |
| 200 | + | |
| 201 | + /** | |
| 202 | + * 绘制结束 | |
| 203 | + */ | |
| 204 | + var drawEnd = function () { | |
| 205 | + $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); | |
| 206 | + }; | |
| 207 | + | |
| 208 | + | |
| 209 | + res_load_ep.emitLater('load_station_route'); | |
| 210 | + return { | |
| 211 | + init: init, | |
| 212 | + getData: function () { | |
| 213 | + return station_maps; | |
| 214 | + }, | |
| 215 | + getTemps: function () { | |
| 216 | + return temps; | |
| 217 | + }, | |
| 218 | + clearFocus: clearFocus, | |
| 219 | + focus: focus, | |
| 220 | + showEditPanel: showEditPanel, | |
| 221 | + hideEditPanel: hideEditPanel, | |
| 222 | + reWriteEditPanel: reWriteEditPanel, | |
| 223 | + update: update, | |
| 224 | + drawEnd: drawEnd | |
| 225 | + }; | |
| 226 | +}(); | |
| 0 | 227 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
0 → 100644
| 1 | +/** | |
| 2 | + * 事件代理,提交数据 | |
| 3 | + */ | |
| 4 | +var gb_data_submit = function () { | |
| 5 | + | |
| 6 | + /** | |
| 7 | + * 缓冲区编辑提交 | |
| 8 | + */ | |
| 9 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.submit', function (e) { | |
| 10 | + var f = $(this).parents('form'); | |
| 11 | + var data = f.serializeJSON(); | |
| 12 | + UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() { | |
| 13 | + | |
| 14 | + //console.log('aaa',f, f.serializeJSON()); | |
| 15 | + show_run_text('正在提交缓冲区信息'); | |
| 16 | + gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { | |
| 17 | + hide_run_text(); | |
| 18 | + UIkit.notification("提交成功!", {status: 'success'}); | |
| 19 | + | |
| 20 | + //更新前端数据 | |
| 21 | + gb_station_route.update(rs.station); | |
| 22 | + gb_ct_map.updateStation(rs.station); | |
| 23 | + | |
| 24 | + //退出编辑模式 | |
| 25 | + gb_ct_map.exitEditBufferStatus(rs.station); | |
| 26 | + }); | |
| 27 | + }, function () { | |
| 28 | + console.log('Rejected.') | |
| 29 | + }); | |
| 30 | + return false; | |
| 31 | + }); | |
| 32 | + | |
| 33 | + var show_run_text = function (t) { | |
| 34 | + $('.text', $loadPanel).text(t); | |
| 35 | + $loadPanel.show(); | |
| 36 | + }; | |
| 37 | + | |
| 38 | + var hide_run_text = function () { | |
| 39 | + $('.text', $loadPanel).text(''); | |
| 40 | + $loadPanel.hide(); | |
| 41 | + }; | |
| 42 | + return {}; | |
| 43 | +}(); | |
| 0 | 44 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/js/version_manage.js
0 → 100644
src/main/resources/static/pages/base/geo_data_edit/main.html
| ... | ... | @@ -5,82 +5,70 @@ |
| 5 | 5 | <meta charset="UTF-8"> |
| 6 | 6 | <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> |
| 7 | 7 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" /> |
| 8 | - <!-- flatpickr --> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css"> | |
| 10 | - <!-- tooltip css--> | |
| 11 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" /> | |
| 12 | - <link rel="stylesheet" href="/real_control_v2/css/pace.css" /> | |
| 13 | - <style> | |
| 14 | - /* ^_^ baidu map hide logo */ | |
| 15 | - .anchorBL, .anchorBL, .amap-logo, .amap-copyright { | |
| 16 | - display: none; | |
| 17 | - } | |
| 18 | - | |
| 19 | - html,body{ | |
| 20 | - height: 100%; | |
| 21 | - } | |
| 22 | - .ct_page{ | |
| 23 | - padding: 0; | |
| 24 | - height: 100%; | |
| 25 | - } | |
| 26 | - | |
| 27 | - div#map_wrap{ | |
| 28 | - height: 100%; | |
| 29 | - } | |
| 30 | - | |
| 31 | - .main_left_panel{ | |
| 32 | - position: absolute; | |
| 33 | - z-index: 999; | |
| 34 | - height: calc(100% - 20px); | |
| 35 | - width: 300px; | |
| 36 | - background: #fffffff5; | |
| 37 | - top: 7px; | |
| 38 | - left: 5px; | |
| 39 | - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 40 | - } | |
| 41 | - .main_lt_search_panel{ | |
| 42 | - position: absolute; | |
| 43 | - z-index: 99; | |
| 44 | - top: 10px; | |
| 45 | - left: 330px; | |
| 46 | - background: #fffffff5; | |
| 47 | - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | |
| 48 | - } | |
| 49 | - .main_rt_tools_panel{ | |
| 50 | - position: absolute; | |
| 51 | - z-index: 99; | |
| 52 | - top: 7px; | |
| 53 | - right: 7px; | |
| 54 | - background: #ffffff; | |
| 55 | - box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48); | |
| 56 | - padding: 0 12px; | |
| 57 | - text-align: center; | |
| 58 | - border-radius: 7px; | |
| 59 | - height: 28px; | |
| 60 | - } | |
| 61 | - | |
| 62 | - .main_rt_tools_panel>._icon{ | |
| 63 | - margin: 0 9px; | |
| 64 | - } | |
| 65 | - .search_input{ | |
| 66 | - width: 250px; | |
| 67 | - height: 42px; | |
| 68 | - } | |
| 69 | - | |
| 70 | - .search_input::placeholder{ | |
| 71 | - color: grey; | |
| 72 | - font-size: 12px; | |
| 73 | - } | |
| 74 | - </style> | |
| 8 | + <!-- jquery contextMenu style --> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" /> | |
| 10 | + <link rel="stylesheet" | |
| 11 | + href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" | |
| 12 | + type="text/css" /> | |
| 13 | + <!-- main css --> | |
| 14 | + <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" /> | |
| 75 | 15 | </head> |
| 76 | 16 | |
| 77 | 17 | <body> |
| 18 | +<div class="loading"> | |
| 19 | + <div><span uk-spinner></span><span class="text">正在加载...</span></div> | |
| 20 | +</div> | |
| 78 | 21 | <div class="ct_page" > |
| 79 | - <div id="map_wrap"> | |
| 80 | - </div> | |
| 22 | + <div id="map_wrap"></div> | |
| 23 | + <div class="main_left_panel_m_layer"></div> | |
| 81 | 24 | <div class="main_left_panel"> |
| 82 | 25 | <div class="_line_info"> |
| 26 | + <div class="_line_name"> | |
| 27 | + 961路 | |
| 28 | + <a uk-icon="icon: plus" class="add_line_version_icon" title="添加一个新的线路版本" uk-tooltip></a> | |
| 29 | + </div> | |
| 30 | + <div class="_version_dropdown_wrap"> | |
| 31 | + <a class="_version_text">原始版本 <i uk-icon="icon: chevron-down;ratio:.6"></i></a> | |
| 32 | + <div uk-dropdown> | |
| 33 | + <ul class="uk-nav uk-dropdown-nav"> | |
| 34 | + <li class="uk-nav-header">历史</li> | |
| 35 | + <li><a>原始版本</a></li> | |
| 36 | + <li class="uk-nav-divider"></li> | |
| 37 | + <li class="uk-nav-header">启用</li> | |
| 38 | + <li class="uk-active"><a>20171206线路改道</a></li> | |
| 39 | + <li class="uk-nav-header">未来</li> | |
| 40 | + <li><a>20180206线路改道</a></li> | |
| 41 | + </ul> | |
| 42 | + </div> | |
| 43 | + </div> | |
| 44 | + <span class="clock_enable_version"> | |
| 45 | + <a uk-icon="icon: clock;ratio: .7" class=""></a> 25:30:20 启用(20180206线路改道) | |
| 46 | + </span> | |
| 47 | + </div> | |
| 48 | + | |
| 49 | + <div class="_route_info_wrap"> | |
| 50 | + <ul uk-tab> | |
| 51 | + <li><a>上行</a></li> | |
| 52 | + <li><a>下行</a></li> | |
| 83 | 53 | |
| 54 | + <span class="rt_show_version_txt uk-badge uk-disabled"> | |
| 55 | + 20180206线路改道 | |
| 56 | + </span> | |
| 57 | + </ul> | |
| 58 | + | |
| 59 | + <ul class="uk-switcher uk-margin up_down_route_list"> | |
| 60 | + <li> | |
| 61 | + <div class="station_route"></div> | |
| 62 | + <div class="road_route"></div> | |
| 63 | + </li> | |
| 64 | + <li> | |
| 65 | + <div class="station_route"></div> | |
| 66 | + <div class="road_route"></div> | |
| 67 | + </li> | |
| 68 | + </ul> | |
| 69 | + <div class="pos_tb_icon"> | |
| 70 | + <a uk-icon="icon: chevron-down;"></a> | |
| 71 | + </div> | |
| 84 | 72 | </div> |
| 85 | 73 | </div> |
| 86 | 74 | <div class="main_lt_search_panel"> |
| ... | ... | @@ -91,7 +79,7 @@ |
| 91 | 79 | </div> |
| 92 | 80 | <div class="main_rt_tools_panel"> |
| 93 | 81 | <a uk-icon="icon: info;ratio: .9" class="_icon"></a> |
| 94 | - <a uk-icon="icon: expand;ratio: .9" class="_icon"></a> | |
| 82 | + <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a> | |
| 95 | 83 | </div> |
| 96 | 84 | </div> |
| 97 | 85 | <!-- 百度 --> |
| ... | ... | @@ -107,33 +95,87 @@ |
| 107 | 95 | <script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> |
| 108 | 96 | <!-- jquery.serializejson JSON序列化插件 --> |
| 109 | 97 | <script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> |
| 110 | -<!-- flatpickr --> | |
| 111 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script> | |
| 112 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script> | |
| 113 | -<!-- qtip --> | |
| 114 | -<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" ></script> | |
| 98 | +<!-- common js --> | |
| 99 | +<script src="/real_control_v2/js/common.js"></script> | |
| 100 | +<script src="/assets/js/TransGPS.js" ></script> | |
| 101 | +<!-- Geolib --> | |
| 102 | +<script src="/real_control_v2/geolib/geolib.js" ></script> | |
| 103 | +<!-- jquery contextMenu --> | |
| 104 | +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" ></script> | |
| 115 | 105 | <script> |
| 106 | + var $loadPanel = $('body>.loading'); | |
| 107 | + //___________________________________ | |
| 108 | + var storage = window.localStorage; | |
| 109 | + storage.setItem("geo_data_edit_line_code" , "70123"); | |
| 110 | + //___________________________________ | |
| 111 | + | |
| 116 | 112 | top.document.title = "绘制线路"; |
| 117 | 113 | // 关闭左侧栏 |
| 118 | 114 | if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();} |
| 115 | + //全屏 | |
| 116 | + $('.full_screen_icon').on('click', function () { | |
| 117 | + window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); | |
| 118 | + }); | |
| 119 | + | |
| 120 | + var gb_main_ep = new EventProxy() | |
| 121 | + //文件加载 | |
| 122 | + var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' | |
| 123 | + , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { | |
| 124 | + | |
| 125 | + //UIkit.notification('加载完成!!'); | |
| 126 | + var eq = gb_main_ep; | |
| 119 | 127 | |
| 120 | - //初始化地图 | |
| 121 | - if(!window.BMap){ | |
| 122 | - alert('地图没有加载成功,请确认是否能正常连接外网!!'); | |
| 128 | + //站点 | |
| 129 | + gb_station_route.init(g_emit('init_road')); | |
| 130 | + //路段 | |
| 131 | + eq.once('init_road', function () { | |
| 132 | + gb_road_route.init(g_emit('init_map')) | |
| 133 | + }) | |
| 134 | + //地图 | |
| 135 | + eq.once('init_map', function () { | |
| 136 | + gb_ct_map._render(g_emit('end')); | |
| 137 | + }); | |
| 138 | + | |
| 139 | + eq.once('end', function () { | |
| 140 | + $loadPanel.hide(); | |
| 141 | + }); | |
| 142 | + }); | |
| 143 | + | |
| 144 | + function g_emit(id) { | |
| 145 | + console.log('g_emit [' + id + ']'); | |
| 146 | + return function () { | |
| 147 | + console.log('eq.emitLater(' + id + ')'); | |
| 148 | + return gb_main_ep.emitLater(id); | |
| 149 | + }; | |
| 150 | + } | |
| 151 | + | |
| 152 | + //滚动条 | |
| 153 | + $('._route_info_wrap>ul.uk-switcher').perfectScrollbar({suppressScrollX: true}); | |
| 154 | + | |
| 155 | + //to top btttom | |
| 156 | + $('.pos_tb_icon a').on('click', function () { | |
| 157 | + UIkit.notification('top top...'); | |
| 158 | + }); | |
| 159 | + | |
| 160 | + function getUpDown(){ | |
| 161 | + return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1; | |
| 123 | 162 | } |
| 124 | - var gb_map_consts = { | |
| 125 | - mapContainer: '#map_wrap', | |
| 126 | - center_point: { | |
| 127 | - lng: 121.544336, | |
| 128 | - lat: 31.221315 | |
| 129 | - } | |
| 130 | - }; | |
| 131 | - | |
| 132 | - map = new BMap.Map($(gb_map_consts.mapContainer)[0]); | |
| 133 | - //map.setMapStyle({style:'dark'}); | |
| 134 | - //中心点和缩放级别 | |
| 135 | - map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 13); | |
| 136 | - map.enableScrollWheelZoom(); | |
| 163 | + | |
| 164 | + //切换上下行显示 | |
| 165 | + $('.up_down_route_list').on('show', function () { | |
| 166 | + gb_ct_map.changeUpDown(); | |
| 167 | + }); | |
| 137 | 168 | </script> |
| 169 | + | |
| 170 | +<!--- js --> | |
| 171 | +<script src="/pages/base/geo_data_edit/js/common_data.js" ></script> | |
| 172 | +<script src="/pages/base/geo_data_edit/js/station_route.js" ></script> | |
| 173 | +<script src="/pages/base/geo_data_edit/js/road_route.js" ></script> | |
| 174 | +<script src="/pages/base/geo_data_edit/js/version_manage.js" ></script> | |
| 175 | +<script src="/pages/base/geo_data_edit/js/history_edit_logs.js" ></script> | |
| 176 | +<script src="/pages/base/geo_data_edit/js/map.js" ></script> | |
| 177 | +<script src="/pages/base/geo_data_edit/js/submit.js" ></script> | |
| 178 | +<script type="text/javascript" | |
| 179 | + src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script> | |
| 138 | 180 | </body> |
| 139 | 181 | </html> |
| 140 | 182 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/geo_data_edit/uk3_wrap.html
| 1 | -<iframe src="/pages/base/geo_data_edit/main.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe> | |
| 2 | 1 | \ No newline at end of file |
| 2 | +<style> | |
| 3 | + iframe.full_screen{ | |
| 4 | + width: 100%; | |
| 5 | + height: 100%; | |
| 6 | + position: fixed; | |
| 7 | + z-index: 9999999; | |
| 8 | + top: 0; | |
| 9 | + left: 0; | |
| 10 | + margin-left: 0 !important; | |
| 11 | + padding-left: 0; | |
| 12 | + padding-top: 0; | |
| 13 | + } | |
| 14 | +</style> | |
| 15 | +<iframe id="geo_edit_wrap_iframe" src="/pages/base/geo_data_edit/main.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe> | |
| 3 | 16 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| ... | ... | @@ -408,7 +408,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 408 | 408 | _internalLpArray[iLpIndex].setBxDesc("5休2分班"); |
| 409 | 409 | } |
| 410 | 410 | for (i = 0; i < iC2; i++) { |
| 411 | - iLpIndex = aNotLbIndexes[_iBx_lb_lpcount - iC2 + i * (iC1 + 1)]; | |
| 411 | + iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)]; | |
| 412 | 412 | _internalLpArray[iLpIndex].setBxLb(false); |
| 413 | 413 | _internalLpArray[iLpIndex].setBxFb(true); |
| 414 | 414 | _internalLpArray[iLpIndex].setBxFb5_2(true); |
| ... | ... | @@ -458,7 +458,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 458 | 458 | var _iZbx_lpIndex; // 中标线对应第几个路牌 |
| 459 | 459 | |
| 460 | 460 | var _fnInitFun4 = function() { // 初始化方法4 |
| 461 | - console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | |
| 461 | + console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); | |
| 462 | 462 | |
| 463 | 463 | //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------// |
| 464 | 464 | // 构造中标线 |
| ... | ... | @@ -523,7 +523,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 523 | 523 | true |
| 524 | 524 | ); |
| 525 | 525 | |
| 526 | - _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌 | |
| 526 | + // 注意:如果中标线和上标线同一个路牌,需要把中标线移到下一个路牌 | |
| 527 | + if (aTtindex[0] == 0) { // 0是上标线路牌索引 | |
| 528 | + aTtindex[0] = aLbIndexes[1]; // 选择下一个连班路牌索引 | |
| 529 | + } | |
| 530 | + | |
| 531 | + _iZbx_lpIndex = aTtindex[0]; // 中标线放在第几个路牌 | |
| 527 | 532 | oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象 |
| 528 | 533 | oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔 |
| 529 | 534 | oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb()); |
| ... | ... | @@ -1502,17 +1507,44 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 1502 | 1507 | oLp = _internalLpArray[i]; |
| 1503 | 1508 | iBcChainCount = oLp.fnGetBcChainCount(); |
| 1504 | 1509 | |
| 1505 | - for (j = 0; j < iBcChainCount; j++) { | |
| 1510 | + if (iBcChainCount == 1) { // 只有一个车次链,是连班班型 | |
| 1511 | + // 头部要添加出场,例保班次 | |
| 1506 | 1512 | oStartBc = oLp.getBc( |
| 1507 | - oLp.fnGetBcChainInfo(j)["s_q"], | |
| 1508 | - oLp.fnGetBcChainInfo(j)["s_b"] | |
| 1513 | + oLp.fnGetBcChainInfo(0)["s_q"], | |
| 1514 | + oLp.fnGetBcChainInfo(0)["s_b"] | |
| 1509 | 1515 | ); |
| 1516 | + aOtherBc.push(_factory.createBcObj( | |
| 1517 | + oLp, "bd", true, 1, | |
| 1518 | + oStartBc.getFcTimeObj(), | |
| 1519 | + _paramObj | |
| 1520 | + )); | |
| 1521 | + aOtherBc.push(_factory.createBcObj( | |
| 1522 | + oLp, "out", true, 1, | |
| 1523 | + oStartBc.getFcTimeObj(), | |
| 1524 | + _paramObj | |
| 1525 | + )); | |
| 1526 | + | |
| 1527 | + // 尾部需添加进场,例保班次 | |
| 1510 | 1528 | oEndBc = oLp.getBc( |
| 1511 | - oLp.fnGetBcChainInfo(j)["e_q"], | |
| 1512 | - oLp.fnGetBcChainInfo(j)["e_b"] | |
| 1529 | + oLp.fnGetBcChainInfo(0)["e_q"], | |
| 1530 | + oLp.fnGetBcChainInfo(0)["e_b"] | |
| 1531 | + ); | |
| 1532 | + aOtherBc.push(_factory.createBcObj( | |
| 1533 | + oLp, "in", true, 1, | |
| 1534 | + oEndBc.getArrTimeObj(), | |
| 1535 | + _paramObj | |
| 1536 | + )); | |
| 1537 | + aOtherBc.push(_factory.createBcObj( | |
| 1538 | + oLp, "lc", true, 1, | |
| 1539 | + oEndBc.getArrTimeObj(), | |
| 1540 | + _paramObj | |
| 1541 | + )); | |
| 1542 | + } else if (iBcChainCount == 2) { // 两个车次链,是分班班型 | |
| 1543 | + // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次 | |
| 1544 | + oStartBc = oLp.getBc( | |
| 1545 | + oLp.fnGetBcChainInfo(0)["s_q"], | |
| 1546 | + oLp.fnGetBcChainInfo(0)["s_b"] | |
| 1513 | 1547 | ); |
| 1514 | - | |
| 1515 | - // 车次链开头添加出场班次 | |
| 1516 | 1548 | aOtherBc.push(_factory.createBcObj( |
| 1517 | 1549 | oLp, "bd", true, 1, |
| 1518 | 1550 | oStartBc.getFcTimeObj(), |
| ... | ... | @@ -1524,7 +1556,31 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 1524 | 1556 | _paramObj |
| 1525 | 1557 | )); |
| 1526 | 1558 | |
| 1527 | - // 车次链结尾添加进场班次 | |
| 1559 | + oEndBc = oLp.getBc( | |
| 1560 | + oLp.fnGetBcChainInfo(0)["e_q"], | |
| 1561 | + oLp.fnGetBcChainInfo(0)["e_b"] | |
| 1562 | + ); | |
| 1563 | + aOtherBc.push(_factory.createBcObj( | |
| 1564 | + oLp, "in", true, 1, | |
| 1565 | + oEndBc.getArrTimeObj(), | |
| 1566 | + _paramObj | |
| 1567 | + )); | |
| 1568 | + | |
| 1569 | + // 第二个车次链开头只有出场班次,车次链结尾有进场,报到班次 | |
| 1570 | + oStartBc = oLp.getBc( | |
| 1571 | + oLp.fnGetBcChainInfo(1)["s_q"], | |
| 1572 | + oLp.fnGetBcChainInfo(1)["s_b"] | |
| 1573 | + ); | |
| 1574 | + aOtherBc.push(_factory.createBcObj( | |
| 1575 | + oLp, "out", true, 1, | |
| 1576 | + oStartBc.getFcTimeObj(), | |
| 1577 | + _paramObj | |
| 1578 | + )); | |
| 1579 | + | |
| 1580 | + oEndBc = oLp.getBc( | |
| 1581 | + oLp.fnGetBcChainInfo(1)["e_q"], | |
| 1582 | + oLp.fnGetBcChainInfo(1)["e_b"] | |
| 1583 | + ); | |
| 1528 | 1584 | aOtherBc.push(_factory.createBcObj( |
| 1529 | 1585 | oLp, "in", true, 1, |
| 1530 | 1586 | oEndBc.getArrTimeObj(), |
| ... | ... | @@ -1535,6 +1591,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 1535 | 1591 | oEndBc.getArrTimeObj(), |
| 1536 | 1592 | _paramObj |
| 1537 | 1593 | )); |
| 1594 | + | |
| 1595 | + | |
| 1596 | + } else { | |
| 1597 | + // 2个车次链以上,暂时没有此班型 | |
| 1538 | 1598 | } |
| 1539 | 1599 | |
| 1540 | 1600 | oLp.addOtherBcArray(aOtherBc); | ... | ... |
src/main/resources/static/pages/history_sch/edit/history_sch_maintain.html
| ... | ... | @@ -38,6 +38,8 @@ |
| 38 | 38 | </div> |
| 39 | 39 | <button class="uk-button">检索</button> |
| 40 | 40 | <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a> |
| 41 | + <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;"> | |
| 42 | + 重新统计</button> | |
| 41 | 43 | </fieldset> |
| 42 | 44 | </form> |
| 43 | 45 | </div> |
| ... | ... | @@ -476,6 +478,41 @@ |
| 476 | 478 | |
| 477 | 479 | $('[name=xlBm_eq]', f).on('change', clearLpSelect); |
| 478 | 480 | //clearLpSelect |
| 481 | + | |
| 482 | + | |
| 483 | + /** | |
| 484 | + * 重新统计 | |
| 485 | + */ | |
| 486 | + $('#reCountBtn', modal).on('click', function () { | |
| 487 | + var lineSelect = $('[name=xlBm_eq]', modal); | |
| 488 | + var rq = $('.h-s-time li.uk-active', modal).text(), | |
| 489 | + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | |
| 490 | + lineCode = lineSelect.val(); | |
| 491 | + | |
| 492 | + var that = this; | |
| 493 | + alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { | |
| 494 | + $(that).attr('disabled', 'disabled'); | |
| 495 | + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | |
| 496 | + | |
| 497 | + | |
| 498 | + var reCountEp = EventProxy.create('ylbUpdate', function () { | |
| 499 | + $('i.uk-icon-spin', that).remove(); | |
| 500 | + $(that).removeAttr('disabled'); | |
| 501 | + notify_succ('重新统计成功!'); | |
| 502 | + }); | |
| 503 | + | |
| 504 | + //统计路单 -娄高峰 | |
| 505 | + /*gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | |
| 506 | + reCountEp.emitLater('calcWaybill'); | |
| 507 | + });*/ | |
| 508 | + | |
| 509 | + //统计油 -廖磊 | |
| 510 | + gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | |
| 511 | + reCountEp.emitLater('ylbUpdate'); | |
| 512 | + }); | |
| 513 | + | |
| 514 | + }, '我确定'); | |
| 515 | + }); | |
| 479 | 516 | })(); |
| 480 | 517 | </script> |
| 481 | 518 | </div> |
| 482 | 519 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch_maintain.html
| ... | ... | @@ -421,26 +421,26 @@ |
| 421 | 421 | * 重新统计 |
| 422 | 422 | */ |
| 423 | 423 | $('#reCountBtn', modal).on('click', function () { |
| 424 | - $(this).attr('disabled', 'disabled'); | |
| 425 | - $(this).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | |
| 426 | - | |
| 427 | 424 | var rq = $('.h-s-time li.uk-active', modal).text(), |
| 428 | 425 | lineName = $('.h-s-line li.uk-active', modal).text(), |
| 429 | 426 | lineCode = $('.h-s-line li.uk-active', modal).data('id'); |
| 430 | 427 | |
| 431 | 428 | var that = this; |
| 432 | 429 | alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { |
| 430 | + $(that).attr('disabled', 'disabled'); | |
| 431 | + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | |
| 432 | + | |
| 433 | 433 | |
| 434 | - var reCountEp = EventProxy.create('calcWaybill', 'ylbUpdate', function () { | |
| 434 | + var reCountEp = EventProxy.create('ylbUpdate', function () { | |
| 435 | 435 | $('i.uk-icon-spin', that).remove(); |
| 436 | - $(this).removeAttr('disabled'); | |
| 436 | + $(that).removeAttr('disabled'); | |
| 437 | 437 | notify_succ('重新统计成功!'); |
| 438 | 438 | }); |
| 439 | 439 | |
| 440 | 440 | //统计路单 -娄高峰 |
| 441 | - gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | |
| 441 | + /*gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | |
| 442 | 442 | reCountEp.emitLater('calcWaybill'); |
| 443 | - }); | |
| 443 | + });*/ | |
| 444 | 444 | |
| 445 | 445 | //统计油 -廖磊 |
| 446 | 446 | gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
| ... | ... | @@ -321,27 +321,7 @@ var gb_schedule_context_menu = (function () { |
| 321 | 321 | }, |
| 322 | 322 | 'lj_zrw': { |
| 323 | 323 | name: '临加/子任务' |
| 324 | - }/*, | |
| 325 | - 'shortcut': { | |
| 326 | - name: '...', | |
| 327 | - items: { | |
| 328 | - 'add_temp_sch':{ | |
| 329 | - name: '新增临加班次' | |
| 330 | - }, | |
| 331 | - 'add_oil': { | |
| 332 | - name: '(子任务)空驶进出场' | |
| 333 | - }, | |
| 334 | - 'add_sub_task_in': { | |
| 335 | - name: '(子任务)进场' | |
| 336 | - }, | |
| 337 | - 'add_sub_task_out': { | |
| 338 | - name: '(子任务)出场' | |
| 339 | - }, | |
| 340 | - 'add_sub_task_range_turn': { | |
| 341 | - name: '(子任务)区间调头' | |
| 342 | - } | |
| 343 | - } | |
| 344 | - }*/, | |
| 324 | + }, | |
| 345 | 325 | 'sep3': '---------', |
| 346 | 326 | 'add_temp_sch': { |
| 347 | 327 | name: '添加临加班次' | ... | ... |