ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
@@ -1,6 +1,7 @@ package com.ycl.platform.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.platform.domain.entity.WorkOrder; import com.ycl.platform.domain.entity.WorkOrderWhite; import com.ycl.platform.domain.entity.YwThreshold; import com.ycl.platform.domain.excel.PointExport; @@ -9,6 +10,7 @@ import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult; import com.ycl.system.Result; import com.ycl.system.page.TableDataInfo; import enumeration.CompareType; import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; @@ -136,4 +138,7 @@ * @author */ Result importWhite(MultipartFile file) throws IOException; public Map<String, YwThreshold> getYwThresholdMap(String name); public <T extends Comparable<T>> void check(String key, T value, String serialNumber, Map<String, YwThreshold> thresholds, WorkOrder workOrder, CompareType compareType, String errorType); } ycl-server/src/main/java/com/ycl/platform/service/impl/UYErrorTypeCheckServiceImpl.java
@@ -1,12 +1,19 @@ package com.ycl.platform.service.impl; 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.UY.*; import com.ycl.platform.service.IYwThresholdService; import com.ycl.platform.service.UYErrorTypeCheckService; import com.ycl.platform.service.WorkOrderService; import com.ycl.utils.DateUtils; import com.ycl.utils.uuid.IdUtils; import constant.ApiConstants; import constant.YwThreadConstants; import enumeration.CompareType; import enumeration.ErrorType; import enumeration.general.BusinessTypeEnum; import enumeration.general.WorkOrderStatusEnum; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -17,6 +24,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** @@ -28,7 +36,7 @@ public class UYErrorTypeCheckServiceImpl implements UYErrorTypeCheckService { private final WorkOrderService workOrderService; private final IYwThresholdService ywThresholdService; /** * 图像检测生成工单 * @@ -134,13 +142,9 @@ @Override public void osdCheck(List<OsdCheckResult> dataList) { Date now = new Date(); Map<String, YwThreshold> ywThresholdMap = ywThresholdService.getYwThresholdMap(BusinessTypeEnum.VIDEO.name()); List<WorkOrder> workOrderList = dataList.stream().map(item -> { WorkOrder workOrder = new WorkOrder(); // osd时间 if (!ApiConstants.OSD_Correct.equals(item.getOsdTimeCorrect())) { this.genWorkOrder(workOrder, ErrorType.CLOCK_SKEW, item.getDeviceNo()); } // osd信息 if (!ApiConstants.OSD_Correct.equals(item.getOsdProvinceCorrect()) || (!ApiConstants.OSD_Correct.equals(item.getOsdCityCorrect())) @@ -149,6 +153,14 @@ ) { this.genWorkOrder(workOrder, ErrorType.OSD_ERROR, item.getDeviceNo()); } // osd时间 时间需要走阈值检查 这里需要把时间放在后面:如果时间处于待下发的阈值那么工单状态会改为待下发的工单 // if (!ApiConstants.OSD_Correct.equals(item.getOsdTimeCorrect())) { // this.genWorkOrder(workOrder, ErrorType.CLOCK_SKEW, item.getDeviceNo()); // } long checkTime = item.getCheckTime().getTime(); long osdTime = item.getSetTime().getTime(); Long timeDiff = (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()); workOrderService.innerAddWorkOrder(workOrderList); ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
@@ -149,7 +149,6 @@ */ @Override public void videoCheck(List list) { } @Override @@ -305,7 +304,8 @@ * @param name * @return */ private Map<String, YwThreshold> getYwThresholdMap(String name) { @Override public Map<String, YwThreshold> getYwThresholdMap(String name) { return ywThresholdMapper.selectList( new QueryWrapper<YwThreshold>().eq("monitor_type", name) ).stream().collect(Collectors.toMap( @@ -583,7 +583,8 @@ * @param errorType 故障类型 * @param <T> */ private <T extends Comparable<T>> void check(String key, T value, String serialNumber, Map<String, YwThreshold> thresholds, WorkOrder workOrder, CompareType compareType,String errorType) { @Override public <T extends Comparable<T>> void check(String key, T value, String serialNumber, Map<String, YwThreshold> thresholds, WorkOrder workOrder, CompareType compareType,String errorType) { Optional.ofNullable(value).ifPresentOrElse( v -> { YwThreshold ywThreshold = thresholds.get(key);