Browse Source

修改情报板回显原始内容代码

develop
Mr.Wang 8 months ago
parent
commit
b2885326b1
  1. 19
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

19
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -30,6 +30,7 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
@Service
@ -225,12 +226,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
*/
public Map<String, List<DcInfoBoardTemplate>> getBoardTemplate(List<DcDevice> dcDevices) {
Map<String, List<DcInfoBoardTemplate>> map = new HashMap<>();
CountDownLatch latch = new CountDownLatch(dcDevices.size());
dcDevices.forEach(dcDevice -> {
threadPoolTaskExecutor.execute(() -> {
try {
if (StringUtils.isEmpty(dcDevice.getIotDeviceId())) {
return;
}
if (StringUtils.isNotEmpty(dcDevice.getIotDeviceId())){
AjaxResult ajaxResult = dcDeviceController.getDeviceRealtimeProperty(dcDevice.getIotDeviceId(), "3A", new HashMap<>());
if (ajaxResult.get("code").equals(200)) {
JSONObject properties = JSON.parseObject(JSON.parseObject(ajaxResult.get("data").toString()).get("3A").toString());
@ -263,12 +263,19 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
});
map.put(dcDevice.getDeviceName(), list);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
latch.countDown(); // 确保在异常情况下也能减少CountDownLatch计数
}
});
});
try {
latch.await(); // 等待所有线程执行完毕
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return map;
}
@ -301,7 +308,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} else if (searchRule.equals(2)) {
// 事件上游最近
if (direction.equals("1")) {
if (direction.equals("菏泽方向")) {
// 上行 取最大的几个
start.add("55");
start.add("379");
@ -341,7 +348,7 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
} else if (searchRule.equals(3)) {
// 事件下游最近
if (direction.equals("1")) {
if (direction.equals("菏泽方向")) {
// 上行 取最大的几个
start.add(markArray[0]);
start.add(markArray[1]);

Loading…
Cancel
Save