Commit d849b94b06c1c7a860c66c2ea66fdf2de2b86137

Authored by zb
2 parents 4edb5f24 a2558d9d

update 超速信息

src/main/java/com/bsth/controller/excep/SpeedingController.java
1 1 package com.bsth.controller.excep;
2 2  
  3 +import java.text.ParseException;
  4 +import java.util.ArrayList;
3 5 import java.util.HashMap;
  6 +import java.util.List;
4 7 import java.util.Map;
5 8  
6 9 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -11,11 +14,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
11 14 import org.springframework.web.bind.annotation.RestController;
12 15  
13 16 import com.bsth.controller.BaseController;
  17 +import com.bsth.data.BasicData;
14 18 import com.bsth.entity.excep.Offline;
15 19 import com.bsth.entity.excep.Speeding;
16 20 import com.bsth.entity.sys.SysUser;
17 21 import com.bsth.service.excep.OfflineService;
18 22 import com.bsth.service.excep.SpeedingService;
  23 +import com.bsth.service.gps.entity.GpsSpeed;
19 24 import com.bsth.util.PageObject;
20 25  
21 26 @RestController
... ... @@ -45,5 +50,11 @@ public class SpeedingController extends BaseController<SysUser, Integer>{
45 50 return modelMap;
46 51 }
47 52  
  53 + @RequestMapping(value = "/findPosition", method = RequestMethod.GET)
  54 + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
  55 + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
  56 + List<Speeding> listSpeeding = speedingService.findPosition(deviceid,startdate,enddate);
  57 + return listSpeeding;
  58 + }
48 59  
49 60 }
... ...
src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -195,12 +195,10 @@ public class GpsController {
195 195 }
196 196  
197 197 @RequestMapping(value = "/pagequery",method = RequestMethod.GET)
198   - public PageObject<GpsSpeed> pagequery(@RequestParam Map<String, Object> map){
199   - PageObject<GpsSpeed> pageObject = null;
  198 + public Map<String, Object> pagequery(@RequestParam Map<String, Object> map){
200 199 map.put("curPage", map.get("page").toString());
201 200 map.put("pageData","10");
202   - pageObject=gpsService.Pagequery(map);
203   - return pageObject;
  201 + return gpsService.Pagequery(map);
204 202 }
205 203  
206 204 }
... ...
src/main/java/com/bsth/entity/excep/Speeding.java
... ... @@ -35,7 +35,11 @@ public class Speeding {
35 35 */
36 36 private String lineName;
37 37  
38   -
  38 + /**
  39 + * 线路ID
  40 + */
  41 + private Integer lineId;
  42 +
39 43 /**
40 44 * 上下行(0 上行 , 1 下行 , -1 无效)
41 45 */
... ... @@ -243,4 +247,12 @@ public class Speeding {
243 247 this.endtimestamp = endtimestamp;
244 248 }
245 249  
  250 + public Integer getLineId() {
  251 + return lineId;
  252 + }
  253 +
  254 + public void setLineId(Integer lineId) {
  255 + this.lineId = lineId;
  256 + }
  257 +
246 258 }
... ...
src/main/java/com/bsth/service/excep/SpeedingService.java
1 1 package com.bsth.service.excep;
2 2  
  3 +import java.util.List;
3 4 import java.util.Map;
4 5  
5 6 import com.bsth.entity.excep.Speeding;
... ... @@ -8,4 +9,6 @@ import com.bsth.util.PageObject;
8 9 public interface SpeedingService {
9 10 PageObject <Speeding> Pagequery(Map<String, Object> map) ;
10 11 Map<String, Object> getReport( Map<String, Object> map);
  12 + List<Speeding> findPosition(String deviceid, String startdate,
  13 + String enddate);
11 14 }
... ...
src/main/java/com/bsth/service/excep/impl/SpeedingServiceImpl.java
... ... @@ -7,6 +7,7 @@ import java.sql.SQLException;
7 7 import java.text.ParseException;
8 8 import java.text.SimpleDateFormat;
9 9 import java.util.ArrayList;
  10 +import java.util.Calendar;
10 11 import java.util.Date;
11 12 import java.util.HashMap;
12 13 import java.util.Iterator;
... ... @@ -18,8 +19,10 @@ import org.springframework.stereotype.Service;
18 19 import org.springframework.beans.factory.annotation.Autowired;
19 20  
20 21 import com.bsth.data.BasicData;
  22 +import com.bsth.entity.excep.Outbound;
21 23 import com.bsth.entity.excep.Speeding;
22 24 import com.bsth.service.excep.SpeedingService;
  25 +import com.bsth.service.gps.entity.GpsSpeed;
23 26 import com.bsth.util.EchartConver;
24 27 import com.bsth.util.PageHelper;
25 28 import com.bsth.util.PageObject;
... ... @@ -40,24 +43,17 @@ public class SpeedingServiceImpl implements SpeedingService {
40 43 ResultSet rs = null;
41 44 int page=Integer.parseInt(map.get("page").toString());
42 45 List<Speeding> list=new ArrayList<Speeding>();
43   - String sql="select * from bsth_c_speeding where 1=1 ";
  46 + String sql="select * from bsth_c_speedingmh where 1=1 ";
44 47 Object line=map.get("line");
45   - Object nbbm=map.get("nbbm");
46 48 Object updown=map.get("updown");
47 49 Object startDate=map.get("startDate");
48 50 Object endDate=map.get("endDate");
  51 + Object times=map.get("times");
49 52  
50 53 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
51 54 if(line!=null){
52 55 sql +=" and line like'%"+line.toString().trim()+"%'";
53 56 }
54   -
55   - if(nbbm!=null){
56   - nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
57   - if(nbbm!=null)
58   - sql +=" and vehicle like '%"+nbbm.toString()+"%'";
59   - }
60   -
61 57 if(updown!=null){
62 58 sql +="and up_down like '%"+updown.toString()+"%'";
63 59 }
... ... @@ -65,41 +61,42 @@ public class SpeedingServiceImpl implements SpeedingService {
65 61 if (startDate.toString().length()>0) {
66 62 try {
67 63 Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
68   - sql += " and timestamp >="+t1;
  64 + sql += " and startTimestamp >="+t1;
69 65 } catch (ParseException e) {
70 66 e.printStackTrace();
71 67 }
72 68 }
73   -
74 69 }
75 70 if(endDate!=null){
76 71 if (endDate.toString().length()>0) {
77 72 try {
78 73 Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
79   - sql += " and timestamp <="+t2;
  74 + sql += " and endTimestamp <="+t2;
80 75 } catch (ParseException e) {
81 76 e.printStackTrace();
82 77 }
83 78 }
84 79  
85 80 }
86   -
87   - /*sql +=" order by id limit ?,?";*/
88 81  
  82 + if(times!=null && times.toString().length()>0){
  83 + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000;
  84 + }
  85 +
  86 + sql +=" order by startTimestamp limit ?,?";
89 87  
90 88 try {
91 89 conn = DBUtils_MS.getConnection();
92 90 ps = conn.prepareStatement(sql);
93   - /* ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
  91 + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
94 92 ps.setInt(2, 10); // O-最小条数 -- M-显示条数
95   -*/ rs = ps.executeQuery();
  93 + rs = ps.executeQuery();
96 94 list = resultSet2Set(rs);
97 95 } catch (SQLException e) {
98 96 e.printStackTrace();
99 97 }finally {
100 98 DBUtils_MS.close(rs, ps, conn);
101 99 }
102   -
103 100 return list;
104 101 }
105 102  
... ... @@ -107,25 +104,27 @@ public class SpeedingServiceImpl implements SpeedingService {
107 104 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
108 105 List<Speeding> list=new ArrayList<Speeding>();
109 106 Speeding speeding;
110   - Float lon, lat;
111 107 Location location;
112 108 while(rs.next()){
113   - lon = rs.getFloat("lon");
114   - lat = rs.getFloat("lat");
115   - location = TransGPS.LocationMake(lon, lat);
116   - location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
117 109 speeding=new Speeding();
118   - speeding.setId(Integer.valueOf(rs.getObject("id").toString()));
119   - speeding.setLon((float)location.getLng());
120   - speeding.setLat((float)location.getLat());
121   - speeding.setLine(Integer.valueOf(rs.getObject("line").toString()));
  110 + speeding.setId(rs.getInt("id"));
  111 + speeding.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString()));
  112 + speeding.setLine(rs.getInt("line"));
