Commit d221ad65384a101d9c5bfa2ba281abc8931b9473

Authored by 王通
2 parents 54f72ca6 9e555437

Merge branch 'chengdu' into changsha

src/main/java/com/bsth/entity/directive/D60.java
... ... @@ -69,7 +69,6 @@ public class D60 extends Directive {
69 69 /**
70 70 * 相关联的班次
71 71 */
72   - @JsonIgnore
73 72 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
74 73 private ScheduleRealInfo sch;
75 74  
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
1   -package com.bsth.service.directive;
2   -
3   -import com.alibaba.fastjson.JSON;
4   -import com.alibaba.fastjson.JSONObject;
5   -import com.bsth.common.ResponseCode;
6   -import com.bsth.data.BasicData;
7   -import com.bsth.data.directive.DayOfDirectives;
8   -import com.bsth.data.directive.DirectiveCreator;
9   -import com.bsth.data.directive.GatewayHttpUtils;
10   -import com.bsth.data.gpsdata_v2.GpsRealData;
11   -import com.bsth.data.gpsdata_v2.entity.GpsEntity;
12   -import com.bsth.data.pilot80.PilotReport;
13   -import com.bsth.data.schedule.DayOfSchedule;
14   -import com.bsth.data.utils.ListFilterUtils;
15   -import com.bsth.data.utils.ListPageQueryUtils;
16   -import com.bsth.entity.directive.*;
17   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
18   -import com.bsth.entity.sys.SysUser;
19   -import com.bsth.repository.directive.D60Repository;
20   -import com.bsth.repository.directive.D64Repository;
21   -import com.bsth.repository.directive.D80Repository;
22   -import com.bsth.security.util.SecurityUtils;
23   -import com.bsth.service.directive.dto.DeviceConfigDto;
24   -import com.bsth.service.impl.BaseServiceImpl;
25   -import com.bsth.websocket.handler.RealControlSocketHandler;
26   -import com.fasterxml.jackson.core.JsonProcessingException;
27   -import com.fasterxml.jackson.databind.ObjectMapper;
28   -import com.google.common.base.Splitter;
29   -import org.apache.commons.lang3.StringEscapeUtils;
30   -import org.apache.commons.lang3.StringUtils;
31   -import org.joda.time.format.DateTimeFormat;
32   -import org.joda.time.format.DateTimeFormatter;
33   -import org.slf4j.Logger;
34   -import org.slf4j.LoggerFactory;
35   -import org.springframework.beans.factory.annotation.Autowired;
36   -import org.springframework.jdbc.core.BeanPropertyRowMapper;
37   -import org.springframework.jdbc.core.JdbcTemplate;
38   -import org.springframework.stereotype.Service;
39   -
40   -import java.util.*;
41   -
42   -@Service
43   -public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService {
44   -
45   - Logger logger = LoggerFactory.getLogger(this.getClass());
46   -
47   - @Autowired
48   - D60Repository d60Repository;
49   -
50   - @Autowired
51   - GpsRealData gpsRealDataBuffer;
52   -
53   - @Autowired
54   - D64Repository d64Repository;
55   -
56   - @Autowired
57   - RealControlSocketHandler socketHandler;
58   -
59   - @Autowired
60   - D80Repository d80Repository;
61   -
62   - @Autowired
63   - DayOfDirectives dayOfDirectives;
64   -
65   - @Autowired
66   - PilotReport pilotReport;
67   -
68   - @Autowired
69   - DayOfSchedule dayOfSchedule;
70   -
71   - @Autowired
72   - JdbcTemplate jdbcTemplate;
73   -
74   - //static Long schDiff = 1000 * 60 * 60L;
75   -
76   - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"), fmtHHmm_CN = DateTimeFormat.forPattern("HH点mm分");
77   -
78   - @Override
79   - public int send60Phrase(String nbbm, String text, String sender) {
80   - D60 d60 = null;
81   - try {
82   - text = StringEscapeUtils.unescapeHtml4(text);
83   - text = text.replaceAll("#", "");
84   - d60 = create60Data(nbbm, text, (short) 0x00, null);
85   - } catch (Exception e) {
86   - logger.error("发送消息短语出现异常", e);
87   - return -1;
88   - }
89   -
90   - if (null == d60)
91   - return -1;
92   -
93   - // 发送指令
94   - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
95   - if (null != sender)
96   - d60.setSender(sender);
97   - d60.setHttpCode(code);
98   -
99   - if (code != 0)
100   - d60.setErrorText("网关通讯失败, code: " + code);
101   -
102   - dayOfDirectives.put60(d60);
103   - return code;
104   - }
105   -
106   - @Override
107   - public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender, String txtPrefix) {
108   - D60 d60 = null;
109   - try {
110   - if (sch.isDestroy()) {
111   - logger.warn("烂班不允许发送调度指令....");
112   - return -1;
113   - }
114   -
115   - //待发应到时间
116   - String dfsj = fmtHHmm.print(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));
117   - String text = "您已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由"
118   - + sch.getQdzName() + "发往" + sch.getZdzName() + ";应到 " + dfsj;
119   -
120   - if(sch.getBcType().equals("venting")){
121   - text += " (直放)";
122   - }
123   - else if(sch.getBcType().equals("major")){
124   - text += " (放站到"+sch.getMajorStationName()+"带客)";
125   - } else if ("ldks".equals(sch.getBcType())) {
126   - text += " (两点空驶)";
127   - }
128   -
129   - //下发0x02指令 调度指令(闹钟有效)
130   - long t = System.currentTimeMillis() + 1000 * 30,
131   - alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT();
132   -
133   - if(StringUtils.isNotEmpty(txtPrefix)){
134   - text = txtPrefix + text;
135   - }
136   - text = StringEscapeUtils.unescapeHtml4(text);
137   - int state = 0;//营运状态
138   - if(dayOfSchedule.emptyService(sch))
139   - state = 1;
140   - d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
141   - , state, new Date(alarmTime));
142   -
143   - d60.setLineCode(sch.getXlBm());
144   - } catch (Exception e) {
145   - logger.error("生成调度指令时出现异常", e);
146   - return -1;
147   - }
148   -
149   - if (null == d60)
150   - return -1;
151   -
152   - d60.setSender(sender);
153   -
154   - JSONObject jObj = JSON.parseObject(JSON.toJSONString(d60));
155   -
156   - //进场或者出场班次时,附加lock 标识
157   - if (null != sch.getBcType()
158   - && (sch.getBcType().equals("out") || sch.getBcType().equals("in"))) {
159   -
160   - jObj.put("lock", 1);
161   - }
162   -
163   - // 发送指令
164   - int code = GatewayHttpUtils.postJson(jObj.toJSONString());
165   -
166   - d60.setDispatch(true);
167   - d60.setSch(sch);
168   - d60.setHttpCode(code);
169   -
170   - if (code == 0) {
171   - sch.setDirectiveState(60);
172   - // 通知页面
173   - sendD60ToPage(sch);
174   - } else {
175   - d60.setErrorText("网关通讯失败, code: " + code);
176   - }
177   -
178   - dayOfDirectives.put60(d60);
179   - return code;
180   - }
181   -
182   - /**
183   - * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws
184   - */
185   - @Override
186   - public void sendD60ToPage(ScheduleRealInfo sch) {
187   - Map<String, Object> map = new HashMap<>();
188   - map.put("fn", "directive");
189   - map.put("t", sch);
190   -
191   - ObjectMapper mapper = new ObjectMapper();
192   -
193   - try {
194   - socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
195   - } catch (JsonProcessingException e) {
196   - logger.error("", e);
197   - }
198   - }
199   -
200   - @Override
201   - public int send60Dispatch(Long id, String sender) {
202   - ScheduleRealInfo sch = dayOfSchedule.get(id);
203   - // 车辆已完成班次
204   - int finish = dayOfSchedule.doneSum(sch.getClZbh());
205   - return send60Dispatch(sch, finish, sender, "");
206   - }
207   -
208   - @Override
209   - public int send60Operation(String nbbm, int state, int upDown, String sender) {
210   - logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown);
211   -
212   - String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运");
213   - D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state, null);
214   -
215   - if (null == d60)
216   - return -1;
217   - if (null != sender)
218   - d60.setSender(sender);
219   - else
220   - d60.setSender("系统");
221   - // 发送指令
222   - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
223   - // 添加到缓存,等待入库
224   - d60.setHttpCode(code);
225   -
226   - GpsEntity gps = gpsRealDataBuffer.getByNbbm(nbbm);
227   - if(null != gps)
228   - d60.setLineCode(gps.getLineId());
229   -
230   - if (code != 0)
231   - d60.setErrorText("网关通讯失败, code: " + code);
232   -
233   - dayOfDirectives.put60(d60);
234   - return code;
235   - }
236   -
237   - /**
238   - * 线路切换
239   - */
240   - @Override
241   - public int lineChange(String nbbm, String lineCode, String sender) {
242   - return lineChangeByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm), lineCode, sender);
243   - }
244   -
245   -
246   - @Override
247   - public int lineChangeByDeviceId(String deviceId, String lineCode, String sender) {
248   - DirectiveCreator crt = new DirectiveCreator();
249   - Long t = System.currentTimeMillis();
250   - //生成64数据包
251   - D64 d64 = crt.create64(deviceId, lineCode, t);
252   -
253   - if (null != sender)
254   - d64.setSender(sender);
255   - else
256   - d64.setSender("系统");
257   -
258   - //String deviceId = d64.getDeviceId();
259   - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64));
260   - // 入库
261   - d64.setHttpCode(code);
262   - d64.getData().setTxtContent("切换线路[" + BasicData.lineCode2NameMap.get(lineCode) + "]");
263   - // 通知设备刷新线路文件,忽略结果
264   - if (code == 0)
265   - GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
266   - else
267   - d64.setErrorText(" 网关通讯失败, code: " + code);
268   -
269   - dayOfDirectives.put64(d64);
270   - return code;
271   - }
272   -
273   - public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) {
274   -
275   - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
276   - String lineCode = null;
277   - if (null == deviceId) {
278   - logger.error("没有设备号对照的车辆:" + nbbm);
279   - return null;
280   - }
281   - // 根据当前GPS确定 上下行和营运状态
282   - Byte upDown = null;
283   - Integer state = null;
284   - if (null == sch) {
285   - GpsEntity gpsData = gpsRealDataBuffer.get(deviceId);
286   - if (null == gpsData) {
287   - /*
288   - * 短语指令不会变更设备状态,所以在没有gps状态对照的情况下可以下发
289   - * 其他指令在不确定状态的情况下,一律不允许
290   - */
291   - if (dispatchInstruct == 0) {
292   - upDown = 0;
293   - state = 0;
294   - } else {
295   - logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm);
296   - return null;
297   - }
298   - } else {
299   - upDown = gpsData.getUpDown();
300   - state = gpsData.getState();
301   - lineCode = gpsData.getLineId();
302   - }
303   - } else {
304   - upDown = Byte.parseByte(sch.getXlDir());
305   - state = 0;
306   - }
307   -
308   - return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state, lineCode);
309   - }
310   -
311   -/* @Override
312   - public int upDownChange(String nbbm, Integer upDown, String sender) {
313   - return send60Operation(nbbm, 0, upDown, sender);
314   - }*/
315   -
316   -
317   - @Override
318   - public Map<String, List<D80>> findNoCofm80(String lineCodes) {
319   - List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes);
320   -
321   - Map<String, List<D80>> rs = new HashMap<>();
322   - for (String code : lineList)
323   - rs.put(code, pilotReport.unconfirmed80(code));
324   -
325   - return rs;
326   - }
327   -
328   - @Override
329   - public Map<String, Object> reply80(int id, int reply) {
330   - Map<String, Object> rs = new HashMap<>();
331   - D80 d80 = pilotReport.findById(id);
332   - try {
333   - if (null == d80) {
334   - rs.put("status", ResponseCode.ERROR);
335   - rs.put("msg", "服务器没有找到对应数据!");
336   - } else if (d80.isConfirm()) {
337   - rs.put("status", ResponseCode.ERROR);
338   - rs.put("msg", "该数据已经被处理了!");
339   - } else {
340   - SysUser user = SecurityUtils.getCurrentUser();
341   - d80.setC0(reply, user.getUserName());
342   - // 入库
343   - d80Repository.save(d80);
344   - //回复网关
345   - int code = GatewayHttpUtils.postJson(JSON.toJSONString(d80.getC0()));
346   -
347   - rs.put("status", ResponseCode.SUCCESS);
348   - if (code != 0)
349   - rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!");
350   -
351   - pilotReport.reply(d80);
352   -
353   - // 通知页面
354   - Map<String, Object> sockMap = new HashMap<>();
355   - sockMap.put("fn", "d80Confirm");
356   - sockMap.put("id", d80.getId());
357   - sockMap.put("lineId", d80.getData().getLineId());
358   - socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), JSON.toJSONString(sockMap));
359   - }
360   - } catch (Exception e) {
361   - logger.error("80响应出现异常...", e);
362   - rs.put("status", ResponseCode.SUCCESS);
363   - }
364   -
365   - return rs;
366   - }
367   -
368   - @Override
369   - public Map<String, Object> findDirective(String nbbms, int dType, int page, int size) {
370   - Map<String, Object> rsMap = new HashMap<>();
371   - try{
372   -
373   - List<String> carArray = new ArrayList<>(), deviceArray=new ArrayList<>();
374   - if(StringUtils.isNotEmpty(nbbms)){
375   - carArray = Splitter.on(",").splitToList(nbbms);
376   - //转换成设备号
377   - Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
378   - for(int i = 0, len=carArray.size(); i < len; i++){
379   - deviceArray.add(nbbm2deviceMap.get(carArray.get(i)));
380   - }
381   - }
382   -
383   - List<Directive> list = new ArrayList<>();
384   - switch (dType) {
385   - case -1:
386   - //所有指令
387   - list = new ArrayList<>(dayOfDirectives.all());
388   - break;
389   - case 0:
390   - //调度指令
391   - Collection<D60> dptArray = dayOfDirectives.all60();
392   - for (D60 d60 : dptArray) {
393   - if (d60.isDispatch())
394   - list.add(d60);
395   - }
396   - break;
397   - case 1:
398   - //运营指令
399   - Collection<D60> yyArray = dayOfDirectives.all60();
400   - for (D60 d60 : yyArray) {
401   - if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x03
402   - && !d60.isDispatch())
403   - list.add(d60);
404   - }
405   - break;
406   - case 2:
407   - //线路切换指令
408   - list.addAll(dayOfDirectives.all64());
409   - break;
410   - case 3:
411   - //消息短语
412   - Collection<D60> dyArray = dayOfDirectives.all60();
413   - for (D60 d60 : dyArray) {
414   - if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x00
415   - && !d60.isDispatch())
416   - list.add(d60);
417   - }
418   - break;
419   - }
420   -
421   - // 时间倒序
422   - Collections.sort(list, new DayOfDirectives.DComparator());
423   - if(deviceArray.size() > 0){
424   - //按设备号过滤
425   - List<Directive> subList = new ArrayList<>();
426   - for (Directive d : list) {
427   - if (deviceArray.contains(d.getDeviceId())) {
428   - subList.add(d);
429   - }
430   - }
431   - list = subList;
432   - }
433   -
434   - for(Directive d : list){
435   - d.setTimeHHmm(fmtHHmm.print(d.getTimestamp()));
436   - d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId()));
437   - }
438   -
439   - int count = list.size();
440   - // 分页
441   - int s = page * size, e = s + size;
442   -
443   - if (e > count)
444   - e = count;
445   -
446   - List<Directive> rs = list.subList(s, e);
447   - rsMap.put("list", rs);
448   - rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size);
449   - rsMap.put("page", page);
450   - }catch (Exception e){
451   - logger.error("", e);
452   - throw e;
453   - }
454   - return rsMap;
455   - }
456   -
457   - @Override
458   - public Map<String, Object> findAll80(Map<String, Object> map, int page, int size) {
459   -
460   - List all = ListFilterUtils.filter(pilotReport.findAll(), map, D80.class);
461   - //排序
462   - Collections.sort(all, new Comparator<D80>() {
463   - @Override
464   - public int compare(D80 o1, D80 o2) {
465   - return (int) (o2.getTimestamp() - o1.getTimestamp());
466   - }
467   - });
468   - List<D80> d80s = ListPageQueryUtils.paging(all, page, size);
469   - //时间格式化
470   - for (D80 d80 : d80s) {
471   - d80.setTimeStr(fmtHHmm.print(d80.getTimestamp()));
472   - }
473   - Map<String, Object> rsMap = new HashMap<>();
474   - rsMap.put("list", d80s);
475   - rsMap.put("totalPages", all.size() % size == 0 ? all.size() / size - 1: all.size() / size);
476   - rsMap.put("page", page);
477   - return rsMap;
478   - }
479   -
480   - @Override
481   - public D64 save64(D64 d64) {
482   - return d64Repository.save(d64);
483   - }
484   -
485   - @Override
486   - public Map<String, Object> sendC0A4(String nbbm) {
487   - Map<String, Object> rs = new HashMap<>();
488   -
489   - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
490   -
491   - GpsEntity gps = gpsRealDataBuffer.get(deviceId);
492   - if(gps == null || gps.isOffline()){
493   - rs.put("status", ResponseCode.ERROR);
494   - rs.put("msg", "下发指令失败,设备离线");
495   - return rs;
496   - }
497   -
498   - Map<String, Object> c0a4 = new HashMap<>();
499   - c0a4.put("deviceId", deviceId);
500   - c0a4.put("timestamp", System.currentTimeMillis());
501   - c0a4.put("operCode", (short) 0xC0);
502   -
503   - Map<String, Object> data = new HashMap<>();
504   - data.put("deviceId", deviceId);
505   - data.put("operCode2", (short) 0xA4);
506   - c0a4.put("data", data);
507   -
508   - int code = GatewayHttpUtils.postJson(JSON.toJSONString(c0a4));
509   - if(code != 0){
510   - rs.put("status", ResponseCode.ERROR);
511   - rs.put("msg", "和网关通讯失败, code " + code);
512   - }
513   - else{
514   - rs.put("status", ResponseCode.SUCCESS);
515   - }
516   - return rs;
517   - }
518   -
519   - @Override
520   - public int sendC0A3(DC0_A3 c0a3) {
521   - GatewayHttpUtils.postJson(JSON.toJSONString(c0a3));
522   - return 0;
523   - }
524   -
525   - @Override
526   - public int sendC0A5(String json) {
527   - return GatewayHttpUtils.postJson(json);
528   - }
529   -
530   - @Override
531   - public int refreshLineFile(String deviceId) {
532   - GpsEntity gps = gpsRealDataBuffer.get(deviceId);
533   - if (gps == null)
534   - return -1;
535   -
536   - return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId()));
537   - }
538   -
539   -/* @Override
540   - public int stateChange(String nbbm, Integer upDown, Integer state, String userName) {
541   - return send60Operation(nbbm, state, upDown, userName);
542   - }*/
543   -
544   - @Override
545   - public Map<String, Object> deviceCofigList(Map<String, String> map, int page, int size) {
546   - Map<String, Object> rs = new HashMap<>();
547   - try {
548   - String conts="";
549   - if(StringUtils.isNotBlank(map.get("lineId"))){
550   - conts+=" AND xl='" + map.get("lineId")+"'";
551   - }
552   - if(StringUtils.isNotBlank(map.get("nbbm"))){
553   - conts+=" AND inside_code like '%" + map.get("nbbm")+"%'";
554   - }
555   - if(StringUtils.isNotBlank(map.get("deviceId"))){
556   - conts+=" AND equipment_code like '%" + map.get("deviceId")+"%'";
557   - }
558   -
559   - String sql = "select * from (SELECT * FROM (SELECT id AS cl_id,inside_code,equipment_code FROM bsth_c_cars ) t1 LEFT JOIN bsth_v_c0_a4 t2 ON t1.equipment_code = t2.id LEFT JOIN (SELECT xl,cl FROM bsth_c_s_ccinfo WHERE id IN (SELECT max(id) FROM bsth_c_s_ccinfo GROUP BY cl)) t3 ON t1.cl_id = t3.cl ORDER BY t2.`timestamp` DESC) t4 where 1=1 "+conts;
560   -
561   - int count = jdbcTemplate.queryForObject("select count(*) from ("+sql+") c1", Integer.class);
562   - int totalPages = count % size == 0 ? count / size : count / size + 1;
563   - int s = page * size;
564   - List<DeviceConfigDto> list = jdbcTemplate.query(sql + " LIMIT " + s + "," + size, new BeanPropertyRowMapper<>(DeviceConfigDto.class));
565   -
566   - rs.put("status", ResponseCode.SUCCESS);
567   - rs.put("list", list);
568   - rs.put("totalPages", totalPages);
569   - rs.put("page", page);
570   - } catch (Exception e) {
571   - e.printStackTrace();
572   - logger.error("", e);
573   - rs.put("status", ResponseCode.ERROR);
574   - }
575   - return rs;
576   - }
577   -}
  1 +package com.bsth.service.directive;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.data.BasicData;
  7 +import com.bsth.data.directive.DayOfDirectives;
  8 +import com.bsth.data.directive.DirectiveCreator;
  9 +import com.bsth.data.directive.GatewayHttpUtils;
  10 +import com.bsth.data.gpsdata_v2.GpsRealData;
  11 +import com.bsth.data.gpsdata_v2.entity.GpsEntity;
  12 +import com.bsth.data.pilot80.PilotReport;
  13 +import com.bsth.data.schedule.DayOfSchedule;
  14 +import com.bsth.data.utils.ListFilterUtils;
  15 +import com.bsth.data.utils.ListPageQueryUtils;
  16 +import com.bsth.entity.directive.*;
  17 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  18 +import com.bsth.entity.sys.SysUser;
  19 +import com.bsth.repository.directive.D60Repository;
  20 +import com.bsth.repository.directive.D64Repository;
  21 +import com.bsth.repository.directive.D80Repository;
  22 +import com.bsth.security.util.SecurityUtils;
  23 +import com.bsth.service.directive.dto.DeviceConfigDto;
  24 +import com.bsth.service.impl.BaseServiceImpl;
  25 +import com.bsth.websocket.handler.RealControlSocketHandler;
  26 +import com.fasterxml.jackson.core.JsonProcessingException;
  27 +import com.fasterxml.jackson.databind.ObjectMapper;
  28 +import com.google.common.base.Splitter;
  29 +import org.apache.commons.lang3.StringEscapeUtils;
  30 +import org.apache.commons.lang3.StringUtils;
  31 +import org.joda.time.format.DateTimeFormat;
  32 +import org.joda.time.format.DateTimeFormatter;
  33 +import org.slf4j.Logger;
  34 +import org.slf4j.LoggerFactory;
  35 +import org.springframework.beans.factory.annotation.Autowired;
  36 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  37 +import org.springframework.jdbc.core.JdbcTemplate;
  38 +import org.springframework.stereotype.Service;
  39 +
  40 +import java.util.*;
  41 +
  42 +@Service
  43 +public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implements DirectiveService {
  44 +
  45 + Logger logger = LoggerFactory.getLogger(this.getClass());
  46 +
  47 + @Autowired
  48 + D60Repository d60Repository;
  49 +
  50 + @Autowired
  51 + GpsRealData gpsRealDataBuffer;
  52 +
  53 + @Autowired
  54 + D64Repository d64Repository;
  55 +
  56 + @Autowired
  57 + RealControlSocketHandler socketHandler;
  58 +
  59 + @Autowired
  60 + D80Repository d80Repository;
  61 +
  62 + @Autowired
  63 + DayOfDirectives dayOfDirectives;
  64 +
  65 + @Autowired
  66 + PilotReport pilotReport;
  67 +
  68 + @Autowired
  69 + DayOfSchedule dayOfSchedule;
  70 +
  71 + @Autowired
  72 + JdbcTemplate jdbcTemplate;
  73 +
  74 + //static Long schDiff = 1000 * 60 * 60L;
  75 +
  76 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"), fmtHHmm_CN = DateTimeFormat.forPattern("HH点mm分");
  77 +
  78 + @Override
  79 + public int send60Phrase(String nbbm, String text, String sender) {
  80 + D60 d60 = null;
  81 + try {
  82 + text = StringEscapeUtils.unescapeHtml4(text);
  83 + text = text.replaceAll("#", "");
  84 + d60 = create60Data(nbbm, text, (short) 0x00, null);
  85 + } catch (Exception e) {
  86 + logger.error("发送消息短语出现异常", e);
  87 + return -1;
  88 + }
  89 +
  90 + if (null == d60)
  91 + return -1;
  92 +
  93 + // 发送指令
  94 + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
  95 + if (null != sender)
  96 + d60.setSender(sender);
  97 + d60.setHttpCode(code);
  98 +
  99 + if (code != 0)
  100 + d60.setErrorText("网关通讯失败, code: " + code);
  101 +
  102 + dayOfDirectives.put60(d60);
  103 + return code;
  104 + }
  105 +
  106 + @Override
  107 + public int send60Dispatch(ScheduleRealInfo sch, int finish, String sender, String txtPrefix) {
  108 + D60 d60 = null;
  109 + try {
  110 + if (sch.isDestroy()) {
  111 + logger.warn("烂班不允许发送调度指令....");
  112 + return -1;
  113 + }
  114 +
  115 + //待发应到时间
  116 + String dfsj = fmtHHmm.print(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000));
  117 + String text = "您已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由"
  118 + + sch.getQdzName() + "发往" + sch.getZdzName() + ";应到 " + dfsj;
  119 +
  120 + if(sch.getBcType().equals("venting")){
  121 + text += " (直放)";
  122 + }
  123 + else if(sch.getBcType().equals("major")){
  124 + text += " (放站到"+sch.getMajorStationName()+"带客)";
  125 + } else if ("ldks".equals(sch.getBcType())) {
  126 + text += " (两点空驶)";
  127 + }
  128 +
  129 + //下发0x02指令 调度指令(闹钟有效)
  130 + long t = System.currentTimeMillis() + 1000 * 30,
  131 + alarmTime = sch.getDfsjT() < t?t:sch.getDfsjT();
  132 +
  133 + if(StringUtils.isNotEmpty(txtPrefix)){
  134 + text = txtPrefix + text;
  135 + }
  136 + text = StringEscapeUtils.unescapeHtml4(text);
  137 + int state = 0;//营运状态
  138 + if(dayOfSchedule.emptyService(sch))
  139 + state = 1;
  140 + d60 = new DirectiveCreator().createD60_02(sch.getClZbh(), text, Integer.parseInt(sch.getXlDir())
  141 + , state, new Date(alarmTime));
  142 +
  143 + d60.setLineCode(sch.getXlBm());
  144 + } catch (Exception e) {
  145 + logger.error("生成调度指令时出现异常", e);
  146 + return -1;
  147 + }
  148 +
  149 + if (null == d60)
  150 + return -1;
  151 +
  152 + d60.setSender(sender);
  153 + d60.setSch(sch);
  154 + JSONObject jObj = JSON.parseObject(JSON.toJSONString(d60));
  155 +
  156 + //进场或者出场班次时,附加lock 标识
  157 + if (null != sch.getBcType()
  158 + && (sch.getBcType().equals("out") || sch.getBcType().equals("in"))) {
  159 +
  160 + jObj.put("lock", 1);
  161 + }
  162 +
  163 + // 发送指令
  164 + int code = GatewayHttpUtils.postJson(jObj.toJSONString());
  165 +
  166 + d60.setDispatch(true);
  167 + d60.setHttpCode(code);
  168 +
  169 + if (code == 0) {
  170 + sch.setDirectiveState(60);
  171 + // 通知页面
  172 + sendD60ToPage(sch);
  173 + } else {
  174 + d60.setErrorText("网关通讯失败, code: " + code);
  175 + }
  176 +
  177 + dayOfDirectives.put60(d60);
  178 + return code;
  179 + }
  180 +
  181 + /**
  182 + * @Title: sendDirectiveState @Description: TODO(向页面推送班次指令状态) @throws
  183 + */
  184 + @Override
  185 + public void sendD60ToPage(ScheduleRealInfo sch) {
  186 + Map<String, Object> map = new HashMap<>();
  187 + map.put("fn", "directive");
  188 + map.put("t", sch);
  189 +
  190 + ObjectMapper mapper = new ObjectMapper();
  191 +
  192 + try {
  193 + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map));
  194 + } catch (JsonProcessingException e) {
  195 + logger.error("", e);
  196 + }
  197 + }
  198 +
  199 + @Override
  200 + public int send60Dispatch(Long id, String sender) {
  201 + ScheduleRealInfo sch = dayOfSchedule.get(id);
  202 + // 车辆已完成班次
  203 + int finish = dayOfSchedule.doneSum(sch.getClZbh());
  204 + return send60Dispatch(sch, finish, sender, "");
  205 + }
  206 +
  207 + @Override
  208 + public int send60Operation(String nbbm, int state, int upDown, String sender) {
  209 + logger.info("切换运营状态, nbbm: " + nbbm + " ,state: " + state + " ,upDown:" + upDown);
  210 +
  211 + String text = "切换为 " + (upDown == 0 ? "上行" : "下行") + (state == 0 ? "营运" : "未营运");
  212 + D60 d60 = new DirectiveCreator().createD60(nbbm, text, (short) 0x03, upDown, state, null);
  213 +
  214 + if (null == d60)
  215 + return -1;
  216 + if (null != sender)
  217 + d60.setSender(sender);
  218 + else
  219 + d60.setSender("系统");
  220 + // 发送指令
  221 + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60));
  222 + // 添加到缓存,等待入库
  223 + d60.setHttpCode(code);
  224 +
  225 + GpsEntity gps = gpsRealDataBuffer.getByNbbm(nbbm);
  226 + if(null != gps)
  227 + d60.setLineCode(gps.getLineId());
  228 +
  229 + if (code != 0)
  230 + d60.setErrorText("网关通讯失败, code: " + code);
  231 +
  232 + dayOfDirectives.put60(d60);
  233 + return code;
  234 + }
  235 +
  236 + /**
  237 + * 线路切换
  238 + */
  239 + @Override
  240 + public int lineChange(String nbbm, String lineCode, String sender) {
  241 + return lineChangeByDeviceId(BasicData.deviceId2NbbmMap.inverse().get(nbbm), lineCode, sender);
  242 + }
  243 +
  244 +
  245 + @Override
  246 + public int lineChangeByDeviceId(String deviceId, String lineCode, String sender) {
  247 + DirectiveCreator crt = new DirectiveCreator();
  248 + Long t = System.currentTimeMillis();
  249 + //生成64数据包
  250 + D64 d64 = crt.create64(deviceId, lineCode, t);
  251 +
  252 + if (null != sender)
  253 + d64.setSender(sender);
  254 + else
  255 + d64.setSender("系统");
  256 +
  257 + //String deviceId = d64.getDeviceId();
  258 + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64));
  259 + // 入库
  260 + d64.setHttpCode(code);
  261 + d64.getData().setTxtContent("切换线路[" + BasicData.lineCode2NameMap.get(lineCode) + "]");
  262 + // 通知设备刷新线路文件,忽略结果
  263 + if (code == 0)
  264 + GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode));
  265 + else
  266 + d64.setErrorText(" 网关通讯失败, code: " + code);
  267 +
  268 + dayOfDirectives.put64(d64);
  269 + return code;
  270 + }
  271 +
  272 + public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) {
  273 +
  274 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  275 + String lineCode = null;
  276 + if (null == deviceId) {
  277 + logger.error("没有设备号对照的车辆:" + nbbm);
  278 + return null;
  279 + }
  280 + // 根据当前GPS确定 上下行和营运状态
  281 + Byte upDown = null;
  282 + Integer state = null;
  283 + if (null == sch) {
  284 + GpsEntity gpsData = gpsRealDataBuffer.get(deviceId);
  285 + if (null == gpsData) {
  286 + /*
  287 + * 短语指令不会变更设备状态,所以在没有gps状态对照的情况下可以下发
  288 + * 其他指令在不确定状态的情况下,一律不允许
  289 + */
  290 + if (dispatchInstruct == 0) {
  291 + upDown = 0;
  292 + state = 0;
  293 + } else {
  294 + logger.error("没有找到gps对照,无法确认营运状态和上下行:" + nbbm);
  295 + return null;
  296 + }
  297 + } else {
  298 + upDown = gpsData.getUpDown();
  299 + state = gpsData.getState();
  300 + lineCode = gpsData.getLineId();
  301 + }
  302 + } else {
  303 + upDown = Byte.parseByte(sch.getXlDir());
  304 + state = 0;
  305 + }
  306 +
  307 + return new DirectiveCreator().createD60(nbbm, text, dispatchInstruct, upDown, state, lineCode);
  308 + }
  309 +
  310 +/* @Override
  311 + public int upDownChange(String nbbm, Integer upDown, String sender) {
  312 + return send60Operation(nbbm, 0, upDown, sender);
  313 + }*/
  314 +
  315 +
  316 + @Override
  317 + public Map<String, List<D80>> findNoCofm80(String lineCodes) {
  318 + List<String> lineList = Splitter.on(",").trimResults().splitToList(lineCodes);
  319 +
  320 + Map<String, List<D80>> rs = new HashMap<>();
  321 + for (String code : lineList)
  322 + rs.put(code, pilotReport.unconfirmed80(code));
  323 +
  324 + return rs;
  325 + }
  326 +
  327 + @Override
  328 + public Map<String, Object> reply80(int id, int reply) {
  329 + Map<String, Object> rs = new HashMap<>();
  330 + D80 d80 = pilotReport.findById(id);
  331 + try {
  332 + if (null == d80) {
  333 + rs.put("status", ResponseCode.ERROR);
  334 + rs.put("msg", "服务器没有找到对应数据!");
  335 + } else if (d80.isConfirm()) {
  336 + rs.put("status", ResponseCode.ERROR);
  337 + rs.put("msg", "该数据已经被处理了!");
  338 + } else {
  339 + SysUser user = SecurityUtils.getCurrentUser();
  340 + d80.setC0(reply, user.getUserName());
  341 + // 入库
  342 + d80Repository.save(d80);
  343 + //回复网关
  344 + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d80.getC0()));
  345 +
  346 + rs.put("status", ResponseCode.SUCCESS);
  347 + if (code != 0)
  348 + rs.put("msg", "发送C0响应指令到车载设备失败,但该操作已经被系统记录!");
  349 +
  350 + pilotReport.reply(d80);
  351 +
  352 + // 通知页面
  353 + Map<String, Object> sockMap = new HashMap<>();
  354 + sockMap.put("fn", "d80Confirm");
  355 + sockMap.put("id", d80.getId());
  356 + sockMap.put("lineId", d80.getData().getLineId());
  357 + socketHandler.sendMessageToLine(d80.getData().getLineId().toString(), JSON.toJSONString(sockMap));
  358 + }
  359 + } catch (Exception e) {
  360 + logger.error("80响应出现异常...", e);
  361 + rs.put("status", ResponseCode.SUCCESS);
  362 + }
  363 +
  364 + return rs;
  365 + }
  366 +
  367 + @Override
  368 + public Map<String, Object> findDirective(String nbbms, int dType, int page, int size) {
  369 + Map<String, Object> rsMap = new HashMap<>();
  370 + try{
  371 +
  372 + List<String> carArray = new ArrayList<>(), deviceArray=new ArrayList<>();
  373 + if(StringUtils.isNotEmpty(nbbms)){
  374 + carArray = Splitter.on(",").splitToList(nbbms);
  375 + //转换成设备号
  376 + Map<String, String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse();
  377 + for(int i = 0, len=carArray.size(); i < len; i++){
  378 + deviceArray.add(nbbm2deviceMap.get(carArray.get(i)));
  379 + }
  380 + }
  381 +
  382 + List<Directive> list = new ArrayList<>();
  383 + switch (dType) {
  384 + case -1:
  385 + //所有指令
  386 + list = new ArrayList<>(dayOfDirectives.all());
  387 + break;
  388 + case 0:
  389 + //调度指令
  390 + Collection<D60> dptArray = dayOfDirectives.all60();
  391 + for (D60 d60 : dptArray) {
  392 + if (d60.isDispatch())
  393 + list.add(d60);
  394 + }
  395 + break;
  396 + case 1:
  397 + //运营指令
  398 + Collection<D60> yyArray = dayOfDirectives.all60();
  399 + for (D60 d60 : yyArray) {
  400 + if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x03
  401 + && !d60.isDispatch())
  402 + list.add(d60);
  403 + }
  404 + break;
  405 + case 2:
  406 + //线路切换指令
  407 + list.addAll(dayOfDirectives.all64());
  408 + break;
  409 + case 3:
  410 + //消息短语
  411 + Collection<D60> dyArray = dayOfDirectives.all60();
  412 + for (D60 d60 : dyArray) {
  413 + if (d60 != null && d60.getData().getDispatchInstruct() == (short) 0x00
  414 + && !d60.isDispatch())
  415 + list.add(d60);
  416 + }
  417 + break;
  418 + }
  419 +
  420 + // 时间倒序
  421 + Collections.sort(list, new DayOfDirectives.DComparator());
  422 + if(deviceArray.size() > 0){
  423 + //按设备号过滤
  424 + List<Directive> subList = new ArrayList<>();
  425 + for (Directive d : list) {
  426 + if (deviceArray.contains(d.getDeviceId())) {
  427 + subList.add(d);
  428 + }
  429 + }
  430 + list = subList;
  431 + }
  432 +
  433 + for(Directive d : list){
  434 + d.setTimeHHmm(fmtHHmm.print(d.getTimestamp()));
  435 + d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId()));
  436 + }
  437 +
  438 + int count = list.size();
  439 + // 分页
  440 + int s = page * size, e = s + size;
  441 +
  442 + if (e > count)
  443 + e = count;
  444 +
  445 + List<Directive> rs = list.subList(s, e);
  446 + rsMap.put("list", rs);
  447 + rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size);
  448 + rsMap.put("page", page);
  449 + }catch (Exception e){
  450 + logger.error("", e);
  451 + throw e;
  452 + }
  453 + return rsMap;
  454 + }
  455 +
  456 + @Override
  457 + public Map<String, Object> findAll80(Map<String, Object> map, int page, int size) {
  458 +
  459 + List all = ListFilterUtils.filter(pilotReport.findAll(), map, D80.class);
  460 + //排序
  461 + Collections.sort(all, new Comparator<D80>() {
  462 + @Override
  463 + public int compare(D80 o1, D80 o2) {
  464 + return (int) (o2.getTimestamp() - o1.getTimestamp());
  465 + }
  466 + });
  467 + List<D80> d80s = ListPageQueryUtils.paging(all, page, size);
  468 + //时间格式化
  469 + for (D80 d80 : d80s) {
  470 + d80.setTimeStr(fmtHHmm.print(d80.getTimestamp()));
  471 + }
  472 + Map<String, Object> rsMap = new HashMap<>();
  473 + rsMap.put("list", d80s);
  474 + rsMap.put("totalPages", all.size() % size == 0 ? all.size() / size - 1: all.size() / size);
  475 + rsMap.put("page", page);
  476 + return rsMap;
  477 + }
  478 +
  479 + @Override
  480 + public D64 save64(D64 d64) {
  481 + return d64Repository.save(d64);
  482 + }
  483 +
  484 + @Override
  485 + public Map<String, Object> sendC0A4(String nbbm) {
  486 + Map<String, Object> rs = new HashMap<>();
  487 +
  488 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  489 +
  490 + GpsEntity gps = gpsRealDataBuffer.get(deviceId);
  491 + if(gps == null || gps.isOffline()){
  492 + rs.put("status", ResponseCode.ERROR);
  493 + rs.put("msg", "下发指令失败,设备离线");
  494 + return rs;
  495 + }
  496 +
  497 + Map<String, Object> c0a4 = new HashMap<>();
  498 + c0a4.put("deviceId", deviceId);
  499 + c0a4.put("timestamp", System.currentTimeMillis());
  500 + c0a4.put("operCode", (short) 0xC0);
  501 +
  502 + Map<String, Object> data = new HashMap<>();
  503 + data.put("deviceId", deviceId);
  504 + data.put("operCode2", (short) 0xA4);
  505 + c0a4.put("data", data);
  506 +
  507 + int code = GatewayHttpUtils.postJson(JSON.toJSONString(c0a4));
  508 + if(code != 0){
  509 + rs.put("status", ResponseCode.ERROR);
  510 + rs.put("msg", "和网关通讯失败, code " + code);
  511 + }
  512 + else{
  513 + rs.put("status", ResponseCode.SUCCESS);
  514 + }
  515 + return rs;
  516 + }
  517 +
  518 + @Override
  519 + public int sendC0A3(DC0_A3 c0a3) {
  520 + GatewayHttpUtils.postJson(JSON.toJSONString(c0a3));
  521 + return 0;
  522 + }
  523 +
  524 + @Override
  525 + public int sendC0A5(String json) {
  526 + return GatewayHttpUtils.postJson(json);
  527 + }
  528 +
  529 + @Override
  530 + public int refreshLineFile(String deviceId) {
  531 + GpsEntity gps = gpsRealDataBuffer.get(deviceId);
  532 + if (gps == null)
  533 + return -1;
  534 +
  535 + return GatewayHttpUtils.postJson(new DirectiveCreator().createDeviceRefreshData(deviceId, gps.getLineId()));
  536 + }
  537 +
  538 +/* @Override
  539 + public int stateChange(String nbbm, Integer upDown, Integer state, String userName) {
  540 + return send60Operation(nbbm, state, upDown, userName);
  541 + }*/
  542 +
  543 + @Override
  544 + public Map<String, Object> deviceCofigList(Map<String, String> map, int page, int size) {
  545 + Map<String, Object> rs = new HashMap<>();
  546 + try {
  547 + String conts="";
  548 + if(StringUtils.isNotBlank(map.get("lineId"))){
  549 + conts+=" AND xl='" + map.get("lineId")+"'";
  550 + }
  551 + if(StringUtils.isNotBlank(map.get("nbbm"))){
  552 + conts+=" AND inside_code like '%" + map.get("nbbm")+"%'";
  553 + }
  554 + if(StringUtils.isNotBlank(map.get("deviceId"))){
  555 + conts+=" AND equipment_code like '%" + map.get("deviceId")+"%'";
  556 + }
  557 +
  558 + String sql = "select * from (SELECT * FROM (SELECT id AS cl_id,inside_code,equipment_code FROM bsth_c_cars ) t1 LEFT JOIN bsth_v_c0_a4 t2 ON t1.equipment_code = t2.id LEFT JOIN (SELECT xl,cl FROM bsth_c_s_ccinfo WHERE id IN (SELECT max(id) FROM bsth_c_s_ccinfo GROUP BY cl)) t3 ON t1.cl_id = t3.cl ORDER BY t2.`timestamp` DESC) t4 where 1=1 "+conts;
  559 +
  560 + int count = jdbcTemplate.queryForObject("select count(*) from ("+sql+") c1", Integer.class);
  561 + int totalPages = count % size == 0 ? count / size : count / size + 1;
  562 + int s = page * size;
  563 + List<DeviceConfigDto> list = jdbcTemplate.query(sql + " LIMIT " + s + "," + size, new BeanPropertyRowMapper<>(DeviceConfigDto.class));
  564 +
  565 + rs.put("status", ResponseCode.SUCCESS);
  566 + rs.put("list", list);
  567 + rs.put("totalPages", totalPages);
  568 + rs.put("page", page);
  569 + } catch (Exception e) {
  570 + e.printStackTrace();
  571 + logger.error("", e);
  572 + rs.put("status", ResponseCode.ERROR);
  573 + }
  574 + return rs;
  575 + }
  576 +}
