Commit 5422a8e29b66ebb6fb5bcaf30416d897312a2b82

Authored by 潘钊
1 parent dbe5d3c8

update

Showing 33 changed files with 772 additions and 55 deletions
src/main/java/com/bsth/StartCommand.java
... ... @@ -5,8 +5,9 @@ import com.bsth.security.SecurityMetadataSourceService;
5 5 import com.bsth.service.realcontrol.buffer.GetSchedulePlanThread;
6 6 import com.bsth.service.realcontrol.buffer.SchedulePersistenceThread;
7 7 import com.bsth.vehicle.common.CommonRefreshThread;
8   -import com.bsth.vehicle.directive.DirectivePersistenceThread;
9   -import com.bsth.vehicle.directive.FirstScheduleIssuedThread;
  8 +import com.bsth.vehicle.directive.thread.DirectivePersistenceThread;
  9 +import com.bsth.vehicle.directive.thread.FirstScheduleIssuedThread;
  10 +import com.bsth.vehicle.directive.thread.RevertLineThread;
10 11 import com.bsth.vehicle.gpsdata.GpsArrivalStationThread;
11 12 import com.bsth.vehicle.gpsdata.GpsRefreshThread;
12 13 import org.slf4j.Logger;
... ... @@ -32,7 +33,7 @@ public class StartCommand implements CommandLineRunner{
32 33 @Autowired
33 34 SecurityMetadataSourceService invocationSecurityMetadataSourceService;
34 35  
35   - public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(7);
  36 + public static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(8);
36 37  
37 38 @Autowired
38 39 GpsRefreshThread gpsRefreshThread;
... ... @@ -48,6 +49,8 @@ public class StartCommand implements CommandLineRunner{
48 49 GpsArrivalStationThread gpsArrivalStationThread;
49 50 @Autowired
50 51 FirstScheduleIssuedThread firstScheduleIssuedThread;
  52 + @Autowired
  53 + RevertLineThread revertLineThread;
51 54  
52 55 @Override
53 56 public void run(String... arg0){
... ... @@ -98,6 +101,12 @@ public class StartCommand implements CommandLineRunner{
98 101 * 后续班次由 “实际终点到达” 事件触发指令下发
99 102 */
100 103 //scheduler.scheduleWithFixedDelay(firstScheduleIssuedThread, 60 , 60 * 2, TimeUnit.SECONDS);
  104 +
  105 + /**
  106 + * 还车线程(2分钟运行一次)
  107 + * 将借出的车刷回原线路
  108 + */
  109 + scheduler.scheduleWithFixedDelay(revertLineThread, 60 , 60 * 2 , TimeUnit.SECONDS);
101 110 } catch (Exception e) {
102 111 e.printStackTrace();
103 112 }
... ...
src/main/java/com/bsth/WebAppConfiguration.java
... ... @@ -14,6 +14,8 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
14 14 import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
15 15  
16 16 import com.bsth.filter.ResourceFilter;
  17 +import com.bsth.websocket.WebSocketHandshakeInterceptor;
  18 +import com.bsth.websocket.handler.Directive80SocketHandler;
17 19  
18 20 @Configuration
19 21 @EnableWebSocket
... ... @@ -61,6 +63,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS
61 63  
62 64 @Override
63 65 public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
64   -
  66 + //驾驶员80指令上报
  67 + registry.addHandler(new Directive80SocketHandler(), "/sockjs/directive80").addInterceptors(new WebSocketHandshakeInterceptor())
  68 + .withSockJS();
65 69 }
66 70 }
... ...
src/main/java/com/bsth/common/Constants.java
... ... @@ -28,4 +28,6 @@ public class Constants {
28 28  
29 29 //车载网关上行接口
30 30 public static final String UPSTREAM_URL = "/control/upstream";
  31 +
  32 + public static final String SESSION_USERNAME = "sessionUserName";
31 33 }
... ...
src/main/java/com/bsth/controller/realcontrol/DeviceRevertLineController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.entity.realcontrol.DeviceRevertLine;
  8 +
  9 +@RestController
  10 +@RequestMapping("/deviceRevert")
  11 +public class DeviceRevertLineController extends BaseController<DeviceRevertLine, Integer>{
  12 +
  13 +}
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -12,8 +12,11 @@ import org.springframework.web.bind.annotation.RestController;
12 12  
13 13 import com.bsth.controller.BaseController;
14 14 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  15 +import com.bsth.security.util.SecurityUtils;
15 16 import com.bsth.service.realcontrol.ScheduleRealInfoService;
  17 +import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
16 18 import com.bsth.vehicle.common.CommonMapped;
  19 +import com.google.common.base.Splitter;
17 20  
18 21 @RestController
19 22 @RequestMapping("/realSchedule")
... ... @@ -29,6 +32,30 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
29 32  
30 33 /**
31 34 *
  35 + * @Title: registerLine
  36 + * @Description: TODO(注册线路,后续才能收到数据推送)
  37 + * @param @param lineCodes
  38 + * @throws
  39 + */
  40 + @RequestMapping(value = "/registerLine", method = RequestMethod.POST)
  41 + public int registerLine(@RequestParam String lineCodes){
  42 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(lineCodes);
  43 + String userName = SecurityUtils.getCurrentUser().getUserName();
  44 + //注销之前的绑定
  45 + Collection<String> cs = CommonMapped.lineUserMap.values();
  46 + for(String c : cs){
  47 + if(c.equals(userName))
  48 + cs.remove(c);
  49 + }
  50 + //重新绑定
  51 + for(String line : list)
  52 + CommonMapped.lineUserMap.put(Integer.parseInt(line), userName);
  53 +
  54 + return 0;
  55 + }
  56 +
  57 + /**
  58 + *
32 59 * @Title: outgoAdjust
33 60 * @Description: TODO(待发调整)
34 61 * @param @param id 主键
... ... @@ -126,10 +153,39 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
126 153 * @throws
127 154 */
128 155 @RequestMapping(value = "/adjust", method = RequestMethod.POST)
129   - public Map<String, Object> adjust(@RequestParam Long id, @RequestParam String nbbm, @RequestParam String jsy, @RequestParam String spy){
  156 + public Map<String, Object> adjust(@RequestParam Long id
  157 + , @RequestParam String nbbm
  158 + , @RequestParam String jsy
  159 + , @RequestParam String spy){
130 160 return scheduleRealInfoService.adjust(id, nbbm, jsy, spy);
131 161 }
132 162  
  163 + /**
  164 + *
  165 + * @Title: trustStatus
  166 + * @Description: TODO(线路托管状态)
  167 + * @param @param lineCodes 线路编码
  168 + * @throws
  169 + */
  170 + @RequestMapping(value = "/trustStatus")
  171 + public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes){
  172 + return scheduleRealInfoService.trustStatus(lineCodes);
  173 + }
  174 +
  175 + /**
  176 + *
  177 + * @Title: changeTrustStatus
  178 + * @Description: TODO(切换线路托管状态)
  179 + * @param @param lineCode 线路编码
  180 + * @param @param status 托管状态
  181 + * @throws
  182 + */
  183 + @RequestMapping(value = "/trustStatus/change", method = RequestMethod.POST)
  184 + public int changeTrustStatus(@RequestParam Integer lineCode, @RequestParam Integer status){
  185 + ScheduleBuffer.trustMap.put(lineCode, status);
  186 + return 200;
  187 + }
  188 +
133 189 @RequestMapping(value="/queryUserInfo")
134 190 public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,@RequestParam String date){
135 191 return scheduleRealInfoService.queryUserInfo(line, date);
... ...
src/main/java/com/bsth/entity/realcontrol/DeviceRevertLine.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.Id;
  9 +import javax.persistence.Table;
  10 +
  11 +/**
  12 + *
  13 + * @ClassName: VehicleRevertLine
  14 + * @Description: TODO(设备线路还原)
  15 + * @author PanZhao
  16 + * @date 2016年7月6日 下午5:31:13
  17 + *
  18 + */
  19 +@Entity
  20 +@Table(name = "bsth_v_line_revert")
  21 +public class DeviceRevertLine {
  22 +
  23 + @Id
  24 + @GeneratedValue
  25 + private Integer id;
  26 +
  27 + /**
  28 + * 车辆内部编码
  29 + */
  30 + private String nbbm;
  31 +
  32 + /**
  33 + * 出借时间
  34 + */
  35 + private Long borrowTime;
  36 +
  37 + private String borrowTimeStr;
  38 +
  39 + /**
  40 + * 出借线路
  41 + */
  42 + private String borrowLine;
  43 +
  44 + /**
  45 + * 归还时间
  46 + */
  47 + private Long revertTime;
  48 +
  49 + private String revertTimeStr;
  50 +
  51 + /**
  52 + * 归还线路
  53 + */
  54 + private String revertLine;
  55 +
  56 + /** 创建日期 */
  57 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  58 + private Date createDate;
  59 +
  60 + /** 状态 1 已还车 */
  61 + private Integer status;
  62 +
  63 + public Integer getId() {
  64 + return id;
  65 + }
  66 +
  67 + public void setId(Integer id) {
  68 + this.id = id;
  69 + }
  70 +
  71 + public String getNbbm() {
  72 + return nbbm;
  73 + }
  74 +
  75 + public void setNbbm(String nbbm) {
  76 + this.nbbm = nbbm;
  77 + }
  78 +
  79 + public String getBorrowLine() {
  80 + return borrowLine;
  81 + }
  82 +
  83 + public void setBorrowLine(String borrowLine) {
  84 + this.borrowLine = borrowLine;
  85 + }
  86 +
  87 + public String getRevertLine() {
  88 + return revertLine;
  89 + }
  90 +
  91 + public void setRevertLine(String revertLine) {
  92 + this.revertLine = revertLine;
  93 + }
  94 +
  95 + public Long getBorrowTime() {
  96 + return borrowTime;
  97 + }
  98 +
  99 + public void setBorrowTime(Long borrowTime) {
  100 + this.borrowTime = borrowTime;
  101 + }
  102 +
  103 + public String getBorrowTimeStr() {
  104 + return borrowTimeStr;
  105 + }
  106 +
  107 + public void setBorrowTimeStr(String borrowTimeStr) {
  108 + this.borrowTimeStr = borrowTimeStr;
  109 + }
  110 +
  111 + public Long getRevertTime() {
  112 + return revertTime;
  113 + }
  114 +
  115 + public void setRevertTime(Long revertTime) {
  116 + this.revertTime = revertTime;
  117 + }
  118 +
  119 + public String getRevertTimeStr() {
  120 + return revertTimeStr;
  121 + }
  122 +
  123 + public void setRevertTimeStr(String revertTimeStr) {
  124 + this.revertTimeStr = revertTimeStr;
  125 + }
  126 +
  127 + public Date getCreateDate() {
  128 + return createDate;
  129 + }
  130 +
  131 + public void setCreateDate(Date createDate) {
  132 + this.createDate = createDate;
  133 + }
  134 +
  135 + public Integer getStatus() {
  136 + return status;
  137 + }
  138 +
  139 + public void setStatus(Integer status) {
  140 + this.status = status;
  141 + }
  142 +}
... ...
src/main/java/com/bsth/repository/realcontrol/DeviceRevertLineRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import com.bsth.entity.realcontrol.DeviceRevertLine;
  9 +import com.bsth.repository.BaseRepository;
  10 +
  11 +@Repository
  12 +public interface DeviceRevertLineRepository extends BaseRepository<DeviceRevertLine, Integer>{
  13 +
  14 + @Query(value = "select dr from DeviceRevertLine dr where dr.revertTime > ?1 and dr.revertTime < ?2 and dr.status = ?3")
  15 + public List<DeviceRevertLine> findByDateAndStatus(Long st, Long et, Integer status);
  16 +}
... ...
src/main/java/com/bsth/security/LoginSuccessHandler.java
... ... @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
8 8 import org.springframework.security.core.Authentication;
9 9 import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
10 10  
  11 +import com.bsth.common.Constants;
11 12 import com.bsth.entity.sys.SysUser;
12 13 import com.bsth.util.IpUtils;
13 14  
... ... @@ -22,6 +23,8 @@ public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessH
22 23 System.out.println("管理员 " + user.getUserName() + " 登录");
23 24 System.out.println("IP :"+IpUtils.getIpAddr(request));
24 25  
  26 + //session里写入用户名
  27 + request.getSession().setAttribute(Constants.SESSION_USERNAME, user.getUserName());
25 28 super.onAuthenticationSuccess(request, response, authentication);
26 29 }
27 30  
... ...
src/main/java/com/bsth/service/realcontrol/DeviceRevertLineService.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.DeviceRevertLine;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +public interface DeviceRevertLineService extends BaseService<DeviceRevertLine, Integer>{
  7 +
  8 +}
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -66,4 +66,6 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
66 66  
67 67 List<ScheduleRealInfo> historyMessage(String line,String date,String code);
68 68  
  69 + Map<Integer, Integer> trustStatus(String lineCodes);
  70 +
