Commit cc6987393fb941165de443020fa257b50856b77c

Authored by 徐烜
2 parents 1f790a99 67ac8a6e

Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong

src/main/java/com/bsth/entity/report/RepairReport.java
@@ -46,6 +46,8 @@ public class RepairReport { @@ -46,6 +46,8 @@ public class RepairReport {
46 // 格式化的时间字符串 46 // 格式化的时间字符串
47 @Transient 47 @Transient
48 private String reportStateStr; 48 private String reportStateStr;
  49 + // 上报方式 0自动 1主动
  50 + private int reportMode;
49 51
50 public Integer getId() { 52 public Integer getId() {
51 return id; 53 return id;
@@ -150,4 +152,12 @@ public class RepairReport { @@ -150,4 +152,12 @@ public class RepairReport {
150 public void setReportStateStr(String reportStateStr) { 152 public void setReportStateStr(String reportStateStr) {
151 this.reportStateStr = reportStateStr; 153 this.reportStateStr = reportStateStr;
152 } 154 }
  155 +
  156 + public int getReportMode() {
  157 + return reportMode;
  158 + }
  159 +
  160 + public void setReportMode(int reportMode) {
  161 + this.reportMode = reportMode;
  162 + }
153 } 163 }
src/main/java/com/bsth/repository/RepairReportRepository.java
@@ -31,4 +31,7 @@ public interface RepairReportRepository extends BaseRepository<RepairReport, Int @@ -31,4 +31,7 @@ public interface RepairReportRepository extends BaseRepository<RepairReport, Int
31 + " RepairReport r where r.lineId = ?1 and r.reportDate between ?2 and " 31 + " RepairReport r where r.lineId = ?1 and r.reportDate between ?2 and "
32 + "?3 and r.incode like ?4%") 32 + "?3 and r.incode like ?4%")
33 List<RepairReport> repairReportList(String lineId,Date start,Date end,String incode); 33 List<RepairReport> repairReportList(String lineId,Date start,Date end,String incode);
  34 +
  35 + @Query(value="select count(r) from RepairReport r where r.schId = ?1 and r.reportMode = ?2")
  36 + int repairReportBySch(Long schId, int reportMode);
34 } 37 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
1 package com.bsth.service.gps; 1 package com.bsth.service.gps;
2 2
  3 +import java.io.IOException;
  4 +import java.io.OutputStream;
  5 +import java.io.UnsupportedEncodingException;
  6 +import java.lang.reflect.Field;
  7 +import java.net.URLEncoder;
  8 +import java.sql.Connection;
  9 +import java.sql.PreparedStatement;
  10 +import java.sql.ResultSet;
  11 +import java.sql.SQLException;
  12 +import java.text.DecimalFormat;
  13 +import java.text.ParseException;
  14 +import java.text.SimpleDateFormat;
  15 +import java.util.ArrayList;
  16 +import java.util.Calendar;
  17 +import java.util.Collections;
  18 +import java.util.Comparator;
  19 +import java.util.Date;
  20 +import java.util.HashMap;
  21 +import java.util.HashSet;
  22 +import java.util.Iterator;
  23 +import java.util.LinkedList;
  24 +import java.util.List;
  25 +import java.util.Map;
  26 +import java.util.Set;
  27 +
  28 +import javax.servlet.http.HttpServletResponse;
  29 +
  30 +import org.apache.commons.lang3.StringUtils;
  31 +import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  32 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  33 +import org.apache.poi.ss.usermodel.CellStyle;
  34 +import org.apache.poi.ss.usermodel.Row;
  35 +import org.apache.poi.ss.usermodel.Sheet;
  36 +import org.apache.poi.ss.usermodel.Workbook;
  37 +import org.joda.time.format.DateTimeFormat;
  38 +import org.joda.time.format.DateTimeFormatter;
  39 +import org.slf4j.Logger;
  40 +import org.slf4j.LoggerFactory;
  41 +import org.springframework.beans.factory.annotation.Autowired;
  42 +import org.springframework.dao.DataAccessException;
  43 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  44 +import org.springframework.jdbc.core.JdbcTemplate;
  45 +import org.springframework.stereotype.Service;
  46 +
3 import com.bsth.common.ResponseCode; 47 import com.bsth.common.ResponseCode;
4 import com.bsth.data.BasicData; 48 import com.bsth.data.BasicData;
5 import com.bsth.data.forecast.entity.ArrivalEntity; 49 import com.bsth.data.forecast.entity.ArrivalEntity;
@@ -12,50 +56,28 @@ import com.bsth.data.pilot80.PilotReport; @@ -12,50 +56,28 @@ import com.bsth.data.pilot80.PilotReport;
12 import com.bsth.data.safe_driv.SafeDriv; 56 import com.bsth.data.safe_driv.SafeDriv;
13 import com.bsth.data.safe_driv.SafeDrivCenter; 57 import com.bsth.data.safe_driv.SafeDrivCenter;
14 import com.bsth.data.schedule.DayOfSchedule; 58 import com.bsth.data.schedule.DayOfSchedule;
15 -import com.bsth.entity.Line;  
16 import com.bsth.entity.LineVersions; 59 import com.bsth.entity.LineVersions;
  60 +import com.bsth.entity.LsSectionRoute;
  61 +import com.bsth.entity.LsStationRoute;
17 import com.bsth.entity.directive.D80; 62 import com.bsth.entity.directive.D80;
18 import com.bsth.entity.realcontrol.ScheduleRealInfo; 63 import com.bsth.entity.realcontrol.ScheduleRealInfo;
19 import com.bsth.repository.CarParkRepository; 64 import com.bsth.repository.CarParkRepository;
20 import com.bsth.repository.LineRepository; 65 import com.bsth.repository.LineRepository;
21 import com.bsth.repository.LineVersionsRepository; 66 import com.bsth.repository.LineVersionsRepository;
  67 +import com.bsth.repository.LsSectionRouteRepository;
  68 +import com.bsth.repository.LsStationRouteRepository;
22 import com.bsth.repository.StationRepository; 69 import com.bsth.repository.StationRepository;
23 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 70 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
24 -import com.bsth.service.gps.entity.*; 71 +import com.bsth.service.gps.entity.DeviceChange;
  72 +import com.bsth.service.gps.entity.GpsOutbound_DTO;
  73 +import com.bsth.service.gps.entity.GpsSpeed;
  74 +import com.bsth.service.gps.entity.GpsSpeed_DTO;
  75 +import com.bsth.service.gps.entity.HistoryGps_DTO;
  76 +import com.bsth.service.gps.entity.HistoryGps_DTOV3;
  77 +import com.bsth.service.gps.entity.Road_DTO;
25 import com.bsth.util.TransGPS; 78 import com.bsth.util.TransGPS;
26 import com.bsth.util.TransGPS.Location; 79 import com.bsth.util.TransGPS.Location;
27 import com.bsth.util.db.DBUtils_MS; 80 import com.bsth.util.db.DBUtils_MS;
28 -import org.apache.commons.lang3.StringUtils;  
29 -import org.apache.poi.hssf.usermodel.HSSFCellStyle;  
30 -import org.apache.poi.hssf.usermodel.HSSFWorkbook;  
31 -import org.apache.poi.ss.usermodel.CellStyle;  
32 -import org.apache.poi.ss.usermodel.Row;  
33 -import org.apache.poi.ss.usermodel.Sheet;  
34 -import org.apache.poi.ss.usermodel.Workbook;  
35 -import org.joda.time.format.DateTimeFormat;  
36 -import org.joda.time.format.DateTimeFormatter;  
37 -import org.slf4j.Logger;  
38 -import org.slf4j.LoggerFactory;  
39 -import org.springframework.beans.factory.annotation.Autowired;  
40 -import org.springframework.dao.DataAccessException;  
41 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
42 -import org.springframework.jdbc.core.JdbcTemplate;  
43 -import org.springframework.stereotype.Service;  
44 -  
45 -import javax.servlet.http.HttpServletResponse;  
46 -import java.io.IOException;  
47 -import java.io.OutputStream;  
48 -import java.io.UnsupportedEncodingException;  
49 -import java.lang.reflect.Field;  
50 -import java.net.URLEncoder;  
51 -import java.sql.Connection;  
52 -import java.sql.PreparedStatement;  
53 -import java.sql.ResultSet;  
54 -import java.sql.SQLException;  
55 -import java.text.DecimalFormat;  
56 -import java.text.ParseException;  
57 -import java.text.SimpleDateFormat;  
58 -import java.util.*;  
59 81
60 @Service 82 @Service
61 public class GpsServiceImpl implements GpsService { 83 public class GpsServiceImpl implements GpsService {
@@ -91,6 +113,12 @@ public class GpsServiceImpl implements GpsService { @@ -91,6 +113,12 @@ public class GpsServiceImpl implements GpsService {
91 113
92 @Autowired 114 @Autowired
93 LineRepository lineRepository; 115 LineRepository lineRepository;
  116 +
  117 + @Autowired
  118 + LsStationRouteRepository lsStationRouteRepository;
  119 +
  120 + @Autowired
  121 + LsSectionRouteRepository lsSectionRouteRepository;
94 122
95 // 历史gps查询 123 // 历史gps查询
96 @Override 124 @Override
@@ -239,66 +267,76 @@ public class GpsServiceImpl implements GpsService { @@ -239,66 +267,76 @@ public class GpsServiceImpl implements GpsService {
239 int inOutStop; 267 int inOutStop;
240 long serviceState; 268 long serviceState;
241 ArrivalEntity arrival; 269 ArrivalEntity arrival;
242 - Set<String> lineSet=new HashSet(); 270 + Set<Integer> lineSet=new HashSet<Integer>();
243 List<Map<String,Object>> lineSwitch=new ArrayList<>(); 271 List<Map<String,Object>> lineSwitch=new ArrayList<>();
244 272
245 - List<Map> gpsNotValidList=new ArrayList();  
246 - List<Map> versionSwitchList=new ArrayList();  
247 - List<Map> gpsEqualsZeroList=new ArrayList();  
248 - Map<String,Object> zeroMap=null;  
249 - Map<String,Object> gpsNotValidMap=null;  
250 - boolean isFirstNotValid=true;  
251 - boolean isFirstLonlatZero=true; 273 + List<Map<String, Object>> gpsNotValidList=new ArrayList<>();
  274 + List<Map<String, Object>> gpsEqualsZeroList=new ArrayList<>();
252 Map<String, Object> map = null; 275 Map<String, Object> map = null;
253 - int index=0;  
254 - for(Map<String, Object> rs : dataList){  
255 - if (index< dataList.size()-1&&!map_get_str( rs,"LINE_ID").equals(map_get_str( dataList.get(index+1),"LINE_ID"))){  
256 - Line cLine =lineRepository.findOne(Integer.valueOf(map_get_str( rs,"LINE_ID")));  
257 - Line nextLine =lineRepository.findOne(Integer.valueOf(map_get_str( dataList.get(index+1),"LINE_ID")));  
258 - if (cLine!=null&&nextLine!=null){  
259 - Map<String,Object> LSmap=new HashMap<>();  
260 - String name=cLine.getName();  
261 - String NextName=nextLine.getName();  
262 - LSmap.put("abnormalType","linesSwitch");  
263 - LSmap.put("line_line",name+"-->"+NextName);  
264 - LSmap.put("st",map_get_long(rs, "TS"));  
265 - LSmap.put("et",index== dataList.size()-1?map_get_long(rs, "TS"):map_get_long( dataList.get(index+1), "TS"));  
266 - lineSwitch.add(LSmap);  
267 - }  
268 - } 276 + int oldLineId = -1, oldGpsValid = -1, oldLonlat = -1;
  277 +
  278 + // 默认加入一个线路切换信息
  279 + Map<String, Object> fls = new HashMap<String, Object>();
  280 + fls.put("abnormalType", "normal");
  281 + fls.put("st", "-1");
  282 + lineSwitch.add(fls);
  283 +
  284 + // 默认加入一个GPS无效异常信息
  285 + Map<String, Object> fgv = new HashMap<String, Object>();
  286 + fgv.put("abnormalType", "normal");
  287 + fgv.put("st", "-1");
  288 + gpsNotValidList.add(fgv);
  289 +
  290 + // 默认加入一个经纬度为零异常信息
  291 + Map<String, Object> fgez = new HashMap<String, Object>();
  292 + fgez.put("abnormalType", "normal");
  293 + fgez.put("st", "-1");
  294 + gpsEqualsZeroList.add(fgez);
  295 +
  296 + for(Map<String, Object> rs : dataList) {
  297 + Object lineId = rs.get("LINE_ID");
  298 + // 线路ID发生变化时补全线路切换信息 并新加入一个
  299 + if (oldLineId != (Integer)lineId) {
  300 + String lineName = BasicData.lineCode2NameMap.get(lineId.toString());
  301 + lineSwitch.get(lineSwitch.size() - 1).put("line2", lineName);
  302 + lineSwitch.get(lineSwitch.size() - 1).put("et", rs.get("TS"));
  303 +
  304 + Map<String, Object> ls = new HashMap<String, Object>();
  305 + ls.put("abnormalType", "lineSwitch");
  306 + ls.put("line1", lineName);
  307 + lineSwitch.add(ls);
  308 +
  309 + lineSet.add((Integer)lineId);
  310 + oldLineId = (Integer)lineId;
  311 + }
269 serviceState = map_get_long(rs, "SERVICE_STATE"); 312 serviceState = map_get_long(rs, "SERVICE_STATE");
270 - if(getGpsValid(serviceState) == 1){  
271 - if (isFirstNotValid) {  
272 - gpsNotValidMap=new HashMap<>();  
273 - gpsNotValidMap.put("abnormalType","gpsNotValid");  
274 - gpsNotValidMap.put("st",map_get_long(rs,"TS"));  
275 - isFirstNotValid=false;  
276 - }  
277 - if (index== dataList.size()-1||index< dataList.size()-1&&getGpsValid(map_get_long(dataList.get(index+1), "SERVICE_STATE"))!=1){  
278 - gpsNotValidMap.put("et",map_get_long(rs,"TS"));  
279 - gpsNotValidList.add(gpsNotValidMap);  
280 - isFirstNotValid=true;  
281 - gpsNotValidMap=null;  
282 - } 313 + // GPS状态发生变化时补全信息 并新加入一个
  314 + if (getGpsValid(serviceState) != oldGpsValid) {
  315 + gpsNotValidList.get(gpsNotValidList.size() - 1).put("et", rs.get("TS"));
  316 +
  317 + Map<String, Object> gv = new HashMap<String, Object>();
  318 + gv.put("abnormalType", getGpsValid(serviceState) == 0 ? "normal" : "gpsNotValid");
  319 + gv.put("st", rs.get("TS"));
  320 + gpsNotValidList.add(gv);
  321 +
  322 + oldGpsValid = getGpsValid(serviceState);
283 } 323 }
284 - //continue;  
285 324
286 map = new HashMap<>(); 325 map = new HashMap<>();
287 lon = map_get_float(rs, "LON"); 326 lon = map_get_float(rs, "LON");
288 lat = map_get_float(rs, "LAT"); 327 lat = map_get_float(rs, "LAT");
289 - if (lon==0||lat==0){  
290 - if (isFirstLonlatZero){  
291 - zeroMap=new HashMap<>();  
292 - zeroMap.put("abnormalType","gpsZero");  
293 - zeroMap.put("st",map_get_long(rs,"TS"));  
294 - isFirstLonlatZero=false;  
295 - }  
296 - if (index<dataList.size()-1&&(map_get_float(dataList.get(index+1),"LON")!=0&&map_get_float(dataList.get(index+1),"LAT")!=0)){  
297 - zeroMap.put("et",map_get_long(rs,"TS"));  
298 - gpsEqualsZeroList.add(zeroMap);  
299 - isFirstLonlatZero=true;  
300 - } 328 + // 经纬度为零
  329 + if ((lon == 0 || lat == 0 ? 1 : 0) != oldLonlat){
  330 + gpsEqualsZeroList.get(gpsEqualsZeroList.size() - 1).put("et", rs.get("TS"));
  331 +
  332 + Map<String, Object> gez = new HashMap<String, Object>();
  333 + gez.put("abnormalType", (lon == 0 || lat == 0 ? 1 : 0) == 0 ? "normal" : "gpsZero");
  334 + gez.put("st", rs.get("TS"));
  335 + gpsEqualsZeroList.add(gez);
  336 +
  337 + oldLonlat = (lon == 0 || lat == 0 ? 1 : 0);
301 } 338 }
  339 +
302 // 高德坐标 340 // 高德坐标
303 gdLoc = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(lon, lat)); 341 gdLoc = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(lon, lat));
304 map.put("gcj_lon", gdLoc.getLng()); 342 map.put("gcj_lon", gdLoc.getLng());
@@ -319,7 +357,7 @@ public class GpsServiceImpl implements GpsService { @@ -319,7 +357,7 @@ public class GpsServiceImpl implements GpsService {
319 357
320 map.put("lineId", map_get_str(rs, "LINE_ID")); 358 map.put("lineId", map_get_str(rs, "LINE_ID"));
321 map.put("speed", map_get_float(rs,"SPEED_GPS")); 359 map.put("speed", map_get_float(rs,"SPEED_GPS"));
322 - lineSet.add(map_get_str(rs, "LINE_ID")); 360 +
323 inOutStop = Integer.parseInt(rs.get("INOUT_STOP").toString()); 361 inOutStop = Integer.parseInt(rs.get("INOUT_STOP").toString());
324 map.put("inout_stop", inOutStop); 362 map.put("inout_stop", inOutStop);
325 363
@@ -336,52 +374,93 @@ public class GpsServiceImpl implements GpsService { @@ -336,52 +374,93 @@ public class GpsServiceImpl implements GpsService {
336 //路段编码 374 //路段编码
337 map.put("section_code", map_get_str(rs,"SECTION_CODE")); 375 map.put("section_code", map_get_str(rs,"SECTION_CODE"));
338 list.add(map); 376 list.add(map);
339 - index++; 377 + }
  378 + if (dataList.size() > 0) {
  379 + Map<String, Object> rs = dataList.get(dataList.size() - 1);
  380 + gpsNotValidList.get(gpsNotValidList.size() - 1).put("et", rs.get("TS"));
  381 + gpsEqualsZeroList.get(gpsEqualsZeroList.size() - 1).put("et", rs.get("TS"));
  382 + }
  383 +
  384 + for (int i = lineSwitch.size() - 1;i > -1;i--) {
  385 + Map<String, Object> ls = lineSwitch.get(i);
  386 + if ("normal".equals(ls.get("abnormalType")) || ls.get("et") == null) {
  387 + lineSwitch.remove(i);
  388 + }
  389 + }
  390 +
  391 + for (int i = gpsNotValidList.size() - 1;i > -1;i--) {
  392 + Map<String, Object> gnv = gpsNotValidList.get(i);
  393 + if ("normal".equals(gnv.get("abnormalType"))) {
  394 + gpsNotValidList.remove(i);
  395 + }
  396 + }
  397 +
  398 + for (int i = gpsEqualsZeroList.size() - 1;i > -1;i--) {
  399 + Map<String, Object> gez = gpsEqualsZeroList.get(i);
  400 + if ("normal".equals(gez.get("abnormalType"))) {
  401 + gpsEqualsZeroList.remove(i);
  402 + }
340 } 403 }
341 404
342 - if (lineSet.size()>0){ 405 + if (lineSet.size() > 0){
343 List<Map<String,Object>> vlist=new ArrayList<>(); 406 List<Map<String,Object>> vlist=new ArrayList<>();
344 - for (String s : lineSet) {  
345 - int lineId=Integer.parseInt(s);  
346 - List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId);  
347 - Map<String,Object> vMap;  
348 - Long qt=0L;  
349 - if (lvs!=null&&!lvs.isEmpty()){  
350 - for (LineVersions lv : lvs) {  
351 - vMap=new HashMap();  
352 - Long sd=lv.getStartDate().getTime();  
353 - Long ed=lv.getEndDate().getTime();  
354 - if (sd<st&&et<ed){  
355 - vMap.put("line",s);  
356 - vMap.put("version",lv.getVersions());  
357 - vMap.put("vtime","all");  
358 - }else if(sd<st&&et>ed&&st<ed){  
359 - vMap.put("line",s);  
360 - vMap.put("version",lv.getVersions());  
361 - vMap.put("endTime",lv.getEndDate().getTime());  
362 - vMap.put("abnormalType","versionSwitch");  
363 - vMap.put("startTime",st);  
364 - vMap.put("st",lv.getEndDate().getTime());  
365 - qt=lv.getEndDate().getTime();  
366 - }else if(st<sd&&et<ed&&sd<et){  
367 - vMap.put("line",s);  
368 - vMap.put("version",lv.getVersions());  
369 - vMap.put("startTime",lv.getStartDate().getTime());  
370 - vMap.put("endTime",et);  
371 - }  
372 - if (!vMap.isEmpty()) {  
373 - vlist.add(vMap);  
374 - }  
375 - }  
376 - }  
377 - if (vlist.size()>1){  
378 - Map<String,Object> VSmap=new HashMap<>();  
379 - VSmap.put("abnormalType","vserionSwitch");  
380 - VSmap.put("st",qt);  
381 - versionSwitchList.add(VSmap); 407 + Map<String, Map<String, Object>> vmap = new HashMap<>();
  408 + Map<String, Map<String, String>> lv2station = new HashMap<String, Map<String, String>>();//lv2section = new HashMap<String, Map<String, String>>();
  409 + for (Integer lineId : lineSet) {
  410 + List<LineVersions> lvs = lineVersionsRepository.findBylineId(lineId);
  411 + for (LineVersions lv : lvs) {
  412 + long vst = lv.getStartDate().getTime(), vet = lv.getEndDate().getTime();
  413 + if (st >= vst && st <= vet || et >= vst && et <= vet) {
  414 + List<LsStationRoute> stations = lsStationRouteRepository.findupdated(lineId, lineId.toString(), lv.getVersions());
  415 + //List<LsSectionRoute> sections = lsSectionRouteRepository.findupdated(lineId, lineId.toString(), lv.getVersions());
  416 + Map<String, Object> vm = new HashMap<String, Object>();
  417 + vm.put("lineId", lineId.toString());
  418 + vm.put("version", lv.getVersions());
  419 + vm.put("startTime", vst);
  420 + vm.put("endTime", vet);
  421 + vm.put("stations", stations);
  422 + //vm.put("sections", sections);
  423 +
  424 + Map<String, String> stationcode2name = new HashMap<String, String>();//sectioncode2name = new HashMap<String, String>();
  425 + for (LsStationRoute lsr : stations) {
  426 + stationcode2name.put(lsr.getStationCode(), lsr.getStationName());
  427 + }
  428 + //for (LsSectionRoute lsr : sections) {
  429 + // sectioncode2name.put(lsr.getSectionCode(), lsr.getSection().getSectionName());
  430 + //}
  431 + lv2station.put(lineId + "_" + lv.getVersions(), stationcode2name);
  432 + // 路段因为可能漂到其它线路路段 因此需要使用最新的全量路段
  433 + //lv2section.put(lineId + "_" + lv.getVersions(), sectioncode2name);
  434 +
  435 + vlist.add(vm);
  436 + vmap.put(lineId + "_" + lv.getVersions(), vm);
  437 + }
382 } 438 }
383 } 439 }
384 rsMap.put("lineVerson",vlist); 440 rsMap.put("lineVerson",vlist);
  441 +
  442 + for (Map<String, Object> gps : list) {
  443 + long ts = (long)gps.get("timestamp");
  444 + for (Map<String, Object> vm : vlist) {
  445 + long vst = (long)vm.get("startTime"), vet = (long)vm.get("endTime");
  446 + if (gps.get("lineId").equals(vm.get("lineId")) && ts >= vst && ts <= vet) {
  447 + gps.put("version", vm.get("version"));
  448 + String key = vm.get("lineId") + "_" + vm.get("version");
  449 + /*if (StringUtils.isEmpty(sectionCode)) {
  450 + gps.put("section_code", "-00404");
  451 + gps.put("section_name", "未知路段");
  452 + }
  453 + gps.put("section_name", lv2section.get(key).get(sectionCode));*/
  454 + ArrivalEntity ae = (ArrivalEntity)gps.get("inout_stop_info");
  455 + if (ae != null) {
  456 + ae.setStopName(lv2station.get(key).get(ae.getStopNo()));
  457 + if (StringUtils.isEmpty(lv2station.get(key).get(ae.getStopNo()))) {
  458 + ae.setStopName(BasicData.stationCode2NameMap.get(ae.getStopNo()));
  459 + }
  460 + }
  461 + }
  462 + }
  463 + }
385 } 464 }
386 // 按时间排序 465 // 按时间排序
387 Collections.sort(list, new Comparator<Map<String, Object>>() { 466 Collections.sort(list, new Comparator<Map<String, Object>>() {
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTOV3.java
@@ -50,6 +50,8 @@ public class HistoryGps_DTOV3 { @@ -50,6 +50,8 @@ public class HistoryGps_DTOV3 {
50 50
51 private String section_code; 51 private String section_code;
52 private String section_name; 52 private String section_name;
  53 +
  54 + private int version;
53 55
54 @JsonIgnore 56 @JsonIgnore
55 private Point point; 57 private Point point;
@@ -119,7 +121,7 @@ public class HistoryGps_DTOV3 { @@ -119,7 +121,7 @@ public class HistoryGps_DTOV3 {
119 this.stopNo = stopNo; 121 this.stopNo = stopNo;
120 } 122 }
121 123
122 - public float getDirection() { 124 + public float getDirection() {
123 return direction; 125 return direction;
124 } 126 }
125 127
@@ -222,4 +224,12 @@ public class HistoryGps_DTOV3 { @@ -222,4 +224,12 @@ public class HistoryGps_DTOV3 {
222 public void setSection_name(String section_name) { 224 public void setSection_name(String section_name) {
223 this.section_name = section_name; 225 this.section_name = section_name;
224 } 226 }
  227 +
  228 + public int getVersion() {
  229 + return version;
  230 + }
  231 +
  232 + public void setVersion(int version) {
  233 + this.version = version;
  234 + }
225 } 235 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1534,6 +1534,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1534,6 +1534,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1534 1534
1535 private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); 1535 private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
1536 1536
  1537 + @Transactional
1537 @Override 1538 @Override
1538 public Map<String, Object> schInfoFineTune(Map<String, String> map) { 1539 public Map<String, Object> schInfoFineTune(Map<String, String> map) {
1539 Map<String, Object> rs = new HashMap<>(); 1540 Map<String, Object> rs = new HashMap<>();
@@ -1543,7 +1544,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1543,7 +1544,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1543 if (StringUtils.isNotBlank(map.get("repairTypes"))) { 1544 if (StringUtils.isNotBlank(map.get("repairTypes"))) {
1544 Map<String, Object> param = new HashMap<String, Object>(); 1545 Map<String, Object> param = new HashMap<String, Object>();
1545 param.putAll(map); 1546 param.putAll(map);
1546 - repairReport(param, false); 1547 + rs = repairReport(param, false);
1547 } 1548 }
1548 1549
1549 Long id = Long.parseLong(map.get("id")); 1550 Long id = Long.parseLong(map.get("id"));
@@ -6068,6 +6069,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6068,6 +6069,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6068 res.put("status", ResponseCode.ERROR); 6069 res.put("status", ResponseCode.ERROR);
6069 res.putAll(response); 6070 res.putAll(response);
6070 } 6071 }
  6072 + } else {
  6073 + res.put("status", ResponseCode.ERROR);
  6074 + res.put("msg", "调用上报接口异常");
6071 } 6075 }
6072 } catch (IOException e) { 6076 } catch (IOException e) {
6073 // TODO Auto-generated catch block 6077 // TODO Auto-generated catch block
@@ -6116,9 +6120,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6116,9 +6120,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6116 StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); 6120 StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1]));
6117 url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); 6121 url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]);
6118 6122
  6123 + int count = repairReportRepository.repairReportBySch(id, 0);
  6124 + if (count > 0) return res;
6119 RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); 6125 RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode);
6120 - // 非主动上报并且无上报记录或上次已上报或上次上报的同一个班次 则不用上报  
6121 - if (!isActive && (lrr == null || lrr.getReportState() != 0 || lrr.getSchId().equals(id))) { 6126 + // 非主动上报并且无上报记录或上次已上报 则不用上报
  6127 + if (!isActive && (lrr == null || lrr.getReportState() != 0)) {
6122 reportState = 0; 6128 reportState = 0;
6123 } else { 6129 } else {
6124 res = request(url.toString()); 6130 res = request(url.toString());
@@ -6136,6 +6142,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6136,6 +6142,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6136 rr.setRepairType(repairTypes); 6142 rr.setRepairType(repairTypes);
6137 rr.setReportDate(new Date()); 6143 rr.setReportDate(new Date());
6138 rr.setReportState(reportState); 6144 rr.setReportState(reportState);
  6145 + rr.setReportMode(isActive ? 1 : 0);
6139 repairReportRepository.save(rr); 6146 repairReportRepository.save(rr);
6140 dayOfSchedule.setLastestRepairReport(rr); 6147 dayOfSchedule.setLastestRepairReport(rr);
6141 6148
src/main/resources/static/pages/control/lineallot_v2/main.html
@@ -507,6 +507,8 @@ @@ -507,6 +507,8 @@
507 }); 507 });
508 //缓存路由 508 //缓存路由
509 idx=idx.substr(0, idx.length - 1); 509 idx=idx.substr(0, idx.length - 1);
  510 +
  511 + $.ajaxSettings.async = false;
510 $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { 512 $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) {
511 if (rs) { 513 if (rs) {
512 for(var lineCode in rs) 514 for(var lineCode in rs)
@@ -514,6 +516,7 @@ @@ -514,6 +516,7 @@
514 //eq.emit('cache_route'); 516 //eq.emit('cache_route');
515 } 517 }
516 }); 518 });
  519 + $.ajaxSettings.async = true;
517 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { 520 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) {
518 if (rs) { 521 if (rs) {
519 for(var lineCode in rs) 522 for(var lineCode in rs)
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
@@ -14,7 +14,7 @@ var gb_safe_driv = (function () { @@ -14,7 +14,7 @@ var gb_safe_driv = (function () {
14 'A9': '玩手机' 14 'A9': '玩手机'
15 }; 15 };
16 16
17 - var path = 'http://180.166.5.82:9005/CurrentSafeDriving/'; 17 + var path = 'http://211.95.61.66:9005/CurrentSafeDriving/';
18 18
19 var $wrap = $('.safe_driv_pop_wrap'); 19 var $wrap = $('.safe_driv_pop_wrap');
20 var max = 5; 20 var max = 5;
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/layout.html
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 {{else if item.abnormalType == 'gpsNotValid'}} 106 {{else if item.abnormalType == 'gpsNotValid'}}
107 gps无效 107 gps无效
108 {{else if item.abnormalType == 'linesSwitch'}} 108 {{else if item.abnormalType == 'linesSwitch'}}
109 - <span style="font-size:12px;-webkit-transform:scale(0.9);display:block;text-indent: 5px;">{{item.line_line}}</span> 109 + <span style="font-size:12px;-webkit-transform:scale(0.9);display:block;text-indent: 5px;">{{item.line1}}->{{item.line2}}</span>
110 {{else if item.abnormalType == 'versionSwitch'}} 110 {{else if item.abnormalType == 'versionSwitch'}}
111 线路版本切换 111 线路版本切换
112 {{else if item.abnormalType == 'gpsZero'}} 112 {{else if item.abnormalType == 'gpsZero'}}
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/right.html
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 var scale = $('.scale', progress); 81 var scale = $('.scale', progress);
82 var play_before_flag; 82 var play_before_flag;
83 var lineVersionList; 83 var lineVersionList;
84 - var currentVersion; 84 + var currentVersion = 0;
85 85
86 $('.play-back-tools-wrap', rightWrap).on('ready-to-play', function (e, data) { 86 $('.play-back-tools-wrap', rightWrap).on('ready-to-play', function (e, data) {
87 e.stopPropagation(); 87 e.stopPropagation();
@@ -304,6 +304,7 @@ @@ -304,6 +304,7 @@
304 circleLine = circleLine && circlePrevStop != circleFirstStop ? true : false; 304 circleLine = circleLine && circlePrevStop != circleFirstStop ? true : false;
305 circlePrevStop = gps.stopNo; 305 circlePrevStop = gps.stopNo;
306 if (autoChange && (gps.lineId != xlPolyline.lineId || gps.upDown != xlPolyline.upDown || circleLine) || xlPolyline.lineVersion != lineVersion) { 306 if (autoChange && (gps.lineId != xlPolyline.lineId || gps.upDown != xlPolyline.upDown || circleLine) || xlPolyline.lineVersion != lineVersion) {
  307 + debugger;
307 drawXlPolyline(gps.lineId, gps.upDown, lineVersion); 308 drawXlPolyline(gps.lineId, gps.upDown, lineVersion);
308 } 309 }
309 } 310 }
@@ -343,6 +344,7 @@ @@ -343,6 +344,7 @@
343 344
344 function drawRoadPolyline(lineCode, upDown, lineVersion) { 345 function drawRoadPolyline(lineCode, upDown, lineVersion) {
345 //从localStorage获取路段 346 //从localStorage获取路段
  347 + //debugger;
346 if (lineVersion==0) 348 if (lineVersion==0)
347 routes = JSON.parse(storage.getItem(lineCode + '_route')); 349 routes = JSON.parse(storage.getItem(lineCode + '_route'));
348 else 350 else
@@ -698,9 +700,9 @@ @@ -698,9 +700,9 @@
698 if (lineVersionList.length > 0) { 700 if (lineVersionList.length > 0) {
699 var isNotLine=0 701 var isNotLine=0
700 for (var i = 0; i < lineVersionList.length; i++) { 702 for (var i = 0; i < lineVersionList.length; i++) {
701 - if(lineVersionList[i].line!=gps.lineId) 703 + if(lineVersionList[i].lineId!=gps.lineId)
702 isNotLine++; 704 isNotLine++;
703 - if (lineVersionList[i]&&lineVersionList[i].line==gps.lineId&&(lineVersionList[i].endTime && lineVersionList[i].endTime > gps.timestamp&&lineVersionList[i].startTime && lineVersionList[i].startTime < gps.timestamp||lineVersionList[i].vtime && lineVersionList[i].vtime == 'all')) { 705 + if (lineVersionList[i]&&lineVersionList[i].lineId==gps.lineId&&(lineVersionList[i].endTime && lineVersionList[i].endTime > gps.timestamp&&lineVersionList[i].startTime && lineVersionList[i].startTime < gps.timestamp)) {
704 drawCarMarker(gps, lineVersionList[i].version);//更新GPS点位 706 drawCarMarker(gps, lineVersionList[i].version);//更新GPS点位
705 }else if(lineVersionList[i].length == 0){ 707 }else if(lineVersionList[i].length == 0){
706 drawCarMarker(gps, 0);//除非线路没有版本信息 708 drawCarMarker(gps, 0);//除非线路没有版本信息