Commit c22797cfa94358b51410607db5f7755e5fd73858

Authored by 廖磊
2 parents 42e55421 d7124004

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Too many changes to show.

To preserve performance only 13 of 32 files are displayed.

1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 2 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 3
4 <modelVersion>4.0.0</modelVersion> 4 <modelVersion>4.0.0</modelVersion>
5 <groupId>com.bsth</groupId> 5 <groupId>com.bsth</groupId>
@@ -237,27 +237,33 @@ @@ -237,27 +237,33 @@
237 <version>1.13</version> 237 <version>1.13</version>
238 </dependency> 238 </dependency>
239 239
240 - <dependency>  
241 - <groupId>org.dbunit</groupId>  
242 - <artifactId>dbunit</artifactId>  
243 - <version>2.4.9</version>  
244 - <scope>test</scope> 240 + <dependency>
  241 + <groupId>org.dbunit</groupId>
  242 + <artifactId>dbunit</artifactId>
  243 + <version>2.4.9</version>
  244 + <scope>test</scope>
245 245
246 - <exclusions>  
247 - <exclusion>  
248 - <groupId>org.slf4j</groupId>  
249 - <artifactId>slf4j-api</artifactId>  
250 - </exclusion>  
251 - </exclusions>  
252 - </dependency> 246 + <exclusions>
  247 + <exclusion>
  248 + <groupId>org.slf4j</groupId>
  249 + <artifactId>slf4j-api</artifactId>
  250 + </exclusion>
  251 + </exclusions>
  252 + </dependency>
  253 +
  254 + <dependency>
  255 + <groupId>com.h2database</groupId>
  256 + <artifactId>h2</artifactId>
  257 + <version>1.2.132</version>
  258 + <scope>test</scope>
  259 + </dependency>
253 260
254 - <dependency>  
255 - <groupId>com.h2database</groupId>  
256 - <artifactId>h2</artifactId>  
257 - <version>1.2.132</version>  
258 - <scope>test</scope>  
259 - </dependency>  
260 261
  262 + <dependency>
  263 + <groupId>ojdbc</groupId>
  264 + <artifactId>ojdbc</artifactId>
  265 + <version>14</version>
  266 + </dependency>
261 </dependencies> 267 </dependencies>
262 268
263 <dependencyManagement> 269 <dependencyManagement>
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -543,4 +543,25 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -543,4 +543,25 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
543 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); 543 rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR);
544 return rs; 544 return rs;
545 } 545 }
  546 +
  547 + /**
  548 + * 误点调整
  549 + * @param idx
  550 + * @param minute
  551 + * @return
  552 + */
  553 + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST)
  554 + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){
  555 + return scheduleRealInfoService.lateAdjust(idx, minute);
  556 + }
  557 +
  558 + /**
  559 + * 获取所有应发未到的班次
  560 + * @param idx
  561 + * @return
  562 + */
  563 + @RequestMapping(value = "allLate2")
  564 + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){
  565 + return scheduleRealInfoService.allLate2(idx);
  566 + }
546 } 567 }
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; @@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState;
8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; 8 import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher;
9 import com.bsth.data.schedule.DayOfSchedule; 9 import com.bsth.data.schedule.DayOfSchedule;
10 import com.bsth.data.schedule.ScheduleComparator; 10 import com.bsth.data.schedule.ScheduleComparator;
  11 +import com.bsth.data.schedule.late_adjust.LateAdjustHandle;
