mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 22:47:49 +08:00
Compare commits
1 Commits
78fa42ea74
...
cfbdc4c657
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfbdc4c657 |
@ -328,13 +328,11 @@ public class DeviceQuery {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 此接口保留仅作为兼容,后续将移除,请迁移至
|
|
||||||
*/
|
|
||||||
@GetMapping("/{deviceId}/sync_status")
|
@GetMapping("/{deviceId}/sync_status")
|
||||||
@Operation(summary = "获取通道同步进度(此接口保留仅作为兼容,后续将移除,请迁移至 /sync_status?deviceId=)", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
public WVPResult<SyncStatus> getSyncStatusInPath(@PathVariable String deviceId) {
|
public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
|
||||||
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
|
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
|
||||||
WVPResult<SyncStatus> wvpResult = new WVPResult<>();
|
WVPResult<SyncStatus> wvpResult = new WVPResult<>();
|
||||||
if (channelSyncStatus == null) {
|
if (channelSyncStatus == null) {
|
||||||
@ -358,36 +356,6 @@ public class DeviceQuery {
|
|||||||
return wvpResult;
|
return wvpResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 此接口保留仅作为兼容,后续将移除,请迁移至
|
|
||||||
*/
|
|
||||||
@GetMapping("/sync_status")
|
|
||||||
@Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
|
||||||
public WVPResult<SyncStatus> getSyncStatus(String deviceId) {
|
|
||||||
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
|
|
||||||
WVPResult<SyncStatus> wvpResult = new WVPResult<>();
|
|
||||||
if (channelSyncStatus == null) {
|
|
||||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
|
||||||
wvpResult.setMsg("同步不存在");
|
|
||||||
}else if (channelSyncStatus.getErrorMsg() != null) {
|
|
||||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
|
||||||
wvpResult.setMsg(channelSyncStatus.getErrorMsg());
|
|
||||||
}else if (channelSyncStatus.getTotal() == null){
|
|
||||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
|
||||||
wvpResult.setMsg("等待通道信息...");
|
|
||||||
}else if (channelSyncStatus.getTotal() == 0){
|
|
||||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
|
||||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
|
||||||
wvpResult.setData(channelSyncStatus);
|
|
||||||
}else {
|
|
||||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
|
||||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
|
||||||
wvpResult.setData(channelSyncStatus);
|
|
||||||
}
|
|
||||||
return wvpResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/snap/{deviceId}/{channelId}")
|
@GetMapping("/snap/{deviceId}/{channelId}")
|
||||||
@Operation(summary = "请求截图")
|
@Operation(summary = "请求截图")
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.excel.support.cglib.beans.BeanMap;
|
||||||
|
import com.alibaba.excel.util.BeanMapUtils;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||||
@ -27,11 +29,9 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import no.ecc.vectortile.VectorTileEncoder;
|
import no.ecc.vectortile.VectorTileEncoder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.locationtech.jts.geom.Coordinate;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import org.locationtech.jts.geom.GeometryFactory;
|
import org.locationtech.jts.geom.GeometryFactory;
|
||||||
import org.locationtech.jts.geom.Point;
|
import org.locationtech.jts.geom.Point;
|
||||||
import org.springframework.beans.BeanWrapper;
|
|
||||||
import org.springframework.beans.BeanWrapperImpl;
|
import org.springframework.beans.BeanWrapperImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
@ -41,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.beans.PropertyDescriptor;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -995,28 +994,14 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
||||||
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
||||||
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
||||||
Map<String, Object> beanMap = getStringObjectMap(commonGBChannel);
|
|
||||||
|
BeanMap beanMap = BeanMapUtils.create(commonGBChannel);
|
||||||
encoder.addFeature("points", beanMap, pointGeom);
|
encoder.addFeature("points", beanMap, pointGeom);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return encoder.encode();
|
return encoder.encode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private static Map<String, Object> getStringObjectMap(CommonGBChannel commonGBChannel) {
|
|
||||||
BeanWrapper wrapper = new BeanWrapperImpl(commonGBChannel);
|
|
||||||
PropertyDescriptor[] pds = wrapper.getPropertyDescriptors();
|
|
||||||
Map<String, Object> beanMap = new HashMap<>();
|
|
||||||
|
|
||||||
for (PropertyDescriptor pd : pds) {
|
|
||||||
if (pd.getReadMethod() != null && !"class".equals(pd.getName())) {
|
|
||||||
Object value = wrapper.getPropertyValue(pd.getName());
|
|
||||||
beanMap.put(pd.getName(), value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return beanMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String drawThin(Map<Integer, Double> zoomParam, Extent extent, String geoCoordSys) {
|
public String drawThin(Map<Integer, Double> zoomParam, Extent extent, String geoCoordSys) {
|
||||||
@ -1169,7 +1154,7 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
|
|||||||
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
||||||
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
||||||
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
||||||
Map<String, Object> beanMap = getStringObjectMap(commonGBChannel);
|
BeanMap beanMap = BeanMapUtils.create(commonGBChannel);
|
||||||
encoder.addFeature("points", beanMap, pointGeom);
|
encoder.addFeature("points", beanMap, pointGeom);
|
||||||
});
|
});
|
||||||
encoderMap.forEach((key, encoder) -> {
|
encoderMap.forEach((key, encoder) -> {
|
||||||
|
|||||||
@ -158,13 +158,8 @@ public interface StreamPushMapper {
|
|||||||
"</script>"})
|
"</script>"})
|
||||||
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
|
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
|
||||||
|
|
||||||
@Delete(" DELETE FROM wvp_stream_push" +
|
@Delete(" DELETE FROM wvp_stream_push st " +
|
||||||
" WHERE server_id = #{serverId}" +
|
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
|
||||||
" AND NOT EXISTS (" +
|
" where wdc.id is null and st.server_id = #{serverId}")
|
||||||
" SELECT 1 " +
|
|
||||||
" FROM wvp_device_channel wdc " +
|
|
||||||
" WHERE wdc.data_type = 2 " +
|
|
||||||
" AND wvp_stream_push.id = wdc.data_device_id" +
|
|
||||||
" );")
|
|
||||||
void deleteWithoutGBId(@Param("serverId") String serverId);
|
void deleteWithoutGBId(@Param("serverId") String serverId);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -5,10 +5,7 @@ import request from '@/utils/request'
|
|||||||
export function queryDeviceSyncStatus(deviceId) {
|
export function queryDeviceSyncStatus(deviceId) {
|
||||||
return request({
|
return request({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `/api/device/query/sync_status`,
|
url: `/api/device/query/${deviceId}/sync_status`
|
||||||
params: {
|
|
||||||
deviceId: deviceId
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,10 @@ service.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
const res = response.data
|
const res = response.data
|
||||||
if (res.code && res.code !== 0) {
|
if (res.code && res.code !== 0) {
|
||||||
throw res.msg
|
Message.error({
|
||||||
|
message: res.msg,
|
||||||
|
duration: 5 * 1000
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user