InfoScreenHeartBeatPacket.java
2.43 KB
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
package com.yoho.rfid.model.req;
import com.yoho.rfid.util.DateUtil;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
/**
* Created by chenchao on 2017/10/16.
*/
public class InfoScreenHeartBeatPacket {
private String ip;
private String mac;
private Integer screenType;
private Long updateDateTime;
private String updateDateTimeStr;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getMac() {
return mac;
}
public void setMac(String mac) {
this.mac = mac;
}
public Integer getScreenType() {
return screenType;
}
public void setScreenType(Integer screenType) {
this.screenType = screenType;
}
public Long getUpdateDateTime() {
return updateDateTime;
}
public void setUpdateDateTime(Long updateDateTime) {
this.updateDateTime = updateDateTime;
}
public String getUpdateDateTimeStr() {
if (Objects.nonNull(updateDateTime)){
Date date = new Date(updateDateTime);
return new SimpleDateFormat(DateUtil.DATE_TIME_FORMAT).format(date);
}
return updateDateTimeStr;
}
public void setUpdateDateTimeStr(String updateDateTimeStr) {
this.updateDateTimeStr = updateDateTimeStr;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("ip", ip)
.append("mac", mac)
.append("screenType", screenType)
.append("updateDateTime", updateDateTime)
.append("updateDateTimeStr", updateDateTimeStr)
.toString();
}
public class DataBuilder{
private InfoScreenHeartBeatPacket packet = new InfoScreenHeartBeatPacket();
public DataBuilder setIp(String ip){
packet.setIp(ip);
return this;
}
public DataBuilder setMac(String mac){
packet.setMac(mac);
return this;
}
public DataBuilder setScreenType(Integer screenType){
packet.setScreenType(screenType);
return this;
}
public InfoScreenHeartBeatPacket build(){
return packet;
}
}
}