diff --git a/src/main/java/com/gaotao/modules/dashboard/service/DashboardWebSocketService.java b/src/main/java/com/gaotao/modules/dashboard/service/DashboardWebSocketService.java index d97391ed..574c469a 100644 --- a/src/main/java/com/gaotao/modules/dashboard/service/DashboardWebSocketService.java +++ b/src/main/java/com/gaotao/modules/dashboard/service/DashboardWebSocketService.java @@ -59,7 +59,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushManualPickingData(Map data) { - log.debug("推送人工拣选看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/manual-picking", createResponseWithServerTime(data)); @@ -74,9 +73,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushRobotPickingData(Map data) { - log.debug("推送机械臂拣选看板数据: 周转箱{}条, 原材{}条", - data.get("containerList") != null ? ((java.util.List)data.get("containerList")).size() : 0, - data.get("materialList") != null ? ((java.util.List)data.get("materialList")).size() : 0); try { messagingTemplate.convertAndSend("/topic/dashboard/robot-picking", createResponseWithServerTime(data)); @@ -91,7 +87,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushSlittingBoardData(Map data) { - log.debug("推送分切区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/slitting-board", createResponseWithServerTime(data)); @@ -106,7 +101,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushInventoryBoardData(Map data) { - log.debug("推送库存分析看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/inventory-board", createResponseWithServerTime(data)); @@ -121,7 +115,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushFinishedProductBoardData(Map data) { - log.debug("推送成品入库出库区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/finished-product-board", createResponseWithServerTime(data)); @@ -136,7 +129,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushMaterialReceivingBoardData(Map data) { - log.debug("推送原材收货区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/material-receiving-board", createResponseWithServerTime(data)); @@ -151,7 +143,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushBufferBoardData(Map data) { - log.debug("推送缓存区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/buffer-board", createResponseWithServerTime(data)); @@ -166,7 +157,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushWorkshopFeedingBoardData(Map data) { - log.debug("推送车间AGV放料区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/workshop-feeding-board", createResponseWithServerTime(data)); @@ -181,7 +171,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushExceptionBoardData(Map data) { - log.debug("推送异常处理区看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/exception-board", createResponseWithServerTime(data)); @@ -196,7 +185,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void broadcastToAllDashboards(Map data) { - log.info("广播推送到所有看板"); try { messagingTemplate.convertAndSend("/topic/dashboard/broadcast", createResponseWithServerTime(data)); @@ -211,7 +199,6 @@ public class DashboardWebSocketService { * @param data 看板数据 */ public void pushWarehouse3dBoardData(Map data) { - log.debug("推送智能立体仓库看板数据"); try { messagingTemplate.convertAndSend("/topic/dashboard/warehouse-3d", createResponseWithServerTime(data)); @@ -227,7 +214,6 @@ public class DashboardWebSocketService { * @param data 数据 */ public void pushToTopic(String topic, Object data) { - log.debug("推送数据到主题: {}", topic); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E"); String serverTime = sdf.format(new Date()); @@ -237,4 +223,3 @@ public class DashboardWebSocketService { } } } - diff --git a/src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java b/src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java index b8bb99f6..845136f7 100644 --- a/src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java +++ b/src/main/java/com/gaotao/modules/dashboard/task/DashboardPushTask.java @@ -1,6 +1,5 @@ package com.gaotao.modules.dashboard.task; -import com.beust.ah.A; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.gaotao.common.utils.HttpUtils; @@ -8,7 +7,6 @@ import com.gaotao.modules.automatedWarehouse.entity.tusk.AgvStatus; import com.gaotao.modules.automatedWarehouse.entity.tusk.TuskResponse; import com.gaotao.modules.automatedWarehouse.service.TuskClientService; import com.gaotao.modules.dashboard.service.DashboardWebSocketService; -import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; @@ -32,13 +30,12 @@ import java.util.*; *
    *
  • 每5秒检查一次机械臂拣选数据
  • *
  • 数据有变化时立即推送
  • - *
  • 推送失败时记录日志,不影响下次推送
  • + *
  • 推送失败不影响下次推送
  • *
* * @author System * @since 2025-01-23 */ -@Slf4j @Component public class DashboardPushTask { @@ -95,13 +92,10 @@ public class DashboardPushTask { public void pushManualPickingData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } try { - log.debug("=== 开始获取人工拣选看板数据 ==="); - // 从WCS获取人工拣选数据 Map data = getManualPickingDataFromWcs(); @@ -115,17 +109,14 @@ public class DashboardPushTask { webSocketService.pushManualPickingData(data); lastDataHash.put("manual-picking", currentHash); - log.debug("=== 人工拣选数据推送完成 ==="); - - } catch (Exception e) { - log.error("推送人工拣选数据失败,推送空数据清空前端列表: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyManualPickingData(); webSocketService.pushManualPickingData(emptyData); lastDataHash.put("manual-picking", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -141,27 +132,19 @@ public class DashboardPushTask { ObjectMapper mapper = new ObjectMapper(); // 请求1043站数据 - log.info("调用WCS人工拣选API (1043站): {}", url); List> station1043List = getStationData(url, "1043", mapper); - log.info("1043站数据获取完成: {}条", station1043List.size()); // 请求1028站数据 - log.info("调用WCS人工拣选API (1028站): {}", url); List> station1028List = getStationData(url, "1028", mapper); - log.info("1028站数据获取完成: {}条", station1028List.size()); // 构造返回数据 Map resultData = new HashMap<>(); resultData.put("station1043List", station1043List); resultData.put("station1028List", station1028List); - log.info("=== 人工拣选数据处理完成 === 1043站:{}条, 1028站:{}条", - station1043List.size(), station1028List.size()); - return resultData; - } catch (Exception e) { - log.error("从WCS获取人工拣选数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return null; } } @@ -182,14 +165,12 @@ public class DashboardPushTask { String jsonBody = "\"" + devCode + "\""; String wcsResponse = HttpUtils.doPost(url, jsonBody, null); - log.debug("WCS API返回数据 ({}站): {}", devCode, wcsResponse); // 解析JSON数据 JsonNode rootNode = mapper.readTree(wcsResponse); // 获取sortingStations数组 if (!rootNode.has("sortingStations")) { - log.warn("WCS返回数据中没有sortingStations ({}站)", devCode); return stationList; } @@ -208,8 +189,8 @@ public class DashboardPushTask { } } - } catch (Exception e) { - log.error("获取{}站数据失败: {}", devCode, e.getMessage(), e); + } catch (Exception ignored) { + // 单次采集失败返回已有结果,避免中断整页看板推送 } return stationList; @@ -283,7 +264,6 @@ public class DashboardPushTask { public void pushRobotPickingData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -301,15 +281,14 @@ public class DashboardPushTask { webSocketService.pushRobotPickingData(data); lastDataHash.put("robot-picking", currentHash); - } catch (Exception e) { - log.error("推送机械臂拣选数据失败,推送空数据清空前端列表: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyData(); webSocketService.pushRobotPickingData(emptyData); lastDataHash.put("robot-picking", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -332,14 +311,12 @@ public class DashboardPushTask { // 检查返回码 int resCode = rootNode.get("resCode").asInt(); if (resCode != 200) { - log.warn("WCS API返回错误: code={}", resCode); return null; } // 获取sortingStations数组 JsonNode resData = rootNode.get("resData"); if (resData == null || !resData.has("sortingStations")) { - log.warn("WCS返回数据中没有sortingStations"); return createEmptyData(); } @@ -374,8 +351,7 @@ public class DashboardPushTask { return resultData; - } catch (Exception e) { - log.error("从WCS获取机械臂拣选数据失败: {}", e.getMessage()); + } catch (Exception ignored) { return null; } } @@ -460,7 +436,6 @@ public class DashboardPushTask { public void pushSlittingBoardData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -478,15 +453,14 @@ public class DashboardPushTask { webSocketService.pushSlittingBoardData(data); lastDataHash.put("slitting-board", currentHash); - } catch (Exception e) { - log.error("推送分切区看板数据失败,推送空数据清空前端列表: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptySlittingData(); webSocketService.pushSlittingBoardData(emptyData); lastDataHash.put("slitting-board", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -500,11 +474,9 @@ public class DashboardPushTask { try { // 查询助力臂区数据 List> assistArmList = dashboardDao.querySlittingAssistArmData(); - log.debug("查询到助力臂区数据: {}条", assistArmList != null ? assistArmList.size() : 0); // 查询分切入库区数据 List> inboundList = dashboardDao.querySlittingInboundData(); - log.debug("查询到分切入库区数据: {}条", inboundList != null ? inboundList.size() : 0); // 构造返回数据 Map resultData = new HashMap<>(); @@ -513,8 +485,7 @@ public class DashboardPushTask { return resultData; - } catch (Exception e) { - log.error("从数据库获取分切区看板数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return null; } } @@ -558,7 +529,6 @@ public class DashboardPushTask { public void refreshWarehouseInventoryTrendCache() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用,跳过库存趋势缓存刷新"); return; } @@ -572,11 +542,8 @@ public class DashboardPushTask { specifiedMaterialTrendCache = specifiedMaterialTrend != null ? new ArrayList<>(specifiedMaterialTrend) : Collections.emptyList(); finishedGoodsTrendCache = finishedGoodsTrend != null ? new ArrayList<>(finishedGoodsTrend) : Collections.emptyList(); - log.info("刷新库存趋势缓存完成: 原材料{}条, 规格料{}条, 产成品{}条", - rawMaterialTrendCache.size(), specifiedMaterialTrendCache.size(), finishedGoodsTrendCache.size()); - } catch (Exception e) { + } catch (Exception ignored) { // 刷新失败时保留上一次成功数据,避免看板趋势瞬间被清空 - log.error("刷新库存趋势缓存失败,沿用上次缓存数据: {}", e.getMessage(), e); } } @@ -597,7 +564,6 @@ public class DashboardPushTask { public void pushWarehouse3dBoardData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -615,15 +581,14 @@ public class DashboardPushTask { webSocketService.pushWarehouse3dBoardData(data); lastDataHash.put("warehouse-3d", currentHash); - } catch (Exception e) { - log.error("推送智能立体仓库看板数据失败,推送空数据: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyWarehouse3dData(); webSocketService.pushWarehouse3dBoardData(emptyData); lastDataHash.put("warehouse-3d", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -635,40 +600,30 @@ public class DashboardPushTask { */ private Map getWarehouse3dBoardDataFromDb() { try { - log.debug("开始从数据库获取智能立体仓库看板数据"); - // 查询任务统计数据 Map taskStats = dashboardDao.queryWarehouseTaskStats(); - log.debug("任务统计数据: {}", taskStats); // 查询库位利用率数据(从WCS Board API获取) Map storageUtilization = getInventoryStatsFromWcs(); - log.debug("库位利用率数据: {}", storageUtilization); // 查询机器人状态数据(从WMS Dashboard API获取) List> robotStatus = getRobotSortingInfoFromWms(); - log.debug("查询到机器人状态数据: {}条", robotStatus != null ? robotStatus.size() : 0); // 查询AGV状态数据(从TUSK系统获取) List> agvStatus = getAgvStatusFromTusk(); - log.debug("查询到AGV状态数据: {}条", agvStatus != null ? agvStatus.size() : 0); // 查询领料申请单统计 //Map materialRequestStats = dashboardDao.queryWarehouseMaterialRequestStats(); Map materialRequestStats = new HashMap<>(); - log.debug("领料申请单统计: {}", materialRequestStats); // 查询发货统计 //Map shipmentStats = dashboardDao.queryWarehouseShipmentStats(); Map shipmentStats = new HashMap<>(); - log.debug("发货统计: {}", shipmentStats); // 使用小时级任务刷新后的库存趋势缓存,避免10秒推送高频查库 List> rawMaterialTrend = new ArrayList<>(rawMaterialTrendCache); List> specifiedMaterialTrend = new ArrayList<>(specifiedMaterialTrendCache); List> finishedGoodsTrend = new ArrayList<>(finishedGoodsTrendCache); - log.debug("使用库存趋势缓存数据: 原材料{}条, 规格料{}条, 产成品{}条", - rawMaterialTrend.size(), specifiedMaterialTrend.size(), finishedGoodsTrend.size()); // 构造返回数据 Map resultData = new HashMap<>(); @@ -684,11 +639,9 @@ public class DashboardPushTask { resultData.put("specifiedMaterialTrend", specifiedMaterialTrend != null ? specifiedMaterialTrend : new ArrayList<>()); resultData.put("finishedGoodsTrend", finishedGoodsTrend != null ? finishedGoodsTrend : new ArrayList<>()); - log.debug("智能立体仓库看板数据组装完成"); return resultData; - } catch (Exception e) { - log.error("从数据库获取智能立体仓库看板数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return null; } } @@ -717,10 +670,8 @@ public class DashboardPushTask { try { // 调用WCS Board API String url = wcsBoardApi + "WmsDashboard/inventory-stats"; - log.debug("调用WCS库存统计API: {}", url); String wcsResponse = HttpUtils.doGet(url, null, null); - log.debug("WCS API返回数据: {}", wcsResponse); // 解析JSON数据 ObjectMapper mapper = new ObjectMapper(); @@ -729,22 +680,18 @@ public class DashboardPushTask { // 检查返回码 int resCode = rootNode.get("resCode").asInt(); if (resCode != 200) { - String resMsg = rootNode.has("resMsg") ? rootNode.get("resMsg").asText() : "未知错误"; - log.warn("WCS API返回错误: code={}, msg={}", resCode, resMsg); return createEmptyStorageData(); } // 获取resData数据 JsonNode resData = rootNode.get("resData"); if (resData == null || resData.isNull()) { - log.warn("WCS返回数据中没有resData"); return createEmptyStorageData(); } // 获取materialInventory(物料库存) JsonNode materialInventory = resData.get("materialInventory"); if (materialInventory == null || materialInventory.isNull()) { - log.warn("WCS返回数据中没有materialInventory"); return createEmptyStorageData(); } @@ -809,14 +756,9 @@ public class DashboardPushTask { storageData.put("materialInventory", materialInventoryData); // 物料盘库存 storageData.put("emptyContainerInventory", emptyContainerInventoryData); // 空盘库存 - log.info("库存统计数据获取成功 - 物料盘[平托:{}, 框架托:{}, 钢托:{}], 空盘[平托:{}, 框架托:{}, 钢托:{}], 总使用:{}, 利用率:{}%", - materialFlatPallet, materialFramePallet, materialSteelPallet, - emptyFlatPallet, emptyFramePallet, emptySteelPallet, usedSlots, utilizationRate); - return storageData; - } catch (Exception e) { - log.error("从WCS获取库存统计数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return createEmptyStorageData(); } } @@ -905,7 +847,6 @@ public class DashboardPushTask { try { // 如果TUSK客户端服务未配置,返回空列表 if (tuskClientService == null) { - log.debug("TUSK客户端服务未配置,跳过AGV状态查询"); return agvList; } @@ -913,7 +854,6 @@ public class DashboardPushTask { TuskResponse> response = tuskClientService.getOnlineRobots(); if (!response.isSuccess() || response.getData() == null) { - log.warn("从TUSK获取AGV状态失败: {}", response.getMsg()); return agvList; } @@ -941,10 +881,8 @@ public class DashboardPushTask { agvList.add(agv); } - log.debug("成功从TUSK获取{}个AGV状态", agvList.size()); - - } catch (Exception e) { - log.error("从TUSK获取AGV状态异常: {}", e.getMessage(), e); + } catch (Exception ignored) { + // 单次采集失败返回已有结果,避免中断整页看板推送 } return agvList; @@ -1027,7 +965,6 @@ public class DashboardPushTask { public void pushFinishedProductBoardData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -1045,15 +982,14 @@ public class DashboardPushTask { webSocketService.pushFinishedProductBoardData(data); lastDataHash.put("finished-product", currentHash); - } catch (Exception e) { - log.error("推送成品入库出库区看板数据失败,推送空数据清空前端列表: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyFinishedProductData(); webSocketService.pushFinishedProductBoardData(emptyData); lastDataHash.put("finished-product", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -1067,11 +1003,9 @@ public class DashboardPushTask { try { // 查询成品包装区数据 List> packageList = dashboardDao.queryFinishPackageData(); - log.debug("查询到成品包装区数据: {}条", packageList != null ? packageList.size() : 0); // 查询成品入库区数据 List> inboundList = dashboardDao.queryFinishInboundData(); - log.debug("查询到成品入库区数据: {}条", inboundList != null ? inboundList.size() : 0); // 构造返回数据 Map resultData = new HashMap<>(); @@ -1080,8 +1014,7 @@ public class DashboardPushTask { return resultData; - } catch (Exception e) { - log.error("从数据库获取成品入库出库区看板数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return null; } } @@ -1129,7 +1062,6 @@ public class DashboardPushTask { public void pushMaterialReceivingBoardData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -1147,15 +1079,14 @@ public class DashboardPushTask { webSocketService.pushMaterialReceivingBoardData(data); lastDataHash.put("material-receiving", currentHash); - } catch (Exception e) { - log.error("推送原材收货区看板数据失败,推送空数据清空前端列表: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyMaterialReceivingData(); webSocketService.pushMaterialReceivingBoardData(emptyData); lastDataHash.put("material-receiving", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -1169,11 +1100,9 @@ public class DashboardPushTask { try { // 查询原材收货区数据 List> receiveList = dashboardDao.queryReceivingReceiveData(); - log.debug("查询到原材收货区数据: {}条", receiveList != null ? receiveList.size() : 0); // 查询原材入库区数据 List> inboundList = dashboardDao.queryReceivingInboundData(); - log.debug("查询到原材入库区数据: {}条", inboundList != null ? inboundList.size() : 0); // 构造返回数据 Map resultData = new HashMap<>(); @@ -1182,8 +1111,7 @@ public class DashboardPushTask { return resultData; - } catch (Exception e) { - log.error("从数据库获取原材收货区看板数据失败: {}", e.getMessage(), e); + } catch (Exception ignored) { return null; } } @@ -1237,10 +1165,8 @@ public class DashboardPushTask { try { // 调用WMS Dashboard API(使用配置文件中的URL) String url = wcsBoardApi + "WmsDashboard/robot-sorting-info"; - log.debug("调用WMS机械臂分拣API: {}", url); String wmsResponse = HttpUtils.doGet(url, null, null); - log.debug("WMS API返回数据: {}", wmsResponse); // 解析JSON数据 ObjectMapper mapper = new ObjectMapper(); @@ -1249,20 +1175,16 @@ public class DashboardPushTask { // 检查返回码 int resCode = rootNode.get("resCode").asInt(); if (resCode != 200) { - String resMsg = rootNode.has("resMsg") ? rootNode.get("resMsg").asText() : "未知错误"; - log.warn("WMS机械臂分拣API返回错误: code={}, msg={}", resCode, resMsg); return robotList; } // 获取resData.sortingStations数组 if (!rootNode.has("resData") || !rootNode.get("resData").has("sortingStations")) { - log.warn("WMS返回数据中没有sortingStations"); return robotList; } JsonNode sortingStations = rootNode.get("resData").get("sortingStations"); if (!sortingStations.isArray()) { - log.warn("sortingStations不是数组格式"); return robotList; } @@ -1307,10 +1229,8 @@ public class DashboardPushTask { robotList.add(robot); } - log.info("从WMS获取到{}个机械臂分拣站状态", robotList.size()); - - } catch (Exception e) { - log.error("从WMS获取机械臂分拣数据失败", e); + } catch (Exception ignored) { + // 单次采集失败返回已有结果,避免中断整页看板推送 } return robotList; @@ -1412,7 +1332,6 @@ public class DashboardPushTask { public void pushExceptionBoardData() { // 检查总开关 if (!dashboardPushEnabled) { - log.trace("看板推送已禁用"); return; } @@ -1430,15 +1349,14 @@ public class DashboardPushTask { webSocketService.pushExceptionBoardData(data); lastDataHash.put("exception-board", currentHash); - } catch (Exception e) { - log.error("推送异常看板数据失败,推送空数据: {}", e.getMessage(), e); + } catch (Exception ignored) { // 异常时推送空数据,避免前端显示过期数据 try { Map emptyData = createEmptyExceptionData(); webSocketService.pushExceptionBoardData(emptyData); lastDataHash.put("exception-board", emptyData.hashCode()); - } catch (Exception ex) { - log.error("推送空数据失败: {}", ex.getMessage()); + } catch (Exception ignoredPush) { + // 空数据推送失败不影响后续推送 } } } @@ -1461,12 +1379,10 @@ public class DashboardPushTask { try { // 调用WMS异常查询API String url = wcsUrl + "query-task-error-info"; - log.debug("调用WMS异常查询API: {}", url); // 构造POST请求参数 - 传入设备编码1101 String jsonBody = "\"1101\""; String wmsResponse = HttpUtils.doPost(url, jsonBody, null); - log.debug("WMS API返回数据: {}", wmsResponse); // 解析JSON数据 ObjectMapper mapper = new ObjectMapper(); @@ -1475,7 +1391,6 @@ public class DashboardPushTask { // 检查返回码 int resCode = rootNode.get("resCode").asInt(); if (resCode != 200) { - log.warn("WMS异常查询API返回错误: code={}", resCode); return createExceptionBoardData(exceptionList); } @@ -1488,14 +1403,10 @@ public class DashboardPushTask { if (exception != null) { exceptionList.add(exception); } - } else { - log.debug("WMS返回无异常信息: {}", resMsg); } - log.info("从WMS获取到{}条异常数据", exceptionList.size()); - - } catch (Exception e) { - log.error("从WMS获取异常数据失败", e); + } catch (Exception ignored) { + // 单次采集失败返回已有结果,避免中断整页看板推送 } return createExceptionBoardData(exceptionList); @@ -1565,8 +1476,7 @@ public class DashboardPushTask { return exception; - } catch (Exception e) { - log.error("解析异常消息失败: {}", resMsg, e); + } catch (Exception ignored) { return null; } }