Commit 9652aed9e2027c82e8bc65586adb10b5597385a9
Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang
Showing
29 changed files
with
446 additions
and
112 deletions
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -22,6 +22,9 @@ public class BasicDataController { |
| 22 | 22 | @Autowired |
| 23 | 23 | BasicData.BasicDataLoader dataLoader; |
| 24 | 24 | |
| 25 | + @Autowired | |
| 26 | + BasicData basicData; | |
| 27 | + | |
| 25 | 28 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 26 | 29 | |
| 27 | 30 | @RequestMapping("/cars") |
| ... | ... | @@ -114,4 +117,13 @@ public class BasicDataController { |
| 114 | 117 | } |
| 115 | 118 | return rs; |
| 116 | 119 | } |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 车辆自编号和车牌号对照 | |
| 123 | + * @return | |
| 124 | + */ | |
| 125 | + @RequestMapping("/nbbm2PlateNo") | |
| 126 | + public Map<String, String> nbbm2PlateNo(){ | |
| 127 | + return basicData.getNbbm2PlateNo(); | |
| 128 | + } | |
| 117 | 129 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 7 | 7 | import com.bsth.data.BasicData; |
| 8 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 10 | 11 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 11 | 12 | import org.apache.commons.lang3.StringEscapeUtils; |
| 12 | 13 | import org.joda.time.format.DateTimeFormat; |
| ... | ... | @@ -444,9 +445,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 444 | 445 | * 获取当日计划排班 , 从计划表抓取数据 |
| 445 | 446 | * @return |
| 446 | 447 | */ |
| 447 | - @RequestMapping(value = "currentSchedulePlan", method = RequestMethod.GET) | |
| 448 | - public Map<String, Object> currentSchedulePlan(@RequestParam String lineCodes){ | |
| 449 | - return scheduleRealInfoService.currentSchedulePlan(lineCodes); | |
| 448 | + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET) | |
| 449 | + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ | |
| 450 | + return scheduleRealInfoService.currentSchedulePlan(lineCode); | |
| 450 | 451 | } |
| 451 | - | |
| 452 | 452 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -13,6 +13,7 @@ import org.slf4j.Logger; |
| 13 | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.boot.CommandLineRunner; |
| 16 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | 17 | import org.springframework.stereotype.Component; |
| 17 | 18 | |
| 18 | 19 | import java.util.*; |
| ... | ... | @@ -89,6 +90,18 @@ public class BasicData implements CommandLineRunner { |
| 89 | 90 | return name != null? name: stationCode2NameMap.get(prefix + code); |
| 90 | 91 | } |
| 91 | 92 | |
| 93 | + @Autowired | |
| 94 | + JdbcTemplate jdbcTemplate; | |
| 95 | + public Map<String, String> getNbbm2PlateNo(){ | |
| 96 | + List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | |
| 97 | + | |
| 98 | + Map<String, String> rs = new HashMap<>(); | |
| 99 | + for(Map<String, Object> map : list){ | |
| 100 | + rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | |
| 101 | + } | |
| 102 | + return rs; | |
| 103 | + } | |
| 104 | + | |
| 92 | 105 | @Component |
| 93 | 106 | public static class BasicDataLoader extends Thread { |
| 94 | 107 | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata; |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | 5 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 6 | +import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | |
| 6 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | 9 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -35,6 +36,9 @@ public class GpsRealData implements CommandLineRunner { |
| 35 | 36 | GpsDataLoaderThread gpsDataLoader; |
| 36 | 37 | |
| 37 | 38 | @Autowired |
| 39 | + OfflineMonitorThread offlineMonitorThread; | |
| 40 | + | |
| 41 | + @Autowired | |
| 38 | 42 | DayOfSchedule dayOfSchedule; |
| 39 | 43 | |
| 40 | 44 | @Autowired |
| ... | ... | @@ -54,9 +58,10 @@ public class GpsRealData implements CommandLineRunner { |
| 54 | 58 | //定时从网关获取GPS数据 |
| 55 | 59 | //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 15, TimeUnit.SECONDS); |
| 56 | 60 | //定时扫描掉离线 |
| 57 | - | |
| 61 | + //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 60, 20, TimeUnit.SECONDS); | |
| 58 | 62 | } |
| 59 | 63 | |
| 64 | + | |
| 60 | 65 | public void put(GpsEntity gps) { |
| 61 | 66 | String device = gps.getDeviceId(); |
| 62 | 67 | GpsEntity old = gpsMap.get(device); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| ... | ... | @@ -19,10 +19,22 @@ public abstract class SignalHandle { |
| 19 | 19 | return prevs != null && prevs.size() > 0 && prevs.getTail() != null; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - protected boolean isDriftSignal(GpsEntity gps) { | |
| 22 | +/* protected boolean isDriftSignal(GpsEntity gps) { | |
| 23 | + return gps.getLat() == 0 || gps.getLon() == 0; | |
| 24 | + }*/ | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * gps掉线 | |
| 28 | + * @param gps | |
| 29 | + * @return | |
| 30 | + */ | |
| 31 | + protected boolean isGpsOffline(GpsEntity gps){ | |
| 23 | 32 | return gps.getLat() == 0 || gps.getLon() == 0; |
| 24 | 33 | } |
| 25 | 34 | |
| 35 | + protected boolean isOffline(GpsEntity gps){ | |
| 36 | + return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline"); | |
| 37 | + } | |
| 26 | 38 | /** |
| 27 | 39 | * 是不是异常信号 |
| 28 | 40 | * |
| ... | ... | @@ -34,7 +46,7 @@ public abstract class SignalHandle { |
| 34 | 46 | /** |
| 35 | 47 | * 连续异常信号个数统计 |
| 36 | 48 | * |
| 37 | - * @param prevs | |
| 49 | + * @param | |
| 38 | 50 | * @return protected int abnormalCount(CircleQueue<GpsEntity> prevs) { |
| 39 | 51 | * int count = 0; |
| 40 | 52 | * <p> |
| ... | ... | @@ -78,9 +90,9 @@ public abstract class SignalHandle { |
| 78 | 90 | return false; |
| 79 | 91 | |
| 80 | 92 | GpsEntity prev = prevs.getTail(); |
| 81 | - //从漂移状态恢复 | |
| 82 | - if (isDriftSignal(prev) | |
| 83 | - && !isDriftSignal(gps)) { | |
| 93 | + //从异常状态恢复 | |
| 94 | + if (isGpsOffline(prev) | |
| 95 | + && !isGpsOffline(gps)) { | |
| 84 | 96 | return true; |
| 85 | 97 | } |
| 86 | 98 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/AbnormalStateHandle.java
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -48,8 +48,8 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 48 | 48 | |
| 49 | 49 | @Override |
| 50 | 50 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 51 | - //忽略漂移信号 | |
| 52 | - if(isDriftSignal(gps)) | |
| 51 | + //忽略掉线信号 | |
| 52 | + if(isGpsOffline(gps)) | |
| 53 | 53 | return false; |
| 54 | 54 | |
| 55 | 55 | //从异常状态恢复的第一个信号 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
| ... | ... | @@ -21,9 +21,10 @@ public class OfflineSignalHandle extends SignalHandle{ |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 24 | - //漂移信号不管 | |
| 25 | - if(isDriftSignal(gps)){ | |
| 24 | + //掉线信号不管 | |
| 25 | + if(isGpsOffline(gps)){ | |
| 26 | 26 | gps.setSignalState("drift"); |
| 27 | + gps.setAbnormalStatus("gps-offline"); | |
| 27 | 28 | return true; |
| 28 | 29 | } |
| 29 | 30 | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
src/main/java/com/bsth/data/gpsdata/thread/OfflineMonitorThread.java
| ... | ... | @@ -2,7 +2,11 @@ package com.bsth.data.gpsdata.thread; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | 4 | import com.bsth.data.gpsdata.GpsRealData; |
| 5 | +import com.bsth.websocket.handler.SendUtils; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.stereotype.Component; | |
| 6 | 10 | |
| 7 | 11 | import java.util.Collection; |
| 8 | 12 | |
| ... | ... | @@ -10,35 +14,45 @@ import java.util.Collection; |
| 10 | 14 | * GPS掉离线监控 |
| 11 | 15 | * Created by panzhao on 2017/1/11. |
| 12 | 16 | */ |
| 17 | +@Component | |
| 13 | 18 | public class OfflineMonitorThread extends Thread{ |
| 14 | 19 | |
| 15 | 20 | @Autowired |
| 16 | 21 | GpsRealData gpsRealData; |
| 17 | 22 | |
| 18 | - //有任务时 掉线阈值 | |
| 19 | - private final static int LOSE_TIME = 1000 * 60 * 2; | |
| 23 | + //掉线阈值 | |
| 24 | + private final static int LOSE_TIME = 1000 * 60 * 10; | |
| 25 | + | |
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + SendUtils sendUtils; | |
| 20 | 30 | |
| 21 | 31 | //无任务时 离线阈值 |
| 22 | - private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 32 | + //private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 23 | 33 | |
| 24 | 34 | @Override |
| 25 | 35 | public void run() { |
| 26 | - long t = System.currentTimeMillis(); | |
| 27 | - Collection<GpsEntity> list = gpsRealData.all(); | |
| 28 | - | |
| 29 | - String state; | |
| 30 | - for(GpsEntity gps : list){ | |
| 31 | - state = gps.getAbnormalStatus(); | |
| 32 | - | |
| 33 | - if(state.equals("offline")) | |
| 34 | - continue; | |
| 35 | - | |
| 36 | - | |
| 37 | - //if(state.equals("lose")) | |
| 38 | - //if(!state.equals("lose")) | |
| 39 | - //if(state.equals("")) | |
| 40 | - //if(gps.getTimestamp()) | |
| 41 | - //if(gps.getAbnormalStatus().equals("lose")) | |
| 36 | + try{ | |
| 37 | + long t = System.currentTimeMillis(); | |
| 38 | + Collection<GpsEntity> list = gpsRealData.all(); | |
| 39 | + | |
| 40 | + String state; | |
| 41 | + for(GpsEntity gps : list){ | |
| 42 | + state = gps.getAbnormalStatus(); | |
| 43 | + | |
| 44 | + if(state != null && state.equals("offline")) | |
| 45 | + continue; | |
| 46 | + | |
| 47 | + if (t - gps.getTimestamp() > LOSE_TIME){ | |
| 48 | + gps.setAbnormalStatus("offline"); | |
| 49 | + | |
| 50 | + //通知页面有设备掉线 | |
| 51 | + sendUtils.deviceOffline(gps); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + }catch (Exception e){ | |
| 55 | + logger.error("", e); | |
| 42 | 56 | } |
| 43 | 57 | } |
| 44 | 58 | } | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -407,7 +407,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 407 | 407 | new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - private List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 410 | + public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) { | |
| 411 | 411 | List<SchedulePlanInfo> list = new ArrayList<>(); |
| 412 | 412 | |
| 413 | 413 | SchedulePlanInfo sp; | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.realcontrol; |
| 3 | 3 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 4 | 4 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 5 | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 6 | 7 | import com.bsth.service.BaseService; |
| 7 | 8 | import org.springframework.stereotype.Service; |
| 8 | 9 | |
| ... | ... | @@ -149,5 +150,5 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 149 | 150 | |
| 150 | 151 | Map<String, Object> exportWaybillMore(Map<String, Object> map); |
| 151 | 152 | |
| 152 | - Map<String,Object> currentSchedulePlan(String lineCodes); | |
| 153 | + List<SchedulePlanInfo> currentSchedulePlan(String lineCode); | |
| 153 | 154 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -24,6 +24,7 @@ import com.bsth.entity.realcontrol.SvgAttribute; |
| 24 | 24 | import com.bsth.entity.schedule.CarConfigInfo; |
| 25 | 25 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 26 | 26 | import com.bsth.entity.schedule.GuideboardInfo; |
| 27 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 27 | 28 | import com.bsth.entity.sys.DutyEmployee; |
| 28 | 29 | import com.bsth.entity.sys.SysUser; |
| 29 | 30 | import com.bsth.repository.LineRepository; |
| ... | ... | @@ -34,11 +35,11 @@ import com.bsth.repository.realcontrol.SvgAttributeRepository; |
| 34 | 35 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 35 | 36 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 36 | 37 | import com.bsth.repository.schedule.GuideboardInfoRepository; |
| 37 | -import com.bsth.repository.schedule.SchedulePlanRepository; | |
| 38 | 38 | import com.bsth.security.util.SecurityUtils; |
| 39 | 39 | import com.bsth.service.SectionRouteService; |
| 40 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 41 | 41 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 42 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 42 | 43 | import com.bsth.service.sys.DutyEmployeeService; |
| 43 | 44 | import com.bsth.util.*; |
| 44 | 45 | import com.bsth.websocket.handler.SendUtils; |
| ... | ... | @@ -2176,7 +2177,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2176 | 2177 | |
| 2177 | 2178 | for (ChangePersonCar cpc : cpcs) { |
| 2178 | 2179 | |
| 2179 | - if (map.get(cpc.getClZbh()) == null) { | |
| 2180 | + if (cpc.getClZbh() != null && map.get(cpc.getClZbh()) == null) { | |
| 2180 | 2181 | rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); |
| 2181 | 2182 | rs.put("status", ResponseCode.ERROR); |
| 2182 | 2183 | return rs; |
| ... | ... | @@ -3226,16 +3227,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3226 | 3227 | return map; |
| 3227 | 3228 | } |
| 3228 | 3229 | |
| 3229 | - | |
| 3230 | - @Autowired | |
| 3231 | - SchedulePlanRepository schedulePlanRepository; | |
| 3232 | - | |
| 3230 | + @Autowired | |
| 3231 | + SchedulePlanInfoService schPlanService; | |
| 3233 | 3232 | @Override |
| 3234 | - public Map<String, Object> currentSchedulePlan(String lineCodes) { | |
| 3235 | - List<String> codes = Splitter.on(",").splitToList(lineCodes); | |
| 3236 | - | |
| 3237 | - //List<SchedulePlan> list = schedulePlanRepository.findByMultiLineCode(codes); | |
| 3238 | - //System.out.println(list); | |
| 3239 | - return null; | |
| 3233 | + public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 3234 | + List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 3235 | + | |
| 3236 | + if(rs==null || rs.size()==0){ | |
| 3237 | + //尝试刷新内存 | |
| 3238 | + Map<String, Object> data = new HashMap<>(); | |
| 3239 | + data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 3240 | + data.put("xlBm_eq", lineCode); | |
| 3241 | + List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 3242 | + | |
| 3243 | + if(planItr.size() > 0){ | |
| 3244 | + dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 3245 | + return planItr; | |
| 3246 | + } | |
| 3247 | + } | |
| 3248 | + return rs; | |
| 3240 | 3249 | } |
| 3241 | 3250 | } |
| 3242 | 3251 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.websocket.handler; |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.bsth.data.BasicData; |
| 5 | 5 | import com.bsth.data.LineConfigData; |
| 6 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | 7 | import com.bsth.data.gpsdata.arrival.entity.SignalState; |
| 7 | 8 | import com.bsth.entity.directive.D80; |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| ... | ... | @@ -170,4 +171,17 @@ public class SendUtils{ |
| 170 | 171 | list.add(sch); |
| 171 | 172 | refreshSch(list); |
| 172 | 173 | } |
| 174 | + | |
| 175 | + public void deviceOffline(GpsEntity gps){ | |
| 176 | + Map<String, Object> map = new HashMap<>(); | |
| 177 | + map.put("fn", "deviceOffline"); | |
| 178 | + map.put("gps", gps);; | |
| 179 | + ObjectMapper mapper = new ObjectMapper(); | |
| 180 | + | |
| 181 | + try { | |
| 182 | + socketHandler.sendMessageToLine(gps.getLineId().toString(), mapper.writeValueAsString(map)); | |
| 183 | + } catch (JsonProcessingException e) { | |
| 184 | + logger.error("", e); | |
| 185 | + } | |
| 186 | + } | |
| 173 | 187 | } | ... | ... |
src/main/resources/static/real_control_v2/css/home.css
src/main/resources/static/real_control_v2/css/main.css
| ... | ... | @@ -784,4 +784,30 @@ li.map-panel { |
| 784 | 784 | #cache_data_manage-modal .uk-table td, |
| 785 | 785 | #cache_data_manage-modal .uk-table th{ |
| 786 | 786 | padding: 8px 8px 6px; |
| 787 | +} | |
| 788 | + | |
| 789 | + | |
| 790 | +.ps-help-panel{ | |
| 791 | + color: grey; | |
| 792 | + padding: 5px 2px; | |
| 793 | +} | |
| 794 | + | |
| 795 | +.ps-help-panel small{ | |
| 796 | + display: block; | |
| 797 | +} | |
| 798 | + | |
| 799 | + | |
| 800 | +svg text.offline{ | |
| 801 | + fill: #534e4e !important; | |
| 802 | +} | |
| 803 | + | |
| 804 | +svg rect.offline{ | |
| 805 | + stroke: #abaaaa !important; | |
| 806 | + fill: #b8b8b8 !important; | |
| 807 | +} | |
| 808 | + | |
| 809 | +.tooltip .tooltip-container .title a>.abnormal-text{ | |
| 810 | + font-size: 14px; | |
| 811 | + color: #ff5e5e; | |
| 812 | + font-weight: 600; | |
| 787 | 813 | } |
| 788 | 814 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/line_panel.html
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | </script> |
| 26 | 26 | |
| 27 | 27 | <script id="home-gps-tbody-temp" type="text/html"> |
| 28 | - <dl id="home_gps_{{deviceId}}" data-device-id="{{deviceId}}"> | |
| 28 | + <dl id="home_gps_{{deviceId}}" data-device-id="{{deviceId}}" {{if abnormalStatus=='offline'}}class="offline"{{/if}}> | |
| 29 | 29 | <dd title="{{nbbm}}"><a>{{nbbm}}</a></dd> |
| 30 | 30 | <dd>{{speed}}</dd> |
| 31 | 31 | <dd>{{expectStopTime}}</dd> | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
| ... | ... | @@ -3,7 +3,18 @@ |
| 3 | 3 | <div class="tooltip" > |
| 4 | 4 | <div class="tooltip-container"> |
| 5 | 5 | <div class="title"> |
| 6 | - <a href="javascript:;" data-for="station" class="tip_modal">{{nbbm}}</a> | |
| 6 | + <a href="javascript:;" data-for="station" class="tip_modal"> | |
| 7 | + {{nbbm}} | |
| 8 | + {{if abnormalStatus == 'outBounds'}} | |
| 9 | + <span class="abnormal-text">越界</span> | |
| 10 | + {{else if abnormalStatus == 'overspeed'}} | |
| 11 | + <span class="abnormal-text">超速</span> | |
| 12 | + {{else if abnormalStatus == 'gps-offline'}} | |
| 13 | + <span class="abnormal-text">GPS掉线</span> | |
| 14 | + {{else if abnormalStatus == 'offline'}} | |
| 15 | + <span class="abnormal-text">已离线</span> | |
| 16 | + {{/if}} | |
| 17 | + </a> | |
| 7 | 18 | </div> |
| 8 | 19 | <div> |
| 9 | 20 | <span class="field">站点:</span>{{stationName}} |
| ... | ... | @@ -36,7 +47,9 @@ |
| 36 | 47 | <div class="tooltip multi-tooltip" > |
| 37 | 48 | <div class="tooltip-container"> |
| 38 | 49 | <div class="title"> |
| 39 | - <a href="javascript:;" data-for="station" class="tip_modal">{{gps.nbbm}}</a> | |
| 50 | + <a href="javascript:;" data-for="station" class="tip_modal"> | |
| 51 | + {{gps.nbbm}} | |
| 52 | + </a> | |
| 40 | 53 | </div> |
| 41 | 54 | <div> |
| 42 | 55 | <span class="field">站点:</span>{{gps.stationName}} | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/curr_date_schedule.html
| ... | ... | @@ -75,6 +75,16 @@ |
| 75 | 75 | .curr-schedule-table dl dt:nth-of-type(18), .curr-schedule-table dl dd:nth-of-type(18) { |
| 76 | 76 | width: 5%; |
| 77 | 77 | } |
| 78 | + | |
| 79 | + #curr-date-schedule-modal .line_list_ul li{ | |
| 80 | + margin-top:0 !important; | |
| 81 | + padding: 5px; | |
| 82 | + cursor: default; | |
| 83 | + } | |
| 84 | + | |
| 85 | + #curr-date-schedule-modal .line_list_ul li.active{ | |
| 86 | + background: #93d1ff; | |
| 87 | + } | |
| 78 | 88 | </style> |
| 79 | 89 | |
| 80 | 90 | <div class="uk-modal-dialog uk-modal-dialog-large"> |
| ... | ... | @@ -83,15 +93,12 @@ |
| 83 | 93 | <h2>当日计划排班</h2></div> |
| 84 | 94 | |
| 85 | 95 | <div class="uk-grid uk-grid-collapse"> |
| 86 | - <div class="uk-width-medium-1-10"> | |
| 87 | - <ul class="uk-list uk-list-line uk-width-medium-1-1"> | |
| 88 | - <li>219路</li> | |
| 89 | - <li>784路</li> | |
| 90 | - <li>166路</li> | |
| 96 | + <div class="uk-width-medium-1-10" style="border-right: 1px solid #81c7fb;border-top: 1px solid #81c7fb;box-shadow: 3px -2px 2px 0 rgba(129, 199, 251, 0.19), 4px -3px 2px 0 rgba(129, 199, 251, 0.2);width: calc(10% - 3px);margin-right: 3px;"> | |
| 97 | + <ul class="uk-list uk-list-line uk-width-medium-1-1 line_list_ul"> | |
| 91 | 98 | </ul> |
| 92 | 99 | </div> |
| 93 | 100 | <div class="uk-width-medium-9-10"> |
| 94 | - <div class="ct_table_wrap"> | |
| 101 | + <div class="ct_table_wrap" style="height: 460px;"> | |
| 95 | 102 | <div class="ct_table curr-schedule-table"> |
| 96 | 103 | <div class="ct_table_head"> |
| 97 | 104 | <dl> |
| ... | ... | @@ -124,6 +131,53 @@ |
| 124 | 131 | </div> |
| 125 | 132 | </div> |
| 126 | 133 | |
| 134 | + <script id="curr_schedule_tree-temp" type="text/html"> | |
| 135 | + {{each list as line i}} | |
| 136 | + <li data-id="{{line.lineCode}}">{{line.name}}</li> | |
| 137 | + {{/each}} | |
| 138 | + </script> | |
| 139 | + | |
| 140 | + <script id="curr_schedule_list-temp" type="text/html"> | |
| 141 | + {{each list as sch i}} | |
| 142 | + <dl> | |
| 143 | + <dd>{{sch.scheduleDateStr}}</dd> | |
| 144 | + <dd>{{sch.xlBm}}</dd> | |
| 145 | + <dd>{{sch.lpName}}</dd> | |
| 146 | + <dd>{{sch.clZbh}}</dd> | |
| 147 | + <dd>{{sch.plate}}</dd> | |
| 148 | + <dd>营运</dd> | |
| 149 | + <dd>{{sch.personArray[0].jGh}}</dd> | |
| 150 | + <dd>{{sch.personArray[0].jName}}</dd> | |
| 151 | + <dd>{{sch.personArray[0].sGh}}</dd> | |
| 152 | + <dd>{{sch.personArray[0].sName}}</dd> | |
| 153 | + | |
| 154 | + {{if sch.personArray.length >= 2}} | |
| 155 | + <dd>{{sch.personArray[1].jGh}}</dd> | |
| 156 | + <dd>{{sch.personArray[1].jName}}</dd> | |
| 157 | + <dd>{{sch.personArray[1].sGh}}</dd> | |
| 158 | + <dd>{{sch.personArray[1].sName}}</dd> | |
| 159 | + {{else}} | |
| 160 | + <dd></dd> | |
| 161 | + <dd></dd> | |
| 162 | + <dd></dd> | |
| 163 | + <dd></dd> | |
| 164 | + {{/if}} | |
| 165 | + | |
| 166 | + | |
| 167 | + {{if sch.personArray.length >= 3}} | |
| 168 | + <dd>{{sch.personArray[2].jGh}}</dd> | |
| 169 | + <dd>{{sch.personArray[2].jName}}</dd> | |
| 170 | + <dd>{{sch.personArray[2].sGh}}</dd> | |
| 171 | + <dd>{{sch.personArray[2].sName}}</dd> | |
| 172 | + {{else}} | |
| 173 | + <dd></dd> | |
| 174 | + <dd></dd> | |
| 175 | + <dd></dd> | |
| 176 | + <dd></dd> | |
| 177 | + {{/if}} | |
| 178 | + </dl> | |
| 179 | + {{/each}} | |
| 180 | + </script> | |
| 127 | 181 | |
| 128 | 182 | <script> |
| 129 | 183 | (function () { |
| ... | ... | @@ -132,13 +186,76 @@ |
| 132 | 186 | $(modal).on('init', function (e, data) { |
| 133 | 187 | e.stopPropagation(); |
| 134 | 188 | |
| 189 | + //线路列表 | |
| 190 | + var htmlStr = template('curr_schedule_tree-temp', {list: gb_data_basic.activeLines}); | |
| 191 | + $('.line_list_ul', modal).html(htmlStr); | |
| 135 | 192 | |
| 193 | + //默认点击第一个 | |
| 194 | + $('.line_list_ul li:eq(0)', modal).trigger('click'); | |
| 136 | 195 | }); |
| 137 | 196 | |
| 197 | + $(modal).on('click', '.line_list_ul li', function () { | |
| 198 | + $('.line_list_ul li.active').removeClass('active'); | |
| 199 | + $(this).addClass('active'); | |
| 200 | + query($(this).data('id')); | |
| 201 | + }); | |
| 202 | + | |
| 203 | + var query = function (lineCode) { | |
| 204 | + $.get('/realSchedule/currSchedulePlanByLineCode', {lineCode: lineCode}, function (rs) { | |
| 205 | + | |
| 138 | 206 | |
| 139 | - var query = function () { | |
| 207 | + var data=[]; | |
| 208 | + //先按路牌分组 | |
| 209 | + var lpMapData = gb_common.groupBy(rs, 'lpName'); | |
| 140 | 210 | |
| 211 | + for(var lp in lpMapData){ | |
| 212 | + data.push(mergeSchData(lpMapData[lp])); | |
| 213 | + } | |
| 214 | + | |
| 215 | + var htmlStr = template('curr_schedule_list-temp', {list: data}); | |
| 216 | + $('.ct_table_body', modal).html(htmlStr); | |
| 217 | + }); | |
| 141 | 218 | }; |
| 219 | + | |
| 220 | + /** | |
| 221 | + * 合并同一个路牌下的班次 | |
| 222 | + * @param list | |
| 223 | + */ | |
| 224 | + function mergeSchData(list) { | |
| 225 | + var sch = list[0]; | |
| 226 | + sch.scheduleDateStr = moment(sch.scheduleDate).format('YYYY-MM-DD'); | |
| 227 | + //车牌号 | |
| 228 | + sch.plate = gb_data_basic.nbbm2PlateMap()[sch.clZbh]; | |
| 229 | + | |
| 230 | + var personArray=[]; | |
| 231 | + $.each(list, function () { | |
| 232 | + if(!isExist(personArray, this)){ | |
| 233 | + personArray.push(getPerson(this)); | |
| 234 | + } | |
| 235 | + }); | |
| 236 | + | |
| 237 | + sch.personArray=personArray; | |
| 238 | + return sch; | |
| 239 | + } | |
| 240 | + | |
| 241 | + function getPerson(sch){ | |
| 242 | + return { | |
| 243 | + jGh: sch.jGh, | |
| 244 | + jName: sch.jName, | |
| 245 | + sGh: sch.sGh, | |
| 246 | + sName: sch.sName | |
| 247 | + } | |
| 248 | + } | |
| 249 | + | |
| 250 | + function isExist(array, sch) { | |
| 251 | + for(var i = 0, person; person=array[i++];){ | |
| 252 | + if(person.jGh == sch.jGh && person.sGh == sch.sGh){ | |
| 253 | + return true; | |
| 254 | + } | |
| 255 | + } | |
| 256 | + | |
| 257 | + return false; | |
| 258 | + } | |
| 142 | 259 | })(); |
| 143 | 260 | </script> |
| 144 | 261 | </div> | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config.html
| ... | ... | @@ -3,33 +3,37 @@ |
| 3 | 3 | <button class="uk-modal-close uk-close" type="button"></button> |
| 4 | 4 | <div class="uk-grid uk-flex-middle" data-uk-grid-margin> |
| 5 | 5 | <div class="uk-width-medium-1-6 uk-height-viewport line-config-tree" data-uk-observe> |
| 6 | - <h3 class="title" >线路配置</h3> | |
| 6 | + <h3 class="title">线路配置</h3> | |
| 7 | 7 | <div class="uk-accordion" data-uk-accordion="{showfirst:false}"></div> |
| 8 | 8 | </div> |
| 9 | - <div class="uk-width-medium-5-6 uk-height-viewport right-container" > | |
| 9 | + <div class="uk-width-medium-5-6 uk-height-viewport right-container"> | |
| 10 | 10 | <div id="line_config_entity_panel"></div> |
| 11 | 11 | <div id="buffer_config_panel"></div> |
| 12 | 12 | </div> |
| 13 | 13 | </div> |
| 14 | + | |
| 15 | + <div style="position: absolute;top: 10px;left: 40%;padding: 10px;color: #fe4242;background: #f2f2f2;box-shadow: 3px 1px 4px 0 rgba(0, 0, 0, 0.2), 1px 0px 5px 0 rgba(0, 0, 0, 0.19);font-size: 16px;"> | |
| 16 | + 功能调试中,当前页面暂不可用!!! | |
| 17 | + </div> | |
| 14 | 18 | </div> |
| 15 | 19 | |
| 16 | 20 | |
| 17 | 21 | <script id="nav-line_config-modal-tree-temp" type="text/html"> |
| 18 | - {{each array as line i}} | |
| 19 | - <h3 class="uk-accordion-title" data-id="{{line.lineCode}}">{{line.name}}</h3> | |
| 20 | - <div class="uk-accordion-content"> | |
| 21 | - <ul class="uk-list uk-list-line"> | |
| 22 | - <li><a>班次更新时间</a></li> | |
| 23 | - <li><a>出场时间类型</a></li> | |
| 24 | - <li><a>原线路回场</a></li> | |
| 25 | - <li><a>到站缓冲区设置</a></li> | |
| 26 | - <li><a>应急停靠</a></li> | |
| 27 | - <li><a class="disabled">漂移判定</a></li> | |
| 28 | - <li><a class="disabled">到离站预测</a></li> | |
| 29 | - <li><a class="disabled">挂牌时刻表</a></li> | |
| 30 | - </ul> | |
| 31 | - </div> | |
| 32 | - {{/each}} | |
| 22 | + {{each array as line i}} | |
| 23 | + <h3 class="uk-accordion-title" data-id="{{line.lineCode}}">{{line.name}}</h3> | |
| 24 | + <div class="uk-accordion-content"> | |
| 25 | + <ul class="uk-list uk-list-line"> | |
| 26 | + <li><a>班次更新时间</a></li> | |
| 27 | + <li><a>出场时间类型</a></li> | |
| 28 | + <li><a>原线路回场</a></li> | |
| 29 | + <li><a>到站缓冲区设置</a></li> | |
| 30 | + <li><a>应急停靠</a></li> | |
| 31 | + <li><a class="disabled">漂移判定</a></li> | |
| 32 | + <li><a class="disabled">到离站预测</a></li> | |
| 33 | + <li><a class="disabled">挂牌时刻表</a></li> | |
| 34 | + </ul> | |
| 35 | + </div> | |
| 36 | + {{/each}} | |
| 33 | 37 | </script> |
| 34 | 38 | |
| 35 | 39 | <script> |
| ... | ... | @@ -37,7 +41,7 @@ |
| 37 | 41 | var modal = '#nav-line_config-modal', |
| 38 | 42 | lineConfig, activeCode; |
| 39 | 43 | |
| 40 | - $(modal).on('init', function(e, data) { | |
| 44 | + $(modal).on('init', function (e, data) { | |
| 41 | 45 | e.stopPropagation(); |
| 42 | 46 | var htmlStr = template('nav-line_config-modal-tree-temp', {array: gb_data_basic.activeLines}); |
| 43 | 47 | $('.line-config-tree .uk-accordion', modal).html(htmlStr); | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_basic.js
| ... | ... | @@ -91,6 +91,11 @@ var gb_data_basic = (function () { |
| 91 | 91 | $.get('/basic/nbbm2deviceId', function (rs) { |
| 92 | 92 | ep.emit('nbbm2deviceId', rs); |
| 93 | 93 | }); |
| 94 | + //nbbm to 车牌号 | |
| 95 | + var nbbm2PlateMap; | |
| 96 | + $.get('/basic/nbbm2PlateNo', function (rs) { | |
| 97 | + nbbm2PlateMap = rs; | |
| 98 | + }); | |
| 94 | 99 | |
| 95 | 100 | //模拟图属性数据 |
| 96 | 101 | gb_common.$get('/realSchedule/svgAttr', {idx: line_idx}, function (rs) { |
| ... | ... | @@ -190,6 +195,9 @@ var gb_data_basic = (function () { |
| 190 | 195 | allPersonnel = data; |
| 191 | 196 | cb && cb(); |
| 192 | 197 | }); |
| 198 | + }, | |
| 199 | + nbbm2PlateMap: function () { | |
| 200 | + return nbbm2PlateMap; | |
| 193 | 201 | } |
| 194 | 202 | }; |
| 195 | 203 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_gps.js
| 1 | 1 | /* gps 数据管理模块 */ |
| 2 | 2 | |
| 3 | -var gb_data_gps = (function() { | |
| 3 | +var gb_data_gps = (function () { | |
| 4 | 4 | |
| 5 | 5 | //fixed time refresh delay |
| 6 | 6 | var delay = 1000 * 7; |
| ... | ... | @@ -9,15 +9,15 @@ var gb_data_gps = (function() { |
| 9 | 9 | //refresh after callback |
| 10 | 10 | var refreshEventCallbacks = []; |
| 11 | 11 | //register callback function |
| 12 | - var registerCallback = function(cb) { | |
| 12 | + var registerCallback = function (cb) { | |
| 13 | 13 | if (cb) |
| 14 | 14 | refreshEventCallbacks.push(cb); |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | - var refresh = function(cb) { | |
| 17 | + var refresh = function (cb) { | |
| 18 | 18 | $.ajax({ |
| 19 | 19 | url: '/gps/real/line', |
| 20 | - data:{lineCodes: gb_data_basic.line_idx}, | |
| 20 | + data: {lineCodes: gb_data_basic.line_idx}, | |
| 21 | 21 | success: function (rs) { |
| 22 | 22 | refreshData(rs); |
| 23 | 23 | cb(); |
| ... | ... | @@ -29,16 +29,16 @@ var gb_data_gps = (function() { |
| 29 | 29 | }); |
| 30 | 30 | }; |
| 31 | 31 | |
| 32 | - var refreshData = function(rs) { | |
| 32 | + var refreshData = function (rs) { | |
| 33 | 33 | var old, addArr = [], |
| 34 | 34 | upArr = [], |
| 35 | 35 | upDownChange = []; |
| 36 | 36 | |
| 37 | 37 | var schArray; |
| 38 | - $.each(rs, function() { | |
| 38 | + $.each(rs, function () { | |
| 39 | 39 | old = realData[this.deviceId]; |
| 40 | 40 | if (old) { |
| 41 | - if (this.timestamp > old.timestamp){ | |
| 41 | + if (this.timestamp > old.timestamp) { | |
| 42 | 42 | if (old.upDown != this.upDown) |
| 43 | 43 | upDownChange.push(this); |
| 44 | 44 | else |
| ... | ... | @@ -49,9 +49,9 @@ var gb_data_gps = (function() { |
| 49 | 49 | addArr.push(this); |
| 50 | 50 | |
| 51 | 51 | //班次信息 |
| 52 | - if(this.schId){ | |
| 53 | - schArray=gb_schedule_table.findScheduleByLine(this.lineId); | |
| 54 | - if(schArray) | |
| 52 | + if (this.schId) { | |
| 53 | + schArray = gb_schedule_table.findScheduleByLine(this.lineId); | |
| 54 | + if (schArray) | |
| 55 | 55 | this.sch = schArray[this.schId]; |
| 56 | 56 | } |
| 57 | 57 | |
| ... | ... | @@ -62,27 +62,27 @@ var gb_data_gps = (function() { |
| 62 | 62 | |
| 63 | 63 | //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length); |
| 64 | 64 | //CCCallFuncN |
| 65 | - $.each(refreshEventCallbacks, function(i, cb) { | |
| 65 | + $.each(refreshEventCallbacks, function (i, cb) { | |
| 66 | 66 | cb(addArr, upArr, upDownChange); |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | 71 | var startFixedTime; |
| 72 | - var fixedTimeRefresh = function() { | |
| 72 | + var fixedTimeRefresh = function () { | |
| 73 | 73 | if (startFixedTime) |
| 74 | 74 | return; |
| 75 | 75 | startFixedTime = true; |
| 76 | 76 | |
| 77 | - (function() { | |
| 77 | + (function () { | |
| 78 | 78 | var f = arguments.callee; |
| 79 | - refresh(function() { | |
| 79 | + refresh(function () { | |
| 80 | 80 | setTimeout(f, delay); |
| 81 | 81 | }); |
| 82 | 82 | })(); |
| 83 | 83 | }; |
| 84 | 84 | |
| 85 | - var gpsByLineCode = function(lineCode) { | |
| 85 | + var gpsByLineCode = function (lineCode) { | |
| 86 | 86 | var rs = []; |
| 87 | 87 | for (var device in realData) { |
| 88 | 88 | if (realData[device].lineId == lineCode) |
| ... | ... | @@ -91,20 +91,38 @@ var gb_data_gps = (function() { |
| 91 | 91 | return rs; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | - var findOne = function(deviceId){ | |
| 94 | + var findOne = function (deviceId) { | |
| 95 | 95 | return realData[deviceId]; |
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | - var findGpsByNbbm = function(nbbm){ | |
| 98 | + var findGpsByNbbm = function (nbbm) { | |
| 99 | 99 | return realData[gb_data_basic.nbbm2deviceMap()[nbbm]]; |
| 100 | 100 | }; |
| 101 | 101 | |
| 102 | + /** | |
| 103 | + * 设备掉线事件 | |
| 104 | + */ | |
| 105 | + var deviceOffline = function (gps) { | |
| 106 | + $.each(offlineCallbacks, function (i, cb) { | |
| 107 | + cb(gps); | |
| 108 | + }); | |
| 109 | + }; | |
| 110 | + | |
| 111 | + //注册掉线事件回调函数 | |
| 112 | + var offlineCallbacks = []; | |
| 113 | + var registerOfflineCb = function (cb) { | |
| 114 | + if (cb) | |
| 115 | + offlineCallbacks.push(cb); | |
| 116 | + }; | |
| 117 | + | |
| 102 | 118 | return { |
| 103 | 119 | fixedTimeRefresh: fixedTimeRefresh, |
| 104 | 120 | registerCallback: registerCallback, |
| 105 | 121 | allGps: realData, |
| 106 | 122 | gpsByLineCode: gpsByLineCode, |
| 107 | 123 | findOne: findOne, |
| 108 | - findGpsByNbbm: findGpsByNbbm | |
| 124 | + findGpsByNbbm: findGpsByNbbm, | |
| 125 | + deviceOffline: deviceOffline, | |
| 126 | + registerOfflineCb: registerOfflineCb | |
| 109 | 127 | }; |
| 110 | 128 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/data/gps_abnormal.js
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
src/main/resources/static/real_control_v2/js/home/line_panel.js
| ... | ... | @@ -79,6 +79,9 @@ var gb_home_line_panel = (function() { |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | var updateRow = function(e, t) { |
| 82 | + if(e.hasClass('offline')) | |
| 83 | + e.removeClass('offline'); | |
| 84 | + | |
| 82 | 85 | var cells = e.find('dd'); |
| 83 | 86 | $(cells[1]).text(t.speed); |
| 84 | 87 | $(cells[2]).html(t.expectStopTime == null ? '' : t.expectStopTime); |
| ... | ... | @@ -138,6 +141,18 @@ var gb_home_line_panel = (function() { |
| 138 | 141 | return rs; |
| 139 | 142 | } |
| 140 | 143 | |
| 144 | + /** | |
| 145 | + * 设备掉线事件 | |
| 146 | + */ | |
| 147 | + gb_data_gps.registerOfflineCb(deviceOffline); | |
| 148 | + | |
| 149 | + function deviceOffline(gps) { | |
| 150 | + //模拟图掉线 | |
| 151 | + gb_svg_chart.deviceOffline(gps); | |
| 152 | + //主页表格掉线 | |
| 153 | + $('#home-main-content .data-body .home-gps-table dl#home_gps_'+gps.deviceId).addClass('offline'); | |
| 154 | + } | |
| 155 | + | |
| 141 | 156 | //文件载入完毕 |
| 142 | 157 | res_load_ep.emitLater('load_home_line_panel'); |
| 143 | 158 | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
| ... | ... | @@ -98,11 +98,19 @@ var gb_schedule_context_menu = (function () { |
| 98 | 98 | }, '确定下发指令'); |
| 99 | 99 | }, |
| 100 | 100 | jgtz: function (schArray) { |
| 101 | - var idArr = []; | |
| 101 | + //忽略进出场班次 | |
| 102 | + schArray = schArray.filter(function (sch) { | |
| 103 | + return sch.bcType != 'in' && sch.bcType != 'out'; | |
| 104 | + }); | |
| 105 | + | |
| 106 | + var idArr = [], qdz = schArray[0].qdzCode; | |
| 102 | 107 | $.each(schArray, function () { |
| 103 | - idArr.push(this.id); | |
| 108 | + if(this.qdzCode==qdz) | |
| 109 | + idArr.push(this.id); | |
| 104 | 110 | }); |
| 105 | - var elem = UIkit.modal.prompt('请输入间隔(分钟)', 0, function (newValue) { | |
| 111 | + | |
| 112 | + var ps = '<div class="ps-help-panel"><small>1、忽略进出场班次</small><small>2、与选中的第一个班次起点站不同的也将被忽略</small></div>'; | |
| 113 | + var elem = UIkit.modal.prompt('请输入间隔(分钟)' + ps, 0, function (newValue) { | |
| 106 | 114 | if (!isNaN(newValue) && newValue > 0) { |
| 107 | 115 | gb_common.$post_arr('/realSchedule/spaceAdjust', {ids: idArr, space: newValue}, function (rs) { |
| 108 | 116 | //刷新数据 | ... | ... |
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
| ... | ... | @@ -244,7 +244,9 @@ var gb_svg_chart = (function () { |
| 244 | 244 | }); |
| 245 | 245 | e.classed({'abnormal': function (d) { |
| 246 | 246 | return d.abnormalClaszz; |
| 247 | - }}); | |
| 247 | + }, 'offline': function (d) { | |
| 248 | + return d['abnormalStatus']=='offline'; | |
| 249 | + }}); | |
| 248 | 250 | //update tip position |
| 249 | 251 | gb_svg_tooltip.update(e); |
| 250 | 252 | }, |
| ... | ... | @@ -259,23 +261,28 @@ var gb_svg_chart = (function () { |
| 259 | 261 | var svgs = $('.line-chart[data-code=' + lineCode + ']'), |
| 260 | 262 | data = gb_data_gps.gpsByLineCode(lineCode); |
| 261 | 263 | |
| 262 | - var list = [], suffix; | |
| 264 | + var list = [], suffix, abmStatus; | |
| 263 | 265 | //过滤无站点字段的数据 |
| 264 | 266 | $.each(data, function () { |
| 265 | 267 | if (!this.stopNo || this.stopNo == '') |
| 266 | 268 | return true; |
| 267 | 269 | |
| 268 | - suffix = ''; | |
| 269 | - this['abnormalClaszz'] = true; | |
| 270 | - if(this['abnormalStatus']=='outBounds'){ | |
| 271 | - suffix = '界'; | |
| 272 | - } | |
| 273 | - else if(this['abnormalStatus']=='overspeed'){ | |
| 274 | - suffix = '速'; | |
| 270 | + abmStatus = this['abnormalStatus']; | |
| 271 | + if(abmStatus != 'offline'){ | |
| 272 | + suffix = ''; | |
| 273 | + this['abnormalClaszz'] = true; | |
| 274 | + if(abmStatus=='outBounds') | |
| 275 | + suffix = '界'; | |
| 276 | + else if(abmStatus=='overspeed') | |
| 277 | + suffix = '速'; | |
| 278 | + else if(abmStatus=='gps-offline') | |
| 279 | + suffix = '掉'; | |
| 280 | + else | |
| 281 | + this['abnormalClaszz'] = false; | |
| 275 | 282 | } |
| 276 | 283 | else |
| 277 | 284 | this['abnormalClaszz'] = false; |
| 278 | - | |
| 285 | + | |
| 279 | 286 | this.suffix = suffix; |
| 280 | 287 | list.push(this); |
| 281 | 288 | }); |
| ... | ... | @@ -350,8 +357,19 @@ var gb_svg_chart = (function () { |
| 350 | 357 | .attr('y', isDown ? y + 24 : y - 14); |
| 351 | 358 | }; |
| 352 | 359 | |
| 360 | + | |
| 361 | + /** | |
| 362 | + * 设备掉线 | |
| 363 | + * @param gps | |
| 364 | + */ | |
| 365 | + var deviceOffline = function (gps) { | |
| 366 | + $('svg text[_id=tx_'+gps.deviceId+']').addClass('offline'); | |
| 367 | + $('svg rect[_id=tx_'+gps.deviceId+']').addClass('offline'); | |
| 368 | + }; | |
| 369 | + | |
| 353 | 370 | return { |
| 354 | 371 | draw_line: draw_line, |
| 355 | - setGps: setGps | |
| 372 | + setGps: setGps, | |
| 373 | + deviceOffline: deviceOffline | |
| 356 | 374 | }; |
| 357 | 375 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
| ... | ... | @@ -149,7 +149,8 @@ var gb_sch_websocket = (function () { |
| 149 | 149 | refreshSch: refreshSch, |
| 150 | 150 | d80Confirm: d80Confirm, |
| 151 | 151 | directive: directiveStatus, |
| 152 | - signal_state: signalState | |
| 152 | + signal_state: signalState, | |
| 153 | + deviceOffline: deviceOffline | |
| 153 | 154 | }; |
| 154 | 155 | |
| 155 | 156 | function currentSecond() { |
| ... | ... | @@ -241,6 +242,14 @@ var gb_sch_websocket = (function () { |
| 241 | 242 | setTimeout(f, 5000); |
| 242 | 243 | }(); |
| 243 | 244 | |
| 245 | + /** | |
| 246 | + * 设备掉线 | |
| 247 | + * @param msg | |
| 248 | + */ | |
| 249 | + function deviceOffline(msg) { | |
| 250 | + gb_data_gps.deviceOffline(msg.gps); | |
| 251 | + } | |
| 252 | + | |
| 244 | 253 | return { |
| 245 | 254 | sock: schSock |
| 246 | 255 | }; | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback/run.html
| ... | ... | @@ -208,11 +208,13 @@ |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | var toCenterTimer; |
| 211 | - | |
| 211 | + var markerIsVisible; | |
| 212 | 212 | function fixedToCenter() { |
| 213 | 213 | toCenterTimer = setInterval(function () { |
| 214 | - map.panTo(marker.getPosition()); | |
| 215 | - }, 4000); | |
| 214 | + var markerIsVisible = BMapLib.GeoUtils.isPointInRect(marker.point,map.getBounds()); | |
| 215 | + if(!markerIsVisible) | |
| 216 | + map.panTo(marker.getPosition()); | |
| 217 | + }, 400); | |
| 216 | 218 | } |
| 217 | 219 | |
| 218 | 220 | //暂停 | ... | ... |