Commit 0db6cdcb35e50a888ea40fe414493d15fdd84c71
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
69 changed files
with
3909 additions
and
437 deletions
src/main/java/com/bsth/XDApplication.java
| @@ -10,6 +10,7 @@ import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | @@ -10,6 +10,7 @@ import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 10 | import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; | 10 | import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; |
| 11 | import com.bsth.data.msg_queue.DirectivePushQueue; | 11 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 12 | import com.bsth.data.msg_queue.WebSocketPushQueue; | 12 | import com.bsth.data.msg_queue.WebSocketPushQueue; |
| 13 | +import com.bsth.data.safe_driv.SafeDrivDataLoadThread; | ||
| 13 | import com.bsth.data.schedule.DayOfSchedule; | 14 | import com.bsth.data.schedule.DayOfSchedule; |
| 14 | import com.bsth.data.schedule.auto_exec.AutoExecScanThread; | 15 | import com.bsth.data.schedule.auto_exec.AutoExecScanThread; |
| 15 | import com.bsth.data.schedule.edit_logs.SeiPstThread; | 16 | import com.bsth.data.schedule.edit_logs.SeiPstThread; |
| @@ -75,6 +76,9 @@ public class XDApplication implements CommandLineRunner { | @@ -75,6 +76,9 @@ public class XDApplication implements CommandLineRunner { | ||
| 75 | @Autowired | 76 | @Autowired |
| 76 | LineVersionsData lineVersionsData; | 77 | LineVersionsData lineVersionsData; |
| 77 | 78 | ||
| 79 | + @Autowired | ||
| 80 | + SafeDrivDataLoadThread safeDrivDataLoadThread; | ||
| 81 | + | ||
| 78 | private static long timeDiff; | 82 | private static long timeDiff; |
| 79 | private static long timeDiffTraffic; | 83 | private static long timeDiffTraffic; |
| 80 | 84 | ||
| @@ -122,7 +126,7 @@ public class XDApplication implements CommandLineRunner { | @@ -122,7 +126,7 @@ public class XDApplication implements CommandLineRunner { | ||
| 122 | //实际排班更新线程 | 126 | //实际排班更新线程 |
| 123 | //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | 127 | //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); |
| 124 | //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行 | 128 | //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行 |
| 125 | - //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | 129 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 |
| 126 | //实际排班延迟入库线程 | 130 | //实际排班延迟入库线程 |
| 127 | //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); | 131 | //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); |
| 128 | //班次修正日志延迟入库 | 132 | //班次修正日志延迟入库 |
| @@ -131,11 +135,16 @@ public class XDApplication implements CommandLineRunner { | @@ -131,11 +135,16 @@ public class XDApplication implements CommandLineRunner { | ||
| 131 | //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | 135 | //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); |
| 132 | //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | 136 | //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) |
| 133 | //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | 137 | //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); |
| 138 | + | ||
| 139 | + //安全驾驶 | ||
| 140 | + //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS); | ||
| 134 | } | 141 | } |
| 135 | 142 | ||
| 136 | public void prodInit(){ | 143 | public void prodInit(){ |
| 137 | log.info("prodInit..."); | 144 | log.info("prodInit..."); |
| 138 | ScheduledExecutorService sexec = Application.mainServices; | 145 | ScheduledExecutorService sexec = Application.mainServices; |
| 146 | + //安全驾驶 | ||
| 147 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 139 | 148 | ||
| 140 | /** 线调业务 */ | 149 | /** 线调业务 */ |
| 141 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | 150 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
| 1 | package com.bsth.controller.geo_data; | 1 | package com.bsth.controller.geo_data; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.geo_data.GeoRoad; | ||
| 3 | import com.bsth.entity.geo_data.GeoStation; | 4 | import com.bsth.entity.geo_data.GeoStation; |
| 4 | import com.bsth.service.geo_data.GeoDataService; | 5 | import com.bsth.service.geo_data.GeoDataService; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -35,4 +36,41 @@ public class GeoDataController { | @@ -35,4 +36,41 @@ public class GeoDataController { | ||
| 35 | public Map<String, Object> updateBufferInfo(GeoStation station){ | 36 | public Map<String, Object> updateBufferInfo(GeoStation station){ |
| 36 | return geoDataService.updateBufferInfo(station); | 37 | return geoDataService.updateBufferInfo(station); |
| 37 | } | 38 | } |
| 38 | -} | 39 | + |
| 40 | + @RequestMapping(value = "updateStationName",method = RequestMethod.POST) | ||
| 41 | + public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){ | ||
| 42 | + return geoDataService.updateStationName(map); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @RequestMapping(value = "addNewStationRoute",method = RequestMethod.POST) | ||
| 46 | + public Map<String, Object> addNewStationRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown | ||
| 47 | + ,@RequestParam String stationName,@RequestParam Float lat,@RequestParam Float lng,@RequestParam int prevRouteId){ | ||
| 48 | + return geoDataService.addNewStationRoute(lineCode, upDown, versions, stationName, lat, lng, prevRouteId); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "addNewRoadRoute",method = RequestMethod.POST) | ||
| 52 | + public Map<String, Object> addNewRoadRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown | ||
| 53 | + ,@RequestParam String sectionName,@RequestParam String crosesRoad,@RequestParam String coords,@RequestParam int prevRouteId){ | ||
| 54 | + return geoDataService.addNewRoadRoute(lineCode, upDown, versions, sectionName, crosesRoad, coords, prevRouteId); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @RequestMapping(value = "destroyStation",method = RequestMethod.POST) | ||
| 58 | + public Map<String, Object> destroyStation(GeoStation station){ | ||
| 59 | + return geoDataService.destroyStation(station); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @RequestMapping(value = "updateRoadInfo",method = RequestMethod.POST) | ||
| 63 | + public Map<String, Object> updateRoadInfo(GeoRoad road){ | ||
| 64 | + return geoDataService.updateRoadInfo(road); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @RequestMapping(value = "destroyRoad",method = RequestMethod.POST) | ||
| 68 | + public Map<String, Object> destroyRoad(GeoRoad road){ | ||
| 69 | + return geoDataService.destroyRoad(road); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @RequestMapping("findVersionInfo") | ||
| 73 | + public Map<String, Object> findVersionInfo(@RequestParam String lineCode){ | ||
| 74 | + return geoDataService.findVersionInfo(lineCode); | ||
| 75 | + } | ||
| 76 | +} | ||
| 39 | \ No newline at end of file | 77 | \ No newline at end of file |
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java
| @@ -2,16 +2,14 @@ package com.bsth.controller.schedule.core; | @@ -2,16 +2,14 @@ package com.bsth.controller.schedule.core; | ||
| 2 | 2 | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.schedule.BController; | 4 | import com.bsth.controller.schedule.BController; |
| 5 | -import com.bsth.entity.LineVersions; | ||
| 6 | import com.bsth.entity.schedule.TTInfo; | 5 | import com.bsth.entity.schedule.TTInfo; |
| 7 | -import com.bsth.service.LineVersionsService; | ||
| 8 | import com.bsth.service.schedule.TTInfoService; | 6 | import com.bsth.service.schedule.TTInfoService; |
| 9 | import com.bsth.service.schedule.exception.ScheduleException; | 7 | import com.bsth.service.schedule.exception.ScheduleException; |
| 10 | -import org.joda.time.DateTime; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
| 13 | 10 | ||
| 14 | -import java.util.*; | 11 | +import java.util.HashMap; |
| 12 | +import java.util.Map; | ||
| 15 | 13 | ||
| 16 | /** | 14 | /** |
| 17 | * Created by xu on 16/12/20. | 15 | * Created by xu on 16/12/20. |
| @@ -21,47 +19,13 @@ import java.util.*; | @@ -21,47 +19,13 @@ import java.util.*; | ||
| 21 | public class TTInfoController extends BController<TTInfo, Long> { | 19 | public class TTInfoController extends BController<TTInfo, Long> { |
| 22 | @Autowired | 20 | @Autowired |
| 23 | private TTInfoService ttInfoService; | 21 | private TTInfoService ttInfoService; |
| 24 | - @Autowired | ||
| 25 | - private LineVersionsService lineVersionsService; | ||
| 26 | 22 | ||
| 27 | @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET) | 23 | @RequestMapping(value = "/stationroute/{lineid}", method = RequestMethod.GET) |
| 28 | public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) { | 24 | public Map<String, Object> getLineStationRouteVersions(@PathVariable(value = "lineid") Integer lineid) { |
| 29 | Map<String, Object> rtn = new HashMap<>(); | 25 | Map<String, Object> rtn = new HashMap<>(); |
| 30 | try { | 26 | try { |
| 31 | - List<LineVersions> lineVersionses = lineVersionsService.findByLineCode(lineid); | ||
| 32 | - Collections.sort(lineVersionses, new Comparator<LineVersions>() { | ||
| 33 | - @Override | ||
| 34 | - public int compare(LineVersions o1, LineVersions o2) { | ||
| 35 | - if (o1.getVersions() > o2.getVersions()) { | ||
| 36 | - return -1; | ||
| 37 | - } else if (o1.getVersions() < o2.getVersions()) { | ||
| 38 | - return 1; | ||
| 39 | - } else { | ||
| 40 | - return 0; | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - }); | ||
| 44 | - | ||
| 45 | - // 取最近2条记录 | ||
| 46 | - List<Map<String, Object>> mapList = new ArrayList<>(); | ||
| 47 | - for (LineVersions lv: lineVersionses) { | ||
| 48 | - String vname = lv.getName(); | ||
| 49 | - String rq = lv.getStartDate() == null ? "未知启用日期" : new DateTime(lv.getStartDate()).toString("YYYY年MM月dd日"); | ||
| 50 | - String sdesc = lv.getStatus() == 0 ? "历史" : (lv.getStatus() == 1 ? "当前" : "待更新"); | ||
| 51 | - | ||
| 52 | - Map<String, Object> value = new HashMap<>(); | ||
| 53 | - value.put("desc", vname + "-" + rq + "-" + sdesc); | ||
| 54 | - value.put("version", lv.getVersions()); | ||
| 55 | - | ||
| 56 | - mapList.add(value); | ||
| 57 | - | ||
| 58 | - if (mapList.size() == 2) { | ||
| 59 | - break; | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | rtn.put("status", ResponseCode.SUCCESS); | 27 | rtn.put("status", ResponseCode.SUCCESS); |
| 64 | - rtn.put("data", mapList); | 28 | + rtn.put("data", ttInfoService.getLineStationRouteVersions(lineid)); |
| 65 | 29 | ||
| 66 | } catch (Exception exp) { | 30 | } catch (Exception exp) { |
| 67 | rtn.put("status", ResponseCode.ERROR); | 31 | rtn.put("status", ResponseCode.ERROR); |
| @@ -72,6 +36,25 @@ public class TTInfoController extends BController<TTInfo, Long> { | @@ -72,6 +36,25 @@ public class TTInfoController extends BController<TTInfo, Long> { | ||
| 72 | 36 | ||
| 73 | } | 37 | } |
| 74 | 38 | ||
| 39 | + @RequestMapping(value = "/versiondesc/{lineid}/{version}") | ||
| 40 | + public Map<String, Object> getLineVersionDesc( | ||
| 41 | + @PathVariable(value = "lineid") Integer lineid, | ||
| 42 | + @PathVariable(value = "version") Integer version) { | ||
| 43 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 44 | + try { | ||
| 45 | + Map<String, String> desc = new HashMap<>(); | ||
| 46 | + desc.put("desc", ttInfoService.getLineVersionDesc(lineid, version)); | ||
| 47 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 48 | + rtn.put("data", desc); | ||
| 49 | + | ||
| 50 | + } catch (Exception exp) { | ||
| 51 | + rtn.put("status", ResponseCode.ERROR); | ||
| 52 | + rtn.put("msg", exp.getMessage()); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + return rtn; | ||
| 56 | + } | ||
| 57 | + | ||
| 75 | @RequestMapping(value = "/validate_name", method = RequestMethod.GET) | 58 | @RequestMapping(value = "/validate_name", method = RequestMethod.GET) |
| 76 | public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) { | 59 | public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) { |
| 77 | Map<String, Object> rtn = new HashMap<>(); | 60 | Map<String, Object> rtn = new HashMap<>(); |
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
| @@ -108,10 +108,10 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { | @@ -108,10 +108,10 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { | ||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) | 110 | @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) |
| 111 | - public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir) { | 111 | + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir, Integer lineversion) { |
| 112 | Map<String, Object> rtn = new HashMap<>(); | 112 | Map<String, Object> rtn = new HashMap<>(); |
| 113 | try { | 113 | try { |
| 114 | - List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir); | 114 | + List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir, lineversion); |
| 115 | rtn.put("status", ResponseCode.SUCCESS); | 115 | rtn.put("status", ResponseCode.SUCCESS); |
| 116 | rtn.put("data", list); | 116 | rtn.put("data", list); |
| 117 | } catch (Exception exp) { | 117 | } catch (Exception exp) { |
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
| 1 | package com.bsth.data.car_out_info; | 1 | package com.bsth.data.car_out_info; |
| 2 | 2 | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 5 | +import com.bsth.data.gpsdata_v2.entity.StationRoute; | ||
| 4 | import com.bsth.data.schedule.DayOfSchedule; | 6 | import com.bsth.data.schedule.DayOfSchedule; |
| 5 | import com.bsth.data.schedule.ScheduleComparator; | 7 | import com.bsth.data.schedule.ScheduleComparator; |
| 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| @@ -166,6 +168,11 @@ public class CarOutInfoHandler { | @@ -166,6 +168,11 @@ public class CarOutInfoHandler { | ||
| 166 | * @param list | 168 | * @param list |
| 167 | * @return | 169 | * @return |
| 168 | */ | 170 | */ |
| 171 | + private static String[] fls = new String[]{"in","out","ldks","venting","major"}; | ||
| 172 | + private static List<String> clearTypes; | ||
| 173 | + static { | ||
| 174 | + clearTypes = Arrays.asList(fls); | ||
| 175 | + } | ||
| 169 | private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) { | 176 | private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) { |
| 170 | ScheduleRealInfo[] array = new ScheduleRealInfo[3]; | 177 | ScheduleRealInfo[] array = new ScheduleRealInfo[3]; |
| 171 | Collections.sort(list, schDFSJComparator); | 178 | Collections.sort(list, schDFSJComparator); |
| @@ -181,11 +188,16 @@ public class CarOutInfoHandler { | @@ -181,11 +188,16 @@ public class CarOutInfoHandler { | ||
| 181 | continue; | 188 | continue; |
| 182 | 189 | ||
| 183 | //进场、出场、2点间空驶 | 190 | //进场、出场、2点间空驶 |
| 184 | - if (sch.getBcType().equals("in") | ||
| 185 | - || sch.getBcType().equals("out") | ||
| 186 | - || sch.getBcType().equals("ldks")) | 191 | + if (clearTypes.contains(sch.getBcType())) |
| 187 | continue; | 192 | continue; |
| 188 | 193 | ||
| 194 | + //区间 | ||
| 195 | + if (sch.getBcType().equals("region")){ | ||
| 196 | + //是否起点发出 | ||
| 197 | + if(!isStartOut(sch)) | ||
| 198 | + continue; | ||
| 199 | + } | ||
| 200 | + | ||
| 189 | //有实发实达时间的 | 201 | //有实发实达时间的 |
| 190 | if (StringUtils.isNotEmpty(sch.getFcsjActual()) | 202 | if (StringUtils.isNotEmpty(sch.getFcsjActual()) |
| 191 | || StringUtils.isNotEmpty(sch.getZdsjActual())) | 203 | || StringUtils.isNotEmpty(sch.getZdsjActual())) |
| @@ -199,4 +211,30 @@ public class CarOutInfoHandler { | @@ -199,4 +211,30 @@ public class CarOutInfoHandler { | ||
| 199 | } | 211 | } |
| 200 | return array; | 212 | return array; |
| 201 | } | 213 | } |
| 214 | + | ||
| 215 | + private static StationRouteComp sComp = new StationRouteComp(); | ||
| 216 | + private boolean isStartOut(ScheduleRealInfo sch) { | ||
| 217 | + try{ | ||
| 218 | + List<StationRoute> list = GeoCacheData.getStationRoute(sch.getXlBm(), Integer.parseInt(sch.getXlDir())); | ||
| 219 | + | ||
| 220 | + if(null == list && list.size() == 0) | ||
| 221 | + return false; | ||
| 222 | + //排序 | ||
| 223 | + Collections.sort(list, sComp); | ||
| 224 | + | ||
| 225 | + if(sch.getQdzName().equals(list.get(0).getName())) | ||
| 226 | + return true; | ||
| 227 | + }catch (Exception e){ | ||
| 228 | + logger.error("", e); | ||
| 229 | + } | ||
| 230 | + return false; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + private static class StationRouteComp implements Comparator<StationRoute> { | ||
| 234 | + | ||
| 235 | + @Override | ||
| 236 | + public int compare(StationRoute s1, StationRoute s2) { | ||
| 237 | + return s1.getRouteSort() - s2.getRouteSort(); | ||
| 238 | + } | ||
| 239 | + } | ||
| 202 | } | 240 | } |
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| @@ -4,18 +4,14 @@ import com.bsth.data.gpsdata_v2.cache.GpsCacheData; | @@ -4,18 +4,14 @@ import com.bsth.data.gpsdata_v2.cache.GpsCacheData; | ||
| 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 5 | import com.bsth.data.gpsdata_v2.handlers.*; | 5 | import com.bsth.data.gpsdata_v2.handlers.*; |
| 6 | import com.google.common.collect.ArrayListMultimap; | 6 | import com.google.common.collect.ArrayListMultimap; |
| 7 | +import org.apache.commons.lang3.StringUtils; | ||
| 7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 11 | 12 | ||
| 12 | -import java.util.ArrayList; | ||
| 13 | -import java.util.List; | ||
| 14 | -import java.util.Set; | ||
| 15 | -import java.util.concurrent.CountDownLatch; | ||
| 16 | -import java.util.concurrent.ExecutorService; | ||
| 17 | -import java.util.concurrent.Executors; | ||
| 18 | -import java.util.concurrent.ThreadFactory; | 13 | +import java.util.*; |
| 14 | +import java.util.concurrent.*; | ||
| 19 | 15 | ||
| 20 | /** | 16 | /** |
| 21 | * 实时信号数据处理 | 17 | * 实时信号数据处理 |
| @@ -24,12 +20,6 @@ import java.util.concurrent.ThreadFactory; | @@ -24,12 +20,6 @@ import java.util.concurrent.ThreadFactory; | ||
| 24 | @Component | 20 | @Component |
| 25 | public class DataHandleProcess { | 21 | public class DataHandleProcess { |
| 26 | 22 | ||
| 27 | - static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); | ||
| 28 | - final static int POOL_SIZE = 25; | ||
| 29 | - | ||
| 30 | - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new HandlerThreadFactory()); | ||
| 31 | - public static CountDownLatch count; | ||
| 32 | - | ||
| 33 | @Autowired | 23 | @Autowired |
| 34 | GpsStateProcess gpsStateProcess; | 24 | GpsStateProcess gpsStateProcess; |
| 35 | @Autowired | 25 | @Autowired |
| @@ -42,10 +32,17 @@ public class DataHandleProcess { | @@ -42,10 +32,17 @@ public class DataHandleProcess { | ||
| 42 | OutStationProcess outStationProcess; | 32 | OutStationProcess outStationProcess; |
| 43 | @Autowired | 33 | @Autowired |
| 44 | ReverseRouteProcess reverseRouteProcess; | 34 | ReverseRouteProcess reverseRouteProcess; |
| 45 | - | ||
| 46 | @Autowired | 35 | @Autowired |
| 47 | GpsRealData gpsRealData; | 36 | GpsRealData gpsRealData; |
| 48 | 37 | ||
| 38 | + | ||
| 39 | + static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); | ||
| 40 | + | ||
| 41 | + final static int POOL_SIZE = 25; | ||
| 42 | + | ||
| 43 | + static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); | ||
| 44 | + public static CountDownLatch count; | ||
| 45 | + | ||
| 49 | static long lastTime; | 46 | static long lastTime; |
| 50 | 47 | ||
| 51 | public static boolean isBlock() { | 48 | public static boolean isBlock() { |
| @@ -54,7 +51,7 @@ public class DataHandleProcess { | @@ -54,7 +51,7 @@ public class DataHandleProcess { | ||
| 54 | 51 | ||
| 55 | public void handle(List<GpsEntity> list) { | 52 | public void handle(List<GpsEntity> list) { |
| 56 | try { | 53 | try { |
| 57 | - if(list.size() == 0) | 54 | + if (list.size() == 0) |
| 58 | return; | 55 | return; |
| 59 | lastTime = System.currentTimeMillis(); | 56 | lastTime = System.currentTimeMillis(); |
| 60 | //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑) | 57 | //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑) |
| @@ -76,21 +73,50 @@ public class DataHandleProcess { | @@ -76,21 +73,50 @@ public class DataHandleProcess { | ||
| 76 | logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | 73 | logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); |
| 77 | count = new CountDownLatch(ks.size()); | 74 | count = new CountDownLatch(ks.size()); |
| 78 | 75 | ||
| 76 | + List<Future> fRs = new ArrayList<>(ks.size()); | ||
| 79 | for (Integer index : ks) { | 77 | for (Integer index : ks) { |
| 80 | - threadPool.execute(new SignalHandleThread(dataListMap.get(index), count)); | 78 | + fRs.add(threadPool.submit(new SignalHandleThread(dataListMap.get(index), count))); |
| 79 | + } | ||
| 80 | + | ||
| 81 | + //按线路分组gps | ||
| 82 | + /*ArrayListMultimap multimap = ArrayListMultimap.create(); | ||
| 83 | + for (GpsEntity gps : list) { | ||
| 84 | + multimap.put(gps.getLineId(), gps); | ||
| 81 | } | 85 | } |
| 82 | 86 | ||
| 87 | + Set<String> ks = multimap.keySet(); | ||
| 88 | + | ||
| 89 | + logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | ||
| 90 | + count = new CountDownLatch(ks.size()); | ||
| 91 | + | ||
| 92 | + for (String lineCode : ks) { | ||
| 93 | + threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count)); | ||
| 94 | + }*/ | ||
| 95 | + | ||
| 83 | //等待子线程结束 | 96 | //等待子线程结束 |
| 84 | count.await(); | 97 | count.await(); |
| 85 | 98 | ||
| 99 | + for (Future f : fRs) { | ||
| 100 | + try { | ||
| 101 | + f.get(); | ||
| 102 | + } catch (InterruptedException e) { | ||
| 103 | + } catch (ExecutionException e) { | ||
| 104 | + logger.error(e.getCause().getMessage()); | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 86 | //加入实时gps对照 | 108 | //加入实时gps对照 |
| 87 | for (GpsEntity gps : list) | 109 | for (GpsEntity gps : list) |
| 88 | gpsRealData.put(gps); | 110 | gpsRealData.put(gps); |
| 111 | + | ||
| 112 | + logger.info("time , " + (System.currentTimeMillis() - lastTime)); | ||
| 89 | } catch (Exception e) { | 113 | } catch (Exception e) { |
| 90 | logger.error("", e); | 114 | logger.error("", e); |
| 91 | } | 115 | } |
| 92 | } | 116 | } |
| 93 | 117 | ||
| 118 | + static GpsComp comp = new GpsComp(); | ||
| 119 | + | ||
| 94 | public class SignalHandleThread implements Runnable { | 120 | public class SignalHandleThread implements Runnable { |
| 95 | 121 | ||
| 96 | List<GpsEntity> list; | 122 | List<GpsEntity> list; |
| @@ -104,9 +130,12 @@ public class DataHandleProcess { | @@ -104,9 +130,12 @@ public class DataHandleProcess { | ||
| 104 | @Override | 130 | @Override |
| 105 | public void run() { | 131 | public void run() { |
| 106 | try { | 132 | try { |
| 133 | + Collections.sort(list, comp); | ||
| 107 | for (GpsEntity gps : list) { | 134 | for (GpsEntity gps : list) { |
| 108 | - try{ | ||
| 109 | - if(Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20) | 135 | + try { |
| 136 | + if (StringUtils.isEmpty(gps.getNbbm())) | ||
| 137 | + continue; | ||
| 138 | + if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20) | ||
| 110 | continue; | 139 | continue; |
| 111 | 140 | ||
| 112 | gpsStateProcess.process(gps);//状态处理 | 141 | gpsStateProcess.process(gps);//状态处理 |
| @@ -118,30 +147,24 @@ public class DataHandleProcess { | @@ -118,30 +147,24 @@ public class DataHandleProcess { | ||
| 118 | outStationProcess.process(gps);//出站 | 147 | outStationProcess.process(gps);//出站 |
| 119 | 148 | ||
| 120 | GpsCacheData.putGps(gps);//历史gps缓存 | 149 | GpsCacheData.putGps(gps);//历史gps缓存 |
| 121 | - }catch (Exception e){ | 150 | + } catch (Exception e) { |
| 122 | logger.error("", e); | 151 | logger.error("", e); |
| 123 | } | 152 | } |
| 124 | } | 153 | } |
| 154 | + | ||
| 125 | } finally { | 155 | } finally { |
| 126 | if (count != null) | 156 | if (count != null) |
| 127 | count.countDown(); | 157 | count.countDown(); |
| 158 | + logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount()); | ||
| 128 | } | 159 | } |
| 129 | } | 160 | } |
| 130 | } | 161 | } |
| 131 | 162 | ||
| 132 | - static class MyUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler { | ||
| 133 | - @Override | ||
| 134 | - public void uncaughtException(Thread t, Throwable e) { | ||
| 135 | - logger.error("caught " , e); | ||
| 136 | - } | ||
| 137 | - } | 163 | + public static class GpsComp implements Comparator<GpsEntity> { |
| 138 | 164 | ||
| 139 | - static class HandlerThreadFactory implements ThreadFactory { | ||
| 140 | @Override | 165 | @Override |
| 141 | - public Thread newThread(Runnable r) { | ||
| 142 | - Thread t = new Thread(r); | ||
| 143 | - t.setUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); | ||
| 144 | - return t; | 166 | + public int compare(GpsEntity g1, GpsEntity g2) { |
| 167 | + return g1.getTimestamp().compareTo(g2.getTimestamp()); | ||
| 145 | } | 168 | } |
| 146 | } | 169 | } |
| 147 | } | 170 | } |
| 148 | \ No newline at end of file | 171 | \ No newline at end of file |
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=329"; //+ dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
| @@ -21,7 +21,7 @@ import java.util.List; | @@ -21,7 +21,7 @@ import java.util.List; | ||
| 21 | @Component | 21 | @Component |
| 22 | public class SafeDrivDataLoadThread extends Thread{ | 22 | public class SafeDrivDataLoadThread extends Thread{ |
| 23 | 23 | ||
| 24 | - private final static String url = "http://118.178.187.115/bsth-safedriving/Crlcxb/realtimeInterface.do"; | 24 | + private final static String url = "http://180.166.5.82:9005/bsth-safedriving/Crlcxb/realtimeInterface.do"; |
| 25 | 25 | ||
| 26 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 26 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 27 | 27 |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -70,6 +70,8 @@ public class DayOfSchedule { | @@ -70,6 +70,8 @@ public class DayOfSchedule { | ||
| 70 | // 排序器 | 70 | // 排序器 |
| 71 | private static ScheduleComparator.FCSJ schFCSJComparator; | 71 | private static ScheduleComparator.FCSJ schFCSJComparator; |
| 72 | 72 | ||
| 73 | + private static ScheduleComparator.DFSJ schDFSJComparator; | ||
| 74 | + | ||
| 73 | private static Long sch_max_id=-1L; | 75 | private static Long sch_max_id=-1L; |
| 74 | 76 | ||
| 75 | @Autowired | 77 | @Autowired |
| @@ -102,6 +104,7 @@ public class DayOfSchedule { | @@ -102,6 +104,7 @@ public class DayOfSchedule { | ||
| 102 | id2SchedulMap = new ConcurrentHashMap<>(); | 104 | id2SchedulMap = new ConcurrentHashMap<>(); |
| 103 | pstBuffer = new ConcurrentLinkedQueue<>(); | 105 | pstBuffer = new ConcurrentLinkedQueue<>(); |
| 104 | schFCSJComparator = new ScheduleComparator.FCSJ(); | 106 | schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 107 | + schDFSJComparator = new ScheduleComparator.DFSJ(); | ||
| 105 | currSchDateMap = new HashMap<>(); | 108 | currSchDateMap = new HashMap<>(); |
| 106 | carExecutePlanMap = new ConcurrentHashMap<>(); | 109 | carExecutePlanMap = new ConcurrentHashMap<>(); |
| 107 | 110 | ||
| @@ -580,6 +583,8 @@ public class DayOfSchedule { | @@ -580,6 +583,8 @@ public class DayOfSchedule { | ||
| 580 | */ | 583 | */ |
| 581 | public ScheduleRealInfo next(ScheduleRealInfo sch) { | 584 | public ScheduleRealInfo next(ScheduleRealInfo sch) { |
| 582 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | 585 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 586 | + //排序 | ||
| 587 | + Collections.sort(list, schDFSJComparator); | ||
| 583 | return next(list, sch); | 588 | return next(list, sch); |
| 584 | } | 589 | } |
| 585 | 590 | ||
| @@ -916,7 +921,7 @@ public class DayOfSchedule { | @@ -916,7 +921,7 @@ public class DayOfSchedule { | ||
| 916 | 921 | ||
| 917 | public void reCalcExecPlan(String nbbm) { | 922 | public void reCalcExecPlan(String nbbm) { |
| 918 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); | 923 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); |
| 919 | - Collections.sort(list, schFCSJComparator); | 924 | + Collections.sort(list, schDFSJComparator); |
| 920 | 925 | ||
| 921 | ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list); | 926 | ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list); |
| 922 | if(null != sch) | 927 | if(null != sch) |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| @@ -68,10 +68,17 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -68,10 +68,17 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 68 | ScheduleRealInfo cancel = null; | 68 | ScheduleRealInfo cancel = null; |
| 69 | //之前存在误点班次没有发出 | 69 | //之前存在误点班次没有发出 |
| 70 | ScheduleRealInfo old = lateSchMap.get(sch.getClZbh()); | 70 | ScheduleRealInfo old = lateSchMap.get(sch.getClZbh()); |
| 71 | + | ||
| 71 | if(old != null && old.getDfsjT() < sch.getDfsjT()){ | 72 | if(old != null && old.getDfsjT() < sch.getDfsjT()){ |
| 72 | - remove(old); | ||
| 73 | - cancel = old; | ||
| 74 | - logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | 73 | + //如果之前班次的 待发应到时间已经过了 3 分钟 |
| 74 | + long t = System.currentTimeMillis(); | ||
| 75 | + long dfEndTime = old.getDfsjT() + (old.getBcsj() * 60 * 1000); | ||
| 76 | + if((t - dfEndTime) > 1000 * 60 * 3){ | ||
| 77 | + | ||
| 78 | + remove(old); | ||
| 79 | + cancel = old; | ||
| 80 | + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | ||
| 81 | + } | ||
| 75 | } | 82 | } |
| 76 | 83 | ||
| 77 | lateSchMap.put(sch.getClZbh(), sch); | 84 | lateSchMap.put(sch.getClZbh(), sch); |
| @@ -164,7 +171,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -164,7 +171,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 164 | } | 171 | } |
| 165 | }catch (Exception e){ | 172 | }catch (Exception e){ |
| 166 | e.printStackTrace(); | 173 | e.printStackTrace(); |
| 167 | - logger.error("", e); | 174 | + logger.error("late2 car arrive", e); |
| 168 | } | 175 | } |
| 169 | } | 176 | } |
| 170 | 177 |
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| @@ -152,7 +152,7 @@ public class SchedulePstThread extends Thread { | @@ -152,7 +152,7 @@ public class SchedulePstThread extends Thread { | ||
| 152 | ps.setBoolean(40, sch.isOnline()); | 152 | ps.setBoolean(40, sch.isOnline()); |
| 153 | ps.setString(41, sch.getAdjustExps()); | 153 | ps.setString(41, sch.getAdjustExps()); |
| 154 | ps.setBoolean(42, sch.isReissue()); | 154 | ps.setBoolean(42, sch.isReissue()); |
| 155 | - ps.setDouble(43, sch.getJhlcOrig()); | 155 | + ps.setDouble(43, sch.getJhlcOrig()==null?0:sch.getJhlcOrig()); |
| 156 | ps.setInt(44, sch.getSiginCompate()); | 156 | ps.setInt(44, sch.getSiginCompate()); |
| 157 | ps.setInt(45, sch.getDriftStatus()); | 157 | ps.setInt(45, sch.getDriftStatus()); |
| 158 | ps.setBoolean(46, sch.isCcService()); | 158 | ps.setBoolean(46, sch.isCcService()); |
src/main/java/com/bsth/entity/geo_data/GeoLineVersionInfo.java
0 → 100644
| 1 | +package com.bsth.entity.geo_data; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 线路版本信息 | ||
| 7 | + * Created by panzhao on 2017/12/18. | ||
| 8 | + */ | ||
| 9 | +public class GeoLineVersionInfo { | ||
| 10 | + /** ID 主键(唯一标识符) int length(11) */ | ||
| 11 | + private Integer id; | ||
| 12 | + | ||
| 13 | + /** 线路版本名字 varchar length(50) | ||
| 14 | + * 给排版人员选版本使用 | ||
| 15 | + * */ | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + /** 线路ID int length(11) */ | ||
| 19 | + private Integer line; | ||
| 20 | + | ||
| 21 | + /** 线路编码 varchar length(50) */ | ||
| 22 | + private String lineCode; | ||
| 23 | + | ||
| 24 | + /** 版本号 int length(11) */ | ||
| 25 | + private int versions; | ||
| 26 | + | ||
| 27 | + /** 启用日期 timestamp */ | ||
| 28 | + private Date startDate; | ||
| 29 | + | ||
| 30 | + /** 终止日期 timestamp */ | ||
| 31 | + private Date endDate; | ||
| 32 | + | ||
| 33 | + /** 创建日期 timestamp */ | ||
| 34 | + private Date createDate; | ||
| 35 | + | ||
| 36 | + /** 修改日期 timestamp */ | ||
| 37 | + private Date updateDate; | ||
| 38 | + | ||
| 39 | + /** 备注 varchar length(50) */ | ||
| 40 | + private String remark; | ||
| 41 | + | ||
| 42 | + /** 版本状态 int length(11) | ||
| 43 | + * 0(历史版本),1(当前版本),2(待更新版本) | ||
| 44 | + */ | ||
| 45 | + private int status; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 是否发布 int length(1) | ||
| 49 | + * 0(没有),1(发布) | ||
| 50 | + */ | ||
| 51 | + private int isupdate; | ||
| 52 | + | ||
| 53 | + private String lineName; | ||
| 54 | + | ||
| 55 | + public Integer getId() { | ||
| 56 | + return id; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public void setId(Integer id) { | ||
| 60 | + this.id = id; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public String getName() { | ||
| 64 | + return name; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public void setName(String name) { | ||
| 68 | + this.name = name; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public String getLineCode() { | ||
| 72 | + return lineCode; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setLineCode(String lineCode) { | ||
| 76 | + this.lineCode = lineCode; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public int getVersions() { | ||
| 80 | + return versions; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public void setVersions(int versions) { | ||
| 84 | + this.versions = versions; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public Date getStartDate() { | ||
| 88 | + return startDate; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public void setStartDate(Date startDate) { | ||
| 92 | + this.startDate = startDate; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public Date getEndDate() { | ||
| 96 | + return endDate; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public void setEndDate(Date endDate) { | ||
| 100 | + this.endDate = endDate; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public Date getCreateDate() { | ||
| 104 | + return createDate; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public void setCreateDate(Date createDate) { | ||
| 108 | + this.createDate = createDate; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public Date getUpdateDate() { | ||
| 112 | + return updateDate; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + public void setUpdateDate(Date updateDate) { | ||
| 116 | + this.updateDate = updateDate; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public String getRemark() { | ||
| 120 | + return remark; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setRemark(String remark) { | ||
| 124 | + this.remark = remark; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public int getStatus() { | ||
| 128 | + return status; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setStatus(int status) { | ||
| 132 | + this.status = status; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public int getIsupdate() { | ||
| 136 | + return isupdate; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setIsupdate(int isupdate) { | ||
| 140 | + this.isupdate = isupdate; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getLineName() { | ||
| 144 | + return lineName; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + public void setLineName(String lineName) { | ||
| 148 | + this.lineName = lineName; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public Integer getLine() { | ||
| 152 | + return line; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public void setLine(Integer line) { | ||
| 156 | + this.line = line; | ||
| 157 | + } | ||
| 158 | +} |
src/main/java/com/bsth/entity/geo_data/GeoStation.java
| 1 | package com.bsth.entity.geo_data; | 1 | package com.bsth.entity.geo_data; |
| 2 | 2 | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 3 | /** | 7 | /** |
| 4 | * Created by panzhao on 2017/12/7. | 8 | * Created by panzhao on 2017/12/7. |
| 5 | */ | 9 | */ |
| @@ -19,14 +23,17 @@ public class GeoStation { | @@ -19,14 +23,17 @@ public class GeoStation { | ||
| 19 | 23 | ||
| 20 | private String stationMark; | 24 | private String stationMark; |
| 21 | 25 | ||
| 22 | - private Integer version; | 26 | + private Integer versions; |
| 23 | 27 | ||
| 24 | private Float gLonx; | 28 | private Float gLonx; |
| 25 | 29 | ||
| 26 | private Float gLaty; | 30 | private Float gLaty; |
| 27 | 31 | ||
| 32 | + @JsonIgnore | ||
| 28 | private String gPolygonGrid; | 33 | private String gPolygonGrid; |
| 29 | 34 | ||
| 35 | + private List<String> bdCoords; | ||
| 36 | + | ||
| 30 | private Integer radius; | 37 | private Integer radius; |
| 31 | 38 | ||
| 32 | private String shapesType; | 39 | private String shapesType; |
| @@ -87,14 +94,6 @@ public class GeoStation { | @@ -87,14 +94,6 @@ public class GeoStation { | ||
| 87 | this.stationMark = stationMark; | 94 | this.stationMark = stationMark; |
| 88 | } | 95 | } |
| 89 | 96 | ||
| 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() { | 97 | public Float getgLonx() { |
| 99 | return gLonx; | 98 | return gLonx; |
| 100 | } | 99 | } |
| @@ -134,4 +133,20 @@ public class GeoStation { | @@ -134,4 +133,20 @@ public class GeoStation { | ||
| 134 | public void setShapesType(String shapesType) { | 133 | public void setShapesType(String shapesType) { |
| 135 | this.shapesType = shapesType; | 134 | this.shapesType = shapesType; |
| 136 | } | 135 | } |
| 137 | -} | 136 | + |
| 137 | + public List<String> getBdCoords() { | ||
| 138 | + return bdCoords; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public void setBdCoords(List<String> bdCoords) { | ||
| 142 | + this.bdCoords = bdCoords; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public Integer getVersions() { | ||
| 146 | + return versions; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setVersions(Integer versions) { | ||
| 150 | + this.versions = versions; | ||
| 151 | + } | ||
| 152 | +} | ||
| 138 | \ No newline at end of file | 153 | \ No newline at end of file |
src/main/java/com/bsth/entity/schedule/TTInfo.java
| @@ -67,6 +67,10 @@ public class TTInfo extends BEntity { | @@ -67,6 +67,10 @@ public class TTInfo extends BEntity { | ||
| 67 | /** 最近备份日期 */ | 67 | /** 最近备份日期 */ |
| 68 | private Date lastBackUpDate; | 68 | private Date lastBackUpDate; |
| 69 | 69 | ||
| 70 | + /** 线路版本(bsth_c_line_versions表对应字段) */ | ||
| 71 | + @Column(nullable = false) | ||
| 72 | + private int lineVersion; | ||
| 73 | + | ||
| 70 | public TTInfo() {} | 74 | public TTInfo() {} |
| 71 | public TTInfo(Object id, Object xlid, Object name, Object nds, Object sds) { | 75 | public TTInfo(Object id, Object xlid, Object name, Object nds, Object sds) { |
| 72 | if (id != null) { | 76 | if (id != null) { |
| @@ -109,7 +113,9 @@ public class TTInfo extends BEntity { | @@ -109,7 +113,9 @@ public class TTInfo extends BEntity { | ||
| 109 | .setUpdateUser(getUpdateBy() == null ? 0 : getUpdateBy().getId()) | 113 | .setUpdateUser(getUpdateBy() == null ? 0 : getUpdateBy().getId()) |
| 110 | .setUpdateUserName(getUpdateBy() == null ? "" : getUpdateBy().getUserName()) | 114 | .setUpdateUserName(getUpdateBy() == null ? "" : getUpdateBy().getUserName()) |
| 111 | .setCreateDate(getCreateDate() == null ? 0l : getCreateDate().getTime()) | 115 | .setCreateDate(getCreateDate() == null ? 0l : getCreateDate().getTime()) |
| 112 | - .setUpdateDate(getUpdateDate() == null ? 0l : getUpdateDate().getTime()); | 116 | + .setUpdateDate(getUpdateDate() == null ? 0l : getUpdateDate().getTime()) |
| 117 | + .setLineVersion(lineVersion) | ||
| 118 | + ; | ||
| 113 | 119 | ||
| 114 | } | 120 | } |
| 115 | 121 | ||
| @@ -216,4 +222,12 @@ public class TTInfo extends BEntity { | @@ -216,4 +222,12 @@ public class TTInfo extends BEntity { | ||
| 216 | public void setLastBackUpDate(Date lastBackUpDate) { | 222 | public void setLastBackUpDate(Date lastBackUpDate) { |
| 217 | this.lastBackUpDate = lastBackUpDate; | 223 | this.lastBackUpDate = lastBackUpDate; |
| 218 | } | 224 | } |
| 225 | + | ||
| 226 | + public int getLineVersion() { | ||
| 227 | + return lineVersion; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + public void setLineVersion(int lineVersion) { | ||
| 231 | + this.lineVersion = lineVersion; | ||
| 232 | + } | ||
| 219 | } | 233 | } |
src/main/java/com/bsth/entity/schedule/TTInfoBackup.java
| @@ -36,6 +36,10 @@ public class TTInfoBackup { | @@ -36,6 +36,10 @@ public class TTInfoBackup { | ||
| 36 | @Lob | 36 | @Lob |
| 37 | private byte[] backUpInfo; | 37 | private byte[] backUpInfo; |
| 38 | 38 | ||
| 39 | + /** 线路版本(bsth_c_line_versions表对应字段) */ | ||
| 40 | + @Column(nullable = false) | ||
| 41 | + private int lineVersion; | ||
| 42 | + | ||
| 39 | public Long getId() { | 43 | public Long getId() { |
| 40 | return id; | 44 | return id; |
| 41 | } | 45 | } |
| @@ -91,4 +95,12 @@ public class TTInfoBackup { | @@ -91,4 +95,12 @@ public class TTInfoBackup { | ||
| 91 | public void setBackUpInfo(byte[] backUpInfo) { | 95 | public void setBackUpInfo(byte[] backUpInfo) { |
| 92 | this.backUpInfo = backUpInfo; | 96 | this.backUpInfo = backUpInfo; |
| 93 | } | 97 | } |
| 98 | + | ||
| 99 | + public int getLineVersion() { | ||
| 100 | + return lineVersion; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setLineVersion(int lineVersion) { | ||
| 104 | + this.lineVersion = lineVersion; | ||
| 105 | + } | ||
| 94 | } | 106 | } |
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
| @@ -100,6 +100,10 @@ public class TTInfoDetail extends BEntity { | @@ -100,6 +100,10 @@ public class TTInfoDetail extends BEntity { | ||
| 100 | /** 备注 */ | 100 | /** 备注 */ |
| 101 | private String remark; | 101 | private String remark; |
| 102 | 102 | ||
| 103 | + /** 线路版本(bsth_c_line_versions表对应字段) */ | ||
| 104 | + @Column(nullable = false) | ||
| 105 | + private int lineVersion; | ||
| 106 | + | ||
| 103 | /** | 107 | /** |
| 104 | * 输出proto生成的builder | 108 | * 输出proto生成的builder |
| 105 | * @return | 109 | * @return |
| @@ -126,6 +130,7 @@ public class TTInfoDetail extends BEntity { | @@ -126,6 +130,7 @@ public class TTInfoDetail extends BEntity { | ||
| 126 | .setIsFB(isFB == null ? false : isFB) | 130 | .setIsFB(isFB == null ? false : isFB) |
| 127 | .setIsTS(isTS == null ? false : isTS) | 131 | .setIsTS(isTS == null ? false : isTS) |
| 128 | .setRemark(remark == null ? "" : remark) | 132 | .setRemark(remark == null ? "" : remark) |
| 133 | + .setLineVersion(lineVersion) | ||
| 129 | ; | 134 | ; |
| 130 | } | 135 | } |
| 131 | 136 | ||
| @@ -320,4 +325,12 @@ public class TTInfoDetail extends BEntity { | @@ -320,4 +325,12 @@ public class TTInfoDetail extends BEntity { | ||
| 320 | public void setIsTS(Boolean isTS) { | 325 | public void setIsTS(Boolean isTS) { |
| 321 | this.isTS = isTS; | 326 | this.isTS = isTS; |
| 322 | } | 327 | } |
| 328 | + | ||
| 329 | + public int getLineVersion() { | ||
| 330 | + return lineVersion; | ||
| 331 | + } | ||
| 332 | + | ||
| 333 | + public void setLineVersion(int lineVersion) { | ||
| 334 | + this.lineVersion = lineVersion; | ||
| 335 | + } | ||
| 323 | } | 336 | } |
src/main/java/com/bsth/service/geo_data/GeoDataService.java
| 1 | package com.bsth.service.geo_data; | 1 | package com.bsth.service.geo_data; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.geo_data.GeoRoad; | ||
| 3 | import com.bsth.entity.geo_data.GeoStation; | 4 | import com.bsth.entity.geo_data.GeoStation; |
| 4 | 5 | ||
| 5 | import java.util.Map; | 6 | import java.util.Map; |
| @@ -15,5 +16,19 @@ public interface GeoDataService { | @@ -15,5 +16,19 @@ public interface GeoDataService { | ||
| 15 | 16 | ||
| 16 | Map<String, Object> findGeoRoad(String lineCode); | 17 | Map<String, Object> findGeoRoad(String lineCode); |
| 17 | 18 | ||
| 18 | - Map<String,Object> updateBufferInfo(GeoStation station); | 19 | + Map<String, Object> updateBufferInfo(GeoStation station); |
| 20 | + | ||
| 21 | + Map<String, Object> updateStationName(Map<String, Object> map); | ||
| 22 | + | ||
| 23 | + Map<String,Object> addNewStationRoute(String lineCode, int upDown,int versions, String stationName, Float lat, Float lng, int prevRouteId); | ||
| 24 | + | ||
| 25 | + Map<String,Object> destroyStation(GeoStation station); | ||
| 26 | + | ||
| 27 | + Map<String,Object> updateRoadInfo(GeoRoad road); | ||
| 28 | + | ||
| 29 | + Map<String,Object> destroyRoad(GeoRoad road); | ||
| 30 | + | ||
| 31 | + Map<String,Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId); | ||
| 32 | + | ||
| 33 | + Map<String,Object> findVersionInfo(String lineCode); | ||
| 19 | } | 34 | } |
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
| 1 | package com.bsth.service.geo_data.impl; | 1 | package com.bsth.service.geo_data.impl; |
| 2 | 2 | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | +import com.bsth.entity.geo_data.GeoLineVersionInfo; | ||
| 4 | import com.bsth.entity.geo_data.GeoRoad; | 5 | import com.bsth.entity.geo_data.GeoRoad; |
| 5 | import com.bsth.entity.geo_data.GeoStation; | 6 | import com.bsth.entity.geo_data.GeoStation; |
| 6 | import com.bsth.service.geo_data.GeoDataService; | 7 | import com.bsth.service.geo_data.GeoDataService; |
| 8 | +import com.bsth.util.GetUIDAndCode; | ||
| 7 | import com.bsth.util.TransGPS; | 9 | import com.bsth.util.TransGPS; |
| 8 | import com.google.common.base.Splitter; | 10 | import com.google.common.base.Splitter; |
| 9 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 12 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 15 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| 13 | import org.springframework.jdbc.core.JdbcTemplate; | 16 | import org.springframework.jdbc.core.JdbcTemplate; |
| 17 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 14 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 19 | +import org.springframework.transaction.TransactionDefinition; | ||
| 20 | +import org.springframework.transaction.TransactionStatus; | ||
| 21 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 15 | 22 | ||
| 16 | -import java.util.ArrayList; | ||
| 17 | -import java.util.HashMap; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | 23 | +import java.sql.PreparedStatement; |
| 24 | +import java.sql.SQLException; | ||
| 25 | +import java.util.*; | ||
| 20 | 26 | ||
| 21 | /** | 27 | /** |
| 22 | * Created by panzhao on 2017/12/8. | 28 | * Created by panzhao on 2017/12/8. |
| @@ -33,15 +39,19 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -33,15 +39,19 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 33 | public Map<String, Object> findGeoStations(String lineCode) { | 39 | public Map<String, Object> findGeoStations(String lineCode) { |
| 34 | 40 | ||
| 35 | Map<String, Object> map = new HashMap(); | 41 | 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"; | 42 | + try { |
| 43 | + 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 | 44 | ||
| 39 | 45 | ||
| 40 | List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | 46 | List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); |
| 41 | 47 | ||
| 48 | + for (GeoStation station : list) { | ||
| 49 | + if (station.getShapesType().equals("d")) | ||
| 50 | + station.setBdCoords(multiWgsToBd(station.getgPolygonGrid(), 9, 3)); | ||
| 51 | + } | ||
| 42 | map.put("status", ResponseCode.SUCCESS); | 52 | map.put("status", ResponseCode.SUCCESS); |
| 43 | map.put("list", list); | 53 | map.put("list", list); |
| 44 | - }catch (Exception e){ | 54 | + } catch (Exception e) { |
| 45 | logger.error("", e); | 55 | logger.error("", e); |
| 46 | map.put("status", ResponseCode.ERROR); | 56 | map.put("status", ResponseCode.ERROR); |
| 47 | map.put("msg", "服务器出现异常"); | 57 | map.put("msg", "服务器出现异常"); |
| @@ -52,18 +62,18 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -52,18 +62,18 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 52 | @Override | 62 | @Override |
| 53 | public Map<String, Object> findGeoRoad(String lineCode) { | 63 | public Map<String, Object> findGeoRoad(String lineCode) { |
| 54 | Map<String, Object> map = new HashMap(); | 64 | 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"; | 65 | + try { |
| 66 | + 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 | 67 | ||
| 58 | 68 | ||
| 59 | List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); | 69 | List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); |
| 60 | 70 | ||
| 61 | - for(GeoRoad road : list){ | ||
| 62 | - road.setBdCoords(multiWgsToBd(road.getGsectionVector())); | 71 | + for (GeoRoad road : list) { |
| 72 | + road.setBdCoords(multiWgsToBd(road.getGsectionVector(), 11, 2)); | ||
| 63 | } | 73 | } |
| 64 | map.put("status", ResponseCode.SUCCESS); | 74 | map.put("status", ResponseCode.SUCCESS); |
| 65 | map.put("list", list); | 75 | map.put("list", list); |
| 66 | - }catch (Exception e){ | 76 | + } catch (Exception e) { |
| 67 | logger.error("", e); | 77 | logger.error("", e); |
| 68 | map.put("status", ResponseCode.ERROR); | 78 | map.put("status", ResponseCode.ERROR); |
| 69 | map.put("msg", "服务器出现异常"); | 79 | map.put("msg", "服务器出现异常"); |
| @@ -73,13 +83,14 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -73,13 +83,14 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 73 | 83 | ||
| 74 | /** | 84 | /** |
| 75 | * 编辑缓冲区信息 | 85 | * 编辑缓冲区信息 |
| 86 | + * | ||
| 76 | * @param station | 87 | * @param station |
| 77 | * @return | 88 | * @return |
| 78 | */ | 89 | */ |
| 79 | @Override | 90 | @Override |
| 80 | public Map<String, Object> updateBufferInfo(GeoStation station) { | 91 | public Map<String, Object> updateBufferInfo(GeoStation station) { |
| 81 | Map<String, Object> rs = new HashMap<>(); | 92 | Map<String, Object> rs = new HashMap<>(); |
| 82 | - try{ | 93 | + try { |
| 83 | //坐标转换 | 94 | //坐标转换 |
| 84 | TransGPS.Location loc = TransGPS.LocationMake(station.getgLonx(), station.getgLaty()); | 95 | TransGPS.Location loc = TransGPS.LocationMake(station.getgLonx(), station.getgLaty()); |
| 85 | loc = TransGPS.bd_decrypt(loc); | 96 | loc = TransGPS.bd_decrypt(loc); |
| @@ -88,20 +99,167 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -88,20 +99,167 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 88 | station.setgLonx(Float.parseFloat(String.valueOf(loc.getLng()))); | 99 | station.setgLonx(Float.parseFloat(String.valueOf(loc.getLng()))); |
| 89 | 100 | ||
| 90 | String sql; | 101 | 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()); | 102 | + String shapesType = station.getShapesType(); |
| 103 | + int rsCount = -1; | ||
| 104 | + if (shapesType.equals("r")) { | ||
| 105 | + sql = "update bsth_c_station set g_lonx=?, g_laty=?, radius=?,shapes_type='r' where station_cod=?"; | ||
| 106 | + rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getRadius(), station.getStationCode()); | ||
| 107 | + } else if (shapesType.equals("d")) { | ||
| 108 | + //多边形坐标转换 | ||
| 109 | + String bdPolygon = "POLYGON((" + station.getgPolygonGrid() + "))"; | ||
| 110 | + String wgsPolygon = "POLYGON((" + bdPolygon2Wgs(station.getgPolygonGrid()) + "))"; | ||
| 111 | + sql = "update bsth_c_station set g_lonx=?, g_laty=?,shapes_type='d', radius=null,b_polygon_grid=ST_GeomFromText('" + bdPolygon + "'),g_polygon_grid=ST_GeomFromText('" + wgsPolygon + "') where station_cod=?"; | ||
| 112 | + | ||
| 113 | + rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getStationCode()); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + //从数据库里重新查询对象 | ||
| 117 | + if (rsCount > 0) { | ||
| 118 | + rs.put("station", findOne(station.getId())); | ||
| 119 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + } catch (Exception e) { | ||
| 123 | + logger.error("", e); | ||
| 124 | + rs.put("status", ResponseCode.ERROR); | ||
| 125 | + rs.put("msg", "服务器出现异常"); | ||
| 126 | + } | ||
| 127 | + return rs; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * 修改站点路由和站点名称 | ||
| 132 | + * | ||
| 133 | + * @param map | ||
| 134 | + * @return | ||
| 135 | + */ | ||
| 136 | + @Override | ||
| 137 | + public Map<String, Object> updateStationName(Map<String, Object> map) { | ||
| 138 | + Map<String, Object> rs = new HashMap<>(); | ||
| 139 | + | ||
| 140 | + //编程式事务 | ||
| 141 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | ||
| 142 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 143 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 144 | + TransactionStatus status = tran.getTransaction(def); | ||
| 145 | + try { | ||
| 146 | + | ||
| 147 | + int id = Integer.parseInt(map.get("id").toString()); | ||
| 148 | + String name = map.get("stationName").toString(); | ||
| 149 | + String code = map.get("stationCode").toString(); | ||
| 150 | + //String lineCode = map.get("lineCode").toString(); | ||
| 151 | + //String stationMark = map.get("stationMark").toString(); | ||
| 94 | 152 | ||
| 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)); | 153 | + //更新历史站点路由 |
| 154 | + jdbcTemplate.update("update bsth_c_ls_stationroute set station_name=? where id=?", name, id); | ||
| 155 | + //更新站点 | ||
| 156 | + jdbcTemplate.update("update bsth_c_station set station_name=? where station_cod=?", name, code); | ||
| 98 | 157 | ||
| 99 | - rs.put("station", list.get(0)); | ||
| 100 | - rs.put("status", ResponseCode.SUCCESS); | 158 | + tran.commit(status); |
| 159 | + | ||
| 160 | + rs.put("station", findOne(id)); | ||
| 161 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 162 | + } catch (Exception e) { | ||
| 163 | + tran.rollback(status); | ||
| 164 | + logger.error("", e); | ||
| 165 | + rs.put("status", ResponseCode.ERROR); | ||
| 166 | + rs.put("msg", "服务器出现异常"); | ||
| 167 | + } | ||
| 168 | + return rs; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public Map<String, Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId) { | ||
| 173 | + Map<String, Object> rs = new HashMap<>(); | ||
| 174 | + | ||
| 175 | + //编程式事务 | ||
| 176 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | ||
| 177 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 178 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 179 | + TransactionStatus status = tran.getTransaction(def); | ||
| 180 | + try { | ||
| 181 | + //根据站点编码,查询站点ID | ||
| 182 | + int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class); | ||
| 183 | + | ||
| 184 | + String sql = "select * from bsth_c_ls_sectionroute where line_code='" + lineCode + "' and line=" + lineId + " and directions=" + upDown + " and destroy=0 and versions=" + versions; | ||
| 185 | + List<SaveRoadRouteDTO> routes = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SaveRoadRouteDTO.class)); | ||
| 186 | + | ||
| 187 | + Collections.sort(routes, new RoadRouteComp()); | ||
| 188 | + | ||
| 189 | + long sCode = GetUIDAndCode.getSectionId(); | ||
| 190 | + //转wgs | ||
| 191 | + String wgsCoord = "LINESTRING(" + bdPolygon2Wgs(coords) + ")"; | ||
| 192 | + String bdCooed = "LINESTRING(" + coords + ")"; | ||
| 193 | + //insert 路段 | ||
| 194 | + sql = "insert into bsth_c_section(id, section_code, section_name, croses_road, bsection_vector, gsection_vector, create_date, update_date, versions) " + | ||
| 195 | + " values(?,?,?,?,ST_GeomFromText('"+bdCooed+"'),ST_GeomFromText('"+wgsCoord+"'),sysdate(),sysdate(),?)"; | ||
| 196 | + | ||
| 197 | + jdbcTemplate.update(sql, sCode, sCode, sectionName, crosesRoad, 1); | ||
| 198 | + | ||
| 199 | + | ||
| 200 | + SaveRoadRouteDTO srr; | ||
| 201 | + int currentNo = -1, | ||
| 202 | + no = 100, step = 100; | ||
| 203 | + | ||
| 204 | + if (prevRouteId == -1) { | ||
| 205 | + //起点站 | ||
| 206 | + currentNo = no; | ||
| 207 | + no += step; | ||
| 208 | + } | ||
| 209 | + //重新排序路由 | ||
| 210 | + for (int i = 0, size = routes.size(); i < size; i++) { | ||
| 211 | + srr = routes.get(i); | ||
| 212 | + srr.setSectionrouteCode(no += step); | ||
| 213 | + if (srr.getId().intValue() == prevRouteId) { | ||
| 214 | + no += step; | ||
| 215 | + currentNo = no; | ||
| 101 | } | 216 | } |
| 102 | } | 217 | } |
| 103 | 218 | ||
| 104 | - }catch (Exception e){ | 219 | + srr = new SaveRoadRouteDTO(); |
| 220 | + srr.setLine(lineId); | ||
| 221 | + srr.setLineCode(lineCode); | ||
| 222 | + srr.setDirections(upDown); | ||
| 223 | + srr.setVersions(versions); | ||
| 224 | + | ||
| 225 | + srr.setSectionrouteCode(currentNo); | ||
| 226 | + srr.setSection(sCode); | ||
| 227 | + srr.setSectionCode(sCode + ""); | ||
| 228 | + srr.setIsRoadeSpeed(0); | ||
| 229 | + srr.setDestroy(0); | ||
| 230 | + Date d = new Date(); | ||
| 231 | + srr.setCreateDate(d); | ||
| 232 | + srr.setUpdateDate(d); | ||
| 233 | + | ||
| 234 | + final List<SaveRoadRouteDTO> saveList = routes; | ||
| 235 | + //insert 新路由 (ID自增) | ||
| 236 | + jdbcTemplate.update("insert into bsth_c_ls_sectionroute(line_code, section_code, sectionroute_code, directions, line, section, create_date,update_date,versions,destroy,is_roade_speed)" + | ||
| 237 | + " values(?,?,?,?,?,?,?,?,?,?,?)", srr.getLineCode(), srr.getSectionCode(), srr.getSectionrouteCode(), srr.getDirections(), srr.getLine(), srr.getSection(), srr.getCreateDate(), srr.getUpdateDate(), versions, srr.getDestroy(), srr.getIsRoadeSpeed()); | ||
| 238 | + | ||
| 239 | + // update 原路由 | ||
| 240 | + jdbcTemplate.batchUpdate("update bsth_c_ls_sectionroute set sectionroute_code=? where id=?" | ||
| 241 | + , new BatchPreparedStatementSetter() { | ||
| 242 | + @Override | ||
| 243 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 244 | + SaveRoadRouteDTO srr = saveList.get(i); | ||
| 245 | + ps.setInt(1, srr.getSectionrouteCode()); | ||
| 246 | + ps.setInt(2, srr.getId()); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + @Override | ||
| 250 | + public int getBatchSize() { | ||
| 251 | + return saveList.size(); | ||
| 252 | + } | ||
| 253 | + }); | ||
| 254 | + | ||
| 255 | + tran.commit(status); | ||
| 256 | + | ||
| 257 | + //返回更新之后的数据 | ||
| 258 | + List<GeoRoad> list = findRoadByUpdown(lineCode, upDown, versions); | ||
| 259 | + rs.put("list", list); | ||
| 260 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 261 | + } catch (Exception e) { | ||
| 262 | + tran.rollback(status); | ||
| 105 | logger.error("", e); | 263 | logger.error("", e); |
| 106 | rs.put("status", ResponseCode.ERROR); | 264 | rs.put("status", ResponseCode.ERROR); |
| 107 | rs.put("msg", "服务器出现异常"); | 265 | rs.put("msg", "服务器出现异常"); |
| @@ -110,24 +268,334 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -110,24 +268,334 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 110 | } | 268 | } |
| 111 | 269 | ||
| 112 | /** | 270 | /** |
| 271 | + * 获取线路版本信息 | ||
| 272 | + * @param lineCode | ||
| 273 | + * @return | ||
| 274 | + */ | ||
| 275 | + @Override | ||
| 276 | + public Map<String, Object> findVersionInfo(String lineCode) { | ||
| 277 | + Map<String, Object> rs = new HashMap<>(); | ||
| 278 | + | ||
| 279 | + try { | ||
| 280 | + String sql = "select t1.*,t2.name as line_name from bsth_c_line_versions t1 LEFT JOIN bsth_c_line t2 on t1.line_code=t2.line_code where t1.line_code='"+lineCode+"'"; | ||
| 281 | + | ||
| 282 | + List<GeoLineVersionInfo> list = | ||
| 283 | + jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoLineVersionInfo.class)); | ||
| 284 | + | ||
| 285 | + rs.put("list", list); | ||
| 286 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 287 | + } catch (Exception e) { | ||
| 288 | + logger.error("", e); | ||
| 289 | + rs.put("status", ResponseCode.ERROR); | ||
| 290 | + rs.put("msg", "服务器出现异常"); | ||
| 291 | + } | ||
| 292 | + return rs; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + @Override | ||
| 296 | + public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) { | ||
| 297 | + Map<String, Object> rs = new HashMap<>(); | ||
| 298 | + | ||
| 299 | + //编程式事务 | ||
| 300 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | ||
| 301 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 302 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 303 | + TransactionStatus status = tran.getTransaction(def); | ||
| 304 | + try { | ||
| 305 | + //根据线路编码,查询线路ID | ||
| 306 | + int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class); | ||
| 307 | + | ||
| 308 | + String sql = "select * from bsth_c_ls_stationroute where line_code='" + lineCode + "' and line=" + lineId + " and directions=" + upDown + " and destroy=0 and versions=" + versions; | ||
| 309 | + List<SaveStationRouteDTO> routes = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SaveStationRouteDTO.class)); | ||
| 310 | + | ||
| 311 | + for (SaveStationRouteDTO s : routes) { | ||
| 312 | + if (s.getStationName().equals(stationName)) { | ||
| 313 | + | ||
| 314 | + rs.put("status", ResponseCode.ERROR); | ||
| 315 | + rs.put("msg", "重复的站点路由名称!"); | ||
| 316 | + return rs; | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + //按路由顺序排列 | ||
| 320 | + Collections.sort(routes, new StationRouteComp()); | ||
| 321 | + | ||
| 322 | + //转WGS | ||
| 323 | + TransGPS.Location wgsLoc = TransGPS.transformFromGCJToWGS(TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(String.valueOf(lng)), Double.parseDouble(String.valueOf(lat))))); | ||
| 324 | + | ||
| 325 | + //insert 站点 | ||
| 326 | + long sCode = GetUIDAndCode.getStationId(); | ||
| 327 | + jdbcTemplate.update("insert into bsth_c_station(id, station_cod, station_name, db_type, b_jwpoints, g_lonx, g_laty, destroy, radius, shapes_type, versions) " + | ||
| 328 | + " values(?,?,?,?,?,?,?,?,?,?,?)", sCode, sCode, stationName, "b", lng + " " + lat, wgsLoc.getLng(), wgsLoc.getLat(), 0, 88, "r", 1); | ||
| 329 | + | ||
| 330 | + | ||
| 331 | + SaveStationRouteDTO sr; | ||
| 332 | + int currentNo = -1, | ||
| 333 | + no = 100, step = 100; | ||
| 334 | + | ||
| 335 | + if (prevRouteId == -1) { | ||
| 336 | + //起点站 | ||
| 337 | + currentNo = no; | ||
| 338 | + no += step; | ||
| 339 | + } | ||
| 340 | + //重新排序路由 | ||
| 341 | + for (int i = 0, size = routes.size(); i < size; i++) { | ||
| 342 | + sr = routes.get(i); | ||
| 343 | + sr.setStationRouteCode(no += step); | ||
| 344 | + if (sr.getId().intValue() == prevRouteId) { | ||
| 345 | + no += step; | ||
| 346 | + currentNo = no; | ||
| 347 | + } | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + SaveStationRouteDTO nsr = new SaveStationRouteDTO(); | ||
| 351 | + nsr.setLine(lineId); | ||
| 352 | + nsr.setLineCode(lineCode); | ||
| 353 | + nsr.setDirections(upDown); | ||
| 354 | + nsr.setVersions(versions); | ||
| 355 | + nsr.setStationRouteCode(currentNo); | ||
| 356 | + nsr.setStation(sCode); | ||
| 357 | + nsr.setStationCode(sCode + ""); | ||
| 358 | + nsr.setStationName(stationName); | ||
| 359 | + nsr.setDistances(0d); | ||
| 360 | + nsr.setToTime(0d); | ||
| 361 | + Date d = new Date(); | ||
| 362 | + nsr.setCreateDate(d); | ||
| 363 | + nsr.setUpdateDate(d); | ||
| 364 | + nsr.setDestroy(0); | ||
| 365 | + | ||
| 366 | + //routes.add(sr); | ||
| 367 | + | ||
| 368 | + //重新标记mark | ||
| 369 | + Collections.sort(routes, new StationRouteComp()); | ||
| 370 | + for (int i = 0, size = routes.size(); i < size; i++) { | ||
| 371 | + routes.get(i).setStationMark("Z"); | ||
| 372 | + } | ||
| 373 | + routes.get(0).setStationMark("B"); | ||
| 374 | + routes.get(routes.size() - 1).setStationMark("E"); | ||
| 375 | + | ||
| 376 | + final List<SaveStationRouteDTO> saveList = routes; | ||
| 377 | + //insert 新路由 (ID自增) | ||
| 378 | + jdbcTemplate.update("insert into bsth_c_ls_stationroute(line, station, station_name, station_route_code, line_code, station_code, station_mark, distances, to_time, destroy, versions, create_date, update_date,directions) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)" | ||
| 379 | + , nsr.getLine(), nsr.getStation(), nsr.getStationName(), nsr.getStationRouteCode(), nsr.getLineCode(), nsr.getStationCode(), nsr.getStationMark() | ||
| 380 | + , nsr.getDistances(), nsr.getToTime(), nsr.getDestroy(), nsr.getVersions(), nsr.getCreateDate(), nsr.getUpdateDate(), nsr.getDirections()); | ||
| 381 | + | ||
| 382 | + // update 原路由 | ||
| 383 | + jdbcTemplate.batchUpdate("update bsth_c_ls_stationroute set line=?,station=?,station_name=?,station_route_code=?," + | ||
| 384 | + "line_code=?,station_code=?,station_mark=?,distances=?,to_time=?,destroy=?,versions=?,create_date=?,update_date=?,directions=?" + | ||
| 385 | + " where id=?" | ||
| 386 | + , new BatchPreparedStatementSetter() { | ||
| 387 | + @Override | ||
| 388 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 389 | + SaveStationRouteDTO sr = saveList.get(i); | ||
| 390 | + ps.setInt(1, sr.getLine()); | ||
| 391 | + ps.setLong(2, sr.getStation()); | ||
| 392 | + ps.setString(3, sr.getStationName()); | ||
| 393 | + ps.setInt(4, sr.getStationRouteCode()); | ||
| 394 | + ps.setString(5, sr.getLineCode()); | ||
| 395 | + ps.setString(6, sr.getStationCode()); | ||
| 396 | + ps.setString(7, sr.getStationMark()); | ||
| 397 | + ps.setDouble(8, sr.getDistances()); | ||
| 398 | + ps.setDouble(9, sr.getToTime()); | ||
| 399 | + ps.setInt(10, sr.getDestroy()); | ||
| 400 | + ps.setInt(11, sr.getVersions()); | ||
| 401 | + ps.setTimestamp(12, new java.sql.Timestamp(sr.getCreateDate().getTime())); | ||
| 402 | + ps.setTimestamp(13, new java.sql.Timestamp(sr.getUpdateDate().getTime())); | ||
| 403 | + ps.setInt(14, sr.getDirections()); | ||
| 404 | + ps.setInt(15, sr.getId()); | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + @Override | ||
| 408 | + public int getBatchSize() { | ||
| 409 | + return saveList.size(); | ||
| 410 | + } | ||
| 411 | + }); | ||
| 412 | + | ||
| 413 | + tran.commit(status); | ||
| 414 | + | ||
| 415 | + //返回更新之后的数据 | ||
| 416 | + List<GeoStation> list = findByUpdown(lineCode, upDown, versions); | ||
| 417 | + | ||
| 418 | + rs.put("list", list); | ||
| 419 | + rs.put("newStationRouteCode", currentNo); | ||
| 420 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 421 | + } catch (Exception e) { | ||
| 422 | + tran.rollback(status); | ||
| 423 | + logger.error("", e); | ||
| 424 | + rs.put("status", ResponseCode.ERROR); | ||
| 425 | + rs.put("msg", "服务器出现异常"); | ||
| 426 | + } | ||
| 427 | + return rs; | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + private List<GeoStation> findByUpdown(String lineCode, int upDown, int versions) { | ||
| 431 | + //返回更新之后的数据 | ||
| 432 | + 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 directions=" + upDown + " and destroy=0 and versions=" + versions + ") t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod"; | ||
| 433 | + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | ||
| 434 | + | ||
| 435 | + for (GeoStation station : list) { | ||
| 436 | + if (station.getShapesType().equals("d")) | ||
| 437 | + station.setBdCoords(multiWgsToBd(station.getgPolygonGrid(), 9, 3)); | ||
| 438 | + } | ||
| 439 | + return list; | ||
| 440 | + } | ||
| 441 | + | ||
| 442 | + private List<GeoRoad> findRoadByUpdown(String lineCode, int upDown, int versions) { | ||
| 443 | + //返回更新之后的数据 | ||
| 444 | + 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 directions=" + upDown + " and destroy=0 and versions=" + versions + ") t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code"; | ||
| 445 | + List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); | ||
| 446 | + | ||
| 447 | + for (GeoRoad road : list) { | ||
| 448 | + road.setBdCoords(multiWgsToBd(road.getGsectionVector(), 11, 2)); | ||
| 449 | + } | ||
| 450 | + return list; | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + @Override | ||
| 454 | + public Map<String, Object> destroyStation(GeoStation station) { | ||
| 455 | + Map<String, Object> rs = new HashMap<>(); | ||
| 456 | + | ||
| 457 | + try { | ||
| 458 | + String sql = "update bsth_c_ls_stationroute set destroy=1 where id=?"; | ||
| 459 | + jdbcTemplate.update(sql, station.getId()); | ||
| 460 | + | ||
| 461 | + //返回更新之后的数据 | ||
| 462 | + List<GeoStation> list = findByUpdown(station.getLineCode(), station.getDirections(), station.getVersions()); | ||
| 463 | + rs.put("list", list); | ||
| 464 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 465 | + } catch (Exception e) { | ||
| 466 | + logger.error("", e); | ||
| 467 | + rs.put("status", ResponseCode.ERROR); | ||
| 468 | + rs.put("msg", "服务器出现异常"); | ||
| 469 | + } | ||
| 470 | + return rs; | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + @Override | ||
| 474 | + public Map<String, Object> destroyRoad(GeoRoad road) { | ||
| 475 | + Map<String, Object> rs = new HashMap<>(); | ||
| 476 | + | ||
| 477 | + try { | ||
| 478 | + String sql = "update bsth_c_ls_sectionroute set destroy=1 where id=?"; | ||
| 479 | + jdbcTemplate.update(sql, road.getId()); | ||
| 480 | + | ||
| 481 | + //返回更新之后的数据 | ||
| 482 | + List<GeoRoad> list = findRoadByUpdown(road.getLineCode(), road.getDirections(), road.getVersions()); | ||
| 483 | + rs.put("list", list); | ||
| 484 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 485 | + } catch (Exception e) { | ||
| 486 | + logger.error("", e); | ||
| 487 | + rs.put("status", ResponseCode.ERROR); | ||
| 488 | + rs.put("msg", "服务器出现异常"); | ||
| 489 | + } | ||
| 490 | + return rs; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + @Override | ||
| 494 | + public Map<String, Object> updateRoadInfo(GeoRoad road) { | ||
| 495 | + Map<String, Object> rs = new HashMap<>(); | ||
| 496 | + | ||
| 497 | + try { | ||
| 498 | + //坐标转换 | ||
| 499 | + String bdPolyline = "LINESTRING(" + road.getGsectionVector() + ")"; | ||
| 500 | + String wgsPolyline = "LINESTRING(" + bdPolygon2Wgs(road.getGsectionVector()) + ")"; | ||
| 501 | + | ||
| 502 | + String sql = "update bsth_c_section set section_name=?, croses_road=?, bsection_vector=ST_GeomFromText('" + bdPolyline + "'),gsection_vector=ST_GeomFromText('" + wgsPolyline + "'),update_date=sysdate() where section_code=?"; | ||
| 503 | + | ||
| 504 | + int rsCount = jdbcTemplate.update(sql, road.getSectionName(), road.getCrosesRoad(), road.getSectionCode()); | ||
| 505 | + | ||
| 506 | + //从数据库里重新查询对象 | ||
| 507 | + if (rsCount > 0) { | ||
| 508 | + rs.put("road", findOneRoad(road.getId())); | ||
| 509 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 510 | + } | ||
| 511 | + } catch (Exception e) { | ||
| 512 | + logger.error("", e); | ||
| 513 | + rs.put("status", ResponseCode.ERROR); | ||
| 514 | + rs.put("msg", "服务器出现异常"); | ||
| 515 | + } | ||
| 516 | + return rs; | ||
| 517 | + } | ||
| 518 | + | ||
| 519 | + | ||
| 520 | + /** | ||
| 521 | + * 根据路由ID 获取站点 | ||
| 522 | + * | ||
| 523 | + * @param id | ||
| 524 | + * @return | ||
| 525 | + */ | ||
| 526 | + private GeoStation findOne(int id) { | ||
| 527 | + 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 id=" + id + " AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod"; | ||
| 528 | + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | ||
| 529 | + | ||
| 530 | + GeoStation s = list.get(0); | ||
| 531 | + if (s.getShapesType().equals("d")) | ||
| 532 | + s.setBdCoords(multiWgsToBd(s.getgPolygonGrid(), 9, 3)); | ||
| 533 | + | ||
| 534 | + return s; | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + private GeoRoad findOneRoad(int id) { | ||
| 538 | + 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 id=" + id + ") t1 LEFT JOIN bsth_c_section t2 ON t1.section_code = t2.section_code"; | ||
| 539 | + List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); | ||
| 540 | + | ||
| 541 | + for (GeoRoad road : list) { | ||
| 542 | + road.setBdCoords(multiWgsToBd(road.getGsectionVector(), 11, 2)); | ||
| 543 | + } | ||
| 544 | + return list.size() > 0 ? list.get(0) : null; | ||
| 545 | + } | ||
| 546 | + | ||
| 547 | + private String bdPolygon2Wgs(String bdPolygon) { | ||
| 548 | + StringBuilder wgsPolygon = new StringBuilder(); | ||
| 549 | + List<String> list = Splitter.on(",").splitToList(bdPolygon); | ||
| 550 | + String[] array; | ||
| 551 | + | ||
| 552 | + TransGPS.Location location; | ||
| 553 | + for (String p : list) { | ||
| 554 | + array = p.split(" "); | ||
| 555 | + location = TransGPS.transformFromGCJToWGS(TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(array[0]), Double.parseDouble(array[1])))); | ||
| 556 | + | ||
| 557 | + wgsPolygon.append(location.getLng() + " " + location.getLat() + ","); | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + if (wgsPolygon.length() > 0) { | ||
| 561 | + wgsPolygon.deleteCharAt(wgsPolygon.length() - 1); | ||
| 562 | + } | ||
| 563 | + return wgsPolygon.toString(); | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + /** | ||
| 113 | * wgs 坐标数组转 百度 | 567 | * wgs 坐标数组转 百度 |
| 114 | * | 568 | * |
| 115 | * @return | 569 | * @return |
| 116 | */ | 570 | */ |
| 117 | - private List<String> multiWgsToBd(String crdStr) { | 571 | + private List<String> multiWgsToBd(String crdStr, int si, int ei) { |
| 118 | List<String> bdList = new ArrayList<>(); | 572 | List<String> bdList = new ArrayList<>(); |
| 119 | 573 | ||
| 120 | - List<String> gList = Splitter.on(",").splitToList(crdStr.substring(11, crdStr.length() - 2)); | 574 | + List<String> gList = Splitter.on(",").splitToList(crdStr.substring(si, crdStr.length() - ei)); |
| 121 | TransGPS.Location location; | 575 | TransGPS.Location location; |
| 122 | - //StringBuilder itemStr = new StringBuilder(); | ||
| 123 | String[] cds; | 576 | String[] cds; |
| 124 | - for(String gs : gList){ | 577 | + for (String gs : gList) { |
| 125 | cds = gs.split(" "); | 578 | cds = gs.split(" "); |
| 126 | location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])))); | 579 | location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])))); |
| 127 | - //itemStr.append(location.getLng() + " " + location.getLat() + ","); | ||
| 128 | 580 | ||
| 129 | bdList.add(location.getLng() + " " + location.getLat()); | 581 | bdList.add(location.getLng() + " " + location.getLat()); |
| 130 | } | 582 | } |
| 131 | return bdList; | 583 | return bdList; |
| 132 | } | 584 | } |
| 133 | -} | 585 | + |
| 586 | + private static class StationRouteComp implements Comparator<SaveStationRouteDTO> { | ||
| 587 | + | ||
| 588 | + @Override | ||
| 589 | + public int compare(SaveStationRouteDTO s1, SaveStationRouteDTO s2) { | ||
| 590 | + return s1.getStationRouteCode() - s2.getStationRouteCode(); | ||
| 591 | + } | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + private static class RoadRouteComp implements Comparator<SaveRoadRouteDTO> { | ||
| 595 | + | ||
| 596 | + @Override | ||
| 597 | + public int compare(SaveRoadRouteDTO s1, SaveRoadRouteDTO s2) { | ||
| 598 | + return s1.getSectionrouteCode() - s2.getSectionrouteCode(); | ||
| 599 | + } | ||
| 600 | + } | ||
| 601 | +} | ||
| 134 | \ No newline at end of file | 602 | \ No newline at end of file |
src/main/java/com/bsth/service/geo_data/impl/SaveRoadRouteDTO.java
0 → 100644
| 1 | +package com.bsth.service.geo_data.impl; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by panzhao on 2017/12/17. | ||
| 7 | + */ | ||
| 8 | +public class SaveRoadRouteDTO { | ||
| 9 | + | ||
| 10 | + private Integer id; | ||
| 11 | + | ||
| 12 | + // 路段路由序号 | ||
| 13 | + private Integer sectionrouteCode; | ||
| 14 | + | ||
| 15 | + // 线路编号 | ||
| 16 | + private String lineCode; | ||
| 17 | + | ||
| 18 | + // 路段编号 | ||
| 19 | + private String sectionCode; | ||
| 20 | + | ||
| 21 | + // 路段路由方向 | ||
| 22 | + private Integer directions; | ||
| 23 | + | ||
| 24 | + // 版本号 | ||
| 25 | + private Integer versions; | ||
| 26 | + | ||
| 27 | + // 是否撤销 | ||
| 28 | + private Integer destroy; | ||
| 29 | + | ||
| 30 | + /** 是否有路段限速数据 <0:分段;1:未分段>*/ | ||
| 31 | + private Integer isRoadeSpeed; | ||
| 32 | + | ||
| 33 | + // 描述 | ||
| 34 | + private String descriptions; | ||
| 35 | + | ||
| 36 | + // 创建人 | ||
| 37 | + private Integer createBy; | ||
| 38 | + | ||
| 39 | + // 修改人 | ||
| 40 | + private Integer updateBy; | ||
| 41 | + | ||
| 42 | + // 创建日期 | ||
| 43 | + private Date createDate; | ||
| 44 | + | ||
| 45 | + // 修改日期 | ||
| 46 | + private Date updateDate; | ||
| 47 | + | ||
| 48 | + // 路段信息 | ||
| 49 | + private long section; | ||
| 50 | + | ||
| 51 | + // 线路ID | ||
| 52 | + private int line; | ||
| 53 | + | ||
| 54 | + public Integer getId() { | ||
| 55 | + return id; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public void setId(Integer id) { | ||
| 59 | + this.id = id; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public Integer getSectionrouteCode() { | ||
| 63 | + return sectionrouteCode; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public void setSectionrouteCode(Integer sectionrouteCode) { | ||
| 67 | + this.sectionrouteCode = sectionrouteCode; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public String getLineCode() { | ||
| 71 | + return lineCode; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public void setLineCode(String lineCode) { | ||
| 75 | + this.lineCode = lineCode; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public String getSectionCode() { | ||
| 79 | + return sectionCode; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public void setSectionCode(String sectionCode) { | ||
| 83 | + this.sectionCode = sectionCode; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public Integer getDirections() { | ||
| 87 | + return directions; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public void setDirections(Integer directions) { | ||
| 91 | + this.directions = directions; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public Integer getVersions() { | ||
| 95 | + return versions; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public void setVersions(Integer versions) { | ||
| 99 | + this.versions = versions; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public Integer getDestroy() { | ||
| 103 | + return destroy; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public void setDestroy(Integer destroy) { | ||
| 107 | + this.destroy = destroy; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public Integer getIsRoadeSpeed() { | ||
| 111 | + return isRoadeSpeed; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public void setIsRoadeSpeed(Integer isRoadeSpeed) { | ||
| 115 | + this.isRoadeSpeed = isRoadeSpeed; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + public String getDescriptions() { | ||
| 119 | + return descriptions; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + public void setDescriptions(String descriptions) { | ||
| 123 | + this.descriptions = descriptions; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + public Integer getCreateBy() { | ||
| 127 | + return createBy; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public void setCreateBy(Integer createBy) { | ||
| 131 | + this.createBy = createBy; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public Integer getUpdateBy() { | ||
| 135 | + return updateBy; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + public void setUpdateBy(Integer updateBy) { | ||
| 139 | + this.updateBy = updateBy; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public Date getCreateDate() { | ||
| 143 | + return createDate; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public void setCreateDate(Date createDate) { | ||
| 147 | + this.createDate = createDate; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + public Date getUpdateDate() { | ||
| 151 | + return updateDate; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public void setUpdateDate(Date updateDate) { | ||
| 155 | + this.updateDate = updateDate; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + public long getSection() { | ||
| 159 | + return section; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + public void setSection(long section) { | ||
| 163 | + this.section = section; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + public int getLine() { | ||
| 167 | + return line; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + public void setLine(int line) { | ||
| 171 | + this.line = line; | ||
| 172 | + } | ||
| 173 | +} |
src/main/java/com/bsth/service/geo_data/impl/SaveStationRouteDTO.java
0 → 100644
| 1 | +package com.bsth.service.geo_data.impl; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 站点路由 jdbc 入库数据 | ||
| 7 | + * Created by panzhao on 2017/12/14. | ||
| 8 | + */ | ||
| 9 | +public class SaveStationRouteDTO { | ||
| 10 | + | ||
| 11 | + //站点路由ID | ||
| 12 | + private Integer id; | ||
| 13 | + | ||
| 14 | + // 站点路由序号 | ||
| 15 | + private Integer stationRouteCode; | ||
| 16 | + | ||
| 17 | + // 站点编码 | ||
| 18 | + private String stationCode; | ||
| 19 | + | ||
| 20 | + // 站点名称 | ||
| 21 | + private String stationName; | ||
| 22 | + | ||
| 23 | + // 线路编码 | ||
| 24 | + private String lineCode; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 站点类型 | ||
| 28 | + * | ||
| 29 | + * ------ B:起点站 | ||
| 30 | + * | ||
| 31 | + * ------ Z:中途站 | ||
| 32 | + * | ||
| 33 | + * ------ E:终点站 | ||
| 34 | + * | ||
| 35 | + * ------ T:停车场 | ||
| 36 | + * | ||
| 37 | + */ | ||
| 38 | + private String stationMark; | ||
| 39 | + | ||
| 40 | + // 站点路由出站序号 | ||
| 41 | + private Integer outStationNmber; | ||
| 42 | + | ||
| 43 | + // 站点路由到站距离 | ||
| 44 | + private Double distances; | ||
| 45 | + | ||
| 46 | + // 站点路由到站时间 | ||
| 47 | + private Double toTime; | ||
| 48 | + | ||
| 49 | + // 首班时间 | ||
| 50 | + private String firstTime; | ||
| 51 | + | ||
| 52 | + // 末班时间 | ||
| 53 | + private String endTime; | ||
| 54 | + | ||
| 55 | + // 站点路由方向 | ||
| 56 | + private Integer directions; | ||
| 57 | + | ||
| 58 | + // 版本号 | ||
| 59 | + private Integer versions; | ||
| 60 | + | ||
| 61 | + // 是否撤销 | ||
| 62 | + private Integer destroy; | ||
| 63 | + | ||
| 64 | + // 描述 | ||
| 65 | + private String descriptions; | ||
| 66 | + | ||
| 67 | + // 创建人 | ||
| 68 | + private Integer createBy; | ||
| 69 | + | ||
| 70 | + // 修改人 | ||
| 71 | + private Integer updateBy; | ||
| 72 | + | ||
| 73 | + // 创建日期 | ||
| 74 | + private Date createDate; | ||
| 75 | + | ||
| 76 | + // 修改日期 | ||
| 77 | + private Date updateDate; | ||
| 78 | + | ||
| 79 | + // 站点ID | ||
| 80 | + private long station; | ||
| 81 | + | ||
| 82 | + // 线路ID | ||
| 83 | + private int line; | ||
| 84 | + | ||
| 85 | + public Integer getId() { | ||
| 86 | + return id; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setId(Integer id) { | ||
| 90 | + this.id = id; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public Integer getStationRouteCode() { | ||
| 94 | + return stationRouteCode; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setStationRouteCode(Integer stationRouteCode) { | ||
| 98 | + this.stationRouteCode = stationRouteCode; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public String getStationCode() { | ||
| 102 | + return stationCode; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setStationCode(String stationCode) { | ||
| 106 | + this.stationCode = stationCode; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public String getStationName() { | ||
| 110 | + return stationName; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setStationName(String stationName) { | ||
| 114 | + this.stationName = stationName; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public String getLineCode() { | ||
| 118 | + return lineCode; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setLineCode(String lineCode) { | ||
| 122 | + this.lineCode = lineCode; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public String getStationMark() { | ||
| 126 | + return stationMark; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public void setStationMark(String stationMark) { | ||
| 130 | + this.stationMark = stationMark; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public Integer getOutStationNmber() { | ||
| 134 | + return outStationNmber; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public void setOutStationNmber(Integer outStationNmber) { | ||
| 138 | + this.outStationNmber = outStationNmber; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public Double getDistances() { | ||
| 142 | + return distances; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public void setDistances(Double distances) { | ||
| 146 | + this.distances = distances; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public Double getToTime() { | ||
| 150 | + return toTime; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public void setToTime(Double toTime) { | ||
| 154 | + this.toTime = toTime; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public String getFirstTime() { | ||
| 158 | + return firstTime; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public void setFirstTime(String firstTime) { | ||
| 162 | + this.firstTime = firstTime; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public String getEndTime() { | ||
| 166 | + return endTime; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public void setEndTime(String endTime) { | ||
| 170 | + this.endTime = endTime; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public Integer getDirections() { | ||
| 174 | + return directions; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public void setDirections(Integer directions) { | ||
| 178 | + this.directions = directions; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public Integer getVersions() { | ||
| 182 | + return versions; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + public void setVersions(Integer versions) { | ||
| 186 | + this.versions = versions; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + public Integer getDestroy() { | ||
| 190 | + return destroy; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public void setDestroy(Integer destroy) { | ||
| 194 | + this.destroy = destroy; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + public String getDescriptions() { | ||
| 198 | + return descriptions; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public void setDescriptions(String descriptions) { | ||
| 202 | + this.descriptions = descriptions; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + public Integer getCreateBy() { | ||
| 206 | + return createBy; | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + public void setCreateBy(Integer createBy) { | ||
| 210 | + this.createBy = createBy; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + public Integer getUpdateBy() { | ||
| 214 | + return updateBy; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + public void setUpdateBy(Integer updateBy) { | ||
| 218 | + this.updateBy = updateBy; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + public Date getCreateDate() { | ||
| 222 | + return createDate; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + public void setCreateDate(Date createDate) { | ||
| 226 | + this.createDate = createDate; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + public Date getUpdateDate() { | ||
| 230 | + return updateDate; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + public void setUpdateDate(Date updateDate) { | ||
| 234 | + this.updateDate = updateDate; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + public long getStation() { | ||
| 238 | + return station; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + public void setStation(long station) { | ||
| 242 | + this.station = station; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + public int getLine() { | ||
| 246 | + return line; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + public void setLine(int line) { | ||
| 250 | + this.line = line; | ||
| 251 | + } | ||
| 252 | +} |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -1252,6 +1252,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1252,6 +1252,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1252 | 1252 | ||
| 1253 | //入库 | 1253 | //入库 |
| 1254 | dayOfSchedule.save(sch); | 1254 | dayOfSchedule.save(sch); |
| 1255 | + //重新计算当前执行班次 | ||
| 1256 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | ||
| 1255 | rs.put("status", ResponseCode.SUCCESS); | 1257 | rs.put("status", ResponseCode.SUCCESS); |
| 1256 | rs.put("t", sch); | 1258 | rs.put("t", sch); |
| 1257 | 1259 |
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
| @@ -54,5 +54,5 @@ public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { | @@ -54,5 +54,5 @@ public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { | ||
| 54 | 54 | ||
| 55 | Map<String, Object> skbDetailMxSave(Map<String, Object> map); | 55 | Map<String, Object> skbDetailMxSave(Map<String, Object> map); |
| 56 | 56 | ||
| 57 | - List<Map<String, Object>> findZdAndTcc(int lineid, int xldir); | 57 | + List<Map<String, Object>> findZdAndTcc(int lineid, int xldir, int lineversion); |
| 58 | } | 58 | } |
src/main/java/com/bsth/service/schedule/TTInfoService.java
| @@ -3,6 +3,9 @@ package com.bsth.service.schedule; | @@ -3,6 +3,9 @@ package com.bsth.service.schedule; | ||
| 3 | import com.bsth.entity.schedule.TTInfo; | 3 | import com.bsth.entity.schedule.TTInfo; |
| 4 | import com.bsth.service.schedule.exception.ScheduleException; | 4 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 5 | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 6 | /** | 9 | /** |
| 7 | * Created by xu on 16/5/12. | 10 | * Created by xu on 16/5/12. |
| 8 | */ | 11 | */ |
| @@ -14,4 +17,8 @@ public interface TTInfoService extends BService<TTInfo, Long> { | @@ -14,4 +17,8 @@ public interface TTInfoService extends BService<TTInfo, Long> { | ||
| 14 | 17 | ||
| 15 | void backUp(Long ttInfoId) throws ScheduleException; | 18 | void backUp(Long ttInfoId) throws ScheduleException; |
| 16 | 19 | ||
| 20 | + List<Map<String, Object>> getLineStationRouteVersions(Integer lineId); | ||
| 21 | + | ||
| 22 | + String getLineVersionDesc(Integer lineId, Integer version); | ||
| 23 | + | ||
| 17 | } | 24 | } |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| @@ -94,17 +94,17 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -94,17 +94,17 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 94 | * @param xldir 线路上下行 | 94 | * @param xldir 线路上下行 |
| 95 | * @return | 95 | * @return |
| 96 | */ | 96 | */ |
| 97 | - public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir) { | 97 | + public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir, int lineversion) { |
| 98 | String sql = "select * from " + | 98 | String sql = "select * from " + |
| 99 | "(" + | 99 | "(" + |
| 100 | - "select station_code as zcode, station_name as zname, concat(station_name, '(站点)') as aname from bsth_c_stationroute " + | ||
| 101 | - "where destroy = 0 and line = ? and directions = ? " + | 100 | + "select station_code as zcode, station_name as zname, concat(station_name, '(站点)') as aname from bsth_c_ls_stationroute " + |
| 101 | + "where destroy = 0 and line = ? and directions = ? and versions = ? " + | ||
| 102 | "union all " + | 102 | "union all " + |
| 103 | "select park_code as zcode, park_name as zname, concat(park_name, '(停车场)') as aname from bsth_c_car_park " + | 103 | "select park_code as zcode, park_name as zname, concat(park_name, '(停车场)') as aname from bsth_c_car_park " + |
| 104 | "where destroy = 0 " + | 104 | "where destroy = 0 " + |
| 105 | ") a "; | 105 | ") a "; |
| 106 | 106 | ||
| 107 | - return jdbcTemplate.queryForList(sql, lineid, xldir); | 107 | + return jdbcTemplate.queryForList(sql, lineid, xldir, lineversion); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | @Override | 110 | @Override |
src/main/java/com/bsth/service/schedule/impl/TTInfoServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.LineVersions; | ||
| 3 | import com.bsth.entity.schedule.TTInfo; | 4 | import com.bsth.entity.schedule.TTInfo; |
| 4 | import com.bsth.entity.schedule.TTInfoBackup; | 5 | import com.bsth.entity.schedule.TTInfoBackup; |
| 5 | import com.bsth.entity.schedule.TTInfoDetail; | 6 | import com.bsth.entity.schedule.TTInfoDetail; |
| 6 | import com.bsth.repository.schedule.TTInfoBackupRepository; | 7 | import com.bsth.repository.schedule.TTInfoBackupRepository; |
| 7 | import com.bsth.repository.schedule.TTInfoDetailRepository; | 8 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 8 | import com.bsth.repository.schedule.TTInfoRepository; | 9 | import com.bsth.repository.schedule.TTInfoRepository; |
| 10 | +import com.bsth.service.LineVersionsService; | ||
| 9 | import com.bsth.service.schedule.TTInfoService; | 11 | import com.bsth.service.schedule.TTInfoService; |
| 10 | import com.bsth.service.schedule.exception.ScheduleException; | 12 | import com.bsth.service.schedule.exception.ScheduleException; |
| 11 | import com.bsth.service.schedule.utils.TimeTableProto; | 13 | import com.bsth.service.schedule.utils.TimeTableProto; |
| 12 | import org.apache.commons.lang3.StringUtils; | 14 | import org.apache.commons.lang3.StringUtils; |
| 15 | +import org.joda.time.DateTime; | ||
| 13 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -21,10 +24,7 @@ import org.springframework.util.CollectionUtils; | @@ -21,10 +24,7 @@ import org.springframework.util.CollectionUtils; | ||
| 21 | 24 | ||
| 22 | import java.io.PrintWriter; | 25 | import java.io.PrintWriter; |
| 23 | import java.io.StringWriter; | 26 | import java.io.StringWriter; |
| 24 | -import java.util.Date; | ||
| 25 | -import java.util.HashMap; | ||
| 26 | -import java.util.List; | ||
| 27 | -import java.util.Map; | 27 | +import java.util.*; |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
| 30 | * Created by xu on 16/12/20. | 30 | * Created by xu on 16/12/20. |
| @@ -40,6 +40,8 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | @@ -40,6 +40,8 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | ||
| 40 | private TTInfoDetailRepository ttInfoDetailRepository; | 40 | private TTInfoDetailRepository ttInfoDetailRepository; |
| 41 | @Autowired | 41 | @Autowired |
| 42 | private TTInfoBackupRepository ttInfoBackupRepository; | 42 | private TTInfoBackupRepository ttInfoBackupRepository; |
| 43 | + @Autowired | ||
| 44 | + private LineVersionsService lineVersionsService; | ||
| 43 | 45 | ||
| 44 | @Override | 46 | @Override |
| 45 | public void validate_name(TTInfo ttInfo) throws ScheduleException { | 47 | public void validate_name(TTInfo ttInfo) throws ScheduleException { |
| @@ -137,7 +139,70 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | @@ -137,7 +139,70 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | ||
| 137 | } | 139 | } |
| 138 | 140 | ||
| 139 | @Override | 141 | @Override |
| 140 | - @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | 142 | + public List<Map<String, Object>> getLineStationRouteVersions(Integer lineId) { |
| 143 | + // 获取线路版本 | ||
| 144 | + List<LineVersions> lineVersionsList = lineVersionsService.findByLineCode(lineId); | ||
| 145 | + // 按照version版本降序排序 | ||
| 146 | + Collections.sort(lineVersionsList, new Comparator<LineVersions>() { | ||
| 147 | + @Override | ||
| 148 | + public int compare(LineVersions o1, LineVersions o2) { | ||
| 149 | + if (o1.getVersions() > o2.getVersions()) { | ||
| 150 | + return -1; | ||
| 151 | + } else if (o1.getVersions() < o2.getVersions()) { | ||
| 152 | + return 1; | ||
| 153 | + } else { | ||
| 154 | + return 0; | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + }); | ||
| 158 | + | ||
| 159 | + // 取最开始的2条记录 | ||
| 160 | + List<Map<String, Object>> mapList = new ArrayList<>(); | ||
| 161 | + for (LineVersions lv: lineVersionsList) { | ||
| 162 | + String vname = lv.getName(); | ||
| 163 | + String rq = lv.getStartDate() == null ? "未知启用日期" : new DateTime(lv.getStartDate()).toString("YYYY年MM月dd日"); | ||
| 164 | + String sdesc = lv.getStatus() == 0 ? "历史" : (lv.getStatus() == 1 ? "当前" : "待更新"); | ||
| 165 | + | ||
| 166 | + Map<String, Object> value = new HashMap<>(); | ||
| 167 | + value.put("desc", vname + "-" + rq + "-" + sdesc); | ||
| 168 | + value.put("version", lv.getVersions()); | ||
| 169 | + | ||
| 170 | + mapList.add(value); | ||
| 171 | + | ||
| 172 | + if (mapList.size() == 2) { | ||
| 173 | + break; | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + return mapList; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + @Override | ||
| 181 | + public String getLineVersionDesc(Integer lineId, Integer version) { | ||
| 182 | + // 查找指定版本,并判定 | ||
| 183 | + Map<String, Object> param = new HashMap<>(); | ||
| 184 | + param.put("line_eq", lineId); | ||
| 185 | + param.put("versions_eq", version); | ||
| 186 | + List<LineVersions> lineVersionsList = (List<LineVersions>) lineVersionsService.list(param); | ||
| 187 | + | ||
| 188 | + LineVersions lv; | ||
| 189 | + if (CollectionUtils.isEmpty(lineVersionsList)) { | ||
| 190 | + return "未知版本"; | ||
| 191 | + } else if (lineVersionsList.size() > 1) { | ||
| 192 | + return "重复版本"; | ||
| 193 | + } else { | ||
| 194 | + lv = lineVersionsList.get(0); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + String vname = lv.getName(); | ||
| 198 | + String rq = lv.getStartDate() == null ? "未知启用日期" : new DateTime(lv.getStartDate()).toString("YYYY年MM月dd日"); | ||
| 199 | + String sdesc = lv.getStatus() == 0 ? "历史" : (lv.getStatus() == 1 ? "当前" : "待更新"); | ||
| 200 | + | ||
| 201 | + return String.format("%s-%s-%s", vname, rq, sdesc); | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + @Override | ||
| 205 | + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.REPEATABLE_READ) | ||
| 141 | public void backUp(Long ttInfoId) throws ScheduleException { | 206 | public void backUp(Long ttInfoId) throws ScheduleException { |
| 142 | LOG.info(">>>>>>开始备份时刻表<<<<<<"); | 207 | LOG.info(">>>>>>开始备份时刻表<<<<<<"); |
| 143 | 208 | ||
| @@ -165,6 +230,7 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | @@ -165,6 +230,7 @@ public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTI | ||
| 165 | ttInfoBackup.setXlName(ttInfo.getXl().getName()); | 230 | ttInfoBackup.setXlName(ttInfo.getXl().getName()); |
| 166 | ttInfoBackup.setTtInfo(ttInfoId); | 231 | ttInfoBackup.setTtInfo(ttInfoId); |
| 167 | ttInfoBackup.setTtInfoName(ttInfo.getName()); | 232 | ttInfoBackup.setTtInfoName(ttInfo.getName()); |
| 233 | + ttInfoBackup.setLineVersion(ttInfo.getLineVersion()); | ||
| 168 | ttInfoBackup.setBackUpDate(backupdate); | 234 | ttInfoBackup.setBackUpDate(backupdate); |
| 169 | ttInfoBackup.setBackUpInfo(backupbytes); | 235 | ttInfoBackup.setBackUpInfo(backupbytes); |
| 170 | 236 |
src/main/java/com/bsth/service/schedule/utils/TimeTableProto.java
| @@ -268,6 +268,15 @@ public final class TimeTableProto { | @@ -268,6 +268,15 @@ public final class TimeTableProto { | ||
| 268 | */ | 268 | */ |
| 269 | com.bsth.service.schedule.utils.TimeTableProto.TTInfoDetailOrBuilder getBcInfoOrBuilder( | 269 | com.bsth.service.schedule.utils.TimeTableProto.TTInfoDetailOrBuilder getBcInfoOrBuilder( |
| 270 | int index); | 270 | int index); |
| 271 | + | ||
| 272 | + /** | ||
| 273 | + * <pre> | ||
| 274 | + * 线路版本 | ||
| 275 | + * </pre> | ||
| 276 | + * | ||
| 277 | + * <code>uint32 lineVersion = 18;</code> | ||
| 278 | + */ | ||
| 279 | + int getLineVersion(); | ||
| 271 | } | 280 | } |
| 272 | /** | 281 | /** |
| 273 | * Protobuf type {@code timetable.TTInfo} | 282 | * Protobuf type {@code timetable.TTInfo} |
| @@ -298,6 +307,7 @@ public final class TimeTableProto { | @@ -298,6 +307,7 @@ public final class TimeTableProto { | ||
| 298 | createDate_ = 0L; | 307 | createDate_ = 0L; |
| 299 | updateDate_ = 0L; | 308 | updateDate_ = 0L; |
| 300 | bcInfo_ = java.util.Collections.emptyList(); | 309 | bcInfo_ = java.util.Collections.emptyList(); |
| 310 | + lineVersion_ = 0; | ||
| 301 | } | 311 | } |
| 302 | 312 | ||
| 303 | @java.lang.Override | 313 | @java.lang.Override |
| @@ -421,6 +431,11 @@ public final class TimeTableProto { | @@ -421,6 +431,11 @@ public final class TimeTableProto { | ||
| 421 | input.readMessage(com.bsth.service.schedule.utils.TimeTableProto.TTInfoDetail.parser(), extensionRegistry)); | 431 | input.readMessage(com.bsth.service.schedule.utils.TimeTableProto.TTInfoDetail.parser(), extensionRegistry)); |
| 422 | break; | 432 | break; |
| 423 | } | 433 | } |
| 434 | + case 144: { | ||
| 435 | + | ||
| 436 | + lineVersion_ = input.readUInt32(); | ||
| 437 | + break; | ||
| 438 | + } | ||
| 424 | } | 439 | } |
| 425 | } | 440 | } |
| 426 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { | 441 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { |
| @@ -914,6 +929,19 @@ public final class TimeTableProto { | @@ -914,6 +929,19 @@ public final class TimeTableProto { | ||
| 914 | return bcInfo_.get(index); | 929 | return bcInfo_.get(index); |
| 915 | } | 930 | } |
| 916 | 931 | ||
| 932 | + public static final int LINEVERSION_FIELD_NUMBER = 18; | ||
| 933 | + private int lineVersion_; | ||
| 934 | + /** | ||
| 935 | + * <pre> | ||
| 936 | + * 线路版本 | ||
| 937 | + * </pre> | ||
| 938 | + * | ||
| 939 | + * <code>uint32 lineVersion = 18;</code> | ||
| 940 | + */ | ||
| 941 | + public int getLineVersion() { | ||
| 942 | + return lineVersion_; | ||
| 943 | + } | ||
| 944 | + | ||
| 917 | private byte memoizedIsInitialized = -1; | 945 | private byte memoizedIsInitialized = -1; |
| 918 | public final boolean isInitialized() { | 946 | public final boolean isInitialized() { |
| 919 | byte isInitialized = memoizedIsInitialized; | 947 | byte isInitialized = memoizedIsInitialized; |
| @@ -977,6 +1005,9 @@ public final class TimeTableProto { | @@ -977,6 +1005,9 @@ public final class TimeTableProto { | ||
| 977 | for (int i = 0; i < bcInfo_.size(); i++) { | 1005 | for (int i = 0; i < bcInfo_.size(); i++) { |
| 978 | output.writeMessage(17, bcInfo_.get(i)); | 1006 | output.writeMessage(17, bcInfo_.get(i)); |
| 979 | } | 1007 | } |
| 1008 | + if (lineVersion_ != 0) { | ||
| 1009 | + output.writeUInt32(18, lineVersion_); | ||
| 1010 | + } | ||
| 980 | } | 1011 | } |
| 981 | 1012 | ||
| 982 | public int getSerializedSize() { | 1013 | public int getSerializedSize() { |
| @@ -1045,6 +1076,10 @@ public final class TimeTableProto { | @@ -1045,6 +1076,10 @@ public final class TimeTableProto { | ||
| 1045 | size += com.google.protobuf.CodedOutputStream | 1076 | size += com.google.protobuf.CodedOutputStream |
| 1046 | .computeMessageSize(17, bcInfo_.get(i)); | 1077 | .computeMessageSize(17, bcInfo_.get(i)); |
| 1047 | } | 1078 | } |
| 1079 | + if (lineVersion_ != 0) { | ||
| 1080 | + size += com.google.protobuf.CodedOutputStream | ||
| 1081 | + .computeUInt32Size(18, lineVersion_); | ||
| 1082 | + } | ||
| 1048 | memoizedSize = size; | 1083 | memoizedSize = size; |
| 1049 | return size; | 1084 | return size; |
| 1050 | } | 1085 | } |
| @@ -1095,6 +1130,8 @@ public final class TimeTableProto { | @@ -1095,6 +1130,8 @@ public final class TimeTableProto { | ||
| 1095 | == other.getUpdateDate()); | 1130 | == other.getUpdateDate()); |
| 1096 | result = result && getBcInfoList() | 1131 | result = result && getBcInfoList() |
| 1097 | .equals(other.getBcInfoList()); | 1132 | .equals(other.getBcInfoList()); |
| 1133 | + result = result && (getLineVersion() | ||
| 1134 | + == other.getLineVersion()); | ||
| 1098 | return result; | 1135 | return result; |
| 1099 | } | 1136 | } |
| 1100 | 1137 | ||
| @@ -1147,6 +1184,8 @@ public final class TimeTableProto { | @@ -1147,6 +1184,8 @@ public final class TimeTableProto { | ||
| 1147 | hash = (37 * hash) + BCINFO_FIELD_NUMBER; | 1184 | hash = (37 * hash) + BCINFO_FIELD_NUMBER; |
| 1148 | hash = (53 * hash) + getBcInfoList().hashCode(); | 1185 | hash = (53 * hash) + getBcInfoList().hashCode(); |
| 1149 | } | 1186 | } |
| 1187 | + hash = (37 * hash) + LINEVERSION_FIELD_NUMBER; | ||
| 1188 | + hash = (53 * hash) + getLineVersion(); | ||
| 1150 | hash = (29 * hash) + unknownFields.hashCode(); | 1189 | hash = (29 * hash) + unknownFields.hashCode(); |
| 1151 | memoizedHashCode = hash; | 1190 | memoizedHashCode = hash; |
| 1152 | return hash; | 1191 | return hash; |
| @@ -1315,6 +1354,8 @@ public final class TimeTableProto { | @@ -1315,6 +1354,8 @@ public final class TimeTableProto { | ||
| 1315 | } else { | 1354 | } else { |
| 1316 | bcInfoBuilder_.clear(); | 1355 | bcInfoBuilder_.clear(); |
| 1317 | } | 1356 | } |
| 1357 | + lineVersion_ = 0; | ||
| 1358 | + | ||
| 1318 | return this; | 1359 | return this; |
| 1319 | } | 1360 | } |
| 1320 | 1361 | ||
| @@ -1364,6 +1405,7 @@ public final class TimeTableProto { | @@ -1364,6 +1405,7 @@ public final class TimeTableProto { | ||
| 1364 | } else { | 1405 | } else { |
| 1365 | result.bcInfo_ = bcInfoBuilder_.build(); | 1406 | result.bcInfo_ = bcInfoBuilder_.build(); |
| 1366 | } | 1407 | } |
| 1408 | + result.lineVersion_ = lineVersion_; | ||
| 1367 | result.bitField0_ = to_bitField0_; | 1409 | result.bitField0_ = to_bitField0_; |
| 1368 | onBuilt(); | 1410 | onBuilt(); |
| 1369 | return result; | 1411 | return result; |
| @@ -1487,6 +1529,9 @@ public final class TimeTableProto { | @@ -1487,6 +1529,9 @@ public final class TimeTableProto { | ||
| 1487 | } | 1529 | } |
| 1488 | } | 1530 | } |
| 1489 | } | 1531 | } |
| 1532 | + if (other.getLineVersion() != 0) { | ||
| 1533 | + setLineVersion(other.getLineVersion()); | ||
| 1534 | + } | ||
| 1490 | onChanged(); | 1535 | onChanged(); |
| 1491 | return this; | 1536 | return this; |
| 1492 | } | 1537 | } |
| @@ -2790,6 +2835,44 @@ public final class TimeTableProto { | @@ -2790,6 +2835,44 @@ public final class TimeTableProto { | ||
| 2790 | } | 2835 | } |
| 2791 | return bcInfoBuilder_; | 2836 | return bcInfoBuilder_; |
| 2792 | } | 2837 | } |
| 2838 | + | ||
| 2839 | + private int lineVersion_ ; | ||
| 2840 | + /** | ||
| 2841 | + * <pre> | ||
| 2842 | + * 线路版本 | ||
| 2843 | + * </pre> | ||
| 2844 | + * | ||
| 2845 | + * <code>uint32 lineVersion = 18;</code> | ||
| 2846 | + */ | ||
| 2847 | + public int getLineVersion() { | ||
| 2848 | + return lineVersion_; | ||
| 2849 | + } | ||
| 2850 | + /** | ||
| 2851 | + * <pre> | ||
| 2852 | + * 线路版本 | ||
| 2853 | + * </pre> | ||
| 2854 | + * | ||
| 2855 | + * <code>uint32 lineVersion = 18;</code> | ||
| 2856 | + */ | ||
| 2857 | + public Builder setLineVersion(int value) { | ||
| 2858 | + | ||
| 2859 | + lineVersion_ = value; | ||
| 2860 | + onChanged(); | ||
| 2861 | + return this; | ||
| 2862 | + } | ||
| 2863 | + /** | ||
| 2864 | + * <pre> | ||
| 2865 | + * 线路版本 | ||
| 2866 | + * </pre> | ||
| 2867 | + * | ||
| 2868 | + * <code>uint32 lineVersion = 18;</code> | ||
| 2869 | + */ | ||
| 2870 | + public Builder clearLineVersion() { | ||
| 2871 | + | ||
| 2872 | + lineVersion_ = 0; | ||
| 2873 | + onChanged(); | ||
| 2874 | + return this; | ||
| 2875 | + } | ||
| 2793 | public final Builder setUnknownFields( | 2876 | public final Builder setUnknownFields( |
| 2794 | final com.google.protobuf.UnknownFieldSet unknownFields) { | 2877 | final com.google.protobuf.UnknownFieldSet unknownFields) { |
| 2795 | return this; | 2878 | return this; |
| @@ -3103,6 +3186,15 @@ public final class TimeTableProto { | @@ -3103,6 +3186,15 @@ public final class TimeTableProto { | ||
| 3103 | */ | 3186 | */ |
| 3104 | com.google.protobuf.ByteString | 3187 | com.google.protobuf.ByteString |
| 3105 | getRemarkBytes(); | 3188 | getRemarkBytes(); |
| 3189 | + | ||
| 3190 | + /** | ||
| 3191 | + * <pre> | ||
| 3192 | + * 线路版本 | ||
| 3193 | + * </pre> | ||
| 3194 | + * | ||
| 3195 | + * <code>uint32 lineVersion = 20;</code> | ||
| 3196 | + */ | ||
| 3197 | + int getLineVersion(); | ||
| 3106 | } | 3198 | } |
| 3107 | /** | 3199 | /** |
| 3108 | * Protobuf type {@code timetable.TTInfoDetail} | 3200 | * Protobuf type {@code timetable.TTInfoDetail} |
| @@ -3135,6 +3227,7 @@ public final class TimeTableProto { | @@ -3135,6 +3227,7 @@ public final class TimeTableProto { | ||
| 3135 | isFB_ = false; | 3227 | isFB_ = false; |
| 3136 | isTS_ = false; | 3228 | isTS_ = false; |
| 3137 | remark_ = ""; | 3229 | remark_ = ""; |
| 3230 | + lineVersion_ = 0; | ||
| 3138 | } | 3231 | } |
| 3139 | 3232 | ||
| 3140 | @java.lang.Override | 3233 | @java.lang.Override |
| @@ -3267,6 +3360,11 @@ public final class TimeTableProto { | @@ -3267,6 +3360,11 @@ public final class TimeTableProto { | ||
| 3267 | remark_ = s; | 3360 | remark_ = s; |
| 3268 | break; | 3361 | break; |
| 3269 | } | 3362 | } |
| 3363 | + case 160: { | ||
| 3364 | + | ||
| 3365 | + lineVersion_ = input.readUInt32(); | ||
| 3366 | + break; | ||
| 3367 | + } | ||
| 3270 | } | 3368 | } |
| 3271 | } | 3369 | } |
| 3272 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { | 3370 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { |
| @@ -3827,6 +3925,19 @@ public final class TimeTableProto { | @@ -3827,6 +3925,19 @@ public final class TimeTableProto { | ||
| 3827 | } | 3925 | } |
| 3828 | } | 3926 | } |
| 3829 | 3927 | ||
| 3928 | + public static final int LINEVERSION_FIELD_NUMBER = 20; | ||
| 3929 | + private int lineVersion_; | ||
| 3930 | + /** | ||
| 3931 | + * <pre> | ||
| 3932 | + * 线路版本 | ||
| 3933 | + * </pre> | ||
| 3934 | + * | ||
| 3935 | + * <code>uint32 lineVersion = 20;</code> | ||
| 3936 | + */ | ||
| 3937 | + public int getLineVersion() { | ||
| 3938 | + return lineVersion_; | ||
| 3939 | + } | ||
| 3940 | + | ||
| 3830 | private byte memoizedIsInitialized = -1; | 3941 | private byte memoizedIsInitialized = -1; |
| 3831 | public final boolean isInitialized() { | 3942 | public final boolean isInitialized() { |
| 3832 | byte isInitialized = memoizedIsInitialized; | 3943 | byte isInitialized = memoizedIsInitialized; |
| @@ -3896,6 +4007,9 @@ public final class TimeTableProto { | @@ -3896,6 +4007,9 @@ public final class TimeTableProto { | ||
| 3896 | if (!getRemarkBytes().isEmpty()) { | 4007 | if (!getRemarkBytes().isEmpty()) { |
| 3897 | com.google.protobuf.GeneratedMessageV3.writeString(output, 19, remark_); | 4008 | com.google.protobuf.GeneratedMessageV3.writeString(output, 19, remark_); |
| 3898 | } | 4009 | } |
| 4010 | + if (lineVersion_ != 0) { | ||
| 4011 | + output.writeUInt32(20, lineVersion_); | ||
| 4012 | + } | ||
| 3899 | } | 4013 | } |
| 3900 | 4014 | ||
| 3901 | public int getSerializedSize() { | 4015 | public int getSerializedSize() { |
| @@ -3969,6 +4083,10 @@ public final class TimeTableProto { | @@ -3969,6 +4083,10 @@ public final class TimeTableProto { | ||
| 3969 | if (!getRemarkBytes().isEmpty()) { | 4083 | if (!getRemarkBytes().isEmpty()) { |
| 3970 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(19, remark_); | 4084 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(19, remark_); |
| 3971 | } | 4085 | } |
| 4086 | + if (lineVersion_ != 0) { | ||
| 4087 | + size += com.google.protobuf.CodedOutputStream | ||
| 4088 | + .computeUInt32Size(20, lineVersion_); | ||
| 4089 | + } | ||
| 3972 | memoizedSize = size; | 4090 | memoizedSize = size; |
| 3973 | return size; | 4091 | return size; |
| 3974 | } | 4092 | } |
| @@ -4025,6 +4143,8 @@ public final class TimeTableProto { | @@ -4025,6 +4143,8 @@ public final class TimeTableProto { | ||
| 4025 | == other.getIsTS()); | 4143 | == other.getIsTS()); |
| 4026 | result = result && getRemark() | 4144 | result = result && getRemark() |
| 4027 | .equals(other.getRemark()); | 4145 | .equals(other.getRemark()); |
| 4146 | + result = result && (getLineVersion() | ||
| 4147 | + == other.getLineVersion()); | ||
| 4028 | return result; | 4148 | return result; |
| 4029 | } | 4149 | } |
| 4030 | 4150 | ||
| @@ -4078,6 +4198,8 @@ public final class TimeTableProto { | @@ -4078,6 +4198,8 @@ public final class TimeTableProto { | ||
| 4078 | getIsTS()); | 4198 | getIsTS()); |
| 4079 | hash = (37 * hash) + REMARK_FIELD_NUMBER; | 4199 | hash = (37 * hash) + REMARK_FIELD_NUMBER; |
| 4080 | hash = (53 * hash) + getRemark().hashCode(); | 4200 | hash = (53 * hash) + getRemark().hashCode(); |
| 4201 | + hash = (37 * hash) + LINEVERSION_FIELD_NUMBER; | ||
| 4202 | + hash = (53 * hash) + getLineVersion(); | ||
| 4081 | hash = (29 * hash) + unknownFields.hashCode(); | 4203 | hash = (29 * hash) + unknownFields.hashCode(); |
| 4082 | memoizedHashCode = hash; | 4204 | memoizedHashCode = hash; |
| 4083 | return hash; | 4205 | return hash; |
| @@ -4245,6 +4367,8 @@ public final class TimeTableProto { | @@ -4245,6 +4367,8 @@ public final class TimeTableProto { | ||
| 4245 | 4367 | ||
| 4246 | remark_ = ""; | 4368 | remark_ = ""; |
| 4247 | 4369 | ||
| 4370 | + lineVersion_ = 0; | ||
| 4371 | + | ||
| 4248 | return this; | 4372 | return this; |
| 4249 | } | 4373 | } |
| 4250 | 4374 | ||
| @@ -4286,6 +4410,7 @@ public final class TimeTableProto { | @@ -4286,6 +4410,7 @@ public final class TimeTableProto { | ||
| 4286 | result.isFB_ = isFB_; | 4410 | result.isFB_ = isFB_; |
| 4287 | result.isTS_ = isTS_; | 4411 | result.isTS_ = isTS_; |
| 4288 | result.remark_ = remark_; | 4412 | result.remark_ = remark_; |
| 4413 | + result.lineVersion_ = lineVersion_; | ||
| 4289 | onBuilt(); | 4414 | onBuilt(); |
| 4290 | return result; | 4415 | return result; |
| 4291 | } | 4416 | } |
| @@ -4394,6 +4519,9 @@ public final class TimeTableProto { | @@ -4394,6 +4519,9 @@ public final class TimeTableProto { | ||
| 4394 | remark_ = other.remark_; | 4519 | remark_ = other.remark_; |
| 4395 | onChanged(); | 4520 | onChanged(); |
| 4396 | } | 4521 | } |
| 4522 | + if (other.getLineVersion() != 0) { | ||
| 4523 | + setLineVersion(other.getLineVersion()); | ||
| 4524 | + } | ||
| 4397 | onChanged(); | 4525 | onChanged(); |
| 4398 | return this; | 4526 | return this; |
| 4399 | } | 4527 | } |
| @@ -5651,6 +5779,44 @@ public final class TimeTableProto { | @@ -5651,6 +5779,44 @@ public final class TimeTableProto { | ||
| 5651 | onChanged(); | 5779 | onChanged(); |
| 5652 | return this; | 5780 | return this; |
| 5653 | } | 5781 | } |
| 5782 | + | ||
| 5783 | + private int lineVersion_ ; | ||
| 5784 | + /** | ||
| 5785 | + * <pre> | ||
| 5786 | + * 线路版本 | ||
| 5787 | + * </pre> | ||
| 5788 | + * | ||
| 5789 | + * <code>uint32 lineVersion = 20;</code> | ||
| 5790 | + */ | ||
| 5791 | + public int getLineVersion() { | ||
| 5792 | + return lineVersion_; | ||
| 5793 | + } | ||
| 5794 | + /** | ||
| 5795 | + * <pre> | ||
| 5796 | + * 线路版本 | ||
| 5797 | + * </pre> | ||
| 5798 | + * | ||
| 5799 | + * <code>uint32 lineVersion = 20;</code> | ||
| 5800 | + */ | ||
| 5801 | + public Builder setLineVersion(int value) { | ||
| 5802 | + | ||
| 5803 | + lineVersion_ = value; | ||
| 5804 | + onChanged(); | ||
| 5805 | + return this; | ||
| 5806 | + } | ||
| 5807 | + /** | ||
| 5808 | + * <pre> | ||
| 5809 | + * 线路版本 | ||
| 5810 | + * </pre> | ||
| 5811 | + * | ||
| 5812 | + * <code>uint32 lineVersion = 20;</code> | ||
| 5813 | + */ | ||
| 5814 | + public Builder clearLineVersion() { | ||
| 5815 | + | ||
| 5816 | + lineVersion_ = 0; | ||
| 5817 | + onChanged(); | ||
| 5818 | + return this; | ||
| 5819 | + } | ||
| 5654 | public final Builder setUnknownFields( | 5820 | public final Builder setUnknownFields( |
| 5655 | final com.google.protobuf.UnknownFieldSet unknownFields) { | 5821 | final com.google.protobuf.UnknownFieldSet unknownFields) { |
| 5656 | return this; | 5822 | return this; |
| @@ -5719,7 +5885,7 @@ public final class TimeTableProto { | @@ -5719,7 +5885,7 @@ public final class TimeTableProto { | ||
| 5719 | descriptor; | 5885 | descriptor; |
| 5720 | static { | 5886 | static { |
| 5721 | java.lang.String[] descriptorData = { | 5887 | java.lang.String[] descriptorData = { |
| 5722 | - "\n\017timetable.proto\022\ttimetable\"\332\002\n\006TTInfo\022" + | 5888 | + "\n\017timetable.proto\022\ttimetable\"\357\002\n\006TTInfo\022" + |
| 5723 | "\n\n\002id\030\001 \001(\004\022\014\n\004name\030\002 \001(\t\022\n\n\002xl\030\003 \001(\r\022\016\n" + | 5889 | "\n\n\002id\030\001 \001(\004\022\014\n\004name\030\002 \001(\t\022\n\n\002xl\030\003 \001(\r\022\016\n" + |
| 5724 | "\006xlName\030\004 \001(\t\022\r\n\005xlDir\030\005 \001(\t\022\014\n\004qyrq\030\006 \001" + | 5890 | "\006xlName\030\004 \001(\t\022\r\n\005xlDir\030\005 \001(\t\022\014\n\004qyrq\030\006 \001" + |
| 5725 | "(\004\022\033\n\023isEnableDisTemplate\030\007 \001(\010\022\020\n\010isCan" + | 5891 | "(\004\022\033\n\023isEnableDisTemplate\030\007 \001(\010\022\020\n\010isCan" + |
| @@ -5728,16 +5894,17 @@ public final class TimeTableProto { | @@ -5728,16 +5894,17 @@ public final class TimeTableProto { | ||
| 5728 | "erName\030\014 \001(\t\022\022\n\nupdateUser\030\r \001(\r\022\026\n\016upda" + | 5894 | "erName\030\014 \001(\t\022\022\n\nupdateUser\030\r \001(\r\022\026\n\016upda" + |
| 5729 | "teUserName\030\016 \001(\t\022\022\n\ncreateDate\030\017 \001(\004\022\022\n\n" + | 5895 | "teUserName\030\016 \001(\t\022\022\n\ncreateDate\030\017 \001(\004\022\022\n\n" + |
| 5730 | "updateDate\030\020 \001(\004\022\'\n\006bcInfo\030\021 \003(\0132\027.timet" + | 5896 | "updateDate\030\020 \001(\004\022\'\n\006bcInfo\030\021 \003(\0132\027.timet" + |
| 5731 | - "able.TTInfoDetail\"\246\002\n\014TTInfoDetail\022\n\n\002id", | ||
| 5732 | - "\030\001 \001(\004\022\n\n\002xl\030\002 \001(\r\022\016\n\006xlName\030\003 \001(\t\022\n\n\002lp" + | ||
| 5733 | - "\030\004 \001(\004\022\016\n\006lpName\030\005 \001(\t\022\014\n\004fcno\030\006 \001(\r\022\r\n\005" + | ||
| 5734 | - "xlDir\030\007 \001(\t\022\017\n\007qdzCode\030\010 \001(\t\022\017\n\007qdzName\030" + | ||
| 5735 | - "\t \001(\t\022\017\n\007zdzCode\030\n \001(\t\022\017\n\007zdzName\030\013 \001(\t\022" + | ||
| 5736 | - "\014\n\004fcsj\030\014 \001(\t\022\013\n\003bcs\030\r \001(\r\022\014\n\004jhlc\030\016 \001(\001" + | ||
| 5737 | - "\022\014\n\004bcsj\030\017 \001(\r\022\016\n\006bcType\030\020 \001(\t\022\014\n\004isFB\030\021" + | ||
| 5738 | - " \001(\010\022\014\n\004isTS\030\022 \001(\010\022\016\n\006remark\030\023 \001(\tB1\n\037co" + | ||
| 5739 | - "m.bsth.service.schedule.utilsB\016TimeTable" + | ||
| 5740 | - "Protob\006proto3" | 5897 | + "able.TTInfoDetail\022\023\n\013lineVersion\030\022 \001(\r\"\273", |
| 5898 | + "\002\n\014TTInfoDetail\022\n\n\002id\030\001 \001(\004\022\n\n\002xl\030\002 \001(\r\022" + | ||
| 5899 | + "\016\n\006xlName\030\003 \001(\t\022\n\n\002lp\030\004 \001(\004\022\016\n\006lpName\030\005 " + | ||
| 5900 | + "\001(\t\022\014\n\004fcno\030\006 \001(\r\022\r\n\005xlDir\030\007 \001(\t\022\017\n\007qdzC" + | ||
| 5901 | + "ode\030\010 \001(\t\022\017\n\007qdzName\030\t \001(\t\022\017\n\007zdzCode\030\n " + | ||
| 5902 | + "\001(\t\022\017\n\007zdzName\030\013 \001(\t\022\014\n\004fcsj\030\014 \001(\t\022\013\n\003bc" + | ||
| 5903 | + "s\030\r \001(\r\022\014\n\004jhlc\030\016 \001(\001\022\014\n\004bcsj\030\017 \001(\r\022\016\n\006b" + | ||
| 5904 | + "cType\030\020 \001(\t\022\014\n\004isFB\030\021 \001(\010\022\014\n\004isTS\030\022 \001(\010\022" + | ||
| 5905 | + "\016\n\006remark\030\023 \001(\t\022\023\n\013lineVersion\030\024 \001(\rB1\n\037" + | ||
| 5906 | + "com.bsth.service.schedule.utilsB\016TimeTab" + | ||
| 5907 | + "leProtob\006proto3" | ||
| 5741 | }; | 5908 | }; |
| 5742 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = | 5909 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = |
| 5743 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { | 5910 | new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { |
| @@ -5756,13 +5923,13 @@ public final class TimeTableProto { | @@ -5756,13 +5923,13 @@ public final class TimeTableProto { | ||
| 5756 | internal_static_timetable_TTInfo_fieldAccessorTable = new | 5923 | internal_static_timetable_TTInfo_fieldAccessorTable = new |
| 5757 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( | 5924 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( |
| 5758 | internal_static_timetable_TTInfo_descriptor, | 5925 | internal_static_timetable_TTInfo_descriptor, |
| 5759 | - new java.lang.String[] { "Id", "Name", "Xl", "XlName", "XlDir", "Qyrq", "IsEnableDisTemplate", "IsCancel", "RuleDays", "SpecialDays", "CreateUser", "CreateUserName", "UpdateUser", "UpdateUserName", "CreateDate", "UpdateDate", "BcInfo", }); | 5926 | + new java.lang.String[] { "Id", "Name", "Xl", "XlName", "XlDir", "Qyrq", "IsEnableDisTemplate", "IsCancel", "RuleDays", "SpecialDays", "CreateUser", "CreateUserName", "UpdateUser", "UpdateUserName", "CreateDate", "UpdateDate", "BcInfo", "LineVersion", }); |
| 5760 | internal_static_timetable_TTInfoDetail_descriptor = | 5927 | internal_static_timetable_TTInfoDetail_descriptor = |
| 5761 | getDescriptor().getMessageTypes().get(1); | 5928 | getDescriptor().getMessageTypes().get(1); |
| 5762 | internal_static_timetable_TTInfoDetail_fieldAccessorTable = new | 5929 | internal_static_timetable_TTInfoDetail_fieldAccessorTable = new |
| 5763 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( | 5930 | com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( |
| 5764 | internal_static_timetable_TTInfoDetail_descriptor, | 5931 | internal_static_timetable_TTInfoDetail_descriptor, |
| 5765 | - new java.lang.String[] { "Id", "Xl", "XlName", "Lp", "LpName", "Fcno", "XlDir", "QdzCode", "QdzName", "ZdzCode", "ZdzName", "Fcsj", "Bcs", "Jhlc", "Bcsj", "BcType", "IsFB", "IsTS", "Remark", }); | 5932 | + new java.lang.String[] { "Id", "Xl", "XlName", "Lp", "LpName", "Fcno", "XlDir", "QdzCode", "QdzName", "ZdzCode", "ZdzName", "Fcsj", "Bcs", "Jhlc", "Bcsj", "BcType", "IsFB", "IsTS", "Remark", "LineVersion", }); |
| 5766 | } | 5933 | } |
| 5767 | 5934 | ||
| 5768 | // @@protoc_insertion_point(outer_class_scope) | 5935 | // @@protoc_insertion_point(outer_class_scope) |
src/main/resources/static/assets/js/baidu/bd_GeoUtils_min.js
0 → 100644
| 1 | +var BMapLib=window.BMapLib=BMapLib||{};(function(){var a=6370996.81;var b=BMapLib.GeoUtils=function(){};b.isPointInRect=function(f,g){if(!(f instanceof BMap.Point)||!(g instanceof BMap.Bounds)){return false}var e=g.getSouthWest();var h=g.getNorthEast();return(f.lng>=e.lng&&f.lng<=h.lng&&f.lat>=e.lat&&f.lat<=h.lat)};b.isPointInCircle=function(e,h){if(!(e instanceof BMap.Point)||!(h instanceof BMap.Circle)){return false}var i=h.getCenter();var g=h.getRadius();var f=b.getDistance(e,i);if(f<=g){return true}else{return false}};b.isPointOnPolyline=function(f,h){if(!(f instanceof BMap.Point)||!(h instanceof BMap.Polyline)){return false}var e=h.getBounds();if(!this.isPointInRect(f,e)){return false}var m=h.getPath();for(var k=0;k<m.length-1;k++){var l=m[k];var j=m[k+1];if(f.lng>=Math.min(l.lng,j.lng)&&f.lng<=Math.max(l.lng,j.lng)&&f.lat>=Math.min(l.lat,j.lat)&&f.lat<=Math.max(l.lat,j.lat)){var g=(l.lng-f.lng)*(j.lat-f.lat)-(j.lng-f.lng)*(l.lat-f.lat);if(g<2e-10&&g>-2e-10){return true}}}return false};b.isPointInPolygon=function(o,l){if(!(o instanceof BMap.Point)||!(l instanceof BMap.Polygon)){return false}var k=l.getBounds();if(!this.isPointInRect(o,k)){return false}var t=l.getPath();var h=t.length;var n=true;var j=0;var g=2e-10;var s,q;var e=o;s=t[0];for(var f=1;f<=h;++f){if(e.equals(s)){return n}q=t[f%h];if(e.lat<Math.min(s.lat,q.lat)||e.lat>Math.max(s.lat,q.lat)){s=q;continue}if(e.lat>Math.min(s.lat,q.lat)&&e.lat<Math.max(s.lat,q.lat)){if(e.lng<=Math.max(s.lng,q.lng)){if(s.lat==q.lat&&e.lng>=Math.min(s.lng,q.lng)){return n}if(s.lng==q.lng){if(s.lng==e.lng){return n}else{++j}}else{var r=(e.lat-s.lat)*(q.lng-s.lng)/(q.lat-s.lat)+s.lng;if(Math.abs(e.lng-r)<g){return n}if(e.lng<r){++j}}}}else{if(e.lat==q.lat&&e.lng<=q.lng){var m=t[(f+1)%h];if(e.lat>=Math.min(s.lat,m.lat)&&e.lat<=Math.max(s.lat,m.lat)){++j}else{j+=2}}}s=q}if(j%2==0){return false}else{return true}};b.degreeToRad=function(e){return Math.PI*e/180};b.radToDegree=function(e){return(180*e)/Math.PI};function d(g,f,e){if(f!=null){g=Math.max(g,f)}if(e!=null){g=Math.min(g,e)}return g}function c(g,f,e){while(g>e){g-=e-f}while(g<f){g+=e-f}return g}b.getDistance=function(j,h){if(!(j instanceof BMap.Point)||!(h instanceof BMap.Point)){return 0}j.lng=c(j.lng,-180,180);j.lat=d(j.lat,-74,74);h.lng=c(h.lng,-180,180);h.lat=d(h.lat,-74,74);var f,e,i,g;f=b.degreeToRad(j.lng);i=b.degreeToRad(j.lat);e=b.degreeToRad(h.lng);g=b.degreeToRad(h.lat);return a*Math.acos((Math.sin(i)*Math.sin(g)+Math.cos(i)*Math.cos(g)*Math.cos(e-f)))};b.getPolylineDistance=function(f){if(f instanceof BMap.Polyline||f instanceof Array){var l;if(f instanceof BMap.Polyline){l=f.getPath()}else{l=f}if(l.length<2){return 0}var j=0;for(var h=0;h<l.length-1;h++){var k=l[h];var g=l[h+1];var e=b.getDistance(k,g);j+=e}return j}else{return 0}};b.getPolygonArea=function(t){if(!(t instanceof BMap.Polygon)&&!(t instanceof Array)){return 0}var R;if(t instanceof BMap.Polygon){R=t.getPath()}else{R=t}if(R.length<3){return 0}var w=0;var D=0;var C=0;var L=0;var J=0;var F=0;var E=0;var S=0;var H=0;var p=0;var T=0;var I=0;var q=0;var e=0;var M=0;var v=0;var K=0;var N=0;var s=0;var O=0;var l=0;var g=0;var z=0;var Q=0;var G=0;var j=0;var A=0;var o=0;var m=0;var y=0;var x=0;var h=0;var k=0;var f=0;var n=a;var B=R.length;for(var P=0;P<B;P++){if(P==0){D=R[B-1].lng*Math.PI/180;C=R[B-1].lat*Math.PI/180;L=R[0].lng*Math.PI/180;J=R[0].lat*Math.PI/180;F=R[1].lng*Math.PI/180;E=R[1].lat*Math.PI/180}else{if(P==B-1){D=R[B-2].lng*Math.PI/180;C=R[B-2].lat*Math.PI/180;L=R[B-1].lng*Math.PI/180;J=R[B-1].lat*Math.PI/180;F=R[0].lng*Math.PI/180;E=R[0].lat*Math.PI/180}else{D=R[P-1].lng*Math.PI/180;C=R[P-1].lat*Math.PI/180;L=R[P].lng*Math.PI/180;J=R[P].lat*Math.PI/180;F=R[P+1].lng*Math.PI/180;E=R[P+1].lat*Math.PI/180}}S=Math.cos(J)*Math.cos(L);H=Math.cos(J)*Math.sin(L);p=Math.sin(J);T=Math.cos(C)*Math.cos(D);I=Math.cos(C)*Math.sin(D);q=Math.sin(C);e=Math.cos(E)*Math.cos(F);M=Math.cos(E)*Math.sin(F);v=Math.sin(E);K=(S*S+H*H+p*p)/(S*T+H*I+p*q);N=(S*S+H*H+p*p)/(S*e+H*M+p*v);s=K*T-S;O=K*I-H;l=K*q-p;g=N*e-S;z=N*M-H;Q=N*v-p;m=(g*s+z*O+Q*l)/(Math.sqrt(g*g+z*z+Q*Q)*Math.sqrt(s*s+O*O+l*l));m=Math.acos(m);G=z*l-Q*O;j=0-(g*l-Q*s);A=g*O-z*s;if(S!=0){o=G/S}else{if(H!=0){o=j/H}else{o=A/p}}if(o>0){y+=m;k++}else{x+=m;h++}}var u,r;u=y+(2*Math.PI*h-x);r=(2*Math.PI*k-y)+x;if(y>x){if((u-(B-2)*Math.PI)<1){f=u}else{f=r}}else{if((r-(B-2)*Math.PI)<1){f=r}else{f=u}}w=(f-(B-2)*Math.PI)*n*n;return w}})(); | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
| @@ -19,7 +19,7 @@ div#map_wrap{ | @@ -19,7 +19,7 @@ div#map_wrap{ | ||
| 19 | position: absolute; | 19 | position: absolute; |
| 20 | z-index: 999; | 20 | z-index: 999; |
| 21 | height: calc(100% - 20px); | 21 | height: calc(100% - 20px); |
| 22 | - width: 300px; | 22 | + width: 310px; |
| 23 | background: #fffffff5; | 23 | background: #fffffff5; |
| 24 | top: 7px; | 24 | top: 7px; |
| 25 | left: 5px; | 25 | left: 5px; |
| @@ -30,14 +30,12 @@ div#map_wrap{ | @@ -30,14 +30,12 @@ div#map_wrap{ | ||
| 30 | z-index: 99; | 30 | z-index: 99; |
| 31 | top: 10px; | 31 | top: 10px; |
| 32 | left: 330px; | 32 | left: 330px; |
| 33 | - background: #fffffff5; | ||
| 34 | - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 35 | } | 33 | } |
| 36 | .main_rt_tools_panel{ | 34 | .main_rt_tools_panel{ |
| 37 | position: absolute; | 35 | position: absolute; |
| 38 | z-index: 99; | 36 | z-index: 99; |
| 39 | - top: 7px; | ||
| 40 | - right: 7px; | 37 | + top: 20px; |
| 38 | + right: 77px; | ||
| 41 | background: #ffffff; | 39 | background: #ffffff; |
| 42 | box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48); | 40 | box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48); |
| 43 | padding: 0 12px; | 41 | padding: 0 12px; |
| @@ -61,7 +59,7 @@ div#map_wrap{ | @@ -61,7 +59,7 @@ div#map_wrap{ | ||
| 61 | 59 | ||
| 62 | ._line_info{ | 60 | ._line_info{ |
| 63 | width: 100%; | 61 | width: 100%; |
| 64 | - height: 90px; | 62 | + height: 80px; |
| 65 | background: white; | 63 | background: white; |
| 66 | box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48); | 64 | box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48); |
| 67 | } | 65 | } |
| @@ -104,7 +102,7 @@ div#map_wrap{ | @@ -104,7 +102,7 @@ div#map_wrap{ | ||
| 104 | margin-top: 6px; | 102 | margin-top: 6px; |
| 105 | } | 103 | } |
| 106 | ._route_info_wrap{ | 104 | ._route_info_wrap{ |
| 107 | - height: calc(100% - 100px); | 105 | + height: calc(100% - 90px); |
| 108 | padding-top: 10px; | 106 | padding-top: 10px; |
| 109 | } | 107 | } |
| 110 | 108 | ||
| @@ -134,7 +132,7 @@ div#map_wrap{ | @@ -134,7 +132,7 @@ div#map_wrap{ | ||
| 134 | width: calc(100% - 38px); | 132 | width: calc(100% - 38px); |
| 135 | } | 133 | } |
| 136 | 134 | ||
| 137 | -.station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { | 135 | +.up_down_route_list ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { |
| 138 | margin-top: 0; | 136 | margin-top: 0; |
| 139 | } | 137 | } |
| 140 | 138 | ||
| @@ -250,20 +248,20 @@ ul.uk-list.station_info_win>li.s_name{ | @@ -250,20 +248,20 @@ ul.uk-list.station_info_win>li.s_name{ | ||
| 250 | background: #91d9fa; | 248 | background: #91d9fa; |
| 251 | } | 249 | } |
| 252 | 250 | ||
| 253 | -.up_down_route_list li.ct_active.first_road_active{ | 251 | +.up_down_route_list li.ct_active.f_r_a{ |
| 254 | background: #fff; | 252 | background: #fff; |
| 255 | } | 253 | } |
| 256 | 254 | ||
| 257 | -.up_down_route_list li.ct_active.first_road_active>a{ | 255 | +.up_down_route_list li.ct_active.f_r_a>a{ |
| 258 | background: #91d9fa; | 256 | background: #91d9fa; |
| 259 | } | 257 | } |
| 260 | 258 | ||
| 261 | .road_route .uk-list ul{ | 259 | .road_route .uk-list ul{ |
| 262 | - padding-left: 22px; | 260 | + padding-left: 0; |
| 263 | } | 261 | } |
| 264 | 262 | ||
| 265 | .road_route>ul>li>ul>li{ | 263 | .road_route>ul>li>ul>li{ |
| 266 | - padding-left: 8px; | 264 | + padding-left: 22px; |
| 267 | } | 265 | } |
| 268 | 266 | ||
| 269 | .ct_coord_str{ | 267 | .ct_coord_str{ |
| @@ -297,7 +295,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -297,7 +295,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 297 | .buffer_edit_panel{ | 295 | .buffer_edit_panel{ |
| 298 | position: absolute; | 296 | position: absolute; |
| 299 | top: 5px; | 297 | top: 5px; |
| 300 | - width: 360px; | 298 | + width: 390px; |
| 301 | height: 120px; | 299 | height: 120px; |
| 302 | background: #ffffff; | 300 | background: #ffffff; |
| 303 | left: calc(50% - 170px); | 301 | left: calc(50% - 170px); |
| @@ -306,7 +304,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -306,7 +304,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 306 | display: none; | 304 | display: none; |
| 307 | } | 305 | } |
| 308 | .buffer_edit_body{ | 306 | .buffer_edit_body{ |
| 309 | - padding: 5px; | 307 | + padding: 5px 0 0 15px; |
| 310 | } | 308 | } |
| 311 | 309 | ||
| 312 | .buffer_edit_body>.name{ | 310 | .buffer_edit_body>.name{ |
| @@ -316,7 +314,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -316,7 +314,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 316 | } | 314 | } |
| 317 | 315 | ||
| 318 | .buffer_edit_body .ct_row .uk-inline{ | 316 | .buffer_edit_body .ct_row .uk-inline{ |
| 319 | - width: 167px; | 317 | + width: 175px; |
| 320 | height: 30px; | 318 | height: 30px; |
| 321 | margin-right: 7px; | 319 | margin-right: 7px; |
| 322 | } | 320 | } |
| @@ -420,4 +418,198 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -420,4 +418,198 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 420 | 418 | ||
| 421 | .shapes_type.st_d .draw_polygon_switch>a{ | 419 | .shapes_type.st_d .draw_polygon_switch>a{ |
| 422 | color: red; | 420 | color: red; |
| 421 | +} | ||
| 422 | + | ||
| 423 | +.ul_li_input{ | ||
| 424 | + display: inline-block; | ||
| 425 | + padding: 4px 0; | ||
| 426 | + width: calc(100% - 53px); | ||
| 427 | + background: #f7f7f7; | ||
| 428 | +} | ||
| 429 | + | ||
| 430 | +.ul_li_input input{ | ||
| 431 | + width: 140px; | ||
| 432 | + height: 28px; | ||
| 433 | + margin-left: 5px; | ||
| 434 | +} | ||
| 435 | + | ||
| 436 | +.save_icon_btn{ | ||
| 437 | + color: #2121d1; | ||
| 438 | + margin-right: 4px; | ||
| 439 | +} | ||
| 440 | + | ||
| 441 | +.ul_li_input .uk-icon:hover{ | ||
| 442 | + background: #dfdfdf; | ||
| 443 | +} | ||
| 444 | + | ||
| 445 | +.station_li_transient .ct_route_badge{ | ||
| 446 | + background: #ddcd3f; | ||
| 447 | + vertical-align: middle; | ||
| 448 | +} | ||
| 449 | + | ||
| 450 | +.station_li_transient .search_point_icon_btn{ | ||
| 451 | + color: #FF9800; | ||
| 452 | + margin-right: 5px; | ||
| 453 | +} | ||
| 454 | + | ||
| 455 | +.station_route ._edit_name .ct_route_badge{ | ||
| 456 | + vertical-align: middle; | ||
| 457 | +} | ||
| 458 | + | ||
| 459 | +.add_station_search_point_wrap{ | ||
| 460 | + width: 390px; | ||
| 461 | + height: 126px; | ||
| 462 | + position: absolute; | ||
| 463 | + top: 10px; | ||
| 464 | + left: calc(50% - 200px); | ||
| 465 | + z-index: 999; | ||
| 466 | + background: #ffface; | ||
| 467 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 468 | +} | ||
| 469 | + | ||
| 470 | +.add_station_search_point_wrap ._title { | ||
| 471 | + text-align: center; | ||
| 472 | + font-size: 17px; | ||
| 473 | + color: #2b2b2b; | ||
| 474 | + padding: 2px 0 0 0; | ||
| 475 | + font-weight: 600; | ||
| 476 | +} | ||
| 477 | + | ||
| 478 | +.add_station_search_point_wrap .buffer_edit_body .ct_row { | ||
| 479 | + margin-top: 8px; | ||
| 480 | +} | ||
| 481 | + | ||
| 482 | +.road_edit_panel{ | ||
| 483 | + position: absolute; | ||
| 484 | + z-index: 999; | ||
| 485 | + top: 10px; | ||
| 486 | + left: calc(50% - 190px); | ||
| 487 | + width: 380px; | ||
| 488 | + background: #fff; | ||
| 489 | + height: 120px; | ||
| 490 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 491 | +} | ||
| 492 | + | ||
| 493 | +.road_li_transient .ul_li_input input:first-child{ | ||
| 494 | + width: 110px; | ||
| 495 | + margin-left: 2px; | ||
| 496 | +} | ||
| 497 | + | ||
| 498 | +.road_li_transient .ul_li_input input:nth-of-type(2){ | ||
| 499 | + width: 100px; | ||
| 500 | + margin-left: 0; | ||
| 501 | + font-size: 12px; | ||
| 502 | +} | ||
| 503 | + | ||
| 504 | +.bks_list li.road_li_transient{ | ||
| 505 | + margin-left: -15px; | ||
| 506 | +} | ||
| 507 | + | ||
| 508 | +.road_li_transient .search_point_icon_btn { | ||
| 509 | + color: #FF9800; | ||
| 510 | + margin-right: 5px; | ||
| 511 | +} | ||
| 512 | + | ||
| 513 | +.road_li_transient .ul_li_input{ | ||
| 514 | + width: 100%; | ||
| 515 | + | ||
| 516 | +} | ||
| 517 | + | ||
| 518 | +.road_li_transient .ul_li_input input{ | ||
| 519 | + color: #c5862a; | ||
| 520 | +} | ||
| 521 | + | ||
| 522 | + | ||
| 523 | +.add_road_search_point_wrap{ | ||
| 524 | + width: 390px; | ||
| 525 | + height: 120px; | ||
| 526 | + position: absolute; | ||
| 527 | + top: 10px; | ||
| 528 | + left: calc(50% - 200px); | ||
| 529 | + z-index: 999; | ||
| 530 | + background: #ffface; | ||
| 531 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 532 | +} | ||
| 533 | + | ||
| 534 | +.add_road_search_point_wrap ._title { | ||
| 535 | + text-align: center; | ||
| 536 | + font-size: 17px; | ||
| 537 | + color: #2b2b2b; | ||
| 538 | + padding: 2px 0 0 0; | ||
| 539 | + font-weight: 600; | ||
| 540 | +} | ||
| 541 | + | ||
| 542 | +.add_road_search_point_wrap .buffer_edit_body .ct_row { | ||
| 543 | + margin-top: 8px; | ||
| 544 | +} | ||
| 545 | + | ||
| 546 | +.draw_polyline_switch{ | ||
| 547 | + display: inline-block; | ||
| 548 | + font-size: 12px; | ||
| 549 | + vertical-align: bottom; | ||
| 550 | + margin-left: 5px; | ||
| 551 | +} | ||
| 552 | + | ||
| 553 | +.draw_polyline_switch>a{ | ||
| 554 | + color: red; | ||
| 555 | +} | ||
| 556 | + | ||
| 557 | +.ct_search_input::placeholder{ | ||
| 558 | + font-size: 13px; | ||
| 559 | +} | ||
| 560 | + | ||
| 561 | +.ct_search_result>ul.s_list ._title{ | ||
| 562 | + display: block; | ||
| 563 | + color: #009688; | ||
| 564 | + font-size: 14px; | ||
| 565 | +} | ||
| 566 | + | ||
| 567 | +.ct_search_result>ul.s_list ._address{ | ||
| 568 | + font-size: 12px; | ||
| 569 | +} | ||
| 570 | + | ||
| 571 | +.ct_s_i_wrap{ | ||
| 572 | + box-shadow: 0px 4px 12px rgba(145, 145, 145, 0.48); | ||
| 573 | +} | ||
| 574 | + | ||
| 575 | +.ct_search_result{ | ||
| 576 | + background: #fff; | ||
| 577 | + margin-top: 10px; | ||
| 578 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 579 | + max-width: 300px; | ||
| 580 | +} | ||
| 581 | + | ||
| 582 | +.ct_search_result .s_list>li{ | ||
| 583 | + padding: 5px 15px; | ||
| 584 | + cursor: pointer; | ||
| 585 | + margin-top: 0; | ||
| 586 | + | ||
| 587 | + overflow: hidden; | ||
| 588 | + text-overflow: ellipsis; | ||
| 589 | + white-space: nowrap; | ||
| 590 | +} | ||
| 591 | + | ||
| 592 | +.ct_search_result .s_list>li:hover{ | ||
| 593 | + background: #e1e1e1; | ||
| 594 | +} | ||
| 595 | + | ||
| 596 | +.ct_search_result ._empty{ | ||
| 597 | + font-size: 12px; | ||
| 598 | + color: #656464; | ||
| 599 | +} | ||
| 600 | + | ||
| 601 | +.ct_search_result .uk-icon{ | ||
| 602 | + cursor: pointer; | ||
| 603 | +} | ||
| 604 | + | ||
| 605 | +.main_lt_search_panel .uk-form-icon:not(a):not(button):not(input){ | ||
| 606 | + pointer-events: auto; | ||
| 607 | +} | ||
| 608 | + | ||
| 609 | +#add_line_versions_modal form.uk-form-horizontal .uk-form-label{ | ||
| 610 | + width: 100px !important; | ||
| 611 | +} | ||
| 612 | + | ||
| 613 | +#add_line_versions_modal form.uk-form-horizontal .uk-form-controls{ | ||
| 614 | + margin-left: 115px; | ||
| 423 | } | 615 | } |
| 424 | \ No newline at end of file | 616 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html
| @@ -2,18 +2,18 @@ | @@ -2,18 +2,18 @@ | ||
| 2 | <script id="geo_d_e_road_route-temp" type="text/html"> | 2 | <script id="geo_d_e_road_route-temp" type="text/html"> |
| 3 | <ul class="uk-list"> | 3 | <ul class="uk-list"> |
| 4 | {{each list as subArr i}} | 4 | {{each list as subArr i}} |
| 5 | - <li class="road_li_{{subArr[0].sectionCode}} first_road_active"> | 5 | + <li class="r_r_item f_r_a" data-id="{{subArr[0].id}}" data-code="{{subArr[0].sectionCode}}"> |
| 6 | <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> | 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}} | 7 | {{if subArr.length > 1}} |
| 8 | + <ul class="uk-list bks_list"> | ||
| 9 | {{each subArr as obj j}} | 9 | {{each subArr as obj j}} |
| 10 | - <ul class="uk-list"> | ||
| 11 | {{if j > 0}} | 10 | {{if j > 0}} |
| 12 | - <li class="road_li_{{obj.sectionCode}}"> | 11 | + <li class="r_r_item" data-id="{{obj.id}}" data-code="{{obj.sectionCode}}"> |
| 13 | <a data-code="{{obj.sectionCode}}" data-updown="{{obj.directions}}">{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li> | 12 | <a data-code="{{obj.sectionCode}}" data-updown="{{obj.directions}}">{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li> |
| 14 | {{/if}} | 13 | {{/if}} |
| 15 | - </ul> | 14 | + |
| 16 | {{/each}} | 15 | {{/each}} |
| 16 | + </ul> | ||
| 17 | {{/if}} | 17 | {{/if}} |
| 18 | </li> | 18 | </li> |
| 19 | {{/each}} | 19 | {{/each}} |
| @@ -26,13 +26,94 @@ | @@ -26,13 +26,94 @@ | ||
| 26 | <li>交叉路名: {{crosesRoad}}</li> | 26 | <li>交叉路名: {{crosesRoad}}</li> |
| 27 | <li>路段编号:{{sectionCode}}</li> | 27 | <li>路段编号:{{sectionCode}}</li> |
| 28 | <li>路由序号:{{sectionrouteCode}}</li> | 28 | <li>路由序号:{{sectionrouteCode}}</li> |
| 29 | - <li>坐标: | 29 | + <!--<li>坐标: |
| 30 | <div class="ct_coord_str"> | 30 | <div class="ct_coord_str"> |
| 31 | {{each bdCoords as coord i}} | 31 | {{each bdCoords as coord i}} |
| 32 | <code>{{coord}}</code><br> | 32 | <code>{{coord}}</code><br> |
| 33 | {{/each}} | 33 | {{/each}} |
| 34 | </div> | 34 | </div> |
| 35 | - </li> | 35 | + </li>--> |
| 36 | </ul> | 36 | </ul> |
| 37 | </script> | 37 | </script> |
| 38 | + | ||
| 39 | + <script id="geo_d_e_road_edit_panel-temp" type="text/html"> | ||
| 40 | + <div class="road_edit_panel uk-animation-slide-top-small"> | ||
| 41 | + <div class="buffer_edit_body" > | ||
| 42 | + <h6 class="name">{{sectionName}} (路段编辑)</h6> | ||
| 43 | + <form> | ||
| 44 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 45 | + <input type="hidden" value="{{sectionCode}}" name="sectionCode"> | ||
| 46 | + | ||
| 47 | + <div class="ct_row"> | ||
| 48 | + <div class="uk-inline"> | ||
| 49 | + <span class="uk-form-icon uk-form-icon-flip" >路段名</span> | ||
| 50 | + <input class="uk-input" name="sectionName" type="text" value="{{sectionName}}" > | ||
| 51 | + </div> | ||
| 52 | + <div class="uk-inline"> | ||
| 53 | + <span class="uk-form-icon uk-form-icon-flip" >交叉路</span> | ||
| 54 | + <input class="uk-input" name="crosesRoad" type="text" value="{{crosesRoad}}" style="font-size: 13px;"> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + | ||
| 58 | + <div class="ct_row"> | ||
| 59 | + <div class="uk-inline" > | ||
| 60 | + <kbd>长度: <span>{{len}}</span> 米</kbd> | ||
| 61 | + </div> | ||
| 62 | + <div class="uk-inline btns"> | ||
| 63 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 64 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 65 | + </div> | ||
| 66 | + </div> | ||
| 67 | + </form> | ||
| 68 | + </div> | ||
| 69 | + </div> | ||
| 70 | + </script> | ||
| 71 | + | ||
| 72 | + <script id="geo_d_e_add_road_panel-temp" type="text/html"> | ||
| 73 | + <li class="road_li_transient"> | ||
| 74 | + <div class="ul_li_input"> | ||
| 75 | + <form> | ||
| 76 | + <input class="uk-input" value="{{sectionName}}" autocomplete="off" placeholder="路段名称" name="sectionName"> | ||
| 77 | + <input class="uk-input" value="{{crosesRoad}}" autocomplete="off" placeholder="交叉路" name="crosesRoad"> | ||
| 78 | + <span uk-icon="icon: location;ratio:.8" title="绘制路段" uk-tooltip class="search_point_icon_btn"></span> | ||
| 79 | + <span uk-icon="icon: close;" title="取消" uk-tooltip class="cancel_icon_btn"></span> | ||
| 80 | + </form> | ||
| 81 | + </div> | ||
| 82 | + </li> | ||
| 83 | + </script> | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + <script id="geo_d_e_add_draw_polyline-temp" type="text/html"> | ||
| 87 | + <div class="add_road_search_point_wrap uk-animation-slide-top-small"> | ||
| 88 | + <div class="buffer_edit_body" > | ||
| 89 | + <div class="_title">绘制 {{name}}({{cName}})</div> | ||
| 90 | + <form> | ||
| 91 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 92 | + <input type="hidden" value="{{sectionCode}}" name="sectionCode"> | ||
| 93 | + | ||
| 94 | + <div class="ct_row"> | ||
| 95 | + <div class="uk-inline"> | ||
| 96 | + <span class="uk-form-icon uk-form-icon-flip" >路段名</span> | ||
| 97 | + <input class="uk-input" name="sectionName" type="text" value="{{name}}" > | ||
| 98 | + </div> | ||
| 99 | + <div class="uk-inline"> | ||
| 100 | + <span class="uk-form-icon uk-form-icon-flip" >交叉路</span> | ||
| 101 | + <input class="uk-input" name="crosesRoad" type="text" value="{{cName}}" style="font-size: 13px;"> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + | ||
| 105 | + <div class="ct_row"> | ||
| 106 | + <div class="uk-inline" > | ||
| 107 | + <span class="draw_polyline_switch"><a>暂停绘制</a></span> | ||
| 108 | + </div> | ||
| 109 | + | ||
| 110 | + <div class="uk-inline btns"> | ||
| 111 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 112 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + </form> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + </script> | ||
| 38 | </div> | 119 | </div> |
| 39 | \ No newline at end of file | 120 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
| @@ -2,17 +2,27 @@ | @@ -2,17 +2,27 @@ | ||
| 2 | <script id="geo_d_e_station_route-temp" type="text/html"> | 2 | <script id="geo_d_e_station_route-temp" type="text/html"> |
| 3 | <ul class="uk-list"> | 3 | <ul class="uk-list"> |
| 4 | {{each list as s i}} | 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}}"> | 5 | + <li class="s_r_item" data-code="{{s.stationCode}}" data-id="{{s.id}}"> |
| 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 s.shapesType=='d'}}polygon{{/if}}"> | ||
| 8 | {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span> | 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> | 9 | + </div> |
| 10 | + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> | ||
| 11 | + </li> | ||
| 12 | {{/each}} | 12 | {{/each}} |
| 13 | </ul> | 13 | </ul> |
| 14 | </script> | 14 | </script> |
| 15 | 15 | ||
| 16 | + <script id="geo_d_e_station_route_one-temp" type="text/html"> | ||
| 17 | + <li class="s_r_item" data-code="{{stationCode}}" data-id="{{id}}"> | ||
| 18 | + <div class="ct_route_badge_wrap"> | ||
| 19 | + <span class="uk-badge ct_route_badge {{if stationMark=='B'}}start{{else if stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}"> | ||
| 20 | + {{if stationMark=='B'}}起点站{{else if stationMark=='E'}}终点站{{else}}{{index}}{{/if}}</span> | ||
| 21 | + </div> | ||
| 22 | + <a class="uk-animation-shake" data-code="{{stationCode}}" data-updown="{{directions}}">{{stationName}}</a> | ||
| 23 | + </li> | ||
| 24 | + </script> | ||
| 25 | + | ||
| 16 | 26 | ||
| 17 | <script id="geo_d_e_station_info_win-temp" type="text/html"> | 27 | <script id="geo_d_e_station_info_win-temp" type="text/html"> |
| 18 | <ul class="uk-list station_info_win"> | 28 | <ul class="uk-list station_info_win"> |
| @@ -58,34 +68,96 @@ | @@ -58,34 +68,96 @@ | ||
| 58 | <input type="hidden" value="{{directions}}" name="directions"> | 68 | <input type="hidden" value="{{directions}}" name="directions"> |
| 59 | <input type="hidden" value="{{stationCode}}" name="stationCode"> | 69 | <input type="hidden" value="{{stationCode}}" name="stationCode"> |
| 60 | <input type="hidden" value="{{stationName}}" name="stationName"> | 70 | <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> | 71 | + <div class="ct_row"> |
| 72 | + <div class="uk-inline"> | ||
| 73 | + <span class="uk-form-icon uk-form-icon-flip" >经度</span> | ||
| 74 | + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly> | ||
| 75 | + </div> | ||
| 76 | + <div class="uk-inline"> | ||
| 77 | + <span class="uk-form-icon uk-form-icon-flip" >纬度</span> | ||
| 78 | + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly> | ||
| 79 | + </div> | ||
| 65 | </div> | 80 | </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 | 81 | ||
| 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> | 82 | + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}"> |
| 83 | + <div class="uk-inline" > | ||
| 84 | + <select name="shapesType" class="uk-select"> | ||
| 85 | + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option> | ||
| 86 | + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option> | ||
| 87 | + </select> | ||
| 88 | + <span class="draw_polygon_switch" data-type="{{shapesType=='d'?'3':'1'}}"><a>{{shapesType=='d'?'重新绘制':'暂停绘制'}}</a></span> | ||
| 89 | + </div> | ||
| 90 | + <div class="uk-inline"> | ||
| 91 | + <span class="uk-form-icon uk-form-icon-flip" >半径</span> | ||
| 92 | + <input class="uk-input" name="radius" type="text" value="{{radius}}"> | ||
| 93 | + </div> | ||
| 94 | + <div class="uk-inline btns"> | ||
| 95 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 96 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 97 | + </div> | ||
| 79 | </div> | 98 | </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}}"> | 99 | + </form> |
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + </script> | ||
| 103 | + | ||
| 104 | + <script id="geo_d_e_edit_name_panel-temp" type="text/html"> | ||
| 105 | + <div class="ul_li_input"> | ||
| 106 | + <form> | ||
| 107 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 108 | + <input type="hidden" value="{{stationCode}}" name="stationCode"> | ||
| 109 | + <input type="hidden" value="{{lineCode}}" name="lineCode"> | ||
| 110 | + <input type="hidden" value="{{stationMark}}" name="stationMark"> | ||
| 111 | + <input class="uk-input" autocomplete="off" value="{{stationName}}" name="stationName"> | ||
| 112 | + <span uk-icon="icon: check" title="确定" uk-tooltip class="save_icon_btn"></span> | ||
| 113 | + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span> | ||
| 114 | + </form> | ||
| 115 | + </div> | ||
| 116 | + </script> | ||
| 117 | + | ||
| 118 | + <script id="geo_d_e_add_station_panel-temp" type="text/html"> | ||
| 119 | + <li class="station_li_transient"> | ||
| 120 | + <div class="ct_route_badge_wrap"> | ||
| 121 | + <span class="uk-badge ct_route_badge ">?</span> | ||
| 122 | + </div> | ||
| 123 | + <div class="ul_li_input"> | ||
| 124 | + <form> | ||
| 125 | + <input class="uk-input" value="" autocomplete="off" placeholder="输入站点名称" name="stationName"> | ||
| 126 | + <span uk-icon="icon: location;ratio:.8" title="选择一个坐标位置" uk-tooltip class="search_point_icon_btn"></span> | ||
| 127 | + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span> | ||
| 128 | + </form> | ||
| 129 | + </div> | ||
| 130 | + </li> | ||
| 131 | + </script> | ||
| 132 | + | ||
| 133 | + <script id="geo_d_e_add_search_point_panel-temp" type="text/html"> | ||
| 134 | + <div class="add_station_search_point_wrap uk-animation-slide-top-small"> | ||
| 135 | + <div class="_title">为 {{name}} 选择一个坐标位置</div> | ||
| 136 | + <div class="buffer_edit_body"> | ||
| 137 | + <form> | ||
| 138 | + <input type="hidden" value="{{name}}" name="stationName"> | ||
| 139 | + <div class="ct_row"> | ||
| 140 | + <div class="uk-inline"> | ||
| 141 | + <span class="uk-form-icon uk-form-icon-flip" >经度</span> | ||
| 142 | + <input class="uk-input" name="gLaty" type="text" readonly> | ||
| 143 | + </div> | ||
| 144 | + <div class="uk-inline"> | ||
| 145 | + <span class="uk-form-icon uk-form-icon-flip" >纬度</span> | ||
| 146 | + <input class="uk-input" name="gLonx" type="text" readonly> | ||
| 147 | + </div> | ||
| 83 | </div> | 148 | </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> | 149 | + <div class="ct_row "> |
| 150 | + <div class="uk-inline" > | ||
| 151 | + <div class="ct_row" style="color: #5e5d5d;font-size: 12px;"> | ||
| 152 | + <span uk-icon="icon: question;ratio:.7;" style="vertical-align: top;margin-top: 2px;"></span> | ||
| 153 | + 双击地图可拾取坐标点位 | ||
| 154 | + </div> | ||
| 155 | + </div> | ||
| 156 | + <div class="uk-inline btns"> | ||
| 157 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 158 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 159 | + </div> | ||
| 87 | </div> | 160 | </div> |
| 88 | - </div> | ||
| 89 | </form> | 161 | </form> |
| 90 | </div> | 162 | </div> |
| 91 | </div> | 163 | </div> |
src/main/resources/static/pages/base/geo_data_edit/fragments/versions.html
0 → 100644
| 1 | +<div> | ||
| 2 | + <script id="geo_d_e_version_add-temp" type="text/html"> | ||
| 3 | + <div id="add_line_versions_modal" uk-modal esc-close="false" bg-close="false"> | ||
| 4 | + <div class="uk-modal-dialog uk-modal-body"> | ||
| 5 | + <button class="uk-modal-close-default" type="button" uk-close></button> | ||
| 6 | + <h2 class="uk-modal-title">添加走向版本</h2> | ||
| 7 | + | ||
| 8 | + <form class="uk-form-horizontal uk-margin-large"> | ||
| 9 | + <div class="uk-margin"> | ||
| 10 | + <label class="uk-form-label" >变更走向原因</label> | ||
| 11 | + <div class="uk-form-controls"> | ||
| 12 | + <select class="uk-select" name="remark"> | ||
| 13 | + <option>线路改道</option> | ||
| 14 | + <option>其他</option> | ||
| 15 | + </select> | ||
| 16 | + </div> | ||
| 17 | + </div> | ||
| 18 | + | ||
| 19 | + <div class="uk-margin"> | ||
| 20 | + <label class="uk-form-label" >启用时间</label> | ||
| 21 | + <div class="uk-form-controls"> | ||
| 22 | + <input class="uk-input _flatpickr" type="text" name="startDate" placeholder="启用该版本走向的时间"> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + | ||
| 26 | + <div class="uk-margin"> | ||
| 27 | + <label class="uk-form-label" >版本名称</label> | ||
| 28 | + <div class="uk-form-controls"> | ||
| 29 | + <input class="uk-input" type="text" name="name" placeholder="版本名称"> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + | ||
| 33 | + <div class="uk-margin"> | ||
| 34 | + <div class="uk-form-label">继承走向</div> | ||
| 35 | + <div class="uk-form-controls"> | ||
| 36 | + <select class="uk-select" > | ||
| 37 | + <option>不继承之前的走向</option> | ||
| 38 | + | ||
| 39 | + {{each array as obj i}} | ||
| 40 | + <option data-id="{{obj.id}}" data-versions="{{obj.versions}}">{{obj.name}}</option> | ||
| 41 | + {{/each}} | ||
| 42 | + </select> | ||
| 43 | + </div> | ||
| 44 | + </div> | ||
| 45 | + | ||
| 46 | + </form> | ||
| 47 | + | ||
| 48 | + <p class="uk-text-right"> | ||
| 49 | + <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button> | ||
| 50 | + <button class="uk-button uk-button-primary _submit" type="button">提交</button> | ||
| 51 | + </p> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + </script> | ||
| 55 | +</div> | ||
| 0 | \ No newline at end of file | 56 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/common_data.js
src/main/resources/static/pages/base/geo_data_edit/js/map.js
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | var gb_ct_map = function () { | 3 | var gb_ct_map = function () { |
| 4 | 4 | ||
| 5 | //初始化地图 | 5 | //初始化地图 |
| 6 | - if(!window.BMap){ | 6 | + if (!window.BMap) { |
| 7 | alert('地图没有加载成功,请确认是否能正常连接外网!!'); | 7 | alert('地图没有加载成功,请确认是否能正常连接外网!!'); |
| 8 | } | 8 | } |
| 9 | var gb_map_consts = { | 9 | var gb_map_consts = { |
| @@ -14,20 +14,35 @@ var gb_ct_map = function () { | @@ -14,20 +14,35 @@ var gb_ct_map = function () { | ||
| 14 | } | 14 | } |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | + var styleOptions = { | ||
| 18 | + strokeColor:"#E91E63", //边线颜色。 | ||
| 19 | + fillColor:"#E91E63", //填充颜色。当参数为空时,圆形将没有填充效果。 | ||
| 20 | + strokeWeight: 6, //边线的宽度,以像素为单位。 | ||
| 21 | + strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。 | ||
| 22 | + fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 | ||
| 23 | + strokeStyle: 'solid' //边线的样式,solid或dashed。 | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + | ||
| 17 | /** | 27 | /** |
| 18 | * 地图状态 | 28 | * 地图状态 |
| 19 | * 1: 站点缓冲区编辑 | 29 | * 1: 站点缓冲区编辑 |
| 20 | */ | 30 | */ |
| 21 | - var map_status=0; | 31 | + var map_status = 0; |
| 22 | var editCircle; | 32 | var editCircle; |
| 23 | var editPolygon; | 33 | var editPolygon; |
| 34 | + var dragMarker; | ||
| 24 | 35 | ||
| 25 | map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); | 36 | map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); |
| 26 | //中心点和缩放级别 | 37 | //中心点和缩放级别 |
| 27 | map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); | 38 | map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); |
| 28 | map.enableScrollWheelZoom(); | 39 | map.enableScrollWheelZoom(); |
| 29 | 40 | ||
| 30 | - var roadPolylines = [], stationMarkers=[]; | 41 | + var stCtrl = new BMap.PanoramaControl(); //构造全景控件 |
| 42 | + stCtrl.setOffset(new BMap.Size(20, 20)); | ||
| 43 | + map.addControl(stCtrl);//添加全景控件 | ||
| 44 | + | ||
| 45 | + var roadPolylines = [], stationMarkers = []; | ||
| 31 | var _render = function (cb) { | 46 | var _render = function (cb) { |
| 32 | //绘制路段 | 47 | //绘制路段 |
| 33 | _renderRoads(gb_road_route.getData()); | 48 | _renderRoads(gb_road_route.getData()); |
| @@ -44,7 +59,7 @@ var gb_ct_map = function () { | @@ -44,7 +59,7 @@ var gb_ct_map = function () { | ||
| 44 | }; | 59 | }; |
| 45 | 60 | ||
| 46 | var updownColor = function (updown) { | 61 | var updownColor = function (updown) { |
| 47 | - return updown==0?'blue':'red'; | 62 | + return updown == 0 ? 'blue' : 'red'; |
| 48 | }; | 63 | }; |
| 49 | var _renderRoads = function (data) { | 64 | var _renderRoads = function (data) { |
| 50 | _renderPolyline(data[0], updownColor(0));//上行路段 | 65 | _renderPolyline(data[0], updownColor(0));//上行路段 |
| @@ -55,22 +70,23 @@ var gb_ct_map = function () { | @@ -55,22 +70,23 @@ var gb_ct_map = function () { | ||
| 55 | _renderStationMarket(data[0]);//上行站点 | 70 | _renderStationMarket(data[0]);//上行站点 |
| 56 | _renderStationMarket(data[1]);//下行站点 | 71 | _renderStationMarket(data[1]);//下行站点 |
| 57 | }; | 72 | }; |
| 58 | - | 73 | + |
| 59 | var _renderStationMarket = function (routes, color) { | 74 | var _renderStationMarket = function (routes, color) { |
| 60 | var marker; | 75 | var marker; |
| 61 | - var array=[]; | 76 | + var array = []; |
| 62 | $.each(routes, function (i) { | 77 | $.each(routes, function (i) { |
| 63 | this.index = i; | 78 | this.index = i; |
| 64 | transCoord(this); | 79 | transCoord(this); |
| 65 | - marker=createStationMark(this); | 80 | + marker = createStationMark(this); |
| 66 | marker.stationCode = this.stationCode; | 81 | marker.stationCode = this.stationCode; |
| 67 | marker.ct_data = this; | 82 | marker.ct_data = this; |
| 83 | + marker.ct_source = '1'; | ||
| 68 | map.addOverlay(marker); | 84 | map.addOverlay(marker); |
| 69 | 85 | ||
| 70 | array.push(marker); | 86 | array.push(marker); |
| 71 | }); | 87 | }); |
| 72 | 88 | ||
| 73 | - stationMarkers.push(array); | 89 | + stationMarkers[routes[0].directions] = array; |
| 74 | }; | 90 | }; |
| 75 | 91 | ||
| 76 | function transCoord(obj) { | 92 | function transCoord(obj) { |
| @@ -81,8 +97,8 @@ var gb_ct_map = function () { | @@ -81,8 +97,8 @@ var gb_ct_map = function () { | ||
| 81 | 97 | ||
| 82 | var _renderPolyline = function (routes, color) { | 98 | var _renderPolyline = function (routes, color) { |
| 83 | var pos, temps; | 99 | var pos, temps; |
| 84 | - var polyline, _pLines=[]; | ||
| 85 | - var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7}; | 100 | + var polyline, _pLines = []; |
| 101 | + var style = {strokeWeight: 7, strokeColor: color, strokeOpacity: .7}; | ||
| 86 | $.each(routes, function (i, item) { | 102 | $.each(routes, function (i, item) { |
| 87 | 103 | ||
| 88 | pos = []; | 104 | pos = []; |
| @@ -93,41 +109,50 @@ var gb_ct_map = function () { | @@ -93,41 +109,50 @@ var gb_ct_map = function () { | ||
| 93 | polyline = new BMap.Polyline(pos, style); | 109 | polyline = new BMap.Polyline(pos, style); |
| 94 | polyline.ct_data = item; | 110 | polyline.ct_data = item; |
| 95 | polyline.ct_data.oldColor = color; | 111 | polyline.ct_data.oldColor = color; |
| 112 | + polyline.ct_source = '1'; | ||
| 96 | map.addOverlay(polyline); | 113 | map.addOverlay(polyline); |
| 97 | 114 | ||
| 98 | - polyline.addEventListener('mouseover', function(){ | ||
| 99 | - this.setStrokeColor('#20bd26'); | 115 | + polyline.addEventListener('mouseover', function () { |
| 116 | + //if (map_status != 1) | ||
| 117 | + if(this!=editPolyline) | ||
| 118 | + this.setStrokeColor('#20bd26'); | ||
| 100 | }); | 119 | }); |
| 101 | - polyline.addEventListener('mouseout', function(){ | ||
| 102 | - if(this!=road_win_show_p) | ||
| 103 | - this.setStrokeColor(color); | 120 | + polyline.addEventListener('mouseout', function () { |
| 121 | + //if (map_status != 1 && this != road_win_show_p) | ||
| 122 | + if(this!=editPolyline && this != road_win_show_p) | ||
| 123 | + this.setStrokeColor(updownColor(this.ct_data.directions)); | ||
| 104 | }); | 124 | }); |
| 105 | - polyline.addEventListener('click', function(e){ | ||
| 106 | - if(map_status!=1) | 125 | + polyline.addEventListener('click', function (e) { |
| 126 | + if (map_status != 1) | ||
| 107 | openRoadInfoWin(this, e.point); | 127 | openRoadInfoWin(this, e.point); |
| 108 | }); | 128 | }); |
| 109 | _pLines.push(polyline); | 129 | _pLines.push(polyline); |
| 110 | }); | 130 | }); |
| 111 | 131 | ||
| 112 | - roadPolylines.push(_pLines); | 132 | + roadPolylines[routes[0].directions]= _pLines; |
| 113 | }; | 133 | }; |
| 114 | 134 | ||
| 115 | var road_win_show_p; | 135 | var road_win_show_p; |
| 136 | + | ||
| 116 | function openRoadInfoWin(p, point) { | 137 | function openRoadInfoWin(p, point) { |
| 117 | var data = p.ct_data; | 138 | var data = p.ct_data; |
| 118 | var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data)); | 139 | var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data)); |
| 119 | 140 | ||
| 120 | //close event | 141 | //close event |
| 121 | win.addEventListener('close', function (e) { | 142 | win.addEventListener('close', function (e) { |
| 122 | - p.setStrokeColor(p.ct_data.oldColor); | ||
| 123 | - gb_road_route.clearFocus(); | ||
| 124 | - road_win_show_p = null; | 143 | + if(map_status != 1) { |
| 144 | + p.setStrokeColor(updownColor(p.ct_data.directions)); | ||
| 145 | + gb_road_route.clearFocus(); | ||
| 146 | + road_win_show_p = null; | ||
| 147 | + } | ||
| 125 | }); | 148 | }); |
| 126 | //open event | 149 | //open event |
| 127 | win.addEventListener('open', function (e) { | 150 | win.addEventListener('open', function (e) { |
| 128 | - gb_road_route.focus(data); | ||
| 129 | - p.setStrokeColor('#20bd26'); | ||
| 130 | - road_win_show_p = p; | 151 | + if(map_status !=1){ |
| 152 | + gb_road_route.focus(data); | ||
| 153 | + p.setStrokeColor('#20bd26'); | ||
| 154 | + road_win_show_p = p; | ||
| 155 | + } | ||
| 131 | }); | 156 | }); |
| 132 | 157 | ||
| 133 | map.openInfoWindow(win, point); | 158 | map.openInfoWindow(win, point); |
| @@ -139,31 +164,18 @@ var gb_ct_map = function () { | @@ -139,31 +164,18 @@ var gb_ct_map = function () { | ||
| 139 | 164 | ||
| 140 | //根据站点名称 计算marker 宽度 | 165 | //根据站点名称 计算marker 宽度 |
| 141 | var w = statio.stationName.length * 12 + 38 | 166 | 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)}) | 167 | + , iw = w - 2; |
| 168 | + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)}) | ||
| 144 | marker.setIcon(icon); | 169 | marker.setIcon(icon); |
| 145 | marker.setShadow(null); | 170 | 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) | 171 | + |
| 172 | + marker.addEventListener('click', function () { | ||
| 173 | + if (map_status != 1) | ||
| 152 | openStationInfoWin(this); | 174 | 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 | }); | 175 | }); |
| 160 | - //open event | ||
| 161 | - infoWin.addEventListener('open', function (e) { | ||
| 162 | - gb_station_route.focus(this.ct_data); | ||
| 163 | - });*/ | ||
| 164 | 176 | ||
| 165 | //mouseover | 177 | //mouseover |
| 166 | - marker.addEventListener('mouseover', function(){ | 178 | + marker.addEventListener('mouseover', function () { |
| 167 | setTop(this); | 179 | setTop(this); |
| 168 | }); | 180 | }); |
| 169 | return marker; | 181 | return marker; |
| @@ -171,7 +183,7 @@ var gb_ct_map = function () { | @@ -171,7 +183,7 @@ var gb_ct_map = function () { | ||
| 171 | 183 | ||
| 172 | var openStationInfoWin = function (m) { | 184 | var openStationInfoWin = function (m) { |
| 173 | //ct_data | 185 | //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)}); | 186 | + 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 | 187 | //close event |
| 176 | win.addEventListener('close', function (e) { | 188 | win.addEventListener('close', function (e) { |
| 177 | gb_station_route.clearFocus(); | 189 | gb_station_route.clearFocus(); |
| @@ -185,20 +197,21 @@ var gb_ct_map = function () { | @@ -185,20 +197,21 @@ var gb_ct_map = function () { | ||
| 185 | }; | 197 | }; |
| 186 | 198 | ||
| 187 | //绘制站点icon | 199 | //绘制站点icon |
| 188 | - function createStationIcon(station, w) { | 200 | + function createStationIcon(station, w, bg) { |
| 189 | var canvas = $('<canvas></canvas>')[0]; | 201 | var canvas = $('<canvas></canvas>')[0]; |
| 190 | var ctx = canvas.getContext('2d'); | 202 | var ctx = canvas.getContext('2d'); |
| 191 | 203 | ||
| 192 | - var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c'; | 204 | + if(!bg) |
| 205 | + bg = station.directions == 0 ? '#5757fc' : '#fc4c4c'; | ||
| 193 | //矩形 | 206 | //矩形 |
| 194 | //ctx.roundRect(0, 0, w, 17, 1).stroke(); | 207 | //ctx.roundRect(0, 0, w, 17, 1).stroke(); |
| 195 | - ctx.lineWidth="3"; | 208 | + ctx.lineWidth = "3"; |
| 196 | ctx.rect(0, 0, w - 2, 19); | 209 | ctx.rect(0, 0, w - 2, 19); |
| 197 | ctx.fillStyle = '#fff'; | 210 | ctx.fillStyle = '#fff'; |
| 198 | ctx.fill(); | 211 | ctx.fill(); |
| 199 | ctx.strokeStyle = bg; | 212 | ctx.strokeStyle = bg; |
| 200 | ctx.stroke(); | 213 | ctx.stroke(); |
| 201 | - ctx.lineWidth="1"; | 214 | + ctx.lineWidth = "1"; |
| 202 | 215 | ||
| 203 | //文字 | 216 | //文字 |
| 204 | ctx.font = "12px arial"; | 217 | ctx.font = "12px arial"; |
| @@ -213,8 +226,11 @@ var gb_ct_map = function () { | @@ -213,8 +226,11 @@ var gb_ct_map = function () { | ||
| 213 | 226 | ||
| 214 | ctx.font = "12px arial"; | 227 | ctx.font = "12px arial"; |
| 215 | ctx.fillStyle = '#fff'; | 228 | ctx.fillStyle = '#fff'; |
| 216 | - var i = station.index + 1; | ||
| 217 | - var left = (i + '').length > 1?3:7; | 229 | + |
| 230 | + var i = station.index; | ||
| 231 | + if(!isNaN(i)) | ||
| 232 | + i ++; | ||
| 233 | + var left = (i + '').length > 1 ? 3 : 7; | ||
| 218 | ctx.fillText(i, left, 14); | 234 | ctx.fillText(i, left, 14); |
| 219 | 235 | ||
| 220 | //角 | 236 | //角 |
| @@ -234,7 +250,7 @@ var gb_ct_map = function () { | @@ -234,7 +250,7 @@ var gb_ct_map = function () { | ||
| 234 | 250 | ||
| 235 | var changeUpDown = function () { | 251 | var changeUpDown = function () { |
| 236 | var upDown = getUpDown(); | 252 | var upDown = getUpDown(); |
| 237 | - $.each(roadPolylines[upDown==0?1:0], function () { | 253 | + $.each(roadPolylines[upDown == 0 ? 1 : 0], function () { |
| 238 | this.hide(); | 254 | this.hide(); |
| 239 | }); | 255 | }); |
| 240 | $.each(roadPolylines[upDown], function () { | 256 | $.each(roadPolylines[upDown], function () { |
| @@ -242,7 +258,7 @@ var gb_ct_map = function () { | @@ -242,7 +258,7 @@ var gb_ct_map = function () { | ||
| 242 | }); | 258 | }); |
| 243 | 259 | ||
| 244 | 260 | ||
| 245 | - $.each(stationMarkers[upDown==0?1:0], function () { | 261 | + $.each(stationMarkers[upDown == 0 ? 1 : 0], function () { |
| 246 | this.hide(); | 262 | this.hide(); |
| 247 | }); | 263 | }); |
| 248 | $.each(stationMarkers[upDown], function () { | 264 | $.each(stationMarkers[upDown], function () { |
| @@ -256,22 +272,22 @@ var gb_ct_map = function () { | @@ -256,22 +272,22 @@ var gb_ct_map = function () { | ||
| 256 | */ | 272 | */ |
| 257 | var focusStation = function (code, updown) { | 273 | var focusStation = function (code, updown) { |
| 258 | var marker = getStationMarker(code, updown); | 274 | var marker = getStationMarker(code, updown); |
| 259 | - if(marker){ | 275 | + if (marker) { |
| 260 | openStationInfoWin(marker); | 276 | openStationInfoWin(marker); |
| 261 | } | 277 | } |
| 262 | }; | 278 | }; |
| 263 | - | 279 | + |
| 264 | var getStationMarker = function (code, updown) { | 280 | var getStationMarker = function (code, updown) { |
| 265 | var array = stationMarkers[updown], | 281 | var array = stationMarkers[updown], |
| 266 | marker; | 282 | marker; |
| 267 | - for(var i=0,m;m=array[i++];){ | ||
| 268 | - if(m.stationCode==code){ | 283 | + for (var i = 0, m; m = array[i++];) { |
| 284 | + if (m.stationCode == code) { | ||
| 269 | marker = m; | 285 | marker = m; |
| 270 | break; | 286 | break; |
| 271 | } | 287 | } |
| 272 | } | 288 | } |
| 273 | return marker; | 289 | return marker; |
| 274 | - } | 290 | + }; |
| 275 | 291 | ||
| 276 | /** | 292 | /** |
| 277 | * 定位到路段 | 293 | * 定位到路段 |
| @@ -281,33 +297,28 @@ var gb_ct_map = function () { | @@ -281,33 +297,28 @@ var gb_ct_map = function () { | ||
| 281 | var focusRoad = function (code, updown) { | 297 | var focusRoad = function (code, updown) { |
| 282 | var array = roadPolylines[updown], | 298 | var array = roadPolylines[updown], |
| 283 | polyline; | 299 | polyline; |
| 284 | - for(var i=0,p;p=array[i++];){ | ||
| 285 | - if(p.ct_data.sectionCode==code){ | 300 | + for (var i = 0, p; p = array[i++];) { |
| 301 | + if (p.ct_data.sectionCode == code) { | ||
| 286 | polyline = p; | 302 | polyline = p; |
| 287 | break; | 303 | break; |
| 288 | } | 304 | } |
| 289 | } | 305 | } |
| 290 | 306 | ||
| 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 | - } | 307 | + openRoadInfoWin(p, new BMap.Point(p.ct_data.cp.longitude, p.ct_data.cp.latitude)); |
| 308 | + }; | ||
| 301 | 309 | ||
| 302 | - return geolib.getCenter(array); | ||
| 303 | - } | ||
| 304 | - | ||
| 305 | var exitEditBufferStatus = function (s) { | 310 | var exitEditBufferStatus = function (s) { |
| 306 | map_status = 0; | 311 | map_status = 0; |
| 307 | - enabledOtherElem(); | ||
| 308 | - gb_station_route.hideEditPanel(); | 312 | + $('.main_left_panel_m_layer').hide(); |
| 313 | + $('.buffer_edit_panel').remove(); | ||
| 314 | + //enabledOtherElem(); | ||
| 315 | + //gb_station_route.hideEditPanel(); | ||
| 309 | 316 | ||
| 310 | - map.removeOverlay(editCircle); | 317 | + clearOtherOverlay(); |
| 318 | + reSetDragMarker();//关闭marker 拖拽 | ||
| 319 | + | ||
| 320 | + clearEditBuffer(); | ||
| 321 | + //map.removeOverlay(editCircle); | ||
| 311 | 322 | ||
| 312 | openStationInfoWin(getStationMarker(s.stationCode, s.directions)); | 323 | openStationInfoWin(getStationMarker(s.stationCode, s.directions)); |
| 313 | }; | 324 | }; |
| @@ -321,52 +332,95 @@ var gb_ct_map = function () { | @@ -321,52 +332,95 @@ var gb_ct_map = function () { | ||
| 321 | map.closeInfoWindow();//关闭infoWindow | 332 | map.closeInfoWindow();//关闭infoWindow |
| 322 | gb_station_route.clearFocus(); | 333 | gb_station_route.clearFocus(); |
| 323 | gb_station_route.focus(s); | 334 | gb_station_route.focus(s); |
| 324 | - clearOldOverlay(); | ||
| 325 | disabledOtherElem(); | 335 | disabledOtherElem(); |
| 326 | gb_station_route.showEditPanel(s); | 336 | gb_station_route.showEditPanel(s); |
| 327 | 337 | ||
| 328 | var marker = getStationMarker(s.stationCode, s.directions); | 338 | var marker = getStationMarker(s.stationCode, s.directions); |
| 339 | + setDragMarker(marker);//站点 点位可拖拽 | ||
| 340 | + | ||
| 329 | map.centerAndZoom(marker.point, 18); | 341 | map.centerAndZoom(marker.point, 18); |
| 330 | var bElem = openBufferOverlay(marker); | 342 | var bElem = openBufferOverlay(marker); |
| 331 | 343 | ||
| 332 | - if(s.shapesType=='r'){ | 344 | + if (s.shapesType == 'r') { |
| 333 | //lineupdate | 345 | //lineupdate |
| 334 | bElem.addEventListener('lineupdate', function (e) { | 346 | 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); | 347 | + //console.log('lineupdatelineupdate 1111', e); |
| 339 | gb_station_route.reWriteEditPanel(e.target); | 348 | gb_station_route.reWriteEditPanel(e.target); |
| 340 | }); | 349 | }); |
| 341 | } | 350 | } |
| 351 | + else if (s.shapesType == 'd') { | ||
| 352 | + //调整多边形 | ||
| 353 | + | ||
| 354 | + } | ||
| 355 | + }; | ||
| 356 | + | ||
| 357 | + var setDragMarker = function (marker) { | ||
| 358 | + marker.enableDragging(); | ||
| 359 | + dragMarker = marker; | ||
| 360 | + dragMarker._old_point = dragMarker.point; | ||
| 361 | + //监听拖拽事件 dragging | ||
| 362 | + dragMarker.addEventListener('dragging', dragMarkerDragEvent); | ||
| 342 | }; | 363 | }; |
| 343 | - | ||
| 344 | - var clearOldOverlay = function () { | ||
| 345 | - map.removeOverlay(editCircle); | ||
| 346 | - map.removeOverlay(editPolygon); | ||
| 347 | - } | 364 | + |
| 365 | + var dragMarkerDragEvent = function () { | ||
| 366 | + if (editPolygon) { | ||
| 367 | + if (!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon)) | ||
| 368 | + dragMarker.setPosition(dragMarker._old_point);//还原位置 | ||
| 369 | + | ||
| 370 | + gb_station_route.reWriteEditPanel(this, true); | ||
| 371 | + } | ||
| 372 | + else if (editCircle) { | ||
| 373 | + editCircle.disableEditing(); | ||
| 374 | + //缓冲区跟随点位运动 | ||
| 375 | + editCircle.setCenter(this.point); | ||
| 376 | + editCircle.enableEditing(); | ||
| 377 | + } | ||
| 378 | + }; | ||
| 379 | + | ||
| 380 | + var reSetDragMarker = function () { | ||
| 381 | + if (dragMarker) { | ||
| 382 | + dragMarker.setPosition(dragMarker._old_point); | ||
| 383 | + dragMarker.removeEventListener('dragging', dragMarkerDragEvent); | ||
| 384 | + dragMarker.disableDragging(); | ||
| 385 | + dragMarker = null; | ||
| 386 | + } | ||
| 387 | + }; | ||
| 388 | + | ||
| 389 | + | ||
| 390 | + /* var removeDragMarkerEvent = function () { | ||
| 391 | + dragMarker.removeEventListener('dragging', dragMarkerDragEvent); | ||
| 392 | + };*/ | ||
| 348 | 393 | ||
| 349 | /** | 394 | /** |
| 350 | * 禁用其他元素 | 395 | * 禁用其他元素 |
| 351 | */ | 396 | */ |
| 352 | var disabledOtherElem = function () { | 397 | var disabledOtherElem = function () { |
| 353 | $('.main_left_panel_m_layer').show(); | 398 | $('.main_left_panel_m_layer').show(); |
| 354 | - } | ||
| 355 | - | ||
| 356 | - var enabledOtherElem = function () { | ||
| 357 | - $('.main_left_panel_m_layer').hide(); | ||
| 358 | - } | 399 | + }; |
| 359 | 400 | ||
| 360 | var openBufferOverlay = function (m) { | 401 | var openBufferOverlay = function (m) { |
| 361 | var elem; | 402 | var elem; |
| 362 | var data = m.ct_data; | 403 | 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(); | 404 | + if (data.shapesType == 'r') { |
| 405 | + elem = new BMap.Circle(m.point, data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/}); | ||
| 406 | + editCircle = elem; | ||
| 407 | + } | ||
| 408 | + else if (data.shapesType == 'd') { | ||
| 409 | + var array = data.bdCoords; | ||
| 410 | + var pos = []; | ||
| 411 | + var temp = []; | ||
| 412 | + for (var i = 0, c; c = array[i++];) { | ||
| 413 | + temp = c.split(' '); | ||
| 414 | + pos.push(new BMap.Point(temp[0], temp[1])); | ||
| 415 | + } | ||
| 416 | + | ||
| 417 | + elem = new BMap.Polygon(pos); | ||
| 418 | + editPolygon = elem; | ||
| 367 | } | 419 | } |
| 368 | - editCircle = circle; | ||
| 369 | - return circle; | 420 | + |
| 421 | + map.addOverlay(elem); | ||
| 422 | + elem.enableEditing(); | ||
| 423 | + return elem; | ||
| 370 | }; | 424 | }; |
| 371 | 425 | ||
| 372 | /** | 426 | /** |
| @@ -379,11 +433,14 @@ var gb_ct_map = function () { | @@ -379,11 +433,14 @@ var gb_ct_map = function () { | ||
| 379 | transCoord(s); | 433 | transCoord(s); |
| 380 | m.ct_data = s; | 434 | m.ct_data = s; |
| 381 | m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat)); | 435 | m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat)); |
| 436 | + m._old_point = this.point; | ||
| 437 | + m.disableDragging(); | ||
| 382 | } | 438 | } |
| 383 | 439 | ||
| 384 | var topOverlay; | 440 | var topOverlay; |
| 385 | - function setTop(overlay){ | ||
| 386 | - if(topOverlay) | 441 | + |
| 442 | + function setTop(overlay) { | ||
| 443 | + if (topOverlay) | ||
| 387 | topOverlay.setTop(false); | 444 | topOverlay.setTop(false); |
| 388 | overlay.setTop(true); | 445 | overlay.setTop(true); |
| 389 | topOverlay = overlay; | 446 | topOverlay = overlay; |
| @@ -395,34 +452,367 @@ var gb_ct_map = function () { | @@ -395,34 +452,367 @@ var gb_ct_map = function () { | ||
| 395 | */ | 452 | */ |
| 396 | var _drawingManager; | 453 | var _drawingManager; |
| 397 | var changeShapeType = function (v) { | 454 | var changeShapeType = function (v) { |
| 398 | - if(v == 'd'){ | ||
| 399 | - map.removeOverlay(editCircle); | 455 | + clearEditBuffer(); |
| 400 | 456 | ||
| 401 | - _drawingManager = new BMapLib.DrawingManager(map,{}); | 457 | + if (v == 'd') { |
| 458 | + _drawingManager = new BMapLib.DrawingManager(map, {polygonOptions: styleOptions}); | ||
| 402 | _drawingManager.open(); | 459 | _drawingManager.open(); |
| 460 | + _drawingManager.enableCalculate(); | ||
| 403 | _drawingManager.setDrawingMode('polygon'); | 461 | _drawingManager.setDrawingMode('polygon'); |
| 404 | 462 | ||
| 405 | //绘制结束事件 | 463 | //绘制结束事件 |
| 406 | - _drawingManager.addEventListener('polygoncomplete', function (e) { | ||
| 407 | - console.log('end ', e); | 464 | + _drawingManager.addEventListener('overlaycomplete', function (e) { |
| 465 | + editPolygon = e.overlay; | ||
| 408 | gb_station_route.drawEnd(); | 466 | gb_station_route.drawEnd(); |
| 409 | }); | 467 | }); |
| 410 | } | 468 | } |
| 469 | + else if (v == 'r') { | ||
| 470 | + updateDragRadius(80); | ||
| 471 | + | ||
| 472 | + //圆形编辑事件 reWriteEditPanel | ||
| 473 | + editCircle.addEventListener('lineupdate', function (e) { | ||
| 474 | + gb_station_route.reWriteEditPanel(e.target); | ||
| 475 | + }); | ||
| 476 | + /*map.removeOverlay(editCircle); | ||
| 477 | + map.removeOverlay(editPolygon); | ||
| 478 | + | ||
| 479 | + //以站点为中心,生成一个默认的圆 | ||
| 480 | + var marker = getStationMarker(s.stationCode, s.directions); | ||
| 481 | + editCircle = new BMap.Circle(marker.point,s.radius?s.radius:50, {strokeColor: '#E91E63'}); | ||
| 482 | + editCircle.enableEditing(); | ||
| 483 | + map.addOverlay(editCircle);*/ | ||
| 484 | + } | ||
| 485 | + }; | ||
| 486 | + | ||
| 487 | + var clearEditBuffer = function () { | ||
| 488 | + map.removeOverlay(editCircle); | ||
| 489 | + map.removeOverlay(editPolygon); | ||
| 490 | + editCircle = null; | ||
| 491 | + editPolygon = null; | ||
| 492 | + }; | ||
| 493 | + | ||
| 494 | + var updateDragRadius = function (radius) { | ||
| 495 | + if (!editCircle) { | ||
| 496 | + clearOtherOverlay(); | ||
| 497 | + var s = gb_station_route.getRealEditStation(); | ||
| 498 | + | ||
| 499 | + //以站点为中心,生成一个默认的圆 | ||
| 500 | + var marker = getStationMarker(s.stationCode, s.directions); | ||
| 501 | + var circle = new BMap.Circle(marker.point, s.radius ? s.radius : 80, {strokeColor: '#E91E63'}); | ||
| 502 | + | ||
| 503 | + setTimeout(function () { | ||
| 504 | + circle.enableEditing(); | ||
| 505 | + }, 200); | ||
| 506 | + map.addOverlay(circle); | ||
| 507 | + | ||
| 508 | + editCircle = circle; | ||
| 509 | + } | ||
| 510 | + | ||
| 511 | + editCircle.setRadius(radius); | ||
| 411 | }; | 512 | }; |
| 412 | 513 | ||
| 413 | var exitDrawStatus = function () { | 514 | var exitDrawStatus = function () { |
| 414 | - if(_drawingManager) | 515 | + if (_drawingManager) { |
| 516 | + clearOtherOverlay(); | ||
| 415 | _drawingManager.close(); | 517 | _drawingManager.close(); |
| 518 | + } | ||
| 416 | }; | 519 | }; |
| 417 | 520 | ||
| 418 | var openDrawStatus = function () { | 521 | var openDrawStatus = function () { |
| 419 | - if(_drawingManager) | 522 | + if (_drawingManager) { |
| 523 | + clearOtherOverlay(); | ||
| 420 | _drawingManager.open(); | 524 | _drawingManager.open(); |
| 525 | + } | ||
| 526 | + }; | ||
| 527 | + | ||
| 528 | + var clearOtherOverlay = function () { | ||
| 529 | + var all = map.getOverlays(); | ||
| 530 | + for (var i = 0, obj; obj = all[i++];) { | ||
| 531 | + if (obj.ct_source && obj.ct_source == '1') | ||
| 532 | + continue; | ||
| 533 | + map.removeOverlay(obj); | ||
| 534 | + //obj = null; | ||
| 535 | + } | ||
| 536 | + }; | ||
| 537 | + | ||
| 538 | + var closeInfoWin = function () { | ||
| 539 | + map.closeInfoWindow(); | ||
| 540 | + }; | ||
| 541 | + | ||
| 542 | + /** | ||
| 543 | + * 绘制新增路段 | ||
| 544 | + * @param name | ||
| 545 | + */ | ||
| 546 | + var showAddRoadPanel = function (name, cName) { | ||
| 547 | + map_status = 1; | ||
| 548 | + | ||
| 549 | + var point; | ||
| 550 | + var pId = gb_road_route.getAddPrevId(); | ||
| 551 | + if(pId){ | ||
| 552 | + //从上一个路段继续绘制 | ||
| 553 | + var prev = gb_road_route.getRoadById(pId), | ||
| 554 | + coords = prev.bdCoords, | ||
| 555 | + lastCoord = coords[coords.length-1].split(' '); | ||
| 556 | + | ||
| 557 | + point = new BMap.Point(lastCoord[0], lastCoord[1]); | ||
| 558 | + } | ||
| 559 | + | ||
| 560 | + map.centerAndZoom(point, 18); | ||
| 561 | + | ||
| 562 | + //开启鼠标绘制 | ||
| 563 | + _drawingManager = new BMapLib.DrawingManager(map, { | ||
| 564 | + polylineOptions: styleOptions | ||
| 565 | + }); | ||
| 566 | + | ||
| 567 | + _drawingManager.open(); | ||
| 568 | + //_drawingManager.enableCalculate(); | ||
| 569 | + _drawingManager.setDrawingMode('polyline'); | ||
| 570 | + | ||
| 571 | + //绘制完成 | ||
| 572 | + _drawingManager.addEventListener('polylinecomplete', function (e) { | ||
| 573 | + console.log('eee', e, e.getPath()); | ||
| 574 | + _drawingManager.close(); | ||
| 575 | + | ||
| 576 | + var polyline = new BMap.Polyline(e.getPath(), {strokeWeight: 7, strokeColor: '#E91E63', strokeOpacity: .7}); | ||
| 577 | + | ||
| 578 | + map.removeOverlay(e); | ||
| 579 | + map.addOverlay(polyline); | ||
| 580 | + polyline.enableEditing(); | ||
| 581 | + | ||
| 582 | + editPolyline = polyline; | ||
| 583 | + }); | ||
| 584 | + }; | ||
| 585 | + | ||
| 586 | + /** | ||
| 587 | + * 为新增的站点选择一个位置 | ||
| 588 | + */ | ||
| 589 | + var showAddPointPanel = function (name) { | ||
| 590 | + map_status = 1; | ||
| 591 | + var spp = gb_station_route.getTemps()['geo_d_e_add_search_point_panel-temp']({name: name}); | ||
| 592 | + $('body').append(spp); | ||
| 593 | + | ||
| 594 | + //按名称定位地图位置 | ||
| 595 | + var local = new BMap.LocalSearch(map, { | ||
| 596 | + renderOptions: {map: map}, | ||
| 597 | + onMarkersSet: function (pos) { | ||
| 598 | + var point; | ||
| 599 | + if(!pos || pos.length==0){ | ||
| 600 | + var pId = gb_station_route.getAddPrevId(); | ||
| 601 | + if(pId){ | ||
| 602 | + //百度没有定位到位置,默认靠近在上一个站 | ||
| 603 | + var prev = gb_station_route.getStationById(pId); | ||
| 604 | + point = new BMap.Point(prev.bd_lon - 0.0001, prev.bd_lat - 0.0001); | ||
| 605 | + } | ||
| 606 | + else{ | ||
| 607 | + //没有上一个站点,默认在地图中间 | ||
| 608 | + point = map.getCenter() | ||
| 609 | + } | ||
| 610 | + } | ||
| 611 | + else{ | ||
| 612 | + var old_m = pos[0].marker; | ||
| 613 | + point = old_m.point; | ||
| 614 | + //清除默认的点 | ||
| 615 | + map.removeOverlay(old_m); | ||
| 616 | + } | ||
| 617 | + //进入新增点位 地图选点模式 | ||
| 618 | + startSearchPoint(point, name); | ||
| 619 | + } | ||
| 620 | + }); | ||
| 621 | + local.setPageCapacity(1); | ||
| 622 | + local.search(name + "-公交车站"); | ||
| 623 | + }; | ||
| 624 | + | ||
| 625 | + var a_s_p_maeker; | ||
| 626 | + var startSearchPoint = function (point, name) { | ||
| 627 | + var m = createYellowStation(point, name); | ||
| 628 | + m.enableDragging(); | ||
| 629 | + map.addOverlay(m); | ||
| 630 | + map.setCenter(point); | ||
| 631 | + | ||
| 632 | + if(map.getZoom() < 16) | ||
| 633 | + map.setZoom(16); | ||
| 634 | + | ||
| 635 | + _updateSearchPoint(m); | ||
| 636 | + m.addEventListener('dragging', function () { | ||
| 637 | + _updateSearchPoint(this); | ||
| 638 | + }); | ||
| 639 | + | ||
| 640 | + //监听地图双击事件 | ||
| 641 | + map.disableDoubleClickZoom(); | ||
| 642 | + map.addEventListener('dblclick', pickupPoint); | ||
| 643 | + | ||
| 644 | + a_s_p_maeker = m; | ||
| 645 | + }; | ||
| 646 | + | ||
| 647 | + /** | ||
| 648 | + * 拾取坐标点位 | ||
| 649 | + */ | ||
| 650 | + var pickupPoint = function (e) { | ||
| 651 | + var point = e.point; | ||
| 652 | + | ||
| 653 | + a_s_p_maeker.setPosition(point); | ||
| 654 | + _updateSearchPoint(a_s_p_maeker); | ||
| 655 | + }; | ||
| 656 | + | ||
| 657 | + var _updateSearchPoint = function (m) { | ||
| 658 | + gb_station_route.reWriteSearchPointPanel(m.point); | ||
| 659 | + }; | ||
| 660 | + /** | ||
| 661 | + * 创建一个黄色的,带添加的站点marker | ||
| 662 | + * @param point | ||
| 663 | + * @returns {BMap.Marker} | ||
| 664 | + */ | ||
| 665 | + function createYellowStation(point, name) { | ||
| 666 | + var marker = new BMap.Marker(point); | ||
| 667 | + | ||
| 668 | + //根据站点名称 计算marker 宽度 | ||
| 669 | + var w = name.length * 12 + 38 | ||
| 670 | + , iw = w - 2; | ||
| 671 | + var icon = new BMap.Icon(createStationIcon({ | ||
| 672 | + stationName: name, index: '?' | ||
| 673 | + }, w, '#ff9800'), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)}); | ||
| 674 | + marker.setIcon(icon); | ||
| 675 | + marker.setShadow(null); | ||
| 676 | + | ||
| 677 | + marker.addEventListener('click', function () { | ||
| 678 | + if (map_status != 1) | ||
| 679 | + openStationInfoWin(this); | ||
| 680 | + }); | ||
| 681 | + | ||
| 682 | + //mouseover | ||
| 683 | + marker.addEventListener('mouseover', function () { | ||
| 684 | + setTop(this); | ||
| 685 | + }); | ||
| 686 | + return marker; | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + /** | ||
| 690 | + * 重绘一个走向的站点 | ||
| 691 | + * @param upDown | ||
| 692 | + */ | ||
| 693 | + var reDrawStation = function (upDown) { | ||
| 694 | + $.each(stationMarkers[upDown], function () { | ||
| 695 | + map.removeOverlay(this); | ||
| 696 | + }); | ||
| 697 | + stationMarkers[upDown] = []; | ||
| 698 | + | ||
| 699 | + clearOtherOverlay(); | ||
| 700 | + _renderStationMarket(gb_station_route.getData()[upDown]); | ||
| 701 | + }; | ||
| 702 | + | ||
| 703 | + /** | ||
| 704 | + * 重绘一个走向的路段 | ||
| 705 | + * @param upDown | ||
| 706 | + */ | ||
| 707 | + var reDrawRoad = function (upDown) { | ||
| 708 | + $.each(roadPolylines[upDown], function () { | ||
| 709 | + map.removeOverlay(this); | ||
| 710 | + }); | ||
| 711 | + roadPolylines[upDown] = []; | ||
| 712 | + | ||
| 713 | + clearOtherOverlay(); | ||
| 714 | + | ||
| 715 | + _renderPolyline(gb_road_route.getData()[upDown], updownColor(upDown)); | ||
| 716 | + }; | ||
| 717 | + | ||
| 718 | + | ||
| 719 | + /** | ||
| 720 | + * 进入路段编辑模式 | ||
| 721 | + * @param road | ||
| 722 | + */ | ||
| 723 | + var editPolyline; | ||
| 724 | + var start_edit_road= function (road) { | ||
| 725 | + map.closeInfoWindow();//关闭infoWindow | ||
| 726 | + map_status = 1; | ||
| 727 | + gb_road_route.focus(road); | ||
| 728 | + | ||
| 729 | + //居中 | ||
| 730 | + console.log('road.cproad.cp', road.cp); | ||
| 731 | + map.centerAndZoom(new BMap.Point(road.cp.longitude, road.cp.latitude), 20); | ||
| 732 | + | ||
| 733 | + //路段变色 | ||
| 734 | + var polyline = getRoadPolyline(road.sectionCode, road.directions); | ||
| 735 | + editPolyline = polyline; | ||
| 736 | + polyline.setStrokeColor('#E91E63'); | ||
| 737 | + | ||
| 738 | + //路段可编辑 | ||
| 739 | + polyline.enableEditing(); | ||
| 740 | + | ||
| 741 | + //lineupdate,计算长度 mouseup | ||
| 742 | + polyline.addEventListener('lineupdate', reCalcPathLength); | ||
| 743 | + //gb_road_route.showPathLength(geolib.getPathLength(polyline.getPath())); | ||
| 744 | + } | ||
| 745 | + | ||
| 746 | + /** | ||
| 747 | + * 计算并显示路段长度 | ||
| 748 | + * @param p | ||
| 749 | + */ | ||
| 750 | + var reCalcPathLength = function () { | ||
| 751 | + var len = geolib.getPathLength(this.getPath()); | ||
| 752 | + gb_road_route.showPathLength(len); | ||
| 421 | }; | 753 | }; |
| 754 | + | ||
| 755 | + var getRoadPolyline = function (code, updown) { | ||
| 756 | + var array = roadPolylines[updown], | ||
| 757 | + polyline; | ||
| 758 | + for (var i = 0, p; p = array[i++];) { | ||
| 759 | + if (p.ct_data.sectionCode == code) { | ||
| 760 | + polyline = p; | ||
| 761 | + break; | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + return polyline; | ||
| 765 | + }; | ||
| 766 | + | ||
| 767 | + var focusMarker; | ||
| 768 | + var focusPoint = function (lat, lng) { | ||
| 769 | + var p = new BMap.Point(lng,lat); | ||
| 770 | + map.setCenter(p); | ||
| 771 | + | ||
| 772 | + clearfocus(); | ||
| 773 | + | ||
| 774 | + var marker = new BMap.Marker(p); | ||
| 775 | + map.addOverlay(marker); | ||
| 776 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | ||
| 777 | + focusMarker = marker; | ||
| 778 | + var zoom = map.getZoom(); | ||
| 779 | + if(zoom < 18) | ||
| 780 | + map.setZoom(18); | ||
| 781 | + }; | ||
| 782 | + | ||
| 783 | + var clearfocus = function () { | ||
| 784 | + if(focusMarker){ | ||
| 785 | + map.removeOverlay(focusMarker); | ||
| 786 | + focusMarker = null; | ||
| 787 | + } | ||
| 788 | + }; | ||
| 789 | + | ||
| 790 | + /** | ||
| 791 | + * 退出路段编辑模式 | ||
| 792 | + */ | ||
| 793 | + var exitEditRoadStatus = function (road, noFocus) { | ||
| 794 | + map_status = 0; | ||
| 795 | + $('.main_left_panel_m_layer').hide(); | ||
| 796 | + $('.road_edit_panel').remove(); | ||
| 797 | + | ||
| 798 | + editPolyline.removeEventListener('lineupdate', reCalcPathLength); | ||
| 799 | + editPolyline = null; | ||
| 800 | + if(noFocus) | ||
| 801 | + return; | ||
| 802 | + | ||
| 803 | + //polyline | ||
| 804 | + var polyline = getRoadPolyline(road.sectionCode, road.directions); | ||
| 805 | + polyline.disableEditing(); | ||
| 806 | + polyline.ct_data = road; | ||
| 807 | + polyline.setStrokeColor(updownColor(road.directions)); | ||
| 808 | + | ||
| 809 | + openRoadInfoWin(polyline, new BMap.Point(road.cp.longitude, road.cp.latitude)); | ||
| 810 | + }; | ||
| 811 | + | ||
| 422 | res_load_ep.emitLater('load_map'); | 812 | res_load_ep.emitLater('load_map'); |
| 423 | return { | 813 | return { |
| 424 | _render: _render, | 814 | _render: _render, |
| 425 | - changeUpDown:changeUpDown, | 815 | + changeUpDown: changeUpDown, |
| 426 | focusStation: focusStation, | 816 | focusStation: focusStation, |
| 427 | focusRoad: focusRoad, | 817 | focusRoad: focusRoad, |
| 428 | editStationBuffer: editStationBuffer, | 818 | editStationBuffer: editStationBuffer, |
| @@ -430,6 +820,29 @@ var gb_ct_map = function () { | @@ -430,6 +820,29 @@ var gb_ct_map = function () { | ||
| 430 | exitEditBufferStatus: exitEditBufferStatus, | 820 | exitEditBufferStatus: exitEditBufferStatus, |
| 431 | changeShapeType: changeShapeType, | 821 | changeShapeType: changeShapeType, |
| 432 | exitDrawStatus: exitDrawStatus, | 822 | exitDrawStatus: exitDrawStatus, |
| 433 | - openDrawStatus: openDrawStatus | 823 | + openDrawStatus: openDrawStatus, |
| 824 | + getDrawPolygon: function () { | ||
| 825 | + return editPolygon; | ||
| 826 | + }, | ||
| 827 | + getDrawPolyline: function () { | ||
| 828 | + return editPolyline; | ||
| 829 | + }, | ||
| 830 | + updateDragRadius: updateDragRadius, | ||
| 831 | + closeInfoWin: closeInfoWin, | ||
| 832 | + showAddPointPanel: showAddPointPanel, | ||
| 833 | + resetMapStatus: function () { | ||
| 834 | + map_status = 0; | ||
| 835 | + clearOtherOverlay(); | ||
| 836 | + map.removeEventListener('dblclick', pickupPoint); | ||
| 837 | + map.enableDoubleClickZoom(); | ||
| 838 | + }, | ||
| 839 | + reDrawStation: reDrawStation, | ||
| 840 | + reDrawRoad: reDrawRoad, | ||
| 841 | + edit_road: start_edit_road, | ||
| 842 | + exitEditRoadStatus: exitEditRoadStatus, | ||
| 843 | + showAddRoadPanel: showAddRoadPanel, | ||
| 844 | + map: map, | ||
| 845 | + focus: focusPoint, | ||
| 846 | + clearfocus: clearfocus | ||
| 434 | }; | 847 | }; |
| 435 | }(); | 848 | }(); |
| 436 | \ No newline at end of file | 849 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
| @@ -10,12 +10,10 @@ var gb_road_route = function () { | @@ -10,12 +10,10 @@ var gb_road_route = function () { | ||
| 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { | 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { |
| 11 | road_maps = data; | 11 | road_maps = data; |
| 12 | temps = temp; | 12 | temps = temp; |
| 13 | - console.log('roads', road_maps); | ||
| 14 | 13 | ||
| 15 | //按顺序,名称分组 | 14 | //按顺序,名称分组 |
| 16 | var ups = _group(road_maps[0]); | 15 | var ups = _group(road_maps[0]); |
| 17 | var downs = _group(road_maps[1]); | 16 | var downs = _group(road_maps[1]); |
| 18 | - console.log('upsupsups', ups, 'downsdownsdowns', downs); | ||
| 19 | //渲染 | 17 | //渲染 |
| 20 | var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups}); | 18 | var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups}); |
| 21 | $('.up_down_route_list>li:first>.road_route').html(upHtmlStr); | 19 | $('.up_down_route_list>li:first>.road_route').html(upHtmlStr); |
| @@ -30,6 +28,13 @@ var gb_road_route = function () { | @@ -30,6 +28,13 @@ var gb_road_route = function () { | ||
| 30 | rs.list.sort(function (a, b) { | 28 | rs.list.sort(function (a, b) { |
| 31 | return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode); | 29 | return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode); |
| 32 | }); | 30 | }); |
| 31 | + | ||
| 32 | + var _pos; | ||
| 33 | + $.each(rs.list, function () { | ||
| 34 | + _pos = cv_points(this.bdCoords); | ||
| 35 | + this.cp = geolib.getCenter(_pos); | ||
| 36 | + this.len = geolib.getPathLength(_pos); | ||
| 37 | + }); | ||
| 33 | ep.emit('data', gb_common.groupBy(rs.list, 'directions')); | 38 | ep.emit('data', gb_common.groupBy(rs.list, 'directions')); |
| 34 | }); | 39 | }); |
| 35 | 40 | ||
| @@ -70,8 +75,10 @@ var gb_road_route = function () { | @@ -70,8 +75,10 @@ var gb_road_route = function () { | ||
| 70 | }; | 75 | }; |
| 71 | 76 | ||
| 72 | var focus = function (data) { | 77 | var focus = function (data) { |
| 78 | + clearFocus(); | ||
| 73 | //sectionCode | 79 | //sectionCode |
| 74 | - var elem = $('.up_down_route_list>li>.road_route .road_li_' + data.sectionCode); | 80 | + var elem = $('.up_down_route_list>li>.road_route .r_r_item a[data-code='+data.sectionCode+']'); |
| 81 | + elem = elem.parent(); | ||
| 75 | elem.addClass('ct_active'); | 82 | elem.addClass('ct_active'); |
| 76 | 83 | ||
| 77 | if (!isShow(elem)) { | 84 | if (!isShow(elem)) { |
| @@ -89,6 +96,246 @@ var gb_road_route = function () { | @@ -89,6 +96,246 @@ var gb_road_route = function () { | ||
| 89 | return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; | 96 | return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; |
| 90 | }; | 97 | }; |
| 91 | 98 | ||
| 99 | + /** | ||
| 100 | + * 路段编辑 | ||
| 101 | + * @param road | ||
| 102 | + */ | ||
| 103 | + var edit_road = function (road) { | ||
| 104 | + $('.main_left_panel_m_layer').show(); | ||
| 105 | + //弹出编辑面板 | ||
| 106 | + var $editPanel = $(temps['geo_d_e_road_edit_panel-temp'](road)); | ||
| 107 | + $('body').append($editPanel); | ||
| 108 | + | ||
| 109 | + gb_ct_map.edit_road(road); | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 点击取消 | ||
| 113 | + */ | ||
| 114 | + $('button.cancel', $editPanel).on('click', function () { | ||
| 115 | + $('.main_left_panel_m_layer').hide(); | ||
| 116 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 117 | + gb_ct_map.resetMapStatus(); | ||
| 118 | + //debugger | ||
| 119 | + gb_ct_map.exitEditRoadStatus(road); | ||
| 120 | + }); | ||
| 121 | + }; | ||
| 122 | + | ||
| 123 | + var showPathLength = function (len) { | ||
| 124 | + $('.road_edit_panel kbd>span').text(len); | ||
| 125 | + }; | ||
| 126 | + | ||
| 127 | + var addPrevId;//添加路段路由的上一个路由ID | ||
| 128 | + var insert_road_before = function (road) { | ||
| 129 | + isPrevEnd(road); | ||
| 130 | + | ||
| 131 | + //在之前插入路段 | ||
| 132 | + var cell = getRoadLI(road); | ||
| 133 | + | ||
| 134 | + var addCell = $(temps['geo_d_e_add_road_panel-temp'](road)); | ||
| 135 | + | ||
| 136 | + cell.before(addCell); | ||
| 137 | + | ||
| 138 | + add_road(addCell); | ||
| 139 | + }; | ||
| 140 | + | ||
| 141 | + var insert_road_after = function (road) { | ||
| 142 | + isPrevEnd(road); | ||
| 143 | + | ||
| 144 | + //在之后插入路段 | ||
| 145 | + var cell = getRoadLI(road); | ||
| 146 | + | ||
| 147 | + var addCell = $(temps['geo_d_e_add_road_panel-temp'](road)); | ||
| 148 | + | ||
| 149 | + //var next = cell.next('.r_r_item'); | ||
| 150 | + //cell.after(addCell); | ||
| 151 | + var $bksList = $('.bks_list', cell); | ||
| 152 | + if($bksList.length > 0) | ||
| 153 | + $bksList.prepend(addCell); | ||
| 154 | + else | ||
| 155 | + cell.after(addCell); | ||
| 156 | + add_road(addCell); | ||
| 157 | + }; | ||
| 158 | + | ||
| 159 | + var isPrevEnd = function (r) { | ||
| 160 | + if($('.up_down_route_list>li:eq('+r.directions+')>.road_route .road_li_transient').length > 0) | ||
| 161 | + return UIkit.notification("你需要完成上一个路段新增!", {status: 'danger'}); | ||
| 162 | + }; | ||
| 163 | + | ||
| 164 | + var add_road = function (cell) { | ||
| 165 | + gb_ct_map.closeInfoWin(); | ||
| 166 | + //焦点 | ||
| 167 | + var $nameInput = $('input[name=sectionName]', cell); | ||
| 168 | + $nameInput.focus(); | ||
| 169 | + | ||
| 170 | + //取消 | ||
| 171 | + $('.cancel_icon_btn', cell).on('click', function () { | ||
| 172 | + cell.remove(); | ||
| 173 | + }); | ||
| 174 | + | ||
| 175 | + //选择地图位置 | ||
| 176 | + $('.search_point_icon_btn', cell).on('click', function () { | ||
| 177 | + $('.station_li_transient').removeClass('_search_point'); | ||
| 178 | + $(this).parents('.station_li_transient').addClass('_search_point'); | ||
| 179 | + var name = $nameInput.val(); | ||
| 180 | + if(!name) | ||
| 181 | + return UIkit.notification("你必须输入路段名称!", {status: 'danger'}); | ||
| 182 | + | ||
| 183 | + $('.main_left_panel_m_layer').show(); | ||
| 184 | + //gb_ct_map.showAddRoadPanel(name, $('input[name=crosesRoad]',cell).val()); | ||
| 185 | + showDrawPanel(name, $('input[name=crosesRoad]',cell).val()); | ||
| 186 | + }); | ||
| 187 | + //监听回车事件 | ||
| 188 | + $('input', cell).on('keydown', function (e) { | ||
| 189 | + if(event.keyCode == "13") | ||
| 190 | + $('.search_point_icon_btn', cell).trigger('click'); | ||
| 191 | + }); | ||
| 192 | + | ||
| 193 | + //上一个路段的ID | ||
| 194 | + var $prev = cell.prev('.r_r_item'); | ||
| 195 | + if($prev.length > 0) | ||
| 196 | + addPrevId = $prev.data('id'); | ||
| 197 | + else{ | ||
| 198 | + if(cell.parent().hasClass('bks_list')) | ||
| 199 | + addPrevId = cell.parents('.r_r_item').data('id'); | ||
| 200 | + else | ||
| 201 | + addPrevId = -1; | ||
| 202 | + } | ||
| 203 | + }; | ||
| 204 | + | ||
| 205 | + var getRoadLI = function (r) { | ||
| 206 | + return $('.up_down_route_list>li:eq('+r.directions+')>.road_route .r_r_item[data-code='+r.sectionCode+']'); | ||
| 207 | + }; | ||
| 208 | + | ||
| 209 | + var realEditRoad; | ||
| 210 | + var callbackHandler = { | ||
| 211 | + edit: edit_road, | ||
| 212 | + insert_before: insert_road_before, | ||
| 213 | + insert_after: insert_road_after, | ||
| 214 | + destroy: function (road) { | ||
| 215 | + gb_data_submit.destroyRoad(road); | ||
| 216 | + } | ||
| 217 | + }; | ||
| 218 | + //$('.up_down_route_list>li>.road_route .r_r_item a[data-code='+data.sectionCode+']') | ||
| 219 | + $.contextMenu({ | ||
| 220 | + selector: '.up_down_route_list>li>.road_route .r_r_item a[data-code]', | ||
| 221 | + className: 'station-route-ct-menu', | ||
| 222 | + callback: function (key, options) { | ||
| 223 | + var aLink = options.$trigger; | ||
| 224 | + var code = aLink.data('code'), | ||
| 225 | + updown = aLink.data('updown'); | ||
| 226 | + | ||
| 227 | + var road = getRoad(code, updown); | ||
| 228 | + realEditRoad = road; | ||
| 229 | + callbackHandler[key] && callbackHandler[key](road); | ||
| 230 | + }, | ||
| 231 | + items: { | ||
| 232 | + 'edit': { | ||
| 233 | + name: '编辑' | ||
| 234 | + }, | ||
| 235 | + 'sep1': '---------', | ||
| 236 | + 'insert_after': { | ||
| 237 | + name: '新增路段(之后)' | ||
| 238 | + }, | ||
| 239 | + 'insert_before': { | ||
| 240 | + name: '新增路段(之前)' | ||
| 241 | + }, | ||
| 242 | + 'destroy': { | ||
| 243 | + name: '撤销路段' | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + }); | ||
| 247 | + | ||
| 248 | + var getRoad = function (code, updown) { | ||
| 249 | + var array = road_maps[updown]; | ||
| 250 | + for(var i=0,r;r=array[i++];){ | ||
| 251 | + if(r.sectionCode==code) | ||
| 252 | + return r; | ||
| 253 | + } | ||
| 254 | + return null; | ||
| 255 | + }; | ||
| 256 | + | ||
| 257 | + var cv_points = function (coords) { | ||
| 258 | + var array = [], strs; | ||
| 259 | + for (var i = 0, item; item = coords[i++];) { | ||
| 260 | + strs = item.split(' '); | ||
| 261 | + array.push({latitude: strs[1], longitude: strs[0]}); | ||
| 262 | + } | ||
| 263 | + return array; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + var update = function (road) { | ||
| 267 | + var _pos = cv_points(road.bdCoords); | ||
| 268 | + road.cp = geolib.getCenter(_pos); | ||
| 269 | + road.len = geolib.getPathLength(_pos); | ||
| 270 | + var array = road_maps[road.directions]; | ||
| 271 | + for(var i=0,item; item=array[i++];){ | ||
| 272 | + if(item.sectionCode==road.sectionCode){ | ||
| 273 | + array.splice(i - 1, 1, road); | ||
| 274 | + break; | ||
| 275 | + } | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + //重新渲染 | ||
| 279 | + var htmlStr = temps['geo_d_e_road_route-temp']({list: _group(array)}); | ||
| 280 | + $('.up_down_route_list>li:'+(road.directions==0?'first':'last')+'>.road_route').html(htmlStr); | ||
| 281 | + }; | ||
| 282 | + | ||
| 283 | + var updateList = function (list) { | ||
| 284 | + var updown = list[0].directions; | ||
| 285 | + list.sort(function (a, b) { | ||
| 286 | + return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode); | ||
| 287 | + }); | ||
| 288 | + | ||
| 289 | + var _pos; | ||
| 290 | + $.each(list, function () { | ||
| 291 | + _pos = cv_points(this.bdCoords); | ||
| 292 | + this.cp = geolib.getCenter(_pos); | ||
| 293 | + this.len = geolib.getPathLength(_pos); | ||
| 294 | + }); | ||
| 295 | + | ||
| 296 | + road_maps[updown] = list; | ||
| 297 | + //重新渲染 | ||
| 298 | + var htmlStr = temps['geo_d_e_road_route-temp']({list: _group(list)}); | ||
| 299 | + $('.up_down_route_list>li:'+(updown==0?'first':'last')+'>.road_route').html(htmlStr); | ||
| 300 | + | ||
| 301 | + gb_ct_map.reDrawRoad(updown); | ||
| 302 | + }; | ||
| 303 | + | ||
| 304 | + /** | ||
| 305 | + * 根据ID获取路段 | ||
| 306 | + * @param id | ||
| 307 | + */ | ||
| 308 | + var getRoadById = function (id) { | ||
| 309 | + for(var i=0,s;s=road_maps[0][i++];){ | ||
| 310 | + if(s.id == id) | ||
| 311 | + return s; | ||
| 312 | + } | ||
| 313 | + for(var i=0,s;s=road_maps[1][i++];){ | ||
| 314 | + if(s.id == id) | ||
| 315 | + return s; | ||
| 316 | + } | ||
| 317 | + return null; | ||
| 318 | + }; | ||
| 319 | + | ||
| 320 | + var showDrawPanel = function (name, cName) { | ||
| 321 | + var spp = $(temps['geo_d_e_add_draw_polyline-temp']({name: name, cName: cName})); | ||
| 322 | + $('body').append(spp); | ||
| 323 | + //暂停和开始绘制 | ||
| 324 | + $('.draw_polyline_switch>a', spp).on('click', function () { | ||
| 325 | + var t = $(this).text(); | ||
| 326 | + if(t=='暂停绘制'){ | ||
| 327 | + gb_ct_map.exitDrawStatus(); | ||
| 328 | + $(this).text('开始绘制'); | ||
| 329 | + } | ||
| 330 | + else{ | ||
| 331 | + gb_ct_map.openDrawStatus(); | ||
| 332 | + $(this).text('暂停绘制'); | ||
| 333 | + } | ||
| 334 | + }); | ||
| 335 | + | ||
| 336 | + gb_ct_map.showAddRoadPanel(name, cName); | ||
| 337 | + }; | ||
| 338 | + | ||
| 92 | res_load_ep.emitLater('load_road_route'); | 339 | res_load_ep.emitLater('load_road_route'); |
| 93 | return { | 340 | return { |
| 94 | init: init, getData: function () { | 341 | init: init, getData: function () { |
| @@ -98,6 +345,13 @@ var gb_road_route = function () { | @@ -98,6 +345,13 @@ var gb_road_route = function () { | ||
| 98 | return temps; | 345 | return temps; |
| 99 | }, | 346 | }, |
| 100 | clearFocus: clearFocus, | 347 | clearFocus: clearFocus, |
| 101 | - focus: focus | 348 | + focus: focus, |
| 349 | + showPathLength: showPathLength, | ||
| 350 | + update: update, | ||
| 351 | + updateList: updateList, | ||
| 352 | + getRoadById: getRoadById, | ||
| 353 | + getAddPrevId: function () { | ||
| 354 | + return addPrevId; | ||
| 355 | + } | ||
| 102 | }; | 356 | }; |
| 103 | }(); | 357 | }(); |
| 104 | \ No newline at end of file | 358 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/search.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 地图搜索定位 | ||
| 3 | + */ | ||
| 4 | +var gb_ct_search = function () { | ||
| 5 | + | ||
| 6 | + var local; | ||
| 7 | + | ||
| 8 | + var _$icon = $('.main_lt_search_panel span[uk-icon]'); | ||
| 9 | + var v, run_flag; | ||
| 10 | + $('.ct_search_input').on('input', function () { | ||
| 11 | + v = $(this).val(); | ||
| 12 | + if(run_flag) | ||
| 13 | + return; | ||
| 14 | + | ||
| 15 | + run_flag = true; | ||
| 16 | + setTimeout(function () { | ||
| 17 | + if(!v){ | ||
| 18 | + _$icon.attr('uk-icon', 'icon: search'); | ||
| 19 | + closeSearchResult(); | ||
| 20 | + } | ||
| 21 | + else{ | ||
| 22 | + _$icon.attr('uk-icon', 'icon: close'); | ||
| 23 | + local.search(v); | ||
| 24 | + } | ||
| 25 | + run_flag = false; | ||
| 26 | + }, 300); | ||
| 27 | + }); | ||
| 28 | + | ||
| 29 | + var searchComplete = function (e) { | ||
| 30 | + var htmlStr = template('geo_d_e_search_result-temp', {list: e.wr}); | ||
| 31 | + $('.ct_search_result').html(htmlStr); | ||
| 32 | + | ||
| 33 | + }; | ||
| 34 | + | ||
| 35 | + _$icon.on('click', function () { | ||
| 36 | + var type = $(this).attr('uk-icon'); | ||
| 37 | + if(type=='icon: close'){ | ||
| 38 | + $('.ct_search_input').val('');//.trigger('input'); | ||
| 39 | + _$icon.attr('uk-icon', 'icon: search'); | ||
| 40 | + closeSearchResult(); | ||
| 41 | + } | ||
| 42 | + }); | ||
| 43 | + | ||
| 44 | + $(document).on('click', '.ct_search_result>ul.s_list>li', function () { | ||
| 45 | + if($(this).hasClass('_empty')) | ||
| 46 | + return; | ||
| 47 | + var lat = $(this).data('lat'); | ||
| 48 | + var lng = $(this).data('lng'); | ||
| 49 | + gb_ct_map.focus(lat, lng); | ||
| 50 | + }); | ||
| 51 | + | ||
| 52 | + function closeSearchResult() { | ||
| 53 | + $('.ct_search_result').empty(); | ||
| 54 | + gb_ct_map.clearfocus(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + return {init: function () { | ||
| 58 | + local = new BMap.LocalSearch(gb_ct_map.map, { | ||
| 59 | + onSearchComplete: searchComplete | ||
| 60 | + }) | ||
| 61 | + }} | ||
| 62 | +}(); | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
| @@ -10,7 +10,8 @@ var gb_station_route = function () { | @@ -10,7 +10,8 @@ var gb_station_route = function () { | ||
| 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { | 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { |
| 11 | station_maps = data; | 11 | station_maps = data; |
| 12 | temps = temp; | 12 | temps = temp; |
| 13 | - console.log('station', station_maps); | 13 | + //当前使用的线路版本 |
| 14 | + storage.setItem("geo_data_edit_line_version" , data[0][0].versions); | ||
| 14 | //渲染页面 | 15 | //渲染页面 |
| 15 | var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]}); | 16 | 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 | $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); |
| @@ -50,7 +51,7 @@ var gb_station_route = function () { | @@ -50,7 +51,7 @@ var gb_station_route = function () { | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | var focus = function (s) { | 53 | var focus = function (s) { |
| 53 | - var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode); | 54 | + var elem = $('.up_down_route_list>li>.station_route .s_r_item[data-code='+s.stationCode+']'); |
| 54 | elem.addClass('ct_active'); | 55 | elem.addClass('ct_active'); |
| 55 | 56 | ||
| 56 | if (!isShow(elem)) { | 57 | if (!isShow(elem)) { |
| @@ -77,21 +78,148 @@ var gb_station_route = function () { | @@ -77,21 +78,148 @@ var gb_station_route = function () { | ||
| 77 | return null; | 78 | return null; |
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 81 | + /** | ||
| 82 | + * 编辑站点名称 | ||
| 83 | + * @param station | ||
| 84 | + */ | ||
| 85 | + var station_edit_name = function (station) { | ||
| 86 | + var cellWrap = getStationLI(station); | ||
| 87 | + $('a[data-code]', cellWrap).hide(); | ||
| 88 | + | ||
| 89 | + cellWrap.append(temps['geo_d_e_edit_name_panel-temp'](station)).addClass('_edit_name'); | ||
| 90 | + //焦点 | ||
| 91 | + $('input[name=stationName]', cellWrap).focus(); | ||
| 92 | + //取消 | ||
| 93 | + $('.cancel_icon_btn', cellWrap).on('click', function () { | ||
| 94 | + $('.ul_li_input', cellWrap).remove(); | ||
| 95 | + $('a[data-code]', cellWrap).show(); | ||
| 96 | + }); | ||
| 97 | + }; | ||
| 98 | + | ||
| 99 | + var getStationLI = function (s) { | ||
| 100 | + return $('.up_down_route_list>li:eq('+s.directions+')>.station_route .s_r_item[data-code='+s.stationCode+']'); | ||
| 101 | + }; | ||
| 102 | + | ||
| 103 | + var addPrevId;//添加站点路由的上一个站点ID | ||
| 104 | + var insert_station_before = function (station) { | ||
| 105 | + //在之前插入站点 | ||
| 106 | + var cell = getStationLI(station); | ||
| 107 | + | ||
| 108 | + var addCell = $(temps['geo_d_e_add_station_panel-temp'](station)); | ||
| 109 | + cell.before(addCell); | ||
| 110 | + | ||
| 111 | + add_station(addCell); | ||
| 112 | + }; | ||
| 113 | + | ||
| 114 | + | ||
| 115 | + //添加站点 取消按钮 | ||
| 116 | + $(document).on('click', '.add_station_search_point_wrap button.cancel', function () { | ||
| 117 | + $('.main_left_panel_m_layer').hide(); | ||
| 118 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 119 | + gb_ct_map.resetMapStatus(); | ||
| 120 | + }); | ||
| 121 | + | ||
| 122 | + var add_station = function (addCell) { | ||
| 123 | + gb_ct_map.closeInfoWin(); | ||
| 124 | + //焦点 | ||
| 125 | + var $nameInput = $('input[name=stationName]', addCell); | ||
| 126 | + $nameInput.focus(); | ||
| 127 | + //取消 | ||
| 128 | + $('.cancel_icon_btn', addCell).on('click', function () { | ||
| 129 | + addCell.remove(); | ||
| 130 | + }); | ||
| 131 | + | ||
| 132 | + //选择地图位置 | ||
| 133 | + $('.search_point_icon_btn', addCell).on('click', function () { | ||
| 134 | + $('.station_li_transient').removeClass('_search_point'); | ||
| 135 | + $(this).parents('.station_li_transient').addClass('_search_point'); | ||
| 136 | + var name = $nameInput.val(); | ||
| 137 | + if(!name) | ||
| 138 | + return UIkit.notification("你必须输入站点名称!", {status: 'danger'}); | ||
| 139 | + | ||
| 140 | + if(is_duplication(name)) | ||
| 141 | + return UIkit.notification("站点路由名称重复!!", {status: 'danger'}); | ||
| 142 | + | ||
| 143 | + debugger | ||
| 144 | + //上一个站点的ID | ||
| 145 | + var _cell = $(this).parents('.station_li_transient'); | ||
| 146 | + var $prev = prevs(_cell, 's_r_item') | ||
| 147 | + if($prev.length > 0) | ||
| 148 | + addPrevId = $prev.data('id'); | ||
| 149 | + else | ||
| 150 | + addPrevId = -1; | ||
| 151 | + | ||
| 152 | + $('.main_left_panel_m_layer').show(); | ||
| 153 | + gb_ct_map.showAddPointPanel(name); | ||
| 154 | + | ||
| 155 | + }); | ||
| 156 | + //监听回车事件 | ||
| 157 | + $('[name=stationName]', addCell).on('keydown', function (e) { | ||
| 158 | + if(event.keyCode == "13") | ||
| 159 | + $('.search_point_icon_btn', addCell).trigger('click'); | ||
| 160 | + }); | ||
| 161 | + }; | ||
| 162 | + | ||
| 163 | + var prevs = function (that, clazz) { | ||
| 164 | + var prev; | ||
| 165 | + while(true){ | ||
| 166 | + prev = $(that).prev(); | ||
| 167 | + | ||
| 168 | + if(prev.length == 0) | ||
| 169 | + return null; | ||
| 170 | + | ||
| 171 | + if(prev.hasClass(clazz)) | ||
| 172 | + return prev; | ||
| 173 | + | ||
| 174 | + that = prev; | ||
| 175 | + } | ||
| 176 | + }; | ||
| 177 | + | ||
| 178 | + /** | ||
| 179 | + * name 是否重复 | ||
| 180 | + * @param name | ||
| 181 | + */ | ||
| 182 | + var is_duplication = function (name) { | ||
| 183 | + var array = station_maps[getUpDown()]; | ||
| 184 | + for(var i=0, s; s=array[i++];){ | ||
| 185 | + if(s.stationName==$.trim(name)) | ||
| 186 | + return true; | ||
| 187 | + } | ||
| 188 | + return false; | ||
| 189 | + }; | ||
| 190 | + | ||
| 191 | + var insert_station_after = function (station) { | ||
| 192 | + //在之后插入站点 | ||
| 193 | + var cell = getStationLI(station); | ||
| 194 | + | ||
| 195 | + var addCell = $(temps['geo_d_e_add_station_panel-temp'](station)); | ||
| 196 | + cell.after(addCell); | ||
| 197 | + | ||
| 198 | + add_station(addCell); | ||
| 199 | + }; | ||
| 200 | + | ||
| 201 | + var realEditStation; | ||
| 80 | var callbackHandler = { | 202 | var callbackHandler = { |
| 81 | edit_buffer: function (station) { | 203 | edit_buffer: function (station) { |
| 82 | - //编辑缓冲区 | ||
| 83 | gb_ct_map.editStationBuffer(station); | 204 | gb_ct_map.editStationBuffer(station); |
| 205 | + }, | ||
| 206 | + edit_name: station_edit_name, | ||
| 207 | + insert_before: insert_station_before, | ||
| 208 | + insert_after: insert_station_after, | ||
| 209 | + destroy: function (station) { | ||
| 210 | + gb_data_submit.destroyStation(station); | ||
| 84 | } | 211 | } |
| 85 | }; | 212 | }; |
| 86 | 213 | ||
| 87 | $.contextMenu({ | 214 | $.contextMenu({ |
| 88 | - selector: '._route_info_wrap .up_down_route_list .station_route>ul>li', | 215 | + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li>a[data-code]', |
| 89 | className: 'station-route-ct-menu', | 216 | className: 'station-route-ct-menu', |
| 90 | callback: function (key, options) { | 217 | callback: function (key, options) { |
| 91 | - var aLink = options.$trigger.find('a[data-code]'); | 218 | + var aLink = options.$trigger; |
| 92 | var code = aLink.data('code'), | 219 | var code = aLink.data('code'), |
| 93 | updown = aLink.data('updown'); | 220 | updown = aLink.data('updown'); |
| 94 | var station = getStation(code, updown); | 221 | var station = getStation(code, updown); |
| 222 | + realEditStation = station; | ||
| 95 | callbackHandler[key] && callbackHandler[key](station); | 223 | callbackHandler[key] && callbackHandler[key](station); |
| 96 | }, | 224 | }, |
| 97 | items: { | 225 | items: { |
| @@ -99,14 +227,17 @@ var gb_station_route = function () { | @@ -99,14 +227,17 @@ var gb_station_route = function () { | ||
| 99 | name: '编辑缓冲区' | 227 | name: '编辑缓冲区' |
| 100 | }, | 228 | }, |
| 101 | 'sep1': '---------', | 229 | 'sep1': '---------', |
| 102 | - 'edit': { | ||
| 103 | - name: '编辑基础信息' | 230 | + 'edit_name': { |
| 231 | + name: '修改站点名称' | ||
| 232 | + }, | ||
| 233 | + 'insert_after': { | ||
| 234 | + name: '新增站点(之后)' | ||
| 104 | }, | 235 | }, |
| 105 | 'insert_before': { | 236 | 'insert_before': { |
| 106 | - name: '新增站点(前)' | 237 | + name: '新增站点(之前)' |
| 107 | }, | 238 | }, |
| 108 | - 'insert_after': { | ||
| 109 | - name: '新增站点(后)' | 239 | + 'destroy': { |
| 240 | + name: '撤销站点' | ||
| 110 | } | 241 | } |
| 111 | } | 242 | } |
| 112 | }); | 243 | }); |
| @@ -115,30 +246,97 @@ var gb_station_route = function () { | @@ -115,30 +246,97 @@ var gb_station_route = function () { | ||
| 115 | var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); | 246 | var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); |
| 116 | $('.ct_page').append(htmlStr); | 247 | $('.ct_page').append(htmlStr); |
| 117 | $('.buffer_edit_panel').show(); | 248 | $('.buffer_edit_panel').show(); |
| 249 | + | ||
| 250 | + //缓冲区编辑 取消 | ||
| 251 | + $('button.cancel', $editWrap).on('click', function (e) { | ||
| 252 | + $('.main_left_panel_m_layer').hide(); | ||
| 253 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 254 | + gb_ct_map.resetMapStatus(); | ||
| 255 | + | ||
| 256 | + var f = $(this).parents('form'); | ||
| 257 | + var data = f.serializeJSON(); | ||
| 258 | + | ||
| 259 | + gb_ct_map.exitEditBufferStatus(data); | ||
| 260 | + }); | ||
| 261 | + | ||
| 262 | + var $editWrap = '.buffer_edit_panel>.buffer_edit_body'; | ||
| 263 | + | ||
| 264 | + //缓冲区编辑 切换缓冲区类型(圆形,多边形) | ||
| 265 | + $('select[name=shapesType]', $editWrap).on('change', function (e) { | ||
| 266 | + var v = $(this).val(); | ||
| 267 | + if(v=='d'){ | ||
| 268 | + $('.buffer_edit_panel .shapes_type').addClass('st_d'); | ||
| 269 | + } | ||
| 270 | + else{ | ||
| 271 | + $('.buffer_edit_panel .shapes_type').removeClass('st_d'); | ||
| 272 | + $('input[name=radius]', $editWrap).val(80); | ||
| 273 | + } | ||
| 274 | + gb_ct_map.changeShapeType(v); | ||
| 275 | + }); | ||
| 276 | + | ||
| 277 | + //半径修改 | ||
| 278 | + var update_radius_flag, update_radius; | ||
| 279 | + $('input[name=radius]', $editWrap).on('input', function (e) { | ||
| 280 | + update_radius = $(this).val(); | ||
| 281 | + if(update_radius_flag){ | ||
| 282 | + return; | ||
| 283 | + } | ||
| 284 | + update_radius_flag = true; | ||
| 285 | + setTimeout(function () { | ||
| 286 | + gb_ct_map.updateDragRadius(update_radius); | ||
| 287 | + update_radius_flag = false; | ||
| 288 | + }, 180); | ||
| 289 | + }); | ||
| 290 | + | ||
| 291 | + //缓冲区编辑 切换绘制模式 | ||
| 292 | + $('.draw_polygon_switch', $editWrap).on('input', function (e) { | ||
| 293 | + var type = $(this).data('type'); | ||
| 294 | + if(type==1){ | ||
| 295 | + //退出绘制状态 | ||
| 296 | + gb_ct_map.exitDrawStatus(); | ||
| 297 | + $(this).data('type', 0).find('a').text('开始绘制'); | ||
| 298 | + } | ||
| 299 | + else if(type==0 || type==2){ | ||
| 300 | + gb_ct_map.openDrawStatus(); | ||
| 301 | + $(this).data('type', 1).find('a').text('暂停绘制'); | ||
| 302 | + } | ||
| 303 | + else if(type==3){ | ||
| 304 | + gb_ct_map.changeShapeType('d'); | ||
| 305 | + $(this).data('type', 1).find('a').text('暂停绘制'); | ||
| 306 | + } | ||
| 307 | + }); | ||
| 118 | }; | 308 | }; |
| 119 | 309 | ||
| 120 | - var hideEditPanel = function () { | ||
| 121 | - $('.buffer_edit_panel').remove(); | 310 | + /** |
| 311 | + * 绘制结束 | ||
| 312 | + */ | ||
| 313 | + var drawEnd = function () { | ||
| 314 | + $('.buffer_edit_panel>.buffer_edit_body .draw_polygon_switch').data('type', 2).find('a').text('重新绘制'); | ||
| 122 | }; | 315 | }; |
| 123 | 316 | ||
| 124 | var edPanelRunFlag; | 317 | var edPanelRunFlag; |
| 125 | var ecObj; | 318 | var ecObj; |
| 126 | - var reWriteEditPanel = function (ec) { | 319 | + var reWriteEditPanel = function (ec, isPolygon) { |
| 320 | + ecObj = ec; | ||
| 127 | if(edPanelRunFlag){ | 321 | if(edPanelRunFlag){ |
| 128 | - ecObj = ec; | ||
| 129 | return; | 322 | return; |
| 130 | } | 323 | } |
| 131 | 324 | ||
| 132 | edPanelRunFlag = true; | 325 | edPanelRunFlag = true; |
| 133 | setTimeout(function () { | 326 | setTimeout(function () { |
| 134 | var panel = $('.buffer_edit_panel'); | 327 | var panel = $('.buffer_edit_panel'); |
| 135 | - $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径 | 328 | + var p; |
| 329 | + if(!isPolygon){ | ||
| 330 | + $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径 | ||
| 331 | + p = ecObj.getCenter(); | ||
| 332 | + }else{ | ||
| 333 | + p = ecObj.point; | ||
| 334 | + } | ||
| 136 | 335 | ||
| 137 | - var p = ecObj.getCenter(); | ||
| 138 | $('[name=gLaty]', panel).val(p.lat); | 336 | $('[name=gLaty]', panel).val(p.lat); |
| 139 | $('[name=gLonx]', panel).val(p.lng); | 337 | $('[name=gLonx]', panel).val(p.lng); |
| 140 | edPanelRunFlag = false; | 338 | edPanelRunFlag = false; |
| 141 | - }, 170); | 339 | + }, 200); |
| 142 | }; | 340 | }; |
| 143 | 341 | ||
| 144 | var update = function (s) { | 342 | var update = function (s) { |
| @@ -146,65 +344,123 @@ var gb_station_route = function () { | @@ -146,65 +344,123 @@ var gb_station_route = function () { | ||
| 146 | for(var i=0,item; item=array[i++];){ | 344 | for(var i=0,item; item=array[i++];){ |
| 147 | if(item.stationCode==s.stationCode){ | 345 | if(item.stationCode==s.stationCode){ |
| 148 | s.index = i; | 346 | s.index = i; |
| 149 | - array.splice(i, 1, s); | 347 | + array.splice(i - 1, 1, s); |
| 150 | break; | 348 | break; |
| 151 | } | 349 | } |
| 152 | } | 350 | } |
| 351 | + | ||
| 352 | + //替换 | ||
| 353 | + var sCell = $(temps['geo_d_e_station_route_one-temp'](s)); | ||
| 354 | + $('a.uk-animation-shake', sCell).on('webkitAnimationEnd', function () { | ||
| 355 | + $(this).removeClass('uk-animation-shake'); | ||
| 356 | + }); | ||
| 357 | + getStationLI(s).replaceWith(sCell); | ||
| 153 | }; | 358 | }; |
| 154 | 359 | ||
| 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(); | 360 | + //取消按钮 |
| 361 | +/* $(document).on('click','.buffer_edit_body button.cancel', function (e) { | ||
| 362 | + $('.main_left_panel_m_layer').hide(); | ||
| 363 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 364 | + gb_ct_map.resetMapStatus(); | ||
| 365 | + });*/ | ||
| 161 | 366 | ||
| 162 | - gb_ct_map.exitEditBufferStatus(data); | ||
| 163 | - }); | ||
| 164 | 367 | ||
| 165 | - /** | ||
| 166 | - * 缓冲区编辑 切换缓冲区类型(圆形,多边形) | ||
| 167 | - */ | ||
| 168 | - $(document).on('click', '.buffer_edit_panel>.buffer_edit_body select[name=shapesType]', function (e) { | ||
| 169 | - var v = $(this).val(); | 368 | + var spcPanelRunFlag; |
| 369 | + var spcPoint; | ||
| 370 | + var reWriteSearchPointPanel = function (point) { | ||
| 371 | + spcPoint = point; | ||
| 372 | + if(spcPanelRunFlag){ | ||
| 373 | + return; | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + spcPanelRunFlag = true; | ||
| 377 | + setTimeout(function () { | ||
| 378 | + var panel = $('.add_station_search_point_wrap .buffer_edit_body'); | ||
| 170 | 379 | ||
| 171 | - gb_ct_map.changeShapeType(v); | ||
| 172 | - if(v=='d'){ | ||
| 173 | - $('.buffer_edit_panel .shapes_type').addClass('st_d'); | 380 | + $('[name=gLaty]', panel).val(spcPoint.lat); |
| 381 | + $('[name=gLonx]', panel).val(spcPoint.lng); | ||
| 382 | + spcPanelRunFlag = false; | ||
| 383 | + }, 200); | ||
| 384 | + }; | ||
| 174 | 385 | ||
| 386 | + var updateStationRouteData = function (list) { | ||
| 387 | + list.sort(function (a, b) { | ||
| 388 | + return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode); | ||
| 389 | + }); | ||
| 175 | 390 | ||
| 176 | - // | ||
| 177 | - //UIkit.notification("使用鼠标在地图上绘制多边形,可点击上发“暂停绘制”链接,退出绘制模式,以拖拽地图", {status: 'primary', pos: 'bottom-center'}) | ||
| 178 | - } | ||
| 179 | - else{ | ||
| 180 | - $('.buffer_edit_panel .shapes_type').removeClass('st_d'); | 391 | + var upDown = list[0].directions; |
| 392 | + var dataMaps = {}; | ||
| 393 | + //更新数据 | ||
| 394 | + for(var i=0,s;s=list[i++];){ | ||
| 395 | + s.index = i; | ||
| 396 | + dataMaps[s.id] = s; | ||
| 181 | } | 397 | } |
| 182 | - }); | 398 | + station_maps[upDown] = list; |
| 399 | + //更新序号 | ||
| 400 | + var wrap = $('.up_down_route_list>li:eq('+upDown+')>.station_route'); | ||
| 401 | + $('.s_r_item', wrap).each(function () { | ||
| 402 | + $(this).replaceWith( | ||
| 403 | + temps['geo_d_e_station_route_one-temp'](dataMaps[$(this).data('id')])); | ||
| 404 | + }); | ||
| 405 | + | ||
| 406 | + //延迟清除动画class | ||
| 407 | + setTimeout(function () { | ||
| 408 | + $('.s_r_item a.uk-animation-shake', wrap).removeClass('uk-animation-shake'); | ||
| 409 | + }, 1000); | ||
| 410 | + | ||
| 411 | + //更新地图 | ||
| 412 | + gb_ct_map.reDrawStation(upDown); | ||
| 413 | + }; | ||
| 183 | 414 | ||
| 184 | /** | 415 | /** |
| 185 | - * 缓冲区编辑 切换绘制模式 | 416 | + * 添加结束,刷新List |
| 417 | + * @param list | ||
| 186 | */ | 418 | */ |
| 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 | - }); | 419 | + var addEnd = function (list, _newRCode) { |
| 420 | + updateStationRouteData(list); | ||
| 421 | + | ||
| 422 | + var upDown = list[0].directions; | ||
| 423 | + var wrap = $('.up_down_route_list>li:eq('+upDown+')>.station_route'); | ||
| 424 | + //新增的站点路由 | ||
| 425 | + var ns = getStationByRouteCode(upDown, _newRCode); | ||
| 426 | + $('.station_li_transient._search_point', wrap).replaceWith( | ||
| 427 | + temps['geo_d_e_station_route_one-temp'](ns) | ||
| 428 | + ); | ||
| 429 | + | ||
| 430 | + $('.main_left_panel_m_layer').hide(); | ||
| 431 | + $('.add_station_search_point_wrap').remove(); | ||
| 432 | + }; | ||
| 200 | 433 | ||
| 201 | /** | 434 | /** |
| 202 | - * 绘制结束 | 435 | + * 撤销完成 |
| 436 | + * @param list | ||
| 203 | */ | 437 | */ |
| 204 | - var drawEnd = function () { | ||
| 205 | - $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); | 438 | + var destroyEnd = function (list, station) { |
| 439 | + //被撤销的 | ||
| 440 | + $('.up_down_route_list .s_r_item[data-id='+station.id+']').remove(); | ||
| 441 | + updateStationRouteData(list); | ||
| 442 | + }; | ||
| 443 | + | ||
| 444 | + var getStationByRouteCode = function (upDown, _newRCode) { | ||
| 445 | + var list = station_maps[upDown]; | ||
| 446 | + for(var i=0,s; s=list[i++];){ | ||
| 447 | + if(s.stationRouteCode==_newRCode) | ||
| 448 | + return s; | ||
| 449 | + } | ||
| 450 | + return null; | ||
| 206 | }; | 451 | }; |
| 207 | 452 | ||
| 453 | + var getStationById = function (id) { | ||
| 454 | + for(var i=0,s;s=station_maps[0][i++];){ | ||
| 455 | + if(s.id == id) | ||
| 456 | + return s; | ||
| 457 | + } | ||
| 458 | + for(var i=0,s;s=station_maps[1][i++];){ | ||
| 459 | + if(s.id == id) | ||
| 460 | + return s; | ||
| 461 | + } | ||
| 462 | + return null; | ||
| 463 | + }; | ||
| 208 | 464 | ||
| 209 | res_load_ep.emitLater('load_station_route'); | 465 | res_load_ep.emitLater('load_station_route'); |
| 210 | return { | 466 | return { |
| @@ -218,9 +474,18 @@ var gb_station_route = function () { | @@ -218,9 +474,18 @@ var gb_station_route = function () { | ||
| 218 | clearFocus: clearFocus, | 474 | clearFocus: clearFocus, |
| 219 | focus: focus, | 475 | focus: focus, |
| 220 | showEditPanel: showEditPanel, | 476 | showEditPanel: showEditPanel, |
| 221 | - hideEditPanel: hideEditPanel, | ||
| 222 | reWriteEditPanel: reWriteEditPanel, | 477 | reWriteEditPanel: reWriteEditPanel, |
| 223 | update: update, | 478 | update: update, |
| 224 | - drawEnd: drawEnd | 479 | + drawEnd: drawEnd, |
| 480 | + getRealEditStation: function () { | ||
| 481 | + return realEditStation; | ||
| 482 | + }, | ||
| 483 | + reWriteSearchPointPanel: reWriteSearchPointPanel, | ||
| 484 | + getAddPrevId: function () { | ||
| 485 | + return addPrevId; | ||
| 486 | + }, | ||
| 487 | + addEnd: addEnd, | ||
| 488 | + destroyEnd: destroyEnd, | ||
| 489 | + getStationById:getStationById | ||
| 225 | }; | 490 | }; |
| 226 | }(); | 491 | }(); |
| 227 | \ No newline at end of file | 492 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
| @@ -10,13 +10,27 @@ var gb_data_submit = function () { | @@ -10,13 +10,27 @@ var gb_data_submit = function () { | ||
| 10 | var f = $(this).parents('form'); | 10 | var f = $(this).parents('form'); |
| 11 | var data = f.serializeJSON(); | 11 | var data = f.serializeJSON(); |
| 12 | UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() { | 12 | UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() { |
| 13 | + if(data.shapesType=='d'){ | ||
| 14 | + var polygon = gb_ct_map.getDrawPolygon(); | ||
| 15 | + if(null == polygon){ | ||
| 16 | + alert('失败,无法获取到 polygon..'); | ||
| 17 | + return; | ||
| 18 | + } | ||
| 19 | + var pos = polygon.getPath(); | ||
| 20 | + //闭合 | ||
| 21 | + pos.push(pos[0]); | ||
| 22 | + var gPolygonGrid = ''; | ||
| 23 | + for(var i=0,p;p=pos[i++];){ | ||
| 24 | + gPolygonGrid += (p.lng + " " + p.lat + ","); | ||
| 25 | + } | ||
| 26 | + data.gPolygonGrid = gPolygonGrid.substr(0, gPolygonGrid.length - 1); | ||
| 27 | + } | ||
| 13 | 28 | ||
| 14 | - //console.log('aaa',f, f.serializeJSON()); | ||
| 15 | - show_run_text('正在提交缓冲区信息'); | 29 | + //gb_ct_map.removeDragMarkerEvent(); |
| 30 | + show_run_text('正在提交缓冲区信息...'); | ||
| 16 | gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { | 31 | gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { |
| 17 | hide_run_text(); | 32 | hide_run_text(); |
| 18 | UIkit.notification("提交成功!", {status: 'success'}); | 33 | UIkit.notification("提交成功!", {status: 'success'}); |
| 19 | - | ||
| 20 | //更新前端数据 | 34 | //更新前端数据 |
| 21 | gb_station_route.update(rs.station); | 35 | gb_station_route.update(rs.station); |
| 22 | gb_ct_map.updateStation(rs.station); | 36 | gb_ct_map.updateStation(rs.station); |
| @@ -24,12 +38,123 @@ var gb_data_submit = function () { | @@ -24,12 +38,123 @@ var gb_data_submit = function () { | ||
| 24 | //退出编辑模式 | 38 | //退出编辑模式 |
| 25 | gb_ct_map.exitEditBufferStatus(rs.station); | 39 | gb_ct_map.exitEditBufferStatus(rs.station); |
| 26 | }); | 40 | }); |
| 27 | - }, function () { | ||
| 28 | - console.log('Rejected.') | ||
| 29 | }); | 41 | }); |
| 30 | return false; | 42 | return false; |
| 31 | }); | 43 | }); |
| 32 | 44 | ||
| 45 | + /** | ||
| 46 | + * 修改名称提交 | ||
| 47 | + */ | ||
| 48 | + $(document).on('click', '.up_down_route_list .station_route .ul_li_input .save_icon_btn', function (e) { | ||
| 49 | + var f = $(this).parents('form'); | ||
| 50 | + var data = f.serializeJSON(); | ||
| 51 | + | ||
| 52 | + UIkit.modal.confirm('确定将站点名称修改为【'+data.stationName+'】?').then(function() { | ||
| 53 | + show_run_text('正在保存...'); | ||
| 54 | + | ||
| 55 | + gb_common.$post('/_geo_data/updateStationName', data, function (rs) { | ||
| 56 | + hide_run_text(); | ||
| 57 | + UIkit.notification("修改成功!", {status: 'success'}); | ||
| 58 | + gb_station_route.update(rs.station); | ||
| 59 | + }); | ||
| 60 | + }); | ||
| 61 | + }); | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 新增站点提交 | ||
| 65 | + */ | ||
| 66 | + $(document).on('click', '.add_station_search_point_wrap .buffer_edit_body button.submit', function (e) { | ||
| 67 | + var f = $(this).parents('form'); | ||
| 68 | + var data = f.serializeJSON(); | ||
| 69 | + data.stationName = $.trim(data.stationName); | ||
| 70 | + | ||
| 71 | + UIkit.modal.confirm('确定新增站点【'+data.stationName+'】?').then(function() { | ||
| 72 | + data.lineCode = storage.getItem('geo_data_edit_line_code'); | ||
| 73 | + data.versions = storage.getItem('geo_data_edit_line_version'); | ||
| 74 | + data.upDown = getUpDown(); | ||
| 75 | + data.prevRouteId = gb_station_route.getAddPrevId(); | ||
| 76 | + data.lng = data.gLonx; | ||
| 77 | + data.lat = data.gLaty; | ||
| 78 | + | ||
| 79 | + delete data.gLonx; | ||
| 80 | + delete data.gLaty; | ||
| 81 | + show_run_text('正在提交数据...'); | ||
| 82 | + //添加 | ||
| 83 | + gb_common.$post('/_geo_data/addNewStationRoute', data, function (rs) { | ||
| 84 | + gb_station_route.addEnd(rs.list, rs.newStationRouteCode); | ||
| 85 | + | ||
| 86 | + hide_run_text(); | ||
| 87 | + UIkit.notification("修改成功!", {status: 'success'}); | ||
| 88 | + }); | ||
| 89 | + }); | ||
| 90 | + return false; | ||
| 91 | + }); | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * 新增路段提交 | ||
| 95 | + */ | ||
| 96 | + $(document).on('click', '.add_road_search_point_wrap .buffer_edit_body button.submit', function (e) { | ||
| 97 | + var f = $(this).parents('form'); | ||
| 98 | + var data = f.serializeJSON(); | ||
| 99 | + | ||
| 100 | + UIkit.modal.confirm('确定新增路段【'+data.sectionName+'('+data.crosesRoad+')】?').then(function() { | ||
| 101 | + data.lineCode = storage.getItem('geo_data_edit_line_code'); | ||
| 102 | + data.versions = storage.getItem('geo_data_edit_line_version'); | ||
| 103 | + data.upDown = getUpDown(); | ||
| 104 | + | ||
| 105 | + data.prevRouteId = gb_road_route.getAddPrevId(); | ||
| 106 | + | ||
| 107 | + var polyline = gb_ct_map.getDrawPolyline(); | ||
| 108 | + var pos = polyline.getPath(); | ||
| 109 | + var gsectionVector = ''; | ||
| 110 | + for(var i=0,p;p=pos[i++];){ | ||
| 111 | + gsectionVector += (p.lng + " " + p.lat + ","); | ||
| 112 | + } | ||
| 113 | + data.coords = gsectionVector.substr(0, gsectionVector.length - 1); | ||
| 114 | + | ||
| 115 | + show_run_text('正在提交数据...'); | ||
| 116 | + //添加 | ||
| 117 | + gb_common.$post('/_geo_data/addNewRoadRoute', data, function (rs) { | ||
| 118 | + | ||
| 119 | + gb_road_route.updateList(rs.list); | ||
| 120 | + hide_run_text(); | ||
| 121 | + UIkit.notification("添加成功!", {status: 'success'}); | ||
| 122 | + $('.add_road_search_point_wrap').remove(); | ||
| 123 | + gb_ct_map.exitEditRoadStatus(null, true); | ||
| 124 | + }); | ||
| 125 | + }); | ||
| 126 | + return false; | ||
| 127 | + }); | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * 路段编辑提交 | ||
| 131 | + */ | ||
| 132 | + $(document).on('click', '.road_edit_panel .buffer_edit_body button.submit', function (e) { | ||
| 133 | + var f = $(this).parents('form'); | ||
| 134 | + var data = f.serializeJSON(); | ||
| 135 | + | ||
| 136 | + var polyline = gb_ct_map.getDrawPolyline(); | ||
| 137 | + var pos = polyline.getPath(); | ||
| 138 | + var gsectionVector = ''; | ||
| 139 | + for(var i=0,p;p=pos[i++];){ | ||
| 140 | + gsectionVector += (p.lng + " " + p.lat + ","); | ||
| 141 | + } | ||
| 142 | + data.gsectionVector = gsectionVector.substr(0, gsectionVector.length - 1); | ||
| 143 | + | ||
| 144 | + console.log('data', data); | ||
| 145 | + UIkit.modal.confirm('确定保存编辑的【'+data.sectionName+'】?').then(function() { | ||
| 146 | + show_run_text('正在保存...'); | ||
| 147 | + | ||
| 148 | + gb_common.$post('/_geo_data/updateRoadInfo', data, function (rs) { | ||
| 149 | + hide_run_text(); | ||
| 150 | + UIkit.notification("修改成功!", {status: 'success'}); | ||
| 151 | + gb_road_route.update(rs.road); | ||
| 152 | + | ||
| 153 | + gb_ct_map.exitEditRoadStatus(rs.road); | ||
| 154 | + }); | ||
| 155 | + }); | ||
| 156 | + }); | ||
| 157 | + | ||
| 33 | var show_run_text = function (t) { | 158 | var show_run_text = function (t) { |
| 34 | $('.text', $loadPanel).text(t); | 159 | $('.text', $loadPanel).text(t); |
| 35 | $loadPanel.show(); | 160 | $loadPanel.show(); |
| @@ -39,5 +164,49 @@ var gb_data_submit = function () { | @@ -39,5 +164,49 @@ var gb_data_submit = function () { | ||
| 39 | $('.text', $loadPanel).text(''); | 164 | $('.text', $loadPanel).text(''); |
| 40 | $loadPanel.hide(); | 165 | $loadPanel.hide(); |
| 41 | }; | 166 | }; |
| 42 | - return {}; | 167 | + |
| 168 | + /** | ||
| 169 | + * 撤销站点 | ||
| 170 | + * @param station | ||
| 171 | + */ | ||
| 172 | + var destroyStation = function (station) { | ||
| 173 | + | ||
| 174 | + UIkit.modal.confirm('确定撤销站点【'+station.stationName+'】?').then(function() { | ||
| 175 | + show_run_text('正在撤销...'); | ||
| 176 | + | ||
| 177 | + gb_common.$post("/_geo_data/destroyStation", station, function (rs) { | ||
| 178 | + gb_station_route.destroyEnd(rs.list, station); | ||
| 179 | + hide_run_text(); | ||
| 180 | + UIkit.notification("撤销成功!", {status: 'success'}); | ||
| 181 | + }); | ||
| 182 | + }); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * 撤销路段 | ||
| 187 | + * @param road | ||
| 188 | + */ | ||
| 189 | + var destroyRoad = function (road) { | ||
| 190 | + UIkit.modal.confirm('确定撤销路段【'+road.sectionName+'】?').then(function() { | ||
| 191 | + show_run_text('正在撤销...'); | ||
| 192 | + console.log('road', road); | ||
| 193 | + | ||
| 194 | + delete road.bdCoords; | ||
| 195 | + delete road.cp; | ||
| 196 | + gb_common.$post("/_geo_data/destroyRoad", road, function (rs) { | ||
| 197 | + | ||
| 198 | + gb_road_route.updateList(rs.list); | ||
| 199 | + hide_run_text(); | ||
| 200 | + UIkit.notification("撤销成功!", {status: 'success'}); | ||
| 201 | + }); | ||
| 202 | + }); | ||
| 203 | + }; | ||
| 204 | + | ||
| 205 | + function getUpDown(){ | ||
| 206 | + return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1; | ||
| 207 | + } | ||
| 208 | + return { | ||
| 209 | + destroyStation: destroyStation, | ||
| 210 | + destroyRoad: destroyRoad | ||
| 211 | + }; | ||
| 43 | }(); | 212 | }(); |
| 44 | \ No newline at end of file | 213 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/version_manage.js
| @@ -2,6 +2,85 @@ | @@ -2,6 +2,85 @@ | ||
| 2 | 2 | ||
| 3 | var gb_version_manage = function () { | 3 | var gb_version_manage = function () { |
| 4 | 4 | ||
| 5 | + var array; | ||
| 6 | + var lineName; | ||
| 7 | + var current; | ||
| 8 | + | ||
| 9 | + var temps; | ||
| 10 | + var init = function (cVersion) { | ||
| 11 | + var lineCode = storage.getItem("geo_data_edit_line_code"); | ||
| 12 | + //获取线路版本信息 | ||
| 13 | + gb_common.$get('/_geo_data/findVersionInfo', {lineCode: lineCode}, function (rs) { | ||
| 14 | + array = rs.list; | ||
| 15 | + lineName = array[0].lineName; | ||
| 16 | + | ||
| 17 | + //当前使用版本 | ||
| 18 | + for(var i=0,obj;obj=array[i++];){ | ||
| 19 | + if(obj.versions==cVersion){ | ||
| 20 | + current = obj; | ||
| 21 | + break; | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + if(!current){ | ||
| 26 | + alert('异常,无法选中当前线路版本!'); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + //线路名称 | ||
| 30 | + $('.main_left_panel>._line_info>._line_name>span').text(lineName); | ||
| 31 | + //当前版本 | ||
| 32 | + $('.main_left_panel ._version_dropdown_wrap>._version_text').html(current.name + '<i uk-icon="icon: chevron-down;ratio:.6"></i>'); | ||
| 33 | + }); | ||
| 34 | + | ||
| 35 | + $.get('/pages/base/geo_data_edit/fragments/versions.html', function (dom) { | ||
| 36 | + temps = gb_common.compileTempByDom(dom, { | ||
| 37 | + compress: true | ||
| 38 | + }); | ||
| 39 | + }); | ||
| 40 | + }; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 新增 | ||
| 44 | + */ | ||
| 45 | + $('.add_line_version_icon').on('click', function () { | ||
| 46 | + console.log('arrayarray', array); | ||
| 47 | + var htmlStr = temps['geo_d_e_version_add-temp']({array: array}); | ||
| 48 | + | ||
| 49 | + $(document.body).append(htmlStr); | ||
| 50 | + UIkit.modal('#add_line_versions_modal').show(); | ||
| 51 | + flatpickr('#add_line_versions_modal input._flatpickr', gb_common.flatpickrDateTimeConfig); | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + var modal = '#add_line_versions_modal'; | ||
| 55 | + var reSetName = function () { | ||
| 56 | + var remark = $('[name=remark]', modal).val(); | ||
| 57 | + var rq = $('[name=startDate]', modal).val(); | ||
| 58 | + | ||
| 59 | + $('[name=name]', modal).val(rq.substr(0, 10).replace(/-/g,'') + remark); | ||
| 60 | + }; | ||
| 61 | + //自动填充版本名称 | ||
| 62 | + $('[name=remark]', modal).on('change', reSetName); | ||
| 63 | + $('[name=startDate]', modal).on('input', reSetName); | ||
| 64 | + }); | ||
| 65 | + | ||
| 66 | + $(document).on('hidden', '.uk-modal', function () { | ||
| 67 | + $(this).remove(); | ||
| 68 | + $('.flatpickr-calendar').remove(); | ||
| 69 | + }); | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 提交新增的线路版本 | ||
| 74 | + */ | ||
| 75 | + $(document).on('click', '#add_line_versions_modal button._submit', function () { | ||
| 76 | + | ||
| 77 | + }); | ||
| 78 | + | ||
| 5 | res_load_ep.emitLater('load_version_manage'); | 79 | res_load_ep.emitLater('load_version_manage'); |
| 6 | - return {}; | 80 | + return { |
| 81 | + init: init, | ||
| 82 | + getLineName: function () { | ||
| 83 | + return lineName; | ||
| 84 | + } | ||
| 85 | + }; | ||
| 7 | }(); | 86 | }(); |
| 8 | \ No newline at end of file | 87 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/main.html
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | type="text/css" /> | 12 | type="text/css" /> |
| 13 | <!-- main css --> | 13 | <!-- main css --> |
| 14 | <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" /> | 14 | <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" /> |
| 15 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css"> | ||
| 15 | </head> | 16 | </head> |
| 16 | 17 | ||
| 17 | <body> | 18 | <body> |
| @@ -24,11 +25,11 @@ | @@ -24,11 +25,11 @@ | ||
| 24 | <div class="main_left_panel"> | 25 | <div class="main_left_panel"> |
| 25 | <div class="_line_info"> | 26 | <div class="_line_info"> |
| 26 | <div class="_line_name"> | 27 | <div class="_line_name"> |
| 27 | - 961路 | ||
| 28 | - <a uk-icon="icon: plus" class="add_line_version_icon" title="添加一个新的线路版本" uk-tooltip></a> | 28 | + <span></span> |
| 29 | + <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路走向版本" uk-tooltip></a> | ||
| 29 | </div> | 30 | </div> |
| 30 | <div class="_version_dropdown_wrap"> | 31 | <div class="_version_dropdown_wrap"> |
| 31 | - <a class="_version_text">原始版本 <i uk-icon="icon: chevron-down;ratio:.6"></i></a> | 32 | + <a class="_version_text"></a> |
| 32 | <div uk-dropdown> | 33 | <div uk-dropdown> |
| 33 | <ul class="uk-nav uk-dropdown-nav"> | 34 | <ul class="uk-nav uk-dropdown-nav"> |
| 34 | <li class="uk-nav-header">历史</li> | 35 | <li class="uk-nav-header">历史</li> |
| @@ -41,9 +42,9 @@ | @@ -41,9 +42,9 @@ | ||
| 41 | </ul> | 42 | </ul> |
| 42 | </div> | 43 | </div> |
| 43 | </div> | 44 | </div> |
| 44 | - <span class="clock_enable_version"> | 45 | + <!--<span class="clock_enable_version"> |
| 45 | <a uk-icon="icon: clock;ratio: .7" class=""></a> 25:30:20 启用(20180206线路改道) | 46 | <a uk-icon="icon: clock;ratio: .7" class=""></a> 25:30:20 启用(20180206线路改道) |
| 46 | - </span> | 47 | + </span>--> |
| 47 | </div> | 48 | </div> |
| 48 | 49 | ||
| 49 | <div class="_route_info_wrap"> | 50 | <div class="_route_info_wrap"> |
| @@ -72,16 +73,32 @@ | @@ -72,16 +73,32 @@ | ||
| 72 | </div> | 73 | </div> |
| 73 | </div> | 74 | </div> |
| 74 | <div class="main_lt_search_panel"> | 75 | <div class="main_lt_search_panel"> |
| 75 | - <div class="uk-inline"> | 76 | + <div class="uk-inline ct_s_i_wrap"> |
| 76 | <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span> | 77 | <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span> |
| 77 | - <input class="uk-input search_input" placeholder="搜索地图位置" type="text"> | 78 | + <input class="uk-input ct_search_input" placeholder="搜索地图位置" type="text"> |
| 78 | </div> | 79 | </div> |
| 80 | + <div class="ct_search_result"></div> | ||
| 79 | </div> | 81 | </div> |
| 80 | <div class="main_rt_tools_panel"> | 82 | <div class="main_rt_tools_panel"> |
| 81 | <a uk-icon="icon: info;ratio: .9" class="_icon"></a> | 83 | <a uk-icon="icon: info;ratio: .9" class="_icon"></a> |
| 82 | <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a> | 84 | <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a> |
| 83 | </div> | 85 | </div> |
| 84 | </div> | 86 | </div> |
| 87 | + | ||
| 88 | +<script id="geo_d_e_search_result-temp" type="text/html"> | ||
| 89 | + <ul class="s_list uk-list"> | ||
| 90 | + {{each list as obj i}} | ||
| 91 | + <li data-lat="{{obj.point.lat}}" data-lng="{{obj.point.lng}}"> | ||
| 92 | + <span class="_title">{{obj.title}}</span> | ||
| 93 | + <span class="_address">{{obj.address}}</span> | ||
| 94 | + </li> | ||
| 95 | + {{/each}} | ||
| 96 | + | ||
| 97 | + {{if list.length==0}} | ||
| 98 | + <li class="_empty">没有搜索到相关数据!</li> | ||
| 99 | + {{/if}} | ||
| 100 | + </ul> | ||
| 101 | +</script> | ||
| 85 | <!-- 百度 --> | 102 | <!-- 百度 --> |
| 86 | <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | 103 | <script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> |
| 87 | <script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | 104 | <script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> |
| @@ -102,14 +119,19 @@ | @@ -102,14 +119,19 @@ | ||
| 102 | <script src="/real_control_v2/geolib/geolib.js" ></script> | 119 | <script src="/real_control_v2/geolib/geolib.js" ></script> |
| 103 | <!-- jquery contextMenu --> | 120 | <!-- jquery contextMenu --> |
| 104 | <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" ></script> | 121 | <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" ></script> |
| 122 | +<script src="/assets/js/baidu/bd_GeoUtils_min.js" ></script> | ||
| 123 | +<!-- flatpickr --> | ||
| 124 | +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script> | ||
| 125 | +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script> | ||
| 126 | + | ||
| 105 | <script> | 127 | <script> |
| 106 | var $loadPanel = $('body>.loading'); | 128 | var $loadPanel = $('body>.loading'); |
| 107 | //___________________________________ | 129 | //___________________________________ |
| 108 | var storage = window.localStorage; | 130 | var storage = window.localStorage; |
| 109 | - storage.setItem("geo_data_edit_line_code" , "70123"); | ||
| 110 | //___________________________________ | 131 | //___________________________________ |
| 111 | 132 | ||
| 112 | top.document.title = "绘制线路"; | 133 | top.document.title = "绘制线路"; |
| 134 | + | ||
| 113 | // 关闭左侧栏 | 135 | // 关闭左侧栏 |
| 114 | if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();} | 136 | if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();} |
| 115 | //全屏 | 137 | //全屏 |
| @@ -117,7 +139,7 @@ | @@ -117,7 +139,7 @@ | ||
| 117 | window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); | 139 | window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); |
| 118 | }); | 140 | }); |
| 119 | 141 | ||
| 120 | - var gb_main_ep = new EventProxy() | 142 | + var gb_main_ep = new EventProxy(); |
| 121 | //文件加载 | 143 | //文件加载 |
| 122 | var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' | 144 | 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 () { | 145 | , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { |
| @@ -130,16 +152,20 @@ | @@ -130,16 +152,20 @@ | ||
| 130 | //路段 | 152 | //路段 |
| 131 | eq.once('init_road', function () { | 153 | eq.once('init_road', function () { |
| 132 | gb_road_route.init(g_emit('init_map')) | 154 | gb_road_route.init(g_emit('init_map')) |
| 133 | - }) | 155 | + }); |
| 134 | //地图 | 156 | //地图 |
| 135 | eq.once('init_map', function () { | 157 | eq.once('init_map', function () { |
| 136 | gb_ct_map._render(g_emit('end')); | 158 | gb_ct_map._render(g_emit('end')); |
| 137 | }); | 159 | }); |
| 138 | 160 | ||
| 139 | eq.once('end', function () { | 161 | eq.once('end', function () { |
| 162 | + //线路版本信息 | ||
| 163 | + gb_version_manage.init(gb_station_route.getData()[0][0].versions); | ||
| 164 | + | ||
| 140 | $loadPanel.hide(); | 165 | $loadPanel.hide(); |
| 166 | + gb_ct_search.init(); | ||
| 141 | }); | 167 | }); |
| 142 | - }); | 168 | + }); |
| 143 | 169 | ||
| 144 | function g_emit(id) { | 170 | function g_emit(id) { |
| 145 | console.log('g_emit [' + id + ']'); | 171 | console.log('g_emit [' + id + ']'); |
| @@ -158,13 +184,18 @@ | @@ -158,13 +184,18 @@ | ||
| 158 | }); | 184 | }); |
| 159 | 185 | ||
| 160 | function getUpDown(){ | 186 | function getUpDown(){ |
| 161 | - return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1; | 187 | + return $('.up_down_route_list>li:first').hasClass('uk-active')?0:1; |
| 162 | } | 188 | } |
| 163 | 189 | ||
| 164 | //切换上下行显示 | 190 | //切换上下行显示 |
| 165 | $('.up_down_route_list').on('show', function () { | 191 | $('.up_down_route_list').on('show', function () { |
| 166 | gb_ct_map.changeUpDown(); | 192 | gb_ct_map.changeUpDown(); |
| 167 | }); | 193 | }); |
| 194 | + | ||
| 195 | + $(document).on('submit', 'form', function (e) { | ||
| 196 | + e.stopPropagation(); | ||
| 197 | + return false; | ||
| 198 | + }); | ||
| 168 | </script> | 199 | </script> |
| 169 | 200 | ||
| 170 | <!--- js --> | 201 | <!--- js --> |
| @@ -175,6 +206,7 @@ | @@ -175,6 +206,7 @@ | ||
| 175 | <script src="/pages/base/geo_data_edit/js/history_edit_logs.js" ></script> | 206 | <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> | 207 | <script src="/pages/base/geo_data_edit/js/map.js" ></script> |
| 177 | <script src="/pages/base/geo_data_edit/js/submit.js" ></script> | 208 | <script src="/pages/base/geo_data_edit/js/submit.js" ></script> |
| 209 | +<script src="/pages/base/geo_data_edit/js/search.js" ></script> | ||
| 178 | <script type="text/javascript" | 210 | <script type="text/javascript" |
| 179 | src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script> | 211 | src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script> |
| 180 | </body> | 212 | </body> |
src/main/resources/static/pages/base/line/list.html
| @@ -347,7 +347,7 @@ | @@ -347,7 +347,7 @@ | ||
| 347 | <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> | 347 | <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> |
| 348 | </td> | 348 | </td> |
| 349 | <td> | 349 | <td> |
| 350 | - <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> | 350 | + <a href="javascript:window.localStorage.setItem('geo_data_edit_line_code' , '{{obj.lineCode}}');window.location.href='/pages/base/geo_data_edit/uk3_wrap.html';" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> |
| 351 | </td> | 351 | </td> |
| 352 | <td> | 352 | <td> |
| 353 | <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> | 353 | <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a> |
src/main/resources/static/pages/forms/mould/allline.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByBus1.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByBus1s.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByBus2.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByBus2s.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByLine.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/countByLines.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/executionrate.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/lbStatuAnaly.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/onlinelist.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/scheduleDaily_m.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/waybill.html
| @@ -332,9 +332,11 @@ | @@ -332,9 +332,11 @@ | ||
| 332 | if(params.length < 1){ | 332 | if(params.length < 1){ |
| 333 | return; | 333 | return; |
| 334 | } | 334 | } |
| 335 | + var i = layer.load(2); | ||
| 335 | $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ | 336 | $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ |
| 336 | var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"; | 337 | var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"; |
| 337 | window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName)); | 338 | window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName)); |
| 339 | + layer.close(i); | ||
| 338 | }); | 340 | }); |
| 339 | }); | 341 | }); |
| 340 | 342 | ||
| @@ -345,6 +347,7 @@ | @@ -345,6 +347,7 @@ | ||
| 345 | $("#exportMore").on("click",function(){ | 347 | $("#exportMore").on("click",function(){ |
| 346 | if($("#info tbody tr td").length <= 1) | 348 | if($("#info tbody tr td").length <= 1) |
| 347 | return; | 349 | return; |
| 350 | + var i = layer.load(2); | ||
| 348 | var param = new Array(); | 351 | var param = new Array(); |
| 349 | $("#info tbody tr").each(function(index){ | 352 | $("#info tbody tr").each(function(index){ |
| 350 | param[index] = new Array(); | 353 | param[index] = new Array(); |
| @@ -361,6 +364,7 @@ | @@ -361,6 +364,7 @@ | ||
| 361 | $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | 364 | $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ |
| 362 | // window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 | 365 | // window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 |
| 363 | window.open("/downloadFile/download?fileName="+result.fileName); | 366 | window.open("/downloadFile/download?fileName="+result.fileName); |
| 367 | + layer.close(i); | ||
| 364 | }); | 368 | }); |
| 365 | }); | 369 | }); |
| 366 | 370 |
src/main/resources/static/pages/forms/statement/waybillBf.html
| @@ -328,7 +328,8 @@ | @@ -328,7 +328,8 @@ | ||
| 328 | }); | 328 | }); |
| 329 | }); | 329 | }); |
| 330 | $post('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | 330 | $post('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ |
| 331 | - window.open("/downloadFile/downloadList?fileName="+result.fileName); | 331 | +// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 |
| 332 | + window.open("/downloadFile/download?fileName="+result.fileName); | ||
| 332 | }); | 333 | }); |
| 333 | }); | 334 | }); |
| 334 | 335 |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -727,6 +727,24 @@ angular.module('ScheduleApp').factory( | @@ -727,6 +727,24 @@ angular.module('ScheduleApp').factory( | ||
| 727 | } | 727 | } |
| 728 | } | 728 | } |
| 729 | } | 729 | } |
| 730 | + ), | ||
| 731 | + | ||
| 732 | + versiondesc: $resource( | ||
| 733 | + '/tic_ec/versiondesc/:lineId/:version', | ||
| 734 | + {}, | ||
| 735 | + { | ||
| 736 | + do: { | ||
| 737 | + method: 'GET', | ||
| 738 | + transformResponse: function(rs) { | ||
| 739 | + var dst = angular.fromJson(rs); | ||
| 740 | + if (dst.status == 'SUCCESS') { | ||
| 741 | + return dst.data; | ||
| 742 | + } else { | ||
| 743 | + return dst; // 业务错误留给控制器处理 | ||
| 744 | + } | ||
| 745 | + } | ||
| 746 | + } | ||
| 747 | + } | ||
| 730 | ) | 748 | ) |
| 731 | }; | 749 | }; |
| 732 | 750 |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
| @@ -1207,7 +1207,7 @@ ScheduleApp.config([ | @@ -1207,7 +1207,7 @@ ScheduleApp.config([ | ||
| 1207 | } | 1207 | } |
| 1208 | }) | 1208 | }) |
| 1209 | .state("ttInfoDetailManage_edit3", { // 时刻表详细信息编辑 | 1209 | .state("ttInfoDetailManage_edit3", { // 时刻表详细信息编辑 |
| 1210 | - url: '/ttInfoDetailManage_edit3/:xlid/:ttid/:xlname/:ttname/:rflag', | 1210 | + url: '/ttInfoDetailManage_edit3/:xlid/:ttid/:xlname/:ttname/:rflag/:lineversion', |
| 1211 | views: { | 1211 | views: { |
| 1212 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html'} | 1212 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html'} |
| 1213 | }, | 1213 | }, |
| @@ -1225,7 +1225,7 @@ ScheduleApp.config([ | @@ -1225,7 +1225,7 @@ ScheduleApp.config([ | ||
| 1225 | } | 1225 | } |
| 1226 | }) | 1226 | }) |
| 1227 | .state("ttInfoDetailManage_detail_edit", { // 时刻表详细信息单元格编辑 | 1227 | .state("ttInfoDetailManage_detail_edit", { // 时刻表详细信息单元格编辑 |
| 1228 | - url: '/ttInfoDetailManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname/:rowindex/:colindex', | 1228 | + url: '/ttInfoDetailManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname/:rowindex/:colindex/:lineversion', |
| 1229 | views: { | 1229 | views: { |
| 1230 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html'} | 1230 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html'} |
| 1231 | }, | 1231 | }, |
| @@ -1244,7 +1244,7 @@ ScheduleApp.config([ | @@ -1244,7 +1244,7 @@ ScheduleApp.config([ | ||
| 1244 | } | 1244 | } |
| 1245 | }) | 1245 | }) |
| 1246 | .state("ttInfoDetailManage_detail_edit2", { // 时刻表详细信息批量单元格修改 | 1246 | .state("ttInfoDetailManage_detail_edit2", { // 时刻表详细信息批量单元格修改 |
| 1247 | - url: '/ttInfoDetailManage_detail_edit/:xlid/:ttid/:xlname/:ttname', | 1247 | + url: '/ttInfoDetailManage_detail_edit/:xlid/:ttid/:xlname/:ttname/:lineversion', |
| 1248 | views: { | 1248 | views: { |
| 1249 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html'} | 1249 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html'} |
| 1250 | }, | 1250 | }, |
| @@ -1263,7 +1263,7 @@ ScheduleApp.config([ | @@ -1263,7 +1263,7 @@ ScheduleApp.config([ | ||
| 1263 | } | 1263 | } |
| 1264 | }) | 1264 | }) |
| 1265 | .state("ttInfoDetailManage_detail_edit_mulselect", { // 时刻表详细信息批量单元格修改 | 1265 | .state("ttInfoDetailManage_detail_edit_mulselect", { // 时刻表详细信息批量单元格修改 |
| 1266 | - url: '/ttInfoDetailManage_detail_edit_mulselect/:xlid/:ttid/:xlname/:ttname', | 1266 | + url: '/ttInfoDetailManage_detail_edit_mulselect/:xlid/:ttid/:xlname/:ttname/:lineversion', |
| 1267 | views: { | 1267 | views: { |
| 1268 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-mulselect.html'} | 1268 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-mulselect.html'} |
| 1269 | }, | 1269 | }, |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
| @@ -30,8 +30,14 @@ | @@ -30,8 +30,14 @@ | ||
| 30 | <div class="portlet light bordered"> | 30 | <div class="portlet light bordered"> |
| 31 | <div class="portlet-title"> | 31 | <div class="portlet-title"> |
| 32 | <div class="caption"> | 32 | <div class="caption"> |
| 33 | - <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 34 | - class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title2"></span> | 33 | + <div> |
| 34 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 35 | + <span class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title2"></span> | ||
| 36 | + </div> | ||
| 37 | + <div style="padding-top: 10px;"> | ||
| 38 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 39 | + <span class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title_tip"></span> | ||
| 40 | + </div> | ||
| 35 | </div> | 41 | </div> |
| 36 | </div> | 42 | </div> |
| 37 | 43 | ||
| @@ -93,7 +99,7 @@ | @@ -93,7 +99,7 @@ | ||
| 93 | cmaps="{'qdzCode' : 'zcode', 'qdzName': 'zname'}" | 99 | cmaps="{'qdzCode' : 'zcode', 'qdzName': 'zname'}" |
| 94 | dcname="qdzCode" | 100 | dcname="qdzCode" |
| 95 | icname="zcode" | 101 | icname="zcode" |
| 96 | - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}" | 102 | + dsparams="{{ {type: 'ajax', param: {'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir, 'lineversion': ctrl.TimeTableDetailForSave.lineVersion}, atype:'zd_tcc' } | json }}" |
| 97 | iterobjname="item" | 103 | iterobjname="item" |
| 98 | iterobjexp="item.aname" | 104 | iterobjexp="item.aname" |
| 99 | searchph="请输拼音..." | 105 | searchph="请输拼音..." |
| @@ -114,7 +120,7 @@ | @@ -114,7 +120,7 @@ | ||
| 114 | cmaps="{'zdzCode' : 'zcode', 'zdzName': 'zname'}" | 120 | cmaps="{'zdzCode' : 'zcode', 'zdzName': 'zname'}" |
| 115 | dcname="zdzCode" | 121 | dcname="zdzCode" |
| 116 | icname="zcode" | 122 | icname="zcode" |
| 117 | - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}" | 123 | + dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir, 'lineversion': ctrl.TimeTableDetailForSave.lineVersion}, atype:'zd_tcc' } | json }}" |
| 118 | iterobjname="item" | 124 | iterobjname="item" |
| 119 | iterobjexp="item.aname" | 125 | iterobjexp="item.aname" |
| 120 | searchph="请输拼音..." | 126 | searchph="请输拼音..." |
| @@ -244,7 +250,7 @@ | @@ -244,7 +250,7 @@ | ||
| 244 | <button type="submit" class="btn green" | 250 | <button type="submit" class="btn green" |
| 245 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> | 251 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> |
| 246 | <a type="button" class="btn default" | 252 | <a type="button" class="btn default" |
| 247 | - ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})" ><i class="fa fa-times"></i> 取消</a> | 253 | + ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname, lineversion : ctrl.lineversion})" ><i class="fa fa-times"></i> 取消</a> |
| 248 | </div> | 254 | </div> |
| 249 | </div> | 255 | </div> |
| 250 | </div> | 256 | </div> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
| @@ -30,8 +30,14 @@ | @@ -30,8 +30,14 @@ | ||
| 30 | <div class="portlet light bordered"> | 30 | <div class="portlet light bordered"> |
| 31 | <div class="portlet-title"> | 31 | <div class="portlet-title"> |
| 32 | <div class="caption"> | 32 | <div class="caption"> |
| 33 | - <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 34 | - class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title1"></span> | 33 | + <div> |
| 34 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 35 | + <span class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title1"></span> | ||
| 36 | + </div> | ||
| 37 | + <div style="padding-top: 10px;"> | ||
| 38 | + <i class="icon-equalizer font-red-sunglo"></i> | ||
| 39 | + <span class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title_tip"></span> | ||
| 40 | + </div> | ||
| 35 | </div> | 41 | </div> |
| 36 | </div> | 42 | </div> |
| 37 | 43 | ||
| @@ -74,7 +80,7 @@ | @@ -74,7 +80,7 @@ | ||
| 74 | cmaps="{'qdzCode' : 'zcode', 'qdzName': 'zname'}" | 80 | cmaps="{'qdzCode' : 'zcode', 'qdzName': 'zname'}" |
| 75 | dcname="qdzCode" | 81 | dcname="qdzCode" |
| 76 | icname="zcode" | 82 | icname="zcode" |
| 77 | - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}" | 83 | + dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir, 'lineversion': ctrl.lineversion}, atype:'zd_tcc' } | json }}" |
| 78 | iterobjname="item" | 84 | iterobjname="item" |
| 79 | iterobjexp="item.aname" | 85 | iterobjexp="item.aname" |
| 80 | searchph="请输拼音..." | 86 | searchph="请输拼音..." |
| @@ -91,7 +97,7 @@ | @@ -91,7 +97,7 @@ | ||
| 91 | cmaps="{'zdzCode' : 'zcode', 'zdzName': 'zname'}" | 97 | cmaps="{'zdzCode' : 'zcode', 'zdzName': 'zname'}" |
| 92 | dcname="zdzCode" | 98 | dcname="zdzCode" |
| 93 | icname="zcode" | 99 | icname="zcode" |
| 94 | - dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}" | 100 | + dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir, 'lineversion': ctrl.lineversion}, atype:'zd_tcc' } | json }}" |
| 95 | iterobjname="item" | 101 | iterobjname="item" |
| 96 | iterobjexp="item.aname" | 102 | iterobjexp="item.aname" |
| 97 | searchph="请输拼音..." | 103 | searchph="请输拼音..." |
| @@ -198,7 +204,7 @@ | @@ -198,7 +204,7 @@ | ||
| 198 | <button type="submit" class="btn green" | 204 | <button type="submit" class="btn green" |
| 199 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> | 205 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> |
| 200 | <a type="button" class="btn default" | 206 | <a type="button" class="btn default" |
| 201 | - ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})" ><i class="fa fa-times"></i> 取消</a> | 207 | + ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname, lineversion : ctrl.lineversion})" ><i class="fa fa-times"></i> 取消</a> |
| 202 | </div> | 208 | </div> |
| 203 | </div> | 209 | </div> |
| 204 | </div> | 210 | </div> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-mulselect.html
| @@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
| 90 | <button type="submit" class="btn green" | 90 | <button type="submit" class="btn green" |
| 91 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> | 91 | ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button> |
| 92 | <a type="button" class="btn default" | 92 | <a type="button" class="btn default" |
| 93 | - ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})" ><i class="fa fa-times"></i> 取消</a> | 93 | + ui-sref="ttInfoDetailManage_edit3({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname, lineversion : ctrl.lineversion})" ><i class="fa fa-times"></i> 取消</a> |
| 94 | </div> | 94 | </div> |
| 95 | </div> | 95 | </div> |
| 96 | </div> | 96 | </div> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html
| @@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
| 29 | <div class="caption font-dark"> | 29 | <div class="caption font-dark"> |
| 30 | <i class="fa fa-database font-dark"></i> | 30 | <i class="fa fa-database font-dark"></i> |
| 31 | <span class="caption-subject bold uppercase" ng-bind="ctrl.title"></span> | 31 | <span class="caption-subject bold uppercase" ng-bind="ctrl.title"></span> |
| 32 | + <span class="caption-subject bold uppercase" ng-bind="ctrl.title2"></span> | ||
| 32 | </div> | 33 | </div> |
| 33 | <div class="actions"> | 34 | <div class="actions"> |
| 34 | <!--<i class="fa fa-arrow-up" aria-hidden="true"></i>--> | 35 | <!--<i class="fa fa-arrow-up" aria-hidden="true"></i>--> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/route.js
| @@ -64,7 +64,7 @@ ScheduleApp.config([ | @@ -64,7 +64,7 @@ ScheduleApp.config([ | ||
| 64 | } | 64 | } |
| 65 | }) | 65 | }) |
| 66 | .state("ttInfoDetailManage_edit3", { // 时刻表详细信息编辑 | 66 | .state("ttInfoDetailManage_edit3", { // 时刻表详细信息编辑 |
| 67 | - url: '/ttInfoDetailManage_edit3/:xlid/:ttid/:xlname/:ttname/:rflag', | 67 | + url: '/ttInfoDetailManage_edit3/:xlid/:ttid/:xlname/:ttname/:rflag/:lineversion', |
| 68 | views: { | 68 | views: { |
| 69 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html'} | 69 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html'} |
| 70 | }, | 70 | }, |
| @@ -82,7 +82,7 @@ ScheduleApp.config([ | @@ -82,7 +82,7 @@ ScheduleApp.config([ | ||
| 82 | } | 82 | } |
| 83 | }) | 83 | }) |
| 84 | .state("ttInfoDetailManage_detail_edit", { // 时刻表详细信息单元格编辑 | 84 | .state("ttInfoDetailManage_detail_edit", { // 时刻表详细信息单元格编辑 |
| 85 | - url: '/ttInfoDetailManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname/:rowindex/:colindex', | 85 | + url: '/ttInfoDetailManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname/:rowindex/:colindex/:lineversion', |
| 86 | views: { | 86 | views: { |
| 87 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html'} | 87 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html'} |
| 88 | }, | 88 | }, |
| @@ -101,7 +101,7 @@ ScheduleApp.config([ | @@ -101,7 +101,7 @@ ScheduleApp.config([ | ||
| 101 | } | 101 | } |
| 102 | }) | 102 | }) |
| 103 | .state("ttInfoDetailManage_detail_edit2", { // 时刻表详细信息批量单元格修改 | 103 | .state("ttInfoDetailManage_detail_edit2", { // 时刻表详细信息批量单元格修改 |
| 104 | - url: '/ttInfoDetailManage_detail_edit/:xlid/:ttid/:xlname/:ttname', | 104 | + url: '/ttInfoDetailManage_detail_edit/:xlid/:ttid/:xlname/:ttname/:lineversion', |
| 105 | views: { | 105 | views: { |
| 106 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html'} | 106 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html'} |
| 107 | }, | 107 | }, |
| @@ -120,7 +120,7 @@ ScheduleApp.config([ | @@ -120,7 +120,7 @@ ScheduleApp.config([ | ||
| 120 | } | 120 | } |
| 121 | }) | 121 | }) |
| 122 | .state("ttInfoDetailManage_detail_edit_mulselect", { // 时刻表详细信息批量单元格修改 | 122 | .state("ttInfoDetailManage_detail_edit_mulselect", { // 时刻表详细信息批量单元格修改 |
| 123 | - url: '/ttInfoDetailManage_detail_edit_mulselect/:xlid/:ttid/:xlname/:ttname', | 123 | + url: '/ttInfoDetailManage_detail_edit_mulselect/:xlid/:ttid/:xlname/:ttname/:lineversion', |
| 124 | views: { | 124 | views: { |
| 125 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-mulselect.html'} | 125 | "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-mulselect.html'} |
| 126 | }, | 126 | }, |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/timeTableDetailManage_old.js
| @@ -3,10 +3,11 @@ angular.module('ScheduleApp').factory( | @@ -3,10 +3,11 @@ angular.module('ScheduleApp').factory( | ||
| 3 | 'TimeTableDetailManageService_old', | 3 | 'TimeTableDetailManageService_old', |
| 4 | [ | 4 | [ |
| 5 | 'TimeTableDetailManageService_g', | 5 | 'TimeTableDetailManageService_g', |
| 6 | + 'TTInfoManageService_g', | ||
| 6 | '$state', | 7 | '$state', |
| 7 | '$q', | 8 | '$q', |
| 8 | 'SaTimeTableUtils', | 9 | 'SaTimeTableUtils', |
| 9 | - function(service, $state, $q, SaTimeTableUtils) { | 10 | + function(service, service2, $state, $q, SaTimeTableUtils) { |
| 10 | 11 | ||
| 11 | // 查询对象类 | 12 | // 查询对象类 |
| 12 | var queryClass = service.rest; | 13 | var queryClass = service.rest; |
| @@ -206,8 +207,20 @@ angular.module('ScheduleApp').factory( | @@ -206,8 +207,20 @@ angular.module('ScheduleApp').factory( | ||
| 206 | } | 207 | } |
| 207 | 208 | ||
| 208 | return deferred.promise; | 209 | return deferred.promise; |
| 209 | - } | 210 | + }, |
| 210 | 211 | ||
| 212 | + /** | ||
| 213 | + * 获取线路版本描述。 | ||
| 214 | + * @param lineId | ||
| 215 | + * @param version | ||
| 216 | + * @returns {*|Function|promise|n} | ||
| 217 | + */ | ||
| 218 | + versiondesc: function(lineId, version) { | ||
| 219 | + var param = {}; | ||
| 220 | + param.lineId = lineId; | ||
| 221 | + param.version = version; | ||
| 222 | + return service2.versiondesc.do(param).$promise; | ||
| 223 | + } | ||
| 211 | 224 | ||
| 212 | }; | 225 | }; |
| 213 | } | 226 | } |
| @@ -215,7 +228,7 @@ angular.module('ScheduleApp').factory( | @@ -215,7 +228,7 @@ angular.module('ScheduleApp').factory( | ||
| 215 | ] | 228 | ] |
| 216 | ); | 229 | ); |
| 217 | 230 | ||
| 218 | -// edit.html 时刻表编辑界面 | 231 | +// edit.html 时刻表表格编辑界面 |
| 219 | angular.module('ScheduleApp').controller( | 232 | angular.module('ScheduleApp').controller( |
| 220 | 'TimeTableDetailManageCtrl_old', | 233 | 'TimeTableDetailManageCtrl_old', |
| 221 | [ | 234 | [ |
| @@ -232,8 +245,17 @@ angular.module('ScheduleApp').controller( | @@ -232,8 +245,17 @@ angular.module('ScheduleApp').controller( | ||
| 232 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 | 245 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 |
| 233 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 | 246 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 |
| 234 | self.rflag = $stateParams.rflag; // 刷新标志 | 247 | self.rflag = $stateParams.rflag; // 刷新标志 |
| 248 | + self.lineversion = $stateParams.lineversion; // 线路版本 | ||
| 235 | 249 | ||
| 236 | self.title = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; | 250 | self.title = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; |
| 251 | + self.title2 = "--->版本加载中..."; | ||
| 252 | + service.versiondesc(self.xlid, self.lineversion).then( | ||
| 253 | + function(result) { | ||
| 254 | + self.title2 = "--->线路版本(" + result.desc + ")"; | ||
| 255 | + } | ||
| 256 | + ); | ||
| 257 | + | ||
| 258 | + // TODO:线路版本 | ||
| 237 | 259 | ||
| 238 | // 获取时刻表明细数据(内部保存) | 260 | // 获取时刻表明细数据(内部保存) |
| 239 | self.getDetailHeads = function() { | 261 | self.getDetailHeads = function() { |
| @@ -304,7 +326,8 @@ angular.module('ScheduleApp').controller( | @@ -304,7 +326,8 @@ angular.module('ScheduleApp').controller( | ||
| 304 | xlname: self.xlname, | 326 | xlname: self.xlname, |
| 305 | ttname: self.ttname, | 327 | ttname: self.ttname, |
| 306 | rowindex: r, | 328 | rowindex: r, |
| 307 | - colindex: c | 329 | + colindex: c, |
| 330 | + lineversion: self.lineversion | ||
| 308 | } | 331 | } |
| 309 | ); | 332 | ); |
| 310 | }; | 333 | }; |
| @@ -313,13 +336,13 @@ angular.module('ScheduleApp').controller( | @@ -313,13 +336,13 @@ angular.module('ScheduleApp').controller( | ||
| 313 | self.editInfos = function() { | 336 | self.editInfos = function() { |
| 314 | if (!service.editIsSel()) { | 337 | if (!service.editIsSel()) { |
| 315 | alert("请选择班次信息"); | 338 | alert("请选择班次信息"); |
| 316 | - return; | ||
| 317 | } else { | 339 | } else { |
| 318 | $state.go("ttInfoDetailManage_detail_edit2", { | 340 | $state.go("ttInfoDetailManage_detail_edit2", { |
| 319 | xlid: self.xlid, | 341 | xlid: self.xlid, |
| 320 | ttid: self.ttid, | 342 | ttid: self.ttid, |
| 321 | xlname: self.xlname, | 343 | xlname: self.xlname, |
| 322 | - ttname: self.ttname | 344 | + ttname: self.ttname, |
| 345 | + lineversion: self.lineversion | ||
| 323 | }); | 346 | }); |
| 324 | } | 347 | } |
| 325 | 348 | ||
| @@ -331,7 +354,8 @@ angular.module('ScheduleApp').controller( | @@ -331,7 +354,8 @@ angular.module('ScheduleApp').controller( | ||
| 331 | xlid: self.xlid, | 354 | xlid: self.xlid, |
| 332 | ttid: self.ttid, | 355 | ttid: self.ttid, |
| 333 | xlname: self.xlname, | 356 | xlname: self.xlname, |
| 334 | - ttname: self.ttname | 357 | + ttname: self.ttname, |
| 358 | + lineversion: self.lineversion | ||
| 335 | }); | 359 | }); |
| 336 | }; | 360 | }; |
| 337 | 361 | ||
| @@ -346,7 +370,8 @@ angular.module('ScheduleApp').controller( | @@ -346,7 +370,8 @@ angular.module('ScheduleApp').controller( | ||
| 346 | xlid: self.xlid, | 370 | xlid: self.xlid, |
| 347 | ttid: self.ttid, | 371 | ttid: self.ttid, |
| 348 | xlname: self.xlname, | 372 | xlname: self.xlname, |
| 349 | - ttname: self.ttname | 373 | + ttname: self.ttname, |
| 374 | + lineversion: self.lineversion | ||
| 350 | }); | 375 | }); |
| 351 | }, function() { | 376 | }, function() { |
| 352 | alert("批量删除失败!"); | 377 | alert("批量删除失败!"); |
| @@ -354,7 +379,8 @@ angular.module('ScheduleApp').controller( | @@ -354,7 +379,8 @@ angular.module('ScheduleApp').controller( | ||
| 354 | xlid: self.xlid, | 379 | xlid: self.xlid, |
| 355 | ttid: self.ttid, | 380 | ttid: self.ttid, |
| 356 | xlname: self.xlname, | 381 | xlname: self.xlname, |
| 357 | - ttname: self.ttname | 382 | + ttname: self.ttname, |
| 383 | + lineversion: self.lineversion | ||
| 358 | }); | 384 | }); |
| 359 | }); | 385 | }); |
| 360 | }; | 386 | }; |
| @@ -467,8 +493,15 @@ angular.module('ScheduleApp').controller( | @@ -467,8 +493,15 @@ angular.module('ScheduleApp').controller( | ||
| 467 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 | 493 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 |
| 468 | self.rowindex = $stateParams.rowindex; // 修改的第几行 | 494 | self.rowindex = $stateParams.rowindex; // 修改的第几行 |
| 469 | self.colindex = $stateParams.colindex; // 修改的第几列 | 495 | self.colindex = $stateParams.colindex; // 修改的第几列 |
| 496 | + self.lineversion = $stateParams.lineversion; // 线路版本 | ||
| 470 | 497 | ||
| 471 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; | 498 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; |
| 499 | + self.title_tip = "版本加载中..."; | ||
| 500 | + service.versiondesc(self.xlid, self.lineversion).then( | ||
| 501 | + function(result) { | ||
| 502 | + self.title_tip = "线路版本(" + result.desc + ")"; | ||
| 503 | + } | ||
| 504 | + ); | ||
| 472 | 505 | ||
| 473 | if (id) { | 506 | if (id) { |
| 474 | TTInfoDetail.get({id: id}, function(value) { | 507 | TTInfoDetail.get({id: id}, function(value) { |
| @@ -491,6 +524,7 @@ angular.module('ScheduleApp').controller( | @@ -491,6 +524,7 @@ angular.module('ScheduleApp').controller( | ||
| 491 | self.ttname | 524 | self.ttname |
| 492 | ); | 525 | ); |
| 493 | 526 | ||
| 527 | + self.TimeTableDetailForSave.lineVersion = self.lineversion; | ||
| 494 | self.TimeTableDetailForSave.isTS = 0; | 528 | self.TimeTableDetailForSave.isTS = 0; |
| 495 | self.title2 = | 529 | self.title2 = |
| 496 | self.xlname + "(" + self.ttname + ")" + "时刻表明细信息" + | 530 | self.xlname + "(" + self.ttname + ")" + "时刻表明细信息" + |
| @@ -531,7 +565,8 @@ angular.module('ScheduleApp').controller( | @@ -531,7 +565,8 @@ angular.module('ScheduleApp').controller( | ||
| 531 | xlid: self.xlid, | 565 | xlid: self.xlid, |
| 532 | ttid: self.ttid, | 566 | ttid: self.ttid, |
| 533 | xlname: self.xlname, | 567 | xlname: self.xlname, |
| 534 | - ttname: self.ttname | 568 | + ttname: self.ttname, |
| 569 | + lineversion: self.lineversion | ||
| 535 | }); | 570 | }); |
| 536 | }); | 571 | }); |
| 537 | 572 | ||
| @@ -555,8 +590,15 @@ angular.module('ScheduleApp').controller( | @@ -555,8 +590,15 @@ angular.module('ScheduleApp').controller( | ||
| 555 | self.ttid = $stateParams.ttid; // 获取传过来的时刻表id | 590 | self.ttid = $stateParams.ttid; // 获取传过来的时刻表id |
| 556 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 | 591 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 |
| 557 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 | 592 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 |
| 593 | + self.lineversion = $stateParams.lineversion; // 线路版本 | ||
| 558 | 594 | ||
| 559 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息 批量修改班次信息"; | 595 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息 批量修改班次信息"; |
| 596 | + self.title_tip = "版本加载中..."; | ||
| 597 | + service.versiondesc(self.xlid, self.lineversion).then( | ||
| 598 | + function(result) { | ||
| 599 | + self.title_tip = "线路版本(" + result.desc + ")"; | ||
| 600 | + } | ||
| 601 | + ); | ||
| 560 | 602 | ||
| 561 | //var TTInfoDetail = service.getQueryClass(); | 603 | //var TTInfoDetail = service.getQueryClass(); |
| 562 | 604 | ||
| @@ -663,7 +705,8 @@ angular.module('ScheduleApp').controller( | @@ -663,7 +705,8 @@ angular.module('ScheduleApp').controller( | ||
| 663 | xlid: self.xlid, | 705 | xlid: self.xlid, |
| 664 | ttid: self.ttid, | 706 | ttid: self.ttid, |
| 665 | xlname: self.xlname, | 707 | xlname: self.xlname, |
| 666 | - ttname: self.ttname | 708 | + ttname: self.ttname, |
| 709 | + lineversion: self.lineversion | ||
| 667 | }); | 710 | }); |
| 668 | }, function() { | 711 | }, function() { |
| 669 | alert("批量更新失败!"); | 712 | alert("批量更新失败!"); |
| @@ -671,7 +714,8 @@ angular.module('ScheduleApp').controller( | @@ -671,7 +714,8 @@ angular.module('ScheduleApp').controller( | ||
| 671 | xlid: self.xlid, | 714 | xlid: self.xlid, |
| 672 | ttid: self.ttid, | 715 | ttid: self.ttid, |
| 673 | xlname: self.xlname, | 716 | xlname: self.xlname, |
| 674 | - ttname: self.ttname | 717 | + ttname: self.ttname, |
| 718 | + lineversion: self.lineversion | ||
| 675 | }); | 719 | }); |
| 676 | }); | 720 | }); |
| 677 | 721 | ||
| @@ -681,7 +725,7 @@ angular.module('ScheduleApp').controller( | @@ -681,7 +725,7 @@ angular.module('ScheduleApp').controller( | ||
| 681 | ] | 725 | ] |
| 682 | ); | 726 | ); |
| 683 | 727 | ||
| 684 | -// edit-mulselect.html 具体班次明细修改页面 | 728 | +// edit-mulselect.html 班次批量选择页面 |
| 685 | angular.module('ScheduleApp').controller( | 729 | angular.module('ScheduleApp').controller( |
| 686 | 'TimeTableDetailManageFormCtrl_mulselect', | 730 | 'TimeTableDetailManageFormCtrl_mulselect', |
| 687 | [ | 731 | [ |
| @@ -696,6 +740,7 @@ angular.module('ScheduleApp').controller( | @@ -696,6 +740,7 @@ angular.module('ScheduleApp').controller( | ||
| 696 | self.ttid = $stateParams.ttid; // 获取传过来的时刻表id | 740 | self.ttid = $stateParams.ttid; // 获取传过来的时刻表id |
| 697 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 | 741 | self.xlname = $stateParams.xlname; // 获取传过来的线路名字 |
| 698 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 | 742 | self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字 |
| 743 | + self.lineversion = $stateParams.lineversion; // 线路版本 | ||
| 699 | 744 | ||
| 700 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; | 745 | self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息"; |
| 701 | 746 | ||
| @@ -744,7 +789,8 @@ angular.module('ScheduleApp').controller( | @@ -744,7 +789,8 @@ angular.module('ScheduleApp').controller( | ||
| 744 | xlid: self.xlid, | 789 | xlid: self.xlid, |
| 745 | ttid: self.ttid, | 790 | ttid: self.ttid, |
| 746 | xlname: self.xlname, | 791 | xlname: self.xlname, |
| 747 | - ttname: self.ttname | 792 | + ttname: self.ttname, |
| 793 | + lineversion: self.lineversion | ||
| 748 | }); | 794 | }); |
| 749 | 795 | ||
| 750 | }; | 796 | }; |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/list.html
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <th style="width: 180px;">时刻表名称</th> | 9 | <th style="width: 180px;">时刻表名称</th> |
| 10 | <th style="width: 80px">上下行</th> | 10 | <th style="width: 80px">上下行</th> |
| 11 | <th style="width: 50px;">启用</th> | 11 | <th style="width: 50px;">启用</th> |
| 12 | - <th style="width: 120px">启用/备份日期</th> | 12 | + <th style="width: 130px">操作日期</th> |
| 13 | <th style="width: 80px">状态</th> | 13 | <th style="width: 80px">状态</th> |
| 14 | <th style="width: 60%">时刻表明细</th> | 14 | <th style="width: 60%">时刻表明细</th> |
| 15 | <th style="width: 40%">操作</th> | 15 | <th style="width: 40%">操作</th> |
| @@ -69,7 +69,25 @@ | @@ -69,7 +69,25 @@ | ||
| 69 | </div> | 69 | </div> |
| 70 | </td> | 70 | </td> |
| 71 | <td> | 71 | <td> |
| 72 | - <span ng-bind="info.xl.name"></span> | 72 | + <div> |
| 73 | + <a href="#"> | ||
| 74 | + <span ng-bind="info.xl.name"></span> | ||
| 75 | + </a> | ||
| 76 | + </div> | ||
| 77 | + <div> | ||
| 78 | + <a href="#" | ||
| 79 | + ng-mouseenter="ctrl.getLineVersionTip(info)" | ||
| 80 | + tooltip-animation="false" | ||
| 81 | + tooltip-placement="top" | ||
| 82 | + uib-tooltip="{{ctrl.lineVersionTip}}" | ||
| 83 | + tooltip-class="headClass"> | ||
| 84 | + | ||
| 85 | + <span ng-bind="'线路版本:' + info.lineVersion"></span> | ||
| 86 | + </a> | ||
| 87 | + | ||
| 88 | + </div> | ||
| 89 | + | ||
| 90 | + | ||
| 73 | </td> | 91 | </td> |
| 74 | <td> | 92 | <td> |
| 75 | <div> | 93 | <div> |
| @@ -90,23 +108,62 @@ | @@ -90,23 +108,62 @@ | ||
| 90 | </td> | 108 | </td> |
| 91 | <td> | 109 | <td> |
| 92 | <div> | 110 | <div> |
| 93 | - <a href="#"> | ||
| 94 | - <span ng-bind="info.qyrq | date: 'yyyy-MM-dd'"></span> | 111 | + <a href="#" |
| 112 | + tooltip-animation="false" | ||
| 113 | + tooltip-placement="top" | ||
| 114 | + uib-tooltip="启用时间:{{info.qyrq | date: 'yyyy-MM-dd HH:mm:ss' }}" | ||
| 115 | + tooltip-class="headClass"> | ||
| 116 | + 启用 | ||
| 117 | + <span ng-bind="(info.qyrq | date: 'yyyy-MM-dd')"></span> | ||
| 95 | </a> | 118 | </a> |
| 96 | </div> | 119 | </div> |
| 120 | + | ||
| 97 | <div> | 121 | <div> |
| 98 | <a href="#" | 122 | <a href="#" |
| 99 | tooltip-animation="false" | 123 | tooltip-animation="false" |
| 100 | tooltip-placement="top" | 124 | tooltip-placement="top" |
| 101 | uib-tooltip="备份时间:{{info.lastBackUpDate | date: 'yyyy-MM-dd HH:mm:ss' }}" | 125 | uib-tooltip="备份时间:{{info.lastBackUpDate | date: 'yyyy-MM-dd HH:mm:ss' }}" |
| 102 | tooltip-class="headClass"> | 126 | tooltip-class="headClass"> |
| 127 | + 备份 | ||
| 128 | + <span ng-bind="(info.lastBackUpDate | date: 'yyyy-MM-dd')"></span> | ||
| 129 | + </a> | ||
| 130 | + </div> | ||
| 103 | 131 | ||
| 104 | - <i class="fa fa-hdd-o" aria-hidden="true"></i> | ||
| 105 | - <span ng-bind="info.lastBackUpDate | date: 'yyyy-MM-dd'"></span> | 132 | + <div> |
| 133 | + <a href="#" | ||
| 134 | + tooltip-animation="false" | ||
| 135 | + tooltip-placement="top" | ||
| 136 | + uib-tooltip="创建时间:{{info.createDate | date: 'yyyy-MM-dd HH:mm:ss' }}" | ||
| 137 | + tooltip-class="headClass"> | ||
| 138 | + 创建 | ||
| 139 | + <span ng-bind="(info.createDate | date: 'yyyy-MM-dd')"></span> | ||
| 106 | </a> | 140 | </a> |
| 141 | + </div> | ||
| 107 | 142 | ||
| 143 | + <div> | ||
| 144 | + <a href="#" | ||
| 145 | + tooltip-animation="false" | ||
| 146 | + tooltip-placement="top" | ||
| 147 | + uib-tooltip="更新时间:{{info.updateDate | date: 'yyyy-MM-dd HH:mm:ss' }}" | ||
| 148 | + tooltip-class="headClass"> | ||
| 149 | + 更新 | ||
| 150 | + <span ng-bind="(info.updateDate | date: 'yyyy-MM-dd')"></span> | ||
| 151 | + </a> | ||
| 108 | </div> | 152 | </div> |
| 109 | 153 | ||
| 154 | + <!--<div>--> | ||
| 155 | + <!--<a href="#"--> | ||
| 156 | + <!--tooltip-animation="false"--> | ||
| 157 | + <!--tooltip-placement="top"--> | ||
| 158 | + <!--uib-tooltip="备份时间:{{info.lastBackUpDate | date: 'yyyy-MM-dd HH:mm:ss' }}"--> | ||
| 159 | + <!--tooltip-class="headClass">--> | ||
| 160 | + | ||
| 161 | + <!--<i class="fa fa-hdd-o" aria-hidden="true"></i>--> | ||
| 162 | + <!--<span ng-bind="info.lastBackUpDate | date: 'yyyy-MM-dd'"></span>--> | ||
| 163 | + <!--</a>--> | ||
| 164 | + | ||
| 165 | + <!--</div>--> | ||
| 166 | + | ||
| 110 | </td> | 167 | </td> |
| 111 | <td> | 168 | <td> |
| 112 | <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span> | 169 | <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span> |
| @@ -117,7 +174,7 @@ | @@ -117,7 +174,7 @@ | ||
| 117 | <!--class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑 </a>--> | 174 | <!--class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑 </a>--> |
| 118 | <!--<a ui-sref="ttInfoDetailManage_edit2({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name})"--> | 175 | <!--<a ui-sref="ttInfoDetailManage_edit2({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name})"--> |
| 119 | <!--class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑2 </a>--> | 176 | <!--class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑2 </a>--> |
| 120 | - <a ui-sref="ttInfoDetailManage_edit3({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name, rflag : true})" | 177 | + <a ui-sref="ttInfoDetailManage_edit3({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name, rflag : true, lineversion : info.lineVersion})" |
| 121 | class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑 </a> | 178 | class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑 </a> |
| 122 | <a ng-click="ctrl.toTtInfoDetailAuto(info.id)" | 179 | <a ng-click="ctrl.toTtInfoDetailAuto(info.id)" |
| 123 | class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 生成 </a> | 180 | class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 生成 </a> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/module.js
| @@ -80,6 +80,19 @@ angular.module('ScheduleApp').factory( | @@ -80,6 +80,19 @@ angular.module('ScheduleApp').factory( | ||
| 80 | var param = {}; | 80 | var param = {}; |
| 81 | param.ttinfoid = ttinfoid; | 81 | param.ttinfoid = ttinfoid; |
| 82 | return service.backup.do(param).$promise; | 82 | return service.backup.do(param).$promise; |
| 83 | + }, | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 获取线路版本描述。 | ||
| 87 | + * @param lineId | ||
| 88 | + * @param version | ||
| 89 | + * @returns {*|Function|promise|n} | ||
| 90 | + */ | ||
| 91 | + versiondesc: function(lineId, version) { | ||
| 92 | + var param = {}; | ||
| 93 | + param.lineId = lineId; | ||
| 94 | + param.version = version; | ||
| 95 | + return service.versiondesc.do(param).$promise; | ||
| 83 | } | 96 | } |
| 84 | 97 | ||
| 85 | 98 | ||
| @@ -171,12 +184,26 @@ angular.module('ScheduleApp').controller( | @@ -171,12 +184,26 @@ angular.module('ScheduleApp').controller( | ||
| 171 | 184 | ||
| 172 | self.doPage(); | 185 | self.doPage(); |
| 173 | 186 | ||
| 174 | - // 自动生成时刻表 | 187 | + // TODO:跳转到自动生成时刻表页面(jquery页面),之后会替换为Angularjs版本 |
| 175 | self.toTtInfoDetailAuto = function(ttinfoid) { | 188 | self.toTtInfoDetailAuto = function(ttinfoid) { |
| 176 | showPjax(); | 189 | showPjax(); |
| 177 | $.pjax({url: 'pages/base/timesmodel/add.html?no=' + ttinfoid, container: pjaxContainer}); | 190 | $.pjax({url: 'pages/base/timesmodel/add.html?no=' + ttinfoid, container: pjaxContainer}); |
| 178 | }; | 191 | }; |
| 179 | 192 | ||
| 193 | + self.lineVersionTip = "载入中..."; | ||
| 194 | + var currentTTInfoForLineVersion; | ||
| 195 | + self.getLineVersionTip = function(info) { | ||
| 196 | + if (currentTTInfoForLineVersion != info) { | ||
| 197 | + service.versiondesc(info.xl.id, info.lineVersion).then( | ||
| 198 | + function(result) { | ||
| 199 | + self.lineVersionTip = result.desc; | ||
| 200 | + currentTTInfoForLineVersion = info; | ||
| 201 | + } | ||
| 202 | + ); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + }; | ||
| 206 | + | ||
| 180 | // TODO: | 207 | // TODO: |
| 181 | } | 208 | } |
| 182 | ] | 209 | ] |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
| @@ -53,6 +53,24 @@ angular.module('ScheduleApp').factory( | @@ -53,6 +53,24 @@ angular.module('ScheduleApp').factory( | ||
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| 56 | + ), | ||
| 57 | + | ||
| 58 | + versiondesc: $resource( | ||
| 59 | + '/tic_ec/versiondesc/:lineId/:version', | ||
| 60 | + {}, | ||
| 61 | + { | ||
| 62 | + do: { | ||
| 63 | + method: 'GET', | ||
| 64 | + transformResponse: function(rs) { | ||
| 65 | + var dst = angular.fromJson(rs); | ||
| 66 | + if (dst.status == 'SUCCESS') { | ||
| 67 | + return dst.data; | ||
| 68 | + } else { | ||
| 69 | + return dst; // 业务错误留给控制器处理 | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + } | ||
| 56 | ) | 74 | ) |
| 57 | }; | 75 | }; |
| 58 | 76 |
src/main/resources/static/real_control_v2/js/safe_driv/CallCenterPluginDemo.html
0 → 100644
src/main/resources/static/real_control_v2/js/safe_driv/call_phone.js
0 → 100644
| 1 | +var gb_call_phone = function () { | ||
| 2 | + | ||
| 3 | + var basePath = "http://180.168.57.114:4244"; | ||
| 4 | + var wsUri = "ws://180.168.57.114:21892/"; | ||
| 5 | + | ||
| 6 | + var nbbm2tel = { | ||
| 7 | + | ||
| 8 | + }; | ||
| 9 | + | ||
| 10 | + var locData = window.localStorage.getItem('test_nbbm2tel_json'); | ||
| 11 | + if(locData){ | ||
| 12 | + nbbm2tel = JSON.parse(locData); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + var login = function (cb) { | ||
| 16 | + var agentID = '1002'; | ||
| 17 | + var dn = '6006'; | ||
| 18 | + | ||
| 19 | + var options = { | ||
| 20 | + AgentID: agentID, | ||
| 21 | + DN: dn, | ||
| 22 | + wsUri: wsUri, | ||
| 23 | + setbtnStatus: function (stateName) { | ||
| 24 | + //setState(stateName); | ||
| 25 | + console.log('stateName', stateName); | ||
| 26 | + | ||
| 27 | + cb && cb(stateName) | ||
| 28 | + } | ||
| 29 | + }; | ||
| 30 | + $.CallCenterInit(options); | ||
| 31 | + }; | ||
| 32 | + | ||
| 33 | + var call = function (nbbm, loginSucc, loginFailed, callSucc) { | ||
| 34 | + var telNumber = nbbm2tel[nbbm]; | ||
| 35 | + if(!telNumber){ | ||
| 36 | + alert('没有该车辆的对照表..'); | ||
| 37 | + loginFailed && loginFailed(); | ||
| 38 | + return; | ||
| 39 | + } | ||
| 40 | + login(function (sname) { | ||
| 41 | + if(sname=='login'){ | ||
| 42 | + loginSucc && loginSucc(); | ||
| 43 | + | ||
| 44 | + $.CallCenterPublicFun.Dialing(telNumber); | ||
| 45 | + setTimeout(function () { | ||
| 46 | + callSucc && callSucc(); | ||
| 47 | + }, 1000); | ||
| 48 | + } | ||
| 49 | + else{ | ||
| 50 | + loginFailed && loginFailed(); | ||
| 51 | + } | ||
| 52 | + }); | ||
| 53 | + }; | ||
| 54 | + | ||
| 55 | + var hangup = function () { | ||
| 56 | + console.log('hangup...'); | ||
| 57 | + $.CallCenterPublicFun.Hangup(); | ||
| 58 | + }; | ||
| 59 | + | ||
| 60 | + return { | ||
| 61 | + call: call, | ||
| 62 | + hangup: hangup, | ||
| 63 | + setNbbm2tel: function (json) { | ||
| 64 | + nbbm2tel = json; | ||
| 65 | + | ||
| 66 | + window.localStorage.setItem('test_nbbm2tel_json', JSON.stringify(nbbm2tel)); | ||
| 67 | + }, | ||
| 68 | + getNbbm2tel: function () { | ||
| 69 | + return nbbm2tel; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | +}(); | ||
| 0 | \ No newline at end of file | 73 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
| @@ -14,7 +14,7 @@ var gb_safe_driv = (function () { | @@ -14,7 +14,7 @@ var gb_safe_driv = (function () { | ||
| 14 | 'A9': '玩手机' | 14 | 'A9': '玩手机' |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | - var path = 'http://118.178.187.115/CurrentSafeDriving/'; | 17 | + var path = 'http://180.166.5.82:9005/CurrentSafeDriving/'; |
| 18 | 18 | ||
| 19 | var $wrap = $('.safe_driv_pop_wrap'); | 19 | var $wrap = $('.safe_driv_pop_wrap'); |
| 20 | var max = 5; | 20 | var max = 5; |
| @@ -43,16 +43,24 @@ var gb_safe_driv = (function () { | @@ -43,16 +43,24 @@ var gb_safe_driv = (function () { | ||
| 43 | $wrap.append(htmlStr); | 43 | $wrap.append(htmlStr); |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | - var vedioModal = '<div id="ssspVedioModal" class="uk-modal ct_move_modal">' + | 46 | +/* var vedioModal = '<div id="ssspVedioModal" class="uk-modal ct_move_modal">' + |
| 47 | '<div class="uk-modal-dialog uk-modal-dialog-large">' + | 47 | '<div class="uk-modal-dialog uk-modal-dialog-large">' + |
| 48 | '<button type="button" class="uk-modal-close uk-close"></button>' + | 48 | '<button type="button" class="uk-modal-close uk-close"></button>' + |
| 49 | '<div class="uk-modal-header"> <h2>实时视频</h2> </div> '+ | 49 | '<div class="uk-modal-header"> <h2>实时视频</h2> </div> '+ |
| 50 | '<p class="loading"><i class="uk-icon-spinner uk-icon-spin"></i> 载入资源...</p><iframe id="vedioIframe" src="http://222.66.0.204:8910/transport_server/dvr_monitor1.jsp?deviceId=229L0650&channel=^^channel^^"></iframe>' + | 50 | '<p class="loading"><i class="uk-icon-spinner uk-icon-spin"></i> 载入资源...</p><iframe id="vedioIframe" src="http://222.66.0.204:8910/transport_server/dvr_monitor1.jsp?deviceId=229L0650&channel=^^channel^^"></iframe>' + |
| 51 | '</div>' + | 51 | '</div>' + |
| 52 | - '</div>'; | 52 | + '</div>';*/ |
| 53 | + | ||
| 54 | + var phoneModal = '<div id="callPhoneModal" class="uk-modal ct_move_modal">' + | ||
| 55 | + '<div class="uk-modal-dialog">' + | ||
| 56 | + '<button type="button" class="uk-modal-close uk-close"></button>' + | ||
| 57 | + '<div class="uk-modal-header"> <h2>打电话</h2> </div> '+ | ||
| 58 | + '<p class="loading"><i class="uk-icon-spinner uk-icon-spin"></i> 载入资源...</p><iframe style="width: 100%;height: 280px;" id="phoneIframe" src="/real_control_v2/js/safe_driv/CallCenterPluginDemo.html"></iframe>' + | ||
| 59 | + '</div>' + | ||
| 60 | + '</div>'; | ||
| 53 | 61 | ||
| 54 | $wrap.on('click', '.safe_driv_pop', function () { | 62 | $wrap.on('click', '.safe_driv_pop', function () { |
| 55 | - var title = $(this).data('title') + ' <button data-type="'+$(this).data('type')+'" class="uk-button uk-button-mini uk-button-primary" id="openVedioModalBtn" type="button">查看实时视频</button>'; | 63 | + var title = $(this).data('title') + ' <button data-nbbm="'+$(this).data('nbbm')+'" class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; |
| 56 | var url = $(this).data('url'); | 64 | var url = $(this).data('url'); |
| 57 | $(this).remove(); | 65 | $(this).remove(); |
| 58 | var lightbox = UIkit.lightbox.create([ | 66 | var lightbox = UIkit.lightbox.create([ |
| @@ -89,6 +97,53 @@ var gb_safe_driv = (function () { | @@ -89,6 +97,53 @@ var gb_safe_driv = (function () { | ||
| 89 | }); | 97 | }); |
| 90 | 98 | ||
| 91 | 99 | ||
| 100 | + var showCallPhoneModal = function () { | ||
| 101 | + open_modal_dom(phoneModal ,{}, {modal: false}); | ||
| 102 | + $('#callPhoneModal #phoneIframe').on('load', function () { | ||
| 103 | + var that = this; | ||
| 104 | + var iframe = this.contentWindow.document.body; | ||
| 105 | + setTimeout(function () { | ||
| 106 | + //修改css | ||
| 107 | + $(iframe).find('.CallCenterToolBar').css('height', '200px').css('width', '100%').css('top', '10px').css('left', 'calc(50% - 148px)').css('box-shadow', 'none'); | ||
| 108 | + $(iframe).find('.CallCenterToolBar .top').css('display', 'none'); | ||
| 109 | + | ||
| 110 | + $('.toolBar td[data-action=call]', iframe).trigger('click'); | ||
| 111 | + | ||
| 112 | + //焦点 | ||
| 113 | + $('input#telNumber', iframe).focus(); | ||
| 114 | + | ||
| 115 | + $(that).show(); | ||
| 116 | + $('#callPhoneModal p.loading').remove(); | ||
| 117 | + }, 700); | ||
| 118 | + }); | ||
| 119 | + }; | ||
| 120 | + | ||
| 121 | + $(document).on('click', '#openPhoneModalBtn', function () { | ||
| 122 | + var t = $(this).text(); | ||
| 123 | + if(t == '挂断!'){ | ||
| 124 | + gb_call_phone.hangup(); | ||
| 125 | + $(this).text('打电话').removeClass('uk-button-danger'); | ||
| 126 | + return; | ||
| 127 | + } | ||
| 128 | + else if(t == '打电话'){ | ||
| 129 | + var nbbm = $(this).data('nbbm'); | ||
| 130 | + var btn = this; | ||
| 131 | + | ||
| 132 | + $(btn).text('登录坐席..'); | ||
| 133 | + gb_call_phone.call(nbbm, function () { | ||
| 134 | + $(btn).text('拨号中..'); | ||
| 135 | + }, function () { | ||
| 136 | + $(btn).text('登录坐席失败'); | ||
| 137 | + setTimeout(function () { | ||
| 138 | + $(btn).text('打电话'); | ||
| 139 | + }, 1200); | ||
| 140 | + }, function () { | ||
| 141 | + $(btn).text('挂断!').addClass('uk-button-danger'); | ||
| 142 | + }); | ||
| 143 | + } | ||
| 144 | + }); | ||
| 145 | + | ||
| 146 | + | ||
| 92 | return { | 147 | return { |
| 93 | pop: pop, | 148 | pop: pop, |
| 94 | safeCode: codes, | 149 | safeCode: codes, |
src/main/resources/static/real_control_v2/main.html
| @@ -117,7 +117,7 @@ | @@ -117,7 +117,7 @@ | ||
| 117 | <!-- 高德 --> | 117 | <!-- 高德 --> |
| 118 | <script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | 118 | <script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> |
| 119 | <!-- jquery --> | 119 | <!-- jquery --> |
| 120 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | 120 | +<script src="http://180.168.57.114:4244/Scripts/jquery-3.2.1.min.js"></script> |
| 121 | <!-- jquery actual --> | 121 | <!-- jquery actual --> |
| 122 | <script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | 122 | <script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> |
| 123 | <!-- jquery.serializejson JSON序列化插件 --> | 123 | <!-- jquery.serializejson JSON序列化插件 --> |
| @@ -224,7 +224,7 @@ | @@ -224,7 +224,7 @@ | ||
| 224 | <!-- #### 安全驾驶 start ### --> | 224 | <!-- #### 安全驾驶 start ### --> |
| 225 | <div class="safe_driv_pop_wrap" ></div> | 225 | <div class="safe_driv_pop_wrap" ></div> |
| 226 | <script id="safe_driv_item-temp" type="text/html"> | 226 | <script id="safe_driv_item-temp" type="text/html"> |
| 227 | - <div class="safe_driv_pop uk-animation-slide-bottom" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}"> | 227 | + <div class="safe_driv_pop uk-animation-slide-bottom" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}"> |
| 228 | <div> | 228 | <div> |
| 229 | <span class="title">异常 {{clzbh}}</span> | 229 | <span class="title">异常 {{clzbh}}</span> |
| 230 | <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> | 230 | <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> |
| @@ -235,6 +235,10 @@ | @@ -235,6 +235,10 @@ | ||
| 235 | 235 | ||
| 236 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | 236 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> |
| 237 | <!-- #### 安全驾驶 end ### --> | 237 | <!-- #### 安全驾驶 end ### --> |
| 238 | + | ||
| 239 | +<!-- 打电话 --> | ||
| 240 | +<script src="http://180.168.57.114:4244/Scripts/CallCenter.js" ></script> | ||
| 241 | +<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | ||
| 238 | </body> | 242 | </body> |
| 239 | 243 | ||
| 240 | </html> | 244 | </html> |
src/main/resources/timetable.proto
| @@ -34,6 +34,8 @@ message TTInfo { | @@ -34,6 +34,8 @@ message TTInfo { | ||
| 34 | 34 | ||
| 35 | // list | 35 | // list |
| 36 | repeated TTInfoDetail bcInfo = 17; | 36 | repeated TTInfoDetail bcInfo = 17; |
| 37 | + | ||
| 38 | + uint32 lineVersion = 18; // 线路版本 | ||
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | message TTInfoDetail { | 41 | message TTInfoDetail { |
| @@ -64,6 +66,7 @@ message TTInfoDetail { | @@ -64,6 +66,7 @@ message TTInfoDetail { | ||
| 64 | bool isTS = 18; // 是否停驶(表示此班次执行完成,停在终点站,不进场) | 66 | bool isTS = 18; // 是否停驶(表示此班次执行完成,停在终点站,不进场) |
| 65 | string remark = 19; // 备注 | 67 | string remark = 19; // 备注 |
| 66 | 68 | ||
| 69 | + uint32 lineVersion = 20; // 线路版本 | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | 72 |