... ...
src/main/resources/static/pages/base/line/add.html
... ... @@ -418,15 +418,15 @@
418 418  
419 419 <!-- 表单分组组件 form-group START -->
420 420 <div class="form-group">
421   - <!-- 上海市线路编码 START -->
  421 + <!-- 锐明线路编码 START -->
422 422 <div class="col-md-6">
423   - <label class="control-label col-md-5"> 上海市线路编码: </label>
  423 + <label class="control-label col-md-5"> 锐明线路编码: </label>
424 424 <div class="col-md-4">
425 425 <input type="text" class="form-control" name="shanghaiLinecode" id="shanghaiLinecodeInput"
426   - placeholder="上海市线路编码">
  426 + placeholder="锐明线路编码">
427 427 </div>
428 428 </div>
429   - <!-- 上海市线路编码 END -->
  429 + <!-- 锐明线路编码 END -->
430 430  
431 431 <!--设备线路编码 START -->
432 432 <div class="col-md-6">
... ...
src/main/resources/static/pages/base/line/details.html
... ... @@ -365,15 +365,15 @@
365 365  
366 366 <!-- 表单分组组件 form-group START -->
367 367 <div class="form-group">
368   - <!-- 上海市线路编码 START -->
  368 + <!-- 锐明线路编码 START -->
