张晓波
2023-10-13 bff2fbdfda25eb57dab169f28d48f1621beb981b
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.thhy.staff.modules.biz.face.entity;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.thhy.general.utils.DeepCopyUtils;
import com.thhy.general.utils.UUIDUtils;
import com.thhy.staff.config.EmqxConfig;
import com.thhy.staff.config.EmqxProperties;
import lombok.Data;
 
import java.io.Serializable;
 
@Data
public class FaceResult implements Serializable {
 
    private int code;
 
    private String msg;
 
    private boolean success;
 
    private String dev_sno;
 
    private String token;
 
    private JSONObject mqinfo;
 
    public FaceResult() {
    }
 
    public FaceResult(boolean success,FaceDevice faceDevice,String emqxConfig){
        this.success = success;
        this.code = 0;
        this.msg = "登录成功";
        this.dev_sno = faceDevice.getDevSno();
        this.mqinfo = JSON.parseObject(emqxConfig);
        this.mqinfo.put("topic",faceDevice.getDevSno());
        this.mqinfo.put("willTopic",faceDevice.getDevSno()+"-W");
        this.mqinfo.put("willContent",faceDevice.getDevSno()+"-offline");
        this.token = UUIDUtils.create();
    }
 
    public FaceResult(boolean success){
        this.success = success;
        this.code = 0;
        this.msg = "OK";
    }
}