From 271fed395d4d3e4ab8cdb44ccf466859ba485e46 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 09 一月 2025 17:45:33 +0800 Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat --- iailab-module-model/iailab-module-model-biz/src/test/java/com/iailab/InfluxDBTest.java | 45 ++++++++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 23 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 0ca16f4..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,14 +1,14 @@ package com.iailab; -import com.iailab.module.model.influxdb.pojo.InfluxPointValuePOJO; -import com.iailab.module.model.influxdb.pojo.InfluxPointValueSimPOJO; +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 org.junit.Test; -import org.junit.runner.RunWith; -import javax.annotation.Resource; +import com.iailab.module.model.influxdb.vo.InfluxModelResultVO; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -20,7 +20,6 @@ * @createTime 2023年12月10日 12:19:00 */ @SpringBootTest -@RunWith(SpringRunner.class) public class InfluxDBTest { @Resource @@ -30,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(); } @@ -53,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