122 113 //run 时注解
123 114 speeding.setLineName(BasicData.lineCode2NameMap.get(speeding.getLine().toString()));
124   - speeding.setSpeed(Float.valueOf(rs.getObject("speed").toString()));
125   - speeding.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString())));
  115 + speeding.setLineId(BasicData.lineId2CodeMap.inverse().get(speeding.getLine().toString()));
  116 + speeding.setUpDown(rs.getInt("up_down"));
  117 + //将gps的经纬度转成百度的经纬度
  118 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("startLon"), rs.getFloat("startLat"))));
  119 + speeding.setLon((float)location.getLng());
  120 + speeding.setLat((float)location.getLat());
  121 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("endLon"), rs.getFloat("endLat"))));
  122 + speeding.setEndlon((float)location.getLng());
  123 + speeding.setEndlat((float)location.getLat());
  124 + speeding.setTimestamp((Long.valueOf(rs.getObject("startTimestamp").toString())));
126 125 speeding.setTimestampDate(sdf.format(new Date(speeding.getTimestamp())));
127   - speeding.setUpDown(Integer.valueOf(rs.getObject("up_down").toString()));
128   - speeding.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString()));
  126 + speeding.setEndtimestamp((Long.valueOf(rs.getObject("endTimestamp").toString())));
  127 + speeding.setEndtimestampDate(sdf.format(new Date(speeding.getEndtimestamp())));