11 import com.bsth.entity.realcontrol.LineConfig; 12 import com.bsth.entity.realcontrol.LineConfig;
12 import com.bsth.entity.realcontrol.ScheduleRealInfo; 13 import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 import com.bsth.service.directive.DirectiveService; 14 import com.bsth.service.directive.DirectiveService;
@@ -145,6 +146,9 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -145,6 +146,9 @@ public class InOutStationSignalHandle extends SignalHandle{
145 //持久化 146 //持久化
146 dayOfSchedule.save(sch); 147 dayOfSchedule.save(sch);
147 148
  149 + //清理应发未发标记
  150 + LateAdjustHandle.remove(sch);
  151 +
148 if(sch.getBcType().equals("out")){ 152 if(sch.getBcType().equals("out")){
149 //出场时,切换成营运状态 153 //出场时,切换成营运状态
150 directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); 154 directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统");
@@ -242,6 +246,10 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -242,6 +246,10 @@ public class InOutStationSignalHandle extends SignalHandle{
242 long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); 246 long rsT = lineConfigData.applyIn(sch, gps.getTimestamp());
243 247
244 sch.setZdsjActualAll(rsT); 248 sch.setZdsjActualAll(rsT);
  249 +
  250 + //通知误点停靠程序,有车辆到站
  251 + LateAdjustHandle.carArrive(gps);
  252 +
245 //已完成班次数 253 //已完成班次数
246 int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); 254 int doneSum = dayOfSchedule.doneSum(sch.getClZbh());
247 ScheduleRealInfo next = dayOfSchedule.next(sch); 255 ScheduleRealInfo next = dayOfSchedule.next(sch);
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -154,10 +154,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -154,10 +154,10 @@ public class DayOfSchedule implements CommandLineRunner {
154 diff += (1000 * 60 * 60 * 24); 154 diff += (1000 * 60 * 60 * 24);
155 155
156 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); 156 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处");
157 - //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 157 + //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
158 158
159 //计算油、公里加注 159 //计算油、公里加注
160 - Application.mainServices.scheduleWithFixedDelay(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); 160 + Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
161 161
162 //指令持久化线程 162 //指令持久化线程
163 Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); 163 Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
1 1
2 package com.bsth.data.schedule.late_adjust; 2 package com.bsth.data.schedule.late_adjust;
3 3
  4 +import com.bsth.data.LineConfigData;
  5 +import com.bsth.data.gpsdata.GpsEntity;
  6 +import com.bsth.entity.realcontrol.LineConfig;
4 import com.bsth.entity.realcontrol.ScheduleRealInfo; 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.websocket.handler.SendUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.BeansException;
  12 +import org.springframework.context.ApplicationContext;
  13 +import org.springframework.context.ApplicationContextAware;
  14 +import org.springframework.stereotype.Component;
5 15
  16 +import java.util.Collection;
  17 +import java.util.HashMap;
6 import java.util.Map; 18 import java.util.Map;
7 19
8 /** 20 /**
9 - * 误点调整处理程序 21 + * 误点自动调整待发 处理程序
  22 + *
  23 + * 注意 :这里的误点是指应发未到
10 * Created by panzhao on 2017/4/16. 24 * Created by panzhao on 2017/4/16.
11 */ 25 */
12 -public class LateAdjustHandle { 26 +@Component
  27 +public class LateAdjustHandle implements ApplicationContextAware{
  28 +
  29 + static LineConfigData lineConfigData;
  30 + static SendUtils sendUtils;
  31 +
  32 + static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class);
13 33
14 /** 34 /**
15 - * 误点的车辆 和 班次 35 + * 应发未到车辆 和 班次
16 */ 36 */
17 private static Map<String, ScheduleRealInfo> lateSchMap; 37 private static Map<String, ScheduleRealInfo> lateSchMap;
18 38
19 39
  40 + static {
  41 + lateSchMap = new HashMap<>();
  42 + }
  43 +
20 /** 44 /**
21 - * 误点的班次ID 和 停靠时间(秒) 45 + * 新增一个误点班次
  46 + * @param sch
22 */ 47 */
23 - private static Map<Long, Integer> stopTimeMap; 48 + public static void putLate(ScheduleRealInfo sch){
  49 + try {
  50 + //线路配置
  51 + LineConfig config = lineConfigData.get(sch.getXlBm());
  52 + if(sch.getLateMinute() == 0){
  53 + if(config.isEnableYjtk()){
  54 + sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute());
  55 + }
  56 + else
  57 + return;
  58 + }
  59 +
  60 + if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0
  61 + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){
  62 +
  63 + ScheduleRealInfo cancel = null;
  64 + //之前存在误点班次没有发出
  65 + ScheduleRealInfo old = lateSchMap.get(sch.getClZbh());
  66 + if(old != null && old.getDfsjT() < sch.getDfsjT()){
  67 + remove(old);
  68 + cancel = old;
  69 + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");
  70 + }
  71 +
  72 + lateSchMap.put(sch.getClZbh(), sch);
  73 + //通知客户端
  74 + sch.setLate2(true);
  75 + sendUtils.sendAutoWdtz(sch, cancel);
  76 +
  77 + logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!");
  78 + }
  79 + }catch (Exception e){
  80 + logger.error("", e);
  81 + }
  82 + }
