Browse Source

解决语音广播超时,没有存储结果问题

develop
Mr.Wang 4 months ago
parent
commit
ebb8d4d3b5
  1. 25
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

25
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 javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.net.SocketTimeoutException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -868,7 +869,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
// 构造设备控制记录数据格式 // 构造设备控制记录数据格式
List<HashMap<String, List<Map<String, Object>>>> propsList = new ArrayList<>(); List<HashMap<String, List<Map<String, Object>>>> propsList = new ArrayList<>();
// 调用状态 0正常 1异常 // 调用状态 0正常 1异常
Integer status = UniversalEnum.ZERO.getNumber(); Integer status = UniversalEnum.ONE.getNumber();
HashMap<String, List<Map<String, Object>>> proDevice = new HashMap<>(); HashMap<String, List<Map<String, Object>>> proDevice = new HashMap<>();
// devices // devices
List<Map<String, Object>> dev = new ArrayList<>(); List<Map<String, Object>> dev = new ArrayList<>();
@ -1116,14 +1117,32 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} }
proDevice.put("functions", functionList); proDevice.put("functions", functionList);
propsList.add(proDevice); 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()) if (!(device.getDeviceType().equals(DeviceTypeConstants.ROAD_SECTION_VOICE_BROADCASTING.toString())
&& operationType.equals(UniversalEnum.TWO.getNumber()))) { && operationType.equals(UniversalEnum.TWO.getNumber()))) {
insertEquipmentControlRecordTable(device, propsList, dcOperLog, status, remark.toString(),eventId); insertEquipmentControlRecordTable(device, propsList, dcOperLog, status, remark.toString(),eventId);
} }
} catch (HttpException | IOException e) {
log.error(e.toString());
} }
} }

Loading…
Cancel
Save