admin
2021-12-04 c79b1ebed5a42a4cbb2f824232da2a51ff22a9a1
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package com.yeshi.location.app.vo.sos;
 
import com.yeshi.location.app.entity.location.SimpleLocationInfo;
import com.yeshi.location.app.entity.sos.SOSRecord;
import com.yeshi.location.app.entity.sos.SOSTargetInfo;
import org.yeshi.utils.StringUtil;
import org.yeshi.utils.TimeUtil;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
 
/**
 * @author hxh
 * @title: SOSRecordVO
 * @description: 求助记录输出
 * @date 2021/11/22 12:05
 */
public class SOSRecordVO {
    //头像
    private String portrait;
    //来源
    private String from;
    //简介
    private String desc;
    //电话
    private String phone;
    //位置信息
    private SimpleLocationInfo location;
    //创建时间
    private Date createTime;
    //被求助者的信息
    private String targetDesc;
 
    //求助者的用户ID
    private String targetUid;
 
    public static String getDesc(SOSRecord record, boolean own) {
        return String.format("%s在位置:\"%s\",经纬度:\"N %s W %s\"于%s发出了一条紧急救助信息,求助信息推送成功。", own ? "你" : "他", record.getLocation().getAddress() + record.getLocation().getAddressDetail(), record.getLocation().getLatitude().toString(), record.getLocation().getLongitude().toString(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"));
    }
 
    public static String getTargetDesc(List<SOSTargetInfo> infoList, Map<Long, String> nickNameMap) {
        List<String> desList = new ArrayList<>();
        for (SOSTargetInfo info : infoList) {
            desList.add(nickNameMap.get(info.getTargetUid()) + (info.getStatus() == SOSTargetInfo.STATUS_READ ? "已查阅" : "未查阅"));
        }
        return StringUtil.concat(desList, "、");
    }
 
 
    public String getTargetDesc() {
        return targetDesc;
    }
 
    public void setTargetDesc(String targetDesc) {
        this.targetDesc = targetDesc;
    }
 
    public String getPortrait() {
        return portrait;
    }
 
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
 
    public String getFrom() {
        return from;
    }
 
    public void setFrom(String from) {
        this.from = from;
    }
 
    public String getDesc() {
        return desc;
    }
 
    public void setDesc(String desc) {
        this.desc = desc;
    }
 
    public String getPhone() {
        return phone;
    }
 
    public void setPhone(String phone) {
        this.phone = phone;
    }
 
    public SimpleLocationInfo getLocation() {
        return location;
    }
 
    public void setLocation(SimpleLocationInfo location) {
        this.location = location;
    }
 
    public Date getCreateTime() {
        return createTime;
    }
 
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
 
    public String getTargetUid() {
        return targetUid;
    }
 
    public void setTargetUid(String targetUid) {
        this.targetUid = targetUid;
    }
}