69 71 }
... ...
src/main/java/com/bsth/service/realcontrol/buffer/ScheduleBuffer.java
... ... @@ -54,6 +54,12 @@ public class ScheduleBuffer {
54 54 */
55 55 public static LinkedList<ScheduleRealInfo> persistentList;
56 56  
  57 + /**
  58 + * 线路是否托管
  59 + * K:线路编码 V:0 托管 1 非托管
  60 + */
  61 + public static Map<Integer, Integer> trustMap;
  62 +
57 63 static ScheduleComparator scheduleComparator = new ScheduleComparator();
58 64  
59 65 static{
... ... @@ -63,6 +69,8 @@ public class ScheduleBuffer {
63 69 vehLinkedMap = new HashMap<>();
64 70  
65 71 finishLinkedMap = LinkedListMultimap.create();
  72 +
  73 + trustMap = new HashMap<>();
66 74 }
67 75  
68 76 public static int init(List<ScheduleRealInfo> list){
... ...
src/main/java/com/bsth/service/realcontrol/impl/DeviceRevertLineServiceImpl.java 0 → 100644
  1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +import java.util.Map;
  7 +
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import com.bsth.entity.realcontrol.DeviceRevertLine;
  13 +import com.bsth.service.impl.BaseServiceImpl;
  14 +import com.bsth.service.realcontrol.DeviceRevertLineService;
  15 +
  16 +@Service
  17 +public class DeviceRevertLineServiceImpl extends BaseServiceImpl<DeviceRevertLine, Integer> implements DeviceRevertLineService {
  18 +
  19 + Logger logger = LoggerFactory.getLogger(this.getClass());
  20 +
  21 + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm")
  22 + ,sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd")
  23 + ,sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  24 +
  25 + @Override
  26 + public Map<String, Object> save(DeviceRevertLine t) {
  27 +
  28 + String dateStr = sdfyyyyMMdd.format(new Date());
  29 +
  30 + try {
  31 + t.setStatus(0);
  32 + t.setBorrowTime(sdfyyyyMMddHHmm.parse(dateStr + " " + t.getBorrowTimeStr()).getTime());
  33 + t.setRevertTime(sdfyyyyMMddHHmm.parse(dateStr + " " + t.getRevertTimeStr()).getTime());
  34 + } catch (ParseException e) {
  35 + logger.error("", e);
  36 + }
  37 + return super.save(t);
  38 + }
  39 +}
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -11,8 +11,6 @@ import java.util.List;
11 11 import java.util.Map;
12 12 import java.util.Set;
13 13  
14   -import javax.transaction.Transactional;
15   -
16 14 import org.apache.commons.lang3.StringUtils;
17 15 import org.slf4j.Logger;
18 16 import org.slf4j.LoggerFactory;
... ... @@ -369,4 +367,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
369 367 // TODO Auto-generated method stub
370 368 return scheduleRealInfoRepository.historyMessage(line, date,code+"%");
371 369 }
  370 +
  371 + @Override
  372 + public Map<Integer, Integer> trustStatus(String lineStr) {
  373 + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr));
  374 +
  375 + Map<Integer, Integer> map = new HashMap<>();
  376 + Integer code;
  377 + for(String lineCode : lineList){
  378 + code = Integer.parseInt(lineCode);
  379 + if(!ScheduleBuffer.trustMap.containsKey(lineCode))
  380 + ScheduleBuffer.trustMap.put(code, 0);
  381 +
  382 + map.put(code, ScheduleBuffer.trustMap.get(code));
  383 + }
  384 + return map;
  385 + }
