|
|
@ -37,6 +37,10 @@ import sun.reflect.generics.tree.Tree;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.time.ZonedDateTime;
|
|
|
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -421,6 +425,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
String databaseName = TdEngineConstants.getDatabaseName();
|
|
|
|
String databaseName = TdEngineConstants.getDatabaseName();
|
|
|
|
|
|
|
|
|
|
|
|
List<HwDevice> hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice);
|
|
|
|
List<HwDevice> hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice);
|
|
|
|
|
|
|
|
if (hwDevices.size()>0){
|
|
|
|
hwDevices.forEach(hwDevice -> {
|
|
|
|
hwDevices.forEach(hwDevice -> {
|
|
|
|
Long deviceId = hwDevice.getDeviceId();
|
|
|
|
Long deviceId = hwDevice.getDeviceId();
|
|
|
|
HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction();
|
|
|
|
HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction();
|
|
|
@ -517,9 +522,17 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
hwDeviceVo.setDevicePic(hwDevice.getDevicePic());
|
|
|
|
hwDeviceVo.setDevicePic(hwDevice.getDevicePic());
|
|
|
|
hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE);
|
|
|
|
hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE);
|
|
|
|
hwDeviceVo.setDeviceDataMap(ddValueMap);
|
|
|
|
hwDeviceVo.setDeviceDataMap(ddValueMap);
|
|
|
|
|
|
|
|
if (deviceLatestDataMapList.size()>0){
|
|
|
|
|
|
|
|
String ts = deviceLatestDataMapList.get(0).get("ts").toString();
|
|
|
|
|
|
|
|
DateTimeFormatter dateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
|
|
|
|
|
|
|
ZonedDateTime parse = ZonedDateTime.parse(ts, dateTime);
|
|
|
|
|
|
|
|
Date updateTime = Date.from(parse.toInstant());
|
|
|
|
|
|
|
|
hwDeviceVo.setUpdateTime(updateTime);
|
|
|
|
|
|
|
|
}
|
|
|
|
acquisitionDeviceVos.add(hwDeviceVo);
|
|
|
|
acquisitionDeviceVos.add(hwDeviceVo);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos);
|
|
|
|
devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos);
|
|
|
|
devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos);
|
|
|
|
devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos);
|
|
|
@ -1170,20 +1183,41 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
|
|
|
|
String substring = s.substring(1, s.length() - 1);
|
|
|
|
String substring = s.substring(1, s.length() - 1);
|
|
|
|
if (!substring.isEmpty()){
|
|
|
|
if (!substring.isEmpty()){
|
|
|
|
Map map = JSONObject.parseObject(substring, Map.class);
|
|
|
|
Map map = JSONObject.parseObject(substring, Map.class);
|
|
|
|
if (map.size()==2){
|
|
|
|
if (map.size()>0){
|
|
|
|
|
|
|
|
// BeaconDevice beaconDevice = new BeaconDevice();
|
|
|
|
|
|
|
|
// beaconDevice.setDeviceId(hwDevices.get(i).getDeviceId());
|
|
|
|
|
|
|
|
// beaconDevice.setDeviceName(hwDevices.get(i).getDeviceName());
|
|
|
|
|
|
|
|
// beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString()));
|
|
|
|
|
|
|
|
// beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString()));
|
|
|
|
|
|
|
|
// beaconDevice.setRemark(hwDevices.get(i).getRemark());
|
|
|
|
|
|
|
|
// beaconDevice.setDeviceLocation(hwDevices.get(i).getDeviceLocation());
|
|
|
|
|
|
|
|
// beaconDevice.setDeviceLocation("白银市");
|
|
|
|
|
|
|
|
// beaconDevice.setDeviceModeId(hwDevices.get(i).getDeviceModeId());
|
|
|
|
|
|
|
|
// beaconDevice.setMonitorUnitName(hwDevices.get(i).getMonitorUnitName());
|
|
|
|
|
|
|
|
// //查询是否报警
|
|
|
|
|
|
|
|
// Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevices.get(i).getDeviceId());
|
|
|
|
|
|
|
|
// Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevices.get(i).getDeviceId());
|
|
|
|
|
|
|
|
String tableName = tdSelectDto.getTableName();
|
|
|
|
|
|
|
|
int underscoreIndex = tableName.lastIndexOf('_');
|
|
|
|
|
|
|
|
int deviceId = Integer.parseInt(tableName.substring(underscoreIndex + 1));
|
|
|
|
|
|
|
|
HwDevice hwDevice = hwDevices.stream().filter(x -> x.getDeviceId() == deviceId).findFirst().get();
|
|
|
|
|
|
|
|
if(hwDevice == null){
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BeaconDevice beaconDevice = new BeaconDevice();
|
|
|
|
BeaconDevice beaconDevice = new BeaconDevice();
|
|
|
|
beaconDevice.setDeviceId(hwDevices.get(i).getDeviceId());
|
|
|
|
beaconDevice.setDeviceId(hwDevice.getDeviceId());
|
|
|
|
beaconDevice.setDeviceName(hwDevices.get(i).getDeviceName());
|
|
|
|
beaconDevice.setDeviceName(hwDevice.getDeviceName());
|
|
|
|
beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString()));
|
|
|
|
beaconDevice.setLatitude(Double.valueOf( map.get("latitude").toString()));
|
|
|
|
beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString()));
|
|
|
|
beaconDevice.setLongitude(Double.valueOf( map.get("longitude").toString()));
|
|
|
|
beaconDevice.setRemark(hwDevices.get(i).getRemark());
|
|
|
|
beaconDevice.setRemark(hwDevice.getRemark());
|
|
|
|
beaconDevice.setDeviceLocation(hwDevices.get(i).getDeviceLocation());
|
|
|
|
beaconDevice.setDeviceLocation(hwDevice.getDeviceLocation());
|
|
|
|
beaconDevice.setDeviceLocation("白银市");
|
|
|
|
beaconDevice.setDeviceLocation("白银市");
|
|
|
|
beaconDevice.setDeviceModeId(hwDevices.get(i).getDeviceModeId());
|
|
|
|
beaconDevice.setDeviceModeId(hwDevice.getDeviceModeId());
|
|
|
|
beaconDevice.setMonitorUnitName(hwDevices.get(i).getMonitorUnitName());
|
|
|
|
beaconDevice.setMonitorUnitName(hwDevice.getMonitorUnitName());
|
|
|
|
//查询是否报警
|
|
|
|
//查询是否报警
|
|
|
|
Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevices.get(i).getDeviceId());
|
|
|
|
Long integer = hwDeviceMapper.selectDeviceIfAlarm(hwDevice.getDeviceId());
|
|
|
|
Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevices.get(i).getDeviceId());
|
|
|
|
Long integer1 = hwDeviceMapper.selectDeviceIfAlarmElectronFence(hwDevice.getDeviceId());
|
|
|
|
Boolean alarmElectronFence = false;
|
|
|
|
Boolean alarmElectronFence = false;
|
|
|
|
String ifAlarm = new String();
|
|
|
|
String ifAlarm = new String();
|
|
|
|
if (integer>0){
|
|
|
|
if (integer>0){
|
|
|
|