微调
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.api.DataSetFeignClient;
|
import com.njcn.csdevice.api.DataSetFeignClient;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
@@ -23,12 +24,18 @@ public class RealDataServiceImpl implements RealDataService {
|
|||||||
private final DataSetFeignClient dataSetFeignClient;
|
private final DataSetFeignClient dataSetFeignClient;
|
||||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
private final MqttUtil mqttUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getBaseRealData(String lineId) {
|
public boolean getBaseRealData(String lineId) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
try {
|
try {
|
||||||
String nDid = lineId.substring(0, lineId.length() - 1);
|
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));
|
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
|
||||||
//获取装置所用模板
|
//获取装置所用模板
|
||||||
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
||||||
@@ -47,7 +54,7 @@ public class RealDataServiceImpl implements RealDataService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -57,6 +64,11 @@ public class RealDataServiceImpl implements RealDataService {
|
|||||||
boolean result = true;
|
boolean result = true;
|
||||||
try {
|
try {
|
||||||
String nDid = lineId.substring(0, lineId.length() - 1);
|
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));
|
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
|
||||||
//获取装置所用模板
|
//获取装置所用模板
|
||||||
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
||||||
@@ -76,7 +88,7 @@ public class RealDataServiceImpl implements RealDataService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user