diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/statistics/vo/MpStatisticsGetReqVO.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/statistics/vo/MpStatisticsGetReqVO.java index 4d7a84aba..be8bca04d 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/statistics/vo/MpStatisticsGetReqVO.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/controller/admin/statistics/vo/MpStatisticsGetReqVO.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.mp.controller.admin.statistics.vo; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import jakarta.validation.constraints.NotNull; import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -17,7 +17,7 @@ public class MpStatisticsGetReqVO { @NotNull(message = "公众号账号的编号不能为空") private Long accountId; - @Schema(description = "查询时间范围") + @Schema(description = "查询时间范围", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @NotNull(message = "查询时间范围不能为空") private LocalDateTime[] date; diff --git a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/statistics/MpStatisticsConvert.java b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/statistics/MpStatisticsConvert.java index 174b0fdc3..9d4d7e3de 100644 --- a/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/statistics/MpStatisticsConvert.java +++ b/yudao-module-mp/yudao-module-mp-biz/src/main/java/cn/iocoder/yudao/module/mp/convert/statistics/MpStatisticsConvert.java @@ -11,10 +11,16 @@ import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; +import org.mapstruct.Named; import org.mapstruct.factory.Mappers; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; + @Mapper public interface MpStatisticsConvert { @@ -27,7 +33,7 @@ public interface MpStatisticsConvert { List convertList03(List list); @Mappings({ - @Mapping(source = "refDate", target = "refDate", dateFormat = "yyyy-MM-dd"), + @Mapping(target = "refDate", expression = "java(dateFormat0(bean.getRefDate()))"), @Mapping(source = "msgUser", target = "messageUser"), @Mapping(source = "msgCount", target = "messageCount"), }) @@ -35,6 +41,12 @@ public interface MpStatisticsConvert { List convertList04(List list); - @Mapping(source = "refDate", target = "refDate", dateFormat = "yyyy-MM-dd") + @Mapping(target = "refDate", expression = "java(dateFormat0(bean.getRefDate()))") MpStatisticsInterfaceSummaryRespVO convert(WxDataCubeInterfaceResult bean); + + @Named("dateFormat0") + default LocalDateTime dateFormat0(String date) { + return LocalDate.parse(date, DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY)).atStartOfDay(); + } + }