diff --git a/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java index 48f0308a..cf4d5538 100644 --- a/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java +++ b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java @@ -1,5 +1,6 @@ package com.chint.application.dtos.system; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; @@ -10,7 +11,9 @@ public class SystemAnnouncementVO { private String title; // 公告的标题 private String content; // 公告的详细内容 private String postedBy; // 发布公告的用户或管理员的用户名 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime postDate; // 公告发布的日期和时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime expiryDate; // 公告的过期日期 private String status; // 公告的状态 private Integer priority; // 公告的优先级,用于排序 diff --git a/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java b/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java index 22c2b54f..4dd750ad 100644 --- a/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java +++ b/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java @@ -6,6 +6,7 @@ import com.chint.application.dtos.system.SystemAnnouncementVO; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.DateTimeUtil; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; @@ -29,7 +30,9 @@ public class SystemAnnouncement implements Serializable { private String title; // 公告的标题 private String content; // 公告的详细内容 private String postedBy; // 发布公告的用户或管理员的用户名 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime postDate; // 公告发布的日期和时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime expiryDate; // 公告的过期日期 private String status; // 公告的状态 private Integer priority; // 公告的优先级,用于排序 @@ -80,7 +83,7 @@ public class SystemAnnouncement implements Serializable { systemAnnouncement.setExpiryDate(expiryTime); } systemAnnouncement.setStatus("1"); - systemAnnouncement.setPriority(0); + systemAnnouncement.setPriority(dto.getPriority()); User currentUser = BaseContext.getCurrentUser(); if (currentUser != null) {