From 7e1912689121dfb254bbcb8e5c517e3132b73a72 Mon Sep 17 00:00:00 2001 From: xuyang <748613696@qq.com> Date: Thu, 8 Jun 2023 21:03:32 +0800 Subject: [PATCH] =?UTF-8?q?influx=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pqs-gateway/src/main/resources/bootstrap.yml | 4 ++++ .../influx/pojo/dto/StatisticalDataDTO.java | 23 ++++++++++++------- .../service/impl/CommonServiceImpl.java | 22 ++++++++++++------ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/pqs-gateway/src/main/resources/bootstrap.yml b/pqs-gateway/src/main/resources/bootstrap.yml index 457fa45df..5a314f85d 100644 --- a/pqs-gateway/src/main/resources/bootstrap.yml +++ b/pqs-gateway/src/main/resources/bootstrap.yml @@ -190,6 +190,10 @@ whitelist: - /*/v2/api-docs - /favicon.ico - /system-boot/theme/getTheme + - /cs-harmonic-boot/** + - /cs-device-boot/** + - /cs-system-boot/** + - /cs-warn-boot/** #- /device-boot/** #- /system-boot/** diff --git a/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java index 03a2e7db4..fd6008fb1 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java +++ b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/StatisticalDataDTO.java @@ -3,10 +3,7 @@ package com.njcn.influx.pojo.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.njcn.common.utils.serializer.InstantDateSerializer; import lombok.Data; -import lombok.EqualsAndHashCode; import org.influxdb.annotation.Column; -import org.influxdb.annotation.Measurement; -import retrofit2.http.Field; import java.time.Instant; @@ -21,13 +18,23 @@ import java.time.Instant; @Data public class StatisticalDataDTO { + @Column(name = "time") @JsonSerialize(using = InstantDateSerializer.class) private Instant time; - private String LineId; - private String Phase; - @Column(name = "Stat_Method") - private String statMethod; + + @Column(name = "line_id") + private String lineId; + + @Column(name = "phasic_type") + private String phaseType; + + @Column(name = "value_type") + private String valueType; + + private Double value; + private String statisticalName; - private Double statisticalData; + + } diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java index 4adb2394b..557e8162e 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java +++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/CommonServiceImpl.java @@ -1,5 +1,12 @@ package com.njcn.influx.service.impl; +import com.njcn.common.pojo.constant.PatternRegex; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.common.utils.PubUtils; +import com.njcn.influx.ano.Select; import com.njcn.influx.imapper.CommonMapper; import com.njcn.influx.pojo.dto.StatisticalDataDTO; import com.njcn.influx.pojo.po.HarmonicRatioData; @@ -31,7 +38,7 @@ public class CommonServiceImpl implements CommonService { InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(aClass,StatisticalDataDTO.class); influxQueryWrapper.eq("LineId",lineId). last(columnName,"statisticalData"). - groupBy(StatisticalDataDTO::getLineId, StatisticalDataDTO::getStatMethod, StatisticalDataDTO::getPhase); + groupBy(StatisticalDataDTO::getLineId, StatisticalDataDTO::getValueType, StatisticalDataDTO::getPhaseType); List statistical = commonMapper.getStatistical(influxQueryWrapper); @@ -41,13 +48,14 @@ public class CommonServiceImpl implements CommonService { @Override public StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType) { - HashMap> entityClassesByAnnotation = ReflectUitl.getEntityClassesByAnnotation(); - Class aClass = entityClassesByAnnotation.get(tableName); - InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(aClass,StatisticalDataDTO.class); - influxQueryWrapper.eq("line_id",lineId) + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class); + influxQueryWrapper.select(StatisticalDataDTO::getLineId) + .select(StatisticalDataDTO::getPhaseType) + .select(StatisticalDataDTO::getValueType) + .last(columnName) + .eq("line_id",lineId) .eq("phasic_type",phasic) - .eq("value_type",dataType) - .last(columnName,"statisticalData"); + .eq("value_type",dataType); return commonMapper.getLineRtData(influxQueryWrapper); } }