From 20fa685dd1fe1fdfa0cd49ddde6d189fbb807173 Mon Sep 17 00:00:00 2001 From: xiepufeng <1072271977@qq.com> Date: Sun, 7 Apr 2024 17:12:11 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0setPeriodType=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=AF=BC=E8=87=B4@Data=E6=B3=A8=E8=A7=A3=E4=B8=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4setPeriodType=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=98=A0=E5=B0=84=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=202.=E8=8E=B7=E5=8F=96=E5=8E=86=E5=8F=B2=E4=BA=A4=E9=80=9A?= =?UTF-8?q?=E6=88=AA=E9=9D=A2=E6=95=B0=E6=8D=AE=E8=AF=B7=E6=B1=82=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4=E5=92=8C=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=B6=E9=97=B4=E6=B7=BB=E5=8A=A0=20=20@DateTimeFor?= =?UTF-8?q?mat(pattern=20=3D=20"yyyy-MM-dd=20HH:mm:ss")=E6=B3=A8=E8=A7=A3?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E5=AF=B9=E5=BA=94=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=203.=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=8E=86=E5=8F=B2=E4=BA=A4=E9=80=9A=E6=88=AA=E9=9D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E4=B8=BAnull=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/domain/DcTrafficSectionData.java | 6 ++++++ .../request/DcTrafficSectionDataRequest.java | 3 +++ .../impl/DcTrafficStatisticsServiceImpl.java | 15 ++++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSectionData.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSectionData.java index 860bcf6a..5ac4e709 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSectionData.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSectionData.java @@ -47,12 +47,14 @@ public class DcTrafficSectionData { /** * 统计时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date statisticalDate; /** * 上报时间 */ @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date reportTime; /** @@ -87,6 +89,10 @@ public class DcTrafficSectionData { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date updateTime; + public void setPeriodType(Byte periodType) { + this.periodType = periodType; + } + /** * 设置交通数据的统计周期类型。 * @param periodType 统计周期类型的枚举值。 diff --git a/zc-business/src/main/java/com/zc/business/request/DcTrafficSectionDataRequest.java b/zc-business/src/main/java/com/zc/business/request/DcTrafficSectionDataRequest.java index 5c9540ff..e99f04f3 100644 --- a/zc-business/src/main/java/com/zc/business/request/DcTrafficSectionDataRequest.java +++ b/zc-business/src/main/java/com/zc/business/request/DcTrafficSectionDataRequest.java @@ -1,6 +1,7 @@ package com.zc.business.request; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -25,11 +26,13 @@ public class DcTrafficSectionDataRequest { /** * 开始时间 */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** * 结束时间 */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; /** diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java index e92bce6b..5924c2b6 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java @@ -123,9 +123,18 @@ public class DcTrafficStatisticsServiceImpl LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.between(DcTrafficSectionData::getStatisticalDate, request.getStartTime(), request.getEndTime()); queryWrapper.eq(DcTrafficSectionData::getPeriodType, request.getPeriodType()); - queryWrapper.eq(DcTrafficSectionData::getDirection, request.getDirection()); - queryWrapper.eq(DcTrafficSectionData::getDeviceType, request.getDeviceType()); - queryWrapper.eq(DcTrafficSectionData::getDeviceId, request.getDeviceId()); + + if (request.getDirection() != null) { + queryWrapper.eq(DcTrafficSectionData::getDirection, request.getDirection()); + } + + if (request.getDeviceType() != null) { + queryWrapper.eq(DcTrafficSectionData::getDeviceType, request.getDeviceType()); + } + + if (request.getDeviceId() != null) { + queryWrapper.eq(DcTrafficSectionData::getDeviceId, request.getDeviceId()); + } return list(queryWrapper); }