369 369 <div class="col-md-6">
370   - <label class="control-label col-md-5"> 上海市线路编码: </label>
  370 + <label class="control-label col-md-5"> 锐明线路编码: </label>
371 371 <div class="col-md-4">
372 372 <input type="text" class="form-control" name="shanghaiLinecode" id="shanghaiLinecodeInput"
373   - placeholder="上海市线路编码">
  373 + placeholder="锐明线路编码">
374 374 </div>
375 375 </div>
376   - <!-- 上海市线路编码 END -->
  376 + <!-- 锐明线路编码 END -->
377 377  
378 378 <!--设备线路编码 START -->
379 379 <div class="col-md-6">
... ...
src/main/resources/static/pages/base/line/edit.html
... ... @@ -379,15 +379,15 @@
379 379  
380 380 <!-- 表单分组组件 form-group START -->
381 381 <div class="form-group">
382   - <!-- 上海市线路编码 START -->
  382 + <!-- 锐明线路编码 START -->
383 383 <div class="col-md-6">
384   - <label class="control-label col-md-5"> 上海市线路编码: </label>
  384 + <label class="control-label col-md-5"> 锐明线路编码: </label>
385 385 <div class="col-md-4">
386 386 <input type="text" class="form-control" name="shanghaiLinecode" id="shanghaiLinecodeInput"
387   - placeholder="上海市线路编码">
  387 + placeholder="锐明线路编码">
