Commit 1e9c5e4448edf5aee07e398d49d673a887222d20

Authored by 潘钊
1 parent 58d9c438

update...

src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -108,4 +108,22 @@ public class GpsController {
108 108 public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
109 109 return gpsService.history_v2(nbbm, st, et);
110 110 }
  111 +
  112 + /**
  113 + * 安全驾驶数据 分页查询
  114 + * @param map
  115 + * @param page
  116 + * @param size
  117 + * @param order
  118 + * @param direction
  119 + * @return
  120 + */
  121 + @RequestMapping(value = "/safeDriv")
  122 + public Map<String, Object> safeDrivList(@RequestParam Map<String, Object> map,
  123 + @RequestParam(defaultValue = "0") int page,
  124 + @RequestParam(defaultValue = "15") int size,
  125 + @RequestParam(defaultValue = "timestamp") String order,
  126 + @RequestParam(defaultValue = "DESC") String direction){
  127 + return gpsService.safeDrivList(map , page, size, order, direction);
  128 + }
111 129 }
... ...
src/main/java/com/bsth/data/safe_driv/SafeDriv.java
... ... @@ -27,6 +27,8 @@ public class SafeDriv {
27 27 */
28 28 private String xlmc;
29 29  
  30 + private String xlbm;
  31 +
30 32 /**
31 33 * 车辆自编号
32 34 */
... ... @@ -127,4 +129,12 @@ public class SafeDriv {
127 129 public void setTs(Long ts) {
128 130 this.ts = ts;
129 131 }
  132 +
  133 + public String getXlbm() {
  134 + return xlbm;
  135 + }
  136 +
  137 + public void setXlbm(String xlbm) {
  138 + this.xlbm = xlbm;
  139 + }
130 140 }
... ...
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
1 1 package com.bsth.data.safe_driv;
2 2  
3   -import com.bsth.Application;
4 3 import com.bsth.websocket.handler.SendUtils;
5 4 import org.joda.time.format.DateTimeFormat;
6 5 import org.joda.time.format.DateTimeFormatter;
... ... @@ -15,7 +14,6 @@ import java.util.HashMap;
15 14 import java.util.HashSet;
16 15 import java.util.Map;
17 16 import java.util.Set;
18   -import java.util.concurrent.TimeUnit;
19 17  
20 18 /**
21 19 * 安全驾驶
... ... @@ -44,7 +42,6 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware
44 42 private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");
45 43 public static void put(SafeDriv sd){
46 44 sd.setTs(fmt.parseMillis(sd.getStartime()));
47   - data.add(sd);
48 45  
49 46 if(sd.getYczltype().indexOf("A") == -1)
50 47 sd.setYczltype("A" + sd.getYczltype());
... ... @@ -53,15 +50,24 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware
53 50 if(old == null || sd.getTs() > old.getTs()){
54 51 //通知客户端
55 52 sendUtils.sendSafeDriv(sd);
  53 + data.add(sd);
  54 + safeMap.put(sd.getClzbh(), sd);
56 55 }
  56 + }
  57 +
  58 + public static Set<SafeDriv> findAll(){
  59 + return data;
  60 + }
57 61  
58   - safeMap.put(sd.getClzbh(), sd);
  62 + public static void clear(){
  63 + data = new HashSet<>();
  64 + safeMap = new HashMap<>();
59 65 }
60 66  
61 67 @Override
62 68 public void run(String... strings) throws Exception {
63 69 //定时加载安全驾驶数据
64   - Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 5, TimeUnit.SECONDS);
  70 + //Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 60, TimeUnit.SECONDS);
65 71 }
66 72  
67 73 @Override
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
  3 +import com.bsth.data.safe_driv.SafeDrivCenter;
3 4 import com.bsth.service.oil.YlbService;
4 5 import org.slf4j.Logger;
5 6 import org.slf4j.LoggerFactory;
... ... @@ -24,6 +25,9 @@ public class CalcOilThread extends Thread{
24 25 logger.info("开始计算路单里程加注量....");
25 26 ylbService.obtainDsq();
26 27 logger.info("计算路单里程加注量结束!");
  28 +
  29 + //清除安全驾驶数据 先临时蹭这个线程
  30 + SafeDrivCenter.clear();
27 31 } catch(Exception e){
28 32 logger.error("计算路单里程加注量失败",e);
29 33 }
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -223,7 +223,7 @@ public class ChildTaskPlan {
223 223  
224 224 @Override
225 225 public int hashCode() {
226   - return ("" + this.getId() + this.getSchedule().getId()).hashCode();
  226 + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode();
227 227 }
228 228  
229 229 @Override
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -171,7 +171,7 @@ public class ScheduleRealInfo {
171 171 private String qdzArrDatesj;
172 172  
173 173 /** 子任务 */
174   - @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  174 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
175 175 private Set<ChildTaskPlan> cTasks = new HashSet<>();
176 176  
177 177 /** 关联的公司名称 */
... ...
src/main/java/com/bsth/service/gps/GpsService.java
... ... @@ -27,4 +27,6 @@ public interface GpsService {
27 27 List<GpsSpeed_DTO> speeds(String nbbm, long st, long et);
28 28  
29 29 List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et);
  30 +
  31 + Map<String, Object> safeDrivList(Map<String, Object> map, int page, int size, String order, String direction);
30 32 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -6,6 +6,8 @@ import com.bsth.data.arrival.ArrivalEntity;
6 6 import com.bsth.data.gpsdata.GpsEntity;
7 7 import com.bsth.data.gpsdata.GpsRealData;
8 8 import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
  9 +import com.bsth.data.safe_driv.SafeDriv;
  10 +import com.bsth.data.safe_driv.SafeDrivCenter;
9 11 import com.bsth.data.schedule.DayOfSchedule;
10 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 13 import com.bsth.repository.CarParkRepository;
... ... @@ -357,17 +359,12 @@ public class GpsServiceImpl implements GpsService {
357 359 //过滤后的
358 360 List<GpsEntity> rs = new ArrayList<>();
359 361 Field[] fields = GpsEntity.class.getDeclaredFields();
360   - //排序字段
361   - Field orderField = null;
362 362 //参与过滤的字段
363 363 List<Field> fs = new ArrayList<>();
364 364 for (Field f : fields) {
365 365 f.setAccessible(true);
366 366 if (map.containsKey(f.getName()))
367 367 fs.add(f);
368   -
369   - if (f.getName().equals(order))
370   - orderField = f;
371 368 }
372 369 //过滤数据
373 370 for (GpsEntity gps : list) {
... ... @@ -375,9 +372,6 @@ public class GpsServiceImpl implements GpsService {
375 372 rs.add(gps);
376 373 }
377 374  
378   - //排序
379   -/* if (null != orderField)
380   - sortGpsList(orderField, rs);*/
381 375 //时间戳排序
382 376 Collections.sort(rs, new Comparator<GpsEntity>() {
383 377 @Override
... ... @@ -593,6 +587,52 @@ public class GpsServiceImpl implements GpsService {
593 587 return GpsOutbound_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st, et));
594 588 }
595 589  
  590 + @Override
  591 + public Map<String, Object> safeDrivList(Map<String, Object> map, int page, int size, String order, String direction) {
  592 + Map<String, Object> rsMap = new HashMap<>();
  593 + try {
  594 + //全量
  595 + List<SafeDriv> list = new ArrayList<>(SafeDrivCenter.findAll());
  596 + //过滤后的
  597 + List<SafeDriv> rs = new ArrayList<>();
  598 + Field[] fields = SafeDriv.class.getDeclaredFields();
  599 + //参与过滤的字段
  600 + List<Field> fs = new ArrayList<>();
  601 + for (Field f : fields) {
  602 + f.setAccessible(true);
  603 + if (map.containsKey(f.getName()))
  604 + fs.add(f);
  605 + }
  606 + //过滤数据
  607 + for (SafeDriv sd : list) {
  608 + if (fieldEquals(fs, sd, map))
  609 + rs.add(sd);
  610 + }
  611 +
  612 + //时间戳排序
  613 + Collections.sort(rs, new Comparator<SafeDriv>() {
  614 + @Override
  615 + public int compare(SafeDriv o1, SafeDriv o2) {
  616 + return o2.getTs().intValue() - o1.getTs().intValue();
  617 + }
  618 + });
  619 +
  620 + //分页
  621 + int count = rs.size(), s = page * size, e = s + size;
  622 + if (e > count)
  623 + e = count;
  624 +
  625 + rsMap.put("list", rs.subList(s, e));
  626 + rsMap.put("totalPages", count % size == 0 ? count / size - 1 : count / size);
  627 + rsMap.put("page", page);
  628 + rsMap.put("status", ResponseCode.SUCCESS);
  629 + } catch (Exception e) {
  630 + logger.error("", e);
  631 + rsMap.put("status", ResponseCode.ERROR);
  632 + }
  633 + return rsMap;
  634 + }
  635 +
596 636 private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads) {
597 637 double min = -1, distance;
598 638 Road_DTO nearRoad = null;
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import com.bsth.common.ResponseCode;
3 4 import com.bsth.data.BasicData;
4   -import com.bsth.data.match.Arrival2Schedule;
5 5 import com.bsth.data.schedule.DayOfSchedule;
6 6 import com.bsth.entity.realcontrol.ChildTaskPlan;
7 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -10,19 +10,19 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 10 import com.bsth.service.impl.BaseServiceImpl;
11 11 import com.bsth.service.realcontrol.ChildTaskPlanService;
12 12 import org.apache.commons.lang3.StringUtils;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
13 15 import org.springframework.beans.factory.annotation.Autowired;
14 16 import org.springframework.jdbc.core.JdbcTemplate;
15 17 import org.springframework.stereotype.Service;
16 18  
17 19 import javax.transaction.Transactional;
  20 +import java.util.HashMap;
18 21 import java.util.Map;
19 22  
20 23 @Service
21 24 public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService {
22 25  
23   - /*@Autowired
24   - ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
25   -
26 26 @Autowired
27 27 ScheduleRealInfoRepository scheduleRealInfoRepository;
28 28  
... ... @@ -33,34 +33,41 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
33 33 DayOfSchedule dayOfSchedule;
34 34  
35 35 @Autowired
36   - Arrival2Schedule arrival2Schedule;
37   -
38   - @Autowired
39 36 JdbcTemplate jdbcTemplate;
40 37  
  38 + Logger logger = LoggerFactory.getLogger(this.getClass());
  39 +
41 40 @Transactional
42 41 @Override
43 42 public Map<String, Object> save(ChildTaskPlan t) {
44   - ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
45   - Map<String, Object> rs;
46   - //保存起终点名称
47   - String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
48   -
49   - if(StringUtils.isEmpty(t.getStartStationName()))
50   - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
51   -
52   - if(StringUtils.isEmpty(t.getEndStationName()))
53   - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
54   - //先持久化子任务
55   - rs = super.save(t);
56   - //再关联主任务
57   - sch.getcTasks().add(t);
58   - dayOfSchedule.save(sch);
59   -
60   - rs.put("t", sch);
61 43  
62   - if (sch.getZdsjActual() == null)
63   - arrival2Schedule.removeExpect(sch.getClZbh());
  44 + Map<String, Object> rs = new HashMap();
  45 + try {
  46 + ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  47 + //保存起终点名称
  48 + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  49 + if(StringUtils.isEmpty(t.getStartStationName()))
  50 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  51 +
  52 + if(StringUtils.isEmpty(t.getEndStationName()))
  53 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  54 + //先持久化子任务
  55 + rs = super.save(t);
  56 + //关联主任务
  57 + System.out.println("schschsch: " + sch);
  58 + System.out.println("sch.getcTasks()sch.getcTasks(): " + sch.getcTasks());
  59 + sch.getcTasks().add(t);
  60 + dayOfSchedule.save(sch);
  61 + //直接持久化
  62 + //scheduleRealInfoRepository.save(sch);
  63 +
  64 + rs.put("status", ResponseCode.SUCCESS);
  65 + rs.put("t", sch);
  66 + }catch (Exception e){
  67 + logger.error("", e);
  68 + rs.put("status", ResponseCode.ERROR);
  69 + rs.put("msg", e.getMessage());
  70 + }
64 71 return rs;
65 72 }
66 73  
... ... @@ -69,16 +76,13 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
69 76 Map<String, Object> rs;
70 77  
71 78 ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);
72   - //解除和主任务关联
73   - ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
74   - sch.getcTasks().remove(cPlan);
75   - //删除关联表数据
76   - jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real=" + sch.getId() + " and c_tasks=" + cPlan.getId());
77 79  
78 80 //删除子任务
79 81 rs = super.delete(id);
80   - dayOfSchedule.save(sch);
81   -
  82 + //dayOfSchedule.save(sch);
  83 + //解除和主任务关联
  84 + ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
  85 + sch.getcTasks().remove(cPlan);
82 86 rs.put("t", sch);
83 87 return rs;
84 88 }
... ...
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js 0 → 100644
  1 +/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2 +!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-lightbox",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";function t(t){if(e)return e.lightbox=t,e;e=i.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>',"</div>","</div>"].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(",")):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join(""));var d,r,u=i.$("<div>&nbsp;</div>").css({opacity:0,position:"absolute",top:0,left:0,width:"100%","max-width":t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('<div class="uk-modal-caption">'+e.title+"</div>"),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),d<e.meta.width&&(g=Math.floor(g*(d/c)),c=d),g>r&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'<img class="uk-responsive-width" width="'+e+'" height="'+o+'" src ="'+i+'">',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+o+'" style="max-width:100%;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+o+'" style="width:100%;box-sizing:border-box;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"//vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'<video class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+o+'" controls></video>',width:t,height:o},e.type="video",e.promise.resolve()};if("video"==e.type||e.source.match(/\.(mp4|webm|ogv)$/i))if(o[e.source])n(e.source,o[e.source].width,o[e.source].height);else var s=i.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'<iframe class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+n+'"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox});
0 3 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css 0 → 100644
  1 +/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2 +.uk-slidenav{display:inline-block;box-sizing:border-box;width:60px;height:60px;line-height:60px;color:rgba(50,50,50,.4);font-size:60px;text-align:center}.uk-slidenav:focus,.uk-slidenav:hover{outline:0;text-decoration:none;color:rgba(50,50,50,.7);cursor:pointer}.uk-slidenav:active{color:rgba(50,50,50,.9)}.uk-slidenav-previous:before{content:"\f104";font-family:FontAwesome}.uk-slidenav-next:before{content:"\f105";font-family:FontAwesome}.uk-slidenav-position{position:relative}.uk-slidenav-position .uk-slidenav{display:none;position:absolute;top:50%;z-index:1;margin-top:-30px}.uk-slidenav-position:hover .uk-slidenav{display:block}.uk-slidenav-position .uk-slidenav-previous{left:20px}.uk-slidenav-position .uk-slidenav-next{right:20px}.uk-slidenav-contrast{color:rgba(255,255,255,.5)}.uk-slidenav-contrast:focus,.uk-slidenav-contrast:hover{color:rgba(255,255,255,.7)}.uk-slidenav-contrast:active{color:rgba(255,255,255,.9)}
0 3 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -930,18 +930,19 @@ option.oil_station_opt{
930 930 position: absolute;
931 931 right: 12px;
932 932 bottom: 12px;
  933 + z-index: 99;
933 934 }
934 935  
935 936 .safe_driv_pop{
936   - height: 45px;
937 937 background: #d44b4b;
938   - color: #f2f2f2;
939 938 font-size: 15px;
940 939 padding: 9px 10px 0;
941 940 border: 1px solid #f4f0f0;
942 941 border-radius: 5px;
943 942 cursor: pointer;
944 943 box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  944 + transition: all .03s;
  945 + color: #f2f2f2;
945 946 }
946 947  
947 948 .safe_driv_pop:hover{
... ... @@ -949,15 +950,33 @@ option.oil_station_opt{
949 950 }
950 951  
951 952 .safe_driv_pop .title{
952   - font-weight: 600;
953 953 }
954 954  
955   -.safe_driv_pop i.uk-icon-times-circle{
  955 +/*.safe_driv_pop i.uk-icon-times-circle{
956 956 margin-right: 5px;
957   -}
  957 +}*/
958 958 .safe_driv_pop .desc{
959 959 display: block;
960 960 font-size: 12px;
961   - margin: 2px 0 0 20px;
962   - color: #e3e3e3;
963   -}
964 961 \ No newline at end of file
  962 + color: #ff9d9d;
  963 + text-align: right;
  964 + margin-right: 5px;
  965 +}
  966 +
  967 +/*.safe_driv_pop .detail_content{
  968 + display: none;
  969 +}
  970 +
  971 +.safe_driv_pop.open .detail_content{
  972 + display: block;
  973 + background: rgb(255, 255, 255);
  974 + height: 200px;
  975 + margin: 7px 0;
  976 + border-radius: 5px;
  977 + color: #000000;
  978 +}
  979 +
  980 +.safe_driv_pop.open .desc{
  981 + display: none;
  982 +}*/
  983 +/** 安全驾驶相关css结束 */
965 984 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
1   -<div class="uk-modal" id="all-devices-modal">
  1 +<div class="uk-modal ct_move_modal" id="all-devices-modal">
2 2 <div class="uk-modal-dialog" style="width: 1100px;">
3 3 <a href="" class="uk-modal-close uk-close"></a>
4 4 <div class="uk-modal-header">
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/safeDriving.html 0 → 100644
  1 +<div class="uk-modal ct_move_modal" id="safe_dring_list-modal" style="z-index: 99;">
  2 + <div class="uk-modal-dialog" style="width: 1100px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>安全驾驶图像信息(当日)</h2></div>
  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 + </fieldset>
  30 + </form>
  31 + </div>
  32 + <div style="height: 495px;margin:5px 0 -18px;">
  33 + <table class="ct-fixed-table uk-table uk-table-hover">
  34 + <thead>
  35 + <tr>
  36 + <th style="width: 12%;">线路</th>
  37 + <th style="width: 13%;">车辆自编号</th>
  38 + <th style="width: 13%;">设备</th>
  39 + <th style="width: 13%;">异常类型</th>
  40 + <th style="width: 17%;">时间</th>
  41 + <th style="width: 11%;">检查属性</th>
  42 + <th style="width: 11%;">图像</th>
  43 + <th>视频</th>
  44 + </tr>
  45 + </thead>
  46 + <tbody data-uk-observe>
  47 + </tbody>
  48 + </table>
  49 + </div>
  50 +
  51 + <div class="uk-modal-footer uk-text-right pagination-wrap">
  52 + </div>
  53 + </div>
  54 +
  55 + <script id="all-safe_dring-table-temp" type="text/html">
  56 + {{each array as sd i}}
  57 + <tr>
  58 + <td style="width: 14%;">{{sd.xlmc}}</td>
  59 + <td style="width: 14%;">{{sd.clzbh}}</td>
  60 + <td style="width: 13%;">{{sd.sbbh}}</td>
  61 + <td style="width: 13%;">{{sd.yczlText}}</td>
  62 + <td style="width: 10%;">{{sd.timeStr}}</td>
  63 + <td style="width: 10%;">
  64 + {{if sd.yczltype=='A1'}}
  65 + {{if sd.jctype==0}}
  66 + 双脱手
  67 + {{else if sd.jctype==1}}
  68 + 单脱手
  69 + {{/if}}
  70 + {{/if}}
  71 + </td>
  72 + <td style="width: 10%;">
  73 + <a class="image_link" href="{{sd.url}}.jpg" data-uk-lightbox="{group:'jpg_group1'}" title="{{sd.title}}">JPG</a>
  74 + </td>
  75 + <td>
  76 + <a class="image_link" href="{{sd.url}}.gif" data-uk-lightbox="{group:'gif_group2'}" title="{{sd.title}}">查看视频</a>
  77 + </td>
  78 + </tr>
  79 + {{/each}}
  80 + </script>
  81 +
  82 + <script>
  83 + (function() {
  84 + var modal = '#safe_dring_list-modal';
  85 + var form = $('.search-form', modal);
  86 + var page = 0;
  87 + var pageSize = 12;
  88 +
  89 + $(modal).on('init', function(e, data) {
  90 + e.stopPropagation();
  91 +
  92 + query();
  93 + });
  94 +
  95 + //sumit event
  96 + form.on('submit', function(e) {
  97 + e.preventDefault();
  98 + resetPagination = true;
  99 + page=0;
  100 + query();
  101 + });
  102 +
  103 + var query = function() {
  104 + scanFlag = false;
  105 + var data = form.serializeJSON();
  106 + data.page = page;
  107 + data.size = pageSize;
  108 +
  109 + gb_common.$get('/gps/safeDriv', data, function (rs) {
  110 + //数据转换
  111 + var code2Name=gb_data_basic.lineCode2NameAll(), url,stm, p;
  112 + $.each(rs.list, function(){
  113 + if(this.xlbm)
  114 + this.xlmc=code2Name[this.xlbm];
  115 + else
  116 + this.xlmc='';
  117 + stm = moment(this.ts);
  118 + this.timeStr = stm.format('YYYY-MM-DD HH:mm:ss');
  119 + this.yczlText= gb_safe_driv.safeCode[this.yczltype];
  120 + //拼接图片地址
  121 + p = (this.sbbh+'_'+this.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  122 + url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
  123 + this.url = gb_safe_driv.urlPath + url;
  124 + //title
  125 + this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczlText;
  126 + });
  127 +
  128 + var bodyHtml = template('all-safe_dring-table-temp', {
  129 + array: rs.list
  130 + });
  131 + $('table tbody', modal).html(bodyHtml);
  132 + if (resetPagination)
  133 + pagination(rs.totalPages + 1, rs.page);
  134 +
  135 + //扫描图片是否存在
  136 + scanFlag = true;
  137 + scanImgIsExist();
  138 + });
  139 + };
  140 +
  141 + var scanFlag;
  142 + var scanImgIsExist = function () {
  143 + var array = $('table tbody a.image_link', modal);
  144 + var i = 0;
  145 + //匿名函数递归
  146 + (function () {
  147 + //计数
  148 + if(i >= array.length || !scanFlag){
  149 + console.log('扫描图片结束');
  150 + return;
  151 + }
  152 + var f = arguments.callee;
  153 + var $a = $(array[i]);
  154 + i ++;
  155 + var img = new Image();
  156 + img.onerror = function(){
  157 + $a.removeAttr('href').removeAttr('data-uk-lightbox').text('无').css('color', '#b8b8b8');
  158 + f();
  159 + };
  160 + img.onload = function(){
  161 + f();
  162 + };
  163 + img.src=$a.attr('href');
  164 + })();
  165 + };
  166 +
  167 + var resetPagination = true;
  168 + var pagination = function(pages, currentPage) {
  169 + var wrap = $('.pagination-wrap', modal).empty()
  170 + ,e = $('<ul class="uk-pagination"></ul>').appendTo(wrap);
  171 +
  172 + var pagination = UIkit.pagination(e, {
  173 + pages: pages,
  174 + currentPage: currentPage
  175 + });
  176 +
  177 + e.on('select.uk.pagination', function(e, pageIndex){
  178 + page = pageIndex;
  179 + query();
  180 + });
  181 +
  182 + resetPagination = false;
  183 + };
  184 + })();
  185 + </script>
  186 +</div>
... ...
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
... ... @@ -267,6 +267,11 @@
267 267 "id": 3.4,
268 268 "text": "轨迹回放",
269 269 "event": "gps_play_back"
  270 + },
  271 + {
  272 + "id": 3.5,
  273 + "text": "安全驾驶(图像)",
  274 + "event": "safe_driving"
270 275 }
271 276 ]
272 277 },
... ...
src/main/resources/static/real_control_v2/js/modal_extend.js
1 1 //modal hide remove dom
2 2 $(document).on('hide.uk.modal', '.uk-modal', function () {
  3 + //放过灯箱
  4 + if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-lightbox')){
  5 + return;
  6 + }
3 7 $(this).remove();
4 8 });
5 9  
... ... @@ -7,10 +11,6 @@ $(document).on(&#39;show.uk.modal&#39;, &#39;.uk-modal.ct_move_modal&#39;, function () {
7 11 if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-blank'))
8 12 return;
9 13  
10   - /* //临时放过轨迹回放
11   - if($(this).attr('id')=='map-playback-modal')
12   - return;*/
13   -
14 14 //计算居中位置
15 15 var win = $('body');
16 16 var Y = (win.width() - $('.uk-modal-dialog', this).width()) / 2 - 10;
... ... @@ -55,7 +55,6 @@ var modal_move = function (m_header) {
55 55 var win = $('body');
56 56  
57 57 $(m_header).on('mousedown', function (e) {
58   - console.log('mousedown');
59 58 e.preventDefault();
60 59 _moveFlag = true;
61 60 _moveObj = $(this).parent();
... ...
src/main/resources/static/real_control_v2/js/north/toolbar.js
... ... @@ -188,6 +188,9 @@ var gb_northToolbar = (function () {
188 188 },
189 189 form_schedule_daily: function () {
190 190 gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/statement/scheduleDaily.html', '调度工作日报表');
  191 + },
  192 + safe_driving: function () {
  193 + open_modal('/real_control_v2/fragments/north/nav/safeDriving.html', {}, modal_opts);
191 194 }
192 195 };
193 196  
... ...
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
... ... @@ -13,32 +13,49 @@ var gb_safe_driv = (function () {
13 13 'A7': '与人交谈'
14 14 };
15 15  
  16 + var path = 'http://180.166.5.82:9988/CurrentSafeDriving/';
  17 +
16 18 var $wrap = $('.safe_driv_pop_wrap');
17 19 var max = 5;
18 20  
19 21 var pop = function (sd) {
20 22 //只有admin用户能收到
21 23 var user = gb_northToolbar.user();
22   - if(!user || user.userName.indexOf('admin') == -1)
  24 + if (!user || user.userName.indexOf('admin') == -1)
23 25 return;
24 26  
25   - var htmlStr = '<div class="safe_driv_pop uk-animation-slide-bottom">'+
26   - ' <span class="title"><i class="uk-icon-times-circle"></i>安全驾驶 '+moment(sd.ts).format('HH:mm')+'</span>'+
27   - ' <span class="text"> '+sd.clzbh+' 违规驾驶('+codes[sd.yczltype]+')</span><span class="desc">请至安全驾驶监管平台查看图像信息</span>'+
28   - '</div>';
29   -
  27 + //时间格式化
  28 + var stm = moment(sd.ts);
  29 + sd.timeStr = stm.format('HH时mm分ss秒');
  30 + //异常状态文本
  31 + sd.ycztText = codes[sd.yczltype];
  32 + //图片地址
  33 + var p = (sd.sbbh+'_'+sd.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  34 + var url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
  35 + sd.url = path + url + '.jpg';
  36 +
  37 + var htmlStr = template('safe_driv_item-temp', sd);
30 38 var items = $wrap.find('.safe_driv_pop'), len = items.length;
31   - if(len >= max)
32   - $wrap.find('.safe_driv_pop:lt('+(len - max)+')').remove();
  39 + if (len >= max)
  40 + $wrap.find('.safe_driv_pop:lt(' + (len - max) + ')').remove();
33 41  
34 42 $wrap.append(htmlStr);
35 43 };
36 44  
37 45 $wrap.on('click', '.safe_driv_pop', function () {
  46 + var title = $(this).data('title');
  47 + var url = $(this).data('url');
38 48 $(this).remove();
  49 + var lightbox = UIkit.lightbox.create([
  50 + {title: title, 'source': url}
  51 + ]);
  52 +
  53 + lightbox.show();
39 54 });
40 55  
41 56 return {
42   - pop: pop
  57 + pop: pop,
  58 + safeCode: codes,
  59 + urlPath: path
43 60 }
44 61 })();
45 62 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/main.html
... ... @@ -11,6 +11,7 @@
11 11 <link rel="stylesheet"
12 12 href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css"/>
13 13 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css"/>
  14 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css"/>
14 15  
15 16 <!-- main style -->
16 17 <link rel="stylesheet" href="/real_control_v2/css/main.css"/>
... ... @@ -60,7 +61,6 @@
60 61 </div>
61 62 </div>
62 63  
63   -<div class="safe_driv_pop_wrap"></div>
64 64 <script>
65 65 delete window.exports;
66 66 delete window.module;
... ... @@ -123,6 +123,7 @@
123 123 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script>
124 124 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js"></script>
125 125 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js"></script>
  126 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js"></script>
126 127  
127 128 <!-- jquery contextMenu -->
128 129 <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js"></script>
... ... @@ -185,8 +186,21 @@
185 186 <script src="/real_control_v2/js/forms/form_embed.js"></script>
186 187 <!-- 模态框扩展 -->
187 188 <script src="/real_control_v2/js/modal_extend.js"></script>
188   -<!-- 安全驾驶相关 -->
  189 +
  190 +<!-- #### 安全驾驶 start ### -->
  191 +<div class="safe_driv_pop_wrap" ></div>
  192 +<script id="safe_driv_item-temp" type="text/html">
  193 + <div class="safe_driv_pop uk-animation-slide-bottom" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}">
  194 + <div>
  195 + <span class="title">异常&nbsp;{{clzbh}}</span>
  196 + <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span>
  197 + <span class="desc">--安全驾驶监管平台</span>
  198 + </div>
  199 + </div>
  200 +</script>
  201 +
189 202 <script src="/real_control_v2/js/safe_driv/safeDriv.js" ></script>
  203 +<!-- #### 安全驾驶 end ### -->
190 204 </body>
191 205  
192 206 </html>
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
... ... @@ -169,7 +169,7 @@
169 169 <input type="checkbox" name="stationName"> 站点名称
170 170 </label>
171 171 <label>
172   - 停车场 <i class="uk-icon-angle-down"></i>
  172 + <a>停车场 <i class="uk-icon-angle-down"></i></a>
173 173 </label>
174 174 </form>
175 175 </div>
... ... @@ -320,7 +320,7 @@
320 320  
321 321 var init = function (data) {
322 322 //设置初始值
323   - if (data.nbbm)
  323 + /*if (data.nbbm)
324 324 $('[name=nbbm]', f).val(data.nbbm);
325 325 var st = moment().subtract(2, 'hour');
326 326 if (data.st)
... ... @@ -331,15 +331,15 @@
331 331 if (data.et)
332 332 et = moment(data.et, 'YYYY-MM-DD HH:mm');
333 333 $('[name=eDate]', f).val(et.format('YYYY-MM-DD'));
334   - $('[name=eTime]', f).val(et.format('HH:mm'));
  334 + $('[name=eTime]', f).val(et.format('HH:mm'));*/
335 335  
336 336  
337   - /*$('[name=nbbm]', f).val('W0A-018');
  337 + $('[name=nbbm]', f).val('W0A-018');
338 338 $('[name=sDate]', f).val('2017-04-06');
339 339 $('[name=sTime]', f).val('04:49');
340 340  
341 341 $('[name=eDate]', f).val('2017-04-06');
342   - $('[name=eTime]', f).val('09:49');*/
  342 + $('[name=eTime]', f).val('09:49');
343 343 //搜索事件
344 344 $('button[type=submit]', f).on('click', search);
345 345 };
... ...