Compare commits

..

1 Commits

Author SHA1 Message Date
田朝盛
cfbdc4c657
Pre Merge pull request !39 from 田朝盛/N/A 2025-11-20 03:35:18 +00:00
6 changed files with 16 additions and 69 deletions

View File

@ -328,13 +328,11 @@ public class DeviceQuery {
return result;
}
/**
* 此接口保留仅作为兼容后续将移除请迁移至
*/
@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)
public WVPResult<SyncStatus> getSyncStatusInPath(@PathVariable String deviceId) {
public WVPResult<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
WVPResult<SyncStatus> wvpResult = new WVPResult<>();
if (channelSyncStatus == null) {
@ -358,36 +356,6 @@ public class DeviceQuery {
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}")
@Operation(summary = "请求截图")
@Parameter(name = "deviceId", description = "设备国标编号", required = true)

View File

@ -1,5 +1,7 @@
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.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
@ -27,11 +29,9 @@ import com.github.pagehelper.PageInfo;
import com.google.common.base.CaseFormat;
import lombok.extern.slf4j.Slf4j;
import no.ecc.vectortile.VectorTileEncoder;
import org.jetbrains.annotations.NotNull;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
@ -41,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import java.beans.PropertyDescriptor;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -995,28 +994,14 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne
// lon/lat 转为瓦片内像素坐标0..256
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
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);
});
}
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
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
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
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);
});
encoderMap.forEach((key, encoder) -> {

View File

@ -158,13 +158,8 @@ public interface StreamPushMapper {
"</script>"})
int batchUpdate(List<StreamPush> streamPushItemForUpdate);
@Delete(" DELETE FROM wvp_stream_push" +
" WHERE server_id = #{serverId}" +
" AND NOT EXISTS (" +
" SELECT 1 " +
" FROM wvp_device_channel wdc " +
" WHERE wdc.data_type = 2 " +
" AND wvp_stream_push.id = wdc.data_device_id" +
" );")
@Delete(" DELETE FROM wvp_stream_push st " +
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" where wdc.id is null and st.server_id = #{serverId}")
void deleteWithoutGBId(@Param("serverId") String serverId);
}

File diff suppressed because one or more lines are too long

View File

@ -5,10 +5,7 @@ import request from '@/utils/request'
export function queryDeviceSyncStatus(deviceId) {
return request({
method: 'get',
url: `/api/device/query/sync_status`,
params: {
deviceId: deviceId
}
url: `/api/device/query/${deviceId}/sync_status`
})
}

View File

@ -46,7 +46,10 @@ service.interceptors.response.use(
}
const res = response.data
if (res.code && res.code !== 0) {
throw res.msg
Message.error({
message: res.msg,
duration: 5 * 1000
})
} else {
return res
}