|
|
@ -211,11 +211,12 @@ 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 Map<Object, Integer> 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();
|
|
|
|
DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA);
|
|
|
|
DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA);
|
|
|
|
|
|
|
|
System.out.println(ofPattern);
|
|
|
|
LocalDate parse = LocalDate.parse(beginTime, ofPattern);
|
|
|
|
LocalDate parse = LocalDate.parse(beginTime, ofPattern);
|
|
|
|
long begintime = parse.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
|
long begintime = parse.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
|
|
|
|
|
|
|
|
@ -232,18 +233,27 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
|
|
|
|
|
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
int sum = 0;
|
|
|
|
int values[] = new int[10];
|
|
|
|
int values[] = new int[10];
|
|
|
|
|
|
|
|
Map<Object,Integer> valuesMap = new HashMap<>();
|
|
|
|
//todo 使用id(以解决)
|
|
|
|
//todo 使用id(以解决)
|
|
|
|
//map key时间戳,value List<DeviceStatus> 对象
|
|
|
|
//map key时间戳,value List<DeviceStatus> 对象
|
|
|
|
|
|
|
|
R<?> r = remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
|
|
|
|
|
|
|
|
Map<Long, List<DeviceStatus>> deviceStatusMap = (Map<Long, List<DeviceStatus>>) r.getData();
|
|
|
|
List<DeviceStatus> list = (List<DeviceStatus>) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
|
|
|
|
List<DeviceStatus> list = (List<DeviceStatus>) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus);
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
Set<Long> longs = deviceStatusMap.keySet();
|
|
|
|
if (list.get(i).getDeviceType()==1) {
|
|
|
|
for (Object key:longs){
|
|
|
|
values[i]=hwMonitorUnitMapper.selectReleatedDeviceIdNums(list.get(i).getDeviceId());
|
|
|
|
List<DeviceStatus> deviceStatuses = deviceStatusMap.get(key);
|
|
|
|
}
|
|
|
|
for (int i=0;i<deviceStatuses.size();i++){
|
|
|
|
else {
|
|
|
|
if (deviceStatuses.get(i).getDeviceType()==1){
|
|
|
|
values[i] = hwDeviceMapper.selectSumDeviceFlagNot0();
|
|
|
|
sum=sum+hwMonitorUnitMapper.selectReleatedDeviceIdNums(list.get(i).getDeviceId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
sum = sum+1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
valuesMap.put(key,sum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return values;
|
|
|
|
|
|
|
|
|
|
|
|
return valuesMap;
|
|
|
|
|
|
|
|
|
|
|
|
//设备类型==网关 根据releated_device_id = 网关设备设备id查询个数
|
|
|
|
//设备类型==网关 根据releated_device_id = 网关设备设备id查询个数
|
|
|
|
//网关子设备数+非网关设备数(getDeviceType()!=1)
|
|
|
|
//网关子设备数+非网关设备数(getDeviceType()!=1)
|
|
|
@ -270,14 +280,18 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService
|
|
|
|
public List<HwMonitorUnit> selectTreeList(List<HwMonitorUnit> hwMonitorUnits) {
|
|
|
|
public List<HwMonitorUnit> selectTreeList(List<HwMonitorUnit> hwMonitorUnits) {
|
|
|
|
List<HwMonitorUnit> returnList = new ArrayList<>();
|
|
|
|
List<HwMonitorUnit> returnList = new ArrayList<>();
|
|
|
|
List<Long> tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList());
|
|
|
|
List<Long> tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<HwMonitorUnit> treeList = new ArrayList<>();
|
|
|
|
for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){
|
|
|
|
for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){
|
|
|
|
if (!tempList.contains(hwMonitorUnit.getParentId()))
|
|
|
|
if (!tempList.contains(hwMonitorUnit.getParentId()))
|
|
|
|
recursionFn(hwMonitorUnits,hwMonitorUnit);
|
|
|
|
recursionFn(hwMonitorUnits,hwMonitorUnit);
|
|
|
|
returnList.add(hwMonitorUnit);
|
|
|
|
returnList.add(hwMonitorUnit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < returnList.size(); i++){
|
|
|
|
return returnList;
|
|
|
|
if (returnList.get(i).getParentId()==null){
|
|
|
|
|
|
|
|
treeList.add(returnList.get(i));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return treeList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void recursionFn(List<HwMonitorUnit> list, HwMonitorUnit t)
|
|
|
|
private void recursionFn(List<HwMonitorUnit> list, HwMonitorUnit t)
|
|
|
|
{
|
|
|
|
{
|
|
|
|