Commit 911b7a219c2506d6717fec22325114bf2e631d33

Authored by ljq
1 parent 037e3cd9

安全驾驶图像信息(当日) 加入异常类型 未带口罩,抽烟打电话

src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
... ... @@ -45,8 +45,10 @@ public class SafeDrivCenter implements ApplicationContextAware {
45 45 private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");
46 46 public static void put(SafeDriv sd){
47 47 sd.setTs(fmt.parseMillis(sd.getStartime()));
48   -
49   - if(sd.getYczltype().indexOf("A") == -1)
  48 + if(Integer.parseInt(sd.getYczltype()) == 5 && Integer.parseInt(sd.getJctype()) == 4
  49 + || Integer.parseInt(sd.getYczltype()) == 6 && Integer.parseInt(sd.getJctype()) == 4)
  50 + sd.setJctype("B" + sd.getJctype());
  51 + else if(sd.getYczltype().indexOf("A") == -1)
50 52 sd.setYczltype("A" + sd.getYczltype());
51 53  
52 54 //SafeDriv old = safeMap.get(sd.getClzbh());
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -114,10 +114,10 @@ public class GpsServiceImpl implements GpsService {
114 114  
115 115 @Autowired
116 116 LineRepository lineRepository;
117   -
  117 +
118 118 @Autowired
119 119 LsStationRouteRepository lsStationRouteRepository;
120   -
  120 +
121 121 @Autowired
122 122 LsSectionRouteRepository lsSectionRouteRepository;
123 123  
... ... @@ -275,25 +275,25 @@ public class GpsServiceImpl implements GpsService {
275 275 List<Map<String, Object>> gpsEqualsZeroList=new ArrayList<>();
276 276 Map<String, Object> map = null;
277 277 int oldLineId = -1, oldGpsValid = -1, oldLonlat = -1;
278   -
  278 +
279 279 // 默认加入一个线路切换信息
280 280 Map<String, Object> fls = new HashMap<String, Object>();
281 281 fls.put("abnormalType", "normal");
282 282 fls.put("st", "-1");
283 283 lineSwitch.add(fls);
284   -
  284 +
285 285 // 默认加入一个GPS无效异常信息
286 286 Map<String, Object> fgv = new HashMap<String, Object>();
287 287 fgv.put("abnormalType", "normal");
288 288 fgv.put("st", "-1");
289 289 gpsNotValidList.add(fgv);
290   -
  290 +
291 291 // 默认加入一个经纬度为零异常信息
292 292 Map<String, Object> fgez = new HashMap<String, Object>();
293 293 fgez.put("abnormalType", "normal");
294 294 fgez.put("st", "-1");
295 295 gpsEqualsZeroList.add(fgez);
296   -
  296 +
297 297 for(Map<String, Object> rs : dataList) {
298 298 Object lineId = rs.get("LINE_ID");
299 299 // 线路ID发生变化时补全线路切换信息 并新加入一个
... ... @@ -301,12 +301,12 @@ public class GpsServiceImpl implements GpsService {
301 301 String lineName = BasicData.lineCode2NameMap.get(lineId.toString());
302 302 lineSwitch.get(lineSwitch.size() - 1).put("line2", lineName);
303 303 lineSwitch.get(lineSwitch.size() - 1).put("et", rs.get("TS"));
304   -
  304 +
305 305 Map<String, Object> ls = new HashMap<String, Object>();
306 306 ls.put("abnormalType", "lineSwitch");
307 307 ls.put("line1", lineName);
308 308 lineSwitch.add(ls);
309   -
  309 +
310 310 lineSet.add((Integer)lineId);
311 311 oldLineId = (Integer)lineId;
312 312 }
... ... @@ -314,12 +314,12 @@ public class GpsServiceImpl implements GpsService {
314 314 // GPS状态发生变化时补全信息 并新加入一个
315 315 if (getGpsValid(serviceState) != oldGpsValid) {
316 316 gpsNotValidList.get(gpsNotValidList.size() - 1).put("et", rs.get("TS"));
317   -
  317 +
318 318 Map<String, Object> gv = new HashMap<String, Object>();
319 319 gv.put("abnormalType", getGpsValid(serviceState) == 0 ? "normal" : "gpsNotValid");
320 320 gv.put("st", rs.get("TS"));
321 321 gpsNotValidList.add(gv);
322   -
  322 +
323 323 oldGpsValid = getGpsValid(serviceState);
324 324 }
325 325  
... ... @@ -329,15 +329,15 @@ public class GpsServiceImpl implements GpsService {
329 329 // 经纬度为零
330 330 if ((lon == 0 || lat == 0 ? 1 : 0) != oldLonlat){
331 331 gpsEqualsZeroList.get(gpsEqualsZeroList.size() - 1).put("et", rs.get("TS"));
332   -
  332 +
333 333 Map<String, Object> gez = new HashMap<String, Object>();
334 334 gez.put("abnormalType", (lon == 0 || lat == 0 ? 1 : 0) == 0 ? "normal" : "gpsZero");
335 335 gez.put("st", rs.get("TS"));
336 336 gpsEqualsZeroList.add(gez);
337   -
  337 +
338 338 oldLonlat = (lon == 0 || lat == 0 ? 1 : 0);
339 339 }
340   -
  340 +
341 341 // 高德坐标
342 342 gdLoc = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(lon, lat));
343 343 map.put("gcj_lon", gdLoc.getLng());
... ... @@ -358,7 +358,7 @@ public class GpsServiceImpl implements GpsService {
358 358  
359 359 map.put("lineId", map_get_str(rs, "LINE_ID"));
360 360 map.put("speed", map_get_float(rs,"SPEED_GPS"));
361   -
  361 +
362 362 inOutStop = Integer.parseInt(rs.get("INOUT_STOP").toString());
363 363 map.put("inout_stop", inOutStop);
364 364  
... ... @@ -381,21 +381,21 @@ public class GpsServiceImpl implements GpsService {
381 381 gpsNotValidList.get(gpsNotValidList.size() - 1).put("et", rs.get("TS"));
382 382 gpsEqualsZeroList.get(gpsEqualsZeroList.size() - 1).put("et", rs.get("TS"));
383 383 }
384   -
  384 +
385 385 for (int i = lineSwitch.size() - 1;i > -1;i--) {
386 386 Map<String, Object> ls = lineSwitch.get(i);
387 387 if ("normal".equals(ls.get("abnormalType")) || ls.get("et") == null) {
388 388 lineSwitch.remove(i);
389 389 }
390 390 }
391   -
  391 +
392 392 for (int i = gpsNotValidList.size() - 1;i > -1;i--) {
393 393 Map<String, Object> gnv = gpsNotValidList.get(i);
394 394 if ("normal".equals(gnv.get("abnormalType"))) {
395 395 gpsNotValidList.remove(i);
396 396 }
397 397 }
398   -
  398 +
399 399 for (int i = gpsEqualsZeroList.size() - 1;i > -1;i--) {
400 400 Map<String, Object> gez = gpsEqualsZeroList.get(i);
401 401 if ("normal".equals(gez.get("abnormalType"))) {
... ... @@ -421,7 +421,7 @@ public class GpsServiceImpl implements GpsService {
421 421 vm.put("endTime", vet);
422 422 vm.put("stations", stations);
423 423 //vm.put("sections", sections);
424   -
  424 +
425 425 Map<String, String> stationcode2name = new HashMap<String, String>();//sectioncode2name = new HashMap<String, String>();
426 426 for (LsStationRoute lsr : stations) {
427 427 stationcode2name.put(lsr.getStationCode(), lsr.getStationName());
... ... @@ -432,14 +432,14 @@ public class GpsServiceImpl implements GpsService {
432 432 lv2station.put(lineId + "_" + lv.getVersions(), stationcode2name);
433 433 // 路段因为可能漂到其它线路路段 因此需要使用最新的全量路段
434 434 //lv2section.put(lineId + "_" + lv.getVersions(), sectioncode2name);
435   -
  435 +
436 436 vlist.add(vm);
437 437 vmap.put(lineId + "_" + lv.getVersions(), vm);
438 438 }
439 439 }
440 440 }
441 441 rsMap.put("lineVerson",vlist);
442   -
  442 +
443 443 for (Map<String, Object> gps : list) {
444 444 long ts = (long)gps.get("timestamp");
445 445 for (Map<String, Object> vm : vlist) {
... ... @@ -1174,7 +1174,7 @@ public class GpsServiceImpl implements GpsService {
1174 1174 }
1175 1175 //过滤数据
1176 1176 for (SafeDriv sd : list) {
1177   - if (isSpecialLines(sd, map) && fieldEquals(fs, sd, map))
  1177 + if (isSpecialLines(sd, map) && fieldEqualstow(fs, sd, map))
1178 1178 rs.add(sd);
1179 1179 }
1180 1180  
... ... @@ -1295,9 +1295,9 @@ public class GpsServiceImpl implements GpsService {
1295 1295 }
1296 1296 });
1297 1297 }
1298   -
  1298 +
1299 1299 /**
1300   - *
  1300 + *
1301 1301 * @param sd
1302 1302 * @param map
1303 1303 * @return
... ... @@ -1305,7 +1305,7 @@ public class GpsServiceImpl implements GpsService {
1305 1305 public boolean isSpecialLines(SafeDriv sd, Map<String, Object> map) {
1306 1306 String lines = (String)map.get("lines");
1307 1307 if (lines == null) lines = "";
1308   -
  1308 +
1309 1309 if (Arrays.asList(lines.split(",")).contains(sd.getXlbm())) return true;
1310 1310 return false;
1311 1311 }
... ... @@ -1333,6 +1333,32 @@ public class GpsServiceImpl implements GpsService {
1333 1333 return true;
1334 1334 }
1335 1335  
  1336 + public boolean fieldEqualstow(List<Field> fs, Object obj, Map<String, Object> map) {
  1337 + try {
  1338 + String fv, v;
  1339 + for (Field f : fs) {
  1340 + if (StringUtils.isEmpty(map.get(f.getName()).toString()))
  1341 + continue;
  1342 +
  1343 + if(f.get(obj) == null)
  1344 + return false;
  1345 +
  1346 + fv = f.get(obj).toString();
  1347 + v = map.get(f.getName()).toString();
  1348 + SafeDriv sd = (SafeDriv) obj;
  1349 + if(v.equals(sd.getJctype()))
  1350 + return true;
  1351 + else if(!fv.startsWith(v)/* && !fv.endsWith(v)*/)
  1352 + return false;
  1353 + }
  1354 + } catch (Exception e) {
  1355 + logger.error("", e);
  1356 + return false;
  1357 + }
  1358 + return true;
  1359 + }
  1360 +
  1361 +
1336 1362 @Override
1337 1363 public List<GpsSpeed> findPosition(String deviceid, String startdate,
1338 1364 String enddate) throws ParseException{
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/safeDriving.html
... ... @@ -4,32 +4,35 @@
4 4 <div class="uk-modal-header">
5 5 <h2>安全驾驶图像信息(当日)</h2></div>
6 6  
7   - <div class="uk-panel uk-panel-box uk-panel-box-primary">
8   - <form class="uk-form search-form">
9   - <fieldset data-uk-margin>
10   - <legend>
11   - 数据检索
12   - </legend>
13   - <span class="horizontal-field">车辆</span>
14   - <div class="uk-autocomplete uk-form autocomplete-cars" >
15   - <input type="text" name="clzbh" placeholder="车辆自编号">
16   - </div>
17   - <span class="horizontal-field">异常类型</span>
18   - <select name="yczltype">
19   - <option value="">全部</option>
20   - <option value="A1">手部离开方向盘</option>
21   - <option value="A2">摄像头异常</option>
22   - <option value="A3">未戴安全带</option>
23   - <option value="A4">未戴袖章</option>
24   - <option value="A5">眨眼/疲劳驾驶</option>
25   - <option value="A6">打哈欠/打瞌睡</option>
26   - <option value="A7">行驶中与人交谈</option>
27   - </select>
28   - <button class="uk-button">检索</button>
29   - <!--<a id="showSSSpVedioModal" style="color: red;float: right;font-size: 12px;">查看实时视频</a>-->
30   - </fieldset>
31   - </form>
32   - </div>
  7 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  8 + <form class="uk-form search-form">
  9 + <fieldset data-uk-margin>
  10 + <legend>
  11 + 数据检索
  12 + </legend>
  13 + <span class="horizontal-field">车辆</span>
  14 + <div class="uk-autocomplete uk-form autocomplete-cars" >
  15 + <input type="text" name="clzbh" placeholder="车辆自编号">
  16 + </div>
  17 + <span class="horizontal-field">异常类型</span>
  18 + <select name="yczltype">
  19 + <option value="">全部</option>
  20 + <option value="A1">手部离开方向盘</option>
  21 + <option value="A2">摄像头异常</option>
  22 + <option value="A3">未戴安全带</option>
  23 + <option value="A4">未戴袖章</option>
  24 + <option value="A5">眨眼/疲劳驾驶</option>
  25 + <option value="A6">打哈欠/打瞌睡</option>
  26 + <option value="A7">行驶中与人交谈</option>
  27 + <option value="A11">抽烟</option>
  28 + <option value="A12">驾驶车辆期间打电话</option>
  29 + <option value="B4">疫情期间未带口罩</option>
  30 + </select>
  31 + <button class="uk-button">检索</button>
  32 + <!--<a id="showSSSpVedioModal" style="color: red;float: right;font-size: 12px;">查看实时视频</a>-->
  33 + </fieldset>
  34 + </form>
  35 + </div>
33 36 <div style="height: 495px;margin:5px 0 -18px;">
34 37 <table class="ct-fixed-table uk-table uk-table-hover">
35 38 <thead>
... ... @@ -65,12 +68,15 @@
65 68 <td style="width: 10%;">{{sd.timeStr}}</td>
66 69 <td style="width: 10%;">
67 70 {{if sd.yczltype=='A1'}}
68   - {{if sd.jctype==0}}
69   - 双脱手
70   - {{else if sd.jctype==1}}
71   - 单脱手
72   - {{/if}}
  71 + {{if sd.jctype==0}}
  72 + 双脱手
  73 + {{else if sd.jctype==1}}
  74 + 单脱手
  75 + {{/if}}
  76 + {{else if sd.jctype == 'B4'}}
  77 + 未戴口罩
73 78 {{/if}}
  79 +
74 80 </td>
75 81 <td style="width: 10%;">
76 82 <a class="image_link" href="{{sd.url}}.jpg" data-uk-lightbox="{group:'jpg_group1'}" title="{{sd.title}}">JPG</a>
... ... @@ -117,7 +123,6 @@
117 123 var query = function() {
118 124 scanFlag = false;
119 125 var data = form.serializeJSON();
120   - debugger;
121 126 var lines = new Array();
122 127 for (var i = 0;i < gb_data_basic.activeLines.length;i++) {
123 128 lines.push(gb_data_basic.activeLines[i].lineCode);
... ... @@ -136,17 +141,27 @@
136 141 this.xlmc='';
137 142 stm = moment(this.ts);
138 143 this.timeStr = stm.format('YYYY-MM-DD HH:mm:ss');
139   - this.yczlText= gb_safe_driv.safeCode[this.yczltype];
  144 + if(this.jctype == 'B4')
  145 + this.yczlText= gb_safe_driv.safeCode[this.jctype];
  146 + else
  147 + this.yczlText= gb_safe_driv.safeCode[this.yczltype];
140 148 //拼接图片地址
141   - p = (this.sbbh+'_'+this.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  149 + if(this.jctype == 'B4')
  150 + p = (this.sbbh+'_A'+this.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  151 + else
  152 + p = (this.sbbh+'_'+this.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  153 +
142 154 url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
143 155 this.url = gb_safe_driv.urlPath + url;
144 156 //title
145 157 var call_btn_html = '<button class="uk-button uk-button-mini uk-button-primary" ' +
146   - 'id="m_voip_call_btn_001" ' +
147   - 'type="button" ' +
148   - 'data-nbbm="'+this.clzbh+'">打电话</button>';
149   - this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczlText + '&nbsp;' + call_btn_html;
  158 + 'id="m_voip_call_btn_001" ' +
  159 + 'type="button" ' +
  160 + 'data-nbbm="'+this.clzbh+'">打电话</button>';
  161 + if(this.jctype == 'B4')
  162 + this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+'A'+this.yczltype + '&nbsp;' + call_btn_html;
  163 + else
  164 + this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczltype + '&nbsp;' + call_btn_html;
150 165 });
151 166  
152 167 var bodyHtml = template('all-safe_dring-table-temp', {
... ...
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
... ... @@ -4,6 +4,7 @@
4 4 var gb_safe_driv = (function () {
5 5  
6 6 var codes = {
  7 + 'B4': '未带口罩',
7 8 'A1': '手部违规',
8 9 'A2': '摄像头偏离',
9 10 'A3': '安全带',
... ... @@ -11,7 +12,9 @@ var gb_safe_driv = (function () {
11 12 'A5': '眨眼/疲劳驾驶',
12 13 'A6': '打哈欠/打瞌睡',
13 14 'A7': '与人交谈',
14   - 'A9': '玩手机'
  15 + 'A9': '玩手机',
  16 + 'A11': '抽烟',
  17 + 'A12': '打电话'
15 18 };
16 19  
17 20 var path = 'http://211.95.61.66:9005/CurrentSafeDriving/';
... ... @@ -24,9 +27,17 @@ var gb_safe_driv = (function () {
24 27 var stm = moment(sd.ts);
25 28 sd.timeStr = stm.format('HH时mm分ss秒');
26 29 //异常状态文本
27   - sd.ycztText = codes[sd.yczltype];
  30 + if(sd.jctype == 'B4')
  31 + sd.ycztText = codes[sd.jctype];
  32 + else
  33 + sd.ycztText = codes[sd.yczltype];
  34 + var p;
28 35 //图片地址
29   - var p = (sd.sbbh+'_'+sd.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  36 + if(sd.jctype == 'B4')
  37 + p = (sd.sbbh+'_A'+sd.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  38 + else
  39 + p = (sd.sbbh+'_'+sd.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  40 +
30 41 var url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
31 42 sd.url = path + url + '.gif';
32 43  
... ... @@ -68,43 +79,43 @@ var gb_safe_driv = (function () {
68 79 'A6': 2,
69 80 'A7': 2
70 81 };
71   -/* var showVedioModal = function (type) {
72   - var channel = channelMap[type]?channelMap[type]:1;
73   - open_modal_dom(vedioModal.replace('^^channel^^', channel) ,{}, {modal: false});
74   - $('#ssspVedioModal #vedioIframe').on('load', function () {
75   - var that = this;
76   - setTimeout(function () {
77   - $(that).show();
78   - $('#ssspVedioModal p.loading').remove();
79   - }, 500);
80   - });
81   - };*/
82   -
83   -/* $(document).on('click', '#openVedioModalBtn', function () {
84   - showVedioModal($(this).data('type'));
85   - });*/
86   -
87   -
88   -/* var showCallPhoneModal = function () {
89   - open_modal_dom(phoneModal ,{}, {modal: false});
90   - $('#callPhoneModal #phoneIframe').on('load', function () {
91   - var that = this;
92   - var iframe = this.contentWindow.document.body;
93   - setTimeout(function () {
94   - //修改css
95   - $(iframe).find('.CallCenterToolBar').css('height', '200px').css('width', '100%').css('top', '10px').css('left', 'calc(50% - 148px)').css('box-shadow', 'none');
96   - $(iframe).find('.CallCenterToolBar .top').css('display', 'none');
97   -
98   - $('.toolBar td[data-action=call]', iframe).trigger('click');
99   -
100   - //焦点
101   - $('input#telNumber', iframe).focus();
102   -
103   - $(that).show();
104   - $('#callPhoneModal p.loading').remove();
105   - }, 700);
106   - });
107   - };*/
  82 + /* var showVedioModal = function (type) {
  83 + var channel = channelMap[type]?channelMap[type]:1;
  84 + open_modal_dom(vedioModal.replace('^^channel^^', channel) ,{}, {modal: false});
  85 + $('#ssspVedioModal #vedioIframe').on('load', function () {
  86 + var that = this;
  87 + setTimeout(function () {
  88 + $(that).show();
  89 + $('#ssspVedioModal p.loading').remove();
  90 + }, 500);
  91 + });
  92 + };*/
  93 +
  94 + /* $(document).on('click', '#openVedioModalBtn', function () {
  95 + showVedioModal($(this).data('type'));
  96 + });*/
  97 +
  98 +
  99 + /* var showCallPhoneModal = function () {
  100 + open_modal_dom(phoneModal ,{}, {modal: false});
  101 + $('#callPhoneModal #phoneIframe').on('load', function () {
  102 + var that = this;
  103 + var iframe = this.contentWindow.document.body;
  104 + setTimeout(function () {
  105 + //修改css
  106 + $(iframe).find('.CallCenterToolBar').css('height', '200px').css('width', '100%').css('top', '10px').css('left', 'calc(50% - 148px)').css('box-shadow', 'none');
  107 + $(iframe).find('.CallCenterToolBar .top').css('display', 'none');
  108 +
  109 + $('.toolBar td[data-action=call]', iframe).trigger('click');
  110 +
  111 + //焦点
  112 + $('input#telNumber', iframe).focus();
  113 +
  114 + $(that).show();
  115 + $('#callPhoneModal p.loading').remove();
  116 + }, 700);
  117 + });
  118 + };*/
108 119  
109 120 $(document).on('click', '#m_voip_call_btn_001', function () {
110 121 //debugger
... ...