Commit 20e6b8348c2b7ffb5ac7eb17b34c35f47a593722

Authored by yiming
1 parent a7767911

1.大客流数据记录

2.线调站点视频查看
3.线调大客流图片查看
src/main/java/com/bsth/data/zndd/OutEntrance.java
@@ -6,9 +6,11 @@ import com.bsth.common.ResponseCode; @@ -6,9 +6,11 @@ import com.bsth.common.ResponseCode;
6 import com.bsth.data.BasicData; 6 import com.bsth.data.BasicData;
7 import com.bsth.data.schedule.DayOfSchedule; 7 import com.bsth.data.schedule.DayOfSchedule;
8 import com.bsth.data.schedule.ScheduleComparator; 8 import com.bsth.data.schedule.ScheduleComparator;
  9 +import com.bsth.entity.DKLInfo;
9 import com.bsth.entity.realcontrol.ScheduleRealInfo; 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 import com.bsth.entity.zndd.StationPeopleLogger; 11 import com.bsth.entity.zndd.StationPeopleLogger;
11 import com.bsth.entity.zndd.StationSignsLogger; 12 import com.bsth.entity.zndd.StationSignsLogger;
  13 +import com.bsth.service.DKLInfoService;
12 import com.bsth.util.HttpClientUtils; 14 import com.bsth.util.HttpClientUtils;
13 import com.bsth.util.SignUtils; 15 import com.bsth.util.SignUtils;
14 import com.bsth.websocket.handler.SendUtils; 16 import com.bsth.websocket.handler.SendUtils;
@@ -17,8 +19,11 @@ import org.slf4j.Logger; @@ -17,8 +19,11 @@ import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory; 19 import org.slf4j.LoggerFactory;
18 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.beans.factory.annotation.Value; 21 import org.springframework.beans.factory.annotation.Value;
  22 +import org.springframework.dao.DataAccessException;
  23 +import org.springframework.jdbc.core.JdbcTemplate;
20 import org.springframework.scheduling.annotation.Scheduled; 24 import org.springframework.scheduling.annotation.Scheduled;
21 import org.springframework.web.bind.annotation.*; 25 import org.springframework.web.bind.annotation.*;
  26 +import javax.annotation.PostConstruct;
22 import java.io.*; 27 import java.io.*;
23 import java.nio.file.Files; 28 import java.nio.file.Files;
24 import java.nio.file.Path; 29 import java.nio.file.Path;
@@ -31,6 +36,7 @@ import java.io.FileOutputStream; @@ -31,6 +36,7 @@ import java.io.FileOutputStream;
31 import java.io.InputStream; 36 import java.io.InputStream;
32 import java.text.SimpleDateFormat; 37 import java.text.SimpleDateFormat;
33 import java.time.Duration; 38 import java.time.Duration;
  39 +import java.time.LocalDateTime;
