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); }