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;
|
}
|
}
|