From 3dc714284a95fe9677a964ec039b2b547547e30d Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期二, 05 十一月 2024 11:20:37 +0800 Subject: [PATCH] 工单异步获取图片、工单导出时间参数bug --- ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 46 insertions(+), 11 deletions(-) diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java index 3dae6eb..8728731 100644 --- a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java @@ -4,12 +4,18 @@ 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; @@ -19,6 +25,7 @@ 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.*; @@ -146,6 +153,21 @@ // 浜害寮傚父鏁呴殰妫�娴� } + @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("瀵煎叆鎴愬姛"); + + } + /** * 鍒ゆ柇浜鸿劯闃堝�兼槸鍚︽弧瓒充笅鍙戞潯浠� * @@ -154,9 +176,9 @@ @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) { @@ -239,9 +261,11 @@ //妫�鏌ョ櫧澶╂湭璇嗗埆閲� Integer dayNoNumberCountResult = result.getSnapPlate().getDayNoNumberCount(); check(YwThreadConstants.Car_DayNoNumberCount, dayNoNumberCountResult, result.getExternalIndexCode(), thresholdMap, workOrder, CompareType.MORE_THAN_EQ, ErrorType.UNRECOGNIZED_DAY_VOLUME.getValue()); - //杞﹁締涓昏灞炴�т笉瀹屾暣鐜� + //杞﹁締涓昏灞炴�т竴鑷寸巼 Integer noIntegrityCountResult = result.getIntegrity().getMainNoIntegrityCount(); - check(YwThreadConstants.Car_NoIntegrityCount, noIntegrityCountResult, result.getExternalIndexCode(), thresholdMap, workOrder, CompareType.MORE_THAN_EQ, ErrorType.CAR_SIX.getValue()); + Integer dataCount = result.getDataCount(); + Double integrityRate = ((double)dataCount-noIntegrityCountResult)/dataCount; + check(YwThreadConstants.Car_NoIntegrityCount, integrityRate, result.getExternalIndexCode(), thresholdMap, workOrder, CompareType.LESS_THAN_EQ, ErrorType.CAR_SIX.getValue()); // 鐐逛綅鍦ㄧ嚎鐜� if (2 == result.getSnapResult()) { workOrder.setSerialNumber(result.getExternalIndexCode()); @@ -262,6 +286,7 @@ /** 娣诲姞宸ュ崟 */ workOrderService.innerAddWorkOrder(workOrderList); workOrderService.innerAddWorkOrder(distributeList); + } /** @@ -295,23 +320,33 @@ 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("percent".equals(ywThreshold.getCountType())){ + if (thresholdAutoValue instanceof Float) { + thresholdAutoValue = (T) Float.valueOf(((Float) thresholdAutoValue) / 100f); + } + if (thresholdValue instanceof Float) { + thresholdValue = (T) Float.valueOf(((Float) thresholdValue) / 100f); + } + } //姣旇緝澶у皬锛屽姞鍏ュ埌瀵瑰簲寰呭鐞嗛泦鍚� - 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)) { //杩涘叆宸ュ崟浠d笅鍙� 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); -- Gitblit v1.8.0