129 128 list.add(speeding);
130 129 }
131 130 return list;
... ... @@ -133,52 +132,49 @@ public class SpeedingServiceImpl implements SpeedingService {
133 132  
134 133 @Override
135 134 public PageObject<Speeding> Pagequery(Map<String, Object> map) {
136   -/* String sql="select count(*) record from bsth_c_speeding where 1=1 ";
  135 + String sql="select count(*) record from bsth_c_speedingmh where 1=1 ";
  136 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
137 137 Object line=map.get("line");
138   - Object nbbm=map.get("nbbm");
139 138 Object updown=map.get("updown");
140 139 Object startDate=map.get("startDate");
141 140 Object endDate=map.get("endDate");
  141 + Object times=map.get("times");
142 142  
143 143 if(line!=null){
144 144 sql +=" and line like'%"+line.toString().trim()+"%'";
145 145 }
146   -
147   - if(nbbm!=null){
148   - nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
149   - if(nbbm!=null)
150   - sql +=" and vehicle like '%"+nbbm.toString()+"%'";
151   - }
152 146 if(updown!=null){
153 147 sql +="and up_down like '%"+updown.toString()+"%'";
154 148 }
155 149 if(startDate!=null){
156 150 if (startDate.toString().length()>0) {
157 151 try {
158   - Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
159   - sql += " and timestamp >="+t1;
  152 + Long t1 = sdf.parse(startDate.toString()+" 00:00:00").getTime();
  153 + sql += " and startTimestamp >="+t1;
160 154 } catch (ParseException e) {
161 155 e.printStackTrace();
162 156 }
163 157 }
164   -
165 158 }
166 159 if(endDate!=null){
167 160 if (endDate.toString().length()>0) {
168 161 try {
169 162 Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
170   - sql += " and timestamp <="+t2;
  163 + sql += " and endTimestamp <="+t2;
171 164 } catch (ParseException e) {
172 165 e.printStackTrace();
173 166 }
174 167 }
175   -
176 168 }
  169 +
  170 + if(times!=null && times.toString().length()>0){
  171 + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000;
  172 + }
  173 +
177 174 Connection conn = null;
178 175 PreparedStatement ps = null;
179 176 ResultSet rs = null;
180 177 int totalData = 0;
181   -
182 178 try {
183 179 conn = DBUtils_MS.getConnection();
184 180 ps = conn.prepareStatement(sql);
... ... @@ -190,93 +186,14 @@ public class SpeedingServiceImpl implements SpeedingService {
190 186 e.printStackTrace();
191 187 }finally {
192 188 DBUtils_MS.close(rs, ps, conn);
193   - }*/
194   -
195   - //时间转换
196   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
197   - List<Speeding> list=findAll(map);
198   - List<Speeding> listResult = new ArrayList<Speeding>();
199   - int curPage;//页码
200   - int pageData;//每页的记录条数
201   - int start;//起始数据下标
202   - int totalPage;//总页数
203   - int totalData = 0;
204   - if(list.size()>1){
205   - Speeding speedingNow;//下标为i的车辆行驶记录
206   - Speeding speedingLast;//下标为i-1的车辆行驶记录
207   - Speeding spped = null;//整合后的车辆行驶记录
208   - String strNow;
209   - String strLast;
210   - boolean Flag = false;//判断是否有连续超速记录,默认没有
211   - for(int i = 1;i<list.size();i++){
212   - speedingNow = list.get(i);
213   - speedingLast = list.get(i-1);
214   - strNow = speedingNow.getVehicle()+speedingNow.getLine()+speedingNow.getUpDown();
215   - strLast = speedingLast.getVehicle()+speedingLast.getLine()+speedingLast.getUpDown();
216   - if(speedingNow.getSpeed()>60 && speedingLast.getSpeed()>60 && strNow.equals(strLast)){//如果两条连续的记录都是超速且属于同一辆车。
217   - if(Flag==false){//
218   - spped = new Speeding();
219   - spped.setId(speedingLast.getId());//设置连续超速记录Id
220   - spped.setLine(speedingLast.getLine());//设置连续超速记录线路
221   - spped.setLineName(speedingLast.getLineName());//设置连续超速记录线路名称
222   - spped.setVehicle(speedingLast.getVehicle());//设置连续超速记录的车辆编号
223   - spped.setUpDown(speedingLast.getUpDown());//设置上下行
224   - spped.setLon(speedingLast.getLon());//设置开始时经度
225   - spped.setLat(speedingLast.getLat());//设置开始时纬度
226   - spped.setTimestamp(speedingLast.getTimestamp());//设置连续超速记录的开始时间
227   - spped.setTimestampDate(speedingLast.getTimestampDate());//设置连续超速记录的开始时间戳
228   - }
229   - spped.setEndtimestamp(speedingNow.getTimestamp());//设置结束时间戳
230   - spped.setEndtimestampDate(sdf.format(new Date(speedingNow.getTimestamp())));//设置结束时间
231   - spped.setEndlon(speedingNow.getLon());//设置结束时的经度
232   - spped.setEndlat(speedingNow.getLat());//设置结束时的纬度
233   - Flag = true;
234   - }else{
235   - if(Flag){//如果上一条记录超速。
236   - listResult.add(spped);
237   - Flag = false;
238   - }
239   - }
240   - }
241   - Iterator<Speeding> speedIt = listResult.iterator();
242   - while(speedIt.hasNext()){
243   - Speeding speeding = speedIt.next();
244   - if(speeding.getEndtimestamp()-speeding.getTimestamp()<=1000){
245   - speedIt.remove();
246   - }
247   - }
248   -
249   - totalData = listResult.size();//总记录条数。
250   - if(map.get("curPage") == null || map.get("curPage").equals("0")){
251   - curPage = 0;
252   - }else{
253   - curPage = Integer.parseInt((String) map.get("curPage"));
254   - }
255   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
256   - start = (curPage - 0) * pageData; //起始记录下标。
257   - totalPage = totalData % pageData == 0 ? totalData / pageData : totalData / pageData +1;//总页数
258   - if(curPage == totalPage-1){//如果当前页等于总页数。
259   - listResult = listResult.subList(start, totalData);
260   - }else{
261   - listResult = listResult.subList(start, start+pageData);
262   - }
263   - }else{
264   - curPage = 1;
265   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
266   - totalPage =1;
267 189 }
268   - Map<String,Object> paramMap = new HashMap<String,Object>();
269   - paramMap.put("totalPage", totalPage);
270   - paramMap.put("curPage", curPage);
271   - paramMap.put("pageData", pageData);
272   - PageHelper pageHelper = new PageHelper(totalData, paramMap);
273   - pageHelper.getMap();
  190 + PageHelper pageHelper = new PageHelper(totalData, map);
  191 + List<Speeding> list=findAll(pageHelper.getMap());
274 192 PageObject<Speeding> pageObject = pageHelper.getPageObject();
275   - pageObject.setDataList(listResult);
  193 + pageObject.setDataList(list);
276 194 return pageObject;
277 195 }
278 196  
279   -
280 197 @Override
281 198 public Map<String, Object> getReport(Map<String, Object> map) {
282 199 String chartStr = "";
... ... @@ -393,5 +310,46 @@ public class SpeedingServiceImpl implements SpeedingService {
393 310 }
394 311  
395 312  
  313 + @Override
  314 + public List<Speeding> findPosition(String deviceid, String startdate,
  315 + String enddate){
  316 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  317 + String sql = "select id,vehicle,line,up_down,lon,lat,speed,timestamp from bsth_c_speeding where vehicle = ? and timestamp >= ? and timestamp <= ? order by timestamp ";
  318 + Connection conn = null;
  319 + PreparedStatement ps = null;
  320 + ResultSet rs = null;
  321 + List<Speeding> listResult = new ArrayList<Speeding>();
  322 + Speeding speed = null;
  323 + try {
  324 + conn = DBUtils_MS.getConnection();
  325 + ps = conn.prepareStatement(sql);
  326 + long startTime = sdf.parse(startdate).getTime();
  327 + long endTime = sdf.parse(enddate).getTime();
  328 + ps.setString(1, deviceid);
  329 + ps.setLong(2,startTime);
  330 + ps.setLong(3,endTime);
  331 + rs = ps.executeQuery();
  332 + Location location;
  333 + while (rs.next()) {
  334 + speed = new Speeding();
  335 + speed.setVehicle(rs.getString("vehicle"));
  336 + location = TransGPS.LocationMake(rs.getFloat("lon"), rs.getFloat("lat"));
  337 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
  338 + speed.setLon((float)location.getLng());
  339 + speed.setLat((float)location.getLat());
  340 + speed.setSpeed(rs.getFloat("speed"));
  341 + speed.setTimestamp(rs.getLong("timestamp"));
  342 + // 上下行
  343 + listResult.add(speed);
  344 + }
  345 + } catch (Exception e) {
  346 + e.printStackTrace();
  347 + } finally {
  348 + DBUtils_MS.close(rs, ps, conn);
  349 + }
  350 + return listResult;
  351 +
  352 + }
  353 +
396 354  
397 355 }
... ...
src/main/java/com/bsth/service/gps/GpsService.java
... ... @@ -47,5 +47,5 @@ public interface GpsService {
47 47 List<GpsSpeed> findPosition(String deviceid, String startdate,
48 48 String enddate) throws ParseException;
49 49  
50   - PageObject<GpsSpeed> Pagequery(Map<String, Object> map);
  50 + Map<String, Object> Pagequery(Map<String, Object> map);
51 51 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -1053,16 +1053,19 @@ public class GpsServiceImpl implements GpsService {
1053 1053 }
1054 1054  
1055 1055 @Override
1056   - public PageObject<GpsSpeed> Pagequery(Map<String, Object> map) {
1057   -
  1056 + public Map<String, Object> Pagequery(Map<String, Object> map) {
1058 1057 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1058 + Integer totalDays = 0;//数据跨越天数
  1059 + try {
  1060 + totalDays = (int) ((sdf.parse(map.get("endDate").toString()+" 23:59:59").getTime()-sdf.parse(map.get("startDate").toString()+" 00:00:00").getTime()+1)/(3600*24*1000))+1;
  1061 + } catch (ParseException e) {
  1062 + e.printStackTrace();
  1063 + }//总页数
  1064 + map.put("totalDays",totalDays);
1059 1065 List<GpsSpeed> list=findAll(map);
1060 1066 List<GpsSpeed> listResult = new ArrayList<GpsSpeed>();
1061   - int curPage;//页码
1062   - int pageData;//每页的记录条数
1063   - int start;//起始数据下标
1064   - int totalPage;//总页数
1065   - int totalData = 0;
  1067 + int curPage = 0;//页码
  1068 + int pageData = 0;//每页的记录条数
1066 1069 if(list.size()>1){
1067 1070 GpsSpeed GpsSpeedNow;//下标为i的车辆行驶记录
1068 1071 GpsSpeed GpsSpeedLast;//下标为i-1的车辆行驶记录
... ... @@ -1099,49 +1102,35 @@ public class GpsServiceImpl implements GpsService {
1099 1102 }
1100 1103 }
1101 1104 }
1102   - Iterator<GpsSpeed> speedIt = listResult.iterator();
1103   - while(speedIt.hasNext()){
1104   - GpsSpeed GpsSpeed = speedIt.next();
1105   - if(GpsSpeed.getEndtimestamp()-GpsSpeed.getTimestamp()<=1000){
1106   - speedIt.remove();
1107   - }
1108   - }
1109   -
1110   - totalData = listResult.size();//总记录条数。
1111   - if(map.get("curPage") == null || map.get("curPage").equals("0")){
1112   - curPage = 0;
1113   - }else{
1114   - curPage = Integer.parseInt((String) map.get("curPage"));
1115   - }
1116   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
1117   - start = (curPage - 0) * pageData; //起始记录下标。
1118   - totalPage = totalData % pageData == 0 ? totalData / pageData : totalData / pageData +1;//总页数
1119   - if(curPage == totalPage-1){//如果当前页等于总页数。
1120   - listResult = listResult.subList(start, totalData);
1121   - }else{
1122   - listResult = listResult.subList(start, start+pageData);
  1105 + if(listResult.size()>0){
  1106 + Iterator<GpsSpeed> speedIt = listResult.iterator();
  1107 + while(speedIt.hasNext()){
  1108 + GpsSpeed GpsSpeed = speedIt.next();
  1109 + if(GpsSpeed.getEndtimestamp()-GpsSpeed.getTimestamp()<=1000){
  1110 + speedIt.remove();
  1111 + }
  1112 + }
1123 1113 }
1124   - }else{
1125   - curPage = 1;
1126   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
1127   - totalPage =1;
1128 1114 }
  1115 + if(map.get("curPage") == null || map.get("curPage").equals("0")){
  1116 + curPage = 0;
  1117 + }else{
  1118 + curPage = Integer.parseInt((String) map.get("curPage"));
  1119 + }
  1120 + Integer totalPage = totalDays;
  1121 + pageData = listResult.size();//每页的记录条数就是当前页查出的全部数据。
1129 1122 Map<String,Object> paramMap = new HashMap<String,Object>();
1130 1123 paramMap.put("totalPage", totalPage);
1131   - paramMap.put("curPage", curPage);
  1124 + paramMap.put("page", curPage);
1132 1125 paramMap.put("pageData", pageData);
1133   - PageHelper pageHelper = new PageHelper(totalData, paramMap);
1134   - pageHelper.getMap();
1135   - PageObject<GpsSpeed> pageObject = pageHelper.getPageObject();
1136   - pageObject.setDataList(listResult);
1137   - return pageObject;
  1126 + paramMap.put("list", listResult);
  1127 + return paramMap;
1138 1128 }
1139 1129  
1140 1130 static List<GpsSpeed> findAll(Map<String, Object> map) {
1141 1131 Connection conn = null;
1142 1132 PreparedStatement ps = null;
1143 1133 ResultSet rs = null;
1144   - int page=Integer.parseInt(map.get("page").toString());
1145 1134 List<GpsSpeed> list=new ArrayList<GpsSpeed>();
1146 1135 String sql="select * from bsth_c_gps_info where 1=1 ";
1147 1136 Object line=map.get("line");
... ... @@ -1149,6 +1138,13 @@ public class GpsServiceImpl implements GpsService {
1149 1138 Object updown=map.get("updown");
1150 1139 Object startDate=map.get("startDate");
1151 1140 Object endDate=map.get("endDate");
  1141 + Integer totalDays = Integer.valueOf(map.get("totalDays").toString());
  1142 + Integer curPage = 0;//页码
  1143 + if(map.get("curPage") == null || map.get("curPage").equals("0")){
  1144 + curPage = 0;
  1145 + }else{
  1146 + curPage = Integer.parseInt((String) map.get("curPage"));
  1147 + }
1152 1148  
1153 1149 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1154 1150 if(line!=null){
... ... @@ -1167,7 +1163,7 @@ public class GpsServiceImpl implements GpsService {
1167 1163 if(startDate!=null){
1168 1164 if (startDate.toString().length()>0) {
1169 1165 try {
1170   - Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
  1166 + Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime()+curPage*3600*24*1000;
1171 1167 sql += " and ts >="+t1;
1172 1168 } catch (ParseException e) {
1173 1169 e.printStackTrace();
... ... @@ -1178,7 +1174,7 @@ public class GpsServiceImpl implements GpsService {
1178 1174 if(endDate!=null){
1179 1175 if (endDate.toString().length()>0) {
1180 1176 try {
1181   - Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
  1177 + Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime()-(totalDays-1-curPage)*3600*24*1000;
1182 1178 sql += " and ts <="+t2;
1183 1179 } catch (ParseException e) {
1184 1180 e.printStackTrace();
... ...
src/main/resources/static/pages/excep/boundList.html
... ... @@ -262,8 +262,8 @@ $(function(){
262 262 }
263 263 }
264 264 });
265   - page = num - 1;
266   - jsDoQuery(params, false);
  265 + page = num - 1;
  266 + jsDoQuery(params, false);
267 267 }
268 268 });
269 269 }
... ...
src/main/resources/static/pages/excep/js/speeding-map.js
... ... @@ -3,33 +3,23 @@
3 3 *
4 4 * - - - - - -》init:地图初始化
5 5 *
6   - * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据
7   - *
8 6 * - - - - - -》getDistanceAndDuration:获取距离与时间
9 7 *
10   - * - - - - - -》pointsPolygon:地图画多边行
11   - *
12   - * - - - - - -》pointsCircle:画圆
13   - *
14   - * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标
15   - *
16 8 * - - - - - -》drawingUpline:在地图上画出上行线路走向
17 9 *
18   - * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)
19   - *
20   - * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)
21   - *
22   - * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)
  10 + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划)
23 11 */
24 12  
25 13 var SpeedingMap = function () {
26 14  
27   - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 *//*
28   - var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false;*/
  15 + /** SpeedingMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数;
  16 + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/
  17 + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false;
29 18  
30 19 var Bmap = {
31 20  
32 21 init : function() {
  22 +
33 23 // 设置中心点,
34 24 var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
35 25  
... ... @@ -40,7 +30,7 @@ var SpeedingMap = function () {
40 30 mapBValue = new BMap.Map("speedingMap");
41 31  
42 32 //中心点和缩放级别
43   - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
  33 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15);
44 34  
45 35 //启用地图拖拽事件,默认启用(可不写)
46 36 mapBValue.enableDragging();
... ... @@ -56,7 +46,10 @@ var SpeedingMap = function () {
56 46  
57 47 return mapBValue;
58 48 },
59   -
  49 + /** 获取第一个切路段的点 @return Point*/
  50 + getFirstPoint : function() {
  51 + return firstPoint;
  52 + },
60 53 /** 获取地图对象 @return 地图对象map */
61 54 getmapBValue : function() {
62 55  
... ... @@ -64,10 +57,337 @@ var SpeedingMap = function () {
64 57  
65 58 },
66 59  
67   - /* drawTravelRoute:function(data){
68   - var driving = Bmap.DrivingRoute(map, {renderOptions:{map: map}})
  60 + getPolyUpline : function() {
  61 +
  62 + return polyUpline;
  63 + },
  64 +
  65 + /** 获取截取过的路段 @return 路段对象List */
  66 + getSectionList : function() {
  67 +
  68 + return sectionList;
  69 +
  70 + },
  71 + setSectionList : function(list) {
  72 +
  73 + sectionList = list;
  74 + },
  75 + initCutSectionPoint : function() {
  76 + sectionList = [];
  77 + var tbodyHtml = template('section_list',{list : sectionList});
  78 + $('#section_table tbody').html(tbodyHtml);
  79 + },
  80 + /** 获取切路段的点下标 @return int*/
  81 + setPointIndex : function(index) {
  82 + pointIndex = index;
  83 + },
  84 + getPointIndex : function() {
  85 +
  86 + return pointIndex;
  87 +
  88 + },
  89 + /** 获取路段是否在编辑状态 @return boolean*/
  90 + getIsEditStatus : function() {
  91 + return iseditStatus;
  92 + },
  93 + setIsEditStatus : function(v) {
  94 + iseditStatus = v ;
  95 + },
  96 +
  97 + /** 获取路段是否在截取状态 @return boolean*/
  98 + getIsCutSection : function() {
  99 + return isCutSection;
  100 + },
  101 + setIsCutSection : function(v) {
  102 + isCutSection = v ;
  103 + },
  104 +
  105 + /** 获取距离与时间 @param <points:坐标点集合> */
  106 + getDistanceAndDuration : function(points,callback){
  107 +
  108 + // 获取长度
  109 + var len = points.length;
  110 + (function(){
  111 +
  112 + if (!arguments.callee.count) {
  113 +
  114 + arguments.callee.count = 0;
  115 +
  116 + }
  117 +
  118 + arguments.callee.count++;
  119 +
  120 + var index = parseInt(arguments.callee.count) - 1;
  121 +
  122 + if (index >= len-1) {
  123 +
  124 + callback && callback(points);
  125 +
  126 + return;
  127 + }
  128 +
  129 + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。)
  130 + var f = arguments.callee;
  131 + // 起点坐标 <坐标格式:40.056878,116.30815>
  132 + var origin = points[index].potion.lat + ',' + points[index].potion.lng;
  133 +
  134 + // 终点坐标 <坐标格式:40.056878,116.30815>
  135 + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng;
  136 + var region = '上海';
  137 +
  138 + var origin_region = '上海';
  139 +
  140 + var destination_region = '上海';
  141 +
  142 + var output = 'json';
  143 +
  144 + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk';
  145 +
  146 + /**
  147 + * origin:起点名称或经纬度;
  148 + *
  149 + * destination:终点名称或经纬度;
  150 + *
  151 + * origin_region:起始点所在城市,驾车导航时必填。
  152 + *
  153 + * destination_region:终点所在城市,驾车导航时必填。
  154 + *
  155 + * output :表示输出类型,可设置为xml或json,默认为xml。
  156 + *
  157 + **/
  158 + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My};
  159 +
  160 + /** @description :未认证开发者默认配额为:2000次/天。 */
  161 + $.ajax({
  162 +
  163 + // 百度地图根据坐标获取两点之间的时间与距离
  164 + url: 'http://api.map.baidu.com/direction/v1?mode=transit',
  165 +
  166 + data: paramsB,
  167 +
  168 + dataType: 'jsonp',
  169 +
  170 + success: function(r){
  171 +
  172 + if(r) {
  173 +
  174 + if(r.message=='ok') {
  175 +
  176 + if(r.result.taxi==null) {
  177 +
  178 + // 获取距离(单位:米)
  179 + points[index+1].distance = 0;
  180 +
  181 + // 获取时间(单位:秒)
  182 + points[index+1].duration = 0;
  183 +
  184 + }else {
  185 +
  186 + // 获取距离(单位:米)
  187 + points[index+1].distance = r.result.taxi.distance;
  188 +
  189 + // 获取时间(单位:秒)
  190 + points[index+1].duration = r.result.taxi.duration;
  191 +
  192 + }
  193 +
  194 +
  195 + }
  196 +
  197 + }
  198 +
  199 + f();
  200 + }
  201 + });
  202 +
  203 + })();
  204 +
  205 + },
  206 + // 在地图上画出上行线路走向
  207 + drawingUpline01 : function (polylineArray,polyline_center,data) {
  208 + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId;
  209 + // 创建线路走向
  210 + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
  211 + polyUpline01.data = data;
  212 + // 把折线添加到地图上
  213 + mapBValue.addOverlay(polyUpline01);
  214 + var sectionPoint = [];
  215 + // 线路单击事件
  216 + polyUpline01.addEventListener('click',function(e) {
  217 + if(SpeedingMap.getIsEditStatus()) {
  218 + layer.msg('请先保存正在编辑的路段信息...');
  219 + return false;
  220 + }
  221 + if(SpeedingMap.getIsCutSection()) {
  222 + layer.msg('请先撤销所有切路段的点...');
  223 + return false;
  224 + }
  225 + polyUpline01.enableEditing();
  226 + SpeedingMap.setIsEditStatus(true);
  227 + });
  228 +
  229 + // 添加路段双击事件
  230 + polyUpline01.addEventListener("dblclick",function(e){
  231 + if(SpeedingMap.getIsCutSection()) {
  232 + layer.msg('请先撤销所有切路段的点...');
  233 + return false;
  234 + }
  235 + SpeedingMap.setIsEditStatus(false);
  236 + // 关闭
  237 + layer.closeAll();
  238 + polyUpline01.disableEditing();
  239 + EditSectionObj.setEitdSection(polyUpline01.data);
  240 + // 获取折线坐标集合
  241 + var editPloyLineArray = polyUpline01.getPath();
  242 + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
  243 + sectionList = [];
  244 + var tbodyHtml = template('section_list',{list : sectionList});
  245 + // 截取路段
  246 + $('#section_table tbody').html(tbodyHtml);
  247 + // 加载修改路段弹出层mobal页面
  248 + $.get('editsection.html', function(m){
  249 + $(pjaxContainer).append(m);
  250 + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [SpeedingMap,GetAjaxData,EditSectionObj,PublicFunctions]);
  251 + });
  252 + });
  253 +
  254 + // 路段右击事件
  255 + var editSection = function(e,ee,marker){
  256 + if(SpeedingMap.getIsEditStatus()) {
  257 + layer.msg('请先保存正在编辑的路段信息...');
  258 + return false;
  259 + }
  260 + var lng = e.lng;
  261 + var lat = e.lat;
  262 + var sectionName = null;
  263 + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点
  264 + marker.isFlag = true;
  265 + if(pointIndex == 0) {
  266 + sectionPoint[pointIndex] = {lng:lng , lat:lat};
  267 + layer.msg('进入切路段状态,请选择本路段的终点!');
  268 + mapBValue.addOverlay(marker);// 添加覆盖物
  269 + firstPoint = {lng:lng, lat:lat};
  270 + pointIndex++;
  271 + EditSectionObj.setEitdSection(polyUpline01.data);
  272 + // 获取折线坐标集合
  273 + var editPloyLineArray = polyUpline01.getPath();
  274 + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
  275 + } else if (pointIndex > 0) {
  276 + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){
  277 + pointList = [];
  278 + sectionPoint[pointIndex] = {lng:lng , lat:lat};
  279 + pointList[0] = sectionPoint[pointIndex-1];
  280 + pointList[1] = sectionPoint[pointIndex];
  281 + sectionList.push({name:sectionName, section:pointList});
  282 + layer.close(index);
  283 + layer.msg('路段截取成功,请选择下一个路段的终点');
  284 + mapBValue.addOverlay(marker);// 添加覆盖物
  285 + var tbodyHtml = template('section_list',{list : sectionList});
  286 + // 截取路段
  287 + $('#section_table tbody').html(tbodyHtml);
  288 + pointIndex++;
  289 + });
  290 + }
  291 + SpeedingMap.setIsCutSection(true);
  292 + }
  293 + var markerMenu=new BMap.ContextMenu();
  294 + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01)));
  295 + polyUpline01.addContextMenu(markerMenu);
  296 +
  297 +
  298 + var PanOptions_ ={noAnimation :true};
  299 + mapBValue.reset();
  300 + mapBValue.panTo(polyline_center,PanOptions_);
  301 + mapBValue.panBy(500,-510,PanOptions_);
  302 + mapBValue.setZoom(14);
  303 + },
  304 + // 删除点刷新cutSectionTable
  305 + refreshCutSectionTable : function() {
  306 + var tbodyHtml = template('section_list',{list : sectionList});
  307 + $('#section_table tbody').html(tbodyHtml);
  308 + },
  309 + // 删除点刷新覆盖物
  310 + deleteCutSectionPoint : function(point) {
  311 + var lng = point.lng;
  312 + var lat = point.lat;
  313 + var allOverlay = mapBValue.getOverlays();
  314 + // 删除最后一个点
  315 + for (var i = 0; i < allOverlay.length -1; i++){
  316 + if(allOverlay[i].isFlag) {
  317 + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){
  318 + mapBValue.removeOverlay(allOverlay[i]);
  319 + break;
  320 + }
  321 + }
  322 + }
  323 + },
  324 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  325 + drawingUpStationPoint : function(point_center,stationName,s) {
  326 +
  327 + // 自定义标注物图片
  328 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10));
  329 +
  330 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  331 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  332 + + '</div>'
  333 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>';
  334 +
  335 +
  336 + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{
  337 + "anchor" : new BMap.Size(-10,8),
  338 + "enableDragging" : true});
  339 +
  340 +
  341 + myRichMarker1.disableDragging();
  342 + mapBValue.addOverlay(myRichMarker1);
  343 +
  344 +
  345 + // 创建标注物
  346 + marker = new BMap.Marker(point_center,{icon : icon_target});
  347 +
  348 + // 允许覆盖物在map.clearOverlays方法中被清除。
  349 + marker.enableMassClear();
  350 +
  351 + mapBValue.addOverlay(marker);
  352 + },
  353 +
  354 + // 根据站点坐标匹配库中的公交站点(手动规划)
  355 + stationsPointsToLibraryPoint : function(arra,callback) {
  356 + // 获取长度
  357 + var len = arra.length;
  358 + var station = {};
  359 + var stationList = [];
  360 + (function(){
  361 + if (!arguments.callee.count) {
  362 + arguments.callee.count = 0;
  363 + }
  364 + arguments.callee.count++;
  365 + var index = parseInt(arguments.callee.count) - 1;
  366 + if (index >= len) {
  367 + callback && callback(stationList);
  368 + return ;
  369 + }
  370 + var f = arguments.callee;
  371 + station = arra[index];
  372 + if(arra[index].name!=''){
  373 +
  374 + $.get('/station/matchStation',station,function(resultStation) {
  375 + stationList.push({name:resultStation.name ,wgs:arra[index].wgs,potion:{lng:resultStation.potion_lng, lat:resultStation.potion_lat}, isHave:resultStation.isHave , id:resultStation.id});
  376 + f();
  377 + });
  378 + }else {
  379 + f();
  380 + }
  381 + })()
  382 + },
  383 + clearMarkAndOverlays : function() {
  384 +
  385 + // 清楚地图覆盖物
  386 + mapBValue.clearOverlays();
  387 +
  388 + mapBValue.removeOverlay();
69 389  
70   - }*/
  390 + }
