This commit is contained in:
xy
2024-11-12 16:33:18 +08:00
parent 49d42328ff
commit 10910e36e0

View File

@@ -1,6 +1,7 @@
package com.njcn.csharmonic.service.impl;
import com.njcn.access.api.AskDeviceDataFeignClient;
import com.njcn.access.utils.MqttUtil;
import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.api.DataSetFeignClient;
import com.njcn.csdevice.pojo.po.CsDataSet;
@@ -23,12 +24,18 @@ public class RealDataServiceImpl implements RealDataService {
private final DataSetFeignClient dataSetFeignClient;
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
private final RedisUtil redisUtil;
private final MqttUtil mqttUtil;
@Override
public boolean getBaseRealData(String lineId) {
boolean result = true;
try {
String nDid = lineId.substring(0, lineId.length() - 1);
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
if (!mqttClient) {
throw new RuntimeException("装置离线");
}
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
//获取装置所用模板
CsLinePO po = csLineFeignClient.getById(lineId).getData();
@@ -47,7 +54,7 @@ public class RealDataServiceImpl implements RealDataService {
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new RuntimeException(e.getMessage());
}
return result;
}
@@ -57,6 +64,11 @@ public class RealDataServiceImpl implements RealDataService {
boolean result = true;
try {
String nDid = lineId.substring(0, lineId.length() - 1);
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
if (!mqttClient) {
throw new RuntimeException("装置离线");
}
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
//获取装置所用模板
CsLinePO po = csLineFeignClient.getById(lineId).getData();
@@ -76,7 +88,7 @@ public class RealDataServiceImpl implements RealDataService {
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new RuntimeException(e.getMessage());
}
return result;
}