Commit c4ba947c authored by zhuangzhuang's avatar zhuangzhuang

1.24-优化地图坐标算法,优化首页报警查询,优化config回复判断

parent 1b11af02
...@@ -12,7 +12,7 @@ public class HomePageDataABBVo { ...@@ -12,7 +12,7 @@ public class HomePageDataABBVo {
private Integer bump;//颠簸异常 private Integer bump;//颠簸异常
private List<AlarmLogVo> alarmLogVos; // private List<AlarmLogVo> alarmLogVos;
private List<CircuitABBVo> circuitABBVos; private List<CircuitABBVo> circuitABBVos;
...@@ -52,13 +52,13 @@ public class HomePageDataABBVo { ...@@ -52,13 +52,13 @@ public class HomePageDataABBVo {
this.bump = bump; this.bump = bump;
} }
public List<AlarmLogVo> getAlarmLogVos() { // public List<AlarmLogVo> getAlarmLogVos() {
return alarmLogVos; // return alarmLogVos;
} // }
//
public void setAlarmLogVos(List<AlarmLogVo> alarmLogVos) { // public void setAlarmLogVos(List<AlarmLogVo> alarmLogVos) {
this.alarmLogVos = alarmLogVos; // this.alarmLogVos = alarmLogVos;
} // }
public List<CircuitABBVo> getCircuitABBVos() { public List<CircuitABBVo> getCircuitABBVos() {
return circuitABBVos; return circuitABBVos;
......
...@@ -7,15 +7,16 @@ import com.example.tdl.domain.vo.CheckInVo; ...@@ -7,15 +7,16 @@ import com.example.tdl.domain.vo.CheckInVo;
import com.example.tdl.domain.vo.ConfigCMDVo; import com.example.tdl.domain.vo.ConfigCMDVo;
import com.example.tdl.domain.vo.ConfigVo; import com.example.tdl.domain.vo.ConfigVo;
import com.example.tdl.service.ConfigService; import com.example.tdl.service.ConfigService;
import com.example.tdl.web.AlarmController;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.jdbc.Null;
import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.expression.spel.ast.NullLiteral;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -37,6 +38,8 @@ import java.util.concurrent.TimeUnit; ...@@ -37,6 +38,8 @@ import java.util.concurrent.TimeUnit;
@Component @Component
public class MqttListener implements MqttCallback { public class MqttListener implements MqttCallback {
private Logger logger = LoggerFactory.getLogger(MqttListener.class);
private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms
private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms
private static final String CHECKIN_TOPIC = "TDL/+/+/CheckIn"; private static final String CHECKIN_TOPIC = "TDL/+/+/CheckIn";
...@@ -159,6 +162,7 @@ public class MqttListener implements MqttCallback { ...@@ -159,6 +162,7 @@ public class MqttListener implements MqttCallback {
String ConfigData; String ConfigData;
Future<String> result = null; Future<String> result = null;
GWConfigWorker gcconfig = null; GWConfigWorker gcconfig = null;
logger.info(topic+"-----"+ flag);
if(flag == 0){ if(flag == 0){
ConfigCMDVo configCMDVo = new ConfigCMDVo(); ConfigCMDVo configCMDVo = new ConfigCMDVo();
configCMDVo.setAction("sleep"); configCMDVo.setAction("sleep");
...@@ -218,19 +222,19 @@ public class MqttListener implements MqttCallback { ...@@ -218,19 +222,19 @@ public class MqttListener implements MqttCallback {
ConfigVo configVo = configService.getConfig(SN,Type); ConfigVo configVo = configService.getConfig(SN,Type);
//网关不存在 //网关不存在
if(configVo == null){ if(configVo == null){
return 0;//休眠 return 10;//无返回值
} }
CheckInVo checkInVo = new Gson().fromJson(message,CheckInVo.class); CheckInVo checkInVo = new Gson().fromJson(message,CheckInVo.class);
if(configVo.getUntie() && StringUtils.isEmpty(configVo.getMessage()) ){ if(configVo.getUntie() && StringUtils.isEmpty(configVo.getMessage()) ){
return 2;//解绑 return 2;//解绑
} }
if(StringUtils.isEmpty(configVo.getMessage()) && configVo.getUntie() == false){ if(StringUtils.isEmpty(configVo.getMessage()) && configVo.getUntie() == false){
return 0;//休眠 return 10;//无返回值
} }
JsonObject returnData = new JsonParser().parse(message).getAsJsonObject(); JsonObject returnData = new JsonParser().parse(message).getAsJsonObject();
ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class); ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class);
if(configCMDVo == null){ if(configCMDVo == null){
return 0;//休眠 return 10;//无返回值
} }
if(returnData.has("tempL") if(returnData.has("tempL")
&&returnData.has("tempH") &&returnData.has("tempH")
......
...@@ -45,12 +45,12 @@ public class MapUtils { ...@@ -45,12 +45,12 @@ public class MapUtils {
// if((lng1+"") .contains("110.")){ // if((lng1+"") .contains("110.")){
// System.out.println("lng:" + lng1 +" ----lat:" +lat1 +" ----speed:" + speed +" ---time :" +time +" -----distance:"+s); // System.out.println("lng:" + lng1 +" ----lat:" +lat1 +" ----speed:" + speed +" ---time :" +time +" -----distance:"+s);
// } // }
// System.out.println("speed:"+speed); // System.out.println("lng:" + lng1 +" ----lat:" +lat1 +" ----speed:" + speed +" ---time :" +time +" -----distance:"+s);
if(s <1000 || s> 10000){ if(s <1000 || s> 10000){
//计算速度 //计算速度
if(speed>250 || speed <sppeed){ if(speed>250 || speed <sppeed){
// if((lng1+"") .contains("110.")){ // if((lng1+"") .contains("110.")){
// System.out.println("lng:" + lng1 +" ----lat:" +lat1 +" ----speed:" + speed +" ---time :" +time +" -----distance:"+s); // System.out.println("lng:" + lng1 +" ----lat:" +lat1 +" ----speed:" + speed +" ---time :" +time +" -----distance:"+s);
// } // }
return 0; return 0;
} }
......
...@@ -41,7 +41,7 @@ public class BaiduController { ...@@ -41,7 +41,7 @@ public class BaiduController {
JSONObject jsonObject= JSON.parseObject(keyword); JSONObject jsonObject= JSON.parseObject(keyword);
keyword=jsonObject.getString("keyword"); keyword=jsonObject.getString("keyword");
logger.info(keyword); logger.info(keyword);
return HttpRequester.get("http://api.map.baidu.com/place_abroad/v1/search?query=" + keyword + "&page_size=1&page_num=0&scope=1&region=%E5%85%A8%E5%9B%BD&output=json&ak=rzjXpeDvGDDaBkuZxaSChdztTFc4NfC7"); return HttpRequester.get("http://api.map.baidu.com/place_abroad/v1/search?query=" + keyword + "&page_size=1&page_num=0&scope=1&coord_type=3&region=%E5%85%A8%E5%9B%BD&output=json&ak=rzjXpeDvGDDaBkuZxaSChdztTFc4NfC7");
} }
} }
...@@ -499,14 +499,12 @@ public class DataController { ...@@ -499,14 +499,12 @@ public class DataController {
csvWriter.writeRecord(rowsName); csvWriter.writeRecord(rowsName);
List<List<Object>> values = DataUtil.getValues(queryResult); List<List<Object>> values = DataUtil.getValues(queryResult);
for(List<Object> value : values){ for(List<Object> value : values){
// logger.info(value.get(1)==null ? " " :value.get(1).toString() +"---------"+devList.get(i));
if(value.get(1) == null || value.get(1).toString().equals(devList.get(i))){ if(value.get(1) == null || value.get(1).toString().equals(devList.get(i))){
String[] objs = new String[rowsName.length]; String[] objs = new String[rowsName.length];
for (int j = 0; j < objs.length; j++) { for (int j = 0; j < objs.length; j++) {
if(j==0){ if(j==0){
try { try {
objs[j] =timeStamp2Date(new Long(DataUtil.UTCToCST(String.valueOf(value.get(j)),transportationNo.getOffset()))); objs[j] =timeStamp2Date(new Long(DataUtil.UTCToCST(String.valueOf(value.get(j)),transportationNo.getOffset())));
// objs[j] =timeStampDate(new Long(dateToStamp(String.valueOf(value.get(j)))));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
logger.info(e.toString()); logger.info(e.toString());
...@@ -682,125 +680,125 @@ public class DataController { ...@@ -682,125 +680,125 @@ public class DataController {
} }
// @ApiOperation(value = "下载线路数据", notes = "下载线路数据") // @ApiOperation(value = "下载线路数据", notes = "下载线路数据")
// @PostMapping("/downLoad") // @PostMapping("/downLoad")
// @ApiImplicitParams({ // @ApiImplicitParams({
// @ApiImplicitParam(paramType = "header", name = "Account_token", value = "token", required = true, dataType = "String"), // @ApiImplicitParam(paramType = "header", name = "Account_token", value = "token", required = true, dataType = "String"),
// }) // })
// public String downLoad(@RequestBody String transportationNo, HttpServletRequest request){ // public String downLoad(@RequestBody String transportationNo, HttpServletRequest request){
// String token = request.getHeader("Account_token"); // String token = request.getHeader("Account_token");
// String datum = tokenRedisService.get("TOKEN_" + token); // String datum = tokenRedisService.get("TOKEN_" + token);
// UserRedisVo user = gson.fromJson(datum, UserRedisVo.class); // UserRedisVo user = gson.fromJson(datum, UserRedisVo.class);
// if (StringUtils.isEmpty(transportationNo)) { // if (StringUtils.isEmpty(transportationNo)) {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage(i18n.getMessage(request, "transportationNo")); // fb.setMessage(i18n.getMessage(request, "transportationNo"));
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// JSONObject jsonObject = JSON.parseObject(transportationNo); // JSONObject jsonObject = JSON.parseObject(transportationNo);
// transportationNo = jsonObject.getString("transportationNo"); // transportationNo = jsonObject.getString("transportationNo");
// ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo, user.getCompanyNo()); // ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo, user.getCompanyNo());
// if (resultCircuitVo == null) { // if (resultCircuitVo == null) {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage(i18n.getMessage(request, "noCircuit")); // fb.setMessage(i18n.getMessage(request, "noCircuit"));
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// if (resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0) { // if (resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0) {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage(i18n.getMessage(request, "notStarted")); // fb.setMessage(i18n.getMessage(request, "notStarted"));
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// Long startTime = resultCircuitVo.getStartTime() * 1000000l; // Long startTime = resultCircuitVo.getStartTime() * 1000000l;
// TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo); // TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
// if (gatewayVo == null) { // if (gatewayVo == null) {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage(i18n.getMessage(request, "noCircuit")); // fb.setMessage(i18n.getMessage(request, "noCircuit"));
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// String device = gatewayVo.getgType() + "_" + gatewayVo.getgSN(); // String device = gatewayVo.getgType() + "_" + gatewayVo.getgSN();
// //获取tdl信息 // //获取tdl信息
// List<String> devList = tdlLogService.getTdlSN(transportationNo); // List<String> devList = tdlLogService.getTdlSN(transportationNo);
// if (devList.size() == 0) { // if (devList.size() == 0) {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage(i18n.getMessage(request, "noCircuit")); // fb.setMessage(i18n.getMessage(request, "noCircuit"));
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
// OSSClient ossClient = AliyunOSSClientUtil.getOSSClient(); // OSSClient ossClient = AliyunOSSClientUtil.getOSSClient();
// //
// String[] rowsName = new String[]{"时间","压力(MPa)","温度(℃)","湿度(%RH)","震动能量(w)","震动强度(g)","倾斜角度(°)","经度","纬度"}; // String[] rowsName = new String[]{"时间","压力(MPa)","温度(℃)","湿度(%RH)","震动能量(w)","震动强度(g)","倾斜角度(°)","经度","纬度"};
// File file = new File("./export"); // File file = new File("./export");
// if(!file.exists()){ // if(!file.exists()){
// file.mkdir(); // file.mkdir();
// } // }
// try { // try {
// String sqls = ""; // String sqls = "";
// if (resultCircuitVo.getEndTime() != null && resultCircuitVo.getEndTime() != 0) { // if (resultCircuitVo.getEndTime() != null && resultCircuitVo.getEndTime() != 0) {
// sqls = "SELECT \"tdl\",\"p\",\"T\",\"h\",\"a0\",\"a1\",\"ta\",\"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\" WHERE time >=" +startTime +" and time <=" +resultCircuitVo.getEndTime() * 1000000l+" ORDER BY time "; // sqls = "SELECT \"tdl\",\"p\",\"T\",\"h\",\"a0\",\"a1\",\"ta\",\"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\" WHERE time >=" +startTime +" and time <=" +resultCircuitVo.getEndTime() * 1000000l+" ORDER BY time ";
// } else { // } else {
// sqls = "SELECT \"tdl\",\"p\",\"T\",\"h\",\"a0\",\"a1\",\"ta\",\"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\" WHERE time >=" +startTime +" and time <=" +System.currentTimeMillis() * 1000000l+" ORDER BY time "; // sqls = "SELECT \"tdl\",\"p\",\"T\",\"h\",\"a0\",\"a1\",\"ta\",\"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\" WHERE time >=" +startTime +" and time <=" +System.currentTimeMillis() * 1000000l+" ORDER BY time ";
// } // }
// QueryResult queryResult = influxDBTemplate.query(new Query(sqls, database)); // QueryResult queryResult = influxDBTemplate.query(new Query(sqls, database));
// File[] srcFiles = new File[devList.size()]; // File[] srcFiles = new File[devList.size()];
// File zipFile = new File("./export/" +transportationNo+"运输数据.zip"); // File zipFile = new File("./export/" +transportationNo+"运输数据.zip");
// if (queryResult.getResults().get(0).getSeries().get(0) != null) { // if (queryResult.getResults().get(0).getSeries().get(0) != null) {
// //
// for(int i = 0;i<devList.size();i++){ // for(int i = 0;i<devList.size();i++){
// //
// CsvWriter csvWriter = new CsvWriter("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv" , ',', Charset.forName("GB2312")); // CsvWriter csvWriter = new CsvWriter("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv" , ',', Charset.forName("GB2312"));
// csvWriter.writeRecord(rowsName); // csvWriter.writeRecord(rowsName);
// List<List<Object>> values = getValues(queryResult); // List<List<Object>> values = getValues(queryResult);
// for(List<Object> value : values){ // for(List<Object> value : values){
//// logger.info(value.get(1)==null ? " " :value.get(1).toString() +"---------"+devList.get(i)); //// logger.info(value.get(1)==null ? " " :value.get(1).toString() +"---------"+devList.get(i));
// if(value.get(1) == null || value.get(1).toString().equals(devList.get(i))){ // if(value.get(1) == null || value.get(1).toString().equals(devList.get(i))){
// String[] objs = new String[rowsName.length]; // String[] objs = new String[rowsName.length];
// for (int j = 0; j < objs.length; j++) { // for (int j = 0; j < objs.length; j++) {
// if(j==0){ // if(j==0){
// try { // try {
// objs[j] =timeStampDate(new Long(UTCToCST(String.valueOf(value.get(j))))); // objs[j] =timeStampDate(new Long(UTCToCST(String.valueOf(value.get(j)))));
//// objs[j] =timeStampDate(new Long(dateToStamp(String.valueOf(value.get(j))))); //// objs[j] =timeStampDate(new Long(dateToStamp(String.valueOf(value.get(j)))));
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// logger.info(e.toString()); // logger.info(e.toString());
// fb.setMessage("时间解析异常"); // fb.setMessage("时间解析异常");
// } // }
// }else { // }else {
// objs[j] =value.get(j+1) == null ? "-" :value.get(j+1).toString(); // objs[j] =value.get(j+1) == null ? "-" :value.get(j+1).toString();
// } // }
// } // }
// csvWriter.writeRecord(objs); // csvWriter.writeRecord(objs);
// csvWriter.flush(); // csvWriter.flush();
// } // }
// } // }
// csvWriter.close(); // csvWriter.close();
// srcFiles[i]=new File("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv"); // srcFiles[i]=new File("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv");
// } // }
// } // }
// //
// ZipCompressUtil.zipFiles(srcFiles,zipFile); // ZipCompressUtil.zipFiles(srcFiles,zipFile);
// try { // try {
// String md5Key = AliyunOSSClientUtil.uploadObject2OSS(ossClient, zipFile); // String md5Key = AliyunOSSClientUtil.uploadObject2OSS(ossClient, zipFile);
// if (md5Key != null) { // if (md5Key != null) {
// for(int a =0;a<srcFiles.length;a++){ // for(int a =0;a<srcFiles.length;a++){
// srcFiles[a].delete(); // srcFiles[a].delete();
// } // }
// zipFile.delete(); // zipFile.delete();
// fb.setCode(1); // fb.setCode(1);
// fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/circuit/"+transportationNo+"运输数据.zip"); // fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/circuit/"+transportationNo+"运输数据.zip");
// return gson.toJson(fb); // return gson.toJson(fb);
// } else { // } else {
// fb.setCode(0); // fb.setCode(0);
// fb.setMessage("上传失败"); // fb.setMessage("上传失败");
// } // }
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// logger.info(e.toString()); // logger.info(e.toString());
// } // }
// }catch (Exception e){ // }catch (Exception e){
// e.printStackTrace(); // e.printStackTrace();
// logger.info(e.toString()); // logger.info(e.toString());
// } // }
// //
// return gson.toJson(fb); // return gson.toJson(fb);
// } // }
//解析数据 //解析数据
...@@ -843,39 +841,19 @@ public class DataController { ...@@ -843,39 +841,19 @@ public class DataController {
}else{ }else{
if(i == 0){ if(i == 0){
String time1 = DataUtil.parseTime(values.get(i).get(0).toString()); String time1 = DataUtil.parseTime(values.get(i).get(0).toString());
String time2 = DataUtil.parseTime(values.get(i+1).get(0).toString());
String time3 = DataUtil.parseTime(values.get(i+2).get(0).toString());
String time4 = DataUtil.parseTime(values.get(i+3).get(0).toString());
Double lng1 = Double.parseDouble(values.get(i).get(1).toString()); Double lng1 = Double.parseDouble(values.get(i).get(1).toString());
Double lat1 = Double.parseDouble(values.get(i).get(2).toString()); Double lat1 = Double.parseDouble(values.get(i).get(2).toString());
Double lng2 = Double.parseDouble(values.get(i+1).get(1).toString()); historyData.setTime(time1);
Double lat2 = Double.parseDouble(values.get(i+1).get(2).toString()); historyData.setLng(lng1);
Double lng3 = Double.parseDouble(values.get(i+2).get(1).toString()); historyData.setLat(lat1);
Double lat3 = Double.parseDouble(values.get(i+2).get(2).toString());
Double lng4 = Double.parseDouble(values.get(i+3).get(1).toString());
Double lat4 = Double.parseDouble(values.get(i+3).get(2).toString());
//获取运行时间
Double speed1 = MapUtils.getSpeed(lat1, lng1,lat2,lng2,(Long.valueOf(time2)-Long.valueOf(time1))/1000,sppeed);
Double speed2 = MapUtils.getSpeed(lat2, lng2,lat3,lng3,(Long.valueOf(time3)-Long.valueOf(time2))/1000,sppeed);
Double speed3 = MapUtils.getSpeed(lat3, lng3,lat4,lng4,(Long.valueOf(time4)-Long.valueOf(time3))/1000,sppeed);
//对比三个速度值,如果三者相差很小直接忽略
Math.abs(speed1-speed2) ;
Math.abs(speed3-speed2);
if(speed1 != 0 &&speed2 !=0 && speed3!=0 && Math.abs(Math.abs(speed1-speed2) -Math.abs(speed3-speed2)) <50){
historyData.setTime(time1);
historyData.setLng(lng1);
historyData.setLat(lat1);
}else{
continue;
}
}else{ }else{
String time1 = DataUtil.parseTime(values.get(i).get(0).toString()); String time1 = DataUtil.parseTime(values.get(i).get(0).toString());
String time2 = DataUtil.parseTime(values.get(i+1).get(0).toString()); String time2 = DataUtil.parseTime(values.get(i-1).get(0).toString());
Double lng1 = Double.parseDouble(values.get(i).get(1).toString()); Double lng1 = Double.parseDouble(values.get(i).get(1).toString());
Double lat1 = Double.parseDouble(values.get(i).get(2).toString()); Double lat1 = Double.parseDouble(values.get(i).get(2).toString());
Double lng2 = Double.parseDouble(values.get(i+1).get(1).toString()); Double lng2 = Double.parseDouble(values.get(i-1).get(1).toString());
Double lat2 = Double.parseDouble(values.get(i+1).get(2).toString()); Double lat2 = Double.parseDouble(values.get(i-1).get(2).toString());
Double speed2 = MapUtils.getSpeed(lat1, lng1,lat2,lng2,(Long.valueOf(time2)-Long.valueOf(time1))/1000,sppeed); Double speed2 = MapUtils.getSpeed(lat1, lng1,lat2,lng2,(Long.valueOf(time1)-Long.valueOf(time2))/1000,sppeed);
if(speed2 >0){ if(speed2 >0){
historyData.setTime(time1); historyData.setTime(time1);
historyData.setLng(lng1); historyData.setLng(lng1);
...@@ -884,8 +862,8 @@ public class DataController { ...@@ -884,8 +862,8 @@ public class DataController {
continue; continue;
} }
} }
} }
historyDataList.add(historyData); historyDataList.add(historyData);
} }
if(historyDataList.size() == 0){ if(historyDataList.size() == 0){
...@@ -930,7 +908,7 @@ public class DataController { ...@@ -930,7 +908,7 @@ public class DataController {
HistoryData altitudeData = new HistoryData(); HistoryData altitudeData = new HistoryData();
altitudeData.setTime(time); altitudeData.setTime(time);
//大气压力(kPa A) =101.325*(1-0.02257*海拔)^5.256 //大气压力(kPa A) =101.325*(1-0.02257*海拔)^5.256
// Double height = 44300*(1-(Math.pow((Double.parseDouble(df.format(Float.valueOf(press)))/1013.25), (float)1/5.256))); // Double height = 44300*(1-(Math.pow((Double.parseDouble(df.format(Float.valueOf(press)))/1013.25), (float)1/5.256)));
Double height = 44300*(1-(Math.pow((Double.parseDouble(df.format(Float.valueOf(press)-10f))/1013.25), (float)1/5.256))); //气压临时减去10 Double height = 44300*(1-(Math.pow((Double.parseDouble(df.format(Float.valueOf(press)-10f))/1013.25), (float)1/5.256))); //气压临时减去10
altitudeData.setValue(df.format(height).toString()); altitudeData.setValue(df.format(height).toString());
pressureDataList.add(pressureData); pressureDataList.add(pressureData);
...@@ -995,15 +973,15 @@ public class DataController { ...@@ -995,15 +973,15 @@ public class DataController {
//解析震动时间 //解析震动时间
public List<String> getTime(QueryResult queryResult) { public List<String> getTime(QueryResult queryResult) {
// for (List<Object> value : values) { // for (List<Object> value : values) {
// try { // try {
// //判断两个时间相差是否超过一分钟 // //判断两个时间相差是否超过一分钟
// //
// time.add(DataUtil.UTCToCST(value.get(0).toString(),"+8")); // time.add(DataUtil.UTCToCST(value.get(0).toString(),"+8"));
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// logger.info(e.toString()); // logger.info(e.toString());
// } // }
// } // }
List<List<Object>> values = DataUtil.getValues(queryResult); List<List<Object>> values = DataUtil.getValues(queryResult);
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
for(int i = 0,length=values.size();i<length;i++){ for(int i = 0,length=values.size();i<length;i++){
......
...@@ -240,7 +240,7 @@ public class HomePageController { ...@@ -240,7 +240,7 @@ public class HomePageController {
dataVo.setOnRoute(circuitABBService.getOnRoute(user.getCompanyNo()));//在途数量 dataVo.setOnRoute(circuitABBService.getOnRoute(user.getCompanyNo()));//在途数量
dataVo.setAlarmed(alarmLogServcie.getCount(time,user.getCompanyNo()));//报警数量 dataVo.setAlarmed(alarmLogServcie.getCount(time,user.getCompanyNo()));//报警数量
dataVo.setBump(alarmLogServcie.getBumpCount(time,user.getCompanyNo())); //获取颠簸数量 dataVo.setBump(alarmLogServcie.getBumpCount(time,user.getCompanyNo())); //获取颠簸数量
dataVo.setAlarmLogVos(alarmLogServcie.getAlarmLog(time,user.getCompanyNo()));//报警列表 // dataVo.setAlarmLogVos(alarmLogServcie.getAlarmLog(time,user.getCompanyNo()));//报警列表
dataVo.setWarehouseVoList(warehouseService.getAll(user.getCompanyNo())); dataVo.setWarehouseVoList(warehouseService.getAll(user.getCompanyNo()));
//获取设备的当前位置 //获取设备的当前位置
...@@ -261,12 +261,12 @@ public class HomePageController { ...@@ -261,12 +261,12 @@ public class HomePageController {
String sql = "SELECT \"bdlng\",\"bdlat\" FROM \"tdl_policy\".\"" + device + "\" where \"data_type\" = 'location' and time >= " + startTime + " ORDER BY time desc limit 1"; String sql = "SELECT \"bdlng\",\"bdlat\" FROM \"tdl_policy\".\"" + device + "\" where \"data_type\" = 'location' and time >= " + startTime + " ORDER BY time desc limit 1";
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
if (queryResult.getResults().get(0).getSeries() != null) { if (queryResult.getResults().get(0).getSeries() != null) {
circuitVos.get(i).setTime(parseTime(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString())); // circuitVos.get(i).setTime(parseTime(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString()));
circuitVos.get(i).setLng(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); circuitVos.get(i).setLng(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString());
circuitVos.get(i).setLat(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString()); circuitVos.get(i).setLat(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString());
} }
}else { }else {
circuitVos.get(i).setTime(null); // circuitVos.get(i).setTime(null);
circuitVos.get(i).setLng(null); circuitVos.get(i).setLng(null);
circuitVos.get(i).setLat(null); circuitVos.get(i).setLat(null);
} }
......
spring.datasource.url=jdbc:mysql://witcloud-mariadb:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false #spring.datasource.url=jdbc:mysql://witcloud-mariadb:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8092
#spring.datasource.url=jdbc:mysql://witcloud-mysql:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=37774020 #spring.datasource.password=37774020
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver #spring.datasource.driver-class-name=com.mysql.jdbc.Driver
server.port=8092
spring.datasource.url=jdbc:mysql://witcloud-mysql:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
tdl.redis.host = witcloud-redis tdl.redis.host = witcloud-redis
#tdl.redis.password=witium #tdl.redis.password=witium
...@@ -22,10 +22,10 @@ tdl.mqtt.port = 8883 ...@@ -22,10 +22,10 @@ tdl.mqtt.port = 8883
tdl.mqtt.username = logistics tdl.mqtt.username = logistics
tdl.mqtt.password = logistics37774020 tdl.mqtt.password = logistics37774020
#tdl.core.add =http://logisticscore-java:8079/witium/addMount tdl.core.add =http://logisticscore-java:8079/witium/addMount
#tdl.core.delete =http://logisticscore-java:8079/witium/delMount tdl.core.delete =http://logisticscore-java:8079/witium/delMount
tdl.core.add =http://abb-herocore:8079/witium/addMount #tdl.core.add =http://abb-herocore:8079/witium/addMount
tdl.core.delete =http://abb-herocore:8079/witium/delMount #tdl.core.delete =http://abb-herocore:8079/witium/delMount
mqtt.userName = wtlogistics mqtt.userName = wtlogistics
mqtt.password = wtlogistics mqtt.password = wtlogistics
\ No newline at end of file
spring.datasource.url=jdbc:mysql://192.168.1.14:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://47.110.153.44:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.url=jdbc:mysql://192.168.1.14:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=37774020 spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
...@@ -7,7 +8,9 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver ...@@ -7,7 +8,9 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30 threadpool.corepoolsize = 30
threadpool.maxpoolsize = 50 threadpool.maxpoolsize = 50
server.port=8888
#server.port=9092
server.port=8092
management.security.enabled=false management.security.enabled=false
...@@ -52,7 +55,8 @@ tdl.mqtt.clientcrt = witcd.crt ...@@ -52,7 +55,8 @@ tdl.mqtt.clientcrt = witcd.crt
# InfluxDB # InfluxDB
spring.influxdb.username=admin spring.influxdb.username=admin
spring.influxdb.password=37774020 spring.influxdb.password=37774020
spring.influxdb.url=http://47.97.184.225:8086 #spring.influxdb.url=http://47.97.184.225:8086
spring.influxdb.url=http://47.110.153.44:8086
spring.influxdb.database=original spring.influxdb.database=original
spring.influxdb.retentionPolicy = tdl_policy spring.influxdb.retentionPolicy = tdl_policy
spring.influxdb.connent-timeout=10 spring.influxdb.connent-timeout=10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment