From d9a8c2818c7e12b531aa83c07747d337adc5a0c7 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期三, 08 一月 2025 11:31:49 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java index 026c73a..528b006 100644 --- a/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java +++ b/iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java @@ -1,12 +1,14 @@ package com.iailab; -import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; -import com.iailab.module.data.influxdb.pojo.InfluxPointValueSimPOJO; -import com.iailab.module.data.influxdb.service.InfluxDBService; +import com.iailab.module.model.common.enums.DataTypeEnum; +import com.iailab.module.model.influxdb.pojo.InfluxModelResultPOJO; +import com.iailab.module.model.influxdb.pojo.InfluxModelResultSimPOJO; +import com.iailab.module.model.influxdb.service.InfluxDBService; +import com.iailab.module.model.influxdb.vo.InfluxModelResultVO; import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; - import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -17,6 +19,7 @@ * @Description * @createTime 2023年12月10日 12:19:00 */ +@SpringBootTest public class InfluxDBTest { @Resource @@ -26,22 +29,22 @@ @Test public void testWrite() { try { - List<InfluxPointValuePOJO> pointValues = new ArrayList<>(); - InfluxPointValuePOJO pojo = new InfluxPointValueSimPOJO(); - pojo.setPoint("88880102030001"); - pojo.setType("float"); + List<InfluxModelResultPOJO> pointValues = new ArrayList<>(); + InfluxModelResultSimPOJO pojo = new InfluxModelResultSimPOJO(); + pojo.setOutPutId("0001"); + pojo.setType(DataTypeEnum.FLOAT.getCode()); pojo.setTimestamp(new Date().toInstant()); - ((InfluxPointValueSimPOJO) pojo).setValue(123d); + pojo.setValue(Double.valueOf(0.001)); pointValues.add(pojo); - InfluxPointValuePOJO pojo1 = new InfluxPointValueSimPOJO(); - pojo1.setPoint("88880102030001"); - pojo1.setType("float"); + InfluxModelResultSimPOJO pojo1 = new InfluxModelResultSimPOJO(); + pojo1.setOutPutId("0002"); + pojo1.setType(DataTypeEnum.FLOAT.getCode()); pojo1.setTimestamp(new Date().toInstant()); - ((InfluxPointValueSimPOJO) pojo1).setValue(456d); + pojo1.setValue(Double.valueOf(0.002)); pointValues.add(pojo1); - influxDBService.asyncWritePointValues(pointValues); + influxDBService.asyncWriteModelResults(pointValues); } catch (Exception ex) { ex.printStackTrace(); } @@ -49,16 +52,16 @@ } @Test - public void testQueryPointMaxValue() { - InfluxPointValuePOJO point = new InfluxPointValuePOJO(); - point.setType("float"); - point.setPoint("88880102030001"); + public void testQuery() { + InfluxModelResultPOJO pojo = new InfluxModelResultPOJO(); + pojo.setType("float"); + pojo.setOutPutId("0001"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR_OF_DAY, -1); - Object value = influxDBService.queryPointMaxValue(point, calendar.getTime()); + List<InfluxModelResultVO> influxModelResultVOS = influxDBService.queryModelResults(pojo, calendar.getTime(), Calendar.getInstance().getTime()); - System.out.println("value=" + value); + System.out.println("value=" + influxModelResultVOS); } } -- Gitblit v1.9.3