Commit 7fed2fc7 authored by Carit Zhu's avatar Carit Zhu 🎱

Add gateway name for WarehouseLogVo and GatewayOnLineVo, and add TDL name for…

Add gateway name for WarehouseLogVo and GatewayOnLineVo, and add TDL name for TDLDeviceVo and TDLDeviceDetailVo which will be returned by getDetails interface in WarehouseController.
parent 39627f24
...@@ -7,6 +7,8 @@ public class GatewayOnLineVo { ...@@ -7,6 +7,8 @@ public class GatewayOnLineVo {
private String type; private String type;
private String name;
private Integer state; private Integer state;
private Long startTime; private Long startTime;
...@@ -23,6 +25,14 @@ public class GatewayOnLineVo { ...@@ -23,6 +25,14 @@ public class GatewayOnLineVo {
this.gSN = gSN; this.gSN = gSN;
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() { public String getType() {
return type; return type;
} }
......
...@@ -3,6 +3,8 @@ package com.example.tdl.domain.vo; ...@@ -3,6 +3,8 @@ package com.example.tdl.domain.vo;
public class TDLDeviceDetailVo { public class TDLDeviceDetailVo {
private String TDLSN; private String TDLSN;
private String TDLName;
private String pressure; private String pressure;
private String temperature; private String temperature;
...@@ -23,6 +25,14 @@ public class TDLDeviceDetailVo { ...@@ -23,6 +25,14 @@ public class TDLDeviceDetailVo {
this.TDLSN = TDLSN; this.TDLSN = TDLSN;
} }
public String getTDLName() {
return TDLName;
}
public void setTDLName(String TDLName) {
this.TDLName = TDLName;
}
public String getPressure() { public String getPressure() {
return pressure; return pressure;
} }
......
...@@ -4,6 +4,8 @@ public class TDLDeviceVo { ...@@ -4,6 +4,8 @@ public class TDLDeviceVo {
private String TDLSN; private String TDLSN;
private String TDLName;
private String offsetJson; private String offsetJson;
public String getTDLSN() { public String getTDLSN() {
...@@ -14,6 +16,14 @@ public class TDLDeviceVo { ...@@ -14,6 +16,14 @@ public class TDLDeviceVo {
this.TDLSN = TDLSN; this.TDLSN = TDLSN;
} }
public String getTDLName() {
return TDLName;
}
public void setTDLName(String TDLName) {
this.TDLName = TDLName;
}
public String getOffsetJson() { public String getOffsetJson() {
return offsetJson; return offsetJson;
} }
......
...@@ -10,6 +10,8 @@ public class WarehouseLogVo { ...@@ -10,6 +10,8 @@ public class WarehouseLogVo {
private String device; private String device;
private String deviceName;
private Long createTime; private Long createTime;
private Long endTime; private Long endTime;
...@@ -46,6 +48,14 @@ public class WarehouseLogVo { ...@@ -46,6 +48,14 @@ public class WarehouseLogVo {
this.device = device; this.device = device;
} }
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public Long getCreateTime() { public Long getCreateTime() {
return createTime; return createTime;
} }
......
...@@ -319,6 +319,7 @@ public class WarehouseController { ...@@ -319,6 +319,7 @@ public class WarehouseController {
GatewayOnLineVo gatewayOnLineVo = new GatewayOnLineVo(); GatewayOnLineVo gatewayOnLineVo = new GatewayOnLineVo();
gatewayOnLineVo.setgSN(list.get(a).getSN()); gatewayOnLineVo.setgSN(list.get(a).getSN());
gatewayOnLineVo.setType(list.get(a).getType()); gatewayOnLineVo.setType(list.get(a).getType());
gatewayOnLineVo.setName(list.get(a).getDeviceName());
Object data = infoRedisService.getHash("DeviceOnline", list.get(a).getDevice() ); Object data = infoRedisService.getHash("DeviceOnline", list.get(a).getDevice() );
if(data !=null){ if(data !=null){
OnlineVo onlineVo = gson.fromJson(data.toString(),OnlineVo.class); OnlineVo onlineVo = gson.fromJson(data.toString(),OnlineVo.class);
...@@ -364,6 +365,7 @@ public class WarehouseController { ...@@ -364,6 +365,7 @@ public class WarehouseController {
tdlDeviceDetailVo.setHumidity("NA"); tdlDeviceDetailVo.setHumidity("NA");
} }
tdlDeviceDetailVo.setTDLSN(tdlDeviceVo.getTDLSN().replace("TDL-","").trim()); tdlDeviceDetailVo.setTDLSN(tdlDeviceVo.getTDLSN().replace("TDL-","").trim());
tdlDeviceDetailVo.setTDLName(tdlDeviceVo.getTDLName());
tdlDeviceDetailVo.setOffsetJson(tdlDeviceVo.getOffsetJson()); tdlDeviceDetailVo.setOffsetJson(tdlDeviceVo.getOffsetJson());
tdlDeviceDetailVos.add(tdlDeviceDetailVo); tdlDeviceDetailVos.add(tdlDeviceDetailVo);
} }
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
</select> </select>
<select id="getTdlByGatewaySN" parameterType="String" resultType="com.example.tdl.domain.vo.TDLDeviceVo"> <select id="getTdlByGatewaySN" parameterType="String" resultType="com.example.tdl.domain.vo.TDLDeviceVo">
select CONCAT("TDL-",TDLSN) TDLSN,offsetJson from tdldevice t,gateway g select CONCAT("TDL-",TDLSN) TDLSN, TDLName, offsetJson from tdldevice t, gateway g
where t.gateway_id = g.id where t.gateway_id = g.id
and g.SN =#{SN,jdbcType=VARCHAR} and g.SN =#{SN,jdbcType=VARCHAR}
and g.type=#{type,jdbcType=VARCHAR} and g.type=#{type,jdbcType=VARCHAR}
......
...@@ -61,11 +61,12 @@ ...@@ -61,11 +61,12 @@
AND endTime is null AND endTime is null
</select> </select>
<select id="getByWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseLogVo"> <select id="getByWarehouse" parameterType="String" resultType="com.example.tdl.domain.vo.WarehouseLogVo">
select DISTINCT CONCAT(gatewaytype,"_",gatewaySN) device, tgl.gatewaySN SN,gatewaytype type,w.warehouseNo select DISTINCT CONCAT(gatewaytype,"_",gatewaySN) device, tgl.gatewaySN SN, gatewaytype type, name deviceName, w.warehouseNo
from tdl_gateway_log tgl,warehouse w from tdl_gateway_log tgl, warehouse w, gateway g
where tgl.warehouseNo = w.warehouseNo where tgl.warehouseNo = w.warehouseNo
and tgl.gatewaySN = g.SN
and tgl.gatewayType = g.type
and w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR} and w.warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
and ISNULL(endTime) and ISNULL(endTime)
</select> </select>
......
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