71 391  
72 392 }
73 393  
... ...
src/main/resources/static/pages/excep/speedingList.html
... ... @@ -20,30 +20,6 @@
20 20 class="caption-subject font-dark sbold uppercase">超速异常数据表</span>
21 21 </div>
22 22 <div class="actions">
23   -<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> -->
24   - <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> -->
25   - <!-- <div class="btn-group">
26   - <a class="btn red btn-outline btn-circle" href="javascript:;"
27   - data-toggle="dropdown"> <i class="fa fa-share"></i> <span
28   - class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i>
29   - </a>
30   - <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
31   - <li><a href="javascript:;" data-action="0"
32   - class="tool-action"> <i class="fa fa-print"></i>打印
33   - </a></li>
34   - <li><a href="javascript:;" data-action="1"
35   - class="tool-action"> <i class="fa fa-copy"></i> 复制
36   - </a></li>
37   - <li><a href="javascript:;" data-action="3"
38   - class="tool-action"> <i class="fa fa-file-excel-o"></i>
39   - 导出Excel
40   - </a></li>
41   - <li class="divider"></li>
42   - <li><a href="javascript:;" data-action="5"
43   - class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
44   - </a></li>
45   - </ul>
46   - </div> -->
47 23 </div>
48 24 </div>
49 25 <div class="portlet-body">
... ... @@ -54,23 +30,22 @@
54 30 <thead>
55 31 <tr role="row" class="heading">
56 32 <th width="3%">#</th>
57   - <th width="8%">线路</th>
58   - <th width="10%">车辆自编号</th>
59   - <!-- <th width="100">工号/名字</th>
60   - <th width="11%">路牌名</th> -->
61   - <th width="10%">上下行</th>
62   - <th width="20%">超速时间</th>
63   - <th width="6%">持续时间</th>
64   - <th width="10%">查看轨迹</th>
65   - <th width="18%">操作</th>
  33 + <th width="4%">线路</th>
  34 + <th width="6%">车辆自编号</th>
  35 + <th width="8%">上下行</th>
  36 + <th width="10%">开始时间</th>
  37 + <th width="10%">结束时间</th>
  38 + <th width="8%">持续时间</th>
  39 + <th width="8%">查看轨迹</th>
  40 + <th width="6%">操作</th>
