diff --git a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/RealDataServiceImpl.java b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/RealDataServiceImpl.java index 7a8ed83..7b3a139 100644 --- a/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/RealDataServiceImpl.java +++ b/cs-harmonic/cs-harmonic-boot/src/main/java/com/njcn/csharmonic/service/impl/RealDataServiceImpl.java @@ -2,6 +2,7 @@ package com.njcn.csharmonic.service.impl; import com.njcn.access.api.AskDeviceDataFeignClient; import com.njcn.access.utils.MqttUtil; +import com.njcn.common.pojo.exception.BusinessException; import com.njcn.csdevice.api.CsLineFeignClient; import com.njcn.csdevice.api.DataSetFeignClient; import com.njcn.csdevice.pojo.po.CsDataSet; @@ -34,7 +35,7 @@ public class RealDataServiceImpl implements RealDataService { String clientName = "NJCN-" + nDid.substring(nDid.length() - 6); boolean mqttClient = mqttUtil.judgeClientOnline(clientName); if (!mqttClient) { - throw new RuntimeException("装置离线"); + throw new BusinessException("装置离线"); } Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1)); //获取装置所用模板 @@ -53,8 +54,8 @@ public class RealDataServiceImpl implements RealDataService { result = false; } } - } catch (InterruptedException e) { - throw new RuntimeException(e.getMessage()); + } catch (Exception e) { + throw new BusinessException(e.getMessage()); } return result; } @@ -67,7 +68,7 @@ public class RealDataServiceImpl implements RealDataService { String clientName = "NJCN-" + nDid.substring(nDid.length() - 6); boolean mqttClient = mqttUtil.judgeClientOnline(clientName); if (!mqttClient) { - throw new RuntimeException("装置离线"); + throw new BusinessException("装置离线"); } Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1)); //获取装置所用模板 @@ -87,8 +88,8 @@ public class RealDataServiceImpl implements RealDataService { result = false; } } - } catch (InterruptedException e) { - throw new RuntimeException(e.getMessage()); + } catch (Exception e) { + throw new BusinessException(e.getMessage()); } return result; }