Commit e9991cac328b23e842d5a0c162620e6f840077eb
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
16 changed files
with
151 additions
and
106 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -553,7 +553,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -553,7 +553,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 553 | 553 | ||
| 554 | long t = System.currentTimeMillis(); | 554 | long t = System.currentTimeMillis(); |
| 555 | if(c != 1) | 555 | if(c != 1) |
| 556 | - t -= (ONE_DAY + (1000 * 60 * 60 * 2)); | 556 | + t -= (ONE_DAY + (1000 * 60 * 60 * 6)); |
| 557 | for(int i = 0; i < 3; i ++){ | 557 | for(int i = 0; i < 3; i ++){ |
| 558 | rs.add(fmtyyyyMMdd.print(t)); | 558 | rs.add(fmtyyyyMMdd.print(t)); |
| 559 | t -= ONE_DAY; | 559 | t -= ONE_DAY; |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| @@ -46,6 +46,13 @@ public class GatewayHttpUtils { | @@ -46,6 +46,13 @@ public class GatewayHttpUtils { | ||
| 46 | 46 | ||
| 47 | response = httpClient.execute(post); | 47 | response = httpClient.execute(post); |
| 48 | 48 | ||
| 49 | + int statusCode = response.getStatusLine().getStatusCode(); | ||
| 50 | + if(statusCode != 200){ | ||
| 51 | + post.abort(); | ||
| 52 | + logger.error("http client status code: " + statusCode); | ||
| 53 | + return code; | ||
| 54 | + } | ||
| 55 | + | ||
| 49 | JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); | 56 | JSONObject json = JSONObject.parseObject(EntityUtils.toString(response.getEntity())); |
| 50 | if (null != json && json.getInteger("errCode") == 0) | 57 | if (null != json && json.getInteger("errCode") == 0) |
| 51 | code = 0; | 58 | code = 0; |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| @@ -116,9 +116,9 @@ public class OutStationProcess { | @@ -116,9 +116,9 @@ public class OutStationProcess { | ||
| 116 | LateAdjustHandle.remove(sch); | 116 | LateAdjustHandle.remove(sch); |
| 117 | 117 | ||
| 118 | //发车的时候,同步一下状态 | 118 | //发车的时候,同步一下状态 |
| 119 | - if (!gps.isService() && !dayOfSchedule.emptyService(sch)) | 119 | + /*if (!gps.isService() && !dayOfSchedule.emptyService(sch)) |
| 120 | gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统"); | 120 | gpsStatusManager.changeServiceState(sch.getClZbh(), sch.getXlDir(), 0, "发车@系统"); |
| 121 | - | 121 | +*/ |
| 122 | logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); | 122 | logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); |
| 123 | } | 123 | } |
| 124 | 124 |
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
| @@ -5,7 +5,6 @@ import org.joda.time.format.DateTimeFormat; | @@ -5,7 +5,6 @@ import org.joda.time.format.DateTimeFormat; | ||
| 5 | import org.joda.time.format.DateTimeFormatter; | 5 | import org.joda.time.format.DateTimeFormatter; |
| 6 | import org.springframework.beans.BeansException; | 6 | import org.springframework.beans.BeansException; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | -import org.springframework.boot.CommandLineRunner; | ||
| 9 | import org.springframework.context.ApplicationContext; | 8 | import org.springframework.context.ApplicationContext; |
| 10 | import org.springframework.context.ApplicationContextAware; | 9 | import org.springframework.context.ApplicationContextAware; |
| 11 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| @@ -20,7 +19,7 @@ import java.util.Set; | @@ -20,7 +19,7 @@ import java.util.Set; | ||
| 20 | * Created by panzhao on 2017/4/6. | 19 | * Created by panzhao on 2017/4/6. |
| 21 | */ | 20 | */ |
| 22 | @Component | 21 | @Component |
| 23 | -public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware { | 22 | +public class SafeDrivCenter implements ApplicationContextAware { |
| 24 | 23 | ||
| 25 | private static Set<SafeDriv> data; | 24 | private static Set<SafeDriv> data; |
| 26 | 25 | ||
| @@ -65,12 +64,6 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware | @@ -65,12 +64,6 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware | ||
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | @Override | 66 | @Override |
| 68 | - public void run(String... strings) throws Exception { | ||
| 69 | - //定时加载安全驾驶数据 | ||
| 70 | - //Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 80, 7, TimeUnit.SECONDS); | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - @Override | ||
| 74 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | 67 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| 75 | sendUtils = applicationContext.getBean(SendUtils.class); | 68 | sendUtils = applicationContext.getBean(SendUtils.class); |
| 76 | } | 69 | } |
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
| @@ -2,6 +2,7 @@ package com.bsth.data.safe_driv; | @@ -2,6 +2,7 @@ package com.bsth.data.safe_driv; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import org.apache.http.HttpEntity; | 4 | import org.apache.http.HttpEntity; |
| 5 | +import org.apache.http.client.config.RequestConfig; | ||
| 5 | import org.apache.http.client.methods.CloseableHttpResponse; | 6 | import org.apache.http.client.methods.CloseableHttpResponse; |
| 6 | import org.apache.http.client.methods.HttpGet; | 7 | import org.apache.http.client.methods.HttpGet; |
| 7 | import org.apache.http.impl.client.CloseableHttpClient; | 8 | import org.apache.http.impl.client.CloseableHttpClient; |
| @@ -21,24 +22,43 @@ import java.util.List; | @@ -21,24 +22,43 @@ import java.util.List; | ||
| 21 | @Component | 22 | @Component |
| 22 | public class SafeDrivDataLoadThread extends Thread{ | 23 | public class SafeDrivDataLoadThread extends Thread{ |
| 23 | 24 | ||
| 24 | - private final static String url = "http://180.166.5.82:9007/bsth-safedriving/Crlcxb/realtimeInterface.do"; | ||
| 25 | - | ||
| 26 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 25 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 27 | 26 | ||
| 27 | + static String url; | ||
| 28 | + static CloseableHttpClient httpClient = null; | ||
| 29 | + static HttpGet get; | ||
| 30 | + static RequestConfig requestConfig; | ||
| 31 | + static CloseableHttpResponse response; | ||
| 32 | + static HttpEntity entity; | ||
| 33 | + static BufferedReader br; | ||
| 34 | + | ||
| 35 | + static { | ||
| 36 | + url = "http://180.166.5.82:9007/bsth-safedriving/Crlcxb/realtimeInterface.do"; | ||
| 37 | + httpClient = HttpClients.createDefault(); | ||
| 38 | + get = new HttpGet(url); | ||
| 39 | + requestConfig = RequestConfig.custom() | ||
| 40 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 41 | + .setSocketTimeout(2500).build(); | ||
| 42 | + get.setConfig(requestConfig); | ||
| 43 | + } | ||
| 44 | + | ||
| 28 | @Override | 45 | @Override |
| 29 | public void run() { | 46 | public void run() { |
| 30 | - List<SafeDriv> list = null; | ||
| 31 | - CloseableHttpClient httpClient = null; | ||
| 32 | - CloseableHttpResponse response = null; | 47 | + List<SafeDriv> list; |
| 33 | try { | 48 | try { |
| 34 | - httpClient = HttpClients.createDefault(); | ||
| 35 | - HttpGet get = new HttpGet(url); | ||
| 36 | 49 | ||
| 37 | response = httpClient.execute(get); | 50 | response = httpClient.execute(get); |
| 38 | 51 | ||
| 39 | - HttpEntity entity = response.getEntity(); | 52 | + int statusCode = response.getStatusLine().getStatusCode(); |
| 53 | + if(statusCode != 200){ | ||
| 54 | + get.abort(); | ||
| 55 | + logger.error("http client status code: " + statusCode); | ||
| 56 | + return; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + entity = response.getEntity(); | ||
| 40 | if (null != entity) { | 60 | if (null != entity) { |
| 41 | - BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | 61 | + br = new BufferedReader(new InputStreamReader(entity.getContent())); |
| 42 | StringBuffer stringBuffer = new StringBuffer(); | 62 | StringBuffer stringBuffer = new StringBuffer(); |
| 43 | String str = ""; | 63 | String str = ""; |
| 44 | while ((str = br.readLine()) != null) | 64 | while ((str = br.readLine()) != null) |
| @@ -46,47 +66,14 @@ public class SafeDrivDataLoadThread extends Thread{ | @@ -46,47 +66,14 @@ public class SafeDrivDataLoadThread extends Thread{ | ||
| 46 | 66 | ||
| 47 | 67 | ||
| 48 | list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); | 68 | list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); |
| 49 | - /** | ||
| 50 | - * 模拟数据 | ||
| 51 | - | ||
| 52 | - SafeDriv sd1 = new SafeDriv(); | ||
| 53 | - sd1.setYczltype("1"); | ||
| 54 | - sd1.setClzbh("W2B-001"); | ||
| 55 | - sd1.setStartime("2017-04-07 08:00:00.0"); | ||
| 56 | - | ||
| 57 | - SafeDriv sd2 = new SafeDriv(); | ||
| 58 | - sd2.setYczltype("2"); | ||
| 59 | - sd2.setClzbh("W2B-002"); | ||
| 60 | - sd2.setStartime("2017-04-07 08:02:00.0"); | ||
| 61 | - | ||
| 62 | - SafeDriv sd3 = new SafeDriv(); | ||
| 63 | - sd3.setYczltype("3"); | ||
| 64 | - sd3.setClzbh("W2B-003"); | ||
| 65 | - sd3.setStartime("2017-04-07 08:03:00.0"); | ||
| 66 | - | ||
| 67 | - SafeDriv sd4 = new SafeDriv(); | ||
| 68 | - sd4.setYczltype("4"); | ||
| 69 | - sd4.setClzbh("W2B-004"); | ||
| 70 | - sd4.setStartime("2017-04-07 08:04:00.0"); | ||
| 71 | - | ||
| 72 | - SafeDriv sd5 = new SafeDriv(); | ||
| 73 | - sd5.setYczltype("5"); | ||
| 74 | - sd5.setClzbh("W2B-005"); | ||
| 75 | - sd5.setStartime("2017-04-07 08:05:00.0"); | ||
| 76 | 69 | ||
| 77 | - list.add(sd1); | ||
| 78 | - list.add(sd2); | ||
| 79 | - list.add(sd3); | ||
| 80 | - list.add(sd4); | ||
| 81 | - list.add(sd5); | ||
| 82 | - */ | ||
| 83 | for(SafeDriv sd : list){ | 70 | for(SafeDriv sd : list){ |
| 84 | SafeDrivCenter.put(sd); | 71 | SafeDrivCenter.put(sd); |
| 85 | } | 72 | } |
| 86 | } | 73 | } |
| 87 | 74 | ||
| 88 | - httpClient.close(); | ||
| 89 | - response.close(); | 75 | + if (null != response) |
| 76 | + response.close(); | ||
| 90 | } catch (Exception e) { | 77 | } catch (Exception e) { |
| 91 | logger.error("安全驾驶接口报错了" , e.getMessage()); | 78 | logger.error("安全驾驶接口报错了" , e.getMessage()); |
| 92 | } | 79 | } |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -188,25 +188,9 @@ public class GpsServiceImpl implements GpsService { | @@ -188,25 +188,9 @@ public class GpsServiceImpl implements GpsService { | ||
| 188 | String nbbm = nbbmArray[0]; | 188 | String nbbm = nbbmArray[0]; |
| 189 | 189 | ||
| 190 | List<DeviceChange> dcs = findDeviceChangeLogs(nbbm, et, st); | 190 | List<DeviceChange> dcs = findDeviceChangeLogs(nbbm, et, st); |
| 191 | - //没有设备变更记录,则参考车辆信息上的设备号 | ||
| 192 | - if(null == dcs || dcs.size() == 0){ | ||
| 193 | - DeviceChange dc = new DeviceChange(); | ||
| 194 | - dc.setNbbm(nbbm); | ||
| 195 | - dc.setDevice(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | ||
| 196 | - dc.setSt(st); | ||
| 197 | - dc.setEt(et); | ||
| 198 | - dc.setType(1); | ||
| 199 | - | ||
| 200 | - dcs.add(dc); | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - //bsth_c_gps_info | ||
| 204 | - String tableName = "bsth_c_gps_info"; | ||
| 205 | - String sYear = fmtyyyy.print(st), | ||
| 206 | - currYear = fmtyyyy.print(System.currentTimeMillis()); | ||
| 207 | 191 | ||
| 208 | - if(!sYear.equals(currYear)) | ||
| 209 | - tableName += "_" + sYear; | 192 | + //按年分表 |
| 193 | + String tableName = "bsth_c_gps_info_" + fmtyyyy.print(st); | ||
| 210 | 194 | ||
| 211 | StringBuilder sql = new StringBuilder(""); | 195 | StringBuilder sql = new StringBuilder(""); |
| 212 | long t1,t2; | 196 | long t1,t2; |
| @@ -221,7 +205,7 @@ public class GpsServiceImpl implements GpsService { | @@ -221,7 +205,7 @@ public class GpsServiceImpl implements GpsService { | ||
| 221 | t2 = dc.getEt(); | 205 | t2 = dc.getEt(); |
| 222 | 206 | ||
| 223 | sql.append("select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS,SECTION_CODE from "+tableName+" where days_year in ("+sDayOfYear+","+eDayOfYear+") " + | 207 | sql.append("select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS,SECTION_CODE from "+tableName+" where days_year in ("+sDayOfYear+","+eDayOfYear+") " + |
| 224 | - " and device_id='"+dc.getDevice()+"' and ts > "+t1+" and ts < "+t2+" "); | 208 | + " and device_id='"+dc.getDevice()+"' and ts >= "+t1+" and ts <= "+t2+" "); |
| 225 | 209 | ||
| 226 | if(i == len - 1) | 210 | if(i == len - 1) |
| 227 | sql.append(" ORDER BY device_id,ts,stop_no"); | 211 | sql.append(" ORDER BY device_id,ts,stop_no"); |
| @@ -365,6 +349,18 @@ public class GpsServiceImpl implements GpsService { | @@ -365,6 +349,18 @@ public class GpsServiceImpl implements GpsService { | ||
| 365 | 349 | ||
| 366 | rs.add(dc); | 350 | rs.add(dc); |
| 367 | } | 351 | } |
| 352 | + | ||
| 353 | + //没有设备变更记录,则参考车辆信息上的设备号 | ||
| 354 | + if(null == rs || rs.size() == 0){ | ||
| 355 | + DeviceChange dc = new DeviceChange(); | ||
| 356 | + dc.setNbbm(nbbm); | ||
| 357 | + dc.setDevice(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | ||
| 358 | + dc.setSt(st); | ||
| 359 | + dc.setEt(et); | ||
| 360 | + dc.setType(1); | ||
| 361 | + | ||
| 362 | + rs.add(dc); | ||
| 363 | + } | ||
| 368 | }catch (Exception e){ | 364 | }catch (Exception e){ |
| 369 | logger.error("", e); | 365 | logger.error("", e); |
| 370 | } | 366 | } |
| @@ -386,6 +382,9 @@ public class GpsServiceImpl implements GpsService { | @@ -386,6 +382,9 @@ public class GpsServiceImpl implements GpsService { | ||
| 386 | eCal.setTime(new Date(et * 1000)); | 382 | eCal.setTime(new Date(et * 1000)); |
| 387 | int eWeekOfYear = eCal.get(Calendar.DAY_OF_YEAR); | 383 | int eWeekOfYear = eCal.get(Calendar.DAY_OF_YEAR); |
| 388 | 384 | ||
| 385 | + //按年分表 | ||
| 386 | + String tableName = "bsth_c_arrival_info_" + fmtyyyy.print(st); | ||
| 387 | + | ||
| 389 | StringBuilder sql = new StringBuilder(""); | 388 | StringBuilder sql = new StringBuilder(""); |
| 390 | long t1,t2; | 389 | long t1,t2; |
| 391 | DeviceChange dc; | 390 | DeviceChange dc; |
| @@ -398,8 +397,8 @@ public class GpsServiceImpl implements GpsService { | @@ -398,8 +397,8 @@ public class GpsServiceImpl implements GpsService { | ||
| 398 | if(dc.getEt() < et) | 397 | if(dc.getEt() < et) |
| 399 | t2 = dc.getEt(); | 398 | t2 = dc.getEt(); |
| 400 | 399 | ||
| 401 | - sql.append("SELECT DEVICE_ID,LINE_ID as LINE_CODE,STOP_NO,TS,UP_DOWN,IN_OUT,WEEKS_YEAR,CREATE_DATE FROM bsth_c_arrival_info " + | ||
| 402 | - " where weeks_year in ("+sWeekOfYear+", "+eWeekOfYear+") and device_id='"+dc.getDevice()+"' and ts > "+t1+" and ts < " + t2); | 400 | + sql.append("SELECT DEVICE_ID,LINE_ID as LINE_CODE,STOP_NO,TS,UP_DOWN,IN_OUT,WEEKS_YEAR,CREATE_DATE FROM " + tableName + |
| 401 | + " where weeks_year in ("+sWeekOfYear+", "+eWeekOfYear+") and device_id='"+dc.getDevice()+"' and ts > "+t1+" and ts < " + t2); | ||
| 403 | 402 | ||
| 404 | if(i == len - 1) | 403 | if(i == len - 1) |
| 405 | sql.append(" ORDER BY device_id,ts,stop_no "); | 404 | sql.append(" ORDER BY device_id,ts,stop_no "); |
| @@ -407,6 +406,7 @@ public class GpsServiceImpl implements GpsService { | @@ -407,6 +406,7 @@ public class GpsServiceImpl implements GpsService { | ||
| 407 | sql.append(" UNION "); | 406 | sql.append(" UNION "); |
| 408 | } | 407 | } |
| 409 | 408 | ||
| 409 | + logger.info("arrivl sql : " + sql.toString()); | ||
| 410 | JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); | 410 | JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 411 | List<ArrivalEntity> list = jdbcTemplate_ms.query(sql.toString(), BeanPropertyRowMapper.newInstance(ArrivalEntity.class)); | 411 | List<ArrivalEntity> list = jdbcTemplate_ms.query(sql.toString(), BeanPropertyRowMapper.newInstance(ArrivalEntity.class)); |
| 412 | 412 | ||
| @@ -887,27 +887,84 @@ public class GpsServiceImpl implements GpsService { | @@ -887,27 +887,84 @@ public class GpsServiceImpl implements GpsService { | ||
| 887 | 887 | ||
| 888 | @Override | 888 | @Override |
| 889 | public List<GpsSpeed_DTO> speeds(String nbbm, long st, long et) { | 889 | public List<GpsSpeed_DTO> speeds(String nbbm, long st, long et) { |
| 890 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | ||
| 891 | - String sql = "select vehicle, line, up_down, lon, lat, speed,timestamp from bsth_c_speeding where vehicle=? and timestamp>? and timestamp<?"; | 890 | + st = st * 1000; |
| 891 | + et = et * 1000; | ||
| 892 | + //按周分区 | ||
| 893 | + Calendar sCal = Calendar.getInstance(); | ||
| 894 | + sCal.setTime(new Date(st)); | ||
| 895 | + int sWeekYear = sCal.get(Calendar.WEEK_OF_YEAR); | ||
| 896 | + Calendar eCal = Calendar.getInstance(); | ||
| 897 | + eCal.setTime(new Date(et)); | ||
| 898 | + int eWeekYear = eCal.get(Calendar.WEEK_OF_YEAR); | ||
| 899 | + | ||
| 900 | + //按年分表 | ||
| 901 | + String tableName = "bsth_c_speeding_" + fmtyyyy.print(st); | ||
| 892 | 902 | ||
| 893 | - return GpsSpeed_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st * 1000, et * 1000)); | 903 | + List<DeviceChange> dcs = findDeviceChangeLogs(nbbm, et, st); |
| 904 | + StringBuilder sql = new StringBuilder(""); | ||
| 905 | + long t1,t2; | ||
| 906 | + DeviceChange dc; | ||
| 907 | + for(int i = 0,len=dcs.size(); i < len; i++){ | ||
| 908 | + t1 = st; | ||
| 909 | + t2 = et; | ||
| 910 | + dc = dcs.get(i); | ||
| 911 | + if(dc.getSt() > st) | ||
| 912 | + t1 = dc.getSt(); | ||
| 913 | + if(dc.getEt() < et && dc.getEt()!=0) | ||
| 914 | + t2 = dc.getEt(); | ||
| 915 | + | ||
| 916 | + sql.append(" select vehicle, line, up_down, lon, lat, speed,timestamp from "+tableName+" where " + | ||
| 917 | + " weeks_year in ("+sWeekYear+", "+eWeekYear+") and vehicle='"+dc.getDevice()+"' and timestamp>="+t1+" and timestamp<= " + t2); | ||
| 918 | + | ||
| 919 | + if(i == len - 1) | ||
| 920 | + sql.append(" ORDER BY vehicle,timestamp"); | ||
| 921 | + else | ||
| 922 | + sql.append(" UNION "); | ||
| 923 | + } | ||
| 924 | + | ||
| 925 | + logger.info("speed sql : " + sql.toString()); | ||
| 926 | + return GpsSpeed_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql.toString())); | ||
| 894 | } | 927 | } |
| 895 | 928 | ||
| 896 | @Override | 929 | @Override |
| 897 | public List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et) { | 930 | public List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et) { |
| 898 | - /** | ||
| 899 | - * 如果 st 和 et 跨了周分区,也只查询st 分区的数据。 | ||
| 900 | - */ | ||
| 901 | st = st * 1000; | 931 | st = st * 1000; |
| 902 | et = et * 1000; | 932 | et = et * 1000; |
| 903 | //按周分区 | 933 | //按周分区 |
| 904 | - Calendar weekCal = Calendar.getInstance(); | ||
| 905 | - weekCal.setTimeInMillis(st); | ||
| 906 | - int weekYear = weekCal.get(Calendar.WEEK_OF_YEAR); | ||
| 907 | - //设备号 | ||
| 908 | - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | ||
| 909 | - String sql = "select vehicle,line,up_down,lon,lat,timestamp from bsth_c_outbound where weeks_year=" + weekYear + " and vehicle=? and timestamp>? and timestamp<?"; | ||
| 910 | - return GpsOutbound_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st, et)); | 934 | + Calendar sCal = Calendar.getInstance(); |
| 935 | + sCal.setTime(new Date(st)); | ||
| 936 | + int sWeekYear = sCal.get(Calendar.WEEK_OF_YEAR); | ||
| 937 | + Calendar eCal = Calendar.getInstance(); | ||
| 938 | + eCal.setTime(new Date(et)); | ||
| 939 | + int eWeekYear = eCal.get(Calendar.WEEK_OF_YEAR); | ||
| 940 | + | ||
| 941 | + //按年分表 | ||
| 942 | + String tableName = "bsth_c_outbound_" + fmtyyyy.print(st); | ||
| 943 | + | ||
| 944 | + List<DeviceChange> dcs = findDeviceChangeLogs(nbbm, et, st); | ||
| 945 | + StringBuilder sql = new StringBuilder(""); | ||
| 946 | + long t1,t2; | ||
| 947 | + DeviceChange dc; | ||
| 948 | + for(int i = 0,len=dcs.size(); i < len; i++){ | ||
| 949 | + t1 = st; | ||
| 950 | + t2 = et; | ||
| 951 | + dc = dcs.get(i); | ||
| 952 | + if(dc.getSt() > st) | ||
| 953 | + t1 = dc.getSt(); | ||
| 954 | + if(dc.getEt() < et && dc.getEt()!=0) | ||
| 955 | + t2 = dc.getEt(); | ||
| 956 | + | ||
| 957 | + sql.append("select vehicle,line,up_down,lon,lat,timestamp from "+tableName+" where " + | ||
| 958 | + " weeks_year in ("+sWeekYear+", "+eWeekYear+") and vehicle='"+dc.getDevice()+"' and timestamp>="+t1+" and timestamp<=" + t2); | ||
| 959 | + | ||
| 960 | + if(i == len - 1) | ||
| 961 | + sql.append(" ORDER BY vehicle,timestamp"); | ||
| 962 | + else | ||
| 963 | + sql.append(" UNION "); | ||
| 964 | + } | ||
| 965 | + | ||
| 966 | + logger.info("outbounds sql : " + sql.toString()); | ||
| 967 | + return GpsOutbound_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql.toString())); | ||
| 911 | } | 968 | } |
| 912 | 969 | ||
| 913 | @Override | 970 | @Override |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -2826,14 +2826,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2826,14 +2826,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2826 | 2826 | ||
| 2827 | String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + | 2827 | String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + |
| 2828 | "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_name, gs_name, xl_dir, xl_bm " + | 2828 | "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_name, gs_name, xl_dir, xl_bm " + |
| 2829 | - "from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'"; | 2829 | + "from bsth_c_s_sp_info_real " + |
| 2830 | + "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " + | ||
| 2831 | + "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; | ||
| 2830 | 2832 | ||
| 2831 | - if(line.length() != 0) | ||
| 2832 | - sql += " and xl_bm = '"+line+"'"; | ||
| 2833 | if(company.length() != 0) | 2833 | if(company.length() != 0) |
| 2834 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 2834 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| 2835 | - | ||
| 2836 | - sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; | 2835 | + if(line.length() != 0) |
| 2836 | + sql += " and xl_bm = '"+line+"'"; | ||
| 2837 | 2837 | ||
| 2838 | System.out.println(sql); | 2838 | System.out.println(sql); |
| 2839 | List<ScheduleRealInfo> list = jdbcTemplate.query(sql, | 2839 | List<ScheduleRealInfo> list = jdbcTemplate.query(sql, |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| @@ -168,8 +168,7 @@ public class SendUtils{ | @@ -168,8 +168,7 @@ public class SendUtils{ | ||
| 168 | ObjectMapper mapper = new ObjectMapper(); | 168 | ObjectMapper mapper = new ObjectMapper(); |
| 169 | 169 | ||
| 170 | try { | 170 | try { |
| 171 | - socketHandler.sendMessage(mapper.writeValueAsString(map)); | ||
| 172 | - | 171 | + socketHandler.sendMessageToLine(sd.getXlbm(), mapper.writeValueAsString(map)); |
| 173 | } catch (JsonProcessingException e) { | 172 | } catch (JsonProcessingException e) { |
| 174 | logger.error("", e); | 173 | logger.error("", e); |
| 175 | } | 174 | } |
src/main/resources/ms-jdbc.properties
| @@ -4,6 +4,6 @@ | @@ -4,6 +4,6 @@ | ||
| 4 | #ms.mysql.password= 123456 | 4 | #ms.mysql.password= 123456 |
| 5 | 5 | ||
| 6 | ms.mysql.driver= com.mysql.jdbc.Driver | 6 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | -ms.mysql.url= jdbc:mysql://10.10.150.21:3306/ms?useUnicode=true&characterEncoding=utf-8 | 7 | +ms.mysql.url= jdbc:mysql://10.10.200.226:3306/ms?useUnicode=true&characterEncoding=utf-8 |
| 8 | ms.mysql.username= root | 8 | ms.mysql.username= root |
| 9 | -ms.mysql.password= root2jsp@JSP | 9 | +ms.mysql.password= root2jsp |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
| 101 | var len_ = array.length,paramsD = new Array(); | 101 | var len_ = array.length,paramsD = new Array(); |
| 102 | if(len_>0) { | 102 | if(len_>0) { |
| 103 | $.each(array, function(i, g){ | 103 | $.each(array, function(i, g){ |
| 104 | - if(g.name!='' || g.name != null) { | 104 | + if(g.remove != 1 && (g.name!='' || g.name != null)) { |
| 105 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); | 105 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); |
| 106 | } | 106 | } |
| 107 | }); | 107 | }); |
src/main/resources/static/pages/base/line/list.html
| @@ -305,7 +305,7 @@ | @@ -305,7 +305,7 @@ | ||
| 305 | <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a> | 305 | <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a> |
| 306 | 306 | ||
| 307 | {{if obj.destroy==1}} | 307 | {{if obj.destroy==1}} |
| 308 | - <a class="ct_base_line_delete_link" data-id="{{obj.id}}" data-name="{{obj.name}}"> 删除 </a> | 308 | + <!--<a class="ct_base_line_delete_link" data-id="{{obj.id}}" data-name="{{obj.name}}"> 删除 </a>--> |
| 309 | {{/if}} | 309 | {{/if}} |
| 310 | </td> | 310 | </td> |
| 311 | </tr> | 311 | </tr> |
src/main/resources/static/pages/base/section/js/section-list-table.js
| @@ -147,7 +147,7 @@ | @@ -147,7 +147,7 @@ | ||
| 147 | var len_ = array.length,paramsD = new Array(); | 147 | var len_ = array.length,paramsD = new Array(); |
| 148 | if(len_>0) { | 148 | if(len_>0) { |
| 149 | $.each(array, function(i, g){ | 149 | $.each(array, function(i, g){ |
| 150 | - if(g.name!='' || g.name != null) { | 150 | + if(g.remove != 1 && (g.name!='' || g.name != null)) { |
| 151 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); | 151 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); |
| 152 | } | 152 | } |
| 153 | }); | 153 | }); |
src/main/resources/static/pages/base/station/js/station-list-table.js
| @@ -173,7 +173,7 @@ | @@ -173,7 +173,7 @@ | ||
| 173 | var len_ = array.length,paramsD = new Array(); | 173 | var len_ = array.length,paramsD = new Array(); |
| 174 | if(len_>0) { | 174 | if(len_>0) { |
| 175 | $.each(array, function(i, g){ | 175 | $.each(array, function(i, g){ |
| 176 | - if(g.name!='' || g.name != null) { | 176 | + if(g.remove != 1 && (g.name!='' || g.name != null)) { |
| 177 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); | 177 | paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)}); |
| 178 | } | 178 | } |
| 179 | }); | 179 | }); |
src/main/resources/static/pages/punctual/onTime.html
| @@ -152,7 +152,7 @@ | @@ -152,7 +152,7 @@ | ||
| 152 | $('.menu-toggler.sidebar-toggler').click(); | 152 | $('.menu-toggler.sidebar-toggler').click(); |
| 153 | 153 | ||
| 154 | var d = new Date(); | 154 | var d = new Date(); |
| 155 | - d.setTime(d.getTime() - 1*1000*60*60*24); | 155 | + d.setTime(d.getTime() - 3*1000*60*60*24); |
| 156 | var year = d.getFullYear(); | 156 | var year = d.getFullYear(); |
| 157 | var month = d.getMonth() + 1; | 157 | var month = d.getMonth() + 1; |
| 158 | var day = d.getDate(); | 158 | var day = d.getDate(); |
src/main/resources/static/real_control_v2/js/forms/wrap.html
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
| @@ -20,10 +20,10 @@ var gb_safe_driv = (function () { | @@ -20,10 +20,10 @@ var gb_safe_driv = (function () { | ||
| 20 | var max = 5; | 20 | var max = 5; |
| 21 | 21 | ||
| 22 | var pop = function (sd) { | 22 | var pop = function (sd) { |
| 23 | - //只有admin用户能收到 | 23 | + /*//只有admin用户能收到 |
| 24 | var user = gb_northToolbar.user(); | 24 | var user = gb_northToolbar.user(); |
| 25 | if (!user || user.userName.indexOf('admin') == -1) | 25 | if (!user || user.userName.indexOf('admin') == -1) |
| 26 | - return; | 26 | + return;*/ |
| 27 | 27 | ||
| 28 | //时间格式化 | 28 | //时间格式化 |
| 29 | var stm = moment(sd.ts); | 29 | var stm = moment(sd.ts); |
| @@ -60,7 +60,7 @@ var gb_safe_driv = (function () { | @@ -60,7 +60,7 @@ var gb_safe_driv = (function () { | ||
| 60 | '</div>'; | 60 | '</div>'; |
| 61 | 61 | ||
| 62 | $wrap.on('click', '.safe_driv_pop', function () { | 62 | $wrap.on('click', '.safe_driv_pop', function () { |
| 63 | - var title = $(this).data('title') + ' <button data-nbbm="'+$(this).data('nbbm')+'" class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; | 63 | + var title = $(this).data('title');// + ' <button data-nbbm="'+$(this).data('nbbm')+'" class="uk-button uk-button-mini uk-button-primary" id="openPhoneModalBtn" type="button">打电话</button>'; |
| 64 | var url = $(this).data('url'); | 64 | var url = $(this).data('url'); |
| 65 | $(this).remove(); | 65 | $(this).remove(); |
| 66 | var lightbox = UIkit.lightbox.create([ | 66 | var lightbox = UIkit.lightbox.create([ |