| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.platform.domain.entity.WorkOrder; |
| | | import com.ycl.platform.domain.entity.YwThreshold; |
| | | import com.ycl.platform.domain.excel.PointExport; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult; |
| | | import com.ycl.platform.domain.vo.DynamicColumnVO; |
| | | import com.ycl.platform.mapper.YwThresholdMapper; |
| | | import com.ycl.platform.service.IYwThresholdService; |
| | | import com.ycl.platform.service.WorkOrderService; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.utils.ip.PingUtil; |
| | | import com.ycl.utils.poi.EasyExcelImportUtils; |
| | | import com.ycl.utils.uuid.IdUtils; |
| | | import constant.PointHeaderConstant; |
| | | import constant.YwThreadConstants; |
| | | import enumeration.CompareType; |
| | | import enumeration.ErrorType; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import utils.DateUtils; |
| | | |
| | | import java.util.*; |
| | |
| | | // 亮度异常故障检测 |
| | | } |
| | | |
| | | @Override |
| | | public Result importData(MultipartFile file) { |
| | | List<Map<String, String>> list = EasyExcelImportUtils.makeData(file); |
| | | List<PointExport> dataList = new ArrayList<>(); |
| | | for (Map<String, String> map : list) { |
| | | PointExport pointExport = new PointExport(); |
| | | pointExport.setPointName(map.get(PointHeaderConstant.Point_Name)); |
| | | pointExport.setSerialNumber(map.get(PointHeaderConstant.Serial_Number)); |
| | | dataList.add(pointExport); |
| | | } |
| | | workOrderService.batchImportWhite(dataList); |
| | | return Result.ok("导入成功"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 判断人脸阈值是否满足下发条件 |
| | | * |
| | |
| | | @Override |
| | | public void faceCheck(List<FaceDeviceInspectionResult> list) { |
| | | Map<String, YwThreshold> thresholdMap = getYwThresholdMap(BusinessTypeEnum.FACE.name()); |
| | | //准备下发工单集合 |
| | | //准备待下发工单集合 |
| | | List<WorkOrder> distributeList = new ArrayList<>(); |
| | | //准备自动生成工单集合 |
| | | //准备直接下发工单集合 |
| | | List<WorkOrder> workOrderList = new ArrayList<>(); |
| | | //处理接口数据 |
| | | for (FaceDeviceInspectionResult result : list) { |
| | |
| | | /** 添加工单 */ |
| | | workOrderService.innerAddWorkOrder(workOrderList); |
| | | workOrderService.innerAddWorkOrder(distributeList); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | v -> { |
| | | YwThreshold ywThreshold = thresholds.get(key); |
| | | //转换类型 |
| | | T thresholdValue = parseThreshold(ywThreshold.getValueAuto(), value.getClass()); |
| | | T thresholdAutoValue = parseThreshold(ywThreshold.getValue(), value.getClass()); |
| | | //待工单阈值 |
| | | T thresholdAutoValue = parseThreshold(ywThreshold.getValueAuto(), value.getClass()); |
| | | //直接下发工单阈值 |
| | | T thresholdValue = parseThreshold(ywThreshold.getValue(), value.getClass()); |
| | | //比较大小,加入到对应待处理集合 |
| | | if (compareType.compare(v, thresholdAutoValue)) { |
| | | //自动下发工单 |
| | | if (compareType.compare(v, thresholdValue)) { |
| | | //进入工单直接下发 |
| | | workOrder.setSerialNumber(serialNumber); |
| | | workOrder.setStatus(WorkOrderStatusEnum.WAIT_DISTRIBUTE); |
| | | workOrder.setStatus(WorkOrderStatusEnum.DISTRIBUTED); |
| | | if (CollectionUtils.isEmpty(workOrder.getErrorTypeList())) { |
| | | workOrder.setErrorTypeList(new ArrayList<>()); |
| | | workOrder.getErrorTypeList().add(errorType); |
| | | } else { |
| | | workOrder.getErrorTypeList().add(errorType); |
| | | } |
| | | } else if (compareType.compare(v, thresholdValue)) { |
| | | } else if (compareType.compare(v, thresholdAutoValue)) { |
| | | //进入工单代下发 |
| | | workOrder.setSerialNumber(serialNumber); |
| | | workOrder.setStatus(WorkOrderStatusEnum.DISTRIBUTED); |
| | | workOrder.setStatus(WorkOrderStatusEnum.WAIT_DISTRIBUTE); |
| | | if (CollectionUtils.isEmpty(workOrder.getErrorTypeList())) { |
| | | workOrder.setErrorTypeList(new ArrayList<>()); |
| | | workOrder.getErrorTypeList().add(errorType); |