From ebb8d4d3b5b8ba2fedf71ab94833a5721d21bd95 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Fri, 26 Jul 2024 12:31:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AF=AD=E9=9F=B3=E5=B9=BF?= =?UTF-8?q?=E6=92=AD=E8=B6=85=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E7=BB=93=E6=9E=9C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DcEmergencyPlansServiceImpl.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index 79006390..06b4870a 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -34,6 +34,7 @@ import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.io.IOException; +import java.net.SocketTimeoutException; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.CountDownLatch; @@ -868,7 +869,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { // 构造设备控制记录数据格式 List>>> propsList = new ArrayList<>(); // 调用状态 0正常 1异常 - Integer status = UniversalEnum.ZERO.getNumber(); + Integer status = UniversalEnum.ONE.getNumber(); HashMap>> proDevice = new HashMap<>(); // devices List> dev = new ArrayList<>(); @@ -1116,14 +1117,32 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { } proDevice.put("functions", functionList); propsList.add(proDevice); + + } catch (HttpException | IOException e) { + log.error(e.toString()); + // 存在语音广播超时 + JSONObject result = new JSONObject(); + result.put("device", device.getId()); + result.put("deviceName", device.getDeviceName()); + result.put("deviceType", device.getDeviceType()); + if (e instanceof SocketTimeoutException) { + // 超时 + result.put("content", "设备响应超时"); + } + JSONObject returnResult = new JSONObject(); + returnResult.put("code",UniversalEnum.FIVE_HUNDRED.getNumber()); + returnResult.put("msg","设备响应超时"); + result.put("result", returnResult); + status = UniversalEnum.ONE.getNumber(); + dcOperLog.add(result); + resultArray.add(result); + }finally { // 语音广播恢复操作不存记录 if (!(device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString()) && operationType.equals(UniversalEnum.TWO.getNumber()))) { insertEquipmentControlRecordTable(device, propsList, dcOperLog, status, remark.toString(),eventId); } - } catch (HttpException | IOException e) { - log.error(e.toString()); } }