Commit b1952d3e0aa8d9818ddf82dde4cc63413883f360
Merge branch 'master' of http://222.66.0.204:8090/panzhaov5/bsth_control
Showing
31 changed files
with
474 additions
and
486 deletions
src/main/java/com/bsth/StartCommand.java
| @@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 21 | import org.springframework.boot.CommandLineRunner; | 21 | import org.springframework.boot.CommandLineRunner; |
| 22 | import org.springframework.stereotype.Component; | 22 | import org.springframework.stereotype.Component; |
| 23 | 23 | ||
| 24 | +import java.util.Timer; | ||
| 25 | +import java.util.TimerTask; | ||
| 24 | import java.util.concurrent.Executors; | 26 | import java.util.concurrent.Executors; |
| 25 | import java.util.concurrent.ScheduledExecutorService; | 27 | import java.util.concurrent.ScheduledExecutorService; |
| 26 | import java.util.concurrent.TimeUnit; | 28 | import java.util.concurrent.TimeUnit; |
| @@ -133,22 +135,26 @@ public class StartCommand implements CommandLineRunner{ | @@ -133,22 +135,26 @@ public class StartCommand implements CommandLineRunner{ | ||
| 133 | */ | 135 | */ |
| 134 | scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS); | 136 | scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS); |
| 135 | 137 | ||
| 136 | - //延迟一会 | 138 | + |
| 137 | /* new Timer().schedule(new TimerTask() { | 139 | /* new Timer().schedule(new TimerTask() { |
| 138 | 140 | ||
| 139 | @Override | 141 | @Override |
| 140 | public void run() { | 142 | public void run() { |
| 141 | - //临时全量刷车辆线路 | ||
| 142 | List<CarConfigInfo> ccis = carConfigInfoRepository.findAll(); | 143 | List<CarConfigInfo> ccis = carConfigInfoRepository.findAll(); |
| 143 | Cars car; | 144 | Cars car; |
| 144 | Line line; | 145 | Line line; |
| 145 | String lineCode; | 146 | String lineCode; |
| 146 | - int code; | 147 | + System.out.println("ccis size: " + ccis.size()); |
| 147 | for(CarConfigInfo cci : ccis){ | 148 | for(CarConfigInfo cci : ccis){ |
| 148 | car = cci.getCl(); | 149 | car = cci.getCl(); |
| 149 | line = cci.getXl(); | 150 | line = cci.getXl(); |
| 150 | lineCode = line.getLineCode(); | 151 | lineCode = line.getLineCode(); |
| 151 | - System.out.println("车辆:" + car.getInsideCode() + "切换线路:" + line.getLineCode()); | 152 | + |
| 153 | + String data = directiveService.createDeviceRefreshData(CommonMapped.vehicDeviceBiMap.inverse().get(car.getInsideCode()) | ||
| 154 | + , Integer.parseInt(lineCode)); | ||
| 155 | + System.out.println(data); | ||
| 156 | + int code = HttpUtils.postJson(data); | ||
| 157 | + System.out.println("车辆:" + car.getInsideCode() + "刷新线路:" + line.getLineCode()); | ||
| 152 | code = directiveService.lineChange(car.getInsideCode(), Integer.parseInt(lineCode)); | 158 | code = directiveService.lineChange(car.getInsideCode(), Integer.parseInt(lineCode)); |
| 153 | //directiveService.send60Phrase(car.getInsideCode(), ""); | 159 | //directiveService.send60Phrase(car.getInsideCode(), ""); |
| 154 | System.out.println("返回值:" + code); | 160 | System.out.println("返回值:" + code); |
src/main/java/com/bsth/Test.java
0 → 100644
| 1 | +//package com.bsth; | ||
| 2 | +// | ||
| 3 | +//import java.io.ByteArrayOutputStream; | ||
| 4 | +//import java.io.IOException; | ||
| 5 | +//import java.io.InputStream; | ||
| 6 | +//import java.io.OutputStream; | ||
| 7 | +//import java.net.HttpURLConnection; | ||
| 8 | +//import java.net.URL; | ||
| 9 | +//import java.util.HashMap; | ||
| 10 | +//import java.util.Map; | ||
| 11 | +// | ||
| 12 | +//import org.apache.commons.io.IOUtils; | ||
| 13 | +// | ||
| 14 | +//import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 15 | +// | ||
| 16 | +//public class Test { | ||
| 17 | +// | ||
| 18 | +// public static void main(String[] args) { | ||
| 19 | +// Map<String, Object> map = new HashMap<>(); | ||
| 20 | +// map.put("timestamp", 1469764939000L); | ||
| 21 | +// map.put("operCode", 128); | ||
| 22 | +// map.put("deviceId", "66ML0007"); | ||
| 23 | +// | ||
| 24 | +// Map<String , Object> dataMap = new HashMap<>(); | ||
| 25 | +// dataMap.put("requestCode", 161); | ||
| 26 | +// dataMap.put("lineId", 1025); | ||
| 27 | +// dataMap.put("operCode2", 38); | ||
| 28 | +// | ||
| 29 | +// map.put("data", dataMap); | ||
| 30 | +// request(map, "http://192.168.168.171:9088/control/upstream"); | ||
| 31 | +// | ||
| 32 | +// } | ||
| 33 | +// | ||
| 34 | +// private static Map<String, Object> request(Map<String, Object> map, String url) { | ||
| 35 | +// InputStream in = null; | ||
| 36 | +// OutputStream out = null; | ||
| 37 | +// HttpURLConnection con = null; | ||
| 38 | +// try { | ||
| 39 | +// con = (HttpURLConnection)new URL(url).openConnection(); | ||
| 40 | +// con.setRequestMethod("POST"); | ||
| 41 | +// con.setRequestProperty("keep-alive", "true"); | ||
| 42 | +// con.setRequestProperty("accept", "*/*"); | ||
| 43 | +// con.setDoInput(true); | ||
| 44 | +// con.setDoOutput(true); | ||
| 45 | +// con.setReadTimeout(2500); | ||
| 46 | +// con.setConnectTimeout(2500); | ||
| 47 | +// out = con.getOutputStream(); | ||
| 48 | +// out.write("json=".getBytes()); | ||
| 49 | +// out.write(new ObjectMapper().writeValueAsBytes(map)); | ||
| 50 | +// out.flush(); | ||
| 51 | +// System.out.println("con.getResponseCode(): " + con.getResponseCode()); | ||
| 52 | +// if (con.getResponseCode() == 200) { | ||
| 53 | +// in = con.getInputStream(); | ||
| 54 | +// ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
| 55 | +// IOUtils.copy(in, bout); bout.close(); | ||
| 56 | +// System.out.println("Message:" + new String(bout.toByteArray())); | ||
| 57 | +// return new ObjectMapper().readValue(bout.toByteArray(), Map.class); | ||
| 58 | +// } | ||
| 59 | +// } catch (IOException e) { | ||
| 60 | +// e.printStackTrace(); | ||
| 61 | +// } finally { | ||
| 62 | +// con.disconnect(); | ||
| 63 | +// try { | ||
| 64 | +// if (in != null) in.close(); | ||
| 65 | +// if (out != null) out.close(); | ||
| 66 | +// } catch (IOException e) { | ||
| 67 | +// e.printStackTrace(); | ||
| 68 | +// } | ||
| 69 | +// } | ||
| 70 | +// return null; | ||
| 71 | +// } | ||
| 72 | +//} |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -255,8 +255,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -255,8 +255,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 255 | * @throws | 255 | * @throws |
| 256 | */ | 256 | */ |
| 257 | @RequestMapping(value = "/findRouteByLine") | 257 | @RequestMapping(value = "/findRouteByLine") |
| 258 | - public Map<String, Object> findRouteByLine(@RequestParam Integer lineId){ | ||
| 259 | - return scheduleRealInfoService.findRouteByLine(lineId); | 258 | + public Map<String, Object> findRouteByLine(@RequestParam Integer lineCode){ |
| 259 | + return scheduleRealInfoService.findRouteByLine(lineCode); | ||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | @RequestMapping(value = "/test/getSch") | 262 | @RequestMapping(value = "/test/getSch") |
src/main/java/com/bsth/filter/AccessLogFilter.java
| @@ -38,7 +38,7 @@ public class AccessLogFilter extends BaseFilter { | @@ -38,7 +38,7 @@ public class AccessLogFilter extends BaseFilter { | ||
| 38 | HttpServletResponse response, FilterChain chain) | 38 | HttpServletResponse response, FilterChain chain) |
| 39 | throws IOException, ServletException { | 39 | throws IOException, ServletException { |
| 40 | 40 | ||
| 41 | - String username = SecurityUtils.getCurrentUser().getName(); //等集成shiro之后再取 | 41 | + String username = /*SecurityUtils.getCurrentUser().getName()*/"test"; //等集成shiro之后再取 |
| 42 | String jsessionId = request.getRequestedSessionId(); | 42 | String jsessionId = request.getRequestedSessionId(); |
| 43 | String ip = IpUtils.getIpAddr(request); | 43 | String ip = IpUtils.getIpAddr(request); |
| 44 | String userAgent = request.getHeader("User-Agent"); | 44 | String userAgent = request.getHeader("User-Agent"); |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -80,7 +80,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 80 | 80 | ||
| 81 | Map<String, Object> outgoAdjustAll(String params); | 81 | Map<String, Object> outgoAdjustAll(String params); |
| 82 | 82 | ||
| 83 | - Map<String, Object> findRouteByLine(Integer lineId); | 83 | + Map<String, Object> findRouteByLine(Integer lineCode); |
| 84 | 84 | ||
| 85 | List<Map<String,String>> findLine(String line); | 85 | List<Map<String,String>> findLine(String line); |
| 86 | 86 |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -757,9 +757,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -757,9 +757,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | @Override | 759 | @Override |
| 760 | - public Map<String, Object> findRouteByLine(Integer lineId) { | 760 | + public Map<String, Object> findRouteByLine(Integer lineCode) { |
| 761 | Map<String, Object> map = new HashMap<>(); | 761 | Map<String, Object> map = new HashMap<>(); |
| 762 | //上行 | 762 | //上行 |
| 763 | + Integer lineId = CommonMapped.lineIdToCode.inverse().get(lineCode); | ||
| 763 | map.put("line.id_eq", lineId); | 764 | map.put("line.id_eq", lineId); |
| 764 | map.put("directions_eq", 0); | 765 | map.put("directions_eq", 0); |
| 765 | List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map); | 766 | List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map); |
src/main/java/com/bsth/vehicle/BorrowCenter.java
| @@ -73,10 +73,10 @@ public class BorrowCenter { | @@ -73,10 +73,10 @@ public class BorrowCenter { | ||
| 73 | @Override | 73 | @Override |
| 74 | public void run() { | 74 | public void run() { |
| 75 | logger.info("nbbm " + (type==0?"借出":"归还") + "线路代码 " + lineCode); | 75 | logger.info("nbbm " + (type==0?"借出":"归还") + "线路代码 " + lineCode); |
| 76 | - directiveService.lineChange(nbbm, lineCode); | 76 | + directiveService.lineChange(nbbm, lineCode, null); |
| 77 | if(upDown != -1){ | 77 | if(upDown != -1){ |
| 78 | //切换走向 | 78 | //切换走向 |
| 79 | - directiveService.upDownChange(nbbm, upDown); | 79 | + directiveService.upDownChange(nbbm, upDown, null); |
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
src/main/java/com/bsth/vehicle/UpstreamEntrance.java
| @@ -32,7 +32,7 @@ public class UpstreamEntrance { | @@ -32,7 +32,7 @@ public class UpstreamEntrance { | ||
| 32 | DirectiveBuffer directiveBuffer; | 32 | DirectiveBuffer directiveBuffer; |
| 33 | 33 | ||
| 34 | @RequestMapping(value = "/upstream", method = RequestMethod.POST) | 34 | @RequestMapping(value = "/upstream", method = RequestMethod.POST) |
| 35 | - public int main(@RequestParam String json) { | 35 | + public String main(@RequestParam String json) { |
| 36 | logger.info("upstream: " + json); | 36 | logger.info("upstream: " + json); |
| 37 | try { | 37 | try { |
| 38 | JSONObject jsonParam = JSONObject.parseObject(json); | 38 | JSONObject jsonParam = JSONObject.parseObject(json); |
| @@ -66,6 +66,6 @@ public class UpstreamEntrance { | @@ -66,6 +66,6 @@ public class UpstreamEntrance { | ||
| 66 | } catch (Exception e) { | 66 | } catch (Exception e) { |
| 67 | logger.error("", e); | 67 | logger.error("", e); |
| 68 | } | 68 | } |
| 69 | - return 0; | 69 | + return "{\"errCode\":0}"; |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
src/main/java/com/bsth/vehicle/common/CommonMapped.java
| @@ -5,7 +5,6 @@ import java.util.Map; | @@ -5,7 +5,6 @@ import java.util.Map; | ||
| 5 | 5 | ||
| 6 | import com.bsth.entity.Line; | 6 | import com.bsth.entity.Line; |
| 7 | import com.bsth.entity.StationRoute; | 7 | import com.bsth.entity.StationRoute; |
| 8 | -import com.google.common.collect.ArrayListMultimap; | ||
| 9 | import com.google.common.collect.BiMap; | 8 | import com.google.common.collect.BiMap; |
| 10 | import com.google.common.collect.TreeMultimap; | 9 | import com.google.common.collect.TreeMultimap; |
| 11 | 10 | ||
| @@ -54,12 +53,17 @@ public class CommonMapped { | @@ -54,12 +53,17 @@ public class CommonMapped { | ||
| 54 | * 线路站点路由对照 | 53 | * 线路站点路由对照 |
| 55 | * (K:线路编码, V:站点路由) | 54 | * (K:线路编码, V:站点路由) |
| 56 | */ | 55 | */ |
| 57 | - public static Map<Integer, List<StationRoute>> lineStationRouteMap; | 56 | + //public static Map<Integer, List<StationRoute>> lineStationRouteMap; |
| 58 | 57 | ||
| 59 | /** | 58 | /** |
| 60 | * 线路和用户名对照 | 59 | * 线路和用户名对照 |
| 61 | * 用于webSocket定向推送消息 | 60 | * 用于webSocket定向推送消息 |
| 62 | */ | 61 | */ |
| 63 | public static TreeMultimap<Integer, String> lineUserMap = TreeMultimap.create(); | 62 | public static TreeMultimap<Integer, String> lineUserMap = TreeMultimap.create(); |
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 线路ID和code 对照 | ||
| 66 | + */ | ||
| 67 | + public static BiMap<Integer, Integer> lineIdToCode; | ||
| 64 | 68 | ||
| 65 | } | 69 | } |
src/main/java/com/bsth/vehicle/common/CommonRefreshThread.java
| @@ -21,6 +21,7 @@ import com.bsth.entity.StationRoute; | @@ -21,6 +21,7 @@ import com.bsth.entity.StationRoute; | ||
| 21 | import com.bsth.entity.schedule.CarConfigInfo; | 21 | import com.bsth.entity.schedule.CarConfigInfo; |
| 22 | import com.bsth.repository.CarParkRepository; | 22 | import com.bsth.repository.CarParkRepository; |
| 23 | import com.bsth.repository.CarsRepository; | 23 | import com.bsth.repository.CarsRepository; |
| 24 | +import com.bsth.repository.LineRepository; | ||
| 24 | import com.bsth.repository.StationRepository; | 25 | import com.bsth.repository.StationRepository; |
| 25 | import com.bsth.repository.StationRouteRepository; | 26 | import com.bsth.repository.StationRouteRepository; |
| 26 | import com.bsth.repository.schedule.CarConfigInfoRepository; | 27 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| @@ -53,6 +54,9 @@ public class CommonRefreshThread extends Thread{ | @@ -53,6 +54,9 @@ public class CommonRefreshThread extends Thread{ | ||
| 53 | @Autowired | 54 | @Autowired |
| 54 | StationRouteRepository sRouteRepository; | 55 | StationRouteRepository sRouteRepository; |
| 55 | 56 | ||
| 57 | + @Autowired | ||
| 58 | + LineRepository lineRepository; | ||
| 59 | + | ||
| 56 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 60 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 57 | 61 | ||
| 58 | @Override | 62 | @Override |
| @@ -62,7 +66,9 @@ public class CommonRefreshThread extends Thread{ | @@ -62,7 +66,9 @@ public class CommonRefreshThread extends Thread{ | ||
| 62 | initStationCodeMap(); | 66 | initStationCodeMap(); |
| 63 | initVehicLineMap(); | 67 | initVehicLineMap(); |
| 64 | 68 | ||
| 65 | - initLineStationRouteMap(); | 69 | + //initLineStationRouteMap(); |
| 70 | + | ||
| 71 | + initLineIdToCode(); | ||
| 66 | } catch (Exception e) { | 72 | } catch (Exception e) { |
| 67 | e.printStackTrace(); | 73 | e.printStackTrace(); |
| 68 | logger.error("", e); | 74 | logger.error("", e); |
| @@ -75,7 +81,7 @@ public class CommonRefreshThread extends Thread{ | @@ -75,7 +81,7 @@ public class CommonRefreshThread extends Thread{ | ||
| 75 | * @Description: TODO(加载线路站点路由信息) | 81 | * @Description: TODO(加载线路站点路由信息) |
| 76 | * @throws | 82 | * @throws |
| 77 | */ | 83 | */ |
| 78 | - private void initLineStationRouteMap() { | 84 | +/* private void initLineStationRouteMap() { |
| 79 | List<StationRoute> routes = sRouteRepository.findAll2(); | 85 | List<StationRoute> routes = sRouteRepository.findAll2(); |
| 80 | 86 | ||
| 81 | Map<Integer, List<StationRoute>> map = new HashMap<>(); | 87 | Map<Integer, List<StationRoute>> map = new HashMap<>(); |
| @@ -97,6 +103,19 @@ public class CommonRefreshThread extends Thread{ | @@ -97,6 +103,19 @@ public class CommonRefreshThread extends Thread{ | ||
| 97 | temp = iterator.next(); | 103 | temp = iterator.next(); |
| 98 | Collections.sort(temp, sRouteComp); | 104 | Collections.sort(temp, sRouteComp); |
| 99 | } | 105 | } |
| 106 | + }*/ | ||
| 107 | + | ||
| 108 | + private void initLineIdToCode() { | ||
| 109 | + Iterator<Line> iterator = lineRepository.findAll().iterator(); | ||
| 110 | + | ||
| 111 | + Line line; | ||
| 112 | + BiMap<Integer, Integer> biMap = HashBiMap.create(); | ||
| 113 | + while(iterator.hasNext()){ | ||
| 114 | + line = iterator.next(); | ||
| 115 | + biMap.put(line.getId(), Integer.parseInt(line.getLineCode())); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + CommonMapped.lineIdToCode = biMap; | ||
| 100 | } | 119 | } |
| 101 | 120 | ||
| 102 | /** | 121 | /** |
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
| @@ -5,7 +5,6 @@ import java.util.Calendar; | @@ -5,7 +5,6 @@ import java.util.Calendar; | ||
| 5 | import java.util.Collection; | 5 | import java.util.Collection; |
| 6 | import java.util.Comparator; | 6 | import java.util.Comparator; |
| 7 | import java.util.HashMap; | 7 | import java.util.HashMap; |
| 8 | -import java.util.Iterator; | ||
| 9 | import java.util.LinkedList; | 8 | import java.util.LinkedList; |
| 10 | import java.util.List; | 9 | import java.util.List; |
| 11 | import java.util.Map; | 10 | import java.util.Map; |
src/main/java/com/bsth/vehicle/directive/controller/DirectiveController.java
| @@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | import org.springframework.web.bind.annotation.RequestParam; | 9 | import org.springframework.web.bind.annotation.RequestParam; |
| 10 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 11 | ||
| 12 | +import com.bsth.entity.sys.SysUser; | ||
| 13 | +import com.bsth.security.util.SecurityUtils; | ||
| 12 | import com.bsth.vehicle.directive.entity.Directive80; | 14 | import com.bsth.vehicle.directive.entity.Directive80; |
| 13 | import com.bsth.vehicle.directive.service.DirectiveService; | 15 | import com.bsth.vehicle.directive.service.DirectiveService; |
| 14 | 16 | ||
| @@ -35,7 +37,8 @@ public class DirectiveController { | @@ -35,7 +37,8 @@ public class DirectiveController { | ||
| 35 | */ | 37 | */ |
| 36 | @RequestMapping(value = "/phrase", method = RequestMethod.POST) | 38 | @RequestMapping(value = "/phrase", method = RequestMethod.POST) |
| 37 | public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){ | 39 | public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){ |
| 38 | - return directiveService.send60Phrase(nbbm, text); | 40 | + SysUser user = SecurityUtils.getCurrentUser(); |
| 41 | + return directiveService.send60Phrase(nbbm, text, user.getUserName()); | ||
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | /** | 44 | /** |
| @@ -47,7 +50,8 @@ public class DirectiveController { | @@ -47,7 +50,8 @@ public class DirectiveController { | ||
| 47 | */ | 50 | */ |
| 48 | @RequestMapping(value = "/dispatch", method = RequestMethod.POST) | 51 | @RequestMapping(value = "/dispatch", method = RequestMethod.POST) |
| 49 | public int send60Dispatch(@RequestParam Long id){ | 52 | public int send60Dispatch(@RequestParam Long id){ |
| 50 | - return directiveService.send60Dispatch(id); | 53 | + SysUser user = SecurityUtils.getCurrentUser(); |
| 54 | + return directiveService.send60Dispatch(id, user.getUserName()); | ||
| 51 | } | 55 | } |
| 52 | 56 | ||
| 53 | /** | 57 | /** |
| @@ -60,7 +64,8 @@ public class DirectiveController { | @@ -60,7 +64,8 @@ public class DirectiveController { | ||
| 60 | */ | 64 | */ |
| 61 | @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) | 65 | @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) |
| 62 | public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ | 66 | public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ |
| 63 | - return directiveService.lineChange(nbbm, lineId); | 67 | + SysUser user = SecurityUtils.getCurrentUser(); |
| 68 | + return directiveService.lineChange(nbbm, lineId, user.getUserName()); | ||
| 64 | } | 69 | } |
| 65 | 70 | ||
| 66 | /** | 71 | /** |
| @@ -71,9 +76,10 @@ public class DirectiveController { | @@ -71,9 +76,10 @@ public class DirectiveController { | ||
| 71 | * @param @param upDon | 76 | * @param @param upDon |
| 72 | * @throws | 77 | * @throws |
| 73 | */ | 78 | */ |
| 74 | - @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | 79 | + @RequestMapping(value = "/upDownChange", method = RequestMethod.GET) |
| 75 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ | 80 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ |
| 76 | - return directiveService.upDownChange(nbbm, upDown); | 81 | + SysUser user = SecurityUtils.getCurrentUser(); |
| 82 | + return directiveService.upDownChange(nbbm, upDown, user.getUserName()); | ||
| 77 | } | 83 | } |
| 78 | 84 | ||
| 79 | /** | 85 | /** |
src/main/java/com/bsth/vehicle/directive/entity/Directive.java
| @@ -44,6 +44,11 @@ public class Directive { | @@ -44,6 +44,11 @@ public class Directive { | ||
| 44 | private String errorText; | 44 | private String errorText; |
| 45 | 45 | ||
| 46 | private int httpCode; | 46 | private int httpCode; |
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 发送人 | ||
| 50 | + */ | ||
| 51 | + private String sender; | ||
| 47 | 52 | ||
| 48 | public short getOperCode() { | 53 | public short getOperCode() { |
| 49 | return operCode; | 54 | return operCode; |
| @@ -100,4 +105,12 @@ public class Directive { | @@ -100,4 +105,12 @@ public class Directive { | ||
| 100 | public void setHttpCode(int httpCode) { | 105 | public void setHttpCode(int httpCode) { |
| 101 | this.httpCode = httpCode; | 106 | this.httpCode = httpCode; |
| 102 | } | 107 | } |
| 108 | + | ||
| 109 | + public String getSender() { | ||
| 110 | + return sender; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setSender(String sender) { | ||
| 114 | + this.sender = sender; | ||
| 115 | + } | ||
| 103 | } | 116 | } |
src/main/java/com/bsth/vehicle/directive/entity/Directive60.java
| @@ -13,7 +13,6 @@ import javax.persistence.Table; | @@ -13,7 +13,6 @@ import javax.persistence.Table; | ||
| 13 | import javax.persistence.Transient; | 13 | import javax.persistence.Transient; |
| 14 | 14 | ||
| 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 16 | -import com.bsth.entity.sys.SysUser; | ||
| 17 | import com.fasterxml.jackson.annotation.JsonIgnore; | 16 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 18 | 17 | ||
| 19 | 18 | ||
| @@ -72,12 +71,6 @@ public class Directive60 extends Directive{ | @@ -72,12 +71,6 @@ public class Directive60 extends Directive{ | ||
| 72 | @ManyToOne(fetch = FetchType.LAZY) | 71 | @ManyToOne(fetch = FetchType.LAZY) |
| 73 | private ScheduleRealInfo sch; | 72 | private ScheduleRealInfo sch; |
| 74 | 73 | ||
| 75 | - /** | ||
| 76 | - * 发送人 | ||
| 77 | - */ | ||
| 78 | - @ManyToOne | ||
| 79 | - private SysUser sender; | ||
| 80 | - | ||
| 81 | @Embeddable | 74 | @Embeddable |
| 82 | public static class DirectiveData { | 75 | public static class DirectiveData { |
| 83 | // 公司代码 | 76 | // 公司代码 |
| @@ -271,12 +264,4 @@ public class Directive60 extends Directive{ | @@ -271,12 +264,4 @@ public class Directive60 extends Directive{ | ||
| 271 | public void setSch(ScheduleRealInfo sch) { | 264 | public void setSch(ScheduleRealInfo sch) { |
| 272 | this.sch = sch; | 265 | this.sch = sch; |
| 273 | } | 266 | } |
| 274 | - | ||
| 275 | - public SysUser getSender() { | ||
| 276 | - return sender; | ||
| 277 | - } | ||
| 278 | - | ||
| 279 | - public void setSender(SysUser sender) { | ||
| 280 | - this.sender = sender; | ||
| 281 | - } | ||
| 282 | } | 267 | } |
src/main/java/com/bsth/vehicle/directive/service/DirectiveService.java
| @@ -20,7 +20,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -20,7 +20,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 20 | * @return int 返回类型 | 20 | * @return int 返回类型 |
| 21 | * @throws | 21 | * @throws |
| 22 | */ | 22 | */ |
| 23 | - int send60Phrase(String nbbm, String text); | 23 | + int send60Phrase(String nbbm, String text, String sender); |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * | 26 | * |
| @@ -30,7 +30,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -30,7 +30,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 30 | * @param @param finish 已完成的班次数 | 30 | * @param @param finish 已完成的班次数 |
| 31 | * @throws | 31 | * @throws |
| 32 | */ | 32 | */ |
| 33 | - int send60Dispatch(ScheduleRealInfo sch, int finish); | 33 | + int send60Dispatch(ScheduleRealInfo sch, int finish, String sender); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * | 36 | * |
| @@ -39,10 +39,10 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -39,10 +39,10 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 39 | * @param @param id 班次ID | 39 | * @param @param id 班次ID |
| 40 | * @throws | 40 | * @throws |
| 41 | */ | 41 | */ |
| 42 | - int send60Dispatch(Long id); | 42 | + int send60Dispatch(Long id, String sender); |
| 43 | 43 | ||
| 44 | //60营运指令 | 44 | //60营运指令 |
| 45 | - int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch); | 45 | + int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender); |
| 46 | 46 | ||
| 47 | /** | 47 | /** |
| 48 | * | 48 | * |
| @@ -52,7 +52,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -52,7 +52,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 52 | * @param @param lineId 新线路编码 | 52 | * @param @param lineId 新线路编码 |
| 53 | * @throws | 53 | * @throws |
| 54 | */ | 54 | */ |
| 55 | - int lineChange(String nbbm, Integer lineId); | 55 | + int lineChange(String nbbm, Integer lineId, String sender); |
| 56 | 56 | ||
| 57 | /** | 57 | /** |
| 58 | * | 58 | * |
| @@ -62,7 +62,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -62,7 +62,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 62 | * @param @param upDonw 上下行 0 上行 1 下行 | 62 | * @param @param upDonw 上下行 0 上行 1 下行 |
| 63 | * @throws | 63 | * @throws |
| 64 | */ | 64 | */ |
| 65 | - int upDownChange(String nbbm, Integer upDown); | 65 | + int upDownChange(String nbbm, Integer upDown, String sender); |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * | 68 | * |
| @@ -77,4 +77,6 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | @@ -77,4 +77,6 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ | ||
| 77 | Map<String, Object> reply80(int id, int reply); | 77 | Map<String, Object> reply80(int id, int reply); |
| 78 | 78 | ||
| 79 | Map<String, Object> findDirective(String nbbm, int dType, int page, int size); | 79 | Map<String, Object> findDirective(String nbbm, int dType, int page, int size); |
| 80 | + | ||
| 81 | + String createDeviceRefreshData(String deviceId, Integer lineId); | ||
| 80 | } | 82 | } |
src/main/java/com/bsth/vehicle/directive/service/DirectiveServiceImpl.java
| 1 | package com.bsth.vehicle.directive.service; | 1 | package com.bsth.vehicle.directive.service; |
| 2 | 2 | ||
| 3 | import java.text.SimpleDateFormat; | 3 | import java.text.SimpleDateFormat; |
| 4 | +import java.util.ArrayList; | ||
| 4 | import java.util.Collections; | 5 | import java.util.Collections; |
| 5 | import java.util.Date; | 6 | import java.util.Date; |
| 6 | import java.util.HashMap; | 7 | import java.util.HashMap; |
| @@ -68,7 +69,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -68,7 +69,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 68 | static final short cityCode = 22; | 69 | static final short cityCode = 22; |
| 69 | 70 | ||
| 70 | @Override | 71 | @Override |
| 71 | - public int send60Phrase(String nbbm, String text) { | 72 | + public int send60Phrase(String nbbm, String text, String sender) { |
| 72 | Directive60 directive = null; | 73 | Directive60 directive = null; |
| 73 | try { | 74 | try { |
| 74 | directive = create60Data(nbbm, text, (short) 0x00, null); | 75 | directive = create60Data(nbbm, text, (short) 0x00, null); |
| @@ -82,6 +83,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -82,6 +83,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 82 | 83 | ||
| 83 | // 发送指令 | 84 | // 发送指令 |
| 84 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); | 85 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| 86 | + if(null != sender) | ||
| 87 | + directive.setSender(sender); | ||
| 85 | directive.setHttpCode(code); | 88 | directive.setHttpCode(code); |
| 86 | // 添加到缓存,等待入库 | 89 | // 添加到缓存,等待入库 |
| 87 | DirectiveBuffer.put(directive); | 90 | DirectiveBuffer.put(directive); |
| @@ -94,7 +97,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -94,7 +97,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 94 | } | 97 | } |
| 95 | 98 | ||
| 96 | @Override | 99 | @Override |
| 97 | - public int send60Dispatch(ScheduleRealInfo sch, int finish) { | 100 | + public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { |
| 98 | Directive60 directive = null; | 101 | Directive60 directive = null; |
| 99 | try { | 102 | try { |
| 100 | // 如果发车时间距当前时间较远,则不发送 | 103 | // 如果发车时间距当前时间较远,则不发送 |
| @@ -114,6 +117,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -114,6 +117,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 114 | 117 | ||
| 115 | if (null == directive) | 118 | if (null == directive) |
| 116 | return -1; | 119 | return -1; |
| 120 | + if(null != sender) | ||
| 121 | + directive.setSender(sender); | ||
| 122 | + else | ||
| 123 | + directive.setSender("系统"); | ||
| 117 | 124 | ||
| 118 | // 发送指令 | 125 | // 发送指令 |
| 119 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); | 126 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| @@ -148,15 +155,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -148,15 +155,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 148 | } | 155 | } |
| 149 | 156 | ||
| 150 | @Override | 157 | @Override |
| 151 | - public int send60Dispatch(Long id) { | 158 | + public int send60Dispatch(Long id, String sender) { |
| 152 | ScheduleRealInfo sch = ScheduleBuffer.findOne(id); | 159 | ScheduleRealInfo sch = ScheduleBuffer.findOne(id); |
| 153 | // 车辆已完成班次 | 160 | // 车辆已完成班次 |
| 154 | int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); | 161 | int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); |
| 155 | - return send60Dispatch(sch, finish); | 162 | + return send60Dispatch(sch, finish, sender); |
| 156 | } | 163 | } |
| 157 | 164 | ||
| 158 | @Override | 165 | @Override |
| 159 | - public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch) { | 166 | + public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { |
| 160 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); | 167 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); |
| 161 | 168 | ||
| 162 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); | 169 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); |
| @@ -164,6 +171,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -164,6 +171,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 164 | 171 | ||
| 165 | if (null == directive) | 172 | if (null == directive) |
| 166 | return -1; | 173 | return -1; |
| 174 | + if(null != sender) | ||
| 175 | + directive.setSender(sender); | ||
| 176 | + else | ||
| 177 | + directive.setSender("系统"); | ||
| 167 | // 发送指令 | 178 | // 发送指令 |
| 168 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); | 179 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| 169 | // 添加到缓存,等待入库 | 180 | // 添加到缓存,等待入库 |
| @@ -183,7 +194,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -183,7 +194,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 183 | * 线路切换 | 194 | * 线路切换 |
| 184 | */ | 195 | */ |
| 185 | @Override | 196 | @Override |
| 186 | - public int lineChange(String nbbm, Integer lineId) { | 197 | + public int lineChange(String nbbm, Integer lineId, String sender) { |
| 187 | Long t = System.currentTimeMillis(); | 198 | Long t = System.currentTimeMillis(); |
| 188 | String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | 199 | String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); |
| 189 | 200 | ||
| @@ -197,6 +208,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -197,6 +208,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 197 | change.setOperCode((short) 0X64); | 208 | change.setOperCode((short) 0X64); |
| 198 | change.setTimestamp(t); | 209 | change.setTimestamp(t); |
| 199 | change.setData(data); | 210 | change.setData(data); |
| 211 | + | ||
| 212 | + if(null != sender) | ||
| 213 | + change.setSender(sender); | ||
| 214 | + else | ||
| 215 | + change.setSender("系统"); | ||
| 200 | 216 | ||
| 201 | int code = HttpUtils.postJson(JSON.toJSONString(change)); | 217 | int code = HttpUtils.postJson(JSON.toJSONString(change)); |
| 202 | // 入库 | 218 | // 入库 |
| @@ -280,7 +296,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -280,7 +296,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 280 | } | 296 | } |
| 281 | 297 | ||
| 282 | @Override | 298 | @Override |
| 283 | - public int upDownChange(String nbbm, Integer upDown) { | 299 | + public int upDownChange(String nbbm, Integer upDown, String sender) { |
| 284 | /* | 300 | /* |
| 285 | * Directive60 directive = createDirective60(nbbm, nbbm + "_" + upDown, | 301 | * Directive60 directive = createDirective60(nbbm, nbbm + "_" + upDown, |
| 286 | * (short) 0x03, upDown, 0); | 302 | * (short) 0x03, upDown, 0); |
| @@ -291,7 +307,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -291,7 +307,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 291 | * == 0){ //添加到缓存,等待入库 DirectiveBuffer.put(directive); }else{ | 307 | * == 0){ //添加到缓存,等待入库 DirectiveBuffer.put(directive); }else{ |
| 292 | * logger.error("send60 upDownChange error, code: " + code); } | 308 | * logger.error("send60 upDownChange error, code: " + code); } |
| 293 | */ | 309 | */ |
| 294 | - return send60Operation(nbbm, 0, upDown, null); | 310 | + return send60Operation(nbbm, 0, upDown, null, sender); |
| 295 | } | 311 | } |
| 296 | 312 | ||
| 297 | /** | 313 | /** |
| @@ -307,7 +323,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -307,7 +323,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 307 | param.put("operCode", 0Xc0); | 323 | param.put("operCode", 0Xc0); |
| 308 | 324 | ||
| 309 | Map<String, Object> data = new HashMap<String, Object>(); | 325 | Map<String, Object> data = new HashMap<String, Object>(); |
| 310 | - data.put("operCode", 0xa1); | 326 | + data.put("operCode2", 0xa1); |
| 311 | data.put("cityCode", cityCode); | 327 | data.put("cityCode", cityCode); |
| 312 | data.put("deviceId", deviceId); | 328 | data.put("deviceId", deviceId); |
| 313 | data.put("timestamp", t); | 329 | data.put("timestamp", t); |
| @@ -409,8 +425,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | @@ -409,8 +425,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> | ||
| 409 | // 时间倒序 | 425 | // 时间倒序 |
| 410 | Collections.sort(list, new DirectiveBuffer.DComparator()); | 426 | Collections.sort(list, new DirectiveBuffer.DComparator()); |
| 411 | if(StringUtils.isNotBlank(nbbm)){ | 427 | if(StringUtils.isNotBlank(nbbm)){ |
| 428 | + String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); | ||
| 412 | //按车辆过滤 | 429 | //按车辆过滤 |
| 413 | - | 430 | + List<Directive> subList = new ArrayList<>(); |
| 431 | + for(Directive d : list){ | ||
| 432 | + if(d.getDeviceId().equals(deviceId)){ | ||
| 433 | + subList.add(d); | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | + list = subList; | ||
| 414 | } | 437 | } |
| 415 | 438 | ||
| 416 | int count = list.size(); | 439 | int count = list.size(); |
src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
| @@ -69,7 +69,7 @@ public class FirstScheduleIssuedThread extends Thread{ | @@ -69,7 +69,7 @@ public class FirstScheduleIssuedThread extends Thread{ | ||
| 69 | //切换营运状态 | 69 | //切换营运状态 |
| 70 | directiveService.send60Operation(sch.getClZbh() | 70 | directiveService.send60Operation(sch.getClZbh() |
| 71 | , 0, Integer.parseInt(sch.getXlDir()) | 71 | , 0, Integer.parseInt(sch.getXlDir()) |
| 72 | - , sch); | 72 | + , sch, null); |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | } | 75 | } |
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread_old.java deleted
100644 → 0
| 1 | -package com.bsth.vehicle.gpsdata; | ||
| 2 | - | ||
| 3 | -import java.sql.Connection; | ||
| 4 | -import java.sql.PreparedStatement; | ||
| 5 | -import java.sql.ResultSet; | ||
| 6 | -import java.text.ParseException; | ||
| 7 | -import java.text.SimpleDateFormat; | ||
| 8 | -import java.util.ArrayList; | ||
| 9 | -import java.util.Calendar; | ||
| 10 | -import java.util.Date; | ||
| 11 | -import java.util.Iterator; | ||
| 12 | -import java.util.List; | ||
| 13 | -import java.util.Set; | ||
| 14 | - | ||
| 15 | -import org.slf4j.Logger; | ||
| 16 | -import org.slf4j.LoggerFactory; | ||
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 18 | -import org.springframework.stereotype.Component; | ||
| 19 | - | ||
| 20 | -import com.alibaba.fastjson.JSONObject; | ||
| 21 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 22 | -import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | ||
| 23 | -import com.bsth.util.DateUtils; | ||
| 24 | -import com.bsth.util.db.DBUtils_MS; | ||
| 25 | -import com.bsth.vehicle.directive.service.DirectiveService; | ||
| 26 | -import com.bsth.vehicle.gpsdata.buffer.ArrivalDataBuffer; | ||
| 27 | -import com.bsth.vehicle.gpsdata.entity.ArrivalInfo; | ||
| 28 | -import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 29 | - | ||
| 30 | -/** | ||
| 31 | - * | ||
| 32 | - * @ClassName: GpsArrivalStationThread | ||
| 33 | - * @Description: TODO(GPS到离站) | ||
| 34 | - * @author PanZhao | ||
| 35 | - * @date 2016年6月27日 上午10:58:13 | ||
| 36 | - * | ||
| 37 | - */ | ||
| 38 | -@Component | ||
| 39 | -public class GpsArrivalStationThread_old extends Thread{ | ||
| 40 | - | ||
| 41 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 42 | - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | ||
| 43 | - | ||
| 44 | - @Autowired | ||
| 45 | - DirectiveService directiveService; | ||
| 46 | - | ||
| 47 | - @Autowired | ||
| 48 | - RealControlSocketHandler socketHandler; | ||
| 49 | - | ||
| 50 | - private static int diff = 1000 * 60 * 20; | ||
| 51 | - | ||
| 52 | - @Override | ||
| 53 | - public void run() { | ||
| 54 | - List<ArrivalInfo> list = null; | ||
| 55 | - try { | ||
| 56 | - list = loadData(); | ||
| 57 | - } catch (ParseException e) { | ||
| 58 | - e.printStackTrace(); | ||
| 59 | - } | ||
| 60 | - ArrivalDataBuffer.putAll(list); | ||
| 61 | - //实际到离站和计划排班相匹配 | ||
| 62 | - | ||
| 63 | - Set<String> keySet = ArrivalDataBuffer.allMap.keySet(); | ||
| 64 | - System.out.println("开始..."); | ||
| 65 | - List<ScheduleRealInfo> schList; | ||
| 66 | - for(String key : keySet){ | ||
| 67 | - schList = extractSched(ScheduleBuffer.carSchListMap.get(key)); | ||
| 68 | - if(null != schList) | ||
| 69 | - match(ArrivalDataBuffer.allMap.get(key), schList); | ||
| 70 | - } | ||
| 71 | - System.out.println("结束..."); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * | ||
| 77 | - * @Title: match | ||
| 78 | - * @Description: TODO(实际和计划进行匹配) | ||
| 79 | - * @param @param arrList 实际GPS到离站链表 | ||
| 80 | - * @param @param schList 计划排班链表 | ||
| 81 | - * @throws | ||
| 82 | - */ | ||
| 83 | - public void match(List<ArrivalInfo> arrList, List<ScheduleRealInfo> schList){ | ||
| 84 | - Iterator<ScheduleRealInfo> schIterator = schList.iterator(); | ||
| 85 | - | ||
| 86 | - while(schIterator.hasNext()) | ||
| 87 | - match(schIterator.next(), arrList); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - public void match(ScheduleRealInfo scInfo, List<ArrivalInfo> arrList){ | ||
| 92 | - for(ArrivalInfo arr : arrList){ | ||
| 93 | - match(scInfo, arr); | ||
| 94 | - } | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - public void match(ScheduleRealInfo scInfo, ArrivalInfo arr){ | ||
| 98 | - try{ | ||
| 99 | - //匹配起点 | ||
| 100 | - matchStart(scInfo, arr); | ||
| 101 | - | ||
| 102 | - //匹配终点 | ||
| 103 | - matchEnd(scInfo, arr); | ||
| 104 | - }catch(Exception e){ | ||
| 105 | - e.printStackTrace(); | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - /** | ||
| 110 | - * | ||
| 111 | - * @Title: matchStart | ||
| 112 | - * @Description: TODO(匹配起点 出站时间) | ||
| 113 | - * @param @param scInfo | ||
| 114 | - * @throws | ||
| 115 | - */ | ||
| 116 | - public void matchStart(ScheduleRealInfo scInfo, ArrivalInfo arr){ | ||
| 117 | - if(scInfo.getFcsjT() == null | ||
| 118 | - || arr.getInOut() != 1 || scInfo.getFcsjActual() != null) | ||
| 119 | - return; | ||
| 120 | - | ||
| 121 | - Long ts = arr.getTs(); | ||
| 122 | - //起点站和发车时间比比较 | ||
| 123 | - if(scInfo.getQdzCode().equals(arr.getStopNo()) | ||
| 124 | - && Math.abs(scInfo.getFcsjT() - ts) < diff){ | ||
| 125 | - scInfo.setFcsjActualTime(ts); | ||
| 126 | - scInfo.setFcsjActual(sdf.format(ts)); | ||
| 127 | - | ||
| 128 | - System.out.println("成功匹配一个起点..."); | ||
| 129 | - //班次状态改为正在执行 | ||
| 130 | - scInfo.setStatus(1); | ||
| 131 | - ScheduleBuffer.persistentList.add(scInfo); | ||
| 132 | - //推送到页面 | ||
| 133 | - sendFcsj(scInfo); | ||
| 134 | - } | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - /** | ||
| 138 | - * @Title: sendFcsj | ||
| 139 | - * @Description: TODO(推送发车信息) | ||
| 140 | - * @param @param schedule 班次 | ||
| 141 | - * @throws | ||
| 142 | - */ | ||
| 143 | - public void sendFcsj(ScheduleRealInfo schedule){ | ||
| 144 | - JSONObject json = new JSONObject(); | ||
| 145 | - json.put("fn", "faChe"); | ||
| 146 | - json.put("t", schedule); | ||
| 147 | - json.put("dataStr", sdf.format(new Date())); | ||
| 148 | - socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * | ||
| 153 | - * @Title: matchEnd | ||
| 154 | - * @Description: TODO(匹配终点 进站时间) | ||
| 155 | - * @throws | ||
| 156 | - */ | ||
| 157 | - public void matchEnd(ScheduleRealInfo scInfo, ArrivalInfo arr){ | ||
| 158 | - if(scInfo.getZdsjT() == null | ||
| 159 | - || arr.getInOut() != 0 || scInfo.getZdsjActual() != null) | ||
| 160 | - return; | ||
| 161 | - | ||
| 162 | - Long ts = arr.getTs(); | ||
| 163 | - //终点站和发车时间比较 | ||
| 164 | - if(scInfo.getZdzCode().equals(arr.getStopNo()) | ||
| 165 | - && Math.abs(scInfo.getZdsjT() - ts) < diff){ | ||
| 166 | - scInfo.setZdsjActualTime(ts); | ||
| 167 | - scInfo.setZdsjActual(sdf.format(ts)); | ||
| 168 | - | ||
| 169 | - System.out.println("成功匹配一个终点..."); | ||
| 170 | - //完成当前班次 | ||
| 171 | - ScheduleRealInfo nextSch = ScheduleBuffer.finishSch(scInfo); | ||
| 172 | - //到达终点,发送下一班次的调度指令 | ||
| 173 | - int finish = ScheduleBuffer.getFinishSchNo(nextSch.getClZbh()); | ||
| 174 | - directiveService.send60Dispatch(nextSch, finish); | ||
| 175 | - //推送到页面 | ||
| 176 | - sendZdsj(scInfo, nextSch, finish); | ||
| 177 | - } | ||
| 178 | - } | ||
| 179 | - | ||
| 180 | - /** | ||
| 181 | - * @Title: sendFcsj | ||
| 182 | - * @Description: TODO(推送到达终点时间) | ||
| 183 | - * @param @param schedule 班次 | ||
| 184 | - * @throws | ||
| 185 | - */ | ||
| 186 | - public void sendZdsj(ScheduleRealInfo schedule,ScheduleRealInfo nextSch, int finish){ | ||
| 187 | - JSONObject json = new JSONObject(); | ||
| 188 | - json.put("fn", "zhongDian"); | ||
| 189 | - json.put("t", schedule); | ||
| 190 | - json.put("nt", nextSch); | ||
| 191 | - json.put("finish", finish); | ||
| 192 | - json.put("dataStr", sdf.format(new Date())); | ||
| 193 | - | ||
| 194 | - socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - /** | ||
| 198 | - * @throws ParseException | ||
| 199 | - * | ||
| 200 | - * @Title: loadData | ||
| 201 | - * @Description: TODO(从数据库加载到离站信息) | ||
| 202 | - * @return List<ArrivalInfo> 返回类型 | ||
| 203 | - * @throws | ||
| 204 | - */ | ||
| 205 | - private List<ArrivalInfo> loadData() throws ParseException{ | ||
| 206 | - Calendar cal = Calendar.getInstance(); | ||
| 207 | - //周数,表分区字段 | ||
| 208 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | ||
| 209 | - //按时间标记增量加载 | ||
| 210 | - if(null == ArrivalDataBuffer.markTime){ | ||
| 211 | - //第一次从当天0点开始 | ||
| 212 | - ArrivalDataBuffer.markTime = DateUtils.getTimesmorning() * 1000L; | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and create_date > ? order by ts"; | ||
| 216 | - | ||
| 217 | - List<ArrivalInfo> list = new ArrayList<>(); | ||
| 218 | - Connection conn = null; | ||
| 219 | - PreparedStatement ps = null; | ||
| 220 | - ResultSet rs = null; | ||
| 221 | - try { | ||
| 222 | - conn = DBUtils_MS.getConnection(); | ||
| 223 | - ps = conn.prepareStatement(sql); | ||
| 224 | - ps.setInt(1, weeks_year); | ||
| 225 | - ps.setLong(2, ArrivalDataBuffer.markTime); | ||
| 226 | - | ||
| 227 | - Long t = System.currentTimeMillis(); | ||
| 228 | - rs = ps.executeQuery(); | ||
| 229 | - | ||
| 230 | - while(rs.next()){ | ||
| 231 | - list.add(new ArrivalInfo(rs.getString("device_id"), rs.getLong("ts"), rs.getString("line_id") | ||
| 232 | - , rs.getInt("up_down"), rs.getString("stop_no"), rs.getInt("in_out"), rs.getLong("create_date"), rs.getInt("weeks_year"))); | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | - //重新打时间标记 | ||
| 236 | - ArrivalDataBuffer.markTime = t; | ||
| 237 | - | ||
| 238 | - } catch (Exception e) { | ||
| 239 | - logger.error("", e); | ||
| 240 | - }finally { | ||
| 241 | - DBUtils_MS.close(rs, ps, conn); | ||
| 242 | - } | ||
| 243 | - return list; | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - Long rang = 1000 * 60 * 60L; | ||
| 247 | - /** | ||
| 248 | - * | ||
| 249 | - * @Title: extractSched | ||
| 250 | - * @Description: TODO(提取当前时间前后一小时的计划) | ||
| 251 | - * @param @param allList | ||
| 252 | - * @throws | ||
| 253 | - */ | ||
| 254 | - public List<ScheduleRealInfo> extractSched(List<ScheduleRealInfo> allList){ | ||
| 255 | - List<ScheduleRealInfo> subList = new ArrayList<>(); | ||
| 256 | - System.out.println("原计划:" + allList.size()); | ||
| 257 | - Long t = System.currentTimeMillis(); | ||
| 258 | - for(ScheduleRealInfo sch : allList){ | ||
| 259 | - if(Math.abs(sch.getFcsjT() - t) < rang | ||
| 260 | - || (sch.getZdsjT() != null && Math.abs(sch.getZdsjT()) - t < rang)){ | ||
| 261 | - subList.add(sch); | ||
| 262 | - } | ||
| 263 | - } | ||
| 264 | - System.out.println("按时间提取:" + subList.size()); | ||
| 265 | - return subList; | ||
| 266 | - } | ||
| 267 | -} |
src/main/java/com/bsth/vehicle/gpsdata/arrival/match/ScheduleRealMatcher.java
| @@ -155,18 +155,19 @@ public class ScheduleRealMatcher implements ApplicationContextAware{ | @@ -155,18 +155,19 @@ public class ScheduleRealMatcher implements ApplicationContextAware{ | ||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); | 157 | finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); |
| 158 | - upDown = Integer.parseInt(sch.getXlDir()); | 158 | + |
| 159 | if(nextSch != null){ | 159 | if(nextSch != null){ |
| 160 | //发送下一班次的调度指令 | 160 | //发送下一班次的调度指令 |
| 161 | - directiveService.send60Dispatch(nextSch, finish); | 161 | + directiveService.send60Dispatch(nextSch, finish, null); |
| 162 | + upDown = Integer.parseInt(nextSch.getXlDir()); | ||
| 162 | //切换下一个班次的走向 | 163 | //切换下一个班次的走向 |
| 163 | - logger.info(sch.getClZbh() + " 切换下一班次走向"); | ||
| 164 | - directiveService.send60Operation(nextSch.getClZbh(), 0, upDown, nextSch); | 164 | + directiveService.send60Operation(nextSch.getClZbh(), 0, upDown, nextSch, null); |
| 165 | } | 165 | } |
| 166 | else{ | 166 | else{ |
| 167 | + upDown = Integer.parseInt(sch.getXlDir()); | ||
| 167 | //没有下一个班次了,切换为非营运状态 | 168 | //没有下一个班次了,切换为非营运状态 |
| 168 | logger.info(sch.getClZbh() + " 完成所有班次,切换为非营运状态"); | 169 | logger.info(sch.getClZbh() + " 完成所有班次,切换为非营运状态"); |
| 169 | - directiveService.send60Operation(sch.getClZbh(), 1, upDown, sch); | 170 | + directiveService.send60Operation(sch.getClZbh(), 1, upDown, sch, null); |
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | sendZdsj(sch, nextSch, finish);//推送到页面 | 173 | sendZdsj(sch, nextSch, finish);//推送到页面 |
src/main/java/com/bsth/vehicle/gpsdata/buffer/GpsRealDataBuffer.java
| @@ -103,11 +103,9 @@ public class GpsRealDataBuffer { | @@ -103,11 +103,9 @@ public class GpsRealDataBuffer { | ||
| 103 | 103 | ||
| 104 | //更新GPS点 | 104 | //更新GPS点 |
| 105 | for(GpsRealData newGps : upGpsList){ | 105 | for(GpsRealData newGps : upGpsList){ |
| 106 | - if(t - newGps.getTimestamp() < OFFLINE_TIME | ||
| 107 | - && !newGps.isOnline()){ | ||
| 108 | - logger.info("设备:" + newGps.getDeviceId() + " 上线"); | 106 | + |
| 107 | + if(t - newGps.getTimestamp() < OFFLINE_TIME ) | ||
| 109 | newGps.setOnline(true); | 108 | newGps.setOnline(true); |
| 110 | - } | ||
| 111 | 109 | ||
| 112 | deviceGpsMap.put(newGps.getDeviceId(), newGps); | 110 | deviceGpsMap.put(newGps.getDeviceId(), newGps); |
| 113 | } | 111 | } |
src/main/resources/fatso/start.js
| @@ -89,7 +89,7 @@ ep.tail('minifier-js', function(){ | @@ -89,7 +89,7 @@ ep.tail('minifier-js', function(){ | ||
| 89 | 89 | ||
| 90 | //打包 | 90 | //打包 |
| 91 | ep.tail('package-jar', function(file){ | 91 | ep.tail('package-jar', function(file){ |
| 92 | - var packageCom = 'mvn clean package'; | 92 | + var packageCom = 'mvn clean package -DskipTests'; |
| 93 | cProcess = child_process.exec(packageCom,{maxBuffer: 5000*1024, cwd: dest},function(error){ | 93 | cProcess = child_process.exec(packageCom,{maxBuffer: 5000*1024, cwd: dest},function(error){ |
| 94 | if(error) | 94 | if(error) |
| 95 | logError(error); | 95 | logError(error); |
src/main/resources/static/pages/control/line/child_pages/historyDirective.html
| @@ -22,8 +22,8 @@ | @@ -22,8 +22,8 @@ | ||
| 22 | <table class="table table-hover" style="table-layout: fixed;"> | 22 | <table class="table table-hover" style="table-layout: fixed;"> |
| 23 | <thead> | 23 | <thead> |
| 24 | <tr> | 24 | <tr> |
| 25 | - <th width="9%">车辆</th> | ||
| 26 | <th width="7%">时间</th> | 25 | <th width="7%">时间</th> |
| 26 | + <th width="9%">车辆</th> | ||
| 27 | <th width="47%">内容</th> | 27 | <th width="47%">内容</th> |
| 28 | <th width="8%">发送人</th> | 28 | <th width="8%">发送人</th> |
| 29 | <th width="17%">状态</th> | 29 | <th width="17%">状态</th> |
| @@ -40,22 +40,21 @@ | @@ -40,22 +40,21 @@ | ||
| 40 | <script id="history_directive_list_temp" type="text/html"> | 40 | <script id="history_directive_list_temp" type="text/html"> |
| 41 | {{each list as item i}} | 41 | {{each list as item i}} |
| 42 | <tr> | 42 | <tr> |
| 43 | - <td>{{item.nbbm}}</td> | ||
| 44 | <td>{{item.timeHHmm}}</td> | 43 | <td>{{item.timeHHmm}}</td> |
| 44 | + <td>{{item.nbbm}}</td> | ||
| 45 | <td> | 45 | <td> |
| 46 | <div class="text-furl"> | 46 | <div class="text-furl"> |
| 47 | {{item.data.txtContent}} | 47 | {{item.data.txtContent}} |
| 48 | </div> | 48 | </div> |
| 49 | </td> | 49 | </td> |
| 50 | - <td>系统</td> | 50 | + <td>{{item.sender}}</td> |
| 51 | <td> | 51 | <td> |
| 52 | {{if item.errorText != null}} | 52 | {{if item.errorText != null}} |
| 53 | <span class="label label-sm label-danger">{{item.errorText}}</span> | 53 | <span class="label label-sm label-danger">{{item.errorText}}</span> |
| 54 | {{else}} | 54 | {{else}} |
| 55 | {{if item.reply46 != 0}} | 55 | {{if item.reply46 != 0}} |
| 56 | <span class="label label-sm label-danger">设备无响应</span> | 56 | <span class="label label-sm label-danger">设备无响应</span> |
| 57 | - {{/if}} | ||
| 58 | - {{if item.reply47 != 0}} | 57 | + {{else if item.reply47 != 0}} |
| 59 | <span class="label label-sm label-warning">驾驶员未确认</span> | 58 | <span class="label label-sm label-warning">驾驶员未确认</span> |
| 60 | {{/if}} | 59 | {{/if}} |
| 61 | 60 |
src/main/resources/static/pages/control/line/index.html
| @@ -290,5 +290,6 @@ function interceptPOST(e, xhr, t){ | @@ -290,5 +290,6 @@ function interceptPOST(e, xhr, t){ | ||
| 290 | layer.msg('监控模式!',{offset: 'ct', shift : 6}); | 290 | layer.msg('监控模式!',{offset: 'ct', shift : 6}); |
| 291 | } | 291 | } |
| 292 | } | 292 | } |
| 293 | + | ||
| 293 | </script> | 294 | </script> |
| 294 | <script src="/pages/control/line/js/webSocketHandle.js"></script> | 295 | <script src="/pages/control/line/js/webSocketHandle.js"></script> |
| 295 | \ No newline at end of file | 296 | \ No newline at end of file |
src/main/resources/static/pages/control/lineallot/allot.html
| @@ -326,7 +326,7 @@ $(function(){ | @@ -326,7 +326,7 @@ $(function(){ | ||
| 326 | var f = arguments.callee | 326 | var f = arguments.callee |
| 327 | ,item = lsData[i]; | 327 | ,item = lsData[i]; |
| 328 | 328 | ||
| 329 | - $.get('/realSchedule/findRouteByLine', {lineId: item.id}, function(rs){ | 329 | + $.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ |
| 330 | if(rs && rs.lineId){ | 330 | if(rs && rs.lineId){ |
| 331 | cacheData[item.lineCode] = rs; | 331 | cacheData[item.lineCode] = rs; |
| 332 | i ++; | 332 | i ++; |
src/main/resources/static/pages/mapmonitor/real/css/real.css
| @@ -93,7 +93,7 @@ label.BMapLabel{ | @@ -93,7 +93,7 @@ label.BMapLabel{ | ||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | .mapRightWrap.playBack{ | 95 | .mapRightWrap.playBack{ |
| 96 | - min-height: 454px; | 96 | + min-height: 374px; |
| 97 | width: 390px; | 97 | width: 390px; |
| 98 | height: auto; | 98 | height: auto; |
| 99 | } | 99 | } |
| @@ -710,8 +710,8 @@ display: none; | @@ -710,8 +710,8 @@ display: none; | ||
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | .play-back-btns .dropdown-menu{ | 712 | .play-back-btns .dropdown-menu{ |
| 713 | - min-width: 70px; | ||
| 714 | - width: 70px; | 713 | + min-width: 80px; |
| 714 | + width: 80px; | ||
| 715 | } | 715 | } |
| 716 | 716 | ||
| 717 | .play-back-btns>i.playBtn{ | 717 | .play-back-btns>i.playBtn{ |
| @@ -803,3 +803,15 @@ display: none; | @@ -803,3 +803,15 @@ display: none; | ||
| 803 | color: #5f5d5d; | 803 | color: #5f5d5d; |
| 804 | margin-left: 7px; | 804 | margin-left: 7px; |
| 805 | } */ | 805 | } */ |
| 806 | + | ||
| 807 | +.layui-layer-msg.layer-bg-green{ | ||
| 808 | + background: #1bbc9b; | ||
| 809 | + border: 1px solid #1bbc9b; | ||
| 810 | + color: white; | ||
| 811 | +} | ||
| 812 | + | ||
| 813 | +.layui-layer-msg.layer-bg-red{ | ||
| 814 | + background: red; | ||
| 815 | + border: 1px solid red; | ||
| 816 | + color: white; | ||
| 817 | +} |
src/main/resources/static/pages/mapmonitor/real/js/map_platform.js
| @@ -277,6 +277,10 @@ var realMap = (function() { | @@ -277,6 +277,10 @@ var realMap = (function() { | ||
| 277 | //居中marker | 277 | //居中marker |
| 278 | markerToCenter: function(marker){ | 278 | markerToCenter: function(marker){ |
| 279 | currentMap.map.panTo(marker.getPosition()); | 279 | currentMap.map.panTo(marker.getPosition()); |
| 280 | + }, | ||
| 281 | + //删除marker | ||
| 282 | + removeMarker: function(marker){ | ||
| 283 | + currentMap.map.removeOverlay(marker); | ||
| 280 | } | 284 | } |
| 281 | }, | 285 | }, |
| 282 | //高德地图 | 286 | //高德地图 |
src/main/resources/static/pages/mapmonitor/real/js/playBack.js
| @@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | var playBack = (function() { | 5 | var playBack = (function() { |
| 6 | + //默认车辆 | ||
| 7 | + var defaultCar, defaultLine; | ||
| 6 | //css3动画结束事件 | 8 | //css3动画结束事件 |
| 7 | var animationend = 'webkitAnimationEnd animationend'; | 9 | var animationend = 'webkitAnimationEnd animationend'; |
| 8 | var prgTimer; | 10 | var prgTimer; |
| @@ -10,6 +12,13 @@ var playBack = (function() { | @@ -10,6 +12,13 @@ var playBack = (function() { | ||
| 10 | var sTime; | 12 | var sTime; |
| 11 | //结束时间戳 | 13 | //结束时间戳 |
| 12 | var eTime; | 14 | var eTime; |
| 15 | + //当前时间戳 | ||
| 16 | + var cTime; | ||
| 17 | + //每步走10秒 | ||
| 18 | + var step = 10; | ||
| 19 | + //1个px多少秒 | ||
| 20 | + var secondPX; | ||
| 21 | + | ||
| 13 | var tRange; | 22 | var tRange; |
| 14 | //进度条宽度 | 23 | //进度条宽度 |
| 15 | var pWidth; | 24 | var pWidth; |
| @@ -20,11 +29,12 @@ var playBack = (function() { | @@ -20,11 +29,12 @@ var playBack = (function() { | ||
| 20 | //上层运动的进度条 | 29 | //上层运动的进度条 |
| 21 | var $pmk = $('.play-back-progress-mark'); | 30 | var $pmk = $('.play-back-progress-mark'); |
| 22 | //单元格 | 31 | //单元格 |
| 23 | - var cell/*, minCell = 5, cellSecond*/; | 32 | + //var cell/*, minCell = 5, cellSecond*/; |
| 24 | //GPS轨迹点 | 33 | //GPS轨迹点 |
| 25 | var gpsArray; | 34 | var gpsArray; |
| 26 | //播放到的轨迹坐标点 | 35 | //播放到的轨迹坐标点 |
| 27 | var cIndex = 0; | 36 | var cIndex = 0; |
| 37 | + //GPS点数量 | ||
| 28 | var size; | 38 | var size; |
| 29 | //播放速度 | 39 | //播放速度 |
| 30 | var speed = parseInt($('#playSpeedText').text()); | 40 | var speed = parseInt($('#playSpeedText').text()); |
| @@ -32,8 +42,10 @@ var playBack = (function() { | @@ -32,8 +42,10 @@ var playBack = (function() { | ||
| 32 | var markerMap = {}; | 42 | var markerMap = {}; |
| 33 | //线路路由数据 | 43 | //线路路由数据 |
| 34 | var lineRoute; | 44 | var lineRoute; |
| 35 | - //默认以第一辆车为焦点 | 45 | + //首辆车自编号 |
| 36 | var firstCar; | 46 | var firstCar; |
| 47 | + //是否启用焦点跟踪 | ||
| 48 | + var isEnableFocus; | ||
| 37 | 49 | ||
| 38 | function getCurrMap(){ | 50 | function getCurrMap(){ |
| 39 | return realMap[realMap.getMap().fName]; | 51 | return realMap[realMap.getMap().fName]; |
| @@ -61,7 +73,8 @@ var playBack = (function() { | @@ -61,7 +73,8 @@ var playBack = (function() { | ||
| 61 | }).mouseout(hideMarkTextMouse) | 73 | }).mouseout(hideMarkTextMouse) |
| 62 | .on('click', function(e){ | 74 | .on('click', function(e){ |
| 63 | var w = e.clientX - 20; | 75 | var w = e.clientX - 20; |
| 64 | - goTo(w); | 76 | + //goTo(w); |
| 77 | + goToByTime(sTime + w * secondPX); | ||
| 65 | hideMarkTextMouse(); | 78 | hideMarkTextMouse(); |
| 66 | }); | 79 | }); |
| 67 | 80 | ||
| @@ -92,37 +105,12 @@ var playBack = (function() { | @@ -92,37 +105,12 @@ var playBack = (function() { | ||
| 92 | }); | 105 | }); |
| 93 | 106 | ||
| 94 | function showMarkText(w){ | 107 | function showMarkText(w){ |
| 95 | - var t = showMark($presMark, w); | ||
| 96 | - //时间戳找gps | ||
| 97 | - var gps; | ||
| 98 | - var marker; | ||
| 99 | - for(;cIndex < size; cIndex ++){ | ||
| 100 | - gps = gpsArray[cIndex]; | ||
| 101 | - if(gps.ts <= t){ | ||
| 102 | - marker = markerMap[gps.nbbm]; | ||
| 103 | - if(marker) | ||
| 104 | - getCurrMap().moveMarker(marker, gps);//移动marker | ||
| 105 | - else{ | ||
| 106 | - markerMap[gps.nbbm] = getCurrMap().addHistoryMarker(gps);//添加marker | ||
| 107 | - //定位到marker | ||
| 108 | - //getCurrMap().markerToCenter(markerMap[gps.nbbm]); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - if(gps.inout_stop != -1){ | ||
| 112 | - //到离站信息 | ||
| 113 | - addInOutText(gps); | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - else{ | ||
| 117 | - break; | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - //定位焦点 | ||
| 121 | - /*if(markerMap[firstCar]){ | ||
| 122 | - getCurrMap().markerToCenter(markerMap[firstCar]); | ||
| 123 | - }*/ | 108 | + var text = moment(cTime * 1000).format('HH:mm.ss'); |
| 109 | + | ||
| 110 | + $presMark.text(text).css('left', w - $presMark.width() / 2).show(); | ||
| 124 | } | 111 | } |
| 125 | 112 | ||
| 113 | + //添加进出站日志 | ||
| 126 | function addInOutText(gps){ | 114 | function addInOutText(gps){ |
| 127 | var info = gps.inout_stop_info | 115 | var info = gps.inout_stop_info |
| 128 | ,date = moment(gps.ts).format('HH:mm.ss'); | 116 | ,date = moment(gps.ts).format('HH:mm.ss'); |
| @@ -149,22 +137,13 @@ var playBack = (function() { | @@ -149,22 +137,13 @@ var playBack = (function() { | ||
| 149 | } | 137 | } |
| 150 | 138 | ||
| 151 | function showMarkTextMouse(w){ | 139 | function showMarkTextMouse(w){ |
| 152 | - showMark($presMarkMouse, w); | 140 | + var text = moment((sTime + w * secondPX) * 1000).format('HH:mm.ss'); |
| 141 | + $presMarkMouse.text(text).css('left', w - $presMarkMouse.width() / 2).show(); | ||
| 153 | } | 142 | } |
| 154 | function hideMarkTextMouse(){ | 143 | function hideMarkTextMouse(){ |
| 155 | $presMarkMouse.hide(); | 144 | $presMarkMouse.hide(); |
| 156 | } | 145 | } |
| 157 | 146 | ||
| 158 | - function showMark(mark, w, anim){ | ||
| 159 | - var t = parseInt((sTime + w / cell) * 1000) | ||
| 160 | - ,text = moment(t).format('HH:mm.ss'); | ||
| 161 | - | ||
| 162 | - mark.text(text).css('left', w - mark.width() / 2) | ||
| 163 | - .show(); | ||
| 164 | - | ||
| 165 | - return t; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | //日志区域滚动条 | 147 | //日志区域滚动条 |
| 169 | $('.pback-logs').slimscroll({ | 148 | $('.pback-logs').slimscroll({ |
| 170 | height: '100%', | 149 | height: '100%', |
| @@ -173,132 +152,243 @@ var playBack = (function() { | @@ -173,132 +152,243 @@ var playBack = (function() { | ||
| 173 | 152 | ||
| 174 | var exports = { | 153 | var exports = { |
| 175 | init : function() { | 154 | init : function() { |
| 176 | - var htmlStr = template('play_back_panel_temp', {}); | 155 | + //清空地图 |
| 156 | + getCurrMap().clear(); | ||
| 157 | + | ||
| 158 | + vehiclePanel.clear(); | ||
| 159 | + | ||
| 160 | + var htmlStr = template('play_back_panel_temp', {}) | ||
| 161 | + ,carSel = '.mapRightWrap select[name="nbbm[]"]'; | ||
| 177 | $('.mapRightWrap').html(htmlStr); | 162 | $('.mapRightWrap').html(htmlStr); |
| 163 | + //初始选中的车辆 | ||
| 164 | + if(defaultCar){ | ||
| 165 | + $(carSel).html('<option selected value="'+defaultCar+'">'+defaultCar+'</option>'); | ||
| 166 | + defaultCar = null; | ||
| 167 | + } | ||
| 178 | //车辆搜索框 | 168 | //车辆搜索框 |
| 179 | - createVehSearch($('.mapRightWrap select[name="nbbm[]"]')); | ||
| 180 | - //线路下拉框 | ||
| 181 | - var lineData = [{id:'-1', text: '请选择...'}]; | ||
| 182 | - $get('/line/all', null, function(array){ | ||
| 183 | - $.each(array, function(){ | ||
| 184 | - lineData.push({id: this.id, text: this.name}); | 169 | + createVehSearch($(carSel)).on('select2:select', function(e){ |
| 170 | + //获取对应线路 | ||
| 171 | + defaultLine = e.params.data.lineCode; | ||
| 185 | }); | 172 | }); |
| 186 | - initPinYinSelect2('.mapRightWrap select[name=lineCode]', lineData); | ||
| 187 | - }); | ||
| 188 | 173 | ||
| 189 | //点击轨迹回放按钮 | 174 | //点击轨迹回放按钮 |
| 190 | - $('#playBackBtn').on('click', function(){ | ||
| 191 | - //表单校验 | ||
| 192 | - if(!customFormValidate('#playBackForm')) | 175 | + $('#playBackBtn').on('click', playBackBtnClick); |
| 176 | + | ||
| 177 | + //默认值,当前时间前后各一个小时 | ||
| 178 | + var m = moment() | ||
| 179 | + ,rq='YYYY-MM-DD', sj='HH:mm'; | ||
| 180 | + $('input[name=sDate]').val(m.format(rq)); | ||
| 181 | + $('input[name=sTime]').val(m.subtract(1, 'hours').format(sj)); | ||
| 182 | + $('input[name=eDate]').val(m.add(2, 'hours').format(rq)); | ||
| 183 | + $('input[name=eTime]').val(m.format('HH:mm')); | ||
| 184 | + } | ||
| 185 | + ,setDefaultCar: function(nbbm, lineCode){ | ||
| 186 | + defaultCar = nbbm; | ||
| 187 | + defaultLine = lineCode; | ||
| 188 | + } | ||
| 189 | + }; | ||
| 190 | + | ||
| 191 | + function playBackBtnClick(){ | ||
| 192 | + //表单校验 | ||
| 193 | + if(!customFormValidate('#playBackForm')) | ||
| 194 | + return; | ||
| 195 | + | ||
| 196 | + var params = $('#playBackForm').serializeJSON(); | ||
| 197 | + //查询历史gps数据 | ||
| 198 | + var fs = 'YYYY-MM-DDHH:mm' | ||
| 199 | + ,st = moment(params.sDate + params.sTime, fs).format('X') | ||
| 200 | + ,et = moment(params.eDate + params.eTime, fs).format('X') | ||
| 201 | + ,nbbm = params.nbbm; | ||
| 202 | + | ||
| 203 | + console.log(params); | ||
| 204 | + isEnableFocus = params.enableFocus; | ||
| 205 | + layer.msg('查询历史GPS...', {icon: 16, time: 0,shade:0.3}); | ||
| 206 | + $.ajax({ | ||
| 207 | + url: '/gps/gpsHistory/multiple', | ||
| 208 | + traditional: true, | ||
| 209 | + data: {nbbmArray: params.nbbm, st: st, et: et}, | ||
| 210 | + success:function(rs){ | ||
| 211 | + if(!rs || rs.length == 0){ | ||
| 212 | + layer.alert('服务器没有返回数据,请检查你的输入参数!', {icon: 3}); | ||
| 193 | return; | 213 | return; |
| 214 | + } | ||
| 194 | 215 | ||
| 195 | - var params = $('#playBackForm').serializeJSON(); | ||
| 196 | - //查询历史gps数据 | ||
| 197 | - var fs = 'YYYY-MM-DDHH:mm' | ||
| 198 | - ,st = moment(params.sDate + params.sTime, fs).format('X') | ||
| 199 | - ,et = moment(params.eDate + params.eTime, fs).format('X') | ||
| 200 | - ,nbbm = params.nbbm; | 216 | + gpsArray = rs; |
| 217 | + size = gpsArray.length; | ||
| 218 | + layer.closeAll(); | ||
| 219 | + //切出轨迹回放面板 | ||
| 220 | + $('.mapRightWrap,.mapTools,.leftUtilsWrap').fadeOut(); | ||
| 221 | + $('.play-back-list,.play-back-btns,.progress-wrap').show(); | ||
| 222 | + //初始化时间戳 | ||
| 223 | + sTime = parseInt(st); | ||
| 224 | + eTime = parseInt(et); | ||
| 225 | + tRange = et - st; | ||
| 201 | 226 | ||
| 202 | - layer.msg('查询历史GPS...', {icon: 16, time: 0,shade:0.3}); | ||
| 203 | - $.ajax({ | ||
| 204 | - url: '/gps/gpsHistory/multiple', | ||
| 205 | - traditional: true, | ||
| 206 | - data: {nbbmArray: params.nbbm, st: st, et: et}, | ||
| 207 | - success:function(rs){ | ||
| 208 | - gpsArray = rs; | ||
| 209 | - size = gpsArray.length; | ||
| 210 | - layer.closeAll(); | ||
| 211 | - //切出轨迹回放面板 | ||
| 212 | - $('.mapRightWrap,.mapTools,.leftUtilsWrap').fadeOut(); | ||
| 213 | - $('.play-back-list,.play-back-btns,.progress-wrap').show(); | ||
| 214 | - //初始化时间戳 | ||
| 215 | - sTime = parseInt(st); | ||
| 216 | - eTime = parseInt(et); | ||
| 217 | - tRange = et - st; | ||
| 218 | - | ||
| 219 | - //获取进度条宽度 | ||
| 220 | - pWidth = $('.progress-body').width(); | ||
| 221 | - cell = pWidth / tRange; | ||
| 222 | - //清理地图 | ||
| 223 | - getCurrMap().clear(); | 227 | + //获取进度条宽度 |
| 228 | + pWidth = $('.progress-body').width(); | ||
| 229 | + secondPX = tRange / pWidth; | ||
| 230 | + //清理地图 | ||
| 231 | + getCurrMap().clear(); | ||
| 232 | + | ||
| 233 | + firstCar = params.nbbm[0]; | ||
| 234 | + | ||
| 235 | + if(defaultLine){ | ||
| 236 | + layer.msg('加载线路图层数据...', {icon: 16, time: 0,shade:0.3}); | ||
| 237 | + $.get('/realSchedule/findRouteByLine', {lineCode: defaultLine} | ||
| 238 | + ,function(route){ | ||
| 239 | + lineRoute = route; | ||
| 240 | + getCurrMap().drawLine(lineRoute); | ||
| 224 | 241 | ||
| 225 | - firstCar = params.nbbm[0]; | 242 | + cTime = sTime; |
| 243 | + play(); | ||
| 226 | 244 | ||
| 227 | - var lineCode = $('.mapRightWrap select[name=lineCode]').val(); | ||
| 228 | - if(lineCode != -1){ | ||
| 229 | - layer.msg('加载线路图层数据...', {icon: 16, time: 0,shade:0.3}); | ||
| 230 | - $.get('/realSchedule/findRouteByLine', {lineId: lineCode} | ||
| 231 | - ,function(route){ | ||
| 232 | - lineRoute = route; | ||
| 233 | - getCurrMap().drawLine(lineRoute); | ||
| 234 | - layer.closeAll(); | ||
| 235 | - play(); | ||
| 236 | - }); | 245 | + //自动定位到第一辆车的第一个点 |
| 246 | + var nbbm = params.nbbm[0] | ||
| 247 | + ,firstTime = searchFirst(gpsArray, nbbm); | ||
| 248 | + if(firstTime){ | ||
| 249 | + layer.msg('从该时区内 ' + nbbm + ' 的首个信号点,' + moment(firstTime).format('HH:mm') + '开始' | ||
| 250 | + ,{offset: 'ct', shift : 5, skin: 'layer-bg-green'}); | ||
| 251 | + | ||
| 252 | + goToByTime(firstTime / 1000); | ||
| 237 | } | 253 | } |
| 238 | else | 254 | else |
| 239 | - play(); | ||
| 240 | - } | ||
| 241 | - }); | ||
| 242 | - }); | ||
| 243 | - | ||
| 244 | - //默认值 | ||
| 245 | - /* $('input[name=sDate]').val('2016-04-24'); | ||
| 246 | - $('input[name=sTime]').val('04:00'); | ||
| 247 | - $('input[name=eDate]').val('2016-04-24'); | ||
| 248 | - $('input[name=eTime]').val('05:40');*/ | 255 | + layer.closeAll(); |
| 256 | + }); | ||
| 257 | + } | ||
| 258 | + else | ||
| 259 | + play(); | ||
| 260 | + } | ||
| 261 | + }); | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + //搜索时间范围内第一个gps点的时间 | ||
| 265 | + function searchFirst(list, nbbm){ | ||
| 266 | + var time; | ||
| 267 | + for(var i = 0, gps; gps = list[i++];){ | ||
| 268 | + if(gps.nbbm == nbbm){ | ||
| 269 | + time = gps.ts; | ||
| 270 | + break; | ||
| 271 | + } | ||
| 249 | } | 272 | } |
| 250 | - }; | 273 | + |
| 274 | + return time; | ||
| 275 | + } | ||
| 251 | 276 | ||
| 252 | function stop(){ | 277 | function stop(){ |
| 278 | + _stopFocusTimer = 1; | ||
| 279 | + clearInterval(focusTimer); | ||
| 280 | + //停止播放 | ||
| 253 | clearInterval(prgTimer); | 281 | clearInterval(prgTimer); |
| 254 | $('.play-back-btns .playBtn').removeClass('fa-pause').addClass('fa-play').data('status', 0); | 282 | $('.play-back-btns .playBtn').removeClass('fa-pause').addClass('fa-play').data('status', 0); |
| 255 | prgTimer = null; | 283 | prgTimer = null; |
| 256 | } | 284 | } |
| 257 | 285 | ||
| 258 | function play(){ | 286 | function play(){ |
| 259 | - if(topW == pWidth){ | ||
| 260 | - //从头再来 | ||
| 261 | - reset(); | ||
| 262 | - } | ||
| 263 | $('#progress-mark-time').show(); | 287 | $('#progress-mark-time').show(); |
| 264 | $('.play-back-btns .playBtn').removeClass('fa-play').addClass('fa-pause').data('status', 1); | 288 | $('.play-back-btns .playBtn').removeClass('fa-play').addClass('fa-pause').data('status', 1); |
| 289 | + //开始播放 | ||
| 265 | start(); | 290 | start(); |
| 291 | + | ||
| 292 | + //启动焦点定位(单独用一个定时器做缓冲) | ||
| 293 | + console.log('isEnableFocus', isEnableFocus); | ||
| 294 | + if(isEnableFocus){ | ||
| 295 | + _stopFocusTimer = null; | ||
| 296 | + startTrackFocus(); | ||
| 297 | + } | ||
| 266 | } | 298 | } |
| 267 | 299 | ||
| 268 | - function reset(){ | ||
| 269 | - topW = 0; | ||
| 270 | - $pmk.css('width', topW + 'px'); | ||
| 271 | - cIndex = 0; | ||
| 272 | - $('.pback-logs').html(''); | 300 | + var _stopFocusTimer, focusTimer; |
| 301 | + function startTrackFocus(){ | ||
| 302 | + trackFocus(); | ||
| 303 | + if(!_stopFocusTimer) | ||
| 304 | + focusTimer = setTimeout(startTrackFocus, 1800); | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + function trackFocus(){ | ||
| 308 | + //定位焦点 | ||
| 309 | + if(markerMap[firstCar]) | ||
| 310 | + getCurrMap().markerToCenter(markerMap[firstCar]); | ||
| 273 | } | 311 | } |
| 274 | 312 | ||
| 275 | - var topW = 0; | ||
| 276 | function start(){ | 313 | function start(){ |
| 277 | - prgTimer = setTimeout(start, 1000); | 314 | + prgTimer = setTimeout(start, 1000 / speed); |
| 278 | run(); | 315 | run(); |
| 279 | } | 316 | } |
| 280 | 317 | ||
| 318 | + var cw = 0; | ||
| 281 | function run(){ | 319 | function run(){ |
| 282 | - topW += (cell * speed); | ||
| 283 | - showMarkText(topW); | ||
| 284 | - if(topW >= pWidth){ | 320 | + cTime += step; |
| 321 | + | ||
| 322 | + cw = (cTime - sTime) / secondPX; | ||
| 323 | + //显示时间标记 | ||
| 324 | + showMarkText(cw); | ||
| 325 | + //移动GPS点 | ||
| 326 | + moveGpsByTime(cTime); | ||
| 327 | + | ||
| 328 | + if(cw >= pWidth){ | ||
| 285 | stop(); | 329 | stop(); |
| 286 | $('#progress-mark-time').hide(); | 330 | $('#progress-mark-time').hide(); |
| 287 | - topW = pWidth; | 331 | + cw = pWidth; |
| 332 | + | ||
| 333 | + layer.msg('本次轨迹回放已结束' | ||
| 334 | + ,{offset: 'ct', shift : 5 , skin: 'layer-bg-red'}); | ||
| 288 | } | 335 | } |
| 289 | - $pmk.css('width', topW + 'px'); | 336 | + $pmk.css('width', cw + 'px'); |
| 290 | } | 337 | } |
| 291 | 338 | ||
| 292 | - function goTo(w){ | ||
| 293 | - $('.pback-logs').html(''); | 339 | + //根据时间移动GPS |
| 340 | + function moveGpsByTime(t){ | ||
| 341 | + t = t * 1000; | ||
| 342 | + var rs = {}, gps; | ||
| 343 | + for(;cIndex < size; cIndex ++){ | ||
| 344 | + gps = gpsArray[cIndex]; | ||
| 345 | + if(gps.ts <= t) | ||
| 346 | + rs[gps.nbbm] = gps; | ||
| 347 | + else | ||
| 348 | + break; | ||
| 349 | + | ||
| 350 | + //到离站信息 | ||
| 351 | + if(gps.inout_stop != -1) | ||
| 352 | + addInOutText(gps); | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + //绘制到地图 | ||
| 356 | + var marker; | ||
| 357 | + for(var nbbm in rs){ | ||
| 358 | + gps = rs[nbbm]; | ||
| 359 | + marker = markerMap[gps.nbbm]; | ||
| 360 | + | ||
| 361 | + if(marker) | ||
| 362 | + getCurrMap().moveMarker(marker, gps);//移动marker | ||
| 363 | + else | ||
| 364 | + markerMap[gps.nbbm] = getCurrMap().addHistoryMarker(gps);//添加marker | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + function goToByTime(time){ | ||
| 370 | + //停止播放 | ||
| 371 | + clearInterval(prgTimer); | ||
| 372 | + prgTimer = null; | ||
| 294 | cIndex = 0; | 373 | cIndex = 0; |
| 295 | - stop(); | ||
| 296 | - topW = w; | ||
| 297 | - showMarkText(w); | ||
| 298 | - //$pmk.css('width', w); | 374 | + |
| 375 | + cTime = time; | ||
| 376 | + //清空右侧日志信息 | ||
| 377 | + $('.pback-logs').html(''); | ||
| 378 | + //清除GPS点 | ||
| 379 | + removeAllGps(); | ||
| 299 | play(); | 380 | play(); |
| 300 | } | 381 | } |
| 301 | 382 | ||
| 383 | + | ||
| 384 | + //removeMarker | ||
| 385 | + function removeAllGps(){ | ||
| 386 | + for(var nbbm in markerMap) | ||
| 387 | + getCurrMap().removeMarker(markerMap[nbbm]); | ||
| 388 | + | ||
| 389 | + markerMap = {}; | ||
| 390 | + } | ||
| 391 | + | ||
| 302 | /** | 392 | /** |
| 303 | * 自定义表单校验 | 393 | * 自定义表单校验 |
| 304 | */ | 394 | */ |
src/main/resources/static/pages/mapmonitor/real/js/vehicle.js
| @@ -38,6 +38,12 @@ var vehiclePanel = (function() { | @@ -38,6 +38,12 @@ var vehiclePanel = (function() { | ||
| 38 | }); | 38 | }); |
| 39 | }); | 39 | }); |
| 40 | 40 | ||
| 41 | + //跳转到轨迹回放 | ||
| 42 | + function toPlayBack(nbbm, lineCode){ | ||
| 43 | + playBack.setDefaultCar(nbbm, lineCode); | ||
| 44 | + $('.mapTools .item[data-click=playBack]').click(); | ||
| 45 | + } | ||
| 46 | + | ||
| 41 | //绘制线路和GPS | 47 | //绘制线路和GPS |
| 42 | function drawLineAndGps(lineCode, callFun){ | 48 | function drawLineAndGps(lineCode, callFun){ |
| 43 | //过滤出该线路的GPS点 | 49 | //过滤出该线路的GPS点 |
| @@ -169,7 +175,11 @@ var vehiclePanel = (function() { | @@ -169,7 +175,11 @@ var vehiclePanel = (function() { | ||
| 169 | for(var deviceId in allGps) | 175 | for(var deviceId in allGps) |
| 170 | array.push(allGps[deviceId]); | 176 | array.push(allGps[deviceId]); |
| 171 | return array; | 177 | return array; |
| 172 | - } | 178 | + }, |
| 179 | + clear: function(){ | ||
| 180 | + cLineCode = null; | ||
| 181 | + }, | ||
| 182 | + toPlayBack:toPlayBack | ||
| 173 | }; | 183 | }; |
| 174 | 184 | ||
| 175 | return exports; | 185 | return exports; |
src/main/resources/static/pages/mapmonitor/real/real.html
| @@ -55,9 +55,12 @@ | @@ -55,9 +55,12 @@ | ||
| 55 | <i class="fa fa-close"></i><span id="playSpeedText">10</span><i class="fa fa-angle-up" ></i> | 55 | <i class="fa fa-close"></i><span id="playSpeedText">10</span><i class="fa fa-angle-up" ></i> |
| 56 | </span> | 56 | </span> |
| 57 | <ul class="dropdown-menu play-speed-select" > | 57 | <ul class="dropdown-menu play-speed-select" > |
| 58 | - <li data-speed=10><a href="javascript:;">10秒 </a></li> | ||
| 59 | - <li data-speed=5><a href="javascript:;">5秒 </a></li> | ||
| 60 | - <li data-speed=1><a href="javascript:;">1秒</a></li> | 58 | + <li data-speed=30><a href="javascript:;">1秒30帧 </a></li> |
| 59 | + <li data-speed=20><a href="javascript:;">1秒20帧 </a></li> | ||
| 60 | + <li data-speed=10><a href="javascript:;">1秒10帧 </a></li> | ||
| 61 | + <li data-speed=7><a href="javascript:;">1秒7帧 </a></li> | ||
| 62 | + <li data-speed=5><a href="javascript:;">1秒5帧 </a></li> | ||
| 63 | + <li data-speed=1><a href="javascript:;">1秒1帧 </a></li> | ||
| 61 | </ul> | 64 | </ul> |
| 62 | </div> | 65 | </div> |
| 63 | 66 | ||
| @@ -80,11 +83,11 @@ | @@ -80,11 +83,11 @@ | ||
| 80 | 83 | ||
| 81 | <div id="temps"></div> | 84 | <div id="temps"></div> |
| 82 | 85 | ||
| 83 | -<script src="/pages/mapmonitor/real/js/map_platform.js"></script> | ||
| 84 | -<script src="/pages/mapmonitor/real/js/vehicle.js"></script> | ||
| 85 | -<script src="/pages/mapmonitor/real/js/search.js"></script> | ||
| 86 | -<script src="/pages/mapmonitor/real/js/temp.js"></script> | ||
| 87 | -<script src="/pages/mapmonitor/real/js/real.js"></script> | ||
| 88 | -<script src="/pages/mapmonitor/real/js/playBack.js"></script> | 86 | +<script src="/pages/mapmonitor/real/js/map_platform.js" data-exclude=1></script> |
| 87 | +<script src="/pages/mapmonitor/real/js/vehicle.js" data-exclude=1></script> | ||
| 88 | +<script src="/pages/mapmonitor/real/js/search.js" data-exclude=1></script> | ||
| 89 | +<script src="/pages/mapmonitor/real/js/temp.js" data-exclude=1></script> | ||
| 90 | +<script src="/pages/mapmonitor/real/js/real.js" data-exclude=1></script> | ||
| 91 | +<script src="/pages/mapmonitor/real/js/playBack.js" data-exclude=1></script> | ||
| 89 | <script> | 92 | <script> |
| 90 | </script> | 93 | </script> |
src/main/resources/static/pages/mapmonitor/real/temps/playBack.html
| @@ -8,7 +8,8 @@ | @@ -8,7 +8,8 @@ | ||
| 8 | <div class="form-group"> | 8 | <div class="form-group"> |
| 9 | <label class="col-md-3 control-label">车辆编码</label> | 9 | <label class="col-md-3 control-label">车辆编码</label> |
| 10 | <div class="col-md-9"> | 10 | <div class="col-md-9"> |
| 11 | - <select class="form-control" name="nbbm[]" placeholder="车辆编码" multiple="multiple" required=1 style="width:100%;"></select> | 11 | + <select class="form-control" name="nbbm[]" placeholder="车辆编码" multiple="multiple" required=1 style="width:100%;"> |
| 12 | + </select> | ||
| 12 | </div> | 13 | </div> |
| 13 | </div> | 14 | </div> |
| 14 | 15 | ||
| @@ -26,15 +27,21 @@ | @@ -26,15 +27,21 @@ | ||
| 26 | <input type="time" name="eTime" class="form-control" placeholder="时间" required=1> | 27 | <input type="time" name="eTime" class="form-control" placeholder="时间" required=1> |
| 27 | </div> | 28 | </div> |
| 28 | </div> | 29 | </div> |
| 29 | - </div> | ||
| 30 | -</form> | ||
| 31 | -<form class="form-horizontal" role="form" style="padding-top: 0px;"> | 30 | + |
| 32 | <div class="form-group"> | 31 | <div class="form-group"> |
| 33 | - <label class="col-md-3 control-label">线路图层</label> | 32 | + <label class="col-md-3 control-label"></label> |
| 34 | <div class="col-md-9"> | 33 | <div class="col-md-9"> |
| 35 | - <select class="form-control" name="lineCode" style="width:100%;"></select> | 34 | + <div class="checkbox-list" style="font-size: 13px;"> |
| 35 | + <label> | ||
| 36 | + <div class="checker" style="display: inline-block;vertical-align: middle;"> | ||
| 37 | + <span> | ||
| 38 | + <input type="checkbox" name="enableFocus"> | ||
| 39 | + </span> | ||
| 40 | + </div> 当前选中的首辆车为焦点 </label> | ||
| 41 | + </div> | ||
| 36 | </div> | 42 | </div> |
| 37 | </div> | 43 | </div> |
| 44 | + </div> | ||
| 38 | </form> | 45 | </form> |
| 39 | <hr> | 46 | <hr> |
| 40 | <div class="form-actions"> | 47 | <div class="form-actions"> |
| @@ -44,4 +51,4 @@ | @@ -44,4 +51,4 @@ | ||
| 44 | </div> | 51 | </div> |
| 45 | </div> | 52 | </div> |
| 46 | </div> | 53 | </div> |
| 47 | -</script> | ||
| 48 | \ No newline at end of file | 54 | \ No newline at end of file |
| 55 | +</script> |
src/main/resources/static/pages/mapmonitor/real/temps/vehicle.html
| @@ -88,6 +88,6 @@ | @@ -88,6 +88,6 @@ | ||
| 88 | 下一班{{nextSch.qdzName}} {{nextSch.fcsj}} 发车 | 88 | 下一班{{nextSch.qdzName}} {{nextSch.fcsj}} 发车 |
| 89 | {{/if}} | 89 | {{/if}} |
| 90 | </p> | 90 | </p> |
| 91 | -<a href="javascript:void(0)" style="color:#006600;font-size:12px;">轨迹回放</a> | 91 | +<a href="javascript:vehiclePanel.toPlayBack('{{nbbm}}', '{{lineId}}')" class="link_to_pback" style="color:#006600;font-size:12px;">轨迹回放</a> |
| 92 | </div> | 92 | </div> |
| 93 | </script> | 93 | </script> |
| 94 | \ No newline at end of file | 94 | \ No newline at end of file |