Commit 562e97e26d0418fcd01ebf5ba280886159e8e4a0
1 parent
be1aec8c
update
Showing
13 changed files
with
67 additions
and
316 deletions
src/main/java/com/bsth/vehicle/BorrowCenter.java
| ... | ... | @@ -73,10 +73,10 @@ public class BorrowCenter { |
| 73 | 73 | @Override |
| 74 | 74 | public void run() { |
| 75 | 75 | logger.info("nbbm " + (type==0?"借出":"归还") + "线路代码 " + lineCode); |
| 76 | - directiveService.lineChange(nbbm, lineCode); | |
| 76 | + directiveService.lineChange(nbbm, lineCode, null); | |
| 77 | 77 | if(upDown != -1){ |
| 78 | 78 | //切换走向 |
| 79 | - directiveService.upDownChange(nbbm, upDown); | |
| 79 | + directiveService.upDownChange(nbbm, upDown, null); | |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
src/main/java/com/bsth/vehicle/directive/controller/DirectiveController.java
| ... | ... | @@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | 9 | import org.springframework.web.bind.annotation.RequestParam; |
| 10 | 10 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 11 | |
| 12 | +import com.bsth.entity.sys.SysUser; | |
| 13 | +import com.bsth.security.util.SecurityUtils; | |
| 12 | 14 | import com.bsth.vehicle.directive.entity.Directive80; |
| 13 | 15 | import com.bsth.vehicle.directive.service.DirectiveService; |
| 14 | 16 | |
| ... | ... | @@ -35,7 +37,8 @@ public class DirectiveController { |
| 35 | 37 | */ |
| 36 | 38 | @RequestMapping(value = "/phrase", method = RequestMethod.POST) |
| 37 | 39 | public int send60Phrase(@RequestParam String nbbm, @RequestParam String text){ |
| 38 | - return directiveService.send60Phrase(nbbm, text); | |
| 40 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 41 | + return directiveService.send60Phrase(nbbm, text, user.getUserName()); | |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | 44 | /** |
| ... | ... | @@ -47,7 +50,8 @@ public class DirectiveController { |
| 47 | 50 | */ |
| 48 | 51 | @RequestMapping(value = "/dispatch", method = RequestMethod.POST) |
| 49 | 52 | public int send60Dispatch(@RequestParam Long id){ |
| 50 | - return directiveService.send60Dispatch(id); | |
| 53 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 54 | + return directiveService.send60Dispatch(id, user.getUserName()); | |
| 51 | 55 | } |
| 52 | 56 | |
| 53 | 57 | /** |
| ... | ... | @@ -60,7 +64,8 @@ public class DirectiveController { |
| 60 | 64 | */ |
| 61 | 65 | @RequestMapping(value = "/lineChnage", method = RequestMethod.POST) |
| 62 | 66 | public int lineChange(@RequestParam String nbbm, @RequestParam Integer lineId){ |
| 63 | - return directiveService.lineChange(nbbm, lineId); | |
| 67 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 68 | + return directiveService.lineChange(nbbm, lineId, user.getUserName()); | |
| 64 | 69 | } |
| 65 | 70 | |
| 66 | 71 | /** |
| ... | ... | @@ -71,9 +76,10 @@ public class DirectiveController { |
| 71 | 76 | * @param @param upDon |
| 72 | 77 | * @throws |
| 73 | 78 | */ |
| 74 | - @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | |
| 79 | + @RequestMapping(value = "/upDownChange", method = RequestMethod.GET) | |
| 75 | 80 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ |
| 76 | - return directiveService.upDownChange(nbbm, upDown); | |
| 81 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 82 | + return directiveService.upDownChange(nbbm, upDown, user.getUserName()); | |
| 77 | 83 | } |
| 78 | 84 | |
| 79 | 85 | /** | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/Directive.java
| ... | ... | @@ -44,6 +44,11 @@ public class Directive { |
| 44 | 44 | private String errorText; |
| 45 | 45 | |
| 46 | 46 | private int httpCode; |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 发送人 | |
| 50 | + */ | |
| 51 | + private String sender; | |
| 47 | 52 | |
| 48 | 53 | public short getOperCode() { |
| 49 | 54 | return operCode; |
| ... | ... | @@ -100,4 +105,12 @@ public class Directive { |
| 100 | 105 | public void setHttpCode(int httpCode) { |
| 101 | 106 | this.httpCode = httpCode; |
| 102 | 107 | } |
| 108 | + | |
| 109 | + public String getSender() { | |
| 110 | + return sender; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setSender(String sender) { | |
| 114 | + this.sender = sender; | |
| 115 | + } | |
| 103 | 116 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/entity/Directive60.java
| ... | ... | @@ -13,7 +13,6 @@ import javax.persistence.Table; |
| 13 | 13 | import javax.persistence.Transient; |
| 14 | 14 | |
| 15 | 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 16 | -import com.bsth.entity.sys.SysUser; | |
| 17 | 16 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 18 | 17 | |
| 19 | 18 | |
| ... | ... | @@ -72,12 +71,6 @@ public class Directive60 extends Directive{ |
| 72 | 71 | @ManyToOne(fetch = FetchType.LAZY) |
| 73 | 72 | private ScheduleRealInfo sch; |
| 74 | 73 | |
| 75 | - /** | |
| 76 | - * 发送人 | |
| 77 | - */ | |
| 78 | - @ManyToOne | |
| 79 | - private SysUser sender; | |
| 80 | - | |
| 81 | 74 | @Embeddable |
| 82 | 75 | public static class DirectiveData { |
| 83 | 76 | // 公司代码 |
| ... | ... | @@ -271,12 +264,4 @@ public class Directive60 extends Directive{ |
| 271 | 264 | public void setSch(ScheduleRealInfo sch) { |
| 272 | 265 | this.sch = sch; |
| 273 | 266 | } |
| 274 | - | |
| 275 | - public SysUser getSender() { | |
| 276 | - return sender; | |
| 277 | - } | |
| 278 | - | |
| 279 | - public void setSender(SysUser sender) { | |
| 280 | - this.sender = sender; | |
| 281 | - } | |
| 282 | 267 | } | ... | ... |
src/main/java/com/bsth/vehicle/directive/service/DirectiveService.java
| ... | ... | @@ -20,7 +20,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ |
| 20 | 20 | * @return int 返回类型 |
| 21 | 21 | * @throws |
| 22 | 22 | */ |
| 23 | - int send60Phrase(String nbbm, String text); | |
| 23 | + int send60Phrase(String nbbm, String text, String sender); | |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * |
| ... | ... | @@ -30,7 +30,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ |
| 30 | 30 | * @param @param finish 已完成的班次数 |
| 31 | 31 | * @throws |
| 32 | 32 | */ |
| 33 | - int send60Dispatch(ScheduleRealInfo sch, int finish); | |
| 33 | + int send60Dispatch(ScheduleRealInfo sch, int finish, String sender); | |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * |
| ... | ... | @@ -39,10 +39,10 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ |
| 39 | 39 | * @param @param id 班次ID |
| 40 | 40 | * @throws |
| 41 | 41 | */ |
| 42 | - int send60Dispatch(Long id); | |
| 42 | + int send60Dispatch(Long id, String sender); | |
| 43 | 43 | |
| 44 | 44 | //60营运指令 |
| 45 | - int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch); | |
| 45 | + int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender); | |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * |
| ... | ... | @@ -52,7 +52,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ |
| 52 | 52 | * @param @param lineId 新线路编码 |
| 53 | 53 | * @throws |
| 54 | 54 | */ |
| 55 | - int lineChange(String nbbm, Integer lineId); | |
| 55 | + int lineChange(String nbbm, Integer lineId, String sender); | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * |
| ... | ... | @@ -62,7 +62,7 @@ public interface DirectiveService extends BaseService<Directive60, Integer>{ |
| 62 | 62 | * @param @param upDonw 上下行 0 上行 1 下行 |
| 63 | 63 | * @throws |
| 64 | 64 | */ |
| 65 | - int upDownChange(String nbbm, Integer upDown); | |
| 65 | + int upDownChange(String nbbm, Integer upDown, String sender); | |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * | ... | ... |
src/main/java/com/bsth/vehicle/directive/service/DirectiveServiceImpl.java
| ... | ... | @@ -69,7 +69,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 69 | 69 | static final short cityCode = 22; |
| 70 | 70 | |
| 71 | 71 | @Override |
| 72 | - public int send60Phrase(String nbbm, String text) { | |
| 72 | + public int send60Phrase(String nbbm, String text, String sender) { | |
| 73 | 73 | Directive60 directive = null; |
| 74 | 74 | try { |
| 75 | 75 | directive = create60Data(nbbm, text, (short) 0x00, null); |
| ... | ... | @@ -83,6 +83,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 83 | 83 | |
| 84 | 84 | // 发送指令 |
| 85 | 85 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| 86 | + if(null != sender) | |
| 87 | + directive.setSender(sender); | |
| 86 | 88 | directive.setHttpCode(code); |
| 87 | 89 | // 添加到缓存,等待入库 |
| 88 | 90 | DirectiveBuffer.put(directive); |
| ... | ... | @@ -95,7 +97,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | @Override |
| 98 | - public int send60Dispatch(ScheduleRealInfo sch, int finish) { | |
| 100 | + public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender) { | |
| 99 | 101 | Directive60 directive = null; |
| 100 | 102 | try { |
| 101 | 103 | // 如果发车时间距当前时间较远,则不发送 |
| ... | ... | @@ -115,6 +117,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 115 | 117 | |
| 116 | 118 | if (null == directive) |
| 117 | 119 | return -1; |
| 120 | + if(null != sender) | |
| 121 | + directive.setSender(sender); | |
| 122 | + else | |
| 123 | + directive.setSender("系统"); | |
| 118 | 124 | |
| 119 | 125 | // 发送指令 |
| 120 | 126 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| ... | ... | @@ -149,15 +155,15 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 149 | 155 | } |
| 150 | 156 | |
| 151 | 157 | @Override |
| 152 | - public int send60Dispatch(Long id) { | |
| 158 | + public int send60Dispatch(Long id, String sender) { | |
| 153 | 159 | ScheduleRealInfo sch = ScheduleBuffer.findOne(id); |
| 154 | 160 | // 车辆已完成班次 |
| 155 | 161 | int finish = ScheduleBuffer.getFinishSchNo(sch.getClZbh()); |
| 156 | - return send60Dispatch(sch, finish); | |
| 162 | + return send60Dispatch(sch, finish, sender); | |
| 157 | 163 | } |
| 158 | 164 | |
| 159 | 165 | @Override |
| 160 | - public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch) { | |
| 166 | + public int send60Operation(String nbbm, int state, int upDown, ScheduleRealInfo sch, String sender) { | |
| 161 | 167 | logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown); |
| 162 | 168 | |
| 163 | 169 | String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运"); |
| ... | ... | @@ -165,6 +171,10 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 165 | 171 | |
| 166 | 172 | if (null == directive) |
| 167 | 173 | return -1; |
| 174 | + if(null != sender) | |
| 175 | + directive.setSender(sender); | |
| 176 | + else | |
| 177 | + directive.setSender("系统"); | |
| 168 | 178 | // 发送指令 |
| 169 | 179 | int code = HttpUtils.postJson(JSON.toJSONString(directive)); |
| 170 | 180 | // 添加到缓存,等待入库 |
| ... | ... | @@ -184,7 +194,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 184 | 194 | * 线路切换 |
| 185 | 195 | */ |
| 186 | 196 | @Override |
| 187 | - public int lineChange(String nbbm, Integer lineId) { | |
| 197 | + public int lineChange(String nbbm, Integer lineId, String sender) { | |
| 188 | 198 | Long t = System.currentTimeMillis(); |
| 189 | 199 | String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm); |
| 190 | 200 | |
| ... | ... | @@ -198,6 +208,11 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 198 | 208 | change.setOperCode((short) 0X64); |
| 199 | 209 | change.setTimestamp(t); |
| 200 | 210 | change.setData(data); |
| 211 | + | |
| 212 | + if(null != sender) | |
| 213 | + change.setSender(sender); | |
| 214 | + else | |
| 215 | + change.setSender("系统"); | |
| 201 | 216 | |
| 202 | 217 | int code = HttpUtils.postJson(JSON.toJSONString(change)); |
| 203 | 218 | // 入库 |
| ... | ... | @@ -281,7 +296,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 281 | 296 | } |
| 282 | 297 | |
| 283 | 298 | @Override |
| 284 | - public int upDownChange(String nbbm, Integer upDown) { | |
| 299 | + public int upDownChange(String nbbm, Integer upDown, String sender) { | |
| 285 | 300 | /* |
| 286 | 301 | * Directive60 directive = createDirective60(nbbm, nbbm + "_" + upDown, |
| 287 | 302 | * (short) 0x03, upDown, 0); |
| ... | ... | @@ -292,7 +307,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<Directive60, Integer> |
| 292 | 307 | * == 0){ //添加到缓存,等待入库 DirectiveBuffer.put(directive); }else{ |
| 293 | 308 | * logger.error("send60 upDownChange error, code: " + code); } |
| 294 | 309 | */ |
| 295 | - return send60Operation(nbbm, 0, upDown, null); | |
| 310 | + return send60Operation(nbbm, 0, upDown, null, sender); | |
| 296 | 311 | } |
| 297 | 312 | |
| 298 | 313 | /** | ... | ... |
src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread_old.java deleted
100644 → 0
| 1 | -package com.bsth.vehicle.gpsdata; | |
| 2 | - | |
| 3 | -import java.sql.Connection; | |
| 4 | -import java.sql.PreparedStatement; | |
| 5 | -import java.sql.ResultSet; | |
| 6 | -import java.text.ParseException; | |
| 7 | -import java.text.SimpleDateFormat; | |
| 8 | -import java.util.ArrayList; | |
| 9 | -import java.util.Calendar; | |
| 10 | -import java.util.Date; | |
| 11 | -import java.util.Iterator; | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Set; | |
| 14 | - | |
| 15 | -import org.slf4j.Logger; | |
| 16 | -import org.slf4j.LoggerFactory; | |
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | -import org.springframework.stereotype.Component; | |
| 19 | - | |
| 20 | -import com.alibaba.fastjson.JSONObject; | |
| 21 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 22 | -import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | |
| 23 | -import com.bsth.util.DateUtils; | |
| 24 | -import com.bsth.util.db.DBUtils_MS; | |
| 25 | -import com.bsth.vehicle.directive.service.DirectiveService; | |
| 26 | -import com.bsth.vehicle.gpsdata.buffer.ArrivalDataBuffer; | |
| 27 | -import com.bsth.vehicle.gpsdata.entity.ArrivalInfo; | |
| 28 | -import com.bsth.websocket.handler.RealControlSocketHandler; | |
| 29 | - | |
| 30 | -/** | |
| 31 | - * | |
| 32 | - * @ClassName: GpsArrivalStationThread | |
| 33 | - * @Description: TODO(GPS到离站) | |
| 34 | - * @author PanZhao | |
| 35 | - * @date 2016年6月27日 上午10:58:13 | |
| 36 | - * | |
| 37 | - */ | |
| 38 | -@Component | |
| 39 | -public class GpsArrivalStationThread_old extends Thread{ | |
| 40 | - | |
| 41 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 42 | - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |
| 43 | - | |
| 44 | - @Autowired | |
| 45 | - DirectiveService directiveService; | |
| 46 | - | |
| 47 | - @Autowired | |
| 48 | - RealControlSocketHandler socketHandler; | |
| 49 | - | |
| 50 | - private static int diff = 1000 * 60 * 20; | |
| 51 | - | |
| 52 | - @Override | |
| 53 | - public void run() { | |
| 54 | - List<ArrivalInfo> list = null; | |
| 55 | - try { | |
| 56 | - list = loadData(); | |
| 57 | - } catch (ParseException e) { | |
| 58 | - e.printStackTrace(); | |
| 59 | - } | |
| 60 | - ArrivalDataBuffer.putAll(list); | |
| 61 | - //实际到离站和计划排班相匹配 | |
| 62 | - | |
| 63 | - Set<String> keySet = ArrivalDataBuffer.allMap.keySet(); | |
| 64 | - System.out.println("开始..."); | |
| 65 | - List<ScheduleRealInfo> schList; | |
| 66 | - for(String key : keySet){ | |
| 67 | - schList = extractSched(ScheduleBuffer.carSchListMap.get(key)); | |
| 68 | - if(null != schList) | |
| 69 | - match(ArrivalDataBuffer.allMap.get(key), schList); | |
| 70 | - } | |
| 71 | - System.out.println("结束..."); | |
| 72 | - } | |
| 73 | - | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * | |
| 77 | - * @Title: match | |
| 78 | - * @Description: TODO(实际和计划进行匹配) | |
| 79 | - * @param @param arrList 实际GPS到离站链表 | |
| 80 | - * @param @param schList 计划排班链表 | |
| 81 | - * @throws | |
| 82 | - */ | |
| 83 | - public void match(List<ArrivalInfo> arrList, List<ScheduleRealInfo> schList){ | |
| 84 | - Iterator<ScheduleRealInfo> schIterator = schList.iterator(); | |
| 85 | - | |
| 86 | - while(schIterator.hasNext()) | |
| 87 | - match(schIterator.next(), arrList); | |
| 88 | - } | |
| 89 | - | |
| 90 | - | |
| 91 | - public void match(ScheduleRealInfo scInfo, List<ArrivalInfo> arrList){ | |
| 92 | - for(ArrivalInfo arr : arrList){ | |
| 93 | - match(scInfo, arr); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - | |
| 97 | - public void match(ScheduleRealInfo scInfo, ArrivalInfo arr){ | |
| 98 | - try{ | |
| 99 | - //匹配起点 | |
| 100 | - matchStart(scInfo, arr); | |
| 101 | - | |
| 102 | - //匹配终点 | |
| 103 | - matchEnd(scInfo, arr); | |
| 104 | - }catch(Exception e){ | |
| 105 | - e.printStackTrace(); | |
| 106 | - } | |
| 107 | - } | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * | |
| 111 | - * @Title: matchStart | |
| 112 | - * @Description: TODO(匹配起点 出站时间) | |
| 113 | - * @param @param scInfo | |
| 114 | - * @throws | |
| 115 | - */ | |
| 116 | - public void matchStart(ScheduleRealInfo scInfo, ArrivalInfo arr){ | |
| 117 | - if(scInfo.getFcsjT() == null | |
| 118 | - || arr.getInOut() != 1 || scInfo.getFcsjActual() != null) | |
| 119 | - return; | |
| 120 | - | |
| 121 | - Long ts = arr.getTs(); | |
| 122 | - //起点站和发车时间比比较 | |
| 123 | - if(scInfo.getQdzCode().equals(arr.getStopNo()) | |
| 124 | - && Math.abs(scInfo.getFcsjT() - ts) < diff){ | |
| 125 | - scInfo.setFcsjActualTime(ts); | |
| 126 | - scInfo.setFcsjActual(sdf.format(ts)); | |
| 127 | - | |
| 128 | - System.out.println("成功匹配一个起点..."); | |
| 129 | - //班次状态改为正在执行 | |
| 130 | - scInfo.setStatus(1); | |
| 131 | - ScheduleBuffer.persistentList.add(scInfo); | |
| 132 | - //推送到页面 | |
| 133 | - sendFcsj(scInfo); | |
| 134 | - } | |
| 135 | - } | |
| 136 | - | |
| 137 | - /** | |
| 138 | - * @Title: sendFcsj | |
| 139 | - * @Description: TODO(推送发车信息) | |
| 140 | - * @param @param schedule 班次 | |
| 141 | - * @throws | |
| 142 | - */ | |
| 143 | - public void sendFcsj(ScheduleRealInfo schedule){ | |
| 144 | - JSONObject json = new JSONObject(); | |
| 145 | - json.put("fn", "faChe"); | |
| 146 | - json.put("t", schedule); | |
| 147 | - json.put("dataStr", sdf.format(new Date())); | |
| 148 | - socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | |
| 149 | - } | |
| 150 | - | |
| 151 | - /** | |
| 152 | - * | |
| 153 | - * @Title: matchEnd | |
| 154 | - * @Description: TODO(匹配终点 进站时间) | |
| 155 | - * @throws | |
| 156 | - */ | |
| 157 | - public void matchEnd(ScheduleRealInfo scInfo, ArrivalInfo arr){ | |
| 158 | - if(scInfo.getZdsjT() == null | |
| 159 | - || arr.getInOut() != 0 || scInfo.getZdsjActual() != null) | |
| 160 | - return; | |
| 161 | - | |
| 162 | - Long ts = arr.getTs(); | |
| 163 | - //终点站和发车时间比较 | |
| 164 | - if(scInfo.getZdzCode().equals(arr.getStopNo()) | |
| 165 | - && Math.abs(scInfo.getZdsjT() - ts) < diff){ | |
| 166 | - scInfo.setZdsjActualTime(ts); | |
| 167 | - scInfo.setZdsjActual(sdf.format(ts)); | |
| 168 | - | |
| 169 | - System.out.println("成功匹配一个终点..."); | |
| 170 | - //完成当前班次 | |
| 171 | - ScheduleRealInfo nextSch = ScheduleBuffer.finishSch(scInfo); | |
| 172 | - //到达终点,发送下一班次的调度指令 | |
| 173 | - int finish = ScheduleBuffer.getFinishSchNo(nextSch.getClZbh()); | |
| 174 | - directiveService.send60Dispatch(nextSch, finish); | |
| 175 | - //推送到页面 | |
| 176 | - sendZdsj(scInfo, nextSch, finish); | |
| 177 | - } | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * @Title: sendFcsj | |
| 182 | - * @Description: TODO(推送到达终点时间) | |
| 183 | - * @param @param schedule 班次 | |
| 184 | - * @throws | |
| 185 | - */ | |
| 186 | - public void sendZdsj(ScheduleRealInfo schedule,ScheduleRealInfo nextSch, int finish){ | |
| 187 | - JSONObject json = new JSONObject(); | |
| 188 | - json.put("fn", "zhongDian"); | |
| 189 | - json.put("t", schedule); | |
| 190 | - json.put("nt", nextSch); | |
| 191 | - json.put("finish", finish); | |
| 192 | - json.put("dataStr", sdf.format(new Date())); | |
| 193 | - | |
| 194 | - socketHandler.sendMessageToLine(Integer.parseInt(schedule.getXlBm()), json.toJSONString()); | |
| 195 | - } | |
| 196 | - | |
| 197 | - /** | |
| 198 | - * @throws ParseException | |
| 199 | - * | |
| 200 | - * @Title: loadData | |
| 201 | - * @Description: TODO(从数据库加载到离站信息) | |
| 202 | - * @return List<ArrivalInfo> 返回类型 | |
| 203 | - * @throws | |
| 204 | - */ | |
| 205 | - private List<ArrivalInfo> loadData() throws ParseException{ | |
| 206 | - Calendar cal = Calendar.getInstance(); | |
| 207 | - //周数,表分区字段 | |
| 208 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 209 | - //按时间标记增量加载 | |
| 210 | - if(null == ArrivalDataBuffer.markTime){ | |
| 211 | - //第一次从当天0点开始 | |
| 212 | - ArrivalDataBuffer.markTime = DateUtils.getTimesmorning() * 1000L; | |
| 213 | - } | |
| 214 | - | |
| 215 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and create_date > ? order by ts"; | |
| 216 | - | |
| 217 | - List<ArrivalInfo> list = new ArrayList<>(); | |
| 218 | - Connection conn = null; | |
| 219 | - PreparedStatement ps = null; | |
| 220 | - ResultSet rs = null; | |
| 221 | - try { | |
| 222 | - conn = DBUtils_MS.getConnection(); | |
| 223 | - ps = conn.prepareStatement(sql); | |
| 224 | - ps.setInt(1, weeks_year); | |
| 225 | - ps.setLong(2, ArrivalDataBuffer.markTime); | |
| 226 | - | |
| 227 | - Long t = System.currentTimeMillis(); | |
| 228 | - rs = ps.executeQuery(); | |
| 229 | - | |
| 230 | - while(rs.next()){ | |
| 231 | - list.add(new ArrivalInfo(rs.getString("device_id"), rs.getLong("ts"), rs.getString("line_id") | |
| 232 | - , rs.getInt("up_down"), rs.getString("stop_no"), rs.getInt("in_out"), rs.getLong("create_date"), rs.getInt("weeks_year"))); | |
| 233 | - } | |
| 234 | - | |
| 235 | - //重新打时间标记 | |
| 236 | - ArrivalDataBuffer.markTime = t; | |
| 237 | - | |
| 238 | - } catch (Exception e) { | |
| 239 | - logger.error("", e); | |
| 240 | - }finally { | |
| 241 | - DBUtils_MS.close(rs, ps, conn); | |
| 242 | - } | |
| 243 | - return list; | |
| 244 | - } | |
| 245 | - | |
| 246 | - Long rang = 1000 * 60 * 60L; | |
| 247 | - /** | |
| 248 | - * | |
| 249 | - * @Title: extractSched | |
| 250 | - * @Description: TODO(提取当前时间前后一小时的计划) | |
| 251 | - * @param @param allList | |
| 252 | - * @throws | |
| 253 | - */ | |
| 254 | - public List<ScheduleRealInfo> extractSched(List<ScheduleRealInfo> allList){ | |
| 255 | - List<ScheduleRealInfo> subList = new ArrayList<>(); | |
| 256 | - System.out.println("原计划:" + allList.size()); | |
| 257 | - Long t = System.currentTimeMillis(); | |
| 258 | - for(ScheduleRealInfo sch : allList){ | |
| 259 | - if(Math.abs(sch.getFcsjT() - t) < rang | |
| 260 | - || (sch.getZdsjT() != null && Math.abs(sch.getZdsjT()) - t < rang)){ | |
| 261 | - subList.add(sch); | |
| 262 | - } | |
| 263 | - } | |
| 264 | - System.out.println("按时间提取:" + subList.size()); | |
| 265 | - return subList; | |
| 266 | - } | |
| 267 | -} |
src/main/java/com/bsth/vehicle/gpsdata/arrival/match/ScheduleRealMatcher.java
| ... | ... | @@ -158,16 +158,16 @@ public class ScheduleRealMatcher implements ApplicationContextAware{ |
| 158 | 158 | |
| 159 | 159 | if(nextSch != null){ |
| 160 | 160 | //发送下一班次的调度指令 |
| 161 | - directiveService.send60Dispatch(nextSch, finish); | |
| 161 | + directiveService.send60Dispatch(nextSch, finish, null); | |
| 162 | 162 | upDown = Integer.parseInt(nextSch.getXlDir()); |
| 163 | 163 | //切换下一个班次的走向 |
| 164 | - directiveService.send60Operation(nextSch.getClZbh(), 0, upDown, nextSch); | |
| 164 | + directiveService.send60Operation(nextSch.getClZbh(), 0, upDown, nextSch, null); | |
| 165 | 165 | } |
| 166 | 166 | else{ |
| 167 | 167 | upDown = Integer.parseInt(sch.getXlDir()); |
| 168 | 168 | //没有下一个班次了,切换为非营运状态 |
| 169 | 169 | logger.info(sch.getClZbh() + " 完成所有班次,切换为非营运状态"); |
| 170 | - directiveService.send60Operation(sch.getClZbh(), 1, upDown, sch); | |
| 170 | + directiveService.send60Operation(sch.getClZbh(), 1, upDown, sch, null); | |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | sendZdsj(sch, nextSch, finish);//推送到页面 | ... | ... |
src/main/resources/fatso/start.js
| ... | ... | @@ -89,7 +89,7 @@ ep.tail('minifier-js', function(){ |
| 89 | 89 | |
| 90 | 90 | //打包 |
| 91 | 91 | ep.tail('package-jar', function(file){ |
| 92 | - var packageCom = 'mvn clean package'; | |
| 92 | + var packageCom = 'mvn clean package -DskipTests'; | |
| 93 | 93 | cProcess = child_process.exec(packageCom,{maxBuffer: 5000*1024, cwd: dest},function(error){ |
| 94 | 94 | if(error) |
| 95 | 95 | logError(error); | ... | ... |
src/main/resources/static/pages/control/line/child_pages/historyDirective.html
src/main/resources/static/pages/mapmonitor/real/real.html
| ... | ... | @@ -83,11 +83,11 @@ |
| 83 | 83 | |
| 84 | 84 | <div id="temps"></div> |
| 85 | 85 | |
| 86 | -<script src="/pages/mapmonitor/real/js/map_platform.js"></script> | |
| 87 | -<script src="/pages/mapmonitor/real/js/vehicle.js"></script> | |
| 88 | -<script src="/pages/mapmonitor/real/js/search.js"></script> | |
| 89 | -<script src="/pages/mapmonitor/real/js/temp.js"></script> | |
| 90 | -<script src="/pages/mapmonitor/real/js/real.js"></script> | |
| 91 | -<script src="/pages/mapmonitor/real/js/playBack.js"></script> | |
| 86 | +<script src="/pages/mapmonitor/real/js/map_platform.js" data-exclude=1></script> | |
| 87 | +<script src="/pages/mapmonitor/real/js/vehicle.js" data-exclude=1></script> | |
| 88 | +<script src="/pages/mapmonitor/real/js/search.js" data-exclude=1></script> | |
| 89 | +<script src="/pages/mapmonitor/real/js/temp.js" data-exclude=1></script> | |
| 90 | +<script src="/pages/mapmonitor/real/js/real.js" data-exclude=1></script> | |
| 91 | +<script src="/pages/mapmonitor/real/js/playBack.js" data-exclude=1></script> | |
| 92 | 92 | <script> |
| 93 | 93 | </script> | ... | ... |