Commit a16a24782c3f30f5a8ad6011d4f432428934d3de

Authored by 廖磊
2 parents f646656c 31632d32

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

Too many changes to show.

To preserve performance only 5 of 32 files are displayed.

src/main/java/com/bsth/data/gpsdata/GpsEntity.java
... ... @@ -315,7 +315,7 @@ public class GpsEntity {
315 315 this.setAbnormalStatus("offline");
316 316 }
317 317  
318   - public boolean isOnline(){
  318 +/* public boolean isOnline(){
319 319 if(isOffline())
320 320 return false;
321 321  
... ... @@ -329,7 +329,7 @@ public class GpsEntity {
329 329 return false;
330 330 }
331 331 return true;
332   - }
  332 + }*/
333 333  
334 334 /**
335 335 * 是否营运
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
... ... @@ -144,29 +144,17 @@ public class GeoCacheData {
144 144 }
145 145  
146 146 private void loadRoadsData() {
  147 + //加载线路下路段空间数据
147 148 String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS, s.CROSES_ROAD from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.destroy=0 and GSECTION_VECTOR is not null order by line_code,directions,sectionroute_code";
148 149 List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql);
149 150  
150 151 String polygonStr, key;
151 152 String[] coords;
152 153 int i, len;
153   -
154 154 ArrayListMultimap<String, LineString> sectionCacheTempMap = ArrayListMultimap.create();
155   - Map<String, String> sectionCode2NameTemp = new HashMap<>();
156   -
157 155 Coordinate[] cds;
158 156 String[] temps1, temps2;
159   - String name = null, code;
160 157 for (Map<String, Object> tMap : secList) {
161   - //编码和名称对照
162   - if(tMap.get("CROSES_ROAD") != null && StringUtils.isNotEmpty(tMap.get("CROSES_ROAD").toString()))
163   - name = tMap.get("CROSES_ROAD").toString();
164   - else if(tMap.get("SECTION_NAME") != null && StringUtils.isNotEmpty(tMap.get("SECTION_NAME").toString()))
165   - name = tMap.get("SECTION_NAME").toString();
166   -
167   - code = tMap.get("SECTION_CODE").toString();
168   - sectionCode2NameTemp.put(code, name);
169   -
170 158 //空间数据映射
171 159 polygonStr = tMap.get("GSECTION_VECTOR").toString();
172 160 key = tMap.get("LINE_CODE") + "_" + tMap.get("DIRECTIONS");
... ... @@ -188,6 +176,22 @@ public class GeoCacheData {
188 176  
189 177 if(sectionCacheTempMap.size() > 0)
190 178 sectionCacheMap = sectionCacheTempMap;
  179 +
  180 + Map<String, String> sectionCode2NameTemp = new HashMap<>();
  181 +
  182 + //加载全量路段编码和名称对照
  183 + sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section";
  184 + secList = jdbcTemplate.queryForList(sql);
  185 + String name = null, code;
  186 + for (Map<String, Object> tMap : secList) {
  187 + if(tMap.get("CROSES_ROAD") != null && StringUtils.isNotEmpty(tMap.get("CROSES_ROAD").toString()))
  188 + name = tMap.get("CROSES_ROAD").toString();
  189 + else if(tMap.get("SECTION_NAME") != null && StringUtils.isNotEmpty(tMap.get("SECTION_NAME").toString()))
  190 + name = tMap.get("SECTION_NAME").toString();
  191 +
  192 + code = tMap.get("SECTION_CODE").toString();
  193 + sectionCode2NameTemp.put(code, name);
  194 + }
191 195 if(sectionCode2NameTemp.size() > 0)
192 196 sectionCode2Name = sectionCode2NameTemp;
193 197 }
... ...
src/main/java/com/bsth/entity/CarDevice.java
1 1 package com.bsth.entity;
2 2  
3 3 import com.bsth.entity.schedule.BEntity;
  4 +import org.hibernate.annotations.Formula;
4 5 import org.joda.time.DateTime;
5 6  
6 7 import javax.persistence.*;
... ... @@ -22,6 +23,16 @@ public class CarDevice extends BEntity {
22 23 @Column
23 24 private String gsName;
24 25  
  26 + /** 所属公司 varchar length(50) */
  27 + private String company;
  28 +
  29 + /** 分公司 varchar length(50)*/
  30 + private String brancheCompany;
  31 +
  32 + /** 组合公司分公司编码 */
  33 + @Formula(" concat(company, '_', branche_company) ")
  34 + private String cgsbm;
  35 +
25 36 /** 车辆id,关联bsth_c_cars */
26 37 @Column(nullable = false)
27 38 private Integer cl;
... ... @@ -203,4 +214,20 @@ public class CarDevice extends BEntity {
203 214 public void setIsCancel(Boolean isCancel) {
204 215 this.isCancel = isCancel;
205 216 }
  217 +
  218 + public String getCompany() {
  219 + return company;
  220 + }
  221 +
  222 + public void setCompany(String company) {
  223 + this.company = company;
  224 + }
  225 +
  226 + public String getBrancheCompany() {
  227 + return brancheCompany;
  228 + }
  229 +
  230 + public void setBrancheCompany(String brancheCompany) {
  231 + this.brancheCompany = brancheCompany;
  232 + }
206 233 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -821,7 +821,7 @@ public class GpsServiceImpl implements GpsService {
821 821 @Override
822 822 public List<GpsSpeed_DTO> speeds(String nbbm, long st, long et) {
823 823 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
824   - String sql = "select vehicle, line, up_down, lon, lat, speed,timestamp from bsth_c_GpsSpeed where vehicle=? and timestamp>? and timestamp<?";
  824 + String sql = "select vehicle, line, up_down, lon, lat, speed,timestamp from bsth_c_speeding where vehicle=? and timestamp>? and timestamp<?";
825 825  
826 826 return GpsSpeed_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st * 1000, et * 1000));
827 827 }
... ... @@ -999,20 +999,20 @@ public class GpsServiceImpl implements GpsService {
999 999 return true;
1000 1000 }
1001 1001  
1002   - @Override
1003   - public List<GpsSpeed> findPosition(String deviceid, String startdate,
1004   - String enddate) throws ParseException{
1005   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1006   - Calendar c = Calendar.getInstance();
1007   - Date date = sdf.parse(startdate);
1008   - c.setTime(date);
1009   - int daysYear = c.get(Calendar.DAY_OF_YEAR);//获取当前是今年的第几天。
1010   -
1011   - long startTime = sdf.parse(startdate).getTime();
1012   - long endTime = sdf.parse(enddate).getTime();
1013   -
  1002 + @Override
  1003 + public List<GpsSpeed> findPosition(String deviceid, String startdate,
  1004 + String enddate) throws ParseException{
  1005 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1006 + Calendar c = Calendar.getInstance();
  1007 + Date date = sdf.parse(startdate);
  1008 + c.setTime(date);
  1009 + int daysYear = c.get(Calendar.DAY_OF_YEAR);//获取当前是今年的第几天。
  1010 +
  1011 + long startTime = sdf.parse(startdate).getTime();
  1012 + long endTime = sdf.parse(enddate).getTime();
  1013 +
1014 1014 String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,speed_gps from bsth_c_gps_info where days_year=? and device_id=? and ts >= ? and ts <= ?" +
1015   - " ORDER BY TS ";
  1015 + " ORDER BY TS ";
1016 1016 Connection conn = null;
1017 1017 PreparedStatement ps = null;
1018 1018 ResultSet rs = null;
... ... @@ -1029,7 +1029,7 @@ public class GpsServiceImpl implements GpsService {
1029 1029 Float lon, lat;
1030 1030 Location location;
1031 1031 while (rs.next()) {
1032   - gpsSpeed = new GpsSpeed();
  1032 + gpsSpeed = new GpsSpeed();
1033 1033 // to 百度坐标
1034 1034 lon = rs.getFloat("LON");
1035 1035 lat = rs.getFloat("LAT");
... ... @@ -1049,184 +1049,184 @@ public class GpsServiceImpl implements GpsService {
1049 1049 DBUtils_MS.close(rs, ps, conn);
1050 1050 }
1051 1051 return listResult;
1052   -
1053   - }
1054   -
1055   - @Override
1056   - public PageObject<GpsSpeed> Pagequery(Map<String, Object> map) {
1057   -
1058   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1059   - List<GpsSpeed> list=findAll(map);
1060   - List<GpsSpeed> listResult = new ArrayList<GpsSpeed>();
1061   - int curPage;//页码
1062   - int pageData;//每页的记录条数
1063   - int start;//起始数据下标
1064   - int totalPage;//总页数
1065   - int totalData = 0;
1066   - if(list.size()>1){
1067   - GpsSpeed GpsSpeedNow;//下标为i的车辆行驶记录
1068   - GpsSpeed GpsSpeedLast;//下标为i-1的车辆行驶记录
1069   - GpsSpeed spped = null;//整合后的车辆行驶记录
1070   - String strNow;
1071   - String strLast;
1072   - boolean Flag = false;//判断是否有连续超速记录,默认没有
1073   - for(int i = 1;i<list.size();i++){
1074   - GpsSpeedNow = list.get(i);
1075   - GpsSpeedLast = list.get(i-1);
1076   - strNow = GpsSpeedNow.getVehicle()+GpsSpeedNow.getLine()+GpsSpeedNow.getUp_down();
1077   - strLast = GpsSpeedLast.getVehicle()+GpsSpeedLast.getLine()+GpsSpeedLast.getUp_down();
1078   - if(GpsSpeedNow.getSpeed()>60 && GpsSpeedLast.getSpeed()>60 && strNow.equals(strLast)){//如果两条连续的记录都是超速且属于同一辆车。
1079   - if(Flag==false){//
1080   - spped = new GpsSpeed();
1081   - spped.setLine(GpsSpeedLast.getLine());//设置连续超速记录线路
1082   - spped.setLineName(GpsSpeedLast.getLineName());//设置连续超速记录线路名称
1083   - spped.setVehicle(GpsSpeedLast.getVehicle());//设置连续超速记录的车辆编号
1084   - spped.setUp_down(GpsSpeedLast.getUp_down());//设置上下行
1085   - spped.setLon(GpsSpeedLast.getLon());//设置开始时经度
1086   - spped.setLat(GpsSpeedLast.getLat());//设置开始时纬度
1087   - spped.setTimestamp(GpsSpeedLast.getTimestamp());//设置连续超速记录的开始时间
1088   - spped.setTimestampDate(GpsSpeedLast.getTimestampDate());//设置连续超速记录的开始时间戳
1089   - }
1090   - spped.setEndtimestamp(GpsSpeedNow.getTimestamp());//设置结束时间戳
1091   - spped.setEndtimestampDate(sdf.format(new Date(GpsSpeedNow.getTimestamp())));//设置结束时间
1092   - spped.setEndlon(GpsSpeedNow.getLon());//设置结束时的经度
1093   - spped.setEndlat(GpsSpeedNow.getLat());//设置结束时的纬度
1094   - Flag = true;
1095   - }else{
1096   - if(Flag){//如果上一条记录超速。
1097   - listResult.add(spped);
1098   - Flag = false;
1099   - }
1100   - }
1101   - }
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);
1123   - }
1124   - }else{
1125   - curPage = 1;
1126   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
1127   - totalPage =1;
1128   - }
1129   - Map<String,Object> paramMap = new HashMap<String,Object>();
1130   - paramMap.put("totalPage", totalPage);
1131   - paramMap.put("curPage", curPage);
1132   - 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;
1138   - }
1139   -
1140   - static List<GpsSpeed> findAll(Map<String, Object> map) {
1141   - Connection conn = null;
1142   - PreparedStatement ps = null;
1143   - ResultSet rs = null;
1144   - int page=Integer.parseInt(map.get("page").toString());
1145   - List<GpsSpeed> list=new ArrayList<GpsSpeed>();
1146   - String sql="select * from bsth_c_gps_info where 1=1 ";
1147   - Object line=map.get("line");
1148   - Object nbbm=map.get("nbbm");
1149   - Object updown=map.get("updown");
1150   - Object startDate=map.get("startDate");
1151   - Object endDate=map.get("endDate");
1152   -
1153   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1154   - if(line!=null){
1155   - sql +=" and line_id like'%"+line.toString().trim()+"%'";
1156   - }
1157   -
1158   - if(nbbm!=null){
1159   - nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
1160   - if(nbbm!=null)
1161   - sql +=" and vehicle like '%"+nbbm.toString()+"%'";
1162   - }
1163   -
1164   - if(updown!=null){
1165   - sql +="and industry_code like '%"+updown.toString()+"%'";
1166   - }
1167   - if(startDate!=null){
1168   - if (startDate.toString().length()>0) {
1169   - try {
1170   - Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
1171   - sql += " and ts >="+t1;
1172   - } catch (ParseException e) {
1173   - e.printStackTrace();
1174   - }
1175   - }
1176   -
1177   - }
1178   - if(endDate!=null){
1179   - if (endDate.toString().length()>0) {
1180   - try {
1181   - Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
1182   - sql += " and ts <="+t2;
1183   - } catch (ParseException e) {
1184   - e.printStackTrace();
1185   - }
1186   - }
1187   -
1188   - }
1189   -
1190   - try {
1191   - conn = DBUtils_MS.getConnection();
1192   - ps = conn.prepareStatement(sql);
1193   - rs = ps.executeQuery();
1194   - list = resultSet2Set(rs);
1195   - } catch (SQLException e) {
1196   - e.printStackTrace();
1197   - }finally {
1198   - DBUtils_MS.close(rs, ps, conn);
1199   - }
1200   -
1201   - return list;
1202   - }
1203   -
1204   - static List<GpsSpeed> resultSet2Set(ResultSet rs) throws SQLException{
1205   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1206   - List<GpsSpeed> list=new ArrayList<GpsSpeed>();
1207   - GpsSpeed GpsSpeed;
1208   - Float lon, lat;
1209   - Location location;
1210   - while(rs.next()){
1211   - lon = rs.getFloat("lon");
1212   - lat = rs.getFloat("lat");
  1052 +
  1053 + }
  1054 +
  1055 + @Override
  1056 + public PageObject<GpsSpeed> Pagequery(Map<String, Object> map) {
  1057 +
  1058 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1059 + List<GpsSpeed> list=findAll(map);
  1060 + List<GpsSpeed> listResult = new ArrayList<GpsSpeed>();
  1061 + int curPage;//页码
  1062 + int pageData;//每页的记录条数
  1063 + int start;//起始数据下标
  1064 + int totalPage;//总页数
  1065 + int totalData = 0;
  1066 + if(list.size()>1){
  1067 + GpsSpeed GpsSpeedNow;//下标为i的车辆行驶记录
  1068 + GpsSpeed GpsSpeedLast;//下标为i-1的车辆行驶记录
  1069 + GpsSpeed spped = null;//整合后的车辆行驶记录
  1070 + String strNow;
  1071 + String strLast;
  1072 + boolean Flag = false;//判断是否有连续超速记录,默认没有
  1073 + for(int i = 1;i<list.size();i++){
  1074 + GpsSpeedNow = list.get(i);
  1075 + GpsSpeedLast = list.get(i-1);
  1076 + strNow = GpsSpeedNow.getVehicle()+GpsSpeedNow.getLine()+GpsSpeedNow.getUp_down();
  1077 + strLast = GpsSpeedLast.getVehicle()+GpsSpeedLast.getLine()+GpsSpeedLast.getUp_down();
  1078 + if(GpsSpeedNow.getSpeed()>60 && GpsSpeedLast.getSpeed()>60 && strNow.equals(strLast)){//如果两条连续的记录都是超速且属于同一辆车。
  1079 + if(Flag==false){//
  1080 + spped = new GpsSpeed();
  1081 + spped.setLine(GpsSpeedLast.getLine());//设置连续超速记录线路
  1082 + spped.setLineName(GpsSpeedLast.getLineName());//设置连续超速记录线路名称
  1083 + spped.setVehicle(GpsSpeedLast.getVehicle());//设置连续超速记录的车辆编号
  1084 + spped.setUp_down(GpsSpeedLast.getUp_down());//设置上下行
  1085 + spped.setLon(GpsSpeedLast.getLon());//设置开始时经度
  1086 + spped.setLat(GpsSpeedLast.getLat());//设置开始时纬度
  1087 + spped.setTimestamp(GpsSpeedLast.getTimestamp());//设置连续超速记录的开始时间
  1088 + spped.setTimestampDate(GpsSpeedLast.getTimestampDate());//设置连续超速记录的开始时间戳
  1089 + }
  1090 + spped.setEndtimestamp(GpsSpeedNow.getTimestamp());//设置结束时间戳
  1091 + spped.setEndtimestampDate(sdf.format(new Date(GpsSpeedNow.getTimestamp())));//设置结束时间
  1092 + spped.setEndlon(GpsSpeedNow.getLon());//设置结束时的经度
  1093 + spped.setEndlat(GpsSpeedNow.getLat());//设置结束时的纬度
  1094 + Flag = true;
  1095 + }else{
  1096 + if(Flag){//如果上一条记录超速。
  1097 + listResult.add(spped);
  1098 + Flag = false;
  1099 + }
  1100 + }
  1101 + }
  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);
  1123 + }
  1124 + }else{
  1125 + curPage = 1;
  1126 + pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
  1127 + totalPage =1;
  1128 + }
  1129 + Map<String,Object> paramMap = new HashMap<String,Object>();
  1130 + paramMap.put("totalPage", totalPage);
  1131 + paramMap.put("curPage", curPage);
  1132 + 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;
  1138 + }
  1139 +
  1140 + static List<GpsSpeed> findAll(Map<String, Object> map) {
  1141 + Connection conn = null;
  1142 + PreparedStatement ps = null;
  1143 + ResultSet rs = null;
  1144 + int page=Integer.parseInt(map.get("page").toString());
  1145 + List<GpsSpeed> list=new ArrayList<GpsSpeed>();
  1146 + String sql="select * from bsth_c_gps_info where 1=1 ";
  1147 + Object line=map.get("line");
  1148 + Object nbbm=map.get("nbbm");
  1149 + Object updown=map.get("updown");
  1150 + Object startDate=map.get("startDate");
  1151 + Object endDate=map.get("endDate");
  1152 +
  1153 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1154 + if(line!=null){
  1155 + sql +=" and line_id like'%"+line.toString().trim()+"%'";
  1156 + }
  1157 +
  1158 + if(nbbm!=null){
  1159 + nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  1160 + if(nbbm!=null)
  1161 + sql +=" and vehicle like '%"+nbbm.toString()+"%'";
  1162 + }
  1163 +
  1164 + if(updown!=null){
  1165 + sql +="and industry_code like '%"+updown.toString()+"%'";
  1166 + }
  1167 + if(startDate!=null){
  1168 + if (startDate.toString().length()>0) {
  1169 + try {
  1170 + Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
  1171 + sql += " and ts >="+t1;
  1172 + } catch (ParseException e) {
  1173 + e.printStackTrace();
  1174 + }
  1175 + }
  1176 +
  1177 + }
  1178 + if(endDate!=null){
  1179 + if (endDate.toString().length()>0) {
  1180 + try {
  1181 + Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
  1182 + sql += " and ts <="+t2;
  1183 + } catch (ParseException e) {
  1184 + e.printStackTrace();
  1185 + }
  1186 + }
  1187 +
  1188 + }
  1189 +
  1190 + try {
  1191 + conn = DBUtils_MS.getConnection();
  1192 + ps = conn.prepareStatement(sql);
  1193 + rs = ps.executeQuery();
  1194 + list = resultSet2Set(rs);
  1195 + } catch (SQLException e) {
  1196 + e.printStackTrace();
  1197 + }finally {
  1198 + DBUtils_MS.close(rs, ps, conn);
  1199 + }
  1200 +
  1201 + return list;
  1202 + }
  1203 +
  1204 + static List<GpsSpeed> resultSet2Set(ResultSet rs) throws SQLException{
  1205 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1206 + List<GpsSpeed> list=new ArrayList<GpsSpeed>();
  1207 + GpsSpeed GpsSpeed;
  1208 + Float lon, lat;
  1209 + Location location;
  1210 + while(rs.next()){
  1211 + lon = rs.getFloat("lon");
  1212 + lat = rs.getFloat("lat");
1213 1213 location = TransGPS.LocationMake(lon, lat);
1214 1214 location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
1215   - GpsSpeed=new GpsSpeed();
1216   - GpsSpeed.setLon((float)location.getLng());
1217   - GpsSpeed.setLat((float)location.getLat());
1218   - GpsSpeed.setLine(rs.getObject("line_id").toString());
1219   - //run 时注解
1220   - GpsSpeed.setLineName(BasicData.lineCode2NameMap.get(GpsSpeed.getLine().toString()));
1221   - GpsSpeed.setSpeed(Float.valueOf(rs.getObject("speed_gps").toString()));
1222   - GpsSpeed.setTimestamp((Long.valueOf(rs.getObject("ts").toString())));
1223   - GpsSpeed.setTimestampDate(sdf.format(new Date(GpsSpeed.getTimestamp())));
1224   - GpsSpeed.setUp_down(((Integer.valueOf(rs.getObject("service_state").toString())) & 0x10000000)==0?0:1);
1225   - GpsSpeed.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("device_id").toString()));
1226   - list.add(GpsSpeed);
1227   - }
1228   - return list;
1229   - }
1230   -
  1215 + GpsSpeed=new GpsSpeed();
  1216 + GpsSpeed.setLon((float)location.getLng());
  1217 + GpsSpeed.setLat((float)location.getLat());
  1218 + GpsSpeed.setLine(rs.getObject("line_id").toString());
  1219 + //run 时注解
  1220 + GpsSpeed.setLineName(BasicData.lineCode2NameMap.get(GpsSpeed.getLine().toString()));
  1221 + GpsSpeed.setSpeed(Float.valueOf(rs.getObject("speed_gps").toString()));
  1222 + GpsSpeed.setTimestamp((Long.valueOf(rs.getObject("ts").toString())));
  1223 + GpsSpeed.setTimestampDate(sdf.format(new Date(GpsSpeed.getTimestamp())));
  1224 + GpsSpeed.setUp_down(((Integer.valueOf(rs.getObject("service_state").toString())) & 0x10000000)==0?0:1);
  1225 + GpsSpeed.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("device_id").toString()));
  1226 + list.add(GpsSpeed);
  1227 + }
  1228 + return list;
  1229 + }
  1230 +
1231 1231 }
1232 1232  
... ...
src/main/java/com/bsth/service/schedule/ScheduleRule1FlatService.java
... ... @@ -6,4 +6,6 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
6 6 * Created by xu on 16/7/4.
7 7 */
8 8 public interface ScheduleRule1FlatService extends BService<ScheduleRule1Flat, Long> {
  9 +
  10 +
9 11 }
... ...