Commit 6fd17789 authored by Carit Zhu's avatar Carit Zhu 🎱

Merge branch 'tdl_bosch_carit' into 'tdl_bosch'

Tdl bosch carit

See merge request !4
parents 46b8f645 fe7adea4
Pipeline #497 passed with stage
in 0 seconds
...@@ -15,7 +15,7 @@ apply plugin: 'idea' ...@@ -15,7 +15,7 @@ apply plugin: 'idea'
apply plugin: 'org.springframework.boot' apply plugin: 'org.springframework.boot'
group = 'com.example' group = 'com.example'
version = '0.0.1-SNAPSHOT' version = '1.0.1-release'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
repositories { repositories {
......
...@@ -4,7 +4,9 @@ public class AddWarehouseGatewayVo { ...@@ -4,7 +4,9 @@ public class AddWarehouseGatewayVo {
private String warehouseNo; private String warehouseNo;
private String gSN; private String gSN;
private String gatewayName;
public String getWarehouseNo() { public String getWarehouseNo() {
return warehouseNo; return warehouseNo;
...@@ -21,4 +23,12 @@ public class AddWarehouseGatewayVo { ...@@ -21,4 +23,12 @@ public class AddWarehouseGatewayVo {
public void setgSN(String gSN) { public void setgSN(String gSN) {
this.gSN = gSN; this.gSN = gSN;
} }
public String getGatewayName() {
return gatewayName;
}
public void setGatewayName(String gatewayName) {
this.gatewayName = gatewayName;
}
} }
...@@ -8,7 +8,9 @@ public class BindingVo { ...@@ -8,7 +8,9 @@ public class BindingVo {
private Integer mode; private Integer mode;
private String TDLSN; private String TDLSN;
private String TDLName;
private String transportationNo; private String transportationNo;
...@@ -48,6 +50,14 @@ public class BindingVo { ...@@ -48,6 +50,14 @@ public class BindingVo {
this.TDLSN = TDLSN; this.TDLSN = TDLSN;
} }
public String getTDLName() {
return TDLName;
}
public void setTDLName(String TDLName) {
this.TDLName = TDLName;
}
public String getTransportationNo() { public String getTransportationNo() {
return transportationNo; return transportationNo;
} }
......
...@@ -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;
} }
......
...@@ -6,7 +6,6 @@ public class UpdateTDLDeviceVo { ...@@ -6,7 +6,6 @@ public class UpdateTDLDeviceVo {
private String TDLSN; private String TDLSN;
public String getTDLName() { public String getTDLName() {
return TDLName; return TDLName;
} }
......
...@@ -6,6 +6,8 @@ public class WarehouseDataVo { ...@@ -6,6 +6,8 @@ public class WarehouseDataVo {
private String TDLSN; private String TDLSN;
private String TDLName;
private String batteryVoltage; private String batteryVoltage;
private String temperature; private String temperature;
...@@ -24,6 +26,14 @@ public class WarehouseDataVo { ...@@ -24,6 +26,14 @@ public class WarehouseDataVo {
this.TDLSN = TDLSN; this.TDLSN = TDLSN;
} }
public String getTDLName() {
return TDLName;
}
public void setTDLName(String TDLName) {
this.TDLName = TDLName;
}
public String getBatteryVoltage() { public String getBatteryVoltage() {
return batteryVoltage; return batteryVoltage;
} }
......
...@@ -7,43 +7,52 @@ public class WarehouseGatewayDateVo { ...@@ -7,43 +7,52 @@ public class WarehouseGatewayDateVo {
private String type; private String type;
private String name;
private String battery; private String battery;
private int state; private int state;
private List<WarehouseDataVo> warehouseDataVos; private List<WarehouseDataVo> warehouseDataVos;
public String getgSN() {
return gSN;
}
public String getBattery() { public void setgSN(String gSN) {
return battery; this.gSN = gSN;
} }
public void setBattery(String battery) { public String getType() {
this.battery = battery; return type;
} }
public int getState() { public void setType(String type) {
return state; this.type = type;
} }
public void setState(int state) { public String getName() {
this.state = state; return name;
} }
public String getgSN() { public void setName(String name) {
return gSN; this.name = name;
} }
public void setgSN(String gSN) { public String getBattery() {
this.gSN = gSN; return battery;
} }
public String getType() { public void setBattery(String battery) {
return type; this.battery = battery;
} }
public void setType(String type) { public int getState() {
this.type = type; return state;
}
public void setState(int state) {
this.state = state;
} }
public List<WarehouseDataVo> getWarehouseDataVos() { public List<WarehouseDataVo> getWarehouseDataVos() {
......
...@@ -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;
} }
......
...@@ -105,15 +105,26 @@ public class AlarmRule { ...@@ -105,15 +105,26 @@ public class AlarmRule {
try { try {
String hashKey = "TDL-" + TDLSN + "_" + alias; String hashKey = "TDL-" + TDLSN + "_" + alias;
/* Get alarm rule from redis */ /* Get alarm rule from redis */
List<AlarmRuleVo> alarmRuleList;
Object hashValueObject = alarmRedisService.getHash(topic, hashKey); Object hashValueObject = alarmRedisService.getHash(topic, hashKey);
List<AlarmRuleVo> alarmRuleList = gson.fromJson(hashValueObject.toString(), if (hashValueObject != null) {
new TypeToken<ArrayList<AlarmRuleVo>>() {}.getType()); alarmRuleList = gson.fromJson(hashValueObject.toString(),
/* Update offset */ new TypeToken<ArrayList<AlarmRuleVo>>() {
if (alarmRuleList != null && alarmRuleList.size() > 0) { }.getType());
alarmRuleList.get(0).setOffset(offset); /* Update offset */
/* Write back to redis */ if (alarmRuleList != null && alarmRuleList.size() > 0) {
alarmRedisService.hmSet(topic, hashKey, gson.toJson(alarmRuleList)); alarmRuleList.get(0).setOffset(offset);
}
} else {
alarmRuleList = new ArrayList<>();
AlarmRuleVo alarmRuleVo = new AlarmRuleVo();
alarmRuleVo.setOffset(offset);
alarmRuleList.add(alarmRuleVo);
} }
/* Write back to redis */
alarmRedisService.hmSet(topic, hashKey, gson.toJson(alarmRuleList));
} catch (JsonSyntaxException e) { } catch (JsonSyntaxException e) {
logger.error("Update offset(" + alias + ") JsonSyntaxException: " + e.getMessage()); logger.error("Update offset(" + alias + ") JsonSyntaxException: " + e.getMessage());
} }
......
package com.example.tdl.web; package com.example.tdl.web;
import com.alibaba.fastjson.JSON; 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;
...@@ -12,7 +11,6 @@ import com.example.tdl.service.redis.InfoRedisService; ...@@ -12,7 +11,6 @@ import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService; import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.AlarmRule; import com.example.tdl.util.AlarmRule;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.sun.org.apache.regexp.internal.RE;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -26,10 +24,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -26,10 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.influxdb.InfluxDBTemplate; import org.springframework.data.influxdb.InfluxDBTemplate;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import retrofit2.http.POST;
import javax.print.DocFlavor;
import javax.print.attribute.standard.RequestingUserName;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
......
...@@ -85,7 +85,8 @@ public class EquipmentBindingController { ...@@ -85,7 +85,8 @@ public class EquipmentBindingController {
" SN:gateWay编号," + " SN:gateWay编号," +
" type:gateWay类型," + " type:gateWay类型," +
" mode:1--运输/2--仓库," + " mode:1--运输/2--仓库," +
" TDLSN:tdl编号," + " tdlsn:tdl编号," +
" tdlname: tdl名称" +
" transportationNo:运输编号," + " transportationNo:运输编号," +
" warehouseNo:仓库编号," + " warehouseNo:仓库编号," +
" alarmType:预警类型" ) " alarmType:预警类型" )
...@@ -223,6 +224,7 @@ public class EquipmentBindingController { ...@@ -223,6 +224,7 @@ public class EquipmentBindingController {
map.put("state",1); map.put("state",1);
map.put("untie",false); map.put("untie",false);
map.put("TDLSN",bindingVo.getTDLSN()); map.put("TDLSN",bindingVo.getTDLSN());
map.put("TDLName",bindingVo.getTDLName());
map.put("createTime",System.currentTimeMillis()); map.put("createTime",System.currentTimeMillis());
configService.addConfig(map); configService.addConfig(map);
Map<Object,Object> msg=new HashMap<>(); Map<Object,Object> msg=new HashMap<>();
......
...@@ -267,6 +267,7 @@ public class WarehouseController { ...@@ -267,6 +267,7 @@ public class WarehouseController {
" gatewayOnLineVos: [" + " gatewayOnLineVos: [" +
" {" + " {" +
" type: 网关类型," + " type: 网关类型," +
" name: 网关名称," +
" state: 在线状态(6离线,7在线)," + " state: 在线状态(6离线,7在线)," +
" battery: 电量," + " battery: 电量," +
" tdlDeviceDetailVos: [" + " tdlDeviceDetailVos: [" +
...@@ -276,6 +277,7 @@ public class WarehouseController { ...@@ -276,6 +277,7 @@ public class WarehouseController {
" humidity: 湿度," + " humidity: 湿度," +
" time: 时间," + " time: 时间," +
" tdlsn: TDL编号" + " tdlsn: TDL编号" +
" tdlname: TDL名称" +
" gatewaySN:网关编号" + " gatewaySN:网关编号" +
" offsetJson: 校准JSON(若为空则视为全零)" + " offsetJson: 校准JSON(若为空则视为全零)" +
" }" + " }" +
...@@ -319,6 +321,7 @@ public class WarehouseController { ...@@ -319,6 +321,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 +367,7 @@ public class WarehouseController { ...@@ -364,6 +367,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);
} }
...@@ -854,7 +858,8 @@ public class WarehouseController { ...@@ -854,7 +858,8 @@ public class WarehouseController {
@ApiOperation(value="添加网关",notes = "添加网关,传值:" + @ApiOperation(value="添加网关",notes = "添加网关,传值:" +
"warehouseNo:仓库编号" + "warehouseNo:仓库编号" +
"SN:网关编号" + "SN:网关编号" +
"type:网关类型") "gatewayName:网关名称"
)
@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"),
}) })
...@@ -889,6 +894,7 @@ public class WarehouseController { ...@@ -889,6 +894,7 @@ public class WarehouseController {
map.put("warehouseNo",addWarehouseGatewayVo.getWarehouseNo()); map.put("warehouseNo",addWarehouseGatewayVo.getWarehouseNo());
map.put("gSN",addWarehouseGatewayVo.getgSN()); map.put("gSN",addWarehouseGatewayVo.getgSN());
map.put("gType",type); map.put("gType",type);
map.put("gName",addWarehouseGatewayVo.getGatewayName());
map.put("startTime",System.currentTimeMillis()); map.put("startTime",System.currentTimeMillis());
warehouseService.addGateway(map); warehouseService.addGateway(map);
Map<Object,Object> msg=new HashMap<>(); Map<Object,Object> msg=new HashMap<>();
...@@ -969,6 +975,7 @@ public class WarehouseController { ...@@ -969,6 +975,7 @@ public class WarehouseController {
" {" + " {" +
" gSN: 网关编号," + " gSN: 网关编号," +
" type: 网关类型," + " type: 网关类型," +
" name: 网关名称," +
" warehouseDataVos: [" + " warehouseDataVos: [" +
" {" + " {" +
" warehouseTDLDetailVos: [" + " warehouseTDLDetailVos: [" +
...@@ -981,6 +988,7 @@ public class WarehouseController { ...@@ -981,6 +988,7 @@ public class WarehouseController {
" }" + " }" +
" ]," + " ]," +
" tdlsn: TDL-201802271711" + " tdlsn: TDL-201802271711" +
" tdlname: tdl名称" +
" }" + " }" +
" ]" + " ]" +
" }" + " }" +
...@@ -998,7 +1006,7 @@ public class WarehouseController { ...@@ -998,7 +1006,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; 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;
...@@ -1006,6 +1014,7 @@ public class WarehouseController { ...@@ -1006,6 +1014,7 @@ public class WarehouseController {
WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo(); WarehouseGatewayDateVo warehouseGatewayDateVo=new WarehouseGatewayDateVo();
warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getgSN()); warehouseGatewayDateVo.setgSN(gatewayOnLineVos.get(a).getgSN());
warehouseGatewayDateVo.setType(gatewayOnLineVos.get(a).getType()); warehouseGatewayDateVo.setType(gatewayOnLineVos.get(a).getType());
warehouseGatewayDateVo.setName(gatewayOnLineVos.get(a).getName());
String device = gatewayOnLineVos.get(a).getType() + "_" + gatewayOnLineVos.get(a).getgSN(); String device = gatewayOnLineVos.get(a).getType() + "_" + gatewayOnLineVos.get(a).getgSN();
String sql ="SELECT \"battery\" FROM \"tdl_policy\".\""+device +"\" where time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time DESC LIMIT 1"; String sql ="SELECT \"battery\" FROM \"tdl_policy\".\""+device +"\" where time >="+ gatewayOnLineVos.get(a).getStartTime()*1000000l+" ORDER BY time DESC LIMIT 1";
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database)); QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
...@@ -1029,15 +1038,19 @@ public class WarehouseController { ...@@ -1029,15 +1038,19 @@ public class WarehouseController {
}else{ }else{
warehouseGatewayDateVo.setState(6); warehouseGatewayDateVo.setState(6);
} }
List<String> tdls=tdlDeviceService.getByGatewaySN(gatewayOnLineVos.get(a).getgSN(),gatewayOnLineVos.get(a).getType());
List<TDLDeviceVo> tdlDeviceVoList = tdlDeviceService.getTdlByGatewaySN(
gatewayOnLineVos.get(a).getgSN(),gatewayOnLineVos.get(a).getType());
List<WarehouseDataVo> warehouseDataVos=new ArrayList<>(); List<WarehouseDataVo> warehouseDataVos=new ArrayList<>();
for (int b=0;b<tdls.size();b++){ for (TDLDeviceVo tdlDeviceVo : tdlDeviceVoList){
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()); String rawTDLSN = tdlDeviceVo.getTDLSN().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+" and time <="+ endTime*1000000l+" ORDER BY time desc limit 1 "; warehouseDataVo.setTDLSN(rawTDLSN);
warehouseDataVo.setTDLName(tdlDeviceVo.getTDLName());
String sqls ="SELECT \"tdl\",\"b\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdlDeviceVo.getTDLSN()+"' 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(),rawTDLSN);
if (queryResults.getResults().get(0).getSeries() != null) { if (queryResults.getResults().get(0).getSeries() != null) {
warehouseDataVo.setTime(UTCToCST(queryResults.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString(),warehouseVo.getOffset()==null ? "+8" : warehouseVo.getOffset())); warehouseDataVo.setTime(UTCToCST(queryResults.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString(),warehouseVo.getOffset()==null ? "+8" : warehouseVo.getOffset()));
warehouseDataVo.setBatteryVoltage(df.format(new BigDecimal(queryResults.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString()))); warehouseDataVo.setBatteryVoltage(df.format(new BigDecimal(queryResults.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString())));
...@@ -1049,7 +1062,7 @@ public class WarehouseController { ...@@ -1049,7 +1062,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+" and time <="+ endTime*1000000l+" ORDER BY time "; String sql3 ="SELECT \"tdl\",\"T\",\"h\" FROM \"tdl_policy\".\""+device+"\" WHERE \"tdl\" = '"+tdlDeviceVo.getTDLSN()+"' 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){
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#{state,mode=IN,jdbcType=INTEGER}, #{state,mode=IN,jdbcType=INTEGER},
#{untie,mode=IN,jdbcType=INTEGER}, #{untie,mode=IN,jdbcType=INTEGER},
#{TDLSN,mode=IN,jdbcType=VARCHAR}, #{TDLSN,mode=IN,jdbcType=VARCHAR},
#{TDLName,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT}, #{createTime,mode=IN,jdbcType=BIGINT},
#{msg,mode=OUT,jdbcType=VARCHAR} #{msg,mode=OUT,jdbcType=VARCHAR}
) )
......
...@@ -119,8 +119,8 @@ ...@@ -119,8 +119,8 @@
<!--根据仓库编号查询网关信息--> <!--根据仓库编号查询网关信息-->
<select id="getByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.GatewayOnLineVo"> <select id="getByWarehouseNo" parameterType="String" resultType="com.example.tdl.domain.vo.GatewayOnLineVo">
SELECT DISTINCT gatewaySN gSN, gatewayType type,createTime startTime SELECT DISTINCT tgl.gatewaySN gSN, tgl.gatewayType type, g.name, tgl.createTime startTime
from tdl_gateway_log from tdl_gateway_log tgl inner join gateway g on tgl.gatewaySN = g.SN and tgl.gatewayType = g.type
where warehouseNo=#{warehouseNo,jdbcType=VARCHAR} where warehouseNo=#{warehouseNo,jdbcType=VARCHAR}
and ISNULL(endTime) and ISNULL(endTime)
GROUP BY gSN GROUP BY gSN
......
...@@ -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>
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
#{warehouseNo,mode=IN,jdbcType=VARCHAR}, #{warehouseNo,mode=IN,jdbcType=VARCHAR},
#{gSN,mode=IN,jdbcType=VARCHAR}, #{gSN,mode=IN,jdbcType=VARCHAR},
#{gType,mode=IN,jdbcType=VARCHAR}, #{gType,mode=IN,jdbcType=VARCHAR},
#{gName,mode=IN,jdbcType=VARCHAR},
#{startTime,mode=IN,jdbcType=BIGINT}, #{startTime,mode=IN,jdbcType=BIGINT},
#{msg,mode=OUT,jdbcType=VARCHAR} #{msg,mode=OUT,jdbcType=VARCHAR}
) )
......
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