Commit c623b441bdf18b02265d45778f0d1c58fb82c89b
1 parent
7aa83666
客流摄像头,以及客流提示
Showing
11 changed files
with
293 additions
and
4 deletions
src/main/java/com/bsth/common/Constants.java
| @@ -42,6 +42,7 @@ public class Constants { | @@ -42,6 +42,7 @@ public class Constants { | ||
| 42 | public static final String COMPANY_AUTHORITYS = "cmyAuths"; | 42 | public static final String COMPANY_AUTHORITYS = "cmyAuths"; |
| 43 | public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | 43 | public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; |
| 44 | 44 | ||
| 45 | + public static final String OUT_URL = "/out/**"; | ||
| 45 | /** | 46 | /** |
| 46 | * 解除调度指令和班次的外键约束 | 47 | * 解除调度指令和班次的外键约束 |
| 47 | */ | 48 | */ |
src/main/java/com/bsth/data/zndd/OutEntrance.java
0 → 100644
| 1 | +package com.bsth.data.zndd; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.common.ResponseCode; | ||
| 6 | +import com.bsth.data.BasicData; | ||
| 7 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 8 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | +import com.bsth.util.SignUtils; | ||
| 10 | +import com.bsth.websocket.handler.SendUtils; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.dao.DataAccessException; | ||
| 15 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | + | ||
| 18 | +import java.util.*; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 对外接口 | ||
| 22 | + * 与站牌、小程序对接接口 | ||
| 23 | + * 调度预案通用接口 | ||
| 24 | + */ | ||
| 25 | +@RestController | ||
| 26 | +@RequestMapping("/out") | ||
| 27 | +public class OutEntrance { | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + SendUtils sendUtils; | ||
| 31 | + @Autowired | ||
| 32 | + DayOfSchedule dayOfSchedule; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + JdbcTemplate jdbcTemplate; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/klyj", method = RequestMethod.POST) | ||
| 43 | + public Map klyj(@RequestBody JSONObject jsonObject) { | ||
| 44 | + Map rtn = new HashMap<>(); | ||
| 45 | + try { | ||
| 46 | + logger.info("大客流接口调用----"); | ||
| 47 | + if(!SignUtils.validation(Long.parseLong(jsonObject.getString("timestamp")),jsonObject.getString("sign"))){ | ||
| 48 | + rtn.put("status", "验证失败"); | ||
| 49 | + // return rtn; | ||
| 50 | + } | ||
| 51 | + String num=jsonObject.getString("num"); | ||
| 52 | + JSONArray jsonArray = jsonObject.getJSONArray("stations"); | ||
| 53 | + for (int i = 0; i < jsonArray.size(); i++) { | ||
| 54 | + JSONObject line=jsonArray.getJSONObject(i); | ||
| 55 | + String lineCode = line.get("lineCode").toString(); | ||
| 56 | + String stationCode = line.get("stationCode").toString(); | ||
| 57 | + String dir = line.get("dir").toString(); | ||
| 58 | + String lineName=BasicData.lineCode2NameMap.get(lineCode); | ||
| 59 | + String stationName=BasicData.stationCode2NameMap.get(lineCode+"_"+dir+"_"+stationCode); | ||
| 60 | + | ||
| 61 | + Map m = new HashMap(); | ||
| 62 | + m.put("stationCode", stationCode); | ||
| 63 | + m.put("lineCode", lineCode); | ||
| 64 | + m.put("stationName",stationName); | ||
| 65 | + m.put("lineName",lineName); | ||
| 66 | + m.put("num",num); | ||
| 67 | + m.put("xlDir",dir); | ||
| 68 | + sendUtils.klyj(m);//推送 | ||
| 69 | + } | ||
| 70 | + rtn.put("status",ResponseCode.SUCCESS); | ||
| 71 | + } catch (Exception e) { | ||
| 72 | + rtn.put("err", ResponseCode.ERROR); | ||
| 73 | + logger.error("",e); | ||
| 74 | + } | ||
| 75 | + return rtn; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + //调度获取站台视频 | ||
| 81 | + @RequestMapping(value = "/getStationVideo", method = RequestMethod.GET) | ||
| 82 | + public String getStationVideo(@RequestParam Map m) { | ||
| 83 | + if (m.get("lineCode")==null || m.get("upDown")==null){ | ||
| 84 | + return null; | ||
| 85 | + } | ||
| 86 | + String sql="select url from station_video where line_code ='"+m.get("lineCode")+"' and up_down ='"+m.get("upDown")+"'"; | ||
| 87 | + String url= null; | ||
| 88 | + try { | ||
| 89 | + url = jdbcTemplate.queryForObject(sql,String.class); | ||
| 90 | + } catch (DataAccessException e) { | ||
| 91 | + return null; | ||
| 92 | + } | ||
| 93 | + return url; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | +} |
src/main/java/com/bsth/entity/zndd/DKLInfo.java
0 → 100644
| 1 | +package com.bsth.entity.zndd; | ||
| 2 | + | ||
| 3 | +import javax.persistence.*; | ||
| 4 | +import java.util.Date; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +@Entity | ||
| 8 | +@Table(name = "dkl_info") | ||
| 9 | +public class DKLInfo { | ||
| 10 | + | ||
| 11 | + // ID | ||
| 12 | + @Id | ||
| 13 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 14 | + private Integer id; | ||
| 15 | + | ||
| 16 | + private String lineCode; | ||
| 17 | + | ||
| 18 | + private String lineName; | ||
| 19 | + | ||
| 20 | + private String stationCode; | ||
| 21 | + | ||
| 22 | + private String stationName; | ||
| 23 | + | ||
| 24 | + private int num; | ||
| 25 | + | ||
| 26 | + private String upDown; | ||
| 27 | + | ||
| 28 | + private String image; | ||
| 29 | + | ||
| 30 | + private String status; | ||
| 31 | + | ||
| 32 | + // 创建日期 | ||
| 33 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 34 | + private Date createDate; | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + public Integer getId() { | ||
| 38 | + return id; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void setId(Integer id) { | ||
| 42 | + this.id = id; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public String getLineCode() { | ||
| 46 | + return lineCode; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public void setLineCode(String lineCode) { | ||
| 50 | + this.lineCode = lineCode; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public String getLineName() { | ||
| 54 | + return lineName; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void setLineName(String lineName) { | ||
| 58 | + this.lineName = lineName; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public String getStationCode() { | ||
| 62 | + return stationCode; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setStationCode(String stationCode) { | ||
| 66 | + this.stationCode = stationCode; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public String getStationName() { | ||
| 70 | + return stationName; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setStationName(String stationName) { | ||
| 74 | + this.stationName = stationName; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public int getNum() { | ||
| 78 | + return num; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setNum(int num) { | ||
| 82 | + this.num = num; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public String getUpDown() { | ||
| 86 | + return upDown; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setUpDown(String upDown) { | ||
| 90 | + this.upDown = upDown; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public String getImage() { | ||
| 94 | + return image; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setImage(String image) { | ||
| 98 | + this.image = image; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public Date getCreateDate() { | ||
| 102 | + return createDate; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setCreateDate(Date createDate) { | ||
| 106 | + this.createDate = createDate; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public String getStatus() { | ||
| 110 | + return status; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setStatus(String status) { | ||
| 114 | + this.status = status; | ||
| 115 | + } | ||
| 116 | +} |
src/main/java/com/bsth/filter/BaseFilter.java
| @@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter { | @@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter { | ||
| 17 | * 白名单 | 17 | * 白名单 |
| 18 | */ | 18 | */ |
| 19 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, | 19 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, |
| 20 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN ,Constants.IPAD_IMG_URL}; | 20 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN ,Constants.IPAD_IMG_URL,Constants.OUT_URL}; |
| 21 | 21 | ||
| 22 | @Override | 22 | @Override |
| 23 | public void destroy() { | 23 | public void destroy() { |
src/main/java/com/bsth/security/WebSecurityConfig.java
| @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 36 | public void configure(WebSecurity web) throws Exception { | 36 | public void configure(WebSecurity web) throws Exception { |
| 37 | // 白名单 | 37 | // 白名单 |
| 38 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, | 38 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, |
| 39 | - Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT); | 39 | + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT,Constants.OUT_URL); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | @Override | 42 | @Override |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| @@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter { | @@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter { | ||
| 33 | * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 | 33 | * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 |
| 34 | */ | 34 | */ |
| 35 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, | 35 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, |
| 36 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN,Constants.IPAD_IMG_URL }; | 36 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN,Constants.IPAD_IMG_URL,Constants.OUT_URL }; |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | @Override | 39 | @Override |
src/main/java/com/bsth/util/SignUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.bsth.service.schedule.utils.Md5Util; | ||
| 4 | + | ||
| 5 | +public class SignUtils { | ||
| 6 | + | ||
| 7 | + private static final String PASSWORD="e126853c7f6f43b4857fa8dfe3b28b5d90be9e68"; | ||
| 8 | + public static boolean validation(long timestamp,String sign){ | ||
| 9 | + String md5String= Md5Util.getMd5(timestamp+PASSWORD); | ||
| 10 | + if(!md5String.equals(sign)){ | ||
| 11 | + return false; | ||
| 12 | + } | ||
| 13 | + if(System.currentTimeMillis()-timestamp>60*1000){ | ||
| 14 | + return false; | ||
| 15 | + } | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | +} |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| @@ -218,6 +218,19 @@ public class SendUtils{ | @@ -218,6 +218,19 @@ public class SendUtils{ | ||
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | + public void klyj(Map<String, Object> cp) { | ||
| 222 | + Map<String, Object> map = new HashMap<>(); | ||
| 223 | + map.put("fn", "klyj"); | ||
| 224 | + map.put("data", cp); | ||
| 225 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 226 | + | ||
| 227 | + try { | ||
| 228 | + socketHandler.sendMessageToLine(cp.get("lineCode").toString(), mapper.writeValueAsString(map)); | ||
| 229 | + } catch (JsonProcessingException e) { | ||
| 230 | + logger.error("sendContingencyPlan", e); | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + | ||
| 221 | /** | 234 | /** |
| 222 | * 将车辆异常停车发送至线调页面 | 235 | * 将车辆异常停车发送至线调页面 |
| 223 | */ | 236 | */ |
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
| @@ -25,7 +25,9 @@ | @@ -25,7 +25,9 @@ | ||
| 25 | </div> | 25 | </div> |
| 26 | <i class="uk-icon-eye uk-icon-hover ct_eye_icon"></i> | 26 | <i class="uk-icon-eye uk-icon-hover ct_eye_icon"></i> |
| 27 | <!--<i class="uk-icon-share-alt uk-icon-hover tp_info_icon" ></i>--> | 27 | <!--<i class="uk-icon-share-alt uk-icon-hover tp_info_icon" ></i>--> |
| 28 | + <i class="uk-icon-video-camera uk-icon-hover ct_video_camera_icon" data-updown="{{dir}}" data-linecode="{{line.lineCode}}" data-toggle="tooltip" data-placement="bottom"></i> | ||
| 28 | 29 | ||
| 30 | + <span type="text" id="{{line.lineCode}}_{{dir}}" ></span> | ||
| 29 | <span class="warn_multi_station" data-updown="{{dir}}" data-code="{{line.lineCode}}"></span> | 31 | <span class="warn_multi_station" data-updown="{{dir}}" data-code="{{line.lineCode}}"></span> |
| 30 | <div class="search_sch_panel"> | 32 | <div class="search_sch_panel"> |
| 31 | <form class="uk-form" onsubmit="javascript:return false;"> | 33 | <form class="uk-form" onsubmit="javascript:return false;"> |
src/main/resources/static/real_control_v2/js/line_schedule/legend.js
| @@ -45,6 +45,42 @@ var gb_sch_legend = (function () { | @@ -45,6 +45,42 @@ var gb_sch_legend = (function () { | ||
| 45 | 45 | ||
| 46 | var eye_dom = '.schedule-wrap i.ct_eye_icon'; | 46 | var eye_dom = '.schedule-wrap i.ct_eye_icon'; |
| 47 | $(document).on('click', eye_dom, changeHandicappedStyle); | 47 | $(document).on('click', eye_dom, changeHandicappedStyle); |
| 48 | + | ||
| 49 | + | ||
| 50 | + $(document).on('click', '.schedule-wrap i.ct_video_camera_icon', function (event) { | ||
| 51 | + var upDown=event.target.dataset.updown; | ||
| 52 | + var lineCode=event.target.dataset.linecode; | ||
| 53 | + var params = {"upDown":upDown,"lineCode":lineCode}; | ||
| 54 | + $.get('/out/getStationVideo', params, function(url){ | ||
| 55 | + if(url!=''){ | ||
| 56 | + var imgHtml = "<iframe src='"+url+"?autoplay=1' style='width:100%;height:100%'/>"; | ||
| 57 | + layer.open({ | ||
| 58 | + type: 1, | ||
| 59 | + offset: 'auto', | ||
| 60 | + area: [700 + 'px', 394 + 'px'], | ||
| 61 | + shadeClose: true,//点击外围关闭弹窗 | ||
| 62 | + scrollbar: true,//不现实滚动条 | ||
| 63 | + title: false, //不显示标题 | ||
| 64 | + content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响 | ||
| 65 | + cancel: function () { | ||
| 66 | + } | ||
| 67 | + }) | ||
| 68 | + }/*else { | ||
| 69 | + notify_succ('设备不存在'); | ||
| 70 | + }*/ | ||
| 71 | + | ||
| 72 | + }); | ||
| 73 | + }); | ||
| 74 | + | ||
| 75 | + function popcf(data){ | ||
| 76 | + if(data.num < 5){ | ||
| 77 | + $("#"+data.lineCode+"_"+data.xlDir).text("(客流正常)"); | ||
| 78 | + }else { | ||
| 79 | + $("#"+data.lineCode+"_"+data.xlDir).text("(客流拥挤)"); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | + | ||
| 48 | function changeHandicappedStyle() { | 84 | function changeHandicappedStyle() { |
| 49 | if($(this).hasClass('active')){ | 85 | if($(this).hasClass('active')){ |
| 50 | $(eye_dom).removeClass('active'); | 86 | $(eye_dom).removeClass('active'); |
| @@ -83,6 +119,7 @@ var gb_sch_legend = (function () { | @@ -83,6 +119,7 @@ var gb_sch_legend = (function () { | ||
| 83 | }; | 119 | }; |
| 84 | 120 | ||
| 85 | return { | 121 | return { |
| 86 | - init: initLegend | 122 | + init: initLegend, |
| 123 | + popcf : popcf | ||
| 87 | }; | 124 | }; |
| 88 | })(); | 125 | })(); |
| 89 | \ No newline at end of file | 126 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
| @@ -186,6 +186,10 @@ var gb_sch_websocket = (function () { | @@ -186,6 +186,10 @@ var gb_sch_websocket = (function () { | ||
| 186 | var signalState = function (msg) { | 186 | var signalState = function (msg) { |
| 187 | gb_signal_state.put(msg.data); | 187 | gb_signal_state.put(msg.data); |
| 188 | }; | 188 | }; |
| 189 | + var klyj = function (msg){ | ||
| 190 | + gb_sch_legend.popcf(msg.data); | ||
| 191 | + }; | ||
| 192 | + | ||
| 189 | 193 | ||
| 190 | var carErrorStop = function (msg){ | 194 | var carErrorStop = function (msg){ |
| 191 | gb_carerrorstop.pop(msg.data); | 195 | gb_carerrorstop.pop(msg.data); |
| @@ -202,6 +206,7 @@ var gb_sch_websocket = (function () { | @@ -202,6 +206,7 @@ var gb_sch_websocket = (function () { | ||
| 202 | deviceOffline: deviceOffline, | 206 | deviceOffline: deviceOffline, |
| 203 | safeDriv: safeDriv, | 207 | safeDriv: safeDriv, |
| 204 | auto_wdtz: autoWdtz, | 208 | auto_wdtz: autoWdtz, |
| 209 | + klyj:klyj, | ||
| 205 | carErrorStop: carErrorStop | 210 | carErrorStop: carErrorStop |
| 206 | }; | 211 | }; |
| 207 | 212 |