liujie
2026-07-30 280ef5100bece9b40ac51736aef037704a52a4ca
backend/src/main/java/com/tourguide/modules/system/dto/GuideNotificationResponse.java
@@ -1,30 +1,48 @@
package com.tourguide.modules.system.dto;
import com.tourguide.modules.system.entity.SystemNotice;
import com.tourguide.modules.system.entity.GuideNotification;
import java.time.LocalDateTime;
public class GuideNotificationResponse {
    private final Long id;
    private final String id;
    private final String type;
    private final String title;
    private final String content;
    private final LocalDateTime time;
    private final boolean read;
    private final Long orderId;
    private final String targetUrl;
    public GuideNotificationResponse(SystemNotice notice, boolean read) {
        this.id = notice.getId();
        this.id = "system:" + notice.getId();
        this.type = notice.getNoticeType();
        this.title = notice.getNoticeTitle();
        this.content = notice.getNoticeContent();
        this.time = notice.getPublishTime();
        this.read = read;
        this.orderId = null;
        this.targetUrl = null;
    }
    public Long getId() { return id; }
    public GuideNotificationResponse(GuideNotification notification) {
        this.id = "guide:" + notification.getId();
        this.type = notification.getNotificationType();
        this.title = notification.getTitle();
        this.content = notification.getContent();
        this.time = notification.getCreatedAt();
        this.read = notification.getReadAt() != null;
        this.orderId = notification.getOrderId();
        this.targetUrl = notification.getTargetUrl();
    }
    public String getId() { return id; }
    public String getType() { return type; }
    public String getTitle() { return title; }
    public String getContent() { return content; }
    public LocalDateTime getTime() { return time; }
    public boolean isRead() { return read; }
    public Long getOrderId() { return orderId; }
    public String getTargetUrl() { return targetUrl; }
}