From 3d6db7478d79b824f93708f936c598cc622221f2 Mon Sep 17 00:00:00 2001
From: mk1990 <153958232@qq.com>
Date: 星期一, 20 六月 2022 15:10:31 +0800
Subject: [PATCH] fix设备状态查询接口
---
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
index 32a1305..c813b11 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
@@ -70,7 +70,9 @@
boolean result = false;
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
ParentPlatform parentPlatform = platformMapper.getParentPlatByServerGBId(platformId);
- if (catalogId == null) catalogId = parentPlatform.getCatalogId();
+ if (catalogId == null) {
+ catalogId = parentPlatform.getCatalogId();
+ }
try {
List<DeviceChannel> deviceChannelList = new ArrayList<>();
for (GbStream gbStream : gbStreams) {
@@ -78,7 +80,7 @@
gbStream.setPlatformId(platformId);
// TODO 淇敼涓烘壒閲忔彁浜�
platformGbStreamMapper.add(gbStream);
- DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform.getDeviceGBId());
+ DeviceChannel deviceChannelListByStream = getDeviceChannelListByStream(gbStream, catalogId, parentPlatform);
deviceChannelList.add(deviceChannelListByStream);
}
dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦
@@ -92,18 +94,24 @@
}
@Override
- public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, String deviceGBId) {
+ public DeviceChannel getDeviceChannelListByStream(GbStream gbStream, String catalogId, ParentPlatform platform) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId());
deviceChannel.setName(gbStream.getName());
deviceChannel.setLongitude(gbStream.getLongitude());
deviceChannel.setLatitude(gbStream.getLatitude());
- deviceChannel.setDeviceId(deviceGBId);
+ deviceChannel.setDeviceId(platform.getDeviceGBId());
deviceChannel.setManufacture("wvp-pro");
- deviceChannel.setStatus(gbStream.isStatus()?1:0);
+// deviceChannel.setStatus(gbStream.isStatus()?1:0);
+ deviceChannel.setStatus(1);
deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
deviceChannel.setRegisterWay(1);
- deviceChannel.setCivilCode(sipConfig.getDomain().substring(0, sipConfig.getDomain().length() - 2));
+ if (catalogId.length() > 0 && catalogId.length() <= 10) {
+ // 鐖惰妭鐐规槸琛屾斂鍖哄垝,鍒欒缃瓹ivilCode浣跨敤姝よ鏀垮尯鍒�
+ deviceChannel.setCivilCode(catalogId);
+ }else {
+ deviceChannel.setCivilCode(platform.getAdministrativeDivision());
+ }
deviceChannel.setModel("live");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setParental(0);
--
Gitblit v1.8.0