Commit 2441df6c authored by zhuangzhuang's avatar zhuangzhuang

增加仓库历史数据的结束时间查询

parent 7a4b8cbd
...@@ -999,6 +999,7 @@ public class WarehouseController { ...@@ -999,6 +999,7 @@ public class WarehouseController {
} }
List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>(); List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>();
List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseVo.getWarehouseNo()); List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseVo.getWarehouseNo());
Long endTime = System.currentTimeMillis() +2*24*3600*1000l;
for (int a=0;a<gatewayOnLineVos.size();a++){ for (int a=0;a<gatewayOnLineVos.size();a++){
if(gatewayOnLineVos.get(a) == null){ if(gatewayOnLineVos.get(a) == null){
continue; continue;
...@@ -1035,7 +1036,7 @@ public class WarehouseController { ...@@ -1035,7 +1036,7 @@ public class WarehouseController {
List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>(); List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>();
WarehouseDataVo warehouseDataVo=new WarehouseDataVo(); WarehouseDataVo warehouseDataVo=new WarehouseDataVo();
warehouseDataVo.setTDLSN(tdls.get(b).replace("TDL-","").trim()); 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 desc limit 1 "; String sqls ="SELECT \"tdl\",\"b\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" and time <="+ endTime*1000000l+" ORDER BY time desc limit 1 ";
QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database)); QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database));
ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseVo.getWarehouseNo(),gatewayOnLineVos.get(a).getgSN(),tdls.get(b).replace("TDL-","").trim()); ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseVo.getWarehouseNo(),gatewayOnLineVos.get(a).getgSN(),tdls.get(b).replace("TDL-","").trim());
if (queryResults.getResults().get(0).getSeries() != null) { if (queryResults.getResults().get(0).getSeries() != null) {
...@@ -1049,7 +1050,7 @@ public class WarehouseController { ...@@ -1049,7 +1050,7 @@ public class WarehouseController {
warehouseDataVo.setTemperature("NA"); warehouseDataVo.setTemperature("NA");
warehouseDataVo.setHumidity("NA"); warehouseDataVo.setHumidity("NA");
} }
String sql3 ="SELECT \"tdl\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time "; String sql3 ="SELECT \"tdl\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdls.get(b)+"' AND time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" and time <="+ endTime*1000000l+" ORDER BY time ";
QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3, database)); QueryResult queryResult3 = influxDBTemplate.query(new Query(sql3, database));
if(queryResult3.getResults().get(0).getSeries() != null){ if(queryResult3.getResults().get(0).getSeries() != null){
......
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