张晓波
2023-10-30 1b3a14a25d8f5013158ef2842e9be0e24240f2b5
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
package com.thhy.staff.modules.biz.platuser.entity;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.thhy.general.annotations.Idkey;
import lombok.Data;
 
import java.io.Serializable;
import java.util.Date;
 
@Data
public class DoorLis implements Serializable {
 
    @Idkey
    private String id;
 
    private String ipAddress;
 
    private String macAddress;
 
    private Date dateTime;
 
    private int noticeType;
 
    private String name;
 
    private String employeeNoString;
 
    private int verify;
 
    private String oriStr;
 
    private Integer cmpType;
 
    private String captureScore;
 
 
    public DoorLis() {
    }
 
    public DoorLis(String oriStr) {
        this.oriStr = oriStr;
    }
 
    public DoorLis(JSONObject jsonObject) {
        this.macAddress = jsonObject.getString("dev_sno");
        long time = jsonObject.getLong("capture_time");
        this.dateTime = new Date(time);
        this.employeeNoString = jsonObject.getString("person_id");
        this.oriStr = jsonObject.getString("capture_img");
        this.cmpType = jsonObject.getInteger("cmp_type");
        this.verify = jsonObject.getInteger("capture_status");
        this.captureScore = jsonObject.getString("capture_score");
    }
 
    public static void main(String[] args) {
        String mess = "{\n" +
                "    \"dev_sno\": \" 04:12:53:FA:21:DA\",\n" +
                "    \"token\": \"f9k4l8ds3e92w02d9c82013na0s9\",\n" +
                "    \"person_id\": 12306,\n" +
                "    \"person_name\": \"张三\",\n" +
                "    \"person_temperature\": 36.7,\n" +
                "    \"person_type\": \"1\",\n" +
                "    \"id_card\": \"\",\n" +
                "    \"ic_card\": \"\",\n" +
                "    \"capture_img\": \"/9i/4aVBORw\",\n" +
                "    \"capture_score\": \"85.64\",\n" +
                "    \"capture_time\": \"1610967016235\",\n" +
                "    \"capture_status\": 1\n" +
                "}";
        JSONObject jsonObject = JSON.parseObject(mess);
        DoorLis doorLis = new DoorLis(jsonObject);
        System.out.println(doorLis.getName());
    }
}