372 386 }
... ...
src/main/java/com/bsth/vehicle/UpstreamEntrance.java
... ... @@ -33,7 +33,7 @@ public class UpstreamEntrance {
33 33  
34 34 @RequestMapping(value = "/upstream" , method = RequestMethod.POST)
35 35 public int main(@RequestParam String json){
36   - logger.info(json);
  36 + logger.info("upstream: " + json);
37 37 JSONObject jsonParam = JSONObject.parseObject(json);
38 38  
39 39 //46和47 调度指令确认
... ...
src/main/java/com/bsth/vehicle/common/CommonMapped.java
... ... @@ -4,6 +4,7 @@ import java.util.Map;
4 4  
5 5 import com.bsth.entity.Line;
6 6 import com.google.common.collect.BiMap;
  7 +import com.google.common.collect.TreeMultimap;
7 8  
8 9 /**
9 10 *
... ... @@ -45,5 +46,11 @@ public class CommonMapped {
45 46 *(K: 站点编码 ,V:站点名称)
46 47 */
47 48 public static Map<String, String> stationCodeMap;
  49 +
  50 + /**
  51 + * 线路和用户名对照
  52 + * 用于webSocket定向推送消息
  53 + */
  54 + public static TreeMultimap<Integer, String> lineUserMap = TreeMultimap.create();
48 55  
49 56 }
... ...
src/main/java/com/bsth/vehicle/directive/buffer/DirectiveBuffer.java
... ... @@ -3,6 +3,7 @@ package com.bsth.vehicle.directive.buffer;
3 3 import java.util.HashMap;
4 4 import java.util.LinkedList;
5 5 import java.util.Map;
  6 +import java.util.Set;
6 7  
7 8 import org.slf4j.Logger;
8 9 import org.slf4j.LoggerFactory;
... ... @@ -10,12 +11,14 @@ import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.stereotype.Component;
11 12  
12 13 import com.alibaba.fastjson.JSONObject;
  14 +import com.bsth.vehicle.common.CommonMapped;
13 15 import com.bsth.vehicle.directive.entity.Directive;
14 16 import com.bsth.vehicle.directive.entity.DirectiveReply;
15 17 import com.bsth.vehicle.directive.entity.DriverReport;
16 18 import com.bsth.vehicle.directive.entity.LineChange;
17 19 import com.bsth.vehicle.directive.repository.DriverReportRepository;
18 20 import com.bsth.vehicle.directive.repository.LineChangeRepository;
  21 +import com.bsth.websocket.handler.Directive80SocketHandler;
19 22 import com.google.common.collect.ArrayListMultimap;
20 23 import com.google.common.collect.Multimap;
21 24  
... ... @@ -59,6 +62,9 @@ public class DirectiveBuffer {
59 62 */
60 63 private static Multimap<Integer, DriverReport> reportMultiMap;
61 64  
  65 + @Autowired
  66 + Directive80SocketHandler directive80SocketHandler;
  67 +
62 68 static{
63 69 transientList = new LinkedList<>();
64 70 directiveMap = new HashMap<>();
... ... @@ -107,6 +113,7 @@ public class DirectiveBuffer {
107 113 }
108 114  
109 115 if(directive.isDispatch()){
  116 + //更新班次状态
110 117 directive.getSch().setDirectiveState(reply.getStatus() * 100);
111 118 }
112 119 transientList.add(directive);
... ... @@ -147,9 +154,14 @@ public class DirectiveBuffer {
147 154 * @throws
148 155 */
149 156 public void jsyReport(DriverReport report){
150   - logger.info("驾驶员上报");
151 157 //实时入库
152 158 driverReportRepository.save(report);
153 159 reportMultiMap.put(report.getData().getLineId(), report);
  160 + //推送到页面
  161 + Set<String> users = CommonMapped.lineUserMap.get(report.getData().getLineId());
  162 + if(users == null || users.size() == 0)
  163 + return;
  164 +
  165 + directive80SocketHandler.sendMessageToUser(users, JSONObject.toJSONString(report));
154 166 }
155 167 }
... ...
src/main/java/com/bsth/vehicle/directive/service/DirectiveService.java
... ... @@ -40,4 +40,14 @@ public interface DirectiveService extends BaseService&lt;Directive, Integer&gt;{
40 40 * @throws
41 41 */
42 42 int lineChange(String nbbm, Integer lineId);
  43 +
  44 + /**
  45 + *
  46 + * @Title: upDownChange
  47 + * @Description: TODO(切换上下行)
  48 + * @param @param nbbm 车辆内部编码
  49 + * @param @param upDonw 上下行 0 上行 1 下行
  50 + * @throws
  51 + */
  52 + int upDownChange(String nbbm, Integer upDonw);
43 53 }
... ...
src/main/java/com/bsth/vehicle/directive/service/DirectiveServiceImpl.java
... ... @@ -3,6 +3,8 @@ package com.bsth.vehicle.directive.service;
3 3 import java.io.IOException;
4 4 import java.text.SimpleDateFormat;
5 5 import java.util.Date;
  6 +import java.util.HashMap;
  7 +import java.util.Map;
6 8  
7 9 import org.apache.http.client.methods.CloseableHttpResponse;
8 10 import org.apache.http.client.methods.HttpPost;
... ... @@ -51,6 +53,9 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
51 53  
52 54 static Long schDiff = 1000 * 60 * 6L;
53 55  
  56 + //城市代码
  57 + static final short cityCode = 22;
  58 +
54 59 @Override
55 60 public int send60Phrase(String nbbm, String text) {
56 61 Directive directive = null;
... ... @@ -128,8 +133,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
128 133  
129 134 LineChange change = new LineChange();
130 135 LineChangeData data = new LineChangeData();
131   - //暂时写死,没什么用
132   - data.setCityCode((short) 22);
  136 + data.setCityCode(cityCode);
133 137 data.setDeviceId(deviceId);
134 138 data.setLineId(String.valueOf(lineId));
135 139  
... ... @@ -143,6 +147,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
143 147 //入库
144 148 lineChangeRepository.save(change);
145 149 DirectiveBuffer.changeMap.put(deviceId + '_' + t , change);
  150 + //通知设备刷新线路文件,忽略结果
  151 + postJson(createDeviceRefreshData(deviceId, lineId));
146 152 }else{
147 153 logger.error("send60Phrase error, code: " + code);
148 154 }
... ... @@ -153,16 +159,16 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
153 159 public Directive create60Data(String nbbm, String text, DispatchInstruct dispatchInstruct){
154 160 Long timestamp = System.currentTimeMillis();
155 161  
156   - //向测试设备发送
  162 + /*//向测试设备发送
157 163 String deviceId = "ABCDFEGH";
158   - Short company = 5;
  164 + Short company = 5;*/
159 165  
160   - /*String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm);
  166 + String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm);
161 167 Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm));
162 168 if(null == deviceId){
163 169 logger.error("没有设备号对照的车辆:" + nbbm);
164 170 return null;
165   - }*/
  171 + }
166 172 GpsRealData gpsData = gpsRealDataBuffer.findOneByDeviceId(deviceId);
167 173 if(null == gpsData){
168 174 logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm);
... ... @@ -201,6 +207,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
201 207 }
202 208  
203 209 public int postJson(String jsonStr){
  210 + logger.info("send : " + jsonStr);
  211 +
204 212 CloseableHttpClient httpClient = null;
205 213 int code = -1;
206 214 try{
... ... @@ -229,4 +237,76 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;Directive, Integer&gt; im
229 237 }
230 238 return code;
231 239 }
  240 +
  241 + @Override
  242 + public int upDownChange(String nbbm, Integer upDonw) {
  243 + //构造数据
  244 + String deviceId = CommonMapped.vehicDeviceBiMap.inverse().get(nbbm);
  245 + Short company = Short.parseShort(CommonMapped.vehicCompanyMap.get(nbbm));
  246 + Long timestamp = System.currentTimeMillis();
  247 + int msgId = MsgIdGenerator.getMsgId();
  248 + Directive directive = new Directive();
  249 + DirectiveData data = new DirectiveData();
  250 + //一级协议
  251 + directive.setOperCode((short) 0x60);
  252 + //设备号
  253 + directive.setDeviceId(deviceId);
  254 + //时间戳
  255 + directive.setTimestamp(timestamp);
  256 + directive.setMsgId(msgId);
  257 + //构造数据
  258 + data.setDeviceId(deviceId);
  259 + data.setDispatchInstruct(DispatchInstruct.OPERATE_CLOCK_OFF);
  260 + data.setTimestamp(timestamp);
  261 + data.setCompanyCode(company);
  262 + data.setMsgId(msgId);
  263 + directive.setData(data);
  264 +
  265 + long serviceState;
  266 + try{
  267 + serviceState = Consts.SERVICE_STATE[upDonw][0];
  268 + }catch(IndexOutOfBoundsException e){
  269 + logger.error("upDonw: " + upDonw, e);
  270 + return -1;
  271 + }
  272 + data.setServiceState(serviceState);
  273 +
  274 + int code = postJson(JSON.toJSONString(directive));
  275 + if(code == 0){
  276 + //添加到缓存,等待入库
  277 + DirectiveBuffer.put(directive);
  278 + }else{
  279 + logger.error("send60 upDownChange error, code: " + code);
  280 + }
  281 + return 0;
  282 + }
  283 +
  284 + /**
  285 + *
  286 + * @Title: createDeviceRefreshData
  287 + * @Description: TODO(生成设备线路刷新数据包)
  288 + * @param @return 设定文件
  289 + * @return String 返回类型
  290 + * @throws
  291 + */
  292 + public String createDeviceRefreshData(String deviceId, Integer lineId){
  293 + Long t = System.currentTimeMillis();
  294 + Map<String, Object> param = new HashMap<String, Object>();
  295 + param.put("deviceId", deviceId);
  296 + param.put("timestamp", t);
  297 + param.put("operCode", 0Xc0);
  298 +
  299 + Map<String, Object> data = new HashMap<String, Object>();
  300 + data.put("operCode", 0xa1);
  301 + data.put("cityCode", cityCode);
  302 + data.put("deviceId", deviceId);
  303 + data.put("timestamp", t);
  304 + data.put("centerId", 1);
  305 + data.put("lineId", lineId);
  306 + data.put("lineVersion", 0);
  307 + data.put("carparkDataVersion", 0);
  308 + param.put("data", data);
  309 +
  310 + return JSON.toJSONString(param);
  311 + }
232 312 }
... ...
src/main/java/com/bsth/vehicle/directive/DirectivePersistenceThread.java renamed to src/main/java/com/bsth/vehicle/directive/thread/DirectivePersistenceThread.java
1   -package com.bsth.vehicle.directive;
  1 +package com.bsth.vehicle.directive.thread;
2 2  
3 3 import java.util.LinkedList;
4 4  
... ...
src/main/java/com/bsth/vehicle/directive/FirstScheduleIssuedThread.java renamed to src/main/java/com/bsth/vehicle/directive/thread/FirstScheduleIssuedThread.java
1   -package com.bsth.vehicle.directive;
  1 +package com.bsth.vehicle.directive.thread;
2 2  
3 3 import java.util.LinkedList;
4 4 import java.util.Set;
... ...
src/main/java/com/bsth/vehicle/directive/thread/RevertLineThread.java 0 → 100644
  1 +package com.bsth.vehicle.directive.thread;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +import com.bsth.entity.realcontrol.DeviceRevertLine;
  9 +import com.bsth.repository.realcontrol.DeviceRevertLineRepository;
  10 +import com.bsth.vehicle.directive.service.DirectiveService;
  11 +
  12 +/**
  13 + *
  14 + * @ClassName: DeviceRevertLineThread
  15 + * @Description: TODO(设备线路还原线程, 将借出的车还原到原线路)
  16 + * @author PanZhao
  17 + * @date 2016年7月7日 上午11:30:38
  18 + *
  19 + */
  20 +@Component
  21 +public class RevertLineThread extends Thread{
  22 +
  23 + @Autowired
  24 + DeviceRevertLineRepository deviceRevertLineRepository;
  25 +
  26 + @Autowired
  27 + DirectiveService directiveService;
  28 +
  29 + @Override
  30 + public void run() {
  31 + Long et = System.currentTimeMillis()
  32 + ,st = et - (1000 * 60 * 5);
  33 +
  34 + List<DeviceRevertLine> list = deviceRevertLineRepository.findByDateAndStatus(st, et, 0);
  35 +
  36 + if(list.size() == 0)
  37 + return;
  38 +
  39 + int code;
  40 + for(DeviceRevertLine revertLine : list){
  41 + //还车
  42 + code = directiveService.lineChange(revertLine.getNbbm(), Integer.parseInt(revertLine.getRevertLine()));
  43 +
  44 + if(code == 0){
  45 + //改变状态
  46 + revertLine.setStatus(1);
  47 + deviceRevertLineRepository.save(revertLine);
  48 + }
  49 + }
  50 + }
  51 +}
... ...
src/main/java/com/bsth/websocket/WebSocketHandshakeInterceptor.java 0 → 100644
  1 +package com.bsth.websocket;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import javax.servlet.http.HttpSession;
  6 +
  7 +import org.springframework.http.server.ServerHttpRequest;
  8 +import org.springframework.http.server.ServerHttpResponse;
  9 +import org.springframework.http.server.ServletServerHttpRequest;
  10 +import org.springframework.stereotype.Component;
  11 +import org.springframework.web.socket.WebSocketHandler;
  12 +import org.springframework.web.socket.server.HandshakeInterceptor;
  13 +
  14 +import com.bsth.common.Constants;
  15 +
  16 +@Component
  17 +public class WebSocketHandshakeInterceptor implements HandshakeInterceptor {
  18 +
  19 + @Override
  20 + public void afterHandshake(ServerHttpRequest request,
  21 + ServerHttpResponse arg1, WebSocketHandler arg2, Exception arg3) {
  22 + }
  23 +
  24 + @Override
  25 + public boolean beforeHandshake(ServerHttpRequest request,
  26 + ServerHttpResponse arg1, WebSocketHandler arg2,
  27 + Map<String, Object> attributes) throws Exception {
  28 + if (request instanceof ServletServerHttpRequest) {
  29 + ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request;
  30 + HttpSession session = servletRequest.getServletRequest()
  31 + .getSession(false);
  32 + if (session != null) {
  33 + // 使用SESSION_USERNAME区分WebSocketHandler,以便定向发送消息
  34 + String userName = session.getAttribute(Constants.SESSION_USERNAME).toString();
  35 + attributes.put(Constants.SESSION_USERNAME, userName);
  36 + }
  37 + }
  38 + return true;
  39 + }
  40 +}
... ...
src/main/java/com/bsth/websocket/handler/Directive80SocketHandler.java 0 → 100644
  1 +package com.bsth.websocket.handler;
  2 +
  3 +import java.io.IOException;
  4 +import java.util.ArrayList;
  5 +import java.util.Set;
  6 +
  7 +import org.springframework.stereotype.Component;
  8 +import org.springframework.web.socket.CloseStatus;
  9 +import org.springframework.web.socket.TextMessage;
  10 +import org.springframework.web.socket.WebSocketHandler;
  11 +import org.springframework.web.socket.WebSocketMessage;
  12 +import org.springframework.web.socket.WebSocketSession;
  13 +
  14 +import com.bsth.common.Constants;
  15 +
  16 +/**
  17 + * 驾驶员上报80指令推送
  18 + * 注意:在sendMsg时,多线程状态下有几率出现连接状态脏读,建议 synchronized
  19 + * @author PanZhao
  20 + */
  21 +@Component
  22 +public class Directive80SocketHandler implements WebSocketHandler {
  23 +
  24 + private static final ArrayList<WebSocketSession> users;
  25 +
  26 + static {
  27 + users = new ArrayList<WebSocketSession>();
  28 + }
  29 +
  30 + @Override
  31 + public void afterConnectionClosed(WebSocketSession session, CloseStatus arg1)
  32 + throws Exception {
  33 + users.remove(session);
  34 + }
  35 +
  36 + @Override
  37 + public void afterConnectionEstablished(WebSocketSession session)
  38 + throws Exception {
  39 + users.add(session);
  40 + }
  41 +
  42 + @Override
  43 + public void handleMessage(WebSocketSession arg0, WebSocketMessage<?> arg1)
  44 + throws Exception {
  45 + }
  46 +
  47 + @Override
  48 + public void handleTransportError(WebSocketSession session, Throwable arg1)
  49 + throws Exception {
  50 + if(session.isOpen()){
  51 + session.close();
  52 + }
  53 + users.remove(session);
  54 + }
  55 +
  56 + @Override
  57 + public boolean supportsPartialMessages() {
  58 + return false;
  59 + }
  60 +
  61 + /**
  62 + * 给所有在线用户发送消息
  63 + *
  64 + * @param message
  65 + */
  66 + public synchronized void sendMessageToUsers(TextMessage message) {
  67 + for (WebSocketSession user : users) {
  68 + try {
  69 + if (user.isOpen()) {
  70 + user.sendMessage(message);
  71 + }
  72 + } catch (IOException e) {
  73 + e.printStackTrace();
  74 + }
  75 + }
  76 + }
  77 +
  78 + /**
  79 + * 给某些用户发送消息
  80 + *
  81 + * @param userId
  82 + * @param message
  83 + */
  84 + public synchronized void sendMessageToUser(Set<String> uids, String msg) {
  85 + TextMessage message = new TextMessage(msg.getBytes());
  86 + for (WebSocketSession user : users) {
  87 + if (uids.contains(user.getAttributes().get(Constants.SESSION_USERNAME))) {
  88 + try {
  89 + if (user.isOpen()) {
  90 + user.sendMessage(message);
  91 + }
  92 + } catch (IOException e) {
  93 + e.printStackTrace();
  94 + }
  95 + }
  96 + }
  97 + }
  98 +}
... ...
src/main/resources/application.properties
... ... @@ -18,6 +18,7 @@ spring.datasource.max-active=100
18 18 spring.datasource.max-idle=8
19 19 spring.datasource.min-idle=8
20 20 spring.datasource.initial-size=5
  21 +spring.datasource.validation-query=select 1
21 22  
22 23 spring.view.suffix=.html
23 24  
... ...
src/main/resources/static/assets/js/sockjs.min.js 0 → 100644
  1 +/* sockjs-client v1.1.1 | http://sockjs.org | MIT license */
  2 +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,r=new Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var o=0;o<e.length;o++)e[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=n},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,debug:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[t.transportName],o=new t(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=t.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,debug:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x=" \n \f\r   ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){"use strict";var n=t.WebSocket||t.MozWebSocket;n&&(e.exports=function(t){return new n(t)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))
  3 +}},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t,e,o){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var u=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new a(this.url,[],o),this.ws.onmessage=function(t){u.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){u.ws.close()}),this.ws.onclose=function(t){u.emit("close",t.code,t.reason),u._cleanup()},this.ws.onerror=function(t){u.emit("close",1006,"WebSocket connection broken"),u._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r;try{r=t.console&&t.console[e]&&t.console[e].apply}catch(i){}n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.1.1"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t){var e=u.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]?e[3]:""}}function r(t,e,u){if(!(this instanceof r))return new r(t,e,u);var c,f,h,d,p=a.test(t),v=typeof e,m=this,y=0;"object"!==v&&"string"!==v&&(u=e,e=null),u&&"function"!=typeof u&&(u=s.parse),e=o(e);var b=n(t);for(m.protocol=b.protocol||e.protocol||"",m.slashes=b.slashes||e.slashes,t=b.rest;y<l.length;y++)f=l[y],c=f[0],d=f[1],c!==c?m[d]=t:"string"==typeof c?~(h=t.indexOf(c))&&("number"==typeof f[2]?(m[d]=t.slice(0,h),t=t.slice(h+f[2])):(m[d]=t.slice(h),t=t.slice(0,h))):(h=c.exec(t))&&(m[d]=h[1],t=t.slice(0,t.length-h[0].length)),m[d]=m[d]||(f[3]||"port"===d&&p?e[d]||"":""),f[4]&&(m[d]=m[d].toLowerCase());u&&(m.query=u(m.query)),i(m.port,m.protocol)||(m.host=m.hostname,m.port=""),m.username=m.password="",m.auth&&(f=m.auth.split(":"),m.username=f[0]||"",m.password=f[1]||""),m.href=m.toString()}var i=t("requires-port"),o=t("./lolcation"),s=t("querystringify"),a=/^\/(?!\/)/,u=/^([a-z0-9.+-]+:)?(\/\/)?(.*)$/i,l=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];r.prototype.set=function(t,e,n){var r=this;return"query"===t?("string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e):"port"===t?(r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="")):"hostname"===t?(r[t]=e,r.port&&(e+=":"+r.port),r.host=e):"host"===t?(r[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),r.hostname=e[0],r.port=e[1])):"protocol"===t?(r.protocol=e,r.slashes=!n):r[t]=e,r.href=r.toString(),r},r.prototype.toString=function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.protocol;r&&":"!==r.charAt(r.length-1)&&(r+=":");var i=r+(n.slashes?"//":"");return n.username&&(i+=n.username,n.password&&(i+=":"+n.password),i+="@"),i+=n.hostname,n.port&&(i+=":"+n.port),i+=n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(i+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(i+=n.hash),i},r.qs=s,r.location=o,e.exports=r},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,o={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var s,a={},u=typeof e;if("blob:"===e.protocol)a=new r(unescape(e.pathname),{});else if("string"===u){a=new r(e,{});for(s in o)delete a[s]}else if("object"===u){for(s in e)s in o||(a[s]=e[s]);void 0===a.slashes&&(a.slashes=i.test(e.href))}return a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)});