24 83
25 84
26 /** 85 /**
27 - * 班次误点(考虑停靠时间)  
28 - * @param sch 86 + * 获取所有应发未到的班次
  87 + * @return
29 */ 88 */
30 - public static void schLate(ScheduleRealInfo sch){ 89 + public static Collection<ScheduleRealInfo> allLateSch(){
  90 + return lateSchMap.values();
  91 + }
  92 +
  93 + public static void remove(ScheduleRealInfo sch){
  94 + try {
  95 + if(lateSchMap.get(sch.getClZbh()) == sch){
  96 + lateSchMap.remove(sch.getClZbh());
  97 + sch.setLate2(false);
  98 + sch.setLateMinute(0);
  99 + }
  100 + }catch (Exception e){
  101 + logger.error("", e);
  102 + }
  103 + }
  104 +
  105 + /**
  106 + * 车辆到站
  107 + * @param gps
  108 + */
  109 + public static void carArrive(GpsEntity gps){
  110 + try{
  111 + if(gps.getInstation() != 1)
  112 + return;
  113 +
  114 + ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm());
  115 + if(sch == null)
  116 + return;
  117 +
  118 + //进的是班次起点
  119 + if(gps.getStopNo().equals(sch.getQdzCode())
  120 + && sch.getLateMinute() > 0){
  121 + //自动调整待发 到达时间 + 停靠时间
  122 + long dt = gps.getTimestamp() + (Long.parseLong(String.valueOf(sch.getLateMinute() * 60 * 1000)));
  123 + sch.setDfsjAll(dt);
  124 + sch.setDfAuto(true);
  125 +
  126 + lateSchMap.remove(sch.getClZbh());
  127 + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt);
  128 + }
  129 + }catch (Exception e){
  130 + logger.error("", e);
  131 + }
  132 + }
31 133
  134 + @Override
  135 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  136 + lineConfigData = applicationContext.getBean(LineConfigData.class);
  137 + sendUtils = applicationContext.getBean(SendUtils.class);
32 } 138 }
33 -} 139 +}
34 \ No newline at end of file 140 \ No newline at end of file
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
@@ -5,6 +5,7 @@ import com.bsth.data.schedule.DayOfSchedule; @@ -5,6 +5,7 @@ import com.bsth.data.schedule.DayOfSchedule;
5 import com.bsth.data.schedule.ScheduleComparator; 5 import com.bsth.data.schedule.ScheduleComparator;
6 import com.bsth.entity.realcontrol.ScheduleRealInfo; 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 import com.bsth.websocket.handler.SendUtils; 7 import com.bsth.websocket.handler.SendUtils;
  8 +import org.apache.commons.lang3.StringUtils;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