34 import java.time.LocalTime; 40 import java.time.LocalTime;
35 import java.time.format.DateTimeFormatter; 41 import java.time.format.DateTimeFormatter;
36 import java.util.*; 42 import java.util.*;
@@ -69,6 +75,12 @@ public class OutEntrance { @@ -69,6 +75,12 @@ public class OutEntrance {
69 @Autowired 75 @Autowired
70 AutomaticSch automaticSch; 76 AutomaticSch automaticSch;
71 77
  78 + @Autowired
  79 + private DKLInfoService dklInfoService;
  80 +
  81 + @Autowired
  82 + JdbcTemplate jdbcTemplate;
  83 +
72 //调度屏小程序接口。 84 //调度屏小程序接口。
73 @RequestMapping(value = "/OutCar", method = RequestMethod.POST) 85 @RequestMapping(value = "/OutCar", method = RequestMethod.POST)
74 public Map OutCarOutCar(@RequestParam Map m,@RequestBody StationSignsLogger ssLogger) { 86 public Map OutCarOutCar(@RequestParam Map m,@RequestBody StationSignsLogger ssLogger) {
@@ -155,10 +167,6 @@ public class OutEntrance { @@ -155,10 +167,6 @@ public class OutEntrance {
155 } 167 }
156 String num=jsonObject.getString("num"); 168 String num=jsonObject.getString("num");
157 int count=automaticSch.getPenum("DKL","0"); 169 int count=automaticSch.getPenum("DKL","0");
158 - if(Integer.parseInt(num)<count){  
159 - rtn.put("status",ResponseCode.SUCCESS);  
160 - return rtn;  
161 - }  
162 String image=jsonObject.getString("image"); 170 String image=jsonObject.getString("image");
163 String img=uploadBase64Img(image); 171 String img=uploadBase64Img(image);
164 JSONArray jsonArray = jsonObject.getJSONArray("stations"); 172 JSONArray jsonArray = jsonObject.getJSONArray("stations");
@@ -169,13 +177,27 @@ public class OutEntrance { @@ -169,13 +177,27 @@ public class OutEntrance {
169 String lineCode = line.get("lineCode").toString(); 177 String lineCode = line.get("lineCode").toString();
170 String stationCode = line.get("stationCode").toString(); 178 String stationCode = line.get("stationCode").toString();
171 String dir = line.get("dir").toString(); 179 String dir = line.get("dir").toString();
172 - /*StationRoute stationRoute=BasicData.stationCode2StationMap.get(lineCode+"_"+stationCode);*/ 180 + imgMap.put(lineCode+"_"+dir,image);
  181 + DKLInfo dklInfo =new DKLInfo();
  182 + dklInfo.setLineCode(stationCode);
  183 + String lineName=BasicData.lineCode2NameMap.get(lineCode);
  184 + String stationName=BasicData.stationCode2NameMap.get(lineCode+"_"+dir+"_"+stationCode);
  185 + dklInfo.setLineName(lineName);
  186 + dklInfo.setStationCode(stationCode);
  187 + dklInfo.setStationName(stationName);
  188 + dklInfo.setNum(Integer.parseInt(num));
  189 + dklInfo.setUpDown(dir);
  190 + dklInfo.setImage(img);
  191 + dklInfoService.save(dklInfo);
  192 + if(Integer.parseInt(num)<count){
  193 + continue;
  194 + }
173 Map m = new HashMap(); 195 Map m = new HashMap();
174 m.put("image", img); 196 m.put("image", img);
175 m.put("stationCode", stationCode); 197 m.put("stationCode", stationCode);
176 m.put("lineCode", lineCode); 198 m.put("lineCode", lineCode);
177 - m.put("stationName",BasicData.stationCode2NameMap.get(lineCode+"_"+dir+"_"+stationCode));  
178 - m.put("lineName",BasicData.lineCode2NameMap.get(lineCode)); 199 + m.put("stationName",stationName);
  200 + m.put("lineName",lineName);
179 m.put("num",num); 201 m.put("num",num);
180 m.put("xlDir",dir); 202 m.put("xlDir",dir);
181 List<ScheduleRealInfo> srList=dayOfSchedule.findByLineAndUpDown(lineCode,Integer.parseInt(dir)); 203 List<ScheduleRealInfo> srList=dayOfSchedule.findByLineAndUpDown(lineCode,Integer.parseInt(dir));
@@ -319,7 +341,7 @@ public class OutEntrance { @@ -319,7 +341,7 @@ public class OutEntrance {
319 destfile.mkdirs(); 341 destfile.mkdirs();
320 } 342 }
321 //文件新名称 343 //文件新名称
322 - String fileNameNew = AutomaticSch.UUID()+ ".png"; 344 + String fileNameNew = System.currentTimeMillis()+"_"+AutomaticSch.UUID()+ ".png";
323 File f = new File(destfile.getAbsoluteFile() + File.separator + fileNameNew); 345 File f = new File(destfile.getAbsoluteFile() + File.separator + fileNameNew);
324 // 将字符串转换成二进制,用于显示图片 346 // 将字符串转换成二进制,用于显示图片
325 // 将上面生成的图片格式字符串 imgStr,还原成图片显示 347 // 将上面生成的图片格式字符串 imgStr,还原成图片显示
@@ -397,7 +419,9 @@ public class OutEntrance { @@ -397,7 +419,9 @@ public class OutEntrance {
397 @Scheduled(cron = "0 0 0 * * ?") 419 @Scheduled(cron = "0 0 0 * * ?")
398 public void clearImg(){ 420 public void clearImg(){
399 try { 421 try {
400 - File folder=new File(imgurl+"/avat"); 422 + LocalDateTime date =LocalDateTime.now().minusDays(7);
  423 + String[] d=date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")).split("-");
  424 + File folder=new File(imgurl+"/avat/"+d[0]+"/"+d[1]+"/"+d[2]);
401 delete(folder); 425 delete(folder);
402 } catch (Exception e) { 426 } catch (Exception e) {
403 e.printStackTrace(); 427 e.printStackTrace();
@@ -416,4 +440,28 @@ public class OutEntrance { @@ -416,4 +440,28 @@ public class OutEntrance {
416 folder.delete(); // 删除空文件夹或者文件 440 folder.delete(); // 删除空文件夹或者文件
417 } 441 }
418 442
  443 + private static Map<String,String> imgMap =new HashMap<>();
  444 + //调度获取站台视频
  445 + @RequestMapping(value = "/getStationVideo", method = RequestMethod.GET)
  446 + public String getStationVideo(@RequestParam Map m) {
  447 + if (m.get("lineCode")==null || m.get("upDown")==null){
  448 + return null;
  449 + }
  450 + String sql="select url from station_video where line_code ='"+m.get("lineCode")+"' and up_down ='"+m.get("upDown")+"'";
  451 + String url= null;
  452 + try {
  453 + url = jdbcTemplate.queryForObject(sql,String.class);
  454 + } catch (DataAccessException e) {
  455 + return null;
  456 + }
  457 + return url;
  458 + }
  459 +
  460 + //调度获取站台图片
  461 + @RequestMapping(value = "/getStationImg", method = RequestMethod.GET)
  462 + public String getStationImg(@RequestParam Map m) {
  463 + String url=imgMap.get(m.get("lineCode")+"_"+m.get("upDown"));
  464 + return url;
  465 + }
  466 +
419 } 467 }
src/main/java/com/bsth/entity/DKLInfo.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.*;
  4 +import java.util.Date;
  5 +
  6 +
  7 +
  8 +@Entity
  9 +@Table(name = "dkl_info")
  10 +public class DKLInfo {
  11 +
  12 + // ID
  13 + @Id
  14 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  15 + private Integer id;
  16 +
  17 + private String lineCode;
  18 +
  19 + private String lineName;
  20 +
  21 + private String stationCode;
  22 +
  23 + private String stationName;
  24 +
  25 + private int num;
  26 +
  27 + private String upDown;
  28 +
  29 + private String image;
  30 +
  31 + // 创建日期
  32 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  33 + private Date createDate;
  34 +
  35 +
  36 + public Integer getId() {
  37 + return id;
  38 + }
  39 +
  40 + public void setId(Integer id) {
  41 + this.id = id;
  42 + }
  43 +
  44 + public String getLineCode() {
  45 + return lineCode;
  46 + }
  47 +
  48 + public void setLineCode(String lineCode) {
  49 + this.lineCode = lineCode;
  50 + }
  51 +
  52 + public String getLineName() {
  53 + return lineName;
  54 + }
  55 +
  56 + public void setLineName(String lineName) {
  57 + this.lineName = lineName;
  58 + }
  59 +
  60 + public String getStationCode() {
  61 + return stationCode;
  62 + }
  63 +
  64 + public void setStationCode(String stationCode) {
  65 + this.stationCode = stationCode;
  66 + }
  67 +
  68 + public String getStationName() {
  69 + return stationName;
  70 + }
  71 +
  72 + public void setStationName(String stationName) {
  73 + this.stationName = stationName;
  74 + }
  75 +
  76 + public int getNum() {
  77 + return num;
  78 + }
  79 +
  80 + public void setNum(int num) {
  81 + this.num = num;
  82 + }
  83 +
  84 + public String getUpDown() {
  85 + return upDown;
  86 + }
  87 +
  88 + public void setUpDown(String upDown) {
  89 + this.upDown = upDown;
  90 + }
  91 +
  92 + public String getImage() {
  93 + return image;
  94 + }
  95 +
  96 + public void setImage(String image) {
  97 + this.image = image;
  98 + }
  99 +
  100 + public Date getCreateDate() {
  101 + return createDate;
  102 + }
  103 +
  104 + public void setCreateDate(Date createDate) {
  105 + this.createDate = createDate;
  106 + }
  107 +
  108 +}
src/main/java/com/bsth/repository/DKLInfoRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +import org.springframework.stereotype.Repository;
  5 +
  6 +
  7 +@Repository
  8 +public interface DKLInfoRepository extends BaseRepository<DKLInfo, Integer> {
  9 +}
src/main/java/com/bsth/service/DKLInfoService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +
  5 +
  6 +public interface DKLInfoService extends BaseService<DKLInfo, Integer> {
  7 +}
src/main/java/com/bsth/service/impl/DKLInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.DKLInfo;
  4 +import com.bsth.service.DKLInfoService;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +
  8 +@Service
  9 +public class DKLInfoServiceImpl extends BaseServiceImpl<DKLInfo, Integer> implements DKLInfoService {
  10 +}
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
@@ -25,6 +25,8 @@ @@ -25,6 +25,8 @@
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-qrcode uk-icon-hover ct_calu_icon" data-toggle="tooltip" data-placement="bottom" title="计算应到实到时间对比"></i> 27 <i class="uk-icon-qrcode uk-icon-hover ct_calu_icon" data-toggle="tooltip" data-placement="bottom" title="计算应到实到时间对比"></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>
  29 + <i class="uk-icon-image uk-icon-hover ct_image_icon" data-updown="{{dir}}" data-linecode="{{line.lineCode}}" data-toggle="tooltip" data-placement="bottom"></i>
28 30
29 <!--<i class="uk-icon-share-alt uk-icon-hover tp_info_icon" ></i>--> 31 <!--<i class="uk-icon-share-alt uk-icon-hover tp_info_icon" ></i>-->
30 32
src/main/resources/static/real_control_v2/js/line_schedule/legend.js
@@ -78,6 +78,55 @@ var gb_sch_legend = (function () { @@ -78,6 +78,55 @@ var gb_sch_legend = (function () {
78 showYdSdDb(); 78 showYdSdDb();
79 } 79 }
80 80
  81 + $(document).on('click', '.schedule-wrap i.ct_video_camera_icon', function (event) {
  82 + var upDown=event.target.dataset.updown;
  83 + var lineCode=event.target.dataset.linecode;
  84 + var params = {"upDown":upDown,"lineCode":lineCode};
  85 + $.get('/out/getStationVideo', params, function(url){
  86 + if(url!=''){
  87 + var imgHtml = "<iframe src='"+url+"?autoplay=1' style='width:100%;height:100%'/>";
  88 + layer.open({
  89 + type: 1,
  90 + offset: 'auto',
  91 + area: [700 + 'px', 394 + 'px'],
  92 + shadeClose: true,//点击外围关闭弹窗
  93 + scrollbar: true,//不现实滚动条
  94 + title: false, //不显示标题
  95 + content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
  96 + cancel: function () {
  97 + }
  98 + })
  99 + }/*else {
  100 + notify_succ('设备不存在');
  101 + }*/
  102 +
  103 + });
  104 + });
  105 +
  106 + $(document).on('click', '.schedule-wrap i.ct_image_icon', function (event) {
  107 + var upDown=event.target.dataset.updown;
  108 + var lineCode=event.target.dataset.linecode;
  109 + var params = {"upDown":upDown,"lineCode":lineCode};
  110 + $.get('/out/getStationImg', params, function(url){
  111 + if(url!=''){
  112 + var imgHtml = "<img src='"+url+"' style='width:700px;height:394px'/>";
  113 + layer.open({
  114 + type: 1,
  115 + offset: 'auto',
  116 + area: [700 + 'px', 394 + 'px'],
  117 + shadeClose: true,//点击外围关闭弹窗
  118 + scrollbar: true,//不现实滚动条
  119 + title: false, //不显示标题
  120 + content: imgHtml, //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
  121 + cancel: function () {
  122 + }
  123 + })
  124 + }/*else {
  125 + notify_succ('设备不存在');
  126 + }*/
  127 + });
  128 + });
  129 +
81 function showYdSdDb() { 130 function showYdSdDb() {
82 if (ydsddb) { 131 if (ydsddb) {
83 var sdsjs = $('.schedule-wrap').find('.qdzArrDatesjDD'); 132 var sdsjs = $('.schedule-wrap').find('.qdzArrDatesjDD');