Compare commits

...

2 Commits

Author SHA1 Message Date
648540858
d7ba1cab30 强化通道同步异常处理 2025-05-10 23:22:59 +08:00
648540858
594a696015 修复je播放器拉伸问题 2025-05-10 23:09:56 +08:00
2 changed files with 27 additions and 13 deletions

View File

@ -194,6 +194,15 @@ public class CatalogDataManager implements CommandLineRunner {
for (String key : keySet) {
CatalogData catalogData = dataMap.get(key);
if (catalogData != null && deviceId.equals(catalogData.getDevice().getDeviceId())) {
// 此时检查是否过期
Instant instantBefore30S = Instant.now().minusMillis(TimeUnit.SECONDS.toMillis(30));
if ((catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)
|| catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready))
&& catalogData.getTime().isBefore(instantBefore30S)) {
dataMap.remove(key);
return false;
}
return !catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end);
}
}
@ -222,21 +231,26 @@ public class CatalogDataManager implements CommandLineRunner {
String deviceId = catalogData.getDevice().getDeviceId();
int sn = catalogData.getSn();
List<DeviceChannel> deviceChannelList = getDeviceChannelList(deviceId, sn);
if (catalogData.getTotal() == deviceChannelList.size()) {
deviceChannelService.resetChannels(catalogData.getDevice().getId(), deviceChannelList);
}else {
deviceChannelService.updateChannels(catalogData.getDevice(), deviceChannelList);
}
List<Region> regionList = getRegionList(deviceId, sn);
if ( regionList!= null && !regionList.isEmpty()) {
regionService.batchAdd(regionList);
}
List<Group> groupList = getGroupList(deviceId, sn);
if (groupList != null && !groupList.isEmpty()) {
groupService.batchAdd(groupList);
try {
if (catalogData.getTotal() == deviceChannelList.size()) {
deviceChannelService.resetChannels(catalogData.getDevice().getId(), deviceChannelList);
}else {
deviceChannelService.updateChannels(catalogData.getDevice(), deviceChannelList);
}
List<Region> regionList = getRegionList(deviceId, sn);
if ( regionList!= null && !regionList.isEmpty()) {
regionService.batchAdd(regionList);
}
List<Group> groupList = getGroupList(deviceId, sn);
if (groupList != null && !groupList.isEmpty()) {
groupService.batchAdd(groupList);
}
}catch (Exception e) {
log.error("[国标通道同步] 入库失败: ", e);
}
String errorMsg = "更新成功,共" + catalogData.getTotal() + "条,已更新" + deviceChannelList.size() + "";
catalogData.setErrorMsg(errorMsg);
catalogData.setStatus(CatalogData.CatalogDataStatus.end);
}else if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready)) {
String errorMsg = "同步失败,等待回复超时";
catalogData.setErrorMsg(errorMsg);

View File

@ -143,7 +143,7 @@ export default {
isFlv: false,
isFullResize: false,
isNotMute: this.isNotMute,
isResize: false,
isResize: true,
keepScreenOn: true,
loadingText: '请稍等, 视频加载中......',
loadingTimeout: 10,