|
@@ -1,11 +1,13 @@
|
|
|
package com.its.op.service.its.wcam;
|
|
|
|
|
|
+import com.its.op.dao.repository.its.database.TbStrmIceSvrInfoRepository;
|
|
|
import com.its.op.dao.repository.its.wcam.TbWcamMonitoringRepository;
|
|
|
import com.its.op.dto.its.common.MonitoringInfoDto;
|
|
|
import com.its.op.dto.its.common.MonitoringListDto;
|
|
|
import com.its.op.dto.its.common.MonitoringListInf;
|
|
|
import com.its.op.dto.its.wcam.TbWcamCtlrDto;
|
|
|
import com.its.op.dto.its.wcam.TbWcamMonitoringDto;
|
|
|
+import com.its.op.entity.its.database.TbStrmIceSvrInfo;
|
|
|
import com.its.op.entity.its.wcam.TbWcamMonitoring;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -14,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
@@ -22,6 +26,38 @@ public class TbWcamMonitoringService {
|
|
|
|
|
|
private final TbWcamMonitoringRepository repo;
|
|
|
private final TbWcamCtlrService ctlrService;
|
|
|
+ private final TbStrmIceSvrInfoRepository strmIceSvrInfoRepo;
|
|
|
+
|
|
|
+ private List<TbWcamMonitoringDto> findStrmIceSvrInfo(List<TbWcamMonitoringDto> result) {
|
|
|
+
|
|
|
+ List<TbStrmIceSvrInfo> iceSvrList = strmIceSvrInfoRepo.findAll();
|
|
|
+ Map<String, TbStrmIceSvrInfo> map = iceSvrList.stream()
|
|
|
+ .collect(Collectors.toMap(TbStrmIceSvrInfo::getSvrId, dto -> dto));
|
|
|
+
|
|
|
+ result.forEach(obj -> {
|
|
|
+ TbStrmIceSvrInfo webIceSvr = map.get(obj.getWebRtcSvrIp());
|
|
|
+ if (webIceSvr != null) {
|
|
|
+ obj.setWebIceSvr(webIceSvr.getSvrProt() + ":" + webIceSvr.getSvrIp() + ":" + webIceSvr.getSvrPort());
|
|
|
+ obj.setWebIceId(webIceSvr.getSvrId());
|
|
|
+ obj.setWebIcePswd(webIceSvr.getSvrPswd());
|
|
|
+ } else {
|
|
|
+ obj.setWebIceSvr("");
|
|
|
+ obj.setWebIceId("");
|
|
|
+ obj.setWebIcePswd("");
|
|
|
+ }
|
|
|
+ TbStrmIceSvrInfo localIceSvr = map.get(obj.getRtcSvrIp());
|
|
|
+ if (localIceSvr != null) {
|
|
|
+ obj.setLocalIceSvr(localIceSvr.getSvrProt() + ":" + localIceSvr.getSvrIp() + ":" + localIceSvr.getSvrPort());
|
|
|
+ obj.setLocalIceId(localIceSvr.getSvrId());
|
|
|
+ obj.setLocalIcePswd(localIceSvr.getSvrPswd());
|
|
|
+ } else {
|
|
|
+ obj.setLocalIceSvr("");
|
|
|
+ obj.setLocalIceId("");
|
|
|
+ obj.setLocalIcePswd("");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
+ }
|
|
|
|
|
|
// 전체 데이터 조회
|
|
|
@Transactional(readOnly = true)
|
|
@@ -31,7 +67,7 @@ public class TbWcamMonitoringService {
|
|
|
for (TbWcamMonitoring entity : data) {
|
|
|
result.add(entity.toDto());
|
|
|
}
|
|
|
- return result;
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
}
|
|
|
|
|
|
// 전체 데이터 조회
|
|
@@ -42,7 +78,7 @@ public class TbWcamMonitoringService {
|
|
|
for (TbWcamMonitoring entity : data) {
|
|
|
result.add(entity.toDto());
|
|
|
}
|
|
|
- return result;
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
}
|
|
|
// 모니터링 유형에 속한 모든 데이터 조회
|
|
|
@Transactional(readOnly = true)
|
|
@@ -54,7 +90,7 @@ public class TbWcamMonitoringService {
|
|
|
result.add(obj.toDto());
|
|
|
});
|
|
|
}
|
|
|
- return result;
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
}
|
|
|
|
|
|
// 모니터링 이름으로 모니터링목록 조회
|
|
@@ -69,7 +105,7 @@ public class TbWcamMonitoringService {
|
|
|
result.add(obj.toDto());
|
|
|
});
|
|
|
}
|
|
|
- return result;
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
}
|
|
|
|
|
|
// 데이터 변경 또는 생성-개별(데이터가 존재하면 업데이트 없으면 신규로 생성)
|
|
@@ -105,7 +141,7 @@ public class TbWcamMonitoringService {
|
|
|
if (result != null) {
|
|
|
this.repo.deleteByName(monitoringType, name.trim());
|
|
|
}
|
|
|
- return result;
|
|
|
+ return findStrmIceSvrInfo(result);
|
|
|
}
|
|
|
|
|
|
/**
|