10 11
@@ -14,10 +15,10 @@ import java.util.Comparator; @@ -14,10 +15,10 @@ import java.util.Comparator;
14 import java.util.List; 15 import java.util.List;
15 16
16 /** 17 /**
17 - *  
18 - * @ClassName: ScheduleLateThread  
19 - * @Description: TODO(班次误点扫描线程)  
20 - * @author PanZhao 18 + *
  19 + * @ClassName: ScheduleLateThread
  20 + * @Description: TODO(班次误点扫描线程)
  21 + * @author PanZhao
21 * @date 2016年8月31日 下午3:09:02 22 * @date 2016年8月31日 下午3:09:02
22 * 23 *
23 */ 24 */
@@ -26,29 +27,39 @@ public class ScheduleLateThread extends Thread{ @@ -26,29 +27,39 @@ public class ScheduleLateThread extends Thread{
26 27
27 @Autowired 28 @Autowired
28 DayOfSchedule dayOfSchedule; 29 DayOfSchedule dayOfSchedule;
29 - 30 +
30 @Autowired 31 @Autowired
31 SendUtils sendUtils; 32 SendUtils sendUtils;
32 - 33 +
33 private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ(); 34 private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ();
34 - 35 +
35 @Override 36 @Override
36 public void run() { 37 public void run() {
37 List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); 38 List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
38 Collections.sort(all, cpm); 39 Collections.sort(all, cpm);
39 - 40 +
40 long t = System.currentTimeMillis(); 41 long t = System.currentTimeMillis();
41 int size = all.size(); 42 int size = all.size();
42 - 43 +
43 ScheduleRealInfo sch; 44 ScheduleRealInfo sch;
44 for(int i = 0; i < size; i ++){ 45 for(int i = 0; i < size; i ++){
45 sch = all.get(i); 46 sch = all.get(i);
46 - if(sch.getDfsjT() > t) 47 + if(sch.getDfsjT() > t || sch.isLate())
47 break; 48 break;
48 -  
49 - if(sch.isLate() == false  
50 - && sch.getStatus() == 0 49 +
  50 + if(sch.getStatus() == 0
51 && sch.getFcsjActual() == null){ 51 && sch.getFcsjActual() == null){
  52 +
  53 + //检查应发未到 当前班次无起点到达时间
  54 + if(StringUtils.isEmpty(sch.getQdzArrDateSJ())){
  55 + ScheduleRealInfo prev = dayOfSchedule.prev(sch);
  56 + //上一个班次也没有实际终点到达时间
  57 + if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){
  58 + //进入误点调整程序
  59 + LateAdjustHandle.putLate(sch);
  60 + }
  61 + }
  62 +
52 //应发未发 63 //应发未发
53 sch.setLate(true); 64 sch.setLate(true);
54 //通知客户端 65 //通知客户端
@@ -56,4 +67,4 @@ public class ScheduleLateThread extends Thread{ @@ -56,4 +67,4 @@ public class ScheduleLateThread extends Thread{
56 } 67 }
57 } 68 }
58 } 69 }
59 -} 70 +}
60 \ No newline at end of file 71 \ No newline at end of file
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
@@ -82,7 +82,9 @@ public class LineConfig { @@ -82,7 +82,9 @@ public class LineConfig {
82 * 应急停靠 82 * 应急停靠
83 */ 83 */
84 private boolean enableYjtk; 84 private boolean enableYjtk;
  85 + /** HH:mm */
85 private String yjtkStart; 86 private String yjtkStart;
  87 + /** HH:mm */
86 private String yjtkEnd; 88 private String yjtkEnd;
87 private int upStopMinute; 89 private int upStopMinute;
88 private int downStopMinute; 90 private int downStopMinute;
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java
@@ -21,6 +21,11 @@ public class OilStationSociety { @@ -21,6 +21,11 @@ public class OilStationSociety {
21 private String stationName; 21 private String stationName;
22 22
23 /** 23 /**
  24 + * 加油站编码(为空则默认社会加油站)
  25 + */
  26 + private String stationCode;
  27 +
  28 + /**
24 * 上行进场距离 29 * 上行进场距离
25 */ 30 */
26 private Double upInMile; 31 private Double upInMile;
@@ -137,4 +142,12 @@ public class OilStationSociety { @@ -137,4 +142,12 @@ public class OilStationSociety {
137 public void setDownOutTime(int downOutTime) { 142 public void setDownOutTime(int downOutTime) {
138 this.downOutTime = downOutTime; 143 this.downOutTime = downOutTime;
139 } 144 }
  145 +
  146 + public String getStationCode() {
  147 + return stationCode;
  148 + }
  149 +
  150 + public void setStationCode(String stationCode) {
  151 + this.stationCode = stationCode;
  152 + }
140 } 153 }
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -139,10 +139,17 @@ public class ScheduleRealInfo { @@ -139,10 +139,17 @@ public class ScheduleRealInfo {
139 /** 是否是临加班次 */ 139 /** 是否是临加班次 */
140 private boolean sflj; 140 private boolean sflj;
141 141
142 - /** 是否误点*/ 142 + /** 是否误点 (应发未发)*/
143 @Transient 143 @Transient
144 private boolean late; 144 private boolean late;
145 145
  146 + /** 是否误点 (应发未到) */
  147 + @Transient
  148 + private boolean late2;
  149 + /** 误点停靠时间 */
  150 + @Transient
  151 + private float lateMinute;
  152 +
146 /** 备注*/ 153 /** 备注*/
147 private String remarks; 154 private String remarks;
148 155
@@ -887,4 +894,20 @@ public class ScheduleRealInfo { @@ -887,4 +894,20 @@ public class ScheduleRealInfo {
887 public void setRemark(String remark) { 894 public void setRemark(String remark) {
888 this.remark = remark; 895 this.remark = remark;
889 } 896 }
  897 +
  898 + public float getLateMinute() {
  899 + return lateMinute;
  900 + }
  901 +
  902 + public void setLateMinute(float lateMinute) {
  903 + this.lateMinute = lateMinute;
  904 + }
  905 +
  906 + public boolean isLate2() {
  907 + return late2;
  908 + }
  909 +
  910 + public void setLate2(boolean late2) {
  911 + this.late2 = late2;
  912 + }
890 } 913 }
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -161,4 +161,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -161,4 +161,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
161 void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type); 161 void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
162 162
163 Map<String,Object> revokeRealArrive(Long id); 163 Map<String,Object> revokeRealArrive(Long id);
  164 +
  165 + Map<String,Object> lateAdjust(String idx, float minute);
  166 +
  167 + List<ScheduleRealInfo> allLate2(String idx);
164 } 168 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -14,6 +14,7 @@ import com.bsth.data.LineConfigData; @@ -14,6 +14,7 @@ import com.bsth.data.LineConfigData;
14 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
15 import com.bsth.data.schedule.SchAttrCalculator; 15 import com.bsth.data.schedule.SchAttrCalculator;
16 import com.bsth.data.schedule.ScheduleComparator; 16 import com.bsth.data.schedule.ScheduleComparator;
  17 +import com.bsth.data.schedule.late_adjust.LateAdjustHandle;
17 import com.bsth.entity.Cars; 18 import com.bsth.entity.Cars;
18 import com.bsth.entity.Line; 19 import com.bsth.entity.Line;
19 import com.bsth.entity.Personnel; 20 import com.bsth.entity.Personnel;
@@ -177,6 +178,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -177,6 +178,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
177 schedule.setDfsjAll(dfsj); 178 schedule.setDfsjAll(dfsj);
178 schedule.addRemarks(remarks); 179 schedule.addRemarks(remarks);
179 180
  181 + //取消应发未到标记
  182 + if(schedule.isLate2()){
  183 + schedule.setLate2(false);
  184 + LateAdjustHandle.remove(schedule);
  185 + }
  186 +
180 List<ScheduleRealInfo> ts = new ArrayList<>(); 187 List<ScheduleRealInfo> ts = new ArrayList<>();
181 ts.add(schedule); 188 ts.add(schedule);
182 //调整终点时间和下一个班次的应到时间 189 //调整终点时间和下一个班次的应到时间
@@ -827,9 +834,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -827,9 +834,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
827 sch.setFcsjActualAll(fcsjActual); 834 sch.setFcsjActualAll(fcsjActual);
828 sch.addRemarks(remarks); 835 sch.addRemarks(remarks);
829 sch.calcStatus(); 836 sch.calcStatus();
  837 + if(sch.isLate2()){
  838 + //取消应发未到标记
  839 + sch.setLate2(false);
  840 + LateAdjustHandle.remove(sch);
  841 + }
830 842
831 dayOfSchedule.save(sch); 843 dayOfSchedule.save(sch);
832 - //scheduleRealInfoRepository.save(sch);  
833 844
834 ts.add(sch); 845 ts.add(sch);
835 846
@@ -1016,8 +1027,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1016,8 +1027,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1016 t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual); 1027 t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);
1017 1028
1018 //调整实发 1029 //调整实发
1019 - if (!fcsjActual.equals(sch.getFcsjActual())) 1030 + if (!fcsjActual.equals(sch.getFcsjActual())){
1020 sch.setFcsjActualAll(t); 1031 sch.setFcsjActualAll(t);
  1032 +
  1033 + //取消应发未到标记
  1034 + if(sch.isLate2()){
  1035 + sch.setLate2(false);
  1036 + LateAdjustHandle.remove(sch);
  1037 + }
  1038 + }
1021 } else { 1039 } else {
1022 //撤销实发 1040 //撤销实发
1023 if (sch.getFcsjActual() != null) 1041 if (sch.getFcsjActual() != null)
@@ -1108,6 +1126,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1108,6 +1126,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1108 //重新计算是否误点 1126 //重新计算是否误点
1109 schedule.reCalcLate(); 1127 schedule.reCalcLate();
1110 1128
  1129 + //取消应发未到标记
  1130 + if(schedule.isLate2()){
  1131 + schedule.setLate2(false);
  1132 + LateAdjustHandle.remove(schedule);
  1133 + }
1111 dayOfSchedule.save(schedule); 1134 dayOfSchedule.save(schedule);
1112 } 1135 }
1113 1136
@@ -4127,4 +4150,53 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4127,4 +4150,53 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4127 } 4150 }
4128 return rs; 4151 return rs;
4129 } 4152 }
  4153 +
  4154 + @Override
  4155 + public Map<String, Object> lateAdjust(String idx, float minute) {
  4156 + Map<String, Object> rs = new HashMap<>();
  4157 + try {
  4158 + int count = 0;
  4159 + List<ScheduleRealInfo> list = new ArrayList<>();
  4160 + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx);
  4161 +
  4162 + ScheduleRealInfo sch;
  4163 + for(String id : ids){
  4164 + sch = dayOfSchedule.get(Long.parseLong(id));
  4165 + if(sch != null && sch.getStatus() == 0){
  4166 + if(minute > 0){
  4167 + sch.setLateMinute(minute);
  4168 + }
  4169 + else if(minute == 0){
  4170 + LateAdjustHandle.remove(sch);
  4171 + }
  4172 + count ++;
  4173 + list.add(sch);
  4174 + }
  4175 + }
  4176 +
  4177 + rs.put("status", ResponseCode.SUCCESS);
  4178 + rs.put("count", count);
  4179 + rs.put("ts", list);
  4180 + }catch (Exception e){
  4181 + logger.error("", e);
  4182 + rs.put("status", ResponseCode.ERROR);
  4183 + rs.put("msg", e.getMessage());
  4184 + }
  4185 +
  4186 + return rs;
  4187 + }
  4188 +
  4189 + @Override
  4190 + public List<ScheduleRealInfo> allLate2(String idx) {
  4191 + List<ScheduleRealInfo> rs = new ArrayList<>();
  4192 + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx);
  4193 +
  4194 + Collection<ScheduleRealInfo> all = LateAdjustHandle.allLateSch();
  4195 + for(ScheduleRealInfo sch : all){
  4196 + if(ids.indexOf(sch.getXlBm()) != -1){
  4197 + rs.add(sch);
  4198 + }
  4199 + }
  4200 + return rs;
  4201 + }
