|
|
@@ -22,6 +22,7 @@ import com.xunmei.mediator.websocket.dto.WebsocketExecuteReq;
|
|
|
import com.xunmei.mediator.websocket.dto.WebsocketResult;
|
|
|
import com.xunmei.mediator.websocket.dto.alarmHost.AlarmHostBaseInfo;
|
|
|
import com.xunmei.mediator.websocket.dto.alarmHost.AlarmInputInfo;
|
|
|
+import com.xunmei.mediator.websocket.dto.alarmHost.CommunicationParameter;
|
|
|
import com.xunmei.mediator.websocket.dto.alarmHost.SubSystemInfo;
|
|
|
import com.xunmei.mediator.websocket.dto.dvs.ChannelInfo;
|
|
|
import com.xunmei.mediator.websocket.dto.dvs.DiskInfo;
|
|
|
@@ -188,7 +189,6 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
List<IotDvrDisk> addDiskList = new ArrayList<>();
|
|
|
//更新磁盘信息集合
|
|
|
List<IotDvrDisk> updateDiskList = new ArrayList<>();
|
|
|
-
|
|
|
//逻辑删除视频设备
|
|
|
iIotDeviceInfoService.deleteDeviceByToken(token);
|
|
|
//逻辑删除扩展信息
|
|
|
@@ -198,15 +198,11 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
/**
|
|
|
* 逻辑处理
|
|
|
*/
|
|
|
- processDvsDevices(dvsBaseInfo.getDvsInfos(), serverInfo, token, addDvsList, updateDvsList, addListExtend, updateListExtend);
|
|
|
+ processDvsExtendInfo(dvsBaseInfo.getCommunicationParameters(), serverInfo, token, addDvsList, updateDvsList, addListExtend, updateListExtend);
|
|
|
processChannelDevices(dvsBaseInfo.getChannelInfos(), serverInfo, token, addChnnelList, updateChnnelList);
|
|
|
processDiskDevices(dvsBaseInfo.getDiskInfos(), serverInfo, token, addDiskList, updateDiskList);
|
|
|
-
|
|
|
-
|
|
|
// 批量保存和更新设备信息
|
|
|
saveOrUpdateDeviceBatches(addDvsList, updateDvsList, addChnnelList, updateChnnelList, addListExtend, updateListExtend, addDiskList, updateDiskList);
|
|
|
-
|
|
|
-
|
|
|
} catch (Exception var8) {
|
|
|
log.error("同步视频类基础信息过程中出现异常", var8);
|
|
|
throw new RuntimeException(var8);
|
|
|
@@ -240,9 +236,9 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
//逻辑删除主机
|
|
|
iIotDeviceInfoService.deleteAlarmHostAndDvsByToken(token);
|
|
|
|
|
|
- //添加报警主机集合
|
|
|
+ //添加主机集合
|
|
|
List<IotDeviceInfo> addHostList = new ArrayList();
|
|
|
- //更新报警主机集合
|
|
|
+ //更新主机集合
|
|
|
List<IotDeviceInfo> updateHostList = new ArrayList();
|
|
|
|
|
|
processHostDevices(alarmHostInfos, serverInfo, token, addHostList, updateHostList);
|
|
|
@@ -351,7 +347,7 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
/**
|
|
|
* 处理dvs数据
|
|
|
*
|
|
|
- * @param dvsInfos
|
|
|
+ * @param communicationParameterList
|
|
|
* @param serverInfo
|
|
|
* @param token
|
|
|
* @param addList
|
|
|
@@ -359,33 +355,32 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
* @param addListExtend
|
|
|
* @param updateListExtend
|
|
|
*/
|
|
|
- private void processDvsDevices(List<DvsInfo> dvsInfos, IotServerInfo serverInfo, String token, List<IotDeviceInfo> addList, List<IotDeviceInfo> updateList, List<IotDeviceInfoExtend> addListExtend, List<IotDeviceInfoExtend> updateListExtend) {
|
|
|
- if (ObjectUtil.isEmpty(dvsInfos)) {
|
|
|
- log.error("同步视频类基础信息,获取DVS信息为空");
|
|
|
+ private void processDvsExtendInfo(List<CommunicationParameter> communicationParameterList, IotServerInfo serverInfo, String token, List<IotDeviceInfo> addList, List<IotDeviceInfo> updateList, List<IotDeviceInfoExtend> addListExtend, List<IotDeviceInfoExtend> updateListExtend) {
|
|
|
+ if (ObjectUtil.isEmpty(communicationParameterList)) {
|
|
|
+ log.error("同步视频类基础信息,获取DVS扩展信息为空");
|
|
|
} else {
|
|
|
- for (DvsInfo dvsInfo : dvsInfos) {
|
|
|
- IotDeviceInfo info = iIotDeviceInfoService.selectByTypeAndCode(token, DeviceTypeEnum.DVS.getCode(), dvsInfo.getDeviceName());
|
|
|
+ for (CommunicationParameter parameter : communicationParameterList) {
|
|
|
+ IotDeviceInfo info = iIotDeviceInfoService.selectByTypeAndCode(token, DeviceTypeEnum.DVS.getCode(), parameter.getDeviceName());
|
|
|
+ IotDeviceInfoExtend extend = iIotDeviceInfoExtendService.selectByProductDeviceNameAndToken(token, DeviceTypeEnum.DVS.getCode(), parameter.getDeviceName());
|
|
|
if (info == null) {
|
|
|
- info = createIotDeviceInfo(dvsInfo, serverInfo);
|
|
|
- addList.add(info);
|
|
|
- addListExtend.add(createIotDeviceInfoExtend(dvsInfo, info.getId(), token));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (extend == null) {
|
|
|
+ addListExtend.add(createIotDeviceInfoExtend(parameter, info.getId(), token));
|
|
|
} else {
|
|
|
- dealDvsInfo(dvsInfo, info, serverInfo);
|
|
|
- updateList.add(info);
|
|
|
- IotDeviceInfoExtend extend = iIotDeviceInfoExtendService.selectByDeviceId(info.getId());
|
|
|
- dealDvsExtend(dvsInfo, extend);
|
|
|
+ dealDvsExtend(parameter, extend);
|
|
|
updateListExtend.add(extend);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void dealDvsExtend(DvsInfo dvsInfo, IotDeviceInfoExtend extend) {
|
|
|
+ private void dealDvsExtend(CommunicationParameter dvsInfo, IotDeviceInfoExtend extend) {
|
|
|
extend.setDeleted(0);
|
|
|
- extend.setPort(dvsInfo.getPort());
|
|
|
- extend.setPassword(dvsInfo.getPassword());
|
|
|
- extend.setUserName(dvsInfo.getUserName());
|
|
|
- extend.setNetAddress(dvsInfo.getNetAddress());
|
|
|
+ extend.setPort(dvsInfo.getDevicePort());
|
|
|
+ extend.setPassword(dvsInfo.getDevicePassword());
|
|
|
+ extend.setUserName(dvsInfo.getDeviceAccount());
|
|
|
+ extend.setNetAddress(dvsInfo.getDeviceAddress());
|
|
|
extend.setUpdateBy("system");
|
|
|
extend.setUpdateTime(new Date());
|
|
|
}
|
|
|
@@ -414,13 +409,13 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
* @param deviceId
|
|
|
* @return
|
|
|
*/
|
|
|
- private IotDeviceInfoExtend createIotDeviceInfoExtend(DvsInfo dvsInfo, Long deviceId, String token) {
|
|
|
+ private IotDeviceInfoExtend createIotDeviceInfoExtend(CommunicationParameter dvsInfo, Long deviceId, String token) {
|
|
|
IotDeviceInfoExtend extend = new IotDeviceInfoExtend();
|
|
|
extend.setDeviceId(deviceId);
|
|
|
- extend.setPort(dvsInfo.getPort());
|
|
|
- extend.setPassword(dvsInfo.getPassword());
|
|
|
- extend.setUserName(dvsInfo.getUserName());
|
|
|
- extend.setNetAddress(dvsInfo.getNetAddress());
|
|
|
+ extend.setPort(dvsInfo.getDevicePort());
|
|
|
+ extend.setPassword(dvsInfo.getDevicePassword());
|
|
|
+ extend.setUserName(dvsInfo.getDeviceAccount());
|
|
|
+ extend.setNetAddress(dvsInfo.getDeviceAddress());
|
|
|
extend.setIotToken(token);
|
|
|
extend.setDeleted(0);
|
|
|
extend.setCreateBy("system");
|
|
|
@@ -656,11 +651,19 @@ public class WebsocketServiceImpl implements WebsocketService, RouterService {
|
|
|
if (ObjectUtil.isEmpty(categories)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String string = categories.split(":")[0];
|
|
|
- if (WebSocketConstants.DVS.equals(string)) {
|
|
|
+ String[] split = categories.split(";");
|
|
|
+ if (categories.contains(WebSocketConstants.FSU_GATEWAY)) {
|
|
|
+ if (split.length == 1) {
|
|
|
+ return DeviceTypeEnum.FSU_GATEWAY.getCode();
|
|
|
+ }
|
|
|
+ DeviceTypeEnum typeEnum = DeviceTypeEnum.valueOf(split[1]);
|
|
|
+ return typeEnum.getCode();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (WebSocketConstants.DVS.equals(split[0])) {
|
|
|
return DeviceTypeEnum.DVS.getCode();
|
|
|
}
|
|
|
- if (WebSocketConstants.ALARM_HOST.equals(string)) {
|
|
|
+ if (WebSocketConstants.ALARM_HOST.equals(split[0])) {
|
|
|
return DeviceTypeEnum.ALARM_HOST.getCode();
|
|
|
}
|
|
|
return null;
|