Commit 8bc915c5a193dd4c84d0752faabc0da52357e1de
update
Showing
7 changed files
with
136 additions
and
125 deletions
src/main/java/com/bsth/data/BasicData.java
src/main/java/com/bsth/data/gpsdata/GpsRealDataList.java
| 1 | -package com.bsth.data.gpsdata; | |
| 2 | - | |
| 3 | -import java.io.BufferedReader; | |
| 4 | -import java.io.InputStreamReader; | |
| 5 | -import java.util.ArrayList; | |
| 6 | -import java.util.HashMap; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | -import java.util.NavigableSet; | |
| 10 | - | |
| 11 | -import org.apache.http.HttpEntity; | |
| 12 | -import org.apache.http.client.methods.CloseableHttpResponse; | |
| 13 | -import org.apache.http.client.methods.HttpGet; | |
| 14 | -import org.apache.http.impl.client.CloseableHttpClient; | |
| 15 | -import org.apache.http.impl.client.HttpClients; | |
| 16 | -import org.slf4j.Logger; | |
| 17 | -import org.slf4j.LoggerFactory; | |
| 18 | - | |
| 19 | -import com.alibaba.fastjson.JSON; | |
| 20 | -import com.alibaba.fastjson.JSONObject; | |
| 21 | -import com.bsth.data.BasicData; | |
| 22 | -import com.bsth.util.ConfigUtil; | |
| 23 | -import com.bsth.vehicle.gpsdata.entity.GpsRealData; | |
| 24 | -import com.google.common.collect.TreeMultimap; | |
| 25 | - | |
| 26 | -/** | |
| 27 | - * | |
| 28 | - * @ClassName: GpsRealDataBuffer | |
| 29 | - * @Description: TODO(实时GPS数据集合) | |
| 30 | - * @author PanZhao | |
| 31 | - * @date 2016年8月12日 下午2:04:41 | |
| 32 | - * | |
| 33 | - */ | |
| 34 | -public class GpsRealDataList { | |
| 35 | - | |
| 36 | - private static Map<String, GpsRealData> gpsMap; | |
| 37 | - | |
| 38 | - private static TreeMultimap<Integer, String> lineCode2Devices; | |
| 39 | - | |
| 40 | - // 网关数据接口地址 | |
| 41 | - private static String url; | |
| 42 | - | |
| 43 | - static{ | |
| 44 | - gpsMap = new HashMap<>(); | |
| 45 | - lineCode2Devices = TreeMultimap.create(); | |
| 46 | - url = ConfigUtil.get("http.gps.real.url"); | |
| 47 | - } | |
| 48 | - | |
| 49 | - static Logger logger = LoggerFactory.getLogger(GpsRealDataList.class); | |
| 50 | - | |
| 51 | - public static GpsRealData add(GpsRealData gps) { | |
| 52 | - String device = gps.getDeviceId(); | |
| 53 | - gpsMap.put(device, gps); | |
| 54 | - lineCode2Devices.put(gps.getLineId(), device); | |
| 55 | - return gps; | |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * | |
| 60 | - * @Title: get @Description: TODO(设备号获取GPS) @param @param deviceId @throws | |
| 61 | - */ | |
| 62 | - public static GpsRealData get(String deviceId) { | |
| 63 | - return gpsMap.get(deviceId); | |
| 64 | - } | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * | |
| 68 | - * @Title: get @Description: TODO(线路编码获取GPS集合) @throws | |
| 69 | - */ | |
| 70 | - public static List<GpsRealData> get(Integer lineCode) { | |
| 71 | - NavigableSet<String> set = lineCode2Devices.get(lineCode); | |
| 72 | - | |
| 73 | - List<GpsRealData> rs = new ArrayList<>(); | |
| 74 | - for(String device : set){ | |
| 75 | - rs.add(gpsMap.get(device)); | |
| 76 | - } | |
| 77 | - | |
| 78 | - return rs; | |
| 79 | - } | |
| 80 | - | |
| 81 | - public static void LoadGpsRealData() throws Exception { | |
| 82 | - List<GpsRealData> list = new ArrayList<>(); | |
| 83 | - CloseableHttpClient httpClient = null; | |
| 84 | - | |
| 85 | - try { | |
| 86 | - httpClient = HttpClients.createDefault(); | |
| 87 | - HttpGet get = new HttpGet(url); | |
| 88 | - | |
| 89 | - CloseableHttpResponse response = httpClient.execute(get); | |
| 90 | - | |
| 91 | - try { | |
| 92 | - HttpEntity entity = response.getEntity(); | |
| 93 | - if (null != entity) { | |
| 94 | - // 返回数据量比较大,建议以流的形式读取 | |
| 95 | - BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 96 | - StringBuffer stringBuffer = new StringBuffer(); | |
| 97 | - String str = ""; | |
| 98 | - while ((str = br.readLine()) != null) | |
| 99 | - stringBuffer.append(str); | |
| 100 | - | |
| 101 | - JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); | |
| 102 | - | |
| 103 | - if (jsonObj != null) | |
| 104 | - list = JSON.parseArray(jsonObj.getString("data"), GpsRealData.class); | |
| 105 | - | |
| 106 | - for(GpsRealData gps : list){ | |
| 107 | - gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps)); | |
| 108 | - add(gps); | |
| 109 | - } | |
| 110 | - } else | |
| 111 | - logger.error("result is null"); | |
| 112 | - } finally { | |
| 113 | - response.close(); | |
| 114 | - } | |
| 115 | - | |
| 116 | - } finally { | |
| 117 | - if (null != httpClient) | |
| 118 | - httpClient.close(); | |
| 119 | - } | |
| 120 | - } | |
| 121 | -} | |
| 1 | +//package com.bsth.data.gpsdata; | |
| 2 | +// | |
| 3 | +//import java.io.BufferedReader; | |
| 4 | +//import java.io.InputStreamReader; | |
| 5 | +//import java.util.ArrayList; | |
| 6 | +//import java.util.HashMap; | |
| 7 | +//import java.util.List; | |
| 8 | +//import java.util.Map; | |
| 9 | +//import java.util.NavigableSet; | |
| 10 | +// | |
| 11 | +//import org.apache.http.HttpEntity; | |
| 12 | +//import org.apache.http.client.methods.CloseableHttpResponse; | |
| 13 | +//import org.apache.http.client.methods.HttpGet; | |
| 14 | +//import org.apache.http.impl.client.CloseableHttpClient; | |
| 15 | +//import org.apache.http.impl.client.HttpClients; | |
| 16 | +//import org.slf4j.Logger; | |
| 17 | +//import org.slf4j.LoggerFactory; | |
| 18 | +// | |
| 19 | +//import com.alibaba.fastjson.JSON; | |
| 20 | +//import com.alibaba.fastjson.JSONObject; | |
| 21 | +//import com.bsth.data.BasicData; | |
| 22 | +//import com.bsth.util.ConfigUtil; | |
| 23 | +//import com.bsth.vehicle.gpsdata.entity.GpsRealData; | |
| 24 | +//import com.google.common.collect.TreeMultimap; | |
| 25 | +// | |
| 26 | +///** | |
| 27 | +// * | |
| 28 | +// * @ClassName: GpsRealDataBuffer | |
| 29 | +// * @Description: TODO(实时GPS数据集合) | |
| 30 | +// * @author PanZhao | |
| 31 | +// * @date 2016年8月12日 下午2:04:41 | |
| 32 | +// * | |
| 33 | +// */ | |
| 34 | +//public class GpsRealDataList { | |
| 35 | +// | |
| 36 | +// private static Map<String, GpsRealData> gpsMap; | |
| 37 | +// | |
| 38 | +// private static TreeMultimap<Integer, String> lineCode2Devices; | |
| 39 | +// | |
| 40 | +// // 网关数据接口地址 | |
| 41 | +// private static String url; | |
| 42 | +// | |
| 43 | +// static{ | |
| 44 | +// gpsMap = new HashMap<>(); | |
| 45 | +// lineCode2Devices = TreeMultimap.create(); | |
| 46 | +// url = ConfigUtil.get("http.gps.real.url"); | |
| 47 | +// } | |
| 48 | +// | |
| 49 | +// static Logger logger = LoggerFactory.getLogger(GpsRealDataList.class); | |
| 50 | +// | |
| 51 | +// public static GpsRealData add(GpsRealData gps) { | |
| 52 | +// String device = gps.getDeviceId(); | |
| 53 | +// gpsMap.put(device, gps); | |
| 54 | +// lineCode2Devices.put(gps.getLineId(), device); | |
| 55 | +// return gps; | |
| 56 | +// } | |
| 57 | +// | |
| 58 | +// /** | |
| 59 | +// * | |
| 60 | +// * @Title: get @Description: TODO(设备号获取GPS) @param @param deviceId @throws | |
| 61 | +// */ | |
| 62 | +// public static GpsRealData get(String deviceId) { | |
| 63 | +// return gpsMap.get(deviceId); | |
| 64 | +// } | |
| 65 | +// | |
| 66 | +// /** | |
| 67 | +// * | |
| 68 | +// * @Title: get @Description: TODO(线路编码获取GPS集合) @throws | |
| 69 | +// */ | |
| 70 | +// public static List<GpsRealData> get(Integer lineCode) { | |
| 71 | +// NavigableSet<String> set = lineCode2Devices.get(lineCode); | |
| 72 | +// | |
| 73 | +// List<GpsRealData> rs = new ArrayList<>(); | |
| 74 | +// for(String device : set){ | |
| 75 | +// rs.add(gpsMap.get(device)); | |
| 76 | +// } | |
| 77 | +// | |
| 78 | +// return rs; | |
| 79 | +// } | |
| 80 | +// | |
| 81 | +// public static void LoadGpsRealData() throws Exception { | |
| 82 | +// List<GpsRealData> list = new ArrayList<>(); | |
| 83 | +// CloseableHttpClient httpClient = null; | |
| 84 | +// | |
| 85 | +// try { | |
| 86 | +// httpClient = HttpClients.createDefault(); | |
| 87 | +// HttpGet get = new HttpGet(url); | |
| 88 | +// | |
| 89 | +// CloseableHttpResponse response = httpClient.execute(get); | |
| 90 | +// | |
| 91 | +// try { | |
| 92 | +// HttpEntity entity = response.getEntity(); | |
| 93 | +// if (null != entity) { | |
| 94 | +// // 返回数据量比较大,建议以流的形式读取 | |
| 95 | +// BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 96 | +// StringBuffer stringBuffer = new StringBuffer(); | |
| 97 | +// String str = ""; | |
| 98 | +// while ((str = br.readLine()) != null) | |
| 99 | +// stringBuffer.append(str); | |
| 100 | +// | |
| 101 | +// JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); | |
| 102 | +// | |
| 103 | +// if (jsonObj != null) | |
| 104 | +// list = JSON.parseArray(jsonObj.getString("data"), GpsRealData.class); | |
| 105 | +// | |
| 106 | +// for(GpsRealData gps : list){ | |
| 107 | +// gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps)); | |
| 108 | +// add(gps); | |
| 109 | +// } | |
| 110 | +// } else | |
| 111 | +// logger.error("result is null"); | |
| 112 | +// } finally { | |
| 113 | +// response.close(); | |
| 114 | +// } | |
| 115 | +// | |
| 116 | +// } finally { | |
| 117 | +// if (null != httpClient) | |
| 118 | +// httpClient.close(); | |
| 119 | +// } | |
| 120 | +// } | |
| 121 | +//} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -993,7 +993,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 993 | 993 | map.put("xlName", xlName); |
| 994 | 994 | map.put("clZbh", code); |
| 995 | 995 | map.put("company", obj[0]); |
| 996 | - map.put("requestType", obj[1]); | |
| 996 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1]+"")).toUpperCase()); | |
| 997 | 997 | map.put("requestTime", obj[2]); |
| 998 | 998 | listMap.add(map); |
| 999 | 999 | } | ... | ... |
src/main/resources/static/pages/forms/statement/account.html
| ... | ... | @@ -69,7 +69,8 @@ |
| 69 | 69 | </div> |
| 70 | 70 | |
| 71 | 71 | <script> |
| 72 | - $(function(){ | |
| 72 | + $(function(){ | |
| 73 | + var reqCodeMap = {"0xA1": '请求恢复运营', "0xA2": '申请调档', "0xA3": '出场请求', "0xA5": '进场请求', "0xA7": '加油请求', "0x50": '车辆故障', "0x70": '路阻报告', "0x60": '事故报告', "0x11": '扣证纠纷', "0x12" : '报警'}; | |
| 73 | 74 | // 关闭左侧栏 |
| 74 | 75 | if (!$('body').hasClass('page-sidebar-closed')) |
| 75 | 76 | $('.menu-toggler.sidebar-toggler').click(); |
| ... | ... | @@ -82,6 +83,7 @@ |
| 82 | 83 | $('#line').select2({ |
| 83 | 84 | ajax: { |
| 84 | 85 | url: '/realSchedule/findLine', |
| 86 | + type: 'post', | |
| 85 | 87 | dataType: 'json', |
| 86 | 88 | delay: 150, |
| 87 | 89 | data: function(params){ |
| ... | ... | @@ -161,7 +163,10 @@ |
| 161 | 163 | var date = $("#date").val(); |
| 162 | 164 | var code = $("#code").val(); |
| 163 | 165 | $(".hidden").removeClass("hidden"); |
| 164 | - $get('/realSchedule/account',{line:line,date:date,code:code,xlName:xlName},function(result){ | |
| 166 | + $post('/realSchedule/account',{line:line,date:date,code:code,xlName:xlName},function(result){ | |
| 167 | + $.each(result, function(i, obj) { | |
| 168 | + obj.requestType = reqCodeMap[obj.requestType]; | |
| 169 | + }); | |
| 165 | 170 | // 把数据填充到模版中 |
| 166 | 171 | var tbodyHtml = template('list_account',{list:result}); |
| 167 | 172 | // 把渲染好的模版html文本追加到表格中 | ... | ... |
src/main/resources/static/pages/forms/statement/correctForm.html
| ... | ... | @@ -110,6 +110,7 @@ |
| 110 | 110 | $('#line').select2({ |
| 111 | 111 | ajax: { |
| 112 | 112 | url: '/realSchedule/findLine', |
| 113 | + type: 'post', | |
| 113 | 114 | dataType: 'json', |
| 114 | 115 | delay: 150, |
| 115 | 116 | data: function(params){ |
| ... | ... | @@ -147,6 +148,7 @@ |
| 147 | 148 | $('#lpName').select2({ |
| 148 | 149 | ajax: { |
| 149 | 150 | url: '/realSchedule/findLpName', |
| 151 | + type: 'post', | |
| 150 | 152 | dataType: 'json', |
| 151 | 153 | delay: 150, |
| 152 | 154 | data: function(params){ |
| ... | ... | @@ -226,7 +228,7 @@ |
| 226 | 228 | var endDate = $("#endDate").val(); |
| 227 | 229 | var lpName = $("#lpName").val(); |
| 228 | 230 | var code = $("#code").val(); |
| 229 | - $get("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code},function(result){ | |
| 231 | + $post("/realSchedule/correctForm",{line:line,startDate:startDate,endDate:endDate,lpName:lpName,code:code},function(result){ | |
| 230 | 232 | $("#sDate").text(startDate); |
| 231 | 233 | $("#eDate").text(endDate); |
| 232 | 234 | var temp = {}; | ... | ... |
src/main/resources/static/pages/forms/statement/daily.html