临时提交

This commit is contained in:
lin
2025-10-15 15:57:25 +08:00
parent 1bc8a8f080
commit 68c20f127e
11 changed files with 339 additions and 117 deletions

View File

@@ -5,10 +5,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.*;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
@@ -478,4 +475,10 @@ public class ChannelController {
}
return channelService.queryListForMap(query, online, hasRecordPlan, channelType);
}
@Operation(summary = "为地图保存抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER))
@PostMapping("/map/save-level")
public void saveLevel(@RequestBody List<ChannelForThin> channels){
channelService.saveLevel(channels);
}
}

View File

@@ -0,0 +1,9 @@
package com.genersoft.iot.vmp.gb28181.controller.bean;
import lombok.Data;
@Data
public class ChannelForThin {
private Integer gbId;
private Integer mapLevel;
}

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelForThin;
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
@@ -644,4 +645,12 @@ public interface CommonGBChannelMapper {
@SelectProvider(type = ChannelProvider.class, method = "queryListForSyMobile")
List<CameraChannel> queryListForSyMobile(@Param("business") String business);
@Update("<script> " +
"<foreach collection='channels' index='index' item='item' separator=';'> " +
"UPDATE wvp_device_channel SET map_level=#{item.mapLevel} " +
"WHERE id = #{item.gbId}" +
"</foreach> " +
"</script>")
void saveLevel(List<ChannelForThin> channels);
}

View File

@@ -21,6 +21,7 @@ public class ChannelProvider {
" stream_id,\n" +
" record_plan_id,\n" +
" enable_broadcast,\n" +
" map_level,\n" +
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
" coalesce(gb_name, name) as gb_name,\n" +
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelForThin;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import com.github.pagehelper.PageInfo;
@@ -99,4 +100,6 @@ public interface IGbChannelService {
void updateGPS(List<CommonGBChannel> channelList);
List<CommonGBChannel> queryListForMap(String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
void saveLevel(List<ChannelForThin> channels);
}

View File

@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelForThin;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
@@ -791,4 +792,21 @@ public class GbChannelServiceImpl implements IGbChannelService {
public List<CommonGBChannel> queryListForMap(String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
return commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType);
}
@Override
@Transactional
public void saveLevel(List<ChannelForThin> channels) {
int limitCount = 1000;
if (channels.size() > limitCount) {
for (int i = 0; i < channels.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > channels.size()) {
toIndex = channels.size();
}
commonGBChannelMapper.saveLevel(channels.subList(i, toIndex));
}
} else {
commonGBChannelMapper.saveLevel(channels);
}
}
}