0 4 \ No newline at end of file
... ...
src/main/resources/static/index.html
... ... @@ -293,6 +293,8 @@ tr.row-active td {
293 293 <script src="/assets/js/dictionary.js"></script>
294 294 <!-- d3 -->
295 295 <script src="/assets/js/d3.min.js" data-exclude=1></script>
  296 +<!-- webSocket JS -->
  297 +<script src="/assets/js/sockjs.min.js"></script>
296 298  
297 299 <!-- TODO:angularJS相关库 -->
298 300  
... ...
src/main/resources/static/pages/control/line/child_pages/vehicAndper_adjust.html
... ... @@ -48,18 +48,18 @@
48 48 <div class="form-custom-row">
49 49 <div class="item full" >
50 50 <span class="item-label" style="width: 80px;">内部编码: </span>
51   - <select class="form-control pd90" id="vehicSearchSelect"></select>
  51 + <select class="form-control pd90" id="vehicSearchSelect" name="nbbm"></select>
52 52 </div>
53 53 </div>
54 54  
55 55 <div class="form-custom-row" id="borrowInfoPanel" style="display: none;">
56 56 <div class="item full" >
57 57 <span class="item-label" style="width: 80px;">借用时间: </span>
58   -
  58 + <input type="hidden" name="revertLine" >
59 59 <div style="display: inline-block;">
60   - <input type="time" class="form-control" name="borrowStart" value="17:26" style="width: 160px;">
  60 + <input type="time" class="form-control" name="borrowTimeStr" style="width: 160px;">
61 61 &nbsp;&nbsp;至&nbsp;&nbsp;
62   - <input type="time" class="form-control" name="borrowEnd" value="23:59" style="width: 160px;">
  62 + <input type="time" class="form-control" name="revertTimeStr" value="23:59" style="width: 160px;">
63 63 </div>
64 64 &nbsp;&nbsp;
65 65 <input type="checkbox" class="icheck" checked="checked" > 本次使用完交还原线路
... ... @@ -69,7 +69,7 @@
69 69 <div class="form-custom-row">
70 70 <div class="item full" >
71 71 <span class="item-label" style="width: 80px;">驾驶员: </span>
72   - <select class="form-control pd90" name="jGh">
  72 + <select class="form-control pd90" name="jsy">
73 73 </select>
74 74 </div>
75 75 </div>
... ... @@ -77,7 +77,7 @@
77 77 <div class="form-custom-row">
78 78 <div class="item full" >
79 79 <span class="item-label" style="width: 80px;">售票员: </span>
80   - <select class="form-control pd90" name="sGh">
  80 + <select class="form-control pd90" name="spy">
81 81 </select>
82 82 </div>
83 83 </div>
... ... @@ -192,13 +192,13 @@
192 192 //驾驶员
193 193 $.get('/realSchedule/driver', {lineCode: lineCode}, function(rs){
194 194 rs.splice(0, 0, placeholder);
195   - initPinYinSelect2(wrap + ' select[name=jGh]', rs);
  195 + initPinYinSelect2(wrap + ' select[name=jsy]', rs);
196 196  
197 197 });
198 198 //售票员
199 199 $.get('/realSchedule/conductor', {lineCode: lineCode}, function(rs){
200 200 rs.splice(0, 0, placeholder);
201   - initPinYinSelect2(wrap + ' select[name=sGh]', rs);
  201 + initPinYinSelect2(wrap + ' select[name=spy]', rs);
202 202 });
203 203 };
204 204  
... ... @@ -231,22 +231,29 @@
231 231  
232 232 //确定
233 233 $('.confirm', wrap).on('click', function(){
234   - var nbbm = $('#vehicSearchSelect').val()
  234 + /* var nbbm = $('#vehicSearchSelect').val()
235 235 ,jsy = $('select[name=jGh]', wrap).val()
236   - ,spy = $('select[name=sGh]', wrap).val(), id;
  236 + ,spy = $('select[name=sGh]', wrap).val(), id; */
  237 +
  238 + var params = $('form', wrap).serializeJSON();
237 239  
238   - console.log(nbbm, jsy, spy);
  240 + console.log('params', params);
239 241 var idArray = [];
240 242 $.each($('.adjust_tr_active', wrap), function(){
241 243 idArray.push($(this).data('id'));
242 244 });
243 245  
244   - syncSubmit(idArray, {nbbm: nbbm, jsy: jsy, spy: spy}
245   - ,function(){
  246 + syncSubmit(idArray, params ,function(){
246 247 layer.msg('操作完成!');
  248 + //刷新表格
247 249 refreshMainList();
248   - });
249   - });
  250 + //提交借车信息
  251 + if(!$("#borrowInfoPanel").is(":hidden")){
  252 + params.borrowLine = lineSelect.val();
  253 + $post('/deviceRevert', params);
  254 + }
  255 + });
  256 + });
