Compare commits

...

7 Commits

Author SHA1 Message Date
田朝盛
78fa42ea74
Pre Merge pull request !39 from 田朝盛/N/A 2025-11-20 09:29:22 +00:00
lin
daddb4bfff 修复删除过期推流数据的SQL兼容性 2025-11-20 17:29:06 +08:00
lin
4bc80d4ef8 修复前端错误提示 2025-11-20 15:44:23 +08:00
lin
8b5a8de15d 补充缺少的js.map 2025-11-20 15:25:58 +08:00
lin
493131df8b 调整获取通道同步进度取参方式 2025-11-20 14:03:06 +08:00
lin
ba4620c2d6 调整转Map实现方式 2025-11-20 12:59:33 +08:00
田朝盛
8dd624ccd4
update src/main/java/com/genersoft/iot/vmp/gb28181/controller/PlayController.java.
Signed-off-by: 田朝盛 <1753182616@qq.com>
2025-07-14 08:04:09 +00:00
7 changed files with 69 additions and 16 deletions

View File

@ -328,11 +328,43 @@ 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))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
public WVPResult<SyncStatus> getSyncStatusInPath(@PathVariable 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("/sync_status")
@Operation(summary = "获取通道同步进度", 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> getSyncStatus(@PathVariable String deviceId) { public WVPResult<SyncStatus> getSyncStatus(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) {

View File

@ -1,7 +1,5 @@
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;
@ -29,9 +27,11 @@ 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,6 +41,7 @@ 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;
@ -994,14 +995,28 @@ 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) {
@ -1154,7 +1169,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]));
BeanMap beanMap = BeanMapUtils.create(commonGBChannel); Map<String, Object> beanMap = getStringObjectMap(commonGBChannel);
encoder.addFeature("points", beanMap, pointGeom); encoder.addFeature("points", beanMap, pointGeom);
}); });
encoderMap.forEach((key, encoder) -> { encoderMap.forEach((key, encoder) -> {

View File

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

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,10 @@ 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/${deviceId}/sync_status` url: `/api/device/query/sync_status`,
params: {
deviceId: deviceId
}
}) })
} }

View File

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