4130 } 4202 }
4131 \ No newline at end of file 4203 \ No newline at end of file
src/main/java/com/bsth/websocket/handler/SendUtils.java
@@ -176,7 +176,7 @@ public class SendUtils{ @@ -176,7 +176,7 @@ public class SendUtils{
176 public void deviceOffline(GpsEntity gps){ 176 public void deviceOffline(GpsEntity gps){
177 Map<String, Object> map = new HashMap<>(); 177 Map<String, Object> map = new HashMap<>();
178 map.put("fn", "deviceOffline"); 178 map.put("fn", "deviceOffline");
179 - map.put("gps", gps);; 179 + map.put("gps", gps);
180 ObjectMapper mapper = new ObjectMapper(); 180 ObjectMapper mapper = new ObjectMapper();
181 181
182 try { 182 try {
@@ -199,4 +199,26 @@ public class SendUtils{ @@ -199,4 +199,26 @@ public class SendUtils{
199 logger.error("", e); 199 logger.error("", e);
200 } 200 }
201 } 201 }
  202 +
  203 + /**
  204 + * 通知客户端,开始进行误点调整
  205 + * @param sch
  206 + */
  207 + public void sendAutoWdtz(ScheduleRealInfo sch, ScheduleRealInfo cancel){
  208 + Map<String, Object> map = new HashMap<>();
  209 + map.put("fn", "auto_wdtz");
  210 + map.put("id", sch.getId());
  211 + if(cancel != null)
  212 + map.put("cancelId", cancel.getId());
  213 + map.put("lineCode", sch.getXlBm());
  214 + map.put("minute", sch.getLateMinute());
  215 + ObjectMapper mapper = new ObjectMapper();
  216 +
  217 + try {
  218 + socketHandler.sendMessageToLine(sch.getXlBm() ,mapper.writeValueAsString(map));
  219 +
  220 + } catch (JsonProcessingException e) {
  221 + logger.error("", e);
  222 + }
  223 + }
202 } 224 }
src/main/resources/static/assets/js/common.js
@@ -204,6 +204,6 @@ function createVehSearch($e){ @@ -204,6 +204,6 @@ function createVehSearch($e){
204 return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; 204 return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
205 } 205 }
206 } 206 }
207 - }) 207 + });
208 return $e; 208 return $e;
209 } 209 }