250 257 });
251 258  
252 259 function syncSubmit(idArray, data, cb){
... ... @@ -322,7 +329,8 @@
322 329 $('#borrowInfoPanel').show();
323 330 //借用时间为选中班次的第一个发车时间
324 331 var fcsj = $.trim($('.adjust_tr_active:eq(0) td:eq(0)').text());
325   - $('input[name=borrowStart]', wrap).val(fcsj);
  332 + $('input[name=borrowTimeStr]', wrap).val(fcsj);
  333 + $('input[name=revertLine]', wrap).val(lineCode);
326 334 }
327 335 else
328 336 $('#borrowInfoPanel').hide();
... ...
src/main/resources/static/pages/control/line/css/lineControl.css
... ... @@ -1028,6 +1028,14 @@ height: 400px;
1028 1028 background: #71A79C;
1029 1029 }
1030 1030  
  1031 +._panel_footer.hand{
  1032 + background: #baba49;
  1033 +}
  1034 +
  1035 +._panel_footer.hand:hover{
  1036 + background: #aaaa47;
  1037 +}
  1038 +
1031 1039 .log-item{
1032 1040 width: 96%;
1033 1041 margin: 2%;
... ...
src/main/resources/static/pages/control/line/index.html
... ... @@ -171,6 +171,7 @@
171 171 <script src="/pages/control/line/js/rightMenu.js"></script>
172 172 <script src="/pages/control/line/js/alone.js"></script>
173 173 <script src="/pages/control/line/js/main.js"></script>
  174 +
174 175 <script>
175 176  
176 177 var lineCodes = '' //全部线路编码字符串,由data.js初始化
... ... @@ -191,4 +192,5 @@ $(function() {
191 192 });
192 193 }
193 194 });
194   -</script>
195 195 \ No newline at end of file
  196 +</script>
  197 +<script src="/pages/control/line/js/webSocketHandle.js"></script>
