Commit adc2ab19dca45610d316cc0994fac0829e7bd174
1 parent
ea43f1bc
update
Showing
16 changed files
with
292 additions
and
188 deletions
src/main/java/com/bsth/controller/DeviceGpsController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | -import java.io.BufferedOutputStream; | |
| 4 | -import java.io.BufferedReader; | |
| 5 | -import java.io.File; | |
| 6 | -import java.io.FileInputStream; | |
| 7 | -import java.io.IOException; | |
| 8 | -import java.io.InputStreamReader; | |
| 9 | -import java.io.OutputStream; | |
| 10 | -import java.text.SimpleDateFormat; | |
| 11 | -import java.util.ArrayList; | |
| 12 | -import java.util.Date; | |
| 13 | -import java.util.HashMap; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.Map; | |
| 16 | - | |
| 17 | -import javax.servlet.http.HttpServletRequest; | |
| 18 | -import javax.servlet.http.HttpServletResponse; | |
| 19 | - | |
| 20 | -import org.apache.commons.lang.StringEscapeUtils; | |
| 21 | -import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 22 | -import org.apache.poi.hssf.usermodel.HSSFRichTextString; | |
| 23 | -import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 24 | -import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 25 | -import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 26 | -import org.springframework.beans.BeanUtils; | |
| 27 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 28 | -import org.springframework.util.StringUtils; | |
| 29 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 30 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 31 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 32 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 33 | -import org.springframework.web.bind.annotation.RestController; | |
| 34 | -import org.springframework.web.multipart.MultipartFile; | |
| 35 | - | |
| 36 | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 37 | 4 | import com.bsth.data.gpsdata.GpsRealData; |
| 38 | 5 | import com.fasterxml.jackson.core.JsonParseException; |
| 39 | 6 | import com.fasterxml.jackson.databind.JsonMappingException; |
| 40 | 7 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 41 | -import com.fasterxml.jackson.databind.util.BeanUtil; | |
| 8 | +import org.apache.commons.lang.StringEscapeUtils; | |
| 9 | +import org.apache.poi.hssf.usermodel.*; | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.util.StringUtils; | |
| 12 | +import org.springframework.web.bind.annotation.*; | |
| 13 | +import org.springframework.web.multipart.MultipartFile; | |
| 14 | + | |
| 15 | +import javax.servlet.http.HttpServletRequest; | |
| 16 | +import javax.servlet.http.HttpServletResponse; | |
| 17 | +import java.io.*; | |
| 18 | +import java.text.SimpleDateFormat; | |
| 19 | +import java.util.*; | |
| 42 | 20 | |
| 43 | 21 | @RestController |
| 44 | 22 | @RequestMapping("devicegps") |
| ... | ... | @@ -121,7 +99,7 @@ public class DeviceGpsController { |
| 121 | 99 | try { |
| 122 | 100 | data = new ObjectMapper().readValue(json, List.class); |
| 123 | 101 | for (Map<String, Object> info : data) { |
| 124 | - info.put("detail", gpsRealData.findByDeviceId((String)info.get("deviceId"))); | |
| 102 | + info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | |
| 125 | 103 | } |
| 126 | 104 | |
| 127 | 105 | res.put("errCode", 0); | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| 1 | 1 | package com.bsth.data.gpsdata; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | -import com.alibaba.fastjson.JSONObject; | |
| 5 | 3 | import com.bsth.data.BasicData; |
| 6 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 7 | -import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 8 | -import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | |
| 5 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | |
| 9 | 6 | import com.bsth.data.schedule.DayOfSchedule; |
| 10 | 7 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | -import com.bsth.util.ConfigUtil; | |
| 12 | 8 | import com.google.common.collect.TreeMultimap; |
| 13 | 9 | import org.apache.commons.lang3.StringUtils; |
| 14 | -import org.apache.http.HttpEntity; | |
| 15 | -import org.apache.http.client.methods.CloseableHttpResponse; | |
| 16 | -import org.apache.http.client.methods.HttpGet; | |
| 17 | -import org.apache.http.impl.client.CloseableHttpClient; | |
| 18 | -import org.apache.http.impl.client.HttpClients; | |
| 19 | 10 | import org.slf4j.Logger; |
| 20 | 11 | import org.slf4j.LoggerFactory; |
| 21 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 13 | import org.springframework.boot.CommandLineRunner; |
| 23 | 14 | import org.springframework.stereotype.Component; |
| 24 | 15 | |
| 25 | -import java.io.BufferedReader; | |
| 26 | -import java.io.InputStreamReader; | |
| 27 | 16 | import java.util.*; |
| 28 | 17 | |
| 29 | 18 | /** |
| ... | ... | @@ -42,11 +31,8 @@ public class GpsRealData implements CommandLineRunner { |
| 42 | 31 | //按线路分组设备号 |
| 43 | 32 | private static TreeMultimap<String, String> lineCode2Devices; |
| 44 | 33 | |
| 45 | - // 网关数据接口地址 | |
| 46 | - private static String url; | |
| 47 | - | |
| 48 | 34 | @Autowired |
| 49 | - GpsDataLoader gpsDataLoader; | |
| 35 | + GpsDataLoaderThread gpsDataLoader; | |
| 50 | 36 | |
| 51 | 37 | @Autowired |
| 52 | 38 | DayOfSchedule dayOfSchedule; |
| ... | ... | @@ -60,13 +46,15 @@ public class GpsRealData implements CommandLineRunner { |
| 60 | 46 | public GpsRealData() { |
| 61 | 47 | gpsMap = new HashMap<>(); |
| 62 | 48 | lineCode2Devices = TreeMultimap.create(); |
| 63 | - url = ConfigUtil.get("http.gps.real.url"); | |
| 64 | 49 | } |
| 65 | 50 | |
| 66 | 51 | @Override |
| 67 | 52 | public void run(String... arg0) throws Exception { |
| 68 | 53 | logger.info("gpsDataLoader,20,5"); |
| 54 | + //定时从网关获取GPS数据 | |
| 69 | 55 | //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); |
| 56 | + //定时扫描掉离线 | |
| 57 | + | |
| 70 | 58 | } |
| 71 | 59 | |
| 72 | 60 | public void put(GpsEntity gps) { |
| ... | ... | @@ -146,10 +134,6 @@ public class GpsRealData implements CommandLineRunner { |
| 146 | 134 | return gpsMap.keySet(); |
| 147 | 135 | } |
| 148 | 136 | |
| 149 | - public GpsEntity findByDeviceId(String deviceId) { | |
| 150 | - return gpsMap.get(deviceId); | |
| 151 | - } | |
| 152 | - | |
| 153 | 137 | public Collection<GpsEntity> all() { |
| 154 | 138 | return gpsMap.values(); |
| 155 | 139 | } |
| ... | ... | @@ -157,87 +141,4 @@ public class GpsRealData implements CommandLineRunner { |
| 157 | 141 | public void remove(String device) { |
| 158 | 142 | gpsMap.remove(device); |
| 159 | 143 | } |
| 160 | - | |
| 161 | - @Component | |
| 162 | - public static class GpsDataLoader extends Thread { | |
| 163 | - | |
| 164 | - Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); | |
| 165 | - | |
| 166 | - @Autowired | |
| 167 | - GpsRealData gpsRealData; | |
| 168 | - | |
| 169 | - @Autowired | |
| 170 | - GpsRealAnalyse gpsRealAnalyse; | |
| 171 | - | |
| 172 | - @Override | |
| 173 | - public void run() { | |
| 174 | - try { | |
| 175 | - //如果正在恢复数据 | |
| 176 | - if (GpsDataRecovery.run) | |
| 177 | - return; | |
| 178 | - | |
| 179 | - load(); | |
| 180 | - } catch (Exception e) { | |
| 181 | - logger.error("", e); | |
| 182 | - } | |
| 183 | - } | |
| 184 | - | |
| 185 | - public void load() throws Exception { | |
| 186 | - List<GpsEntity> list = null; | |
| 187 | - List<GpsEntity> updateList = new ArrayList<>(); | |
| 188 | - CloseableHttpClient httpClient = null; | |
| 189 | - CloseableHttpResponse response = null; | |
| 190 | - try { | |
| 191 | - httpClient = HttpClients.createDefault(); | |
| 192 | - HttpGet get = new HttpGet(url); | |
| 193 | - | |
| 194 | - response = httpClient.execute(get); | |
| 195 | - | |
| 196 | - HttpEntity entity = response.getEntity(); | |
| 197 | - if (null != entity) { | |
| 198 | - BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 199 | - StringBuffer stringBuffer = new StringBuffer(); | |
| 200 | - String str = ""; | |
| 201 | - while ((str = br.readLine()) != null) | |
| 202 | - stringBuffer.append(str); | |
| 203 | - | |
| 204 | - JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); | |
| 205 | - | |
| 206 | - if (jsonObj != null) | |
| 207 | - list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); | |
| 208 | - | |
| 209 | - String nbbm; | |
| 210 | - GpsEntity old; | |
| 211 | - for (GpsEntity gps : list) { | |
| 212 | - //没有设备号 | |
| 213 | - if (StringUtils.isBlank(gps.getDeviceId())) | |
| 214 | - continue; | |
| 215 | - | |
| 216 | - old = gpsMap.get(gps.getDeviceId()); | |
| 217 | - if (old != null && | |
| 218 | - old.getTimestamp() == gps.getTimestamp()) | |
| 219 | - continue; | |
| 220 | - | |
| 221 | - nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 222 | - if (StringUtils.isBlank(nbbm)) | |
| 223 | - gps.setIncomplete(true);//标记为异常数据 | |
| 224 | - else | |
| 225 | - gps.setNbbm(nbbm); | |
| 226 | - //有更新的点位 | |
| 227 | - updateList.add(gps); | |
| 228 | - } | |
| 229 | - //分析数据 | |
| 230 | - gpsRealAnalyse.analyse(updateList); | |
| 231 | - } else | |
| 232 | - logger.error("real gps result is null"); | |
| 233 | - } catch (Exception e) { | |
| 234 | - logger.error("", e); | |
| 235 | - } finally { | |
| 236 | - if (null != httpClient) | |
| 237 | - httpClient.close(); | |
| 238 | - if (null != response) | |
| 239 | - response.close(); | |
| 240 | - } | |
| 241 | - } | |
| 242 | - } | |
| 243 | 144 | } |
| 244 | 145 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.thread; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.bsth.data.BasicData; | |
| 6 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 7 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 8 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 9 | +import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | |
| 10 | +import com.bsth.util.ConfigUtil; | |
| 11 | +import org.apache.commons.lang3.StringUtils; | |
| 12 | +import org.apache.http.HttpEntity; | |
| 13 | +import org.apache.http.client.methods.CloseableHttpResponse; | |
| 14 | +import org.apache.http.client.methods.HttpGet; | |
| 15 | +import org.apache.http.impl.client.CloseableHttpClient; | |
| 16 | +import org.apache.http.impl.client.HttpClients; | |
| 17 | +import org.slf4j.Logger; | |
| 18 | +import org.slf4j.LoggerFactory; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.stereotype.Component; | |
| 21 | + | |
| 22 | +import java.io.BufferedReader; | |
| 23 | +import java.io.InputStreamReader; | |
| 24 | +import java.util.ArrayList; | |
| 25 | +import java.util.List; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Created by panzhao on 2017/1/11. | |
| 29 | + */ | |
| 30 | +@Component | |
| 31 | +public class GpsDataLoaderThread extends Thread { | |
| 32 | + | |
| 33 | + Logger logger = LoggerFactory.getLogger(GpsDataLoaderThread.class); | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 构造函数 | |
| 37 | + */ | |
| 38 | + public GpsDataLoaderThread() { | |
| 39 | + url = ConfigUtil.get("http.gps.real.url"); | |
| 40 | + } | |
| 41 | + | |
| 42 | + // 网关数据接口地址 | |
| 43 | + private static String url; | |
| 44 | + | |
| 45 | + @Autowired | |
| 46 | + GpsRealData gpsRealData; | |
| 47 | + | |
| 48 | + @Autowired | |
| 49 | + GpsRealAnalyse gpsRealAnalyse; | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void run() { | |
| 53 | + try { | |
| 54 | + //如果正在恢复数据 | |
| 55 | + if (GpsDataRecovery.run) | |
| 56 | + return; | |
| 57 | + | |
| 58 | + load(); | |
| 59 | + } catch (Exception e) { | |
| 60 | + logger.error("", e); | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void load() throws Exception { | |
| 65 | + List<GpsEntity> list = null; | |
| 66 | + List<GpsEntity> updateList = new ArrayList<>(); | |
| 67 | + CloseableHttpClient httpClient = null; | |
| 68 | + CloseableHttpResponse response = null; | |
| 69 | + try { | |
| 70 | + httpClient = HttpClients.createDefault(); | |
| 71 | + HttpGet get = new HttpGet(url); | |
| 72 | + | |
| 73 | + response = httpClient.execute(get); | |
| 74 | + | |
| 75 | + HttpEntity entity = response.getEntity(); | |
| 76 | + if (null != entity) { | |
| 77 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 78 | + StringBuffer stringBuffer = new StringBuffer(); | |
| 79 | + String str = ""; | |
| 80 | + while ((str = br.readLine()) != null) | |
| 81 | + stringBuffer.append(str); | |
| 82 | + | |
| 83 | + JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); | |
| 84 | + | |
| 85 | + if (jsonObj != null) | |
| 86 | + list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); | |
| 87 | + | |
| 88 | + String nbbm; | |
| 89 | + GpsEntity old; | |
| 90 | + for (GpsEntity gps : list) { | |
| 91 | + //没有设备号 | |
| 92 | + if (StringUtils.isBlank(gps.getDeviceId())) | |
| 93 | + continue; | |
| 94 | + | |
| 95 | + old = gpsRealData.get(gps.getDeviceId()); | |
| 96 | + if (old != null && | |
| 97 | + old.getTimestamp() == gps.getTimestamp()) | |
| 98 | + continue; | |
| 99 | + | |
| 100 | + nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 101 | + if (StringUtils.isBlank(nbbm)) | |
| 102 | + gps.setIncomplete(true);//标记为异常数据 | |
| 103 | + else | |
| 104 | + gps.setNbbm(nbbm); | |
| 105 | + //有更新的点位 | |
| 106 | + updateList.add(gps); | |
| 107 | + } | |
| 108 | + //分析数据 | |
| 109 | + gpsRealAnalyse.analyse(updateList); | |
| 110 | + } else | |
| 111 | + logger.error("real gps result is null"); | |
| 112 | + } catch (Exception e) { | |
| 113 | + logger.error("", e); | |
| 114 | + } finally { | |
| 115 | + if (null != httpClient) | |
| 116 | + httpClient.close(); | |
| 117 | + if (null != response) | |
| 118 | + response.close(); | |
| 119 | + } | |
| 120 | + } | |
| 121 | +} | |
| 0 | 122 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/OfflineMonitorThread.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.thread; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 4 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | + | |
| 7 | +import java.util.Collection; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * GPS掉离线监控 | |
| 11 | + * Created by panzhao on 2017/1/11. | |
| 12 | + */ | |
| 13 | +public class OfflineMonitorThread extends Thread{ | |
| 14 | + | |
| 15 | + @Autowired | |
| 16 | + GpsRealData gpsRealData; | |
| 17 | + | |
| 18 | + //有任务时 掉线阈值 | |
| 19 | + private final static int LOSE_TIME = 1000 * 60 * 2; | |
| 20 | + | |
| 21 | + //无任务时 离线阈值 | |
| 22 | + private final static int OFFLINE_TIME = 1000 * 60 * 10; | |
| 23 | + | |
| 24 | + @Override | |
| 25 | + 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")) | |
| 42 | + } | |
| 43 | + } | |
| 44 | +} | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| 1 | 1 | package com.bsth.service.directive; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | -import java.util.Collection; | |
| 5 | -import java.util.Collections; | |
| 6 | -import java.util.Comparator; | |
| 7 | -import java.util.Date; | |
| 8 | -import java.util.HashMap; | |
| 9 | -import java.util.List; | |
| 10 | -import java.util.Map; | |
| 11 | - | |
| 12 | -import org.apache.commons.lang3.StringUtils; | |
| 13 | -import org.joda.time.format.DateTimeFormat; | |
| 14 | -import org.joda.time.format.DateTimeFormatter; | |
| 15 | -import org.slf4j.Logger; | |
| 16 | -import org.slf4j.LoggerFactory; | |
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | -import org.springframework.stereotype.Service; | |
| 19 | - | |
| 20 | 3 | import com.alibaba.fastjson.JSON; |
| 21 | 4 | import com.alibaba.fastjson.JSONObject; |
| 22 | 5 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -24,15 +7,11 @@ import com.bsth.data.BasicData; |
| 24 | 7 | import com.bsth.data.directive.DayOfDirectives; |
| 25 | 8 | import com.bsth.data.directive.DirectiveCreator; |
| 26 | 9 | import com.bsth.data.directive.GatewayHttpUtils; |
| 27 | -import com.bsth.data.gpsdata.GpsRealData; | |
| 28 | 10 | import com.bsth.data.gpsdata.GpsEntity; |
| 11 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 29 | 12 | import com.bsth.data.pilot80.PilotReport; |
| 30 | 13 | import com.bsth.data.schedule.DayOfSchedule; |
| 31 | -import com.bsth.entity.directive.D60; | |
| 32 | -import com.bsth.entity.directive.D64; | |
| 33 | -import com.bsth.entity.directive.D80; | |
| 34 | -import com.bsth.entity.directive.DC0_A3; | |
| 35 | -import com.bsth.entity.directive.Directive; | |
| 14 | +import com.bsth.entity.directive.*; | |
| 36 | 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 37 | 16 | import com.bsth.entity.sys.SysUser; |
| 38 | 17 | import com.bsth.repository.directive.D60Repository; |
| ... | ... | @@ -44,6 +23,15 @@ import com.bsth.websocket.handler.RealControlSocketHandler; |
| 44 | 23 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 45 | 24 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 46 | 25 | import com.google.common.base.Splitter; |
| 26 | +import org.apache.commons.lang3.StringUtils; | |
| 27 | +import org.joda.time.format.DateTimeFormat; | |
| 28 | +import org.joda.time.format.DateTimeFormatter; | |
| 29 | +import org.slf4j.Logger; | |
| 30 | +import org.slf4j.LoggerFactory; | |
| 31 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 32 | +import org.springframework.stereotype.Service; | |
| 33 | + | |
| 34 | +import java.util.*; | |
| 47 | 35 | |
| 48 | 36 | @Service |
| 49 | 37 | public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService { |
| ... | ... | @@ -265,7 +253,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 265 | 253 | // 根据当前GPS确定 上下行和营运状态 |
| 266 | 254 | Integer upDown = null, state = null; |
| 267 | 255 | if (null == sch) { |
| 268 | - GpsEntity gpsData = gpsRealDataBuffer.findByDeviceId(deviceId); | |
| 256 | + GpsEntity gpsData = gpsRealDataBuffer.get(deviceId); | |
| 269 | 257 | if (null == gpsData) { |
| 270 | 258 | /* |
| 271 | 259 | * 短语指令不会变更设备状态,所以在没有gps状态对照的情况下可以下发 | ... | ... |
src/main/resources/static/real_control_v2/css/ct_table.css
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | |
| 28 | 28 | .ct_table>.ct_table_head dl dt { |
| 29 | 29 | font-weight: normal; |
| 30 | + font-size: 12px; | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | .ct_table>.ct_table_body { |
| ... | ... | @@ -65,7 +66,7 @@ |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | .ct_table_wrap { |
| 68 | - border: 1px solid #e6e6e6; | |
| 69 | + /*border: 1px solid #e6e6e6;*/ | |
| 69 | 70 | border-left: 0; |
| 70 | 71 | } |
| 71 | 72 | ... | ... |
src/main/resources/static/real_control_v2/css/home.css
| 1 | +.ct_table.home-gps-table>.ct_table_head dl dt{ | |
| 2 | + font-size: 12px; | |
| 3 | +} | |
| 1 | 4 | #main-tab-content>.home-panel, #main-tab-content>.home-panel>#home-main-content>li { |
| 2 | 5 | height: 100%; |
| 3 | 6 | } |
| ... | ... | @@ -121,19 +124,16 @@ |
| 121 | 124 | |
| 122 | 125 | .data-wrap .data-title span.data-title-text { |
| 123 | 126 | display: inline-block; |
| 124 | - color: white; | |
| 125 | 127 | padding: 0 8px; |
| 126 | - border-radius: 0 8px 8px 0; | |
| 128 | + font-weight: 600; | |
| 127 | 129 | } |
| 128 | 130 | |
| 129 | 131 | .data-wrap.up .data-title span.data-title-text { |
| 130 | - background: #5e96d2; | |
| 131 | - /*background-image: -webkit-linear-gradient(top, #5e96d2, #5788bb);*/ | |
| 132 | + color: #3e50b3; | |
| 132 | 133 | } |
| 133 | 134 | |
| 134 | 135 | .data-wrap.down .data-title span.data-title-text { |
| 135 | - background: #d66868; | |
| 136 | - /*background-image: -webkit-linear-gradient(top, #d66868, #bf6363);*/ | |
| 136 | + color: #c94f21; | |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | .data-wrap .data-body { |
| ... | ... | @@ -278,4 +278,24 @@ span.signal-state-speed-limit{ |
| 278 | 278 | color: #4dc24d; |
| 279 | 279 | font-size: 14px; |
| 280 | 280 | margin-left: 5px; |
| 281 | +} | |
| 282 | + | |
| 283 | +.home-rb-explain-icon{ | |
| 284 | + position: absolute; | |
| 285 | + right: 25px; | |
| 286 | + top: -5px; | |
| 287 | +} | |
| 288 | + | |
| 289 | +.qtip.qtip-home-rb{ | |
| 290 | + max-width: 380px; | |
| 291 | + width: 300px; | |
| 292 | +} | |
| 293 | + | |
| 294 | +.qtip-home-rb .uk-list{ | |
| 295 | + font-size: 13px; | |
| 296 | + margin-bottom: 0; | |
| 297 | +} | |
| 298 | + | |
| 299 | +.qtip-home-rb .uk-list li{ | |
| 300 | + padding: 4px 2px; | |
| 281 | 301 | } |
| 282 | 302 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/css/main.css
| ... | ... | @@ -121,9 +121,10 @@ svg.line-chart { |
| 121 | 121 | |
| 122 | 122 | svg.line-chart circle.station_circle { |
| 123 | 123 | fill: #5e96d2; |
| 124 | - r: 6; | |
| 124 | + r: 5.5; | |
| 125 | 125 | stroke: rgb(253, 253, 253); |
| 126 | 126 | stroke-width: 3; |
| 127 | + Pointer-events: none; | |
| 127 | 128 | } |
| 128 | 129 | |
| 129 | 130 | svg.line-chart circle.station_circle.down { |
| ... | ... | @@ -131,8 +132,9 @@ svg.line-chart circle.station_circle.down { |
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | svg.line-chart path.station_link { |
| 134 | - stroke-width: 5.4px; | |
| 135 | + stroke-width: 3.5px; | |
| 135 | 136 | stroke: #5E96D2; |
| 137 | + Pointer-events: none; | |
| 136 | 138 | } |
| 137 | 139 | |
| 138 | 140 | svg.line-chart path.station_link.down { |
| ... | ... | @@ -149,6 +151,7 @@ svg.line-chart text.station_text { |
| 149 | 151 | fill: #3e3e3e; |
| 150 | 152 | letter-spacing: -.2px; |
| 151 | 153 | text-shadow: 0 0 2px #dadada; |
| 154 | + Pointer-events: none; | |
| 152 | 155 | } |
| 153 | 156 | |
| 154 | 157 | svg.line-chart text.station_text.up { |
| ... | ... | @@ -188,7 +191,7 @@ svg.line-chart g.gps-wrap>rect { |
| 188 | 191 | } |
| 189 | 192 | |
| 190 | 193 | svg.line-chart g.gps-wrap>rect[updown="0"] { |
| 191 | - stroke: rgb(62, 80, 179); | |
| 194 | + /*stroke: rgb(62, 80, 179);*/ | |
| 192 | 195 | fill: rgb(62, 80, 179); |
| 193 | 196 | } |
| 194 | 197 | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/layout.html
| ... | ... | @@ -13,6 +13,9 @@ |
| 13 | 13 | <li {{if i==0}}class="uk-active"{{/if}}><a> {{t}}</a></li> |
| 14 | 14 | {{/each}} |
| 15 | 15 | </ul> |
| 16 | + <div class="home-rb-explain-icon uk-icon-hover"> | |
| 17 | + <i class="uk-icon-question-circle"></i> | |
| 18 | + </div> | |
| 16 | 19 | </div> |
| 17 | 20 | </script> |
| 18 | 21 | |
| ... | ... | @@ -32,4 +35,12 @@ |
| 32 | 35 | {{/each}} |
| 33 | 36 | </script> |
| 34 | 37 | |
| 38 | + <script id="home-rb-explain-help-temp" type="text/html"> | |
| 39 | + <ul class="uk-list"> | |
| 40 | + <li>场外车辆,距离线路超过100米即为越界</li> | |
| 41 | + <li>线路标准信息限速字段为空,则默认限速60</li> | |
| 42 | + <li>有任务时,连续2分钟无信号即为掉线</li> | |
| 43 | + <li>无任务时,连续10分钟无信号则已离线</li> | |
| 44 | + </ul> | |
| 45 | + </script> | |
| 35 | 46 | </div> | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/line_panel.html
| ... | ... | @@ -32,9 +32,9 @@ |
| 32 | 32 | <dd> |
| 33 | 33 | {{if abnormalStatus != null}} |
| 34 | 34 | {{if abnormalStatus == 'outBounds'}} |
| 35 | - <span class="signal-state-outbounds">越界</span> | |
| 35 | + <span class="signal-state-outbounds">越界</span> | |
| 36 | 36 | {{else if abnormalStatus == 'overspeed'}} |
| 37 | - <span class="signal-state-speed-limit">超速</span> | |
| 37 | + <span class="signal-state-speed-limit">超速</span> | |
| 38 | 38 | {{/if}} |
| 39 | 39 | {{/if}} |
| 40 | 40 | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
src/main/resources/static/real_control_v2/js/data/data_basic.js
| ... | ... | @@ -161,9 +161,9 @@ var gb_data_basic = (function () { |
| 161 | 161 | //是否是环线 |
| 162 | 162 | isLoopLine: function (lineCode) { |
| 163 | 163 | var data = gb_common.groupBy(stationRoutes[lineCode], 'directions'); |
| 164 | - //如果上行起终点名称相同,并且距离50米内 | |
| 164 | + //如果上行起终点名称相同,并且距离50米内 并且下行只有2个站点 | |
| 165 | 165 | var len = data[0].length; |
| 166 | - if(len > 0){ | |
| 166 | + if(len > 0 && data[1].length == 2){ | |
| 167 | 167 | var first = data[0][0], |
| 168 | 168 | end = data[0][len - 1]; |
| 169 | 169 | ... | ... |
src/main/resources/static/real_control_v2/js/home/context_menu.js
| ... | ... | @@ -37,7 +37,7 @@ var gb_home_context_menu = (function() { |
| 37 | 37 | else |
| 38 | 38 | notify_err('发送失败,原因参考【指令下发记录】'); |
| 39 | 39 | }); |
| 40 | - } | |
| 40 | + }; | |
| 41 | 41 | |
| 42 | 42 | // send phrase |
| 43 | 43 | var sendPhrase = function() { |
| ... | ... | @@ -59,7 +59,7 @@ var gb_home_context_menu = (function() { |
| 59 | 59 | notify_err_form('发送短语消息失败', f); |
| 60 | 60 | }); |
| 61 | 61 | }); |
| 62 | - } | |
| 62 | + }; | |
| 63 | 63 | |
| 64 | 64 | //send phrase multiple |
| 65 | 65 | var sendPhraseMulti = function() { |
| ... | ... | @@ -100,7 +100,7 @@ var gb_home_context_menu = (function() { |
| 100 | 100 | showMultiSendModal(nbbmArr, data.text); |
| 101 | 101 | }, 200); |
| 102 | 102 | }); |
| 103 | - } | |
| 103 | + }; | |
| 104 | 104 | |
| 105 | 105 | // multi send animation modal |
| 106 | 106 | var showMultiSendModal = function(nbbmArray, text) { |
| ... | ... | @@ -136,7 +136,7 @@ var gb_home_context_menu = (function() { |
| 136 | 136 | f(); |
| 137 | 137 | }); |
| 138 | 138 | }(); |
| 139 | - } | |
| 139 | + }; | |
| 140 | 140 | |
| 141 | 141 | var state_up_0 = function() { |
| 142 | 142 | changeUpDown(active_car, 0); |
| ... | ... | @@ -182,7 +182,7 @@ var gb_home_context_menu = (function() { |
| 182 | 182 | |
| 183 | 183 | var C0_A3 = function(){ |
| 184 | 184 | open_modal('/real_control_v2/fragments/home/c0_a3.html', {}, {center: false, bgclose: false}); |
| 185 | - } | |
| 185 | + }; | |
| 186 | 186 | |
| 187 | 187 | var callbackHandler = { |
| 188 | 188 | send_phrase: sendPhrase, | ... | ... |
src/main/resources/static/real_control_v2/js/home/layout.js
| ... | ... | @@ -34,10 +34,44 @@ var gb_home_layout = (function () { |
| 34 | 34 | return false; |
| 35 | 35 | }); |
| 36 | 36 | |
| 37 | + initRbDxplain(); | |
| 37 | 38 | cb && cb(); |
| 38 | 39 | }); |
| 39 | 40 | }; |
| 40 | 41 | |
| 42 | + //右下角说明icon | |
| 43 | + function initRbDxplain() { | |
| 44 | + $(document).on('mouseenter', '.home-rb-explain-icon', function() { | |
| 45 | + $(this).qtip({ | |
| 46 | + show: { | |
| 47 | + ready: true, | |
| 48 | + delay: 0 | |
| 49 | + }, | |
| 50 | + content: { | |
| 51 | + text: function() { | |
| 52 | + return temps['home-rb-explain-help-temp']({}); | |
| 53 | + } | |
| 54 | + }, | |
| 55 | + position: { | |
| 56 | + viewport: $(window) | |
| 57 | + }, | |
| 58 | + style: { | |
| 59 | + classes: 'qtip-jtools qtip-home-rb' | |
| 60 | + }, | |
| 61 | + hide: { | |
| 62 | + fixed: true, | |
| 63 | + delay: 300 | |
| 64 | + }, | |
| 65 | + events: { | |
| 66 | + hidden: function(event, api) { | |
| 67 | + //destroy dom | |
| 68 | + $(this).qtip('destroy', true); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + }); | |
| 72 | + }); | |
| 73 | + } | |
| 74 | + | |
| 41 | 75 | //click svg edit icon |
| 42 | 76 | $(document).on('click', '.home-svg-edit-icon', function () { |
| 43 | 77 | open_modal('/real_control_v2/fragments/home/svg_edit.html', {lineCode: $(this).data('line-code')}); | ... | ... |
src/main/resources/static/real_control_v2/js/utils/ct_table.js
| 1 | 1 | var gb_ct_table = (function() { |
| 2 | + var webkit=true; | |
| 3 | + if(typeof $("body")[0].style.WebkitAnimation=="undefined") | |
| 4 | + webkit = false; | |
| 5 | + | |
| 2 | 6 | function fixedHead($wrap) { |
| 7 | + if(!webkit) | |
| 8 | + return; | |
| 3 | 9 | |
| 4 | 10 | $wrap.off('scroll').on('scroll', function() { |
| 5 | 11 | var top = $(this).scrollTop(); | ... | ... |
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
| ... | ... | @@ -227,11 +227,10 @@ var gb_svg_chart = (function () { |
| 227 | 227 | var x; |
| 228 | 228 | e.transition().attr('x', function (d) { |
| 229 | 229 | x = gx(d, svg); |
| 230 | - //找不到停靠点,直接隐藏 | |
| 231 | 230 | if(x == -100) |
| 232 | - $(this).hide(); | |
| 231 | + $(this).css('transition-duration', 0).hide(); | |
| 233 | 232 | else |
| 234 | - $(this).show(); | |
| 233 | + $(this).show();//找不到停靠点,直接隐藏 | |
| 235 | 234 | return x; |
| 236 | 235 | }) |
| 237 | 236 | .attr('y', function (d) { |
| ... | ... | @@ -269,7 +268,6 @@ var gb_svg_chart = (function () { |
| 269 | 268 | //聚合gps |
| 270 | 269 | marker_clusterer(this, lineCode); |
| 271 | 270 | }); |
| 272 | - | |
| 273 | 271 | }; |
| 274 | 272 | |
| 275 | 273 | var draw_gps = function (svg, data) { |
| ... | ... | @@ -290,7 +288,6 @@ var gb_svg_chart = (function () { |
| 290 | 288 | var marker_clusterer = function (svg, lineCode) { |
| 291 | 289 | //debugger |
| 292 | 290 | var gpsArr, idxMapp = line_gps_index[lineCode]; |
| 293 | - //svgs = $('.line-chart[data-code=' + lineCode + ']'); | |
| 294 | 291 | for (var stopNo in idxMapp) { |
| 295 | 292 | gpsArr = gb_common.get_keys(idxMapp[stopNo]); |
| 296 | 293 | //remove old merger point | ... | ... |