class CountDeviceStateDimension implements MeasurementDimension {

        @Override
        public DimensionDefinition getDefinition() {
            return CommonDimensionDefinition.agg;
        }

        @Override
        public DataType getValueType() {
            return historyValueType;
        }

        @Override
        public ConfigMetadata getParams() {
            return historyConfigMetadata;
        }

        @Override
        public boolean isRealTime() {
            return false;
        }

        @Override
        public Flux<SimpleMeasurementValue> getValue(MeasurementParameter parameter) {<FILL_FUNCTION_BODY>}
    }

            String format = parameter.getString("format").orElse("yyyy年MM月dd日");
            DateTimeFormatter formatter = DateTimeFormat.forPattern(format);

            return AggregationQueryParam.of()
                .sum("count")
                .groupBy(parameter.getInterval("time", Interval.ofDays(1)), format)
                .filter(query ->
                    query.where("name", parameter.getString("type").orElse("online"))
                        .is("productId", parameter.getString("productId").orElse(null))
                )
                .limit(parameter.getInt("limit").orElse(1))
                .from(parameter.getDate("from").orElse(Date.from(LocalDateTime.now().plusDays(-1).atZone(ZoneId.systemDefault()).toInstant())))
                .to(parameter.getDate("to").orElse(new Date()))
                .execute(timeSeriesManager.getService(DeviceTimeSeriesMetric.deviceMetrics())::aggregation)
                .map(data -> {
                    long ts = data.getString("time")
                        .map(time -> DateTime.parse(time, formatter).getMillis())
                        .orElse(System.currentTimeMillis());
                    return SimpleMeasurementValue.of(
                        data.get("count").orElse(0),
                        data.getString("time", ""),
                        ts);
                })
                .sort();
        
<methods>public void <init>(org.jetlinks.community.dashboard.MeasurementDefinition) ,public org.jetlinks.community.dashboard.supports.StaticMeasurement addDimension(org.jetlinks.community.dashboard.MeasurementDimension) ,public Mono<org.jetlinks.community.dashboard.MeasurementDimension> getDimension(java.lang.String) ,public Flux<org.jetlinks.community.dashboard.MeasurementDimension> getDimensions() <variables>private org.jetlinks.community.dashboard.MeasurementDefinition definition,private Map<java.lang.String,org.jetlinks.community.dashboard.MeasurementDimension> dimensions