|
|
@@ -1,8 +1,10 @@
|
|
|
package vip.xiaonuo.coldchain.modular.app.controller;
|
|
|
|
|
|
import cn.hutool.core.io.resource.InputStreamResource;
|
|
|
+import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.github.jfcloud.influxdb.flux.AggregationWindow;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import jakarta.annotation.Resource;
|
|
|
@@ -25,9 +27,11 @@ import vip.xiaonuo.common.exception.CommonException;
|
|
|
import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Tag(name = "APP移动端控制器")
|
|
|
@RestController
|
|
|
@@ -169,4 +173,18 @@ public class AppController {
|
|
|
public CommonResult<CountEntity> getIndexCount() {
|
|
|
return CommonResult.data(monitorDeviceService.getIndexCount());
|
|
|
}
|
|
|
+
|
|
|
+ @Operation(summary = "获取统计间隔单位")
|
|
|
+ @GetMapping("/device/aggregationWindow")
|
|
|
+ public CommonResult<List<Map>> getAggregationWindow(){
|
|
|
+ //从枚举获取时间单位间隔
|
|
|
+ List<Map> datas = Arrays.stream(AggregationWindow.values())
|
|
|
+ .filter(a -> !a.equals(AggregationWindow.DEFAULT) && !a.equals(AggregationWindow.MINUTE))
|
|
|
+ .map(a->{return MapUtil.builder()
|
|
|
+ .put("value",a.getCode())
|
|
|
+ .put("label",a.getDescription()).build();
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return CommonResult.data(datas);
|
|
|
+ }
|
|
|
}
|