|
|
@ -8,16 +8,13 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
|
|
|
import com.ruoyi.business.domain.HwDevice;
|
|
|
|
import com.ruoyi.business.domain.HwDevice;
|
|
|
|
import com.ruoyi.business.domain.HwElectronicFence;
|
|
|
|
|
|
|
|
import com.ruoyi.business.domain.VO.*;
|
|
|
|
import com.ruoyi.business.domain.VO.*;
|
|
|
|
import com.ruoyi.business.mapper.HwDeviceMapper;
|
|
|
|
import com.ruoyi.business.mapper.HwDeviceMapper;
|
|
|
|
import com.ruoyi.business.mapper.HwElectronicFenceMapper;
|
|
|
|
import com.ruoyi.business.mapper.HwElectronicFenceMapper;
|
|
|
|
import com.ruoyi.common.core.constant.TdEngineConstants;
|
|
|
|
import com.ruoyi.common.core.constant.TdEngineConstants;
|
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
|
import com.ruoyi.system.api.domain.SysDept;
|
|
|
|
|
|
|
|
import com.ruoyi.tdengine.api.RemoteTdEngineService;
|
|
|
|
import com.ruoyi.tdengine.api.RemoteTdEngineService;
|
|
|
|
import com.ruoyi.tdengine.api.domain.DeviceStatus;
|
|
|
|
import com.ruoyi.tdengine.api.domain.DeviceStatus;
|
|
|
|
import com.ruoyi.tdengine.api.domain.TdSelectDto;
|
|
|
|
import com.ruoyi.tdengine.api.domain.TdSelectDto;
|
|
|
@ -108,17 +105,38 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
|
|
|
|
public AllNumsVo selectAllNums() {
|
|
|
|
public AllNumsVo selectAllNums() {
|
|
|
|
//监控单元
|
|
|
|
//监控单元
|
|
|
|
String monitor = hwMonitorUnitMapper.selectSubSetNums();
|
|
|
|
String monitor = hwMonitorUnitMapper.selectSubSetNums();
|
|
|
|
Integer integer = hwMonitorUnitMapper.selectDeviceNums();
|
|
|
|
String integer = hwMonitorUnitMapper.selectDeviceNums();
|
|
|
|
|
|
|
|
System.out.println(monitor+" dsaas "+integer);
|
|
|
|
|
|
|
|
Integer monitor1 = 0;
|
|
|
|
|
|
|
|
Integer monitor2 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
AllNumsVo vo = new AllNumsVo();
|
|
|
|
AllNumsVo vo = new AllNumsVo();
|
|
|
|
vo.setSubSum(Integer.valueOf(monitor));
|
|
|
|
if (monitor == null){
|
|
|
|
vo.setSum(integer);
|
|
|
|
monitor1 = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
monitor1 = Integer.valueOf(monitor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (integer == null){
|
|
|
|
|
|
|
|
monitor2 = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
monitor2 = Integer.valueOf(integer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
vo.setSubSum(monitor1);
|
|
|
|
|
|
|
|
vo.setSum(monitor2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return vo;
|
|
|
|
return vo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
String str1 = "1";
|
|
|
|
|
|
|
|
String str2 = null;
|
|
|
|
|
|
|
|
int q = Integer.valueOf(str2);
|
|
|
|
|
|
|
|
System.out.println(q);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<AllNumsVo> selectSenceAllNums() {
|
|
|
|
public List<AllNumsVo> selectSenceAllNums() {
|
|
|
|
List<AllNumsVo> allNumsVos = hwMonitorUnitMapper.selectAllNums();
|
|
|
|
List<AllNumsVo> allNumsVos = hwMonitorUnitMapper.selectAllNums();
|
|
|
@ -191,7 +209,7 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
// 加一个begintime参数,endtime参数 stream时间戳 从开始时间0点开始,结束时间23.59.59结束
|
|
|
|
// 加一个begintime参数,endtime参数 stream时间戳 从开始时间0点开始,结束时间23.59.59结束
|
|
|
|
public int selectTdengine(String beginTime,String endTime,Long sceneId) {
|
|
|
|
public int[] selectTdengine(String beginTime, String endTime, Long sceneId) {
|
|
|
|
DeviceStatus queryDeviceStatus = new DeviceStatus();
|
|
|
|
DeviceStatus queryDeviceStatus = new DeviceStatus();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> params = queryDeviceStatus.getParams();
|
|
|
|
Map<String, Object> params = queryDeviceStatus.getParams();
|
|
|
@ -209,21 +227,21 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
|
|
|
|
if (sceneId != null) {
|
|
|
|
if (sceneId != null) {
|
|
|
|
queryDeviceStatus.setSceneId(sceneId);
|
|
|
|
queryDeviceStatus.setSceneId(sceneId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int value = 0;
|
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
int sum = 0;
|
|
|
|
|
|
|
|
int values[] = new int[10];
|
|
|
|
//todo 使用id(以解决)
|
|
|
|
//todo 使用id(以解决)
|
|
|
|
//map key时间戳,value List<DeviceStatus> 对象
|
|
|
|
//map key时间戳,value List<DeviceStatus> 对象
|
|
|
|
List<DeviceStatus> list = (List<DeviceStatus>) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
|
|
|
|
List<DeviceStatus> list = (List<DeviceStatus>) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
if (list.get(i).getDeviceType()==1) {
|
|
|
|
if (list.get(i).getDeviceType()==1) {
|
|
|
|
sum =sum+ hwMonitorUnitMapper.selectReleatedDeviceIdNums(list.get(i).getDeviceId());
|
|
|
|
values[i]=hwMonitorUnitMapper.selectReleatedDeviceIdNums(list.get(i).getDeviceId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
value++;
|
|
|
|
values[i] = hwDeviceMapper.selectSumDeviceFlagNot0();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
value = value+sum;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
return values;
|
|
|
|
|
|
|
|
|
|
|
|
//设备类型==网关 根据releated_device_id = 网关设备设备id查询个数
|
|
|
|
//设备类型==网关 根据releated_device_id = 网关设备设备id查询个数
|
|
|
|
//网关子设备数+非网关设备数(getDeviceType()!=1)
|
|
|
|
//网关子设备数+非网关设备数(getDeviceType()!=1)
|
|
|
|