Browse Source

修复推流列表大数据量时批量删除的错误,修复推流列表分页查询错误

pull/276/head
648540858 3 years ago
parent
commit
b6fa459bc3
  1. 3
      pom.xml
  2. 17
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

3
pom.xml

@ -50,7 +50,6 @@
<jedis-version>3.1.0</jedis-version>
<!-- 依赖版本 -->
<pagehelper.version>5.2.0</pagehelper.version>
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
<asciidoctor.input.directory>${project.basedir}/docs/asciidoc</asciidoctor.input.directory>
<generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory>
@ -113,7 +112,7 @@
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
<version>1.4.1</version>
</dependency>
<!--Swagger3 -->

17
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java

@ -188,10 +188,23 @@ public class StreamPushServiceImpl implements IStreamPushService {
streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream());
}
}
Collection<StreamPushItem> offlinePushItems = pushItemMap.values();
List<StreamPushItem> offlinePushItems = new ArrayList<>(pushItemMap.values());
if (offlinePushItems.size() > 0) {
String type = "PUSH";
streamPushMapper.delAll(new ArrayList<>(offlinePushItems));
int runLimit = 300;
if (offlinePushItems.size() > runLimit) {
for (int i = 0; i < offlinePushItems.size(); i += runLimit) {
int toIndex = i + runLimit;
if (i + runLimit > offlinePushItems.size()) {
toIndex = offlinePushItems.size();
}
List<StreamPushItem> streamPushItemsSub = offlinePushItems.subList(i, toIndex);
streamPushMapper.delAll(streamPushItemsSub);
}
}else {
streamPushMapper.delAll(offlinePushItems);
}
}
Collection<StreamInfo> offlineStreamInfoItems = streamInfoPushItemMap.values();
if (offlineStreamInfoItems.size() > 0) {

2
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

@ -40,7 +40,7 @@ public class StreamPushController {
@RequestParam(required = false)String query,
@RequestParam(required = false)Boolean online ){
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page - 1, page - 1 + count);
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count);
return pushList;
}

Loading…
Cancel
Save