From 47c4bbf9cac1a915b125370c2629eacaadfade76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Tue, 18 Feb 2025 10:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E4=BF=AE=E6=94=B9=E5=9B=9E?= =?UTF-8?q?=E6=98=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/taskinfo/vo/TaskInfoRespVO.java | 15 +++++++++++++-- .../admin/taskinfo/vo/TaskInfoSaveReqVO.java | 10 ++++++++-- .../system/job/TaskSendStartMessageJob.java | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java index 32ee6af..c8a62cd 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java @@ -5,6 +5,11 @@ import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseinspections.Enter import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO; import cn.iocoder.yudao.module.system.dal.dataobject.tasktag.TaskTagDO; import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -59,11 +64,17 @@ public class TaskInfoRespVO { @Schema(description = "任务计划开始时间") @ExcelProperty("任务计划开始时间") - private LocalDateTime startDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; @Schema(description = "任务计划结束时间") @ExcelProperty("任务计划结束时间") - private LocalDateTime endDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; @Schema(description = "任务创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("任务创建时间") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java index 146de60..ecef9b3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoSaveReqVO.java @@ -55,10 +55,16 @@ public class TaskInfoSaveReqVO { private String status; @Schema(description = "任务计划开始时间") - private LocalDateTime startDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; @Schema(description = "任务计划结束时间") - private LocalDateTime endDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; @Schema(description = "父任务id", example = "30399") private Long parentId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java index f856932..6ae2415 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/job/TaskSendStartMessageJob.java @@ -42,9 +42,9 @@ public class TaskSendStartMessageJob implements JobHandler { reqDTO.setUserId(x.getUserId()); Map message = new HashMap<>(); message.put("thing2", beforeTaskInfo.getTitle()); - message.put("time3", DateUtil.format(beforeTaskInfo.getStartDate(), DateUtils.FORMAT_YEAR_MONTH_DAY)); + message.put("time3", DateUtil.format(beforeTaskInfo.getStartDate().atStartOfDay(), DateUtils.FORMAT_YEAR_MONTH_DAY)); message.put("thing4", beforeTaskInfo.getDescription()); - message.put("time5", DateUtil.format(beforeTaskInfo.getEndDate(), DateUtils.FORMAT_YEAR_MONTH_DAY)); + message.put("time5", DateUtil.format(beforeTaskInfo.getEndDate().atStartOfDay(), DateUtils.FORMAT_YEAR_MONTH_DAY)); reqDTO.setMessages(message); socialClientApi.sendWxaSubscribeMessage(reqDTO); }