Commit 9f449c44 authored by chenying's avatar chenying

5.29实时数据返回值加报警上下限

parent 03384116
...@@ -7,6 +7,46 @@ public class WarehouseGatewayDateVo { ...@@ -7,6 +7,46 @@ public class WarehouseGatewayDateVo {
private String type; private String type;
private Float temMax;
private Float temMin;
private Float humidityMax;
private Float humidityMin;
public Float getTemMax() {
return temMax;
}
public void setTemMax(Float temMax) {
this.temMax = temMax;
}
public Float getTemMin() {
return temMin;
}
public void setTemMin(Float temMin) {
this.temMin = temMin;
}
public Float getHumidityMax() {
return humidityMax;
}
public void setHumidityMax(Float humidityMax) {
this.humidityMax = humidityMax;
}
public Float getHumidityMin() {
return humidityMin;
}
public void setHumidityMin(Float humidityMin) {
this.humidityMin = humidityMin;
}
private List<WarehouseDataVo> warehouseDataVos; private List<WarehouseDataVo> warehouseDataVos;
public String getgSN() { public String getgSN() {
......
...@@ -24,4 +24,6 @@ public interface AlarmMapper { ...@@ -24,4 +24,6 @@ public interface AlarmMapper {
List<AlarmTypeVo> getForWarehouse(String companyName); List<AlarmTypeVo> getForWarehouse(String companyName);
List<AlarmTypeVo> getForTransportation(String companyName); List<AlarmTypeVo> getForTransportation(String companyName);
ResultAlarmVo getAlarmByWarehouseNo(@Param("warehouseNo") String warehouseNo);
} }
...@@ -46,4 +46,8 @@ public class AlarmService { ...@@ -46,4 +46,8 @@ public class AlarmService {
return alarmMapper.getForTransportation(companyName); return alarmMapper.getForTransportation(companyName);
} }
public ResultAlarmVo getAlarmByWarehouseNo(String warehouseNo){
return alarmMapper.getAlarmByWarehouseNo(warehouseNo);
}
} }
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback; import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*; import com.example.tdl.domain.vo.*;
import com.example.tdl.entity.Alarm;
import com.example.tdl.entity.Gateway; import com.example.tdl.entity.Gateway;
import com.example.tdl.service.*; import com.example.tdl.service.*;
import com.example.tdl.service.redis.InfoRedisService; import com.example.tdl.service.redis.InfoRedisService;
...@@ -103,7 +104,6 @@ public class WarehouseController { ...@@ -103,7 +104,6 @@ public class WarehouseController {
return warehouseService.getAll(userRedisVo.getCompanyName()); return warehouseService.getAll(userRedisVo.getCompanyName());
} }
//根据条件查询仓库信息 //根据条件查询仓库信息
@ApiOperation(value = "根据条件查询仓库信息",notes = "根据条件查询仓库信息,传值说明:" + @ApiOperation(value = "根据条件查询仓库信息",notes = "根据条件查询仓库信息,传值说明:" +
" warehouseName:仓库名," + " warehouseName:仓库名," +
...@@ -148,7 +148,6 @@ public class WarehouseController { ...@@ -148,7 +148,6 @@ public class WarehouseController {
return warehouseService.getAllByTerm(warehouseTermVo); return warehouseService.getAllByTerm(warehouseTermVo);
} }
//获取仓库以及设备数据 //获取仓库以及设备数据
@ApiOperation(value = "获取仓库以及设备数据",notes = "获取仓库以及设备数据,传值说明:" + @ApiOperation(value = "获取仓库以及设备数据",notes = "获取仓库以及设备数据,传值说明:" +
" warehouseName:仓库名," + " warehouseName:仓库名," +
...@@ -218,8 +217,6 @@ public class WarehouseController { ...@@ -218,8 +217,6 @@ public class WarehouseController {
return simpleWarehouseVos; return simpleWarehouseVos;
} }
//根据仓库编号获取仓库信息 //根据仓库编号获取仓库信息
@ApiOperation(value = "根据仓库编号获取仓库信息",notes = "根据仓库编号获取仓库信息,传值说明:") @ApiOperation(value = "根据仓库编号获取仓库信息",notes = "根据仓库编号获取仓库信息,传值说明:")
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -280,8 +277,6 @@ public class WarehouseController { ...@@ -280,8 +277,6 @@ public class WarehouseController {
return warehouseDetailVo; return warehouseDetailVo;
} }
//获取某个仓库的网关 //获取某个仓库的网关
@ApiOperation(value="添加网关",notes = "添加网关,传值:" + @ApiOperation(value="添加网关",notes = "添加网关,传值:" +
"warehouseNo:仓库编号" + "warehouseNo:仓库编号" +
...@@ -310,8 +305,6 @@ public class WarehouseController { ...@@ -310,8 +305,6 @@ public class WarehouseController {
return warehouseService.getGateway(warehouseNo); return warehouseService.getGateway(warehouseNo);
} }
//添加仓库信息 //添加仓库信息
@ApiOperation(value = "添加仓库信息",notes = "添加仓库信息,传值说明:" + @ApiOperation(value = "添加仓库信息",notes = "添加仓库信息,传值说明:" +
" warehouseName:仓库名," + " warehouseName:仓库名," +
...@@ -506,8 +499,6 @@ public class WarehouseController { ...@@ -506,8 +499,6 @@ public class WarehouseController {
} }
//根据仓库编号修改仓库信息 //根据仓库编号修改仓库信息
@ApiOperation(value = "根据仓库编号修改仓库信息",notes = "根据仓库编号修改仓库信息,updatTime不用传,传值说明:" + @ApiOperation(value = "根据仓库编号修改仓库信息",notes = "根据仓库编号修改仓库信息,updatTime不用传,传值说明:" +
" warehouseNo:需要修改的仓库编号," + " warehouseNo:需要修改的仓库编号," +
...@@ -740,8 +731,6 @@ public class WarehouseController { ...@@ -740,8 +731,6 @@ public class WarehouseController {
return gson.toJson(fb); return gson.toJson(fb);
} }
@ApiOperation(value="添加网关",notes = "添加网关,传值:" + @ApiOperation(value="添加网关",notes = "添加网关,传值:" +
"warehouseNo:仓库编号" + "warehouseNo:仓库编号" +
"SN:网关编号") "SN:网关编号")
...@@ -857,24 +846,27 @@ public class WarehouseController { ...@@ -857,24 +846,27 @@ public class WarehouseController {
warehouseNo=(String) jsonObject.get("warehouseNo"); warehouseNo=(String) jsonObject.get("warehouseNo");
List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>(); List<WarehouseGatewayDateVo> warehouseGatewayDateVoList=new ArrayList<>();
List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseNo); List<GatewayOnLineVo> gatewayOnLineVos=gatewayService.getByWarehouseNo(warehouseNo);
ResultAlarmVo resultAlarmVo=alarmService.getAlarmByWarehouseNo(warehouseNo);
for (int a=0;a<gatewayOnLineVos.size();a++){ for (int a=0;a<gatewayOnLineVos.size();a++){
WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo(); WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo();
warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getSN()); warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getSN());
warehouseGatewayDateVo.setType(gatewayOnLineVos.get(a).getType()); warehouseGatewayDateVo.setType(gatewayOnLineVos.get(a).getType());
warehouseGatewayDateVo.setTemMax(resultAlarmVo.getTemMax());
warehouseGatewayDateVo.setTemMin(resultAlarmVo.getTemMin());
warehouseGatewayDateVo.setHumidityMax(resultAlarmVo.getHumidityMax());
warehouseGatewayDateVo.setHumidityMin(resultAlarmVo.getHumidityMin());
String device = gatewayOnLineVos.get(a).getType() + "_" + gatewayOnLineVos.get(a).getSN(); String device = gatewayOnLineVos.get(a).getType() + "_" + gatewayOnLineVos.get(a).getSN();
List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getSN(),gatewayOnLineVos.get(a).getType()); List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getSN(),gatewayOnLineVos.get(a).getType());
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos = new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos1 = new ArrayList<>();
List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>();
List<WarehouseDataVo> warehouseDataVos=new ArrayList<>(); List<WarehouseDataVo> warehouseDataVos=new ArrayList<>();
for (int b=0;b<tdls.size();b++){ for (int b=0;b<tdls.size();b++){
String sqls ="SELECT \"tdl\",\"T\", \"h\" FROM \"tdl_policy\".\""+device+"\" WHERE (\"tdl\" = '"+tdls.get(b)+"') ORDER BY time DESC "; // String sqls ="SELECT \"tdl\",\"T\", \"h\" FROM \"tdl_policy\".\""+device+"\" WHERE (\"tdl\" = '"+tdls.get(b)+"') ORDER BY time DESC ";
String sqls ="SELECT \"tdl\",\"T\", \"h\" FROM \"tdl_policy\".\"WTD93LG_17110194\" WHERE (\"tdl\" = 'TDL-1701110082608') ORDER BY time DESC ";
QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database)); QueryResult queryResults = influxDBTemplate.query(new Query(sqls, database));
WarehouseDataVo warehouseDataVo=new WarehouseDataVo(); WarehouseDataVo warehouseDataVo=new WarehouseDataVo();
List<WarehouseTDLDetailVo> warehouseTDLDetailVos=new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos = new ArrayList<>();
List<WarehouseTimeAndDataVo> warehouseTimeAndDataVos1 = new ArrayList<>();
if(queryResults.getResults().get(0).getSeries() != null){ if(queryResults.getResults().get(0).getSeries() != null){
//解析数据 //解析数据
WarehouseTDLDetailVo warehouseTDLDetailVo=new WarehouseTDLDetailVo(); WarehouseTDLDetailVo warehouseTDLDetailVo=new WarehouseTDLDetailVo();
......
...@@ -7,7 +7,7 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver ...@@ -7,7 +7,7 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30 threadpool.corepoolsize = 30
threadpool.maxpoolsize = 50 threadpool.maxpoolsize = 50
server.port=8090 server.port=8092
management.security.enabled=false management.security.enabled=false
......
...@@ -68,11 +68,19 @@ ...@@ -68,11 +68,19 @@
<!--查询仓库的预警类型--> <!--查询仓库的预警类型-->
<select id="getForWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo"> <select id="getForWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo">
SELECT alarmType from alarm WHERE alarmScene="仓库" AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) SELECT alarmType from alarm WHERE alarmScene="仓库"
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
<!--查询仓库的预警类型--> <!--查询仓库的预警类型-->
<select id="getForTransportation" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo"> <select id="getForTransportation" parameterType="String" resultType="com.example.tdl.domain.vo.AlarmTypeVo">
SELECT alarmType from alarm WHERE alarmScene="运输" AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) SELECT alarmType from alarm WHERE alarmScene="运输"
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select>
<select id="getAlarmByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,a.remark
FROM warehouse w INNER JOIN alarm a ON w.alarm_id=a.id
where w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -254,9 +254,13 @@ ...@@ -254,9 +254,13 @@
<select id="getWarehouseDetailByNo" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseDetailVo"> <select id="getWarehouseDetailByNo" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseDetailVo">
SELECT warehouseNo,warehouseName,c.country,c.city,addressDetail,(SELECT COUNT(id) from gateway_warehouse WHERE warehouse_id=w.id) gatewayCounts, SELECT warehouseNo,warehouseName,c.country,c.city,addressDetail,(SELECT COUNT(id) from gateway_warehouse WHERE warehouse_id=w.id) gatewayCounts,
(SELECT COUNT(id) FROM tdldevice WHERE warehouse_id=w.id) tdlCounts,,property,type,hardwareLevel,areaPlanIndoor (SELECT COUNT(id) FROM tdldevice WHERE warehouse_id=w.id) tdlCounts,property,type,hardwareLevel,areaPlanIndoor
from warehouse w INNER JOIN city c ON w.city_id=c.id from warehouse w INNER JOIN city c ON w.city_id=c.id
where warehouseNo=#{warehouseNo,jdbcType=VARCHAR} where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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