fuliqi
2024-12-04 fefb9084284c7d14ed1d3290ba43cb144981e1be
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package com.ycl.platform.domain.result.UY;
 
import com.ycl.platform.domain.result.BaseResult;
import com.ycl.platform.domain.vo.DataCenter.MonitorQualifyResultVO;
import lombok.Data;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
 
@Data
@Document(collection = "uy_monitor_qualify")
public class MonitorQualifyResult extends BaseResult {
    /**
     * 行政编码
     */
    private QualifyResult civilCode;
    /**
     * 是否集成设备
     */
    private QualifyResult integrated_device;
    /**
     * IP地址
     */
    @TextIndexed
    private QualifyResult ip;
    /**
     * 监控点位类型
     */
    private QualifyResult jkdwlx;
    /**
     * 纬度
     */
    private QualifyResult latitude;
    /**
     * 经度
     */
    private QualifyResult longitude;
    /**
     * mac地址
     */
    private QualifyResult macdz;
    /**
     * 设备名
     */
    @TextIndexed
    private QualifyResult name;
    /**
     * 设备状态
     */
    private QualifyResult sbzt;
    /**
     * 设备编码
     */
    @TextIndexed
    private QualifyResult serialNumber;
    /**
     * 摄像机采集区域
     */
    private QualifyResult sxjcjqy;
    /**
     * 摄像机功能类型
     */
    private QualifyResult sxjgnlx;
    /**
     * 租户id
     */
    private QualifyResult tenantId;
 
    @Data
    public static class QualifyResult {
        /**
         * 是否错误 正常是false,ture表示有问题
         */
        private Boolean error;
        private String errorMessage;
        /**
         * 展示值
         */
        @TextIndexed
        private String showValue;
        /**
         * 数据原始值,如国标码等
         */
        @TextIndexed
        private String value;
    }
 
    //全对返ture
    public static boolean correct(MonitorQualifyResult result) {
        return checkError(result.getName()) &&
                checkError(result.getCivilCode()) &&
                checkError(result.getIp()) &&
                checkError(result.getSerialNumber()) &&
                checkError(result.getMacdz()) &&
                checkError(result.getLatitude()) &&
                checkError(result.getLongitude()) &&
                checkError(result.getSbzt()) &&
                checkError(result.getSxjcjqy()) &&
                checkError(result.getSxjgnlx()) &&
                checkError(result.getJkdwlx()) &&
                checkError(result.getIntegrated_device())
                ;
    }
 
    //检查指标,正常返回true
    public static boolean checkError(MonitorQualifyResult.QualifyResult result) {
        return result!=null && result.getError() != null && !result.getError();
    }
 
    public static MonitorQualifyResultVO getVO(MonitorQualifyResult result) {
        MonitorQualifyResultVO vo = new MonitorQualifyResultVO();
        vo.setCivilCode(result.getCivilCode().getShowValue());
        vo.setCivilCodeError(result.getCivilCode().getError());
        vo.setIp(result.getIp().getShowValue());
        vo.setIpError(result.getIp().getError());
        vo.setIntegratedDevice(result.getIntegrated_device().getShowValue());
        vo.setIntegratedDeviceError(result.getIntegrated_device().getError());
        vo.setJkdwlx(result.getJkdwlx().getShowValue());
        vo.setJkdwlxError(result.getJkdwlx().getError());
        vo.setLatitude(result.getLatitude().getShowValue());
        vo.setLatitudeError(result.getLatitude().getError());
        vo.setLongitude(result.getLongitude().getShowValue());
        vo.setLongitudeError(result.getLongitude().getError());
        vo.setMacdz(result.getMacdz().getShowValue());
        vo.setMacdzError(result.getMacdz().getError());
        vo.setName(result.getName().getShowValue());
        vo.setNameError(result.getName().getError());
        vo.setSbzt(result.getSbzt().getShowValue());
        vo.setSbztError(result.getSbzt().getError());
        vo.setSerialNumber(result.getSerialNumber().getShowValue());
        vo.setSerialNumberError(result.getSerialNumber().getError());
        vo.setSxjcjqy(result.getSxjcjqy().getShowValue());
        vo.setSxjcjqyError(result.getSxjcjqy().getError());
        vo.setSxjgnlx(result.getSxjgnlx().getShowValue());
        vo.setSxjgnlxError(result.getSxjgnlx().getError());
        if (result.getNewDevice()) {
            vo.setNewDevice("是");
        } else {
            vo.setNewDevice("否");
        }
        return vo;
    }
}