liujie
2026-07-31 0cf54692efc067adca7fa4308af241f723930b58
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 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 = "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 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; }
}