196 198 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/js/alone.js
1 1 /**
2 2 * 单线路调度
3 3 */
4   -
5 4 var _alone = (function(){
6 5 var upCode = 0
7 6 ,downCode = 1;
... ... @@ -15,41 +14,37 @@ var _alone = (function(){
15 14 schTempList = schList[lineCode];
16 15 tab = $('#tab_line_' + lineCode);
17 16 tab.append(template('alone_main_temp', lineMap[lineCode]));
18   -
19 17 //有排班数据
20 18 if(schTempList){
21 19 var rs = splitDir(schTempList);
22 20 //填充表格数据
23 21 calculateLineNo(
  22 + //上行
24 23 tab.find('table[data-type=up] tbody').html(template('alone_plan_table_temp', {list: rs.up}))[0]
25 24 );
26 25 calculateLineNo(
  26 + //下行
27 27 tab.find('table[data-type=down] tbody').html(template('alone_plan_table_temp', {list: rs.down}))[0]
28 28 );
29   -
30 29 //滚动条
31 30 tab.find('._body').slimscroll({
32 31 height: 'calc(100% - 80px)',
33 32 alwaysVisible: true
34 33 });
35 34 }
  35 + //svg
36 36 _data.queryStationRoute(lineCode , 'lineSvg' + lineCode , drawSvg.initAloneSvg);
37 37 }
  38 + //初始化备注弹层
  39 + initRemarksPop();
  40 + //初始化信使
  41 + initMessenger(lineCodes);
38 42  
  43 + //消息框滚动条
39 44 $('.console-log .log-item-list').slimscroll({
40 45 height: '100%'
41   - })
42   - //托管Question
43   - $('#tgQuestion').popover({
44   - content: template('tg_question_info_temp', {}),
45   - html: true,
46   - placement: 'left',
47   - trigger: 'hover',
48   - container: '.portlet-fullscreen'
49 46 });
50 47  
51   - initRemarksPop();
52   -
53 48 cb && cb();
54 49 });
55 50 },
... ... @@ -106,6 +101,51 @@ var _alone = (function(){
106 101 return rs;
107 102 }
108 103  
  104 + //切换托管状态
  105 + function changeTGStatus(){
  106 + var status = $(this).data('status');
  107 + if(status == 0)
  108 + status = 1;
  109 + else
  110 + status = 0;
  111 +
  112 + $(this).data('status', status);
  113 +
  114 + var lineCode = $(this).data('linecode');
  115 +
  116 + $.post('/realSchedule/trustStatus/change', {lineCode: lineCode, status: status}
  117 + ,function(rs){
  118 + if(rs == 200){
  119 + layer.msg('切换成功!');
  120 + changeTgHtml(lineCode, status);
  121 + }
  122 + });
  123 + }
  124 +
  125 + $('.portlet-fullscreen').on('click', '.tg_tools', changeTGStatus);
  126 + var tgHtml = ['托管状态,计算机自动处理&nbsp;<i class="fa fa-question-circle tgQuestion" style="cursor: pointer;"></i>', '非托管状态,手动处理!'];
  127 + var tgPopoverOps = {content: template('tg_question_info_temp', {}),html: true,placement: 'left',trigger: 'hover',container: '.portlet-fullscreen'};
  128 + function initMessenger(lineCodes){
  129 + //查询线路托管状态
  130 + $.get('/realSchedule/trustStatus', {lineCodes: lineCodes},function(rs){
  131 + for(var line in rs)
  132 + changeTgHtml(line, rs[line]);
  133 + });
  134 + }
  135 +
  136 + function changeTgHtml(line, status){
  137 + var tgTools = $('#tgTools_' + line);
  138 +
  139 + tgTools.html(tgHtml[status]).data('status', status);
  140 + if(status == 0){
  141 + //托管Question
  142 + $('.tgQuestion', tgTools).popover(tgPopoverOps);
  143 + tgTools.removeClass('hand');
  144 + }
  145 + else
  146 + tgTools.addClass('hand');
  147 + }
  148 +
109 149 function initRemarksPop(){
110 150 //备注POPOVER
111 151 $('.remarks-popover', '.pb-table').popover({trigger: 'hover',container: '.portlet-fullscreen',placement:'bottom'});
... ...
src/main/resources/static/pages/control/line/js/rightMenu.js
... ... @@ -157,8 +157,14 @@ var _menu = (function() {
157 157 title: '实发调整',
158 158 success: function(){
159 159 $('.confirm', '#realOutgoAdjust').on('click', function(){
160   - //alert('提交...');
161   -
  160 + var params = $('#realOutgoAdjust').serializeJSON();
  161 + if(!params.fcsjActual){
  162 + layer.msg('实发时刻不能为空');return;
  163 + }
  164 + if(!$.trim(params.remarks)){
  165 + layer.msg('备注不能为空');return;
  166 + }
  167 + alert('可以提交...');
162 168 });
163 169 }
164 170 });
... ...
src/main/resources/static/pages/control/line/js/webSocketHandle.js 0 → 100644
  1 +/** web socket */
  2 +//将当前用户和线路绑定到后台
  3 +$.post('/realSchedule/registerLine', {lineCodes: lineCodes}
  4 +,function(rs){
  5 + if(rs == 0){
  6 + layer.msg('注册线路成功!');
  7 + initWebSocket();
  8 + }
  9 +});
  10 +
  11 +//初始化webSocket
  12 +var msg80Sock;
  13 +var initWebSocket = function(){
  14 + msg80Sock = new SockJS('/sockjs/directive80');
  15 +
  16 + msg80Sock.onopen = function(e) {
  17 + console.log('webSocket[msg80Sock] onopen');
  18 + };
  19 +
  20 + //接收消息
  21 + msg80Sock.onmessage = function(e) {
  22 + try{
  23 + console.log(e);
  24 + var jsonMsg = $.parseJSON(e.data);
  25 + msg80Handle(jsonMsg);
  26 + }catch(e){
  27 + console.log(e);
  28 + }
  29 + };
  30 +};
  31 +
  32 +//驾驶员80上报处理
  33 +var msg80Handle = function(msg){
  34 +}
... ...
src/main/resources/static/pages/control/line/temps/alone_tp.html
... ... @@ -129,9 +129,8 @@
129 129 </div>
130 130 </div>
131 131 </div>
132   - <div class="_panel_footer" id="tgTools">
133   - 托管状态,计算机自动处理
134   - &nbsp;<i id="tgQuestion" class="fa fa-question-circle" style="cursor: pointer;"></i>
  132 + <div class="_panel_footer tg_tools" id="tgTools_{{lineCode}}" data-linecode="{{lineCode}}">
  133 +
135 134 </div>
136 135 </div>
137 136 </div>
... ... @@ -382,7 +381,7 @@
382 381 <div class="item full">
383 382 <span class="item-label" style="width: 80px;">计发时刻: </span>
384 383 <select class="form-control" disabled>
385   - <option value="">{{fcsj}}</option>
  384 + <option value="">{{fcsj}}</option>
386 385 </select>
387 386 </div>
388 387 </div>
... ... @@ -390,14 +389,14 @@
390 389 <div class="form-custom-row">
391 390 <div class="item full">
392 391 <span class="item-label" style="width: 80px;">实发时刻: </span>
393   - <input class="form-control" value="{{fcsjActual}}" type="time">
  392 + <input class="form-control" name="fcsjActual" value="{{fcsjActual}}" type="time">
394 393 </div>
395 394 </div>
396 395  
397 396 <div class="form-custom-row">
398 397 <div class="item full" >
399 398 <p style="margin: 10px 0;">调整说明: <span class="font-red">(不超过20个字符)</span></p>
400   - <textarea class="form-control" rows="4" placeholder="说明,必填"></textarea>
  399 + <textarea class="form-control" name="remarks" rows="4" placeholder="说明,必填"></textarea>
401 400 </div>
402 401 </div>
403 402 <hr>
... ...