388 388 </div>
389 389 </div>
390   - <!-- 上海市线路编码 END -->
  390 + <!-- 锐明线路编码 END -->
391 391  
392 392 <!--设备线路编码 START -->
393 393 <div class="col-md-6">
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -72,7 +72,7 @@
72 72 <th width="9%">所属分公司</th>
73 73 <th width="6%">线路性质</th>
74 74 <th width="6%">线路等级</th>
75   - <th width="9%">上海市线路编码</th>
  75 + <th width="9%">锐明线路编码</th>
76 76 <th width="7%">是否撤销</th>
77 77 <th width="6%">线路标准</th>
78 78 <th width="6%">站点详情</th>
... ...
src/main/resources/static/pages/trafficManage/lineStationUploadRecord.html
1   -<link href="css/trafficManage.css" rel="stylesheet" type="text/css" />
2   -<link href="css/autocompleter.css" rel="stylesheet" type="text/css" />
3   -<ul class="page-breadcrumb breadcrumb">
4   - <li><a href="/pages/home.html" data-pjax>首页</a> <i
5   - class="fa fa-circle"></i></li>
6   - <li><span class="active">运维管理</span> <i class="fa fa-circle"></i></li>
7   - <li><span class="active">车载上报停靠站</span></li>
8   -</ul>
9   -<div class="tab_line">
10   - <div class="col-md-12">
11   - <form class="form-inline" action="">
12   - <div class="inLine_block" class="param">
13   - <span class="item-label" style="width: 80px;">筛选数据:日期:</span>
14   - <input class="form-control" name="reportDate" type="text" id="dateInput" style="width: 180px;"/>
15   - </div>
16   - <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
17   - <span class="item-label" style="width: 80px;">时间范围:</span>
18   - <input type="text" name="startDate" class="inputCommon dateRange">至
19   - <input type="text" name="endDate" class="inputCommon dateRange">时
20   - </div>
21   - <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
22   - <span class="item-label" style="width: 80px;">线路名称:</span>
23   - <select class="form-control" name="lineId" id="line" style="width: 150px;"></select>
24   - </div>
25   - <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
26   - <span class="item-label" style="width: 80px;">内部编码:</span>
27   - <input type="text" name="insideCode" id="insideCode" style="width: 120px;" maxlength="40"/>
28   - </div>
29   - <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
30   - <span class="item-label" style="width: 80px;">车牌号:</span>
31   - <input type="text" name="carPlate" id="carPlate" style="width: 120px;" maxlength="40"/>
32   - <span style="color: red;width: 80px;">(沪D-12345 '沪'和'-'去掉)</span>
33   - </div>
34   - <div class="form-group" style="display: inline-block;margin-left: 15px;">
35   - <a class="btn btn-circle blue" id="search">筛选</a>
36   - </div>
37   - </form>
38   - </div>
39   - <div class="col-md-12 panel-wrap">
40   - <div class="_panel">
41   - <div class="table-container">
42   - <table
43   - class="table table-striped table-bordered table-advance pb-table head"
44   - id="vehicle_stop">
45   - <thead>
46   - <tr>
47   - <th>序号</th>
48   - <th>公司</th>
49   - <th>分公司</th>
50   - <th>线路</th>
51   - <th>上海市线路编码</th>
52   - <th>内部编码</th>
53   - <th>设备编码</th>
54   - <th>车牌</th>
55   - <th>站点序号</th>
56   - <th>营运状态</th>
57   - <th>上下行</th>
58   - <th>站内外</th>
59   - <th>上报时间</th>
60   - </tr>
61   - </thead>
62   - <tbody>
63   - </tbody>
64   - </table>
65   - <div style="text-align: right;">
66   - <ul id="pagination" class="pagination"></ul>
67   - </div>
68   - </div>
69   - </div>
70   - </div>
71   -</div>
72   -<script id="lineStationUploadRecord_list_temp" type="text/html">
73   -{{each list as obj i}}
74   -<tr>
75   - <td class="seq" style="vertical-align: middle;">
76   - {{i+1}}
77   - </td>
78   - <td>
79   - {{obj['branche_company']}}
80   - </td>
81   - <td>
82   - {{obj['company']}}
83   - </td>
84   - <td>
85   - {{obj['name']}}
86   - </td>
87   - <td>
88   - {{obj['shanghai_linecode']}}
89   - </td>
90   - <td>
91   - {{obj['inside_code']}}
92   - </td>
93   - <td>
94   - {{obj['equipment_code']}}
95   - </td>
96   - <td>
97   - {{obj['car_plate']}}
98   - </td>
99   - <td>
100   - {{obj['stop']}}
101   - </td>
102   - <td>
103   - {{obj['service_state']}}
104   - </td>
105   - <td>
106   - {{obj['up_down']}}
107   - </td>
108   - <td>
109   - {{obj['in_out_stop']}}
110   - </td>
111   - <td>
112   - {{obj['report_date']}}
113   - </td>
114   -</tr>
115   -{{/each}}
116   -{{if list.length == 0}}
117   -<tr class="muted">
118   - <td colspan=13 style="text-align: center;"><h6>没有找到相关数据</h6></td>
119   -</tr>
120   -{{/if}}
121   - </script>
  1 +<link href="css/trafficManage.css" rel="stylesheet" type="text/css" />
  2 +<link href="css/autocompleter.css" rel="stylesheet" type="text/css" />
  3 +<ul class="page-breadcrumb breadcrumb">
  4 + <li><a href="/pages/home.html" data-pjax>首页</a> <i
  5 + class="fa fa-circle"></i></li>
  6 + <li><span class="active">运维管理</span> <i class="fa fa-circle"></i></li>
  7 + <li><span class="active">车载上报停靠站</span></li>
  8 +</ul>
  9 +<div class="tab_line">
  10 + <div class="col-md-12">
  11 + <form class="form-inline" action="">
  12 + <div class="inLine_block" class="param">
  13 + <span class="item-label" style="width: 80px;">筛选数据:日期:</span>
  14 + <input class="form-control" name="reportDate" type="text" id="dateInput" style="width: 180px;"/>
  15 + </div>
  16 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  17 + <span class="item-label" style="width: 80px;">时间范围:</span>
  18 + <input type="text" name="startDate" class="inputCommon dateRange">至
  19 + <input type="text" name="endDate" class="inputCommon dateRange">时
  20 + </div>
  21 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  22 + <span class="item-label" style="width: 80px;">线路名称:</span>
  23 + <select class="form-control" name="lineId" id="line" style="width: 150px;"></select>
  24 + </div>
  25 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  26 + <span class="item-label" style="width: 80px;">内部编码:</span>
  27 + <input type="text" name="insideCode" id="insideCode" style="width: 120px;" maxlength="40"/>
  28 + </div>
  29 + <div class="inLine_block" style="display: inline-block;margin-left: 15px;">
  30 + <span class="item-label" style="width: 80px;">车牌号:</span>
  31 + <input type="text" name="carPlate" id="carPlate" style="width: 120px;" maxlength="40"/>
  32 + <span style="color: red;width: 80px;">(沪D-12345 '沪'和'-'去掉)</span>
  33 + </div>
  34 + <div class="form-group" style="display: inline-block;margin-left: 15px;">
  35 + <a class="btn btn-circle blue" id="search">筛选</a>
  36 + </div>
  37 + </form>
  38 + </div>
  39 + <div class="col-md-12 panel-wrap">
  40 + <div class="_panel">
  41 + <div class="table-container">
  42 + <table
  43 + class="table table-striped table-bordered table-advance pb-table head"
  44 + id="vehicle_stop">
  45 + <thead>
  46 + <tr>
  47 + <th>序号</th>
  48 + <th>公司</th>
  49 + <th>分公司</th>
  50 + <th>线路</th>
  51 + <th>锐明线路编码</th>
  52 + <th>内部编码</th>
  53 + <th>设备编码</th>
  54 + <th>车牌</th>
  55 + <th>站点序号</th>
  56 + <th>营运状态</th>
  57 + <th>上下行</th>
  58 + <th>站内外</th>
  59 + <th>上报时间</th>
  60 + </tr>
  61 + </thead>
  62 + <tbody>
  63 + </tbody>
  64 + </table>
  65 + <div style="text-align: right;">
  66 + <ul id="pagination" class="pagination"></ul>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + </div>
  71 +</div>
  72 +<script id="lineStationUploadRecord_list_temp" type="text/html">
  73 +{{each list as obj i}}
  74 +<tr>
  75 + <td class="seq" style="vertical-align: middle;">
  76 + {{i+1}}
  77 + </td>
  78 + <td>
  79 + {{obj['branche_company']}}
  80 + </td>
  81 + <td>
  82 + {{obj['company']}}
  83 + </td>
  84 + <td>
  85 + {{obj['name']}}
  86 + </td>
  87 + <td>
  88 + {{obj['shanghai_linecode']}}
  89 + </td>
  90 + <td>
  91 + {{obj['inside_code']}}
  92 + </td>
  93 + <td>
  94 + {{obj['equipment_code']}}
  95 + </td>
  96 + <td>
  97 + {{obj['car_plate']}}
  98 + </td>
  99 + <td>
  100 + {{obj['stop']}}
  101 + </td>
  102 + <td>
  103 + {{obj['service_state']}}
  104 + </td>
  105 + <td>
  106 + {{obj['up_down']}}
  107 + </td>
  108 + <td>
  109 + {{obj['in_out_stop']}}
  110 + </td>
  111 + <td>
  112 + {{obj['report_date']}}
  113 + </td>
  114 +</tr>
  115 +{{/each}}
  116 +{{if list.length == 0}}
  117 +<tr class="muted">
  118 + <td colspan=13 style="text-align: center;"><h6>没有找到相关数据</h6></td>
  119 +</tr>
  120 +{{/if}}
  121 + </script>
122 122 <script src="./js/lineStationUploadRecord.js"></script>
123 123 \ No newline at end of file
... ...