66 41 </tr>
67 42 <tr role="row" class="filter">
68 43 <td></td>
69 44 <td>
70   - <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  45 + <select class="form-control" name="line" id="line" style="width: 100px;"></select>
71 46 </td>
72 47 <td>
73   - <select class="form-control" name="nbbm" id="nbbm" style="width: 150px;"></select>
  48 + <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select>
74 49 </td>
75 50 <!-- <td>
76 51  
... ... @@ -78,18 +53,19 @@
78 53 <td>
79 54 </td> -->
80 55 <td>
81   - <select class="form-control form-filter " name="updown">
  56 + <select class="form-control form-filter " name="updown" style="width: 90px;">
82 57 <option value="">请选择...</option>
83 58 <option value="0">上行</option>
84 59 <option value="1">下行</option>
85 60 <option value="-1">无效</option>
86 61 </select>
87 62 </td>
88   - <td nowrap="nowrap">
89   - <input class="form-control" type="date" name="startDate" style="width: 180px;"/>
  63 + <td>
  64 + <input class="form-control" type="date" name="startDate" />
90 65 -
91   - <input class="form-control" type="date" name="endDate" style="width: 180px;"/>
92   -
  66 + <input class="form-control" type="date" name="endDate" />
  67 + </td>
  68 + <td>
