zxl
2025-06-24 3b0516a2959e25576e4f3fda697a3b025d06c8c9
ycl-pojo/src/main/java/com/ycl/platform/domain/result/UY/MonitorQualifyResult.java
@@ -1,6 +1,7 @@
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;
@@ -19,7 +20,6 @@
    /**
     * IP地址
     */
    @TextIndexed
    private QualifyResult ip;
    /**
     * 监控点位类型
@@ -40,7 +40,6 @@
    /**
     * 设备名
     */
    @TextIndexed
    private QualifyResult name;
    /**
     * 设备状态
@@ -49,7 +48,6 @@
    /**
     * 设备编码
     */
    @TextIndexed
    private QualifyResult serialNumber;
    /**
     * 摄像机采集区域
@@ -68,18 +66,72 @@
    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()!=null?result.getCivilCode().getShowValue():"");
        vo.setCivilCodeError(result.getCivilCode()!=null?result.getCivilCode().getError():Boolean.FALSE);
        vo.setIp(result.getIp()!=null?result.getIp().getShowValue():"");
        vo.setIpError(result.getIp()!=null?result.getIp().getError():Boolean.FALSE);
        vo.setIntegratedDevice(result.getIntegrated_device()!=null?result.getIntegrated_device().getShowValue():"");
        vo.setIntegratedDeviceError(result.getIntegrated_device()!=null?result.getIntegrated_device().getError():Boolean.FALSE);
        vo.setJkdwlx(result.getJkdwlx()!=null?result.getJkdwlx().getShowValue():"");
        vo.setJkdwlxError(result.getJkdwlx()!=null?result.getJkdwlx().getError():Boolean.FALSE);
        vo.setLatitude(result.getLatitude()!=null?result.getLatitude().getShowValue():"");
        vo.setLatitudeError(result.getLatitude()!=null?result.getLatitude().getError():Boolean.FALSE);
        vo.setLongitude(result.getLongitude()!=null?result.getLongitude().getShowValue():"");
        vo.setLongitudeError(result.getLongitude()!=null?result.getLongitude().getError():Boolean.FALSE);
        vo.setMacdz(result.getMacdz()!=null?result.getMacdz().getShowValue():"");
        vo.setMacdzError(result.getMacdz()!=null?result.getMacdz().getError():Boolean.FALSE);
        vo.setName(result.getName()!=null?result.getName().getShowValue():"");
        vo.setNameError(result.getName()!=null?result.getName().getError():Boolean.FALSE);
        vo.setSbzt(result.getSbzt()!=null?result.getSbzt().getShowValue():"");
        vo.setSbztError(result.getSbzt()!=null?result.getSbzt().getError():Boolean.FALSE);
        vo.setSerialNumber(result.getSerialNumber()!=null?result.getSerialNumber().getShowValue():"");
        vo.setSerialNumberError(result.getSerialNumber()!=null?result.getSerialNumber().getError():Boolean.FALSE);
        vo.setSxjcjqy(result.getSxjcjqy()!=null?result.getSxjcjqy().getShowValue():"");
        vo.setSxjcjqyError(result.getSxjcjqy()!=null?result.getSxjcjqy().getError():Boolean.FALSE);
        vo.setSxjgnlx(result.getSxjgnlx()!=null?result.getSxjgnlx().getShowValue():"");
        vo.setSxjgnlxError(result.getSxjgnlx()!=null?result.getSxjgnlx().getError():Boolean.FALSE);
        if (result.getNewDevice()!=null && result.getNewDevice()) {
            vo.setNewDevice("是");
        } else {
            vo.setNewDevice("否");
        }
        return vo;
    }
}