From 22a8584faeb01090bcdf3c7d1bf02d6a335dc52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Mon, 17 Feb 2025 15:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=97=B6=E9=97=B4=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/taskinfo/TaskInfoController.java | 2 +- .../admin/taskinfo/vo/TaskInfoSaveReqVO.java | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java index 18bf658..c4e6c7e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java @@ -84,7 +84,7 @@ public class TaskInfoController { return success(taskInfoService.createTaskInfo(createReqVO)); } - @PostMapping("/update") + @PutMapping("/update") @Operation(summary = "更新任务表,用于存储所有的任务信息,任务可由不同用户创建并管理。") @PreAuthorize("@ss.hasPermission('system:task-info:update')") public CommonResult updateTaskInfo(@Valid @RequestBody TaskInfoSaveReqVO updateReqVO) { 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 87b4c7b..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 @@ -1,12 +1,20 @@ package cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; +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.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; @@ -47,12 +55,16 @@ public class TaskInfoSaveReqVO { private String status; @Schema(description = "任务计划开始时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime startDate; + @JsonSerialize(using = LocalDateSerializer.class) // 序列化(响应) + @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化(请求) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; @Schema(description = "任务计划结束时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - 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;