93 69 </td>
94 70 <td>
95 71 </td>
... ... @@ -128,9 +104,9 @@
128 104 {{obj.vehicle}}
129 105 </td>
130 106 <td>
131   - {{if obj.upDown==0}}
  107 + {{if obj.up_down==0}}
132 108 上行
133   - {{else if obj.upDown==1}}
  109 + {{else if obj.up_down==1}}
134 110 下行
135 111 {{else}}
136 112 无效
... ... @@ -140,10 +116,18 @@
140 116 {{obj.timestampDate}}
141 117 </td>
142 118 <td>
143   - {{obj.durationTime}}秒
  119 + {{obj.endtimestampDate}}
144 120 </td>
145 121 <td>
146   -
  122 + {{(obj.endtimestamp-obj.timestamp)/1000}}秒
  123 + </td>
  124 + <td>
  125 + <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}"
  126 + data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}"
  127 + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}"
  128 + data-endlon="{{obj.endlon}}" data-endlat="{{obj.endlat}}" >
  129 + 查看轨迹
  130 + </a>
147 131 </td>
148 132 <td>
149 133  
... ... @@ -157,6 +141,8 @@
157 141 {{/if}}
158 142 </script>
159 143  
  144 +<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  145 +
160 146 <script>
161 147 $(function(){
162 148 var page = 0, initPagination;
... ... @@ -171,7 +157,6 @@ $(function(){
171 157  
172 158 var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。
173 159 var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。
174   -
175 160 var endDate = timeToData(endTime);
176 161 var startDate = timeToData(startTime);
177 162 //表单默认选择上周一到上周日的超速信息。
... ... @@ -180,15 +165,27 @@ $(function(){
180 165 var parameter = new Object();
181 166 parameter.endDate = $("input[name='endDate']")[0].value;
182 167 parameter.startDate = $("input[name='startDate']")[0].value;
183   - //jsDoQuery(parameter,true);
184   - jsDoQuery(null,true);
  168 +
  169 + //搜索线路
  170 + $.get('/basic/lineCode2Name',function(result){
  171 + var data=[];
  172 + data.push({id: " ", text: "全部线路"});
  173 + for(var code in result){
  174 + data.push({id: code, text: result[code]});
  175 + }
  176 + initPinYinSelect2($('#line'),data,function(ldmcSelector) {
  177 + ldmcSelector.select2("val",data[1].id);//因为数据量太大,所以默认一条线路作为查询参数
  178 + });
  179 + parameter.line = data[1].id;
  180 + jsDoQuery(parameter,true);
  181 + });
185 182  
186 183 //时间戳转换为年月日
187 184 function timeToData(time){
188 185 var date = new Date(time);
189 186 var year = date.getFullYear();
190 187 var Month = date.getMonth()+1>10?date.getMonth()+1:"0"+(date.getMonth()+1);
191   - var Day = date.getDate()>10?date.getDate():"0"+date.getDate();
  188 + var Day = date.getDate()>9?date.getDate():"0"+date.getDate();
192 189 return year+"-"+Month+"-"+Day;
193 190 }
194 191  
... ... @@ -219,7 +216,7 @@ $(function(){
219 216 /*
220 217 * 获取数据 p: 要提交的参数, pagination: 是否重新分页
221 218 */
222   - function jsDoQuery(p, pagination){
  219 + function jsDoQuery(p, pagination){
223 220 var params = {};
224 221 if(p)
225 222 params = p;
... ... @@ -227,20 +224,40 @@ $(function(){
227 224 params['order'] = 'lastLoginDate';
228 225 params['page'] = page;
229 226 var i = layer.load(2);
230   - $get('/speeding/pagequery' ,params, function(data){
231   -// $.each(data.content, function(i, obj) {
232   -// obj.lastLoginDate = moment(obj.lastLoginDate).format("YYYY-MM-DD HH:mm:ss");
233   -// });
234   - var bodyHtm = template('speeding_list_temp', {list: data.dataList});
  227 + $.get('/gps/pagequery' ,params, function(data){
  228 + var bodyHtm = template('speeding_list_temp', {list: data.list});
235 229 $('#datatable_speeding tbody').html(bodyHtm)
236 230 .find('.icheck').iCheck(icheckOptions)
237 231 .on('ifChanged', iCheckChange);
238   - if(pagination && data.dataList.length > 0){
  232 + if(pagination){
239 233 //重新分页
240 234 initPagination = true;
241 235 showPagination(data);
242 236 }
243 237 layer.close(i);
  238 + $(".lookTrajectory").click(function(){
  239 + var vehicle = $(this).data('vehicle');
  240 + var startDate = $(this).data('startdate');
  241 + var endDate = $(this).data('enddate');
  242 + var lon = $(this).data('lon');
  243 + var lat = $(this).data('lat');
  244 + var endLon = $(this).data('endlon');
  245 + var endLat = $(this).data('endlat');
  246 + var storage = window.localStorage;
  247 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat);
  248 + $.get('/pages/excep/speedingMap.html?',function (result) {
  249 + layer.open({
  250 + type: 1,
  251 + title:'<i class="uk-icon-play-circle"></i>轨迹回放',
  252 + shadeClose: true,
  253 + shade: true,
  254 + scrollbar: false,
  255 + maxmin: false, //开启最大化最小化按钮
  256 + area: ['100%', '100%'],
  257 + content:result,//内容
  258 + });
  259 + });
  260 + })
244 261 });
245 262 }
246 263  
... ... @@ -291,6 +308,7 @@ $(function(){
291 308 });
292 309 }
293 310  
  311 +
294 312 //删除
295 313 $('#removeButton').on('click', function(){
296 314 if($(this).attr('disabled'))
... ... @@ -302,17 +320,6 @@ $(function(){
302 320 $('tr.filter .filter-submit').click();
303 321 });
304 322 });
305   -
306   - //搜索线路
307   - $.get('/basic/lineCode2Name',function(result){
308   - var data=[];
309   - data.push({id: " ", text: "全部线路"});
310   - for(var code in result){
311   - data.push({id: code, text: result[code]});
312   - }
313   - initPinYinSelect2('#line',data,'');
314   -
315   - });
316 323  
317 324 $("#line").on("change",initXl);
318 325 function initXl(){
... ... @@ -329,6 +336,7 @@ $(&#39;#nbbm&#39;).select2({
329 336 xlbm:$('#line').val()};
330 337 },
331 338 processResults: function (data) {
  339 + console.log(data);
332 340 return {
333 341 results: data
334 342 };
... ... @@ -365,7 +373,6 @@ $(&#39;#nbbm&#39;).select2({
365 373  
366 374 //改变状态
367 375 function changeEnabled(id,enabled){
368   - debugger
369 376 $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){
370 377 jsDoQuery(null, true);
371 378 })
... ...
src/main/resources/static/pages/excep/speedingListmh.html
... ... @@ -20,30 +20,6 @@
20 20 class="caption-subject font-dark sbold uppercase">超速异常数据表</span>
21 21 </div>
22 22 <div class="actions">
23   -<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> -->
24   - <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> -->
25   - <!-- <div class="btn-group">
26   - <a class="btn red btn-outline btn-circle" href="javascript:;"
27   - data-toggle="dropdown"> <i class="fa fa-share"></i> <span
28   - class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i>
29   - </a>
30   - <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
31   - <li><a href="javascript:;" data-action="0"
32   - class="tool-action"> <i class="fa fa-print"></i>打印
33   - </a></li>
34   - <li><a href="javascript:;" data-action="1"
35   - class="tool-action"> <i class="fa fa-copy"></i> 复制
36   - </a></li>
37   - <li><a href="javascript:;" data-action="3"
38   - class="tool-action"> <i class="fa fa-file-excel-o"></i>
39   - 导出Excel
40   - </a></li>
41   - <li class="divider"></li>
42   - <li><a href="javascript:;" data-action="5"
43   - class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
44   - </a></li>
45   - </ul>
46   - </div> -->
47 23 </div>
48 24 </div>
49 25 <div class="portlet-body">
... ... @@ -83,15 +59,16 @@
83 59 <option value="1">下行</option>
84 60 <option value="-1">无效</option>
85 61 </select>
86   - </td>
  62 + </td>
87 63 <td>
88 64 <input class="form-control" type="date" name="startDate" />
89   - -
90   - <input class="form-control" type="date" name="endDate" />
91 65 </td>
92 66 <td>
  67 + <input class="form-control" type="date" name="endDate" />
93 68 </td>
94 69 <td>
  70 + >=<input class="form-control" type="text" name="times" style="width:50px;display:inline!important"
  71 + onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"/>
95 72 </td>
96 73 <td>
97 74 </td>
... ... @@ -128,9 +105,9 @@
128 105 {{obj.vehicle}}
129 106 </td>
130 107 <td>
131   - {{if obj.up_down==0}}
  108 + {{if obj.upDown==0}}
132 109 上行
133   - {{else if obj.up_down==1}}
  110 + {{else if obj.upDown==1}}
134 111 下行
135 112 {{else}}
136 113 无效
... ... @@ -148,9 +125,9 @@
148 125 <td>
149 126 <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}"
150 127 data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}"
151   - data-lon="{{obj.lon}}" data-lat="{{obj.lat}}"
152   - data-endlon="{{obj.endlon}}" data-endlat="{{obj.endlat}}" >
153   - 查看轨迹
  128 + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" data-endlon="{{obj.endlon}}"
  129 + data-endlat="{{obj.endlat}}" data-lineid="{{obj.lineId}}" data-updown="{{obj.upDown}}">
  130 + 查看轨迹
154 131 </a>
155 132 </td>
156 133 <td>
... ... @@ -181,7 +158,6 @@ $(function(){
181 158  
182 159 var endTime = dateTime-week*24*3600*1000;//上周末、格式为时间戳。
183 160 var startTime = endTime-6*24*3600*1000;//上周一、格式为时间戳。
184   - debugger;
185 161 var endDate = timeToData(endTime);
186 162 var startDate = timeToData(startTime);
187 163 //表单默认选择上周一到上周日的超速信息。
... ... @@ -190,7 +166,7 @@ $(function(){
190 166 var parameter = new Object();
191 167 parameter.endDate = $("input[name='endDate']")[0].value;
192 168 parameter.startDate = $("input[name='startDate']")[0].value;
193   -
  169 + jsDoQuery(parameter, true);
194 170 //搜索线路
195 171 $.get('/basic/lineCode2Name',function(result){
196 172 var data=[];
... ... @@ -198,11 +174,7 @@ $(function(){
198 174 for(var code in result){
199 175 data.push({id: code, text: result[code]});
200 176 }
201   - initPinYinSelect2($('#line'),data,function(ldmcSelector) {
202   - ldmcSelector.select2("val",data[1].id);//因为数据量太大,所以默认一条线路作为查询参数
203   - });
204   - parameter.line = data[1].id;
205   - jsDoQuery(parameter,true);
  177 + initPinYinSelect2('#line',data,'');
206 178 });
207 179  
208 180 //时间戳转换为年月日
... ... @@ -249,7 +221,7 @@ $(function(){
249 221 params['order'] = 'lastLoginDate';
250 222 params['page'] = page;
251 223 var i = layer.load(2);
252   - $get('/gps/pagequery' ,params, function(data){
  224 + $get('/speeding/pagequery' ,params, function(data){
253 225 var bodyHtm = template('speeding_list_temp', {list: data.dataList});
254 226 $('#datatable_speeding tbody').html(bodyHtm)
255 227 .find('.icheck').iCheck(icheckOptions)
... ... @@ -268,8 +240,10 @@ $(function(){
268 240 var lat = $(this).data('lat');
269 241 var endLon = $(this).data('endlon');
270 242 var endLat = $(this).data('endlat');
  243 + var lineid = $(this).data('lineid');
  244 + var upDown = $(this).data('updown');
271 245 var storage = window.localStorage;
272   - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat);
  246 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);
273 247 $.get('/pages/excep/speedingMap.html?',function (result) {
274 248 layer.open({
275 249 type: 1,
... ... @@ -315,25 +289,24 @@ $(function(){
315 289 initPagination = false;
316 290 return;
317 291 }
318   - page = num - 1;
319 292 var cells = $('tr.filter')[0].cells
320 293 ,params = {}
321 294 ,name;
322   - $.each(cells, function(i, cell){
323   - var items = $('input,select', cell);
324   - for(var j = 0, item; item = items[j++];){
325   - name = $(item).attr('name');
326   - if(name){
327   - params[name] = $(item).val();
328   - }
  295 + $.each(cells, function(i, cell){
  296 + var items = $('input,select', cell);
  297 + for(var j = 0, item; item = items[j++];){
  298 + name = $(item).attr('name');
  299 + if(name){
  300 + params[name] = $(item).val();
329 301 }
330   - });
331   - jsDoQuery(params, false);
  302 + }
  303 + });
  304 + page = num - 1;
  305 + jsDoQuery(params, false);
332 306 }
333 307 });
334 308 }
335 309  
336   -
337 310 //删除
338 311 $('#removeButton').on('click', function(){
339 312 if($(this).attr('disabled'))
... ... @@ -361,7 +334,6 @@ $(&#39;#nbbm&#39;).select2({
361 334 xlbm:$('#line').val()};
362 335 },
363 336 processResults: function (data) {
364   - console.log(data);
365 337 return {
366 338 results: data
367 339 };
... ...
src/main/resources/static/pages/excep/speedingMap.html
... ... @@ -20,6 +20,8 @@
20 20 }
21 21 </style>
22 22 <script type="text/javascript" src="/pages/excep/js/speeding-map.js"></script>
  23 +<script type="text/javascript" src="/pages/excep/js/line-list-function.js"></script>
  24 +
23 25 <script type="text/javascript">
24 26 $(function(){
25 27 var dataArr = window.localStorage.zbhAndDate.split(",");//获取页面传递过来的车辆自编号以及超速起始时间和超速结束时间
... ... @@ -30,13 +32,15 @@ $(function(){
30 32 var lat = dataArr[4];//起点纬度
31 33 var endLon = dataArr[5];//终点经度
32 34 var endLat = dataArr[6];//终点纬度
  35 + var lineid = dataArr[7];
  36 + var directionData = dataArr[8];
33 37 var pointObj;//坐标和速度组成的对象
34 38 var Points = [];//坐标和速度对象的集合
35 39 var coordinateArr = [];//坐标点数组
36 40 $.ajax({
37 41 type: "GET",
38 42 async:false,
39   - url: '/gps/findPosition',
  43 + url: '/speeding/findPosition',
40 44 data: {vehicle:vehicle,startdate:startdate,enddate:enddate},
41 45 success: function(data){
42 46 $.each(data,function(i,item){
... ... @@ -44,6 +48,7 @@ $(function(){
44 48 pointObj = new Object();
45 49 pointObj.coordinate = new BMap.Point(item.lon,item.lat);
46 50 pointObj.speed = item.speed;
  51 + pointObj.vehicle = item.vehicle;
47 52 Points.push(pointObj);
48 53 }
49 54 });
... ... @@ -51,38 +56,44 @@ $(function(){
51 56 });
52 57 setTimeout(function(){
53 58 var map = SpeedingMap.init();//创建地图
  59 + $get('/sectionroute/findSection',{'line.id_eq' : lineid , 'directions_eq' :directionData},function(data) {
  60 + // 在地图上画出线路走向
  61 + PublicFunctions.linePanlThree(lineid,data,directionData);
  62 + });
54 63 var myP1 = new BMap.Point(lon,lat); //起点
55 64 var myP2 = new BMap.Point(endLon,endLat); //终点
56   - var centerLon = (parseFloat(lon)+parseFloat(endLon))/2;
  65 +/* var centerLon = (parseFloat(lon)+parseFloat(endLon))/2;
57 66 var centerLat = (parseFloat(lat)+parseFloat(endLat))/2;
58   - map.centerAndZoom(new BMap.Point(centerLon,centerLat),18);//地图中心点坐标
59   -
  67 + map.centerAndZoom(new BMap.Point(centerLon,centerLat),18);//地图中心点坐标 */
60 68 for(i in Points){
61 69 coordinateArr.push(Points[i].coordinate);
62 70 }
63   - var polyline = new BMap.Polyline(coordinateArr, {strokeColor:"blue", strokeWeight:5, strokeOpacity:0.5});//创建折线
  71 + var polyline = new BMap.Polyline(coordinateArr, {strokeColor:"red", strokeWeight:5, strokeOpacity:0.5});//创建折线
64 72 var myIcon = new BMap.Icon("/pages/excep/img/bus.png", new BMap.Size(32, 70), {//小车图片
65 73 imageOffset: new BMap.Size(5,20) //图片的偏移量。为了是图片底部中心对准坐标点。
66 74 });
67 75  
  76 + var carMk;
68 77 $(document).on('click', '#run', function() {
69   - map.clearOverlays();//清空上一次的轨迹
  78 + map.centerAndZoom(new BMap.Point(lon,lat),16);//地图中心点坐标 */
  79 + if(typeof(carMk)!="undefined"){
  80 + map.removeOverlay(carMk);//清空上一次的轨迹
  81 + }
  82 + carMk = new BMap.Marker(coordinateArr[0],{icon:myIcon});
70 83 map.addOverlay(polyline);//增加折线
71 84 var paths = coordinateArr.length;//获得有几个点
72   - var carMk = new BMap.Marker(coordinateArr[0],{icon:myIcon});
73 85 map.addOverlay(carMk);
74   - var sContent ="车辆即时速度:"+Points[0].speed;
  86 + var sContent ="车辆编号:"+Points[0].vehicle+"</br>车辆速度:"+Points[0].speed+"km/h";
75 87 var infoWindow = new BMap.InfoWindow(sContent);// 创建信息窗口对象
76 88 map.openInfoWindow(infoWindow,coordinateArr[0]); //开启信息窗口
77 89 i=0;
78   -
79 90 setTimeout(function(){
80 91 resetMkPoint(0);
81 92 },500);
82 93  
83 94 function resetMkPoint(i){
84 95 carMk.setPosition(coordinateArr[i]);
85   - sContent ="车辆即时速度是:"+Points[i].speed;
  96 + sContent ="车辆编号:"+Points[i].vehicle+"</br>车辆速度:"+Points[i].speed+"km/h";
86 97 infoWindow = new BMap.InfoWindow(sContent);// 创建信息窗口对象
87 98 map.openInfoWindow(infoWindow,coordinateArr[i]); //开启信息窗口
88 99 if(i < paths-1){
... ... @@ -91,9 +102,10 @@ $(function(){
91 102 resetMkPoint(i);
92 103 },500);
93 104 }
94   - };
  105 + };
  106 +
95 107 });
96   -}, 500);
  108 + }, 500);
97 109 });
98 110 </script>
99 111  
... ...