Commit b6fa459bc3ae287abcb3292a873718fd08297e61
1 parent
20a3cb9e
修复推流列表大数据量时批量删除的错误,修复推流列表分页查询错误
Showing
3 changed files
with
17 additions
and
5 deletions
pom.xml
| @@ -50,7 +50,6 @@ | @@ -50,7 +50,6 @@ | ||
| 50 | <jedis-version>3.1.0</jedis-version> | 50 | <jedis-version>3.1.0</jedis-version> |
| 51 | 51 | ||
| 52 | <!-- 依赖版本 --> | 52 | <!-- 依赖版本 --> |
| 53 | - <pagehelper.version>5.2.0</pagehelper.version> | ||
| 54 | <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory> | 53 | <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory> |
| 55 | <asciidoctor.input.directory>${project.basedir}/docs/asciidoc</asciidoctor.input.directory> | 54 | <asciidoctor.input.directory>${project.basedir}/docs/asciidoc</asciidoctor.input.directory> |
| 56 | <generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory> | 55 | <generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory> |
| @@ -113,7 +112,7 @@ | @@ -113,7 +112,7 @@ | ||
| 113 | <dependency> | 112 | <dependency> |
| 114 | <groupId>com.github.pagehelper</groupId> | 113 | <groupId>com.github.pagehelper</groupId> |
| 115 | <artifactId>pagehelper-spring-boot-starter</artifactId> | 114 | <artifactId>pagehelper-spring-boot-starter</artifactId> |
| 116 | - <version>1.2.10</version> | 115 | + <version>1.4.1</version> |
| 117 | </dependency> | 116 | </dependency> |
| 118 | 117 | ||
| 119 | <!--Swagger3 --> | 118 | <!--Swagger3 --> |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| @@ -188,10 +188,23 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -188,10 +188,23 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 188 | streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream()); | 188 | streamInfoPushItemMap.remove(streamPushItem.getApp() + streamPushItem.getStream()); |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | - Collection<StreamPushItem> offlinePushItems = pushItemMap.values(); | 191 | + List<StreamPushItem> offlinePushItems = new ArrayList<>(pushItemMap.values()); |
| 192 | if (offlinePushItems.size() > 0) { | 192 | if (offlinePushItems.size() > 0) { |
| 193 | String type = "PUSH"; | 193 | String type = "PUSH"; |
| 194 | - streamPushMapper.delAll(new ArrayList<>(offlinePushItems)); | 194 | + int runLimit = 300; |
| 195 | + if (offlinePushItems.size() > runLimit) { | ||
| 196 | + for (int i = 0; i < offlinePushItems.size(); i += runLimit) { | ||
| 197 | + int toIndex = i + runLimit; | ||
| 198 | + if (i + runLimit > offlinePushItems.size()) { | ||
| 199 | + toIndex = offlinePushItems.size(); | ||
| 200 | + } | ||
| 201 | + List<StreamPushItem> streamPushItemsSub = offlinePushItems.subList(i, toIndex); | ||
| 202 | + streamPushMapper.delAll(streamPushItemsSub); | ||
| 203 | + } | ||
| 204 | + }else { | ||
| 205 | + streamPushMapper.delAll(offlinePushItems); | ||
| 206 | + } | ||
| 207 | + | ||
| 195 | } | 208 | } |
| 196 | Collection<StreamInfo> offlineStreamInfoItems = streamInfoPushItemMap.values(); | 209 | Collection<StreamInfo> offlineStreamInfoItems = streamInfoPushItemMap.values(); |
| 197 | if (offlineStreamInfoItems.size() > 0) { | 210 | if (offlineStreamInfoItems.size() > 0) { |
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
| @@ -40,7 +40,7 @@ public class StreamPushController { | @@ -40,7 +40,7 @@ public class StreamPushController { | ||
| 40 | @RequestParam(required = false)String query, | 40 | @RequestParam(required = false)String query, |
| 41 | @RequestParam(required = false)Boolean online ){ | 41 | @RequestParam(required = false)Boolean online ){ |
| 42 | 42 | ||
| 43 | - PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page - 1, page - 1 + count); | 43 | + PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count); |
| 44 | return pushList; | 44 | return pushList; |
| 45 | } | 45 | } |
| 46 | 46 |