From ca9193b861e54e69787ae9a198259e3ad8151d66 Mon Sep 17 00:00:00 2001 From: hzj <826100833@qq.com> Date: Wed, 23 Oct 2024 10:25:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cs-report/cs-report-boot/pom.xml | 10 ++++---- .../csreport/controller/TestController.java | 25 +++++++++++++------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/cs-report/cs-report-boot/pom.xml b/cs-report/cs-report-boot/pom.xml index 689c574..c593015 100644 --- a/cs-report/cs-report-boot/pom.xml +++ b/cs-report/cs-report-boot/pom.xml @@ -46,11 +46,11 @@ pqs-influx ${project.version} - - com.baomidou - dynamic-datasource-spring-boot-starter - 3.5.1 - + + + + + com.squareup.okhttp3 okhttp diff --git a/cs-report/cs-report-boot/src/main/java/com/njcn/csreport/controller/TestController.java b/cs-report/cs-report-boot/src/main/java/com/njcn/csreport/controller/TestController.java index 7e72fa5..b5d5cca 100644 --- a/cs-report/cs-report-boot/src/main/java/com/njcn/csreport/controller/TestController.java +++ b/cs-report/cs-report-boot/src/main/java/com/njcn/csreport/controller/TestController.java @@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.lang.reflect.Field; @@ -71,10 +72,12 @@ public class TestController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @GetMapping("/test") @ApiOperation("报表测试") - public HttpResult queryEvent() throws ClassNotFoundException { - + public HttpResult test(@RequestParam("dateTime") String dateTime) throws ClassNotFoundException { + DateTimeFormatter formatter1 = DateTimeFormatter.ISO_DATE; // 获取当前日期 - LocalDate today = LocalDate.now().minusDays(3); + LocalDate today = LocalDate.parse(dateTime, formatter1); + + // 计算前一天的日期 LocalDate yesterday = today.minusDays(1); // 获取前一天的开始时间(00:00:00) @@ -122,7 +125,9 @@ public class TestController { collect.forEach((tempPhase,byNameMap)->{ //最小值 InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz); - influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); + influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min") + .eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase); +// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0); byNameMap.forEach((name, eleEpdPqdList) -> { @@ -151,7 +156,9 @@ public class TestController { //最大值 InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz); - influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); + influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max") + .eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase); +// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0); byNameMap.forEach((name, eleEpdPqdList) -> { @@ -179,7 +186,9 @@ public class TestController { //平均值 InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz); - influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); + influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg") + .eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase); +// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0); byNameMap.forEach((name, eleEpdPqdList) -> { EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0); @@ -207,7 +216,9 @@ public class TestController { //CP95 InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz); - influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0); + influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg") + .eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase); +// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0); byNameMap.forEach((name, eleEpdPqdList) -> { EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);