Commit baeb678c473823ea5607dccb149ea83d7d0999e2

Authored by ljq
1 parent 74d076bc

线调ip打电话功能

src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
@@ -5,6 +5,7 @@ import com.bsth.data.forecast.ForecastRealServer; @@ -5,6 +5,7 @@ import com.bsth.data.forecast.ForecastRealServer;
5 import com.bsth.data.gpsdata_v2.entity.GpsEntity; 5 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
6 import com.bsth.data.schedule.DayOfSchedule; 6 import com.bsth.data.schedule.DayOfSchedule;
7 import com.bsth.entity.realcontrol.ScheduleRealInfo; 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.service.realcontrol.impl.ScheduleRealInfoServiceImpl;
8 import com.google.common.collect.TreeMultimap; 9 import com.google.common.collect.TreeMultimap;
9 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
10 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -155,7 +156,8 @@ public class GpsRealData { @@ -155,7 +156,8 @@ public class GpsRealData {
155 } 156 }
156 }else 157 }else
157 gps.setRemark(null); 158 gps.setRemark(null);
158 - 159 +
  160 + gps.setDvrcode(ScheduleRealInfoServiceImpl.DIRMAP.get(BasicData.deviceId2NbbmMap.get(gps.getDeviceId())));;
159 rs.add(gps); 161 rs.add(gps);
160 } 162 }
161 163
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
@@ -110,6 +110,8 @@ public class GpsEntity implements Cloneable{ @@ -110,6 +110,8 @@ public class GpsEntity implements Cloneable{
110 110
111 private String remark; 111 private String remark;
112 private String planCode; 112 private String planCode;
  113 +
  114 + private String dvrcode;
113 115
114 public Object clone() { 116 public Object clone() {
115 try { 117 try {
@@ -119,6 +121,14 @@ public class GpsEntity implements Cloneable{ @@ -119,6 +121,14 @@ public class GpsEntity implements Cloneable{
119 } 121 }
120 } 122 }
121 123
  124 + public String getDvrcode() {
  125 + return dvrcode;
  126 + }
  127 +
  128 + public void setDvrcode(String dvrcode) {
  129 + this.dvrcode = dvrcode;
  130 + }
  131 +
122 public String getDeviceId() { 132 public String getDeviceId() {
123 return deviceId; 133 return deviceId;
124 } 134 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 package com.bsth.service.realcontrol.impl; 1 package com.bsth.service.realcontrol.impl;
2 2
3 -import java.io.ByteArrayOutputStream;  
4 -import java.io.File;  
5 -import java.io.IOException;  
6 -import java.io.InputStream; 3 +import java.io.*;
7 import java.net.HttpURLConnection; 4 import java.net.HttpURLConnection;
  5 +import java.net.MalformedURLException;
8 import java.net.URL; 6 import java.net.URL;
  7 +import java.net.URLEncoder;
9 import java.sql.ResultSet; 8 import java.sql.ResultSet;
10 import java.sql.SQLException; 9 import java.sql.SQLException;
11 import java.text.DecimalFormat; 10 import java.text.DecimalFormat;
@@ -223,6 +222,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf @@ -223,6 +222,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf
223 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 222 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
224 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 223 sdfSimple = new SimpleDateFormat("yyyyMMdd");
225 224
  225 + public static Map<String,String> DIRMAP ; // dvr电话
226 private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>(); 226 private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>();
227 227
228 private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { 228 private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
@@ -237,6 +237,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -237,6 +237,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
237 } 237 }
238 }); 238 });
239 239
  240 +
  241 +
240 private static Map<String, String> report2repair = new HashMap<String, String>(); 242 private static Map<String, String> report2repair = new HashMap<String, String>();
241 243
242 static { 244 static {
@@ -6494,7 +6496,46 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6494,7 +6496,46 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6494 } 6496 }
6495 } 6497 }
6496 }, 30, 30, TimeUnit.MINUTES); 6498 }, 30, 30, TimeUnit.MINUTES);
6497 - } 6499 +
  6500 + //// ---
  6501 + exec.scheduleWithFixedDelay(new Runnable() {
  6502 + @Override
  6503 + public void run() {
  6504 + Map<String, Object> res = new HashMap<>();
  6505 + InputStream in = null;
  6506 + OutputStream out = null;
  6507 + SysUser user = SecurityUtils.getCurrentUser();
  6508 + DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
  6509 + String url ="http://211.95.61.66:9008/modules/tSafedrivingCs/DSMBHforCLBH";
  6510 +
  6511 + try {
  6512 + HttpURLConnection con = (HttpURLConnection)new URL(url.toString()).openConnection();
  6513 + con.setDoInput(true);
  6514 + con.setRequestMethod("POST");
  6515 + con.setConnectTimeout(5000);
  6516 + con.setReadTimeout(5000);
  6517 + con.setRequestProperty("keep-alive", "true");
  6518 + con.setRequestProperty("accept", "*/*");
  6519 + con.setRequestProperty("content-type", "application/x-www-form-urlencoded");
  6520 + con.connect();
  6521 +
  6522 + if (con.getResponseCode() == 200) {
  6523 + in = con.getInputStream();
  6524 + ByteArrayOutputStream bout = new ByteArrayOutputStream();
  6525 + IOUtils.copy(in, bout);
  6526 + DIRMAP = new ObjectMapper().readValue(bout.toByteArray(), Map.class);
  6527 + }
  6528 + } catch (MalformedURLException e) {
  6529 + // TODO Auto-generated catch block
  6530 + e.printStackTrace();
  6531 + } catch (IOException e) {
  6532 + // TODO Auto-generated catch block
  6533 + e.printStackTrace();
  6534 + }
  6535 +
  6536 + }
  6537 + }, 0, 60 * 60 * 24, TimeUnit.MINUTES);
  6538 + }
6498 } 6539 }
6499 6540
6500 class AccountMap implements Comparator<Map<String, Object>> { 6541 class AccountMap implements Comparator<Map<String, Object>> {
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
@@ -39,6 +39,7 @@ @@ -39,6 +39,7 @@
39 <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a> 39 <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a>
40 {{/if}} 40 {{/if}}
41 <a href="javascript:;" style="float: left;" onclick="javascript:window.open('http://211.95.61.66:9020/transport_server/dvr_monitor2.html?userid=4&zbh={{nbbm}}');">DVR</a> 41 <a href="javascript:;" style="float: left;" onclick="javascript:window.open('http://211.95.61.66:9020/transport_server/dvr_monitor2.html?userid=4&zbh={{nbbm}}');">DVR</a>
  42 + <a href="javascript:;" style="margin-left: 50px;" onclick="javascript:window.open('sip:{{dvrcode}}@139.196.29.203:5060?method=call');">IP电话</a>
42 <a href="javascript:;" style="float: right;" onclick="javascript:gb_map_play_back.initParams('{{deviceId}}', '{{nbbm}}');">轨迹回放</a> 43 <a href="javascript:;" style="float: right;" onclick="javascript:gb_map_play_back.initParams('{{deviceId}}', '{{nbbm}}');">轨迹回放</a>
43 </div> 44 </div>
44 </script> 45 </script>