Commit 4b485e45 authored by zhuangzhuang's avatar zhuangzhuang

8.8-增加仓库环境下网关传输数据间隔时间的配置;

     增加下载线路历史数据的接口;
parent ed7bc3e7
......@@ -30,6 +30,7 @@ public class MyWebMvcConfigurer extends WebMvcConfigurerAdapter {
.excludePathPatterns("/login/**")
.excludePathPatterns("/alarmLog/addAlarmLog")
.excludePathPatterns("/side/**")
.excludePathPatterns("/downLoad")
.excludePathPatterns("/test")
.excludePathPatterns("/getData");
super.addInterceptors(registry);
......
......@@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
public class MqttListener implements MqttCallback {
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 String CHECKIN_TOPIC = "CY/+/+/CheckIn";
private static final String CHECKIN_TOPIC = "TDL/+/+/CheckIn";
private MqttTemlateAsync mqttAsyncClient;
......
......@@ -38,6 +38,8 @@ public class AliyunOSSClientUtil {
private static String FOLDER5;
private static String FOLDER6;
private static CannedAccessControlList acl_pub_readwrite = CannedAccessControlList.PublicReadWrite;
//初始化属性
......@@ -51,6 +53,7 @@ public class AliyunOSSClientUtil {
FOLDER3 = OSSClientConstants.FOLDER3;
FOLDER4 = OSSClientConstants.FOLDER4;
FOLDER5 = OSSClientConstants.FOLDER5;
FOLDER6 = OSSClientConstants.FOLDER6;
}
public static String getENDPOINT() {
......@@ -125,6 +128,14 @@ public class AliyunOSSClientUtil {
AliyunOSSClientUtil.FOLDER5 = FOLDER5;
}
public static String getFOLDER6() {
return FOLDER6;
}
public static void setFOLDER6(String FOLDER6) {
AliyunOSSClientUtil.FOLDER6 = FOLDER6;
}
/**
* 获取阿里云OSS客户端对象
* @return ossClient
......@@ -365,7 +376,7 @@ public class AliyunOSSClientUtil {
if(fileName.contains("时") && fileName.contains("分") && fileName.contains("秒")){
putResult = ossClient.putObject(BACKET_NAME, FOLDER3+ fileName, is, metadata);
} else if(fileName.contains("CHN")){
putResult = ossClient.putObject(BACKET_NAME, FOLDER4+ fileName, is, metadata);
putResult = ossClient.putObject(BACKET_NAME, FOLDER6+ fileName, is, metadata);
} else if(fileName.contains("仓库温湿度观测记录")){
putResult = ossClient.putObject(BACKET_NAME, FOLDER5+ fileName, is, metadata);
} else {
......
......@@ -28,6 +28,8 @@ public class OSSClientConstants {
public static final String FOLDER5="warehouse/";//仓库数据下载
public static final String FOLDER6="circuit/";//线路数据下载
//公共读写
private static final CannedAccessControlList acl_pub_readwrite = CannedAccessControlList.PublicReadWrite;
......
......@@ -58,4 +58,55 @@ public class ZipCompressUtil {
}
}
public static void zipFiles(File[] srcFiles, File zipFile) {
// 判断压缩后的文件存在不,不存在则创建
if (!zipFile.exists()) {
try {
zipFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
// 创建 FileOutputStream 对象
FileOutputStream fileOutputStream = null;
// 创建 ZipOutputStream
ZipOutputStream zipOutputStream = null;
// 创建 FileInputStream 对象
FileInputStream fileInputStream = null;
try {
// 实例化 FileOutputStream 对象
fileOutputStream = new FileOutputStream(zipFile);
// 实例化 ZipOutputStream 对象
zipOutputStream = new ZipOutputStream(fileOutputStream);
// 创建 ZipEntry 对象
ZipEntry zipEntry = null;
// 遍历源文件数组
for (int i = 0; i < srcFiles.length; i++) {
// 将源文件数组中的当前文件读入 FileInputStream 流中
fileInputStream = new FileInputStream(srcFiles[i]);
// 实例化 ZipEntry 对象,源文件数组中的当前文件
zipEntry = new ZipEntry(srcFiles[i].getName());
zipOutputStream.putNextEntry(zipEntry);
// 该变量记录每次真正读的字节个数
int len;
// 定义每次读取的字节数组
byte[] buffer = new byte[1024];
while ((len = fileInputStream.read(buffer)) > 0) {
zipOutputStream.write(buffer, 0, len);
}
}
zipOutputStream.closeEntry();
zipOutputStream.close();
fileInputStream.close();
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -11,6 +11,7 @@ import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.AlarmRule;
import com.google.gson.Gson;
import com.sun.org.apache.regexp.internal.RE;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -86,6 +87,12 @@ public class CircuitController {
@Autowired
private I18nController i18n;
@Autowired
private TopicService topicService;
@Autowired
private TopicConfigService topicConfigService;
private final static String database ="original";
......@@ -427,11 +434,11 @@ public class CircuitController {
//根据时间和运输编号获取报警信息
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
cityVo.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime(),request));
}else{
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo.setAlarmCount(count);
cityVo.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
cityVo.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime(),request));
}
}
cityVoList.add(cityVo);
......@@ -472,7 +479,7 @@ public class CircuitController {
if(list.get(i).getStartTime() == null ||list.get(i).getStartTime() ==0){
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), System.currentTimeMillis());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getArrivalTime()));
cityVo2.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getArrivalTime(),request));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
......@@ -485,7 +492,7 @@ public class CircuitController {
}else{
Integer count2 = alarmLogService.getByTime(transportationNo, list.get(i).getArrivalTime(), list.get(i).getStartTime());
cityVo2.setAlarmCount(count2);
cityVo2.setLast(getMistiming(list.get(i ).getStartTime(),list.get(i).getArrivalTime()));
cityVo2.setLast(getMistiming(list.get(i ).getStartTime(),list.get(i).getArrivalTime(),request));
cityVoList.add(cityVo2);
ResultCityVo cityVo1 = new ResultCityVo();
cityVo1.setCity(list.get(i).getCity());
......@@ -495,12 +502,12 @@ public class CircuitController {
if(list.get(i + 1).getArrivalTime() == null ||list.get(i + 1).getArrivalTime() ==0){
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), System.currentTimeMillis());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime()));
cityVo1.setLast(getMistiming(System.currentTimeMillis(),list.get(i).getStartTime(),request));
cityVoList.add(cityVo1);
}else {
Integer count = alarmLogService.getByTime(transportationNo, list.get(i).getStartTime(), list.get(i + 1).getArrivalTime());
cityVo1.setAlarmCount(count);
cityVo1.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime()));
cityVo1.setLast(getMistiming(list.get(i + 1).getArrivalTime(),list.get(i).getStartTime(),request));
cityVoList.add(cityVo1);
}
}
......@@ -945,6 +952,22 @@ public class CircuitController {
//增加配置(公司以及线路信息)
AlarmMqttConfig alarmMqttConfig = new AlarmMqttConfig(transportationNo,companyVo.getCompanyNo());
infoRedisService.hmSet("AlarmMqttConfig",type+"_"+addCircuitVo.getSN(),gson.toJson(alarmMqttConfig));
List<ResultTopicVo> topicList = topicService.getByGateway(new GatewaySNAndTypeVo(addCircuitVo.getSN(),type));
for (ResultTopicVo topic : topicList) {
infoRedisService.delHashKey("TopicConfig", topic.getTopicName());
//配置发布还是订阅
ProbesConfigVo channel_config = new ProbesConfigVo();
//根据设备的主题名,获取所有的通道
List<ResultTopicConfigVo> devChannelList = topicConfigService.getProbes(topic.getTopicName(),addCircuitVo.getSN(),type);
List<ChannelConfigVo> channelConfigs = new ArrayList<>();
for (ResultTopicConfigVo devChannel : devChannelList) {
ChannelConfigVo channelConfig = new ChannelConfigVo(devChannel.getPort(),devChannel.getUnti(),devChannel.getDescription(),devChannel.getAlias());
channelConfigs.add(channelConfig);
}
channel_config.setIntervalTime(topic.getIntervalTime());
channel_config.setChannelConfigs(channelConfigs);
infoRedisService.hmSet("TopicConfig", topic.getTopicName(), channel_config.toString());
}
}else {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"circuitFailure"));
......@@ -953,7 +976,6 @@ public class CircuitController {
}
@ApiOperation(value = "添加线路信息----mobile",notes = "添加线路信息," +
" cargoNo:货物编号," +
" plateNo:车牌号," +
......@@ -1588,7 +1610,7 @@ public class CircuitController {
//两个时间戳之间相差多少
public String getMistiming(Long startTime,Long arrivalTime){
public String getMistiming(Long startTime,Long arrivalTime,HttpServletRequest request){
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
......@@ -1603,7 +1625,7 @@ public class CircuitController {
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟" +sec +"秒";
return day + i18n.getMessage(request,"day")+" " + hour + i18n.getMessage(request,"hour") +" " + min +i18n.getMessage(request,"min") ;
}
......
......@@ -3,6 +3,8 @@ package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.OSSClient;
import com.csvreader.CsvWriter;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.service.*;
......@@ -10,7 +12,9 @@ import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.RealRedisService;
import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.AliyunOSSClientUtil;
import com.example.tdl.util.DataUtil;
import com.example.tdl.util.ZipCompressUtil;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -29,6 +33,8 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.data.influxdb.InfluxDBTemplate;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.nio.charset.Charset;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -45,7 +51,6 @@ public class DataController {
@Autowired
private TDLDeviceService tdlDeviceService;
@Autowired
private InfoRedisService infoRedisService;
......@@ -391,7 +396,7 @@ public class DataController {
}
JSONObject jsonObject = JSON.parseObject(transportationNo);
transportationNo = jsonObject.getString("transportationNo");
return DataUtil.getData(transportationNo,request,i18n,user.getCompanyNo(),circuitService,tdlLogService,influxDBTemplate,database,"\"ta\"","Tilt event");
return DataUtil.getData(transportationNo,request,i18n,user.getCompanyNo(),circuitService,tdlLogService,influxDBTemplate,database,"\"ta\"","TIlt event");
}
......@@ -456,6 +461,124 @@ public class DataController {
}
//下载数据
@ApiOperation(value = "下载线路数据", notes = "下载线路数据")
@PostMapping("/downLoad")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
public String downLoad(@RequestBody String transportationNo, HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" + token);
UserRedisVo user = gson.fromJson(datum, UserRedisVo.class);
if (StringUtils.isEmpty(transportationNo)) {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "transportationNo"));
return gson.toJson(fb);
}
JSONObject jsonObject = JSON.parseObject(transportationNo);
transportationNo = jsonObject.getString("transportationNo");
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo, user.getCompanyNo());
if (resultCircuitVo == null) {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "noCircuit"));
return gson.toJson(fb);
}
if (resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0) {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "notStarted"));
return gson.toJson(fb);
}
Long startTime = resultCircuitVo.getStartTime() * 1000000l;
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if (gatewayVo == null) {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "noCircuit"));
return gson.toJson(fb);
}
String device = gatewayVo.getgType() + "_" + gatewayVo.getgSN();
//获取tdl信息
List<String> devList = tdlLogService.getTdlSN(transportationNo);
if (devList.size() == 0) {
fb.setCode(0);
fb.setMessage(i18n.getMessage(request, "noCircuit"));
return gson.toJson(fb);
}
OSSClient ossClient = AliyunOSSClientUtil.getOSSClient();
String[] rowsName = new String[]{"时间","压力(MPa)","温度(℃)","湿度(%RH)","震动能量(w)","震动强度(g)","倾斜角度(°)","经度","纬度"};
File file = new File("./export");
if(!file.exists()){
file.mkdir();
}
try {
String sqls = "";
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 ";
} 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 ";
}
QueryResult queryResult = influxDBTemplate.query(new Query(sqls, database));
File[] srcFiles = new File[devList.size()];
File zipFile = new File("./export/" +transportationNo+"运输数据.zip");
if (queryResult.getResults().get(0).getSeries().get(0) != null) {
for(int i = 0;i<devList.size();i++){
CsvWriter csvWriter = new CsvWriter("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv" , ',', Charset.forName("GB2312"));
csvWriter.writeRecord(rowsName);
List<List<Object>> values = getValues(queryResult);
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))){
String[] objs = new String[rowsName.length];
for (int j = 0; j < objs.length; j++) {
if(j==0){
try {
objs[j] =timeStampDate(new Long(dateToStamp(String.valueOf(value.get(j)))));
} catch (Exception e) {
e.printStackTrace();
fb.setMessage("时间解析异常");
}
}else {
objs[j] =value.get(j+1) == null ? "-" :value.get(j+1).toString();
}
}
csvWriter.writeRecord(objs);
csvWriter.flush();
}
}
csvWriter.close();
srcFiles[i]=new File("./export/"+devList.get(i).replace("TDL-", "").trim()+"运输数据.csv");
}
}
ZipCompressUtil.zipFiles(srcFiles,zipFile);
try {
String md5Key = AliyunOSSClientUtil.uploadObject2OSS(ossClient, zipFile);
if (md5Key != null) {
for(int a =0;a<srcFiles.length;a++){
srcFiles[a].delete();
}
zipFile.delete();
fb.setCode(1);
fb.setMessage("https://tdlcloud.oss-cn-shanghai.aliyuncs.com/circuit/"+transportationNo+"运输数据.zip");
return gson.toJson(fb);
} else {
fb.setCode(0);
fb.setMessage("上传失败");
}
} catch (Exception e) {
e.printStackTrace();
logger.info(e.toString());
}
}catch (Exception e){
e.printStackTrace();
logger.info(e.toString());
}
return gson.toJson(fb);
}
//解析数据
public List<LocationDataVo> getLocation(QueryResult queryResult) {
List<List<Object>> values = getValues(queryResult);
......@@ -561,6 +684,11 @@ public class DataController {
return sdf.format(new Date(seconds));
}
public static String timeStampDate(Long seconds) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
return sdf.format(new Date(seconds));
}
//解析震动时间
public List<String> getTime(QueryResult queryResult) {
List<List<Object>> values = getValues(queryResult);
......
......@@ -7,6 +7,7 @@ import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.service.*;
import com.example.tdl.service.redis.AlarmRedisService;
import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.AlarmRule;
import com.google.gson.Gson;
......@@ -58,6 +59,15 @@ public class EquipmentBindingController {
@Autowired
private WarehouseService warehouseService;
@Autowired
private InfoRedisService infoRedisService;
@Autowired
private TopicConfigService topicConfigService;
@Autowired
private TopicService topicService;
@Autowired
private I18nController i18n;
......@@ -198,6 +208,26 @@ public class EquipmentBindingController {
fb.setMessage("配置网关成功");
//根据报警类型货报警信息
AlarmRule.saveAlarmRule("TDL/"+bindingVo.getType()+"/" +bindingVo.getgSN()+"/Data",bindingVo.getTDLSN(),bindingVo.getAlarmType(),user.getCompanyNo(),alarmService,alarmRedisService);
List<ResultTopicVo> topicList = topicService.getByGateway(new GatewaySNAndTypeVo(bindingVo.getgSN(),bindingVo.getType()));
for (ResultTopicVo topic : topicList) {
infoRedisService.delHashKey("TopicConfig", topic.getTopicName());
//配置发布还是订阅
ProbesConfigVo channel_config = new ProbesConfigVo();
//根据设备的主题名,获取所有的通道
List<ResultTopicConfigVo> devChannelList = topicConfigService.getProbes(topic.getTopicName(),bindingVo.getgSN(),bindingVo.getType());
List<ChannelConfigVo> channelConfigs = new ArrayList<>();
for (ResultTopicConfigVo devChannel : devChannelList) {
ChannelConfigVo channelConfig = new ChannelConfigVo(devChannel.getPort(),devChannel.getUnti(),devChannel.getDescription(),devChannel.getAlias());
channelConfigs.add(channelConfig);
}
if(bindingVo.getMode()==2){
channel_config.setIntervalTime(3600000);
}else if(bindingVo.getMode()==1){
channel_config.setIntervalTime(topic.getIntervalTime());
}
channel_config.setChannelConfigs(channelConfigs);
infoRedisService.hmSet("TopicConfig", topic.getTopicName(), channel_config.toString());
}
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
......
......@@ -61,7 +61,6 @@ public class LoginController {
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = true, dataType = "String"),
})
public String loginForToken(@RequestBody LoginUserVo loginUserVo, HttpServletRequest request, HttpServletResponse response) {
String port =request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(loginUserVo.getUserName())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"userName"));
......
......@@ -60,8 +60,8 @@ public class SideController {
List<ResultSideVo> sliderTitleVoList=sideService.selectAllTitle(user.getRoleName(),user.getCompanyNo());
Set<String> l=new HashSet<>();
for (int i=0;i<sliderTitleVoList.size();i++){
l.add(i18n.getMessage(request,sliderTitleVoList.get(i).getpName().replace(" ","")));
l.add(i18n.getMessage(request,sliderTitleVoList.get(i).getSideTitle().replace(" ","")));
l.add(sliderTitleVoList.get(i).getpName());
l.add(sliderTitleVoList.get(i).getSideTitle());
}
return l;
}
......
......@@ -1033,14 +1033,13 @@ public class WarehouseController {
}
List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getgSN(),gatewayOnLineVos.get(a).getType());
List<WarehouseDataVo> warehouseDataVos=new ArrayList<>();
for (int b=0;b<tdls.size();b++){
List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos = new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos1 = new ArrayList<>();
WarehouseDataVo warehouseDataVo=new WarehouseDataVo();
warehouseDataVo.setTDLSN(tdls.get(b).replace("TDL-","").trim());
String sqls ="SELECT \"tdl\",\"b\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time ";
String sqls ="SELECT \"tdl\",\"b\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time desc limit 1 ";
QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database));
ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseNo,gatewayOnLineVos.get(a).getgSN(),tdls.get(b).replace("TDL-","").trim());
if (queryResults.getResults().get(0).getSeries() != null) {
......@@ -1054,10 +1053,12 @@ public class WarehouseController {
warehouseDataVo.setTemperature("NA");
warehouseDataVo.setHumidity("NA");
}
if(queryResults.getResults().get(0).getSeries() != null){
String sql3 ="SELECT \"tdl\",\"b\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time ";
QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3, database));
if(queryResult3.getResults().get(0).getSeries() != null){
//解析数据
WarehouseTDLDetailVo warehouseTDLDetailVo=new WarehouseTDLDetailVo();
warehouseTimeAndDataVos = getData(queryResults);
warehouseTimeAndDataVos = getData(queryResult3);
warehouseTDLDetailVo.setDescription("temperature");
warehouseTDLDetailVo.setTimeAndValuesVos(warehouseTimeAndDataVos);
warehouseTDLDetailVo.setMax(resultAlarmVo.getTemMax());
......@@ -1065,7 +1066,7 @@ public class WarehouseController {
warehouseTDLDetailVos.add(warehouseTDLDetailVo);
WarehouseTDLDetailVo warehouseTDLDetailVo1=new WarehouseTDLDetailVo();
warehouseTimeAndDataVos1 = getDatas(queryResults);
warehouseTimeAndDataVos1 = getDatas(queryResult3);
warehouseTDLDetailVo1.setDescription("humidity");
warehouseTDLDetailVo1.setTimeAndValuesVos(warehouseTimeAndDataVos1);
warehouseTDLDetailVo1.setMax(resultAlarmVo.getHumidityMax());
......
spring.datasource.url=jdbc:mysql://192.168.1.16:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url=jdbc:mysql://47.97.184.225: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
......@@ -37,7 +37,7 @@ logging.config=classpath:logback.xml
# Mqtt
tdl.mqtt.url = ssl://192.168.1.11
tdl.mqtt.url = ssl://192.168.1.12
tdl.mqtt.port = 8883
tdl.mqtt.username = ugen
tdl.mqtt.password = ugen
......
......@@ -262,6 +262,10 @@ warehouseHardwareLevel1=Excelent
warehouseHardwareLevel2=Good
warehouseHardwareLevel3=Fair
warehouseHardwareLevel4=Poor
day=Day
hour=Hour
min=Min
sec=Sec
DataOverview=Data Overview
TransportationState=Transportation State
......
......@@ -283,6 +283,10 @@ warehouseHardwareLevel1 = \u4F18
warehouseHardwareLevel2 = \u826F
warehouseHardwareLevel3 =\u4E2D
warehouseHardwareLevel4 = \u5DEE
day =\u5929
hour =\u5C0F\u65F6
min =\u5206\u949F
sec = \u79D2
DataOverview=\u6570\u636E\u6982\u89C8
TransportationState=\u8FD0\u8F93\u72B6\u6001
......
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