Commit f888dc97d860221a1e92f6b978c93ff2d13dba07

Authored by 游瑞烽
2 parents f0aeb349 2cf067bd

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

Showing 24 changed files with 310 additions and 109 deletions
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
@@ -2,9 +2,11 @@ package com.bsth.controller.realcontrol; @@ -2,9 +2,11 @@ package com.bsth.controller.realcontrol;
2 2
3 import com.bsth.data.directive.DayOfDirectives; 3 import com.bsth.data.directive.DayOfDirectives;
4 import com.bsth.data.gpsdata_v2.cache.GeoCacheData; 4 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  5 +import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
5 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; 6 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
6 import com.bsth.data.msg_queue.DirectivePushQueue; 7 import com.bsth.data.msg_queue.DirectivePushQueue;
7 import com.bsth.data.msg_queue.WebSocketPushQueue; 8 import com.bsth.data.msg_queue.WebSocketPushQueue;
  9 +import com.bsth.data.pilot80.PilotReport;
8 import com.bsth.data.schedule.DayOfSchedule; 10 import com.bsth.data.schedule.DayOfSchedule;
9 import com.bsth.entity.realcontrol.ScheduleRealInfo; 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 import com.bsth.websocket.handler.SendUtils; 12 import com.bsth.websocket.handler.SendUtils;
@@ -41,29 +43,32 @@ public class AdminUtilsController { @@ -41,29 +43,32 @@ public class AdminUtilsController {
41 @Autowired 43 @Autowired
42 SendUtils sendUtils; 44 SendUtils sendUtils;
43 45
  46 + @Autowired
  47 + PilotReport pilotReport;
  48 +
44 /** 49 /**
45 * 出现重复班次的车辆 50 * 出现重复班次的车辆
46 * @param 51 * @param
47 52
48 - @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)  
49 - public void schRepeat(@RequestParam String nbbm){  
50 - logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");  
51 - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);  
52 - logger.info("检测前,车辆班次数量:" + list.size());  
53 -  
54 - Map<Long, ScheduleRealInfo> map = new HashMap<>();  
55 - for(ScheduleRealInfo sch : list){  
56 - if(map.containsKey(sch.getId())){  
57 - logger.info("检测到重复ID: " + sch.getId());  
58 - }  
59 - map.put(sch.getId(), sch);  
60 - }  
61 -  
62 - logger.info("检测后,车辆班次数量:" + list.size());  
63 - if(map.values().size() > 0){  
64 - dayOfSchedule.replaceByNbbm(nbbm, map.values());  
65 - }  
66 - }*/ 53 + @RequestMapping(value = "/schRepeat", method = RequestMethod.POST)
  54 + public void schRepeat(@RequestParam String nbbm){
  55 + logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测...");
  56 + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm);
  57 + logger.info("检测前,车辆班次数量:" + list.size());
  58 +
  59 + Map<Long, ScheduleRealInfo> map = new HashMap<>();
  60 + for(ScheduleRealInfo sch : list){
  61 + if(map.containsKey(sch.getId())){
  62 + logger.info("检测到重复ID: " + sch.getId());
  63 + }
  64 + map.put(sch.getId(), sch);
  65 + }
  66 +
  67 + logger.info("检测后,车辆班次数量:" + list.size());
  68 + if(map.values().size() > 0){
  69 + dayOfSchedule.replaceByNbbm(nbbm, map.values());
  70 + }
  71 + }*/
67 72
68 /* @RequestMapping(value = "/directivePushQueue") 73 /* @RequestMapping(value = "/directivePushQueue")
69 public void directivePushQueue(){ 74 public void directivePushQueue(){
@@ -132,10 +137,12 @@ public class AdminUtilsController { @@ -132,10 +137,12 @@ public class AdminUtilsController {
132 public Map<String, Integer> containerSize(){ 137 public Map<String, Integer> containerSize(){
133 Map<String, Integer> rs = new HashMap<>(); 138 Map<String, Integer> rs = new HashMap<>();
134 rs.put("60_size", dayOfDirectives.all60().size()); 139 rs.put("60_size", dayOfDirectives.all60().size());
  140 + rs.put("80_size", pilotReport.findAll().size());
135 rs.put("nbbm_sch_size", dayOfSchedule.findAll().size()); 141 rs.put("nbbm_sch_size", dayOfSchedule.findAll().size());
136 rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size()); 142 rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size());
137 rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); 143 rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size());
138 rs.put("pst_sch_size", dayOfSchedule.getPstSize()); 144 rs.put("pst_sch_size", dayOfSchedule.getPstSize());
  145 + rs.put("speeds_size", OverspeedProcess.size());
139 return rs; 146 return rs;
140 } 147 }
141 148
src/main/java/com/bsth/data/directive/DayOfDirectives.java
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Component; @@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
16 16
17 import java.util.*; 17 import java.util.*;
18 import java.util.concurrent.ConcurrentHashMap; 18 import java.util.concurrent.ConcurrentHashMap;
  19 +import java.util.concurrent.ConcurrentMap;
19 20
20 /** 21 /**
21 * 22 *
@@ -29,13 +30,10 @@ import java.util.concurrent.ConcurrentHashMap; @@ -29,13 +30,10 @@ import java.util.concurrent.ConcurrentHashMap;
29 public class DayOfDirectives { 30 public class DayOfDirectives {
30 31
31 // 当日60指令缓存 32 // 当日60指令缓存
32 - private static Map<Integer, D60> d60Map; 33 + private static ConcurrentMap<Integer, D60> d60Map;
33 34
34 // 线路切换指令 64 35 // 线路切换指令 64
35 - public static Map<String, D64> d64Map;  
36 -  
37 - //等待C0_A4回复的用户  
38 - //public static Map<K, V> 36 + public static ConcurrentMap<String, D64> d64Map;
39 37
40 //等待入库的指令 38 //等待入库的指令
41 public static LinkedList<Directive> pstDirectives; 39 public static LinkedList<Directive> pstDirectives;
@@ -149,9 +147,53 @@ public class DayOfDirectives { @@ -149,9 +147,53 @@ public class DayOfDirectives {
149 return; 147 return;
150 148
151 directiveService.save(d60); 149 directiveService.save(d60);
  150 + }
  151 +
  152 + public void clear(String lineCode){
  153 + int c60 = 0, c64 = 0;
  154 +
  155 + Collection<D60> d60s = d60Map.values();
  156 + List<D60> rem60List = new ArrayList<>();
  157 + for(D60 d60 : d60s){
  158 + if(d60.getLineCode().equals(lineCode))
  159 + rem60List.add(d60);
  160 + }
  161 +
  162 + //清除60数据
  163 + for(D60 d60 : rem60List){
  164 + if(d60.getReply47() == null)
  165 + directiveService.save(d60);
  166 + if(null != d60Map.remove(d60.getMsgId()))
  167 + c60 ++;
  168 + }
  169 +
  170 + rem60List.clear();
  171 + if(c60 > 0)
  172 + logger.info("清除60数据 ," + c60);
  173 +
  174 + //找到该设备的64数据
  175 + Collection<D64> d64s = d64Map.values();
  176 + List<D64> rem64List = new ArrayList<>();
  177 + for(D64 d64 : d64s){
  178 + if(d64.get)
  179 + rem64List.add(d64);
  180 + }
  181 +
  182 + //清除64数据
  183 + for(D64 d64 : rem64List){
  184 + if(d64.getRespAck() == null)
  185 + directiveService.save64(d64);
  186 +
  187 + if(null != d64Map.remove(d64.getKey()))
  188 + c64 ++;
  189 + }
  190 +
  191 + rem64List.clear();
  192 + if(c64 > 0)
  193 + logger.info("清除64数据 ," + c64);
152 }*/ 194 }*/
153 -  
154 - public void clear(String device){ 195 +
  196 +/* public void clear(String device){
155 int c60 = 0, c64 = 0; 197 int c60 = 0, c64 = 0;
156 198
157 Collection<D60> d60s = d60Map.values(); 199 Collection<D60> d60s = d60Map.values();
@@ -193,6 +235,12 @@ public class DayOfDirectives { @@ -193,6 +235,12 @@ public class DayOfDirectives {
193 rem64List.clear(); 235 rem64List.clear();
194 if(c64 > 0) 236 if(c64 > 0)
195 logger.info("清除64数据 ," + c64); 237 logger.info("清除64数据 ," + c64);
  238 + }*/
  239 +
  240 + public void clearAll(){
  241 + d60Map = new ConcurrentHashMap<>();
  242 + d64Map = new ConcurrentHashMap<>();
  243 + logger.info("清除指令数据 ,,,");
196 } 244 }
197 245
198 public Collection<D60> all60(){ 246 public Collection<D60> all60(){
src/main/java/com/bsth/data/directive/DirectiveCreator.java
@@ -81,7 +81,7 @@ public class DirectiveCreator { @@ -81,7 +81,7 @@ public class DirectiveCreator {
81 } 81 }
82 82
83 83
84 - public D60 createD60_01(String nbbm, String text, int upDown, int state, Date alarmTime){ 84 + public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){
85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); 85 SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm");
86 86
87 Long timestamp = System.currentTimeMillis(); 87 Long timestamp = System.currentTimeMillis();
@@ -102,7 +102,7 @@ public class DirectiveCreator { @@ -102,7 +102,7 @@ public class DirectiveCreator {
102 directive.setMsgId(msgId); 102 directive.setMsgId(msgId);
103 // 构造数据 103 // 构造数据
104 data.setDeviceId(deviceId); 104 data.setDeviceId(deviceId);
105 - data.setDispatchInstruct((short) 0x01); 105 + data.setDispatchInstruct((short) 0x02);
106 data.setTimestamp(timestamp); 106 data.setTimestamp(timestamp);
107 data.setCompanyCode(company); 107 data.setCompanyCode(company);
108 data.setMsgId(msgId); 108 data.setMsgId(msgId);
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
@@ -48,9 +48,7 @@ public class GatewayHttpUtils { @@ -48,9 +48,7 @@ public class GatewayHttpUtils {
48 48
49 int statusCode = response.getStatusLine().getStatusCode(); 49 int statusCode = response.getStatusLine().getStatusCode();
50 if(statusCode != 200){ 50 if(statusCode != 200){
51 - //post.abort();  
52 logger.error("http client status code: " + statusCode); 51 logger.error("http client status code: " + statusCode);
53 - //return code;  
54 } 52 }
55 53
56 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); 54 JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity()));
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
@@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; @@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
13 public class GpsEntity implements Cloneable{ 13 public class GpsEntity implements Cloneable{
14 14
15 /** 公司代码 */ 15 /** 公司代码 */
  16 + @JsonIgnore
16 private Short companyCode; 17 private Short companyCode;
17 18
18 /** 线路编码 */ 19 /** 线路编码 */
@@ -31,6 +32,7 @@ public class GpsEntity implements Cloneable{ @@ -31,6 +32,7 @@ public class GpsEntity implements Cloneable{
31 private String stationName; 32 private String stationName;
32 33
33 /** 到站时间 */ 34 /** 到站时间 */
  35 + @JsonIgnore
34 private long arrTime; 36 private long arrTime;
35 37
36 /** 经度 */ 38 /** 经度 */
@@ -56,6 +58,12 @@ public class GpsEntity implements Cloneable{ @@ -56,6 +58,12 @@ public class GpsEntity implements Cloneable{
56 58
57 /** 上下行(0 上行 , 1 下行 , -1 无效) */ 59 /** 上下行(0 上行 , 1 下行 , -1 无效) */
58 private Byte upDown; 60 private Byte upDown;
  61 +
  62 + /**
  63 + * 设备原始走向_营运状态
  64 + * 当设备状态和系统不一致时,该字段有值
  65 + */
  66 + private String origStateStr;
59 67
60 /** 车辆内部编码 */ 68 /** 车辆内部编码 */
61 private String nbbm; 69 private String nbbm;
@@ -379,4 +387,12 @@ public class GpsEntity implements Cloneable{ @@ -379,4 +387,12 @@ public class GpsEntity implements Cloneable{
379 public void setPlanCode(String planCode) { 387 public void setPlanCode(String planCode) {
380 this.planCode = planCode; 388 this.planCode = planCode;
381 } 389 }
  390 +
  391 + public String getOrigStateStr() {
  392 + return origStateStr;
  393 + }
  394 +
  395 + public void setOrigStateStr(String origStateStr) {
  396 + this.origStateStr = origStateStr;
  397 + }
382 } 398 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
@@ -7,6 +7,9 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; @@ -7,6 +7,9 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
9 9
  10 +import java.util.concurrent.ConcurrentHashMap;
  11 +import java.util.concurrent.ConcurrentMap;
  12 +
10 /** 13 /**
11 * GPS 状态处理 14 * GPS 状态处理
12 * Created by panzhao on 2017/11/15. 15 * Created by panzhao on 2017/11/15.
@@ -20,6 +23,13 @@ public class GpsStateProcess { @@ -20,6 +23,13 @@ public class GpsStateProcess {
20 @Autowired 23 @Autowired
21 GpsStatusManager gpsStatusManager; 24 GpsStatusManager gpsStatusManager;
22 25
  26 + /**
  27 + * 设置状态差异连续次数
  28 + */
  29 + private static ConcurrentMap<String, Integer> stateDiffMap = new ConcurrentHashMap<>();
  30 +
  31 + private final static int CHANGE_THRESHOLD = 2;
  32 +
23 public void process(GpsEntity gps) { 33 public void process(GpsEntity gps) {
24 //在执行的任务 34 //在执行的任务
25 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); 35 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
@@ -27,16 +37,40 @@ public class GpsStateProcess { @@ -27,16 +37,40 @@ public class GpsStateProcess {
27 if (null == sch) 37 if (null == sch)
28 return; 38 return;
29 39
30 - byte upDown = Byte.parseByte(sch.getXlDir()); 40 + int upDown = Integer.parseInt(sch.getXlDir());
31 int schState = dayOfSchedule.emptyService(sch)?1:0; 41 int schState = dayOfSchedule.emptyService(sch)?1:0;
32 - 42 + String device = gps.getDeviceId();
  43 + /**
  44 + * 网关在进终点的时候,会直接将当前点位状态改变
  45 + * 为避免出现单个点的状态跳动,设置一下切换阈值
  46 + */
33 if(gps.getState() != schState || gps.getUpDown() != upDown){ 47 if(gps.getState() != schState || gps.getUpDown() != upDown){
34 - //下发指令纠正车载的 营运状态 和 走向  
35 - gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统"); 48 + Integer count = 0;
  49 + if(stateDiffMap.containsKey(device))
  50 + count = stateDiffMap.get(device);
  51 +
  52 + count ++;
  53 +
  54 + if(count >= CHANGE_THRESHOLD){
  55 + //下发指令纠正车载的 营运状态 和 走向
  56 + gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, schState, "同步@系统");
  57 + count = 0;
  58 + }
  59 +
  60 + stateDiffMap.put(device, count);
  61 +
  62 + //记录原始设备状态
  63 + gps.setOrigStateStr(gps.getUpDown() + "_" + gps.getState());
36 } 64 }
  65 + else
  66 + stateDiffMap.put(device, 0);
37 67
38 if (gps.getUpDown() != upDown) { 68 if (gps.getUpDown() != upDown) {
39 - gps.setUpDown(upDown);//修正走向 69 + gps.setUpDown((byte) upDown);//修正走向
  70 + }
  71 +
  72 + if(gps.getState() != schState){
  73 + gps.setState(schState);//修正营运状态
40 } 74 }
41 75
42 if (!sch.getXlBm().equals(gps.getLineId())) { 76 if (!sch.getXlBm().equals(gps.getLineId())) {
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -144,6 +144,8 @@ public class InStationProcess { @@ -144,6 +144,8 @@ public class InStationProcess {
144 dayOfSchedule.addExecPlan(next); 144 dayOfSchedule.addExecPlan(next);
145 inStationAndInPark(sch, next);//进站既进场 145 inStationAndInPark(sch, next);//进站既进场
146 } 146 }
  147 + else
  148 + dayOfSchedule.removeExecPlan(nbbm);
147 149
148 //路牌的下一个班次,页面显示起点实际到达时间 150 //路牌的下一个班次,页面显示起点实际到达时间
149 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); 151 ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch);
@@ -176,9 +178,14 @@ public class InStationProcess { @@ -176,9 +178,14 @@ public class InStationProcess {
176 if(null == next && gps.isService()){ 178 if(null == next && gps.isService()){
177 nonService(sch, "结束@系统");//营运结束 179 nonService(sch, "结束@系统");//营运结束
178 } 180 }
179 - //下发运营指令  
180 - DirectivePushQueue.put6003(next, "到站@系统");  
181 181
  182 + /**
  183 + * 下一班不是全程班次的时候,下发运营指令
  184 + * 全程班次时,由网关根据进出起终点,自动切换走向
  185 +
  186 + if(null != next && !next.getBcType().equals("normal"))
  187 + DirectivePushQueue.put6003(next, "到站@系统");
  188 + */
182 //下发调度指令 189 //下发调度指令
183 DirectivePushQueue.put6002(next, doneSum, "到站@系统", ""); 190 DirectivePushQueue.put6002(next, doneSum, "到站@系统", "");
184 } 191 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/overspeed/OverspeedProcess.java
@@ -43,7 +43,7 @@ public class OverspeedProcess { @@ -43,7 +43,7 @@ public class OverspeedProcess {
43 */ 43 */
44 private static Map<String, Integer> contSpeedMap; 44 private static Map<String, Integer> contSpeedMap;
45 45
46 - Logger logger = LoggerFactory.getLogger(this.getClass()); 46 + static Logger logger = LoggerFactory.getLogger(OverspeedProcess.class);
47 47
48 static{ 48 static{
49 multimap = ArrayListMultimap.create(); 49 multimap = ArrayListMultimap.create();
@@ -51,6 +51,10 @@ public class OverspeedProcess { @@ -51,6 +51,10 @@ public class OverspeedProcess {
51 realOverspeedMap = new HashMap(); 51 realOverspeedMap = new HashMap();
52 } 52 }
53 53
  54 + public static int size(){
  55 + return multimap.size();
  56 + }
  57 +
54 public static void clear(){ 58 public static void clear(){
55 multimap = null; 59 multimap = null;
56 multimap = ArrayListMultimap.create(); 60 multimap = ArrayListMultimap.create();
@@ -60,6 +64,8 @@ public class OverspeedProcess { @@ -60,6 +64,8 @@ public class OverspeedProcess {
60 64
61 realOverspeedMap = null; 65 realOverspeedMap = null;
62 realOverspeedMap = new HashMap(); 66 realOverspeedMap = new HashMap();
  67 +
  68 + logger.info("清理超速缓存数据,,,");
63 } 69 }
64 70
65 public boolean process(GpsEntity gps){ 71 public boolean process(GpsEntity gps){
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
@@ -15,6 +15,8 @@ public class GpsDataUtils { @@ -15,6 +15,8 @@ public class GpsDataUtils {
15 15
16 static Logger logger = LoggerFactory.getLogger(GpsDataUtils.class); 16 static Logger logger = LoggerFactory.getLogger(GpsDataUtils.class);
17 17
  18 + private final static long MAX_DIFF = 1000 * 60 * 60 * 24;
  19 +
18 /** 20 /**
19 * 过滤无效的gps点位 21 * 过滤无效的gps点位
20 * 22 *
@@ -24,9 +26,16 @@ public class GpsDataUtils { @@ -24,9 +26,16 @@ public class GpsDataUtils {
24 public static List<GpsEntity> clearInvalid(List<GpsEntity> list) { 26 public static List<GpsEntity> clearInvalid(List<GpsEntity> list) {
25 List<GpsEntity> rs = new ArrayList<>(); 27 List<GpsEntity> rs = new ArrayList<>();
26 28
  29 + long t = System.currentTimeMillis();
27 try { 30 try {
28 GpsEntity prev; 31 GpsEntity prev;
29 for (GpsEntity gps : list) { 32 for (GpsEntity gps : list) {
  33 + if(Math.abs(gps.getTimestamp() - t) > MAX_DIFF){
  34 + //尝试校准GPS时间
  35 + gps.setTimestamp(t + 1);
  36 + gps.setAbnormalStatus("timeError");
  37 + }
  38 +
30 prev = GpsRealData.get(gps.getDeviceId()); 39 prev = GpsRealData.get(gps.getDeviceId());
31 40
32 //不接收过期数据 41 //不接收过期数据
@@ -48,7 +57,7 @@ public class GpsDataUtils { @@ -48,7 +57,7 @@ public class GpsDataUtils {
48 if (rs.size() < list.size()) 57 if (rs.size() < list.size())
49 logger.info("过滤无效的点位 : " + (list.size() - rs.size())); 58 logger.info("过滤无效的点位 : " + (list.size() - rs.size()));
50 } catch (Exception e) { 59 } catch (Exception e) {
51 - logger.error("", e); 60 + logger.error("过滤GPS出现异常", e);
52 rs = list; 61 rs = list;
53 } 62 }
54 return rs; 63 return rs;
src/main/java/com/bsth/data/msg_queue/DirectivePushQueue.java
@@ -24,7 +24,7 @@ public class DirectivePushQueue implements ApplicationContextAware { @@ -24,7 +24,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
24 static ConcurrentLinkedQueue<QueueData_Directive> linkedList; 24 static ConcurrentLinkedQueue<QueueData_Directive> linkedList;
25 static DataPushThread thread; 25 static DataPushThread thread;
26 static DirectiveService directiveService; 26 static DirectiveService directiveService;
27 - static long t; 27 + static long threadT;
28 28
29 /** 29 /**
30 * 下发运营指令6003的最小间隔时间 30 * 下发运营指令6003的最小间隔时间
@@ -34,11 +34,11 @@ public class DirectivePushQueue implements ApplicationContextAware { @@ -34,11 +34,11 @@ public class DirectivePushQueue implements ApplicationContextAware {
34 /** 34 /**
35 * 车辆 ——> 上次下发6003的时间 35 * 车辆 ——> 上次下发6003的时间
36 */ 36 */
37 - static ConcurrentMap<String, Long> lastSend6003Map; 37 + static ConcurrentMap<String, Long> lastSend60TimeMap;
38 38
39 static { 39 static {
40 linkedList = new ConcurrentLinkedQueue<>(); 40 linkedList = new ConcurrentLinkedQueue<>();
41 - lastSend6003Map = new ConcurrentHashMap<>(); 41 + lastSend60TimeMap = new ConcurrentHashMap<>();
42 } 42 }
43 43
44 public static void put6002(ScheduleRealInfo sch, int finish, String sender, String txtPrefix){ 44 public static void put6002(ScheduleRealInfo sch, int finish, String sender, String txtPrefix){
@@ -52,12 +52,13 @@ public class DirectivePushQueue implements ApplicationContextAware { @@ -52,12 +52,13 @@ public class DirectivePushQueue implements ApplicationContextAware {
52 qd6002.setTxtPrefix(txtPrefix); 52 qd6002.setTxtPrefix(txtPrefix);
53 53
54 linkedList.add(qd6002); 54 linkedList.add(qd6002);
  55 + lastSend60TimeMap.put(sch.getClZbh(), System.currentTimeMillis());
55 } 56 }
56 57
57 public static void put6003(String nbbm, int state, int upDown, String sender){ 58 public static void put6003(String nbbm, int state, int upDown, String sender){
58 long t = System.currentTimeMillis(); 59 long t = System.currentTimeMillis();
59 - if(lastSend6003Map.containsKey(nbbm)  
60 - && t - lastSend6003Map.get(nbbm) < MIN_SEND6003_SPACE) 60 + if(lastSend60TimeMap.containsKey(nbbm)
  61 + && t - lastSend60TimeMap.get(nbbm) < MIN_SEND6003_SPACE)
61 return; //最短下发间隔 62 return; //最短下发间隔
62 63
63 QueueData_Directive qd6003 = new QueueData_Directive(); 64 QueueData_Directive qd6003 = new QueueData_Directive();
@@ -68,7 +69,7 @@ public class DirectivePushQueue implements ApplicationContextAware { @@ -68,7 +69,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
68 qd6003.setCode("60_03"); 69 qd6003.setCode("60_03");
69 70
70 linkedList.add(qd6003); 71 linkedList.add(qd6003);
71 - lastSend6003Map.put(nbbm, t); 72 + lastSend60TimeMap.put(nbbm, t);
72 } 73 }
73 74
74 public static void put6003(ScheduleRealInfo sch, String sender){ 75 public static void put6003(ScheduleRealInfo sch, String sender){
@@ -146,7 +147,7 @@ public class DirectivePushQueue implements ApplicationContextAware { @@ -146,7 +147,7 @@ public class DirectivePushQueue implements ApplicationContextAware {
146 sleepFlag = true; 147 sleepFlag = true;
147 } 148 }
148 } 149 }
149 - t = System.currentTimeMillis(); 150 + threadT = System.currentTimeMillis();
150 } 151 }
151 catch(InterruptedException e){ 152 catch(InterruptedException e){
152 log.error("", e); 153 log.error("", e);
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
@@ -3,6 +3,8 @@ package com.bsth.data.safe_driv; @@ -3,6 +3,8 @@ package com.bsth.data.safe_driv;
3 import com.bsth.websocket.handler.SendUtils; 3 import com.bsth.websocket.handler.SendUtils;
4 import org.joda.time.format.DateTimeFormat; 4 import org.joda.time.format.DateTimeFormat;
5 import org.joda.time.format.DateTimeFormatter; 5 import org.joda.time.format.DateTimeFormatter;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
6 import org.springframework.beans.BeansException; 8 import org.springframework.beans.BeansException;
7 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.context.ApplicationContext; 10 import org.springframework.context.ApplicationContext;
@@ -33,6 +35,8 @@ public class SafeDrivCenter implements ApplicationContextAware { @@ -33,6 +35,8 @@ public class SafeDrivCenter implements ApplicationContextAware {
33 */ 35 */
34 private static Map<String, SafeDriv> safeMap; 36 private static Map<String, SafeDriv> safeMap;
35 37
  38 + static Logger logger = LoggerFactory.getLogger(SafeDrivCenter.class);
  39 +
36 static { 40 static {
37 data = new HashSet<>(); 41 data = new HashSet<>();
38 safeMap = new HashMap<>(); 42 safeMap = new HashMap<>();
@@ -61,6 +65,7 @@ public class SafeDrivCenter implements ApplicationContextAware { @@ -61,6 +65,7 @@ public class SafeDrivCenter implements ApplicationContextAware {
61 public static void clear(){ 65 public static void clear(){
62 data = new HashSet<>(); 66 data = new HashSet<>();
63 safeMap = new HashMap<>(); 67 safeMap = new HashMap<>();
  68 + logger.info("清除安全驾驶数据,,,");
64 } 69 }
65 70
66 @Override 71 @Override
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 package com.bsth.data.schedule.thread; 1 package com.bsth.data.schedule.thread;
2 2
  3 +import com.bsth.data.directive.DayOfDirectives;
3 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; 4 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
4 import com.bsth.service.oil.DlbService; 5 import com.bsth.service.oil.DlbService;
5 import com.bsth.data.safe_driv.SafeDrivCenter; 6 import com.bsth.data.safe_driv.SafeDrivCenter;
@@ -27,6 +28,9 @@ public class CalcOilThread extends Thread{ @@ -27,6 +28,9 @@ public class CalcOilThread extends Thread{
27 SheetService sheetService; 28 SheetService sheetService;
28 Logger logger = LoggerFactory.getLogger(this.getClass()); 29 Logger logger = LoggerFactory.getLogger(this.getClass());
29 30
  31 + @Autowired
  32 + DayOfDirectives dayOfDirectives;
  33 +
30 @Override 34 @Override
31 public void run() { 35 public void run() {
32 try{ 36 try{
@@ -37,12 +41,15 @@ public class CalcOilThread extends Thread{ @@ -37,12 +41,15 @@ public class CalcOilThread extends Thread{
37 logger.info("开始计算班次准点率...."); 41 logger.info("开始计算班次准点率....");
38 sheetService.saveSheetList(""); 42 sheetService.saveSheetList("");
39 logger.info("计算班次准点率结束!"); 43 logger.info("计算班次准点率结束!");
40 - //清除安全驾驶数据 先临时蹭这个线程  
41 - SafeDrivCenter.clear();  
42 - //清除超速缓存数据  
43 - OverspeedProcess.clear();  
44 } catch(Exception e){ 44 } catch(Exception e){
45 logger.error("计算路单里程加注量失败",e); 45 logger.error("计算路单里程加注量失败",e);
46 } 46 }
  47 +
  48 + //清除指令数据
  49 + dayOfDirectives.clearAll();
  50 + //清除安全驾驶数据
  51 + SafeDrivCenter.clear();
  52 + //清除超速缓存数据
  53 + OverspeedProcess.clear();
47 } 54 }
48 } 55 }
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 package com.bsth.data.schedule.thread; 1 package com.bsth.data.schedule.thread;
2 2
3 -import com.bsth.data.BasicData;  
4 import com.bsth.data.LineConfigData; 3 import com.bsth.data.LineConfigData;
5 import com.bsth.data.directive.DayOfDirectives; 4 import com.bsth.data.directive.DayOfDirectives;
6 import com.bsth.data.gpsdata_v2.cache.GpsCacheData; 5 import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
@@ -56,17 +55,15 @@ public class ScheduleRefreshThread extends Thread{ @@ -56,17 +55,15 @@ public class ScheduleRefreshThread extends Thread{
56 55
57 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ 56 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
58 57
59 - //logger.info(lineCode + "开始翻班, " + currSchDate);  
60 -  
61 try{ 58 try{
62 - //清除指令数据  
63 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); 59 Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode);
64 for(String car : cars){ 60 for(String car : cars){
65 - dayOfDirectives.clear(BasicData.deviceId2NbbmMap.inverse().get(car));  
66 GpsCacheData.remove(car); 61 GpsCacheData.remove(car);
67 } 62 }
68 //清除驾驶员上报数据 63 //清除驾驶员上报数据
69 pilotReport.clear(lineCode); 64 pilotReport.clear(lineCode);
  65 + //清除指令数据 指令数据,直接定时全部清空
  66 + //dayOfDirectives.clear(lineCode);
70 }catch (Exception e){ 67 }catch (Exception e){
71 logger.error("清理 60 和 80出现问题", e); 68 logger.error("清理 60 和 80出现问题", e);
72 } 69 }
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
@@ -128,7 +128,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -128,7 +128,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
128 text += " (放站到"+sch.getMajorStationName()+"带客)"; 128 text += " (放站到"+sch.getMajorStationName()+"带客)";
129 } 129 }
130 130
131 - //下发0x01指令 调度指令(闹钟有效) 131 + //下发0x02指令 调度指令(闹钟有效)
132 long t = System.currentTimeMillis() + 1000 * 30, 132 long t = System.currentTimeMillis() + 1000 * 30,
133 alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT(); 133 alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT();
134 134
@@ -139,7 +139,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen @@ -139,7 +139,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
139 int state = 0;//营运状态 139 int state = 0;//营运状态
140 if(dayOfSchedule.emptyService(sch)) 140 if(dayOfSchedule.emptyService(sch))
141 state = 1; 141 state = 1;
142 - d60 = new DirectiveCreator().createD60_01(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir()) 142 + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
143 , state, new Date(alarmTime)); 143 , state, new Date(alarmTime));
144 144
145 d60.setLineCode(sch.getXlBm()); 145 d60.setLineCode(sch.getXlBm());
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -5,6 +5,7 @@ import com.bsth.data.BasicData; @@ -5,6 +5,7 @@ import com.bsth.data.BasicData;
5 import com.bsth.data.forecast.entity.ArrivalEntity; 5 import com.bsth.data.forecast.entity.ArrivalEntity;
6 import com.bsth.data.gpsdata_v2.GpsRealData; 6 import com.bsth.data.gpsdata_v2.GpsRealData;
7 import com.bsth.data.gpsdata_v2.cache.GeoCacheData; 7 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  8 +import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
8 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 9 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
9 import com.bsth.data.gpsdata_v2.utils.GeoUtils; 10 import com.bsth.data.gpsdata_v2.utils.GeoUtils;
10 import com.bsth.data.pilot80.PilotReport; 11 import com.bsth.data.pilot80.PilotReport;
@@ -492,6 +493,7 @@ public class GpsServiceImpl implements GpsService { @@ -492,6 +493,7 @@ public class GpsServiceImpl implements GpsService {
492 try { 493 try {
493 494
494 gpsRealData.remove(device); 495 gpsRealData.remove(device);
  496 + GpsCacheData.remove(BasicData.deviceId2NbbmMap.get(device));
495 rs.put("status", ResponseCode.SUCCESS); 497 rs.put("status", ResponseCode.SUCCESS);
496 } catch (Exception e) { 498 } catch (Exception e) {
497 rs.put("status", ResponseCode.ERROR); 499 rs.put("status", ResponseCode.ERROR);
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -2762,13 +2762,25 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2762,13 +2762,25 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2762 !zdsj.equals(zdsjActual) && 2762 !zdsj.equals(zdsjActual) &&
2763 !zdsj.equals("")&& 2763 !zdsj.equals("")&&
2764 !zdsjActual.equals("")) { 2764 !zdsjActual.equals("")) {
2765 - if (zdsj.compareTo(zdsjActual) > 0) {  
2766 - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
2767 - maps.put("slow", "");  
2768 - } else {  
2769 - maps.put("fast", "");  
2770 - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
2771 - } 2765 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  2766 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
  2767 + if (zdsj.compareTo(zdsjActual) > 0) {
  2768 + if(zdsjT - zdsjAT > 1000){
  2769 + maps.put("fast", "");
  2770 + maps.put("slow", zdsjAT - zdsjT + 1440);
  2771 + } else {
  2772 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2773 + maps.put("slow", "");
  2774 + }
  2775 + } else {
  2776 + if(zdsjAT - zdsjT > 1000){
  2777 + maps.put("fast", zdsjT - zdsjAT + 1440);
  2778 + maps.put("slow", "");
  2779 + } else {
  2780 + maps.put("fast", "");
  2781 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2782 + }
  2783 + }
2772 } else { 2784 } else {
2773 maps.put("fast", ""); 2785 maps.put("fast", "");
2774 maps.put("slow", ""); 2786 maps.put("slow", "");
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
698 //数据库删除 698 //数据库删除
699 rs = super.delete(id); 699 rs = super.delete(id);
700 if(rs.get("status").equals(ResponseCode.SUCCESS)){ 700 if(rs.get("status").equals(ResponseCode.SUCCESS)){
701 - /*ScheduleRealInfo temp = super.findById(id);  
702 - if(temp != null){  
703 - rs.put("status", ResponseCode.ERROR);  
704 - rs.put("msg", "删除失败,请重试!");  
705 - return rs;  
706 - }*/  
707 -  
708 dayOfSchedule.delete(sch); 701 dayOfSchedule.delete(sch);
709 //更新起点应到时间 702 //更新起点应到时间
710 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); 703 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch);
@@ -1027,12 +1020,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1027,12 +1020,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1027 !zdsj.equals(zdsjActual) && 1020 !zdsj.equals(zdsjActual) &&
1028 !zdsj.equals("")&& 1021 !zdsj.equals("")&&
1029 !zdsjActual.equals("")) { 1022 !zdsjActual.equals("")) {
  1023 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  1024 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
1030 if (zdsj.compareTo(zdsjActual) > 0) { 1025 if (zdsj.compareTo(zdsjActual) > 0) {
1031 - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
1032 - maps.put("slow", ""); 1026 + if(zdsjT - zdsjAT > 1000){
  1027 + maps.put("fast", "");
  1028 + maps.put("slow", zdsjAT - zdsjT + 1440);
  1029 + } else {
  1030 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1031 + maps.put("slow", "");
  1032 + }
1033 } else { 1033 } else {
1034 - maps.put("fast", "");  
1035 - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); 1034 + if(zdsjAT - zdsjT > 1000){
  1035 + maps.put("fast", zdsjT - zdsjAT + 1440);
  1036 + maps.put("slow", "");
  1037 + } else {
  1038 + maps.put("fast", "");
  1039 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  1040 + }
1036 } 1041 }
1037 } else { 1042 } else {
1038 maps.put("fast", ""); 1043 maps.put("fast", "");
@@ -3707,12 +3712,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3707,12 +3712,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3707 String zdsjActual = scheduleRealInfo.getZdsjActual(); 3712 String zdsjActual = scheduleRealInfo.getZdsjActual();
3708 if (zdsj != null && zdsjActual != null && 3713 if (zdsj != null && zdsjActual != null &&
3709 !zdsj.equals(zdsjActual)) { 3714 !zdsj.equals(zdsjActual)) {
  3715 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  3716 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
3710 if (zdsj.compareTo(zdsjActual) > 0) { 3717 if (zdsj.compareTo(zdsjActual) > 0) {
3711 - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
3712 - map.put("slow", ""); 3718 + if(zdsjT - zdsjAT > 1000){
  3719 + map.put("fast", "");
  3720 + map.put("slow", zdsjAT - zdsjT + 1440);
  3721 + } else {
  3722 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3723 + map.put("slow", "");
  3724 + }
3713 } else { 3725 } else {
3714 - map.put("fast", "");  
3715 - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); 3726 + if(zdsjAT - zdsjT > 1000){
  3727 + map.put("fast", zdsjT - zdsjAT + 1440);
  3728 + map.put("slow", "");
  3729 + } else {
  3730 + map.put("fast", "");
  3731 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  3732 + }
3716 } 3733 }
3717 } else { 3734 } else {
3718 map.put("fast", ""); 3735 map.put("fast", "");
@@ -4703,12 +4720,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4703,12 +4720,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4703 !zdsj.equals(zdsjActual) && 4720 !zdsj.equals(zdsjActual) &&
4704 !zdsj.equals("")&& 4721 !zdsj.equals("")&&
4705 !zdsjActual.equals("")) { 4722 !zdsjActual.equals("")) {
  4723 + int zdsjT = Integer.valueOf(zdsj.split(":")[0])*60 + Integer.valueOf(zdsj.split(":")[1]);
  4724 + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0])*60 + Integer.valueOf(zdsjActual.split(":")[1]);
4706 if (zdsj.compareTo(zdsjActual) > 0) { 4725 if (zdsj.compareTo(zdsjActual) > 0) {
4707 - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
4708 - maps.put("slow", ""); 4726 + if(zdsjT - zdsjAT > 1000){
  4727 + maps.put("fast", "");
  4728 + maps.put("slow", zdsjAT - zdsjT + 1440);
  4729 + } else {
  4730 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4731 + maps.put("slow", "");
  4732 + }
4709 } else { 4733 } else {
4710 - maps.put("fast", "");  
4711 - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); 4734 + if(zdsjAT - zdsjT > 1000){
  4735 + maps.put("fast", zdsjT - zdsjAT + 1440);
  4736 + maps.put("slow", "");
  4737 + } else {
  4738 + maps.put("fast", "");
  4739 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4740 + }
4712 } 4741 }
4713 } else { 4742 } else {
4714 maps.put("fast", ""); 4743 maps.put("fast", "");
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -93,8 +93,10 @@ public class ReportServiceImpl implements ReportService{ @@ -93,8 +93,10 @@ public class ReportServiceImpl implements ReportService{
93 String sbbb=BasicData.deviceId2NbbmMap.inverse().get(clzbh); 93 String sbbb=BasicData.deviceId2NbbmMap.inverse().get(clzbh);
94 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 94 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
95 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); 95 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
96 - Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();  
97 - Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime(); 96 +// Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
  97 +// Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
  98 + Long date1=simpleDateFormat.parse(sjfc+":00").getTime();
  99 + Long date2=simpleDateFormat.parse(sjdd+":00").getTime();
98 Date dates=simpleDateFormat.parse(date+" 00:00:00"); 100 Date dates=simpleDateFormat.parse(date+" 00:00:00");
99 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates,date); 101 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates,date);
100 102
@@ -129,20 +131,22 @@ public class ReportServiceImpl implements ReportService{ @@ -129,20 +131,22 @@ public class ReportServiceImpl implements ReportService{
129 cal.setTime(dates); 131 cal.setTime(dates);
130 //周数,表分区字段 132 //周数,表分区字段
131 int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); 133 int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
132 - 134 + int weeks_year_next=weeks_year +1;
133 Connection conn = null; 135 Connection conn = null;
134 PreparedStatement ps = null; 136 PreparedStatement ps = null;
135 ResultSet rs = null; 137 ResultSet rs = null;
136 String year=date.substring(0,4); 138 String year=date.substring(0,4);
137 - String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts"; 139 + String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? "
  140 + + " AND weeks_year>=? AND weeks_year<=? AND ts >= ? AND ts <=? order by ts";
138 try{ 141 try{
139 conn = DBUtils_MS.getConnection(); 142 conn = DBUtils_MS.getConnection();
140 ps = conn.prepareStatement(sql); 143 ps = conn.prepareStatement(sql);
141 ps.setString(1, sbbb); 144 ps.setString(1, sbbb);
142 ps.setString(2,line); 145 ps.setString(2,line);
143 ps.setInt(3, weeks_year); 146 ps.setInt(3, weeks_year);
144 - ps.setLong(4, date1);  
145 - ps.setLong(5, date2); 147 + ps.setInt(4, weeks_year_next);
  148 + ps.setLong(5, date1);
  149 + ps.setLong(6, date2);
146 rs = ps.executeQuery(); 150 rs = ps.executeQuery();
147 151
148 list = resultSet2Set(rs); 152 list = resultSet2Set(rs);
src/main/resources/static/pages/electricity/list/list.html
@@ -588,12 +588,13 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -588,12 +588,13 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
588 588
589 function jsyUpdate(){ 589 function jsyUpdate(){
590 var params=getParamsList(); 590 var params=getParamsList();
  591 + var id = $(this).data('id');
591 $get('/ylb/checkDate',params,function(status){ 592 $get('/ylb/checkDate',params,function(status){
592 if(status=='2'){ 593 if(status=='2'){
593 layer.msg('只能操作三天内数据.'); 594 layer.msg('只能操作三天内数据.');
594 }else{ 595 }else{
595 - var id = $(this).data('id');  
596 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val(); 596 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val();
  597 + console.log(id+"修改驾驶员:"+jsy);
597 $get('/dlb/updateJsy',{id:id,jsy:jsy}, function(result){ 598 $get('/dlb/updateJsy',{id:id,jsy:jsy}, function(result){
598 layer.msg('修改成功.'); 599 layer.msg('修改成功.');
599 page = 0; 600 page = 0;
src/main/resources/static/pages/forms/statement/waybill.html
@@ -375,10 +375,18 @@ @@ -375,10 +375,18 @@
375 var zdsjActual = (obj.zdsjActual).split(":"); 375 var zdsjActual = (obj.zdsjActual).split(":");
376 var zdsj = (obj.zdsj).split(":"); 376 var zdsj = (obj.zdsj).split(":");
377 if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){ 377 if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
378 - obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])); 378 + if(zdsjActual[0]*60+Number(zdsjActual[1]) - zdsj[0]*60+Number(zdsj[1]) > 1000){
  379 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) + 1440;
  380 + } else {
  381 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  382 + }
379 } 383 }
380 else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){ 384 else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
381 - obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])); 385 + if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) > 1000){
  386 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])) + 1440;
  387 + } else {
  388 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  389 + }
382 } 390 }
383 } 391 }
384 }); 392 });
src/main/resources/static/pages/oil/list_ph.html
@@ -764,10 +764,10 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -764,10 +764,10 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
764 function jsyUpdate(){ 764 function jsyUpdate(){
765 var params=getParamsList(); 765 var params=getParamsList();
766 $get('/ylb/checkDate',params,function(status){ 766 $get('/ylb/checkDate',params,function(status){
  767 + var id = $(this).data('id');
767 if(status=='2'){ 768 if(status=='2'){
768 layer.msg('只能操作三天内数据.'); 769 layer.msg('只能操作三天内数据.');
769 }else{ 770 }else{
770 - var id = $(this).data('id');  
771 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#ll_oil_list').val(); 771 var jsy=$('.in_carpark_jsy[data-id='+id+']', '#ll_oil_list').val();
772 $get('/ylb/updateJsy',{id:id,jsy:jsy}, function(result){ 772 $get('/ylb/updateJsy',{id:id,jsy:jsy}, function(result){
773 layer.msg('修改成功.'); 773 layer.msg('修改成功.');
src/main/resources/static/pages/report/inoutstation.html
@@ -389,6 +389,14 @@ @@ -389,6 +389,14 @@
389 var id=params[0].split("\\")[0]; 389 var id=params[0].split("\\")[0];
390 var fcsj = $('.in_carpark_fcsj[data-id='+id+']', '#forms').html(); 390 var fcsj = $('.in_carpark_fcsj[data-id='+id+']', '#forms').html();
391 var ddsj= $('.in_carpark_zdsj[data-id='+id+']', '#forms').html(); 391 var ddsj= $('.in_carpark_zdsj[data-id='+id+']', '#forms').html();
  392 + var d1 = new Date(fcsj+":00");
  393 + var d2 = new Date(ddsj+":00");
  394 + console.log(parseInt(d1 - d2) / 1000 / 60);//两个时间相差的分钟数
  395 + if(parseInt(d1 - d2)>0){
  396 + d2.setDate(d2.getDate()+1);//设置天数 -1 天
  397 + ddsj = d2.getFullYear() + '-' + (d2.getMonth() + 1) + '-' + d2.getDate() + ' ' + d2.getHours() + ':' + d2.getMinutes();
  398 + }
  399 +
392 if(!(typeof(fcsj)=='undefined'|| typeof(ddsj)=='undefined')){ 400 if(!(typeof(fcsj)=='undefined'|| typeof(ddsj)=='undefined')){
393 $get('/report/queryListZdxx',{clzbh:nbbm,date:rq,line:line,fcsj:fcsj,ddsj:ddsj},function(result){ 401 $get('/report/queryListZdxx',{clzbh:nbbm,date:rq,line:line,fcsj:fcsj,ddsj:ddsj},function(result){
394 var xlmc="线路: "+$("#select2-line-container").html(); 402 var xlmc="线路: "+$("#select2-line-container").html();
@@ -396,8 +404,8 @@ @@ -396,8 +404,8 @@
396 var rqmc="日期: "+rq; 404 var rqmc="日期: "+rq;
397 var bcmc="班次: "+fcsj+"-"+ddsj; 405 var bcmc="班次: "+fcsj+"-"+ddsj;
398 $("#dlzmx").html("到离站详细 "+xlmc+" "+clmc+" "+rqmc+" "+bcmc); 406 $("#dlzmx").html("到离站详细 "+xlmc+" "+clmc+" "+rqmc+" "+bcmc);
399 - $("#fcsj_xx").val(fcsj);  
400 - $("#ddsj_xx").val(ddsj); 407 + $("#fcsj_xx").val(fcsj);
  408 + $("#ddsj_xx").val(ddsj);
401 var ludan_ll_1 = template('ludan_ll_1',{list:result}); 409 var ludan_ll_1 = template('ludan_ll_1',{list:result});
402 // 把渲染好的模版html文本追加到表格中 410 // 把渲染好的模版html文本追加到表格中
403 $('#forms1 .ludan_ll_1').html(ludan_ll_1); 411 $('#forms1 .ludan_ll_1').html(ludan_ll_1);
@@ -419,7 +427,7 @@ @@ -419,7 +427,7 @@
419 layer.msg("请选择时间"); 427 layer.msg("请选择时间");
420 }else if(zdlx=="" || zdlx==null){ 428 }else if(zdlx=="" || zdlx==null){
421 layer.msg("请选择方向"); 429 layer.msg("请选择方向");
422 - }else if(zd=="" || zd==null){ 430 + }else if(zd=="" || zd==null||zd==" "){
423 layer.msg("请选择站点"); 431 layer.msg("请选择站点");
424 }else{ 432 }else{
425 var xlmc="线路: "+$("#select2-line-container").html(); 433 var xlmc="线路: "+$("#select2-line-container").html();
@@ -557,8 +565,8 @@ @@ -557,8 +565,8 @@
557 整点 565 整点
558 {{/if}} 566 {{/if}}
559 ) 567 )
560 - <span class="in_carpark_fcsj" data-id="{{i+1}}" style="display:none">{{obj.fcsjActual}}</span>  
561 - <span class="in_carpark_zdsj" data-id="{{i+1}}" style="display:none">{{obj.zdsjActual}}</span> 568 + <span class="in_carpark_fcsj" data-id="{{i+1}}" style="display:none">{{obj.realExecDate}} {{obj.fcsjActual}}</span>
  569 + <span class="in_carpark_zdsj" data-id="{{i+1}}" style="display:none">{{obj.realExecDate}} {{obj.zdsjActual}}</span>
562 </a> 570 </a>
563 {{/if}} 571 {{/if}}
564 </td> 572 </td>
src/main/resources/static/real_control_v2/alone_page/map/alone_wrap.html
@@ -110,6 +110,7 @@ @@ -110,6 +110,7 @@
110 <!-- jquery.serializejson JSON序列化插件 --> 110 <!-- jquery.serializejson JSON序列化插件 -->
111 <script src="/assets/plugins/jquery.serializejson.js" merge="uikit_js"></script> 111 <script src="/assets/plugins/jquery.serializejson.js" merge="uikit_js"></script>
112 112
  113 +<script src="/assets/plugins/pinyin.js" merge="plugins"></script>
113 </body> 114 </body>
114 <script> 115 <script>
115 gb_data_gps.fixedTimeRefresh(); 116 gb_data_gps.fixedTimeRefresh();
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 <div class="uk-autocomplete uk-form " > 36 <div class="uk-autocomplete uk-form " >
37 <select name="abnormalStatus"> 37 <select name="abnormalStatus">
38 <option value="">全部</option> 38 <option value="">全部</option>
  39 + <option value="timeError">时间戳异常</option>
39 <option value="outBounds">越界</option> 40 <option value="outBounds">越界</option>
40 <option value="overspeed">超速</option> 41 <option value="overspeed">超速</option>
41 <option value="offline">离线</option> 42 <option value="offline">离线</option>
@@ -58,11 +59,11 @@ @@ -58,11 +59,11 @@
58 <th style="width: 14%;">站点</th> 59 <th style="width: 14%;">站点</th>
59 <th style="width: 11%;">车辆</th> 60 <th style="width: 11%;">车辆</th>
60 <th style="width: 11%;">设备号</th> 61 <th style="width: 11%;">设备号</th>
61 - <th style="width: 9%;">走向/营运</th> 62 + <th style="width: 12%;">走向/营运</th>
62 <th style="width: 9%;">程序版本</th> 63 <th style="width: 9%;">程序版本</th>
63 <th>最后GPS时间</th> 64 <th>最后GPS时间</th>
64 - <th style="width: 9%;">状态</th>  
65 - <th style="width: 8%;">来源</th> 65 + <th style="width: 8%;">状态</th>
  66 + <th style="width: 6%;">源</th>
66 </tr> 67 </tr>
67 </thead> 68 </thead>
68 <tbody> 69 <tbody>
@@ -81,7 +82,11 @@ @@ -81,7 +82,11 @@
81 <td>{{gps.stationName}}</td> 82 <td>{{gps.stationName}}</td>
82 <td>{{gps.nbbm}}</td> 83 <td>{{gps.nbbm}}</td>
83 <td>{{gps.deviceId}}</td> 84 <td>{{gps.deviceId}}</td>
84 - <td>{{gps.upDown}}/{{gps.state}}</td> 85 + <td>{{gps.upDown}}/{{gps.state}}
  86 + {{if gps.origStateStr!=null}}
  87 + (<span style="color: #fe6262;">{{gps.origStateStr}}</span>)
  88 + {{/if}}
  89 + </td>
85 <td>{{gps.version}}</td> 90 <td>{{gps.version}}</td>
86 <td>{{gps.timeStr}}</td> 91 <td>{{gps.timeStr}}</td>
87 <td> 92 <td>
@@ -95,18 +100,14 @@ @@ -95,18 +100,14 @@
95 <span class="sm-red">GPS (0,0)</span> 100 <span class="sm-red">GPS (0,0)</span>
96 {{else if gps.abnormalStatus=='offline'}} 101 {{else if gps.abnormalStatus=='offline'}}
97 <span>离线</span> 102 <span>离线</span>
  103 + {{else if gps.abnormalStatus=='timeError'}}
  104 + <span class="sm-red" title="设备时间戳异常,尝试以服务器时间修正">time_ex</span>
98 {{else}} 105 {{else}}
99 ... 106 ...
100 {{/if}} 107 {{/if}}
101 </td> 108 </td>
102 <td> 109 <td>
103 - {{if gps.source==1}}  
104 - <span style="color: #1e1ef5;" title="已切换至新网关">网关</span>  
105 - {{else if gps.source==0}}  
106 - <span style="color: #8e8e8e;" title="转接的数据,无法下发指令">转发</span>  
107 - {{else}}  
108 - <span class="sm-grey">未知</span>  
109 - {{/if}} 110 + <span class="sm-grey">{{gps.source}}</span>
110 </td> 111 </td>
111 </tr> 112 </tr>
112 {{/each}} 113 {{/each}}