Commit 2d3c0cc01579bfd6bdba237cf7607b15d500bfbd
1 parent
a917eba4
update...
Showing
7 changed files
with
81 additions
and
24 deletions
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| @@ -5,6 +5,7 @@ import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | @@ -5,6 +5,7 @@ import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 5 | import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | 5 | import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; |
| 6 | import com.bsth.data.msg_queue.DirectivePushQueue; | 6 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 7 | import com.bsth.data.msg_queue.WebSocketPushQueue; | 7 | import com.bsth.data.msg_queue.WebSocketPushQueue; |
| 8 | +import com.bsth.data.pilot80.PilotReport; | ||
| 8 | import com.bsth.data.schedule.DayOfSchedule; | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | import com.bsth.websocket.handler.SendUtils; | 11 | import com.bsth.websocket.handler.SendUtils; |
| @@ -41,6 +42,9 @@ public class AdminUtilsController { | @@ -41,6 +42,9 @@ public class AdminUtilsController { | ||
| 41 | @Autowired | 42 | @Autowired |
| 42 | SendUtils sendUtils; | 43 | SendUtils sendUtils; |
| 43 | 44 | ||
| 45 | + @Autowired | ||
| 46 | + PilotReport pilotReport; | ||
| 47 | + | ||
| 44 | /** | 48 | /** |
| 45 | * 出现重复班次的车辆 | 49 | * 出现重复班次的车辆 |
| 46 | * @param | 50 | * @param |
| @@ -132,6 +136,7 @@ public class AdminUtilsController { | @@ -132,6 +136,7 @@ public class AdminUtilsController { | ||
| 132 | public Map<String, Integer> containerSize(){ | 136 | public Map<String, Integer> containerSize(){ |
| 133 | Map<String, Integer> rs = new HashMap<>(); | 137 | Map<String, Integer> rs = new HashMap<>(); |
| 134 | rs.put("60_size", dayOfDirectives.all60().size()); | 138 | rs.put("60_size", dayOfDirectives.all60().size()); |
| 139 | + rs.put("80_size", pilotReport.findAll().size()); | ||
| 135 | rs.put("nbbm_sch_size", dayOfSchedule.findAll().size()); | 140 | rs.put("nbbm_sch_size", dayOfSchedule.findAll().size()); |
| 136 | rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size()); | 141 | rs.put("lp_sch_size", dayOfSchedule.findAllByLpContainer().size()); |
| 137 | rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); | 142 | rs.put("id_sch_size", dayOfSchedule.findAllByIdContainer().size()); |
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/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(); |
| @@ -60,6 +60,8 @@ public class OverspeedProcess { | @@ -60,6 +60,8 @@ public class OverspeedProcess { | ||
| 60 | 60 | ||
| 61 | realOverspeedMap = null; | 61 | realOverspeedMap = null; |
| 62 | realOverspeedMap = new HashMap(); | 62 | realOverspeedMap = new HashMap(); |
| 63 | + | ||
| 64 | + logger.info("清理超速缓存数据,,,"); | ||
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | public boolean process(GpsEntity gps){ | 67 | public boolean process(GpsEntity gps){ |
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/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -698,13 +698,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<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); |