fuliqi
2025-02-21 64efb660b2c119c00432434c0f651f8996483f18
ycl-server/src/main/java/com/ycl/platform/service/impl/UYErrorTypeCheckServiceImpl.java
@@ -3,7 +3,9 @@
import com.ycl.platform.controller.YwThresholdController;
import com.ycl.platform.domain.entity.WorkOrder;
import com.ycl.platform.domain.entity.YwThreshold;
import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult;
import com.ycl.platform.domain.result.UY.*;
import com.ycl.platform.mapper.WorkOrderMapper;
import com.ycl.platform.service.IYwThresholdService;
import com.ycl.platform.service.UYErrorTypeCheckService;
import com.ycl.platform.service.WorkOrderService;
@@ -17,6 +19,7 @@
import enumeration.general.WorkOrderStatusEnum;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@@ -37,6 +40,7 @@
    private final WorkOrderService workOrderService;
    private final IYwThresholdService ywThresholdService;
    private final WorkOrderMapper workOrderMapper;
    /**
     * 图像检测生成工单
@@ -52,27 +56,27 @@
                    WorkOrder workOrder = new WorkOrder();
                    // 信号缺失
                    if (-1 == item.getSigna1()) {
                        this.genWorkOrder(workOrder, ErrorType.SIGNAL_LOSS, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
                    // 画面偏色
                    if (-1 == item.getColor()) {
                        this.genWorkOrder(workOrder, ErrorType.SCREEN_COLOR_DEVIATION, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
                    // 雪花干扰
                    if (-1 == item.getSnow()) {
                        this.genWorkOrder(workOrder, ErrorType.SNOW_STORM, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
                    // 条纹干扰
                    if (-1 == item.getStripe()) {
                        this.genWorkOrder(workOrder, ErrorType.STRIPE_INTERFERENCE, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
                    // 画面遮挡
                    if (-1 == item.getShade()) {
                        this.genWorkOrder(workOrder, ErrorType.SCREEN_OCCLUSION, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
                    // 清晰度异常
                    if (-1 == item.getBlur()) {
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_CLARITY, item.getDeviceId());
                        this.genWorkOrder(workOrder, ErrorType.ABNORMAL_PIC, item.getDeviceId());
                    }
//            // 亮度异常
//            if (-1 == item.getLight()) {
@@ -117,16 +121,31 @@
    @Override
    public void videoOnlineCheck(List<VideoOnlineResult> dataList) {
        List<WorkOrder> workOrderList = dataList.stream().map(item -> {
            WorkOrder workOrder = new WorkOrder();
            if (ApiConstants.UY_OnlineSite_Offline.equals(item.getStatus())) {
                this.genWorkOrder(workOrder, ErrorType.DEVICE_OFFLINE, item.getDeviceId());
            }
//            else if (0 == item.getStatus()) {
//                this.genWorkOrder(workOrder, ErrorType.UNKNOWN, item.getDeviceId());
//            }
            return workOrder;
        }).collect(Collectors.toList());
        //查询数据库已存在的离线工单获取ip集合,剔除
        List<String> ips = workOrderMapper.getOfflineWorkOrder();
        List<WorkOrder> workOrderList = dataList.stream()
                .filter(item -> CollectionUtils.isEmpty(ips) || !ips.contains(item.getIpAddr()))
                .map(item -> {
                    WorkOrder workOrder = new WorkOrder();
                    if (ApiConstants.UY_OnlineSite_Offline.equals(item.getStatus())) {
                        this.genWorkOrder(workOrder, ErrorType.DEVICE_OFFLINE, item.getDeviceId());
                    }
                    return workOrder;
                }).collect(Collectors.toList());
        workOrderService.innerAddWorkOrder(workOrderList);
    }
    @Override
    public void hkOnlineCheck(List<SnapshotDataMonitorResult> dataList) {
        //查询数据库已存在的离线工单获取ip集合,剔除
        List<String> ips = workOrderMapper.getOfflineWorkOrder();
        List<WorkOrder> workOrderList = dataList.stream()
                .filter(item -> CollectionUtils.isEmpty(ips) || !ips.contains(item.getIp()))
                .map(item -> {
                    WorkOrder workOrder = new WorkOrder();
                    this.genWorkOrder(workOrder, ErrorType.DEVICE_OFFLINE, item.getExternalIndexCode());
                    return workOrder;
                }).collect(Collectors.toList());
        workOrderService.innerAddWorkOrder(workOrderList);
    }
@@ -164,7 +183,7 @@
//            }
            long checkTime = item.getCheckTime().getTime();
            long osdTime = item.getSetTime().getTime();
            Long timeDiff = (checkTime - osdTime) / 1000;
            Long timeDiff = Math.abs((checkTime - osdTime) / 1000);
            ywThresholdService.check(YwThreadConstants.Video_DiffTime, timeDiff, item.getDeviceNo(), ywThresholdMap, workOrder, CompareType.MORE_THAN_EQ, ErrorType.CLOCK_SKEW.getValue());
            return workOrder;
        }).collect(Collectors.toList());