| | |
| | | |
| | | private static Map<String, Map<String,Map<String,Object>>> userPositionMap = new HashMap();//依用户存放实施车辆位置:userId,carId,车辆位置 |
| | | |
| | | private static Map<String,Map<String,Object>> carPositionMap = new HashMap();//依车辆存放实施车辆位置:carId,车辆位置 |
| | | |
| | | public static Map<String, List<ArdSyCarLock>> getTopicSubscribe() { |
| | | return topicSubscribe; |
| | | } |
| | |
| | | public static synchronized void setUserPositionMap(Map<String, Map<String, Map<String, Object>>> userPositionMap) { |
| | | PositionContainer.userPositionMap = userPositionMap; |
| | | } |
| | | |
| | | public static Map<String, Map<String, Object>> getCarPositionMap() { |
| | | return carPositionMap; |
| | | } |
| | | |
| | | public static void setCarPositionMap(Map<String, Map<String, Object>> carPositionMap) { |
| | | PositionContainer.carPositionMap = carPositionMap; |
| | | } |
| | | } |
| | |
| | | } |
| | | //清淤结束------------ |
| | | |
| | | /*gpsMap.putAll(result); |
| | | gpsMap.putAll(result); |
| | | String ancestors = (String) gpsMap.get("ancestors");//获取父级部门 |
| | | String[] ancestorsArray = ancestors.split(","); |
| | | if(ancestorsArray.length == 1){//最高级部门 |
| | |
| | | deptMapp.put((String)gpsMap.get("carId"),gpsMap); |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | //存入实时位置容器 |
| | | PositionContainer.getCarPositionMap().put(carId,gpsMap); |
| | | //存入用户容器 |
| | | if(PositionContainer.getUserPositionMap().size() != 0){ |
| | | for(String userId : PositionContainer.getUserPositionMap().keySet()){ |
| | |
| | | Map<String, Map<String, Object>> map = new HashMap(); |
| | | map.put(carId, new HashMap()); |
| | | PositionContainer.getUserPositionMap().put(usersId, map); |
| | | Map<String, Object> position = PositionContainer.getCarPositionMap().get(carId);//查询当前车辆位置 |
| | | if (position != null) { |
| | | if (position.size() != 0) { |
| | | Map<String, Map<String, Object>> data = new HashMap(); |
| | | data.put("31000", position); |
| | | WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(sessionId), JSON.toJSONString(data)); |
| | | } |
| | | } |
| | | |
| | | Date date = new Date(); |
| | | Timer carPositionTimer = new Timer(sessionId);//定时推送实时位置 |
| | | TimerTask carPositionTask = new TimerTask() { |
| | |
| | | Map<String, Map<String, Object>> map = new HashMap(); |
| | | map.put(carId, new HashMap()); |
| | | PositionContainer.getUserPositionMap().put(usersId, map); |
| | | Map<String, Object> position = PositionContainer.getCarPositionMap().get(carId);//查询当前车辆位置 |
| | | if (position != null) { |
| | | if (position.size() != 0) { |
| | | Map<String, Map<String, Object>> data = new HashMap(); |
| | | data.put("31000", position); |
| | | WebSocketUtils.sendMessage(ONLINE_USER_SESSIONS.get(sessionId), JSON.toJSONString(data)); |
| | | } |
| | | } |
| | | |
| | | Date date = new Date(); |
| | | Timer carPositionTimer = new Timer(sessionId);//定时推送实时位置 |
| | | TimerTask carPositionTask = new TimerTask() { |