Commit 4babf2b47b894c2fc445db46c00d88efbbecc1d0

Authored by 648540858
1 parent 72a1f122

更新README

README.md
1 -![logo](https://raw.githubusercontent.com/648540858/wvp-GB28181-pro/wvp-28181-2.0/web_src/static/logo.png) 1 +![logo](doc/_media/logo.png)
2 # 撘蝞勗28181悅閫像 2 # 撘蝞勗28181悅閫像
3 3
4 [![Build Status](https://travis-ci.org/xia-chu/ZLMediaKit.svg?branch=master)](https://travis-ci.org/xia-chu/ZLMediaKit) 4 [![Build Status](https://travis-ci.org/xia-chu/ZLMediaKit.svg?branch=master)](https://travis-ci.org/xia-chu/ZLMediaKit)
@@ -17,7 +17,7 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗 @@ -17,7 +17,7 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗
17 # 摨嚗 17 # 摨嚗
18 辣仍閫 18 辣仍閫
19 像VR蝑挽憭 19 像VR蝑挽憭
20 -漣 20 +漣像蝥扯楊蝵
21 tsp/rtmp蝑蓮像 21 tsp/rtmp蝑蓮像
22 tsp/rtmp蝑瘚蓮像 22 tsp/rtmp蝑瘚蓮像
23 23
@@ -31,62 +31,49 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗 @@ -31,62 +31,49 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗
31 https://gitee.com/pan648540858/wvp-GB28181-pro.git 31 https://gitee.com/pan648540858/wvp-GB28181-pro.git
32 32
33 # 33 #
34 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101513_79632720_1018729.png "2022-03-04_09-51.png")  
35 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/103025_5df016f9_1018729.png "2022-03-04_10-27.png")  
36 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101706_088fbafa_1018729.png "2022-03-04_09-52_1.png")  
37 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101756_3d662828_1018729.png "2022-03-04_10-00_1.png")  
38 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101823_19050c66_1018729.png "2022-03-04_10-12_1.png")  
39 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101848_e5a39557_1018729.png "2022-03-04_10-12_2.png")  
40 -![build_1.png](https://images.gitee.com/uploads/images/2022/0304/101919_ee5b8c79_1018729.png "2022-03-04_10-13.png")  
41 -  
42 -# 1.0 蝖  
43 -1. 閫;  
44 -2. 鈭嚗憬嚗;  
45 -3. 閫挽憭縑郊;  
46 -4. 蝳餃蝥輻;  
47 -5. 敶霂V嚗鈭VR\DVR嚗翰餈eek;  
48 -6. 犖閫瘚;  
49 -7. DPCP銝斤縑隞支芋撘;  
50 -8. eb, 銝閬蝵脣垢, wvp蔭辣蝵, vp銝韏琿蝵;  
51 -9. 像, 笆憭批像憭折挽憭餈;  
52 -10. 蝝,;  
53 -11. 蔭ZLM慦, 蔭憸憸;  
54 -12. udp憭垢璅∪, dp璅∪扯;  
55 -13. 憸挽蝵;  
56 -14. 敶霂;  
57 -15. dp/tcp芋撘;  
58 -16. 颲RTSPTMPTTP-FLVebsocket-FLVLS憭悅瘚  
59 -17.  
60 -18. 蝵蝵, vp銝lm蝵  
61 -19. h265, g.711撘(閬loseWaitRTPInfo霈曆蛹false)  
62 -20. 霅虫縑憭垢霅虫縑  
63 -  
64 -# 1.0  
65 -1. eb, 銝閬蝵脣垢, wvp蔭辣蝵, vp銝韏琿蝵;  
66 -2. 像, 笆憭批像憭折挽憭餈;  
67 -3. 蝝,;  
68 -4. 蔭ZLM慦, 蔭憸憸;  
69 -5. udp憭垢璅∪, dp璅∪扯;  
70 -6. 憸挽蝵;  
71 -7. 敶霂;  
72 -8. dp/tcp芋撘;  
73 -9. 颲RTSPTMPTTP-FLVebsocket-FLVLS憭悅瘚  
74 -10.  
75 -11. 蝵蝵, vp銝lm蝵  
76 -12. h265, g.711撘  
77 -13. 摰嚗瘚嚗誨絲. ( [IKI](https://github.com/648540858/wvp-GB28181-pro/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E5%9B%BA%E5%AE%9A%E6%92%AD%E6%94%BE%E5%9C%B0%E5%9D%80%E4%B8%8E%E8%87%AA%E5%8A%A8%E7%82%B9%E6%92%AD)嚗  
78 -14. 霅虫縑憭垢霅虫縑  
79 -15. 恥瘜  
80 - - [X] 蝘餃雿蔭霈a  
81 - - [X] 蝘餃雿蔭憭  
82 - - [X] 霅虫辣霈a  
83 - - [X] 霅虫辣憭  
84 - - [X] 霈曉敶恥  
85 - - [X] 霈曉敶憭  
86 -16. 蝘餃雿蔭霂W蝷綽蔭辣霈曄蔭蝘餃雿蔭摮  
87 -  
88 -# 2.0  
89 -- [X] 漣 34 +![index](doc/_media/index.png "index.png")
  35 +![2](doc/_media/2.png "2.png")
  36 +![3](doc/_media/3.png "3.png")
  37 +![3-1](doc/_media/3-1.png "3-1.png")
  38 +![3-2](doc/_media/3-2.png "3-2.png")
  39 +![3-3](doc/_media/3-3.png "3-3.png")
  40 +![build_1](https://images.gitee.com/uploads/images/2022/0304/101919_ee5b8c79_1018729.png "2022-03-04_10-13.png")
  41 +
  42 +#
  43 +- [X] eb
  44 +- [X] 摰寞扯憟
  45 +- [X] 摮嚗WGS84CJ02銝斤頂嚗僎銝頧砍蛹頂餈內
  46 +- [X] 霈曉
  47 + - [X] 閫
  48 + - [X] 頝舀嚗憭挽憭鈭扯
  49 + - [X] 鈭嚗霈曉蓮
  50 + - [X] 憸蔭雿霂g蝙銝挽蝵
  51 + - [X] 霂﹫VR/IPC銝嚗銝蝸
  52 + - [X] 犖閫瘚
  53 + - [X] 閫挽憭縑郊
  54 + - [X] 蝳餃蝥輻
  55 + - [X] 颲RTSPTMPTTP-FLVebsocket-FLVLS憭悅瘚
  56 + - [X] 銝芣閫仍嚗敶誑隞颱
  57 + - [X] DPCP銝斤縑隞支芋撘
  58 + - [X] DPCP銝斤芋撘
  59 + - [X] 蝝,
  60 + - [X] 敶霂
  61 + - [X] 誘憸甇X敶勗
  62 + - [X]
  63 + - [X] H264265
  64 + - [X] 霅虫縑憭垢霅虫縑
  65 + - [X] 恥瘜
  66 + - [X] 蝘餃雿蔭霈a
  67 + - [X] 蝘餃雿蔭憭
  68 + - [X] 霅虫辣霈a
  69 + - [X] 霅虫辣憭
  70 + - [X] 霈曉敶恥
  71 + - [X] 霈曉敶憭
  72 + - [X] 蝘餃雿蔭霂W蝷
  73 + - [X] 瘛餃挽憭挽憭挽蝵桀
  74 +- [X] 像撖寞
  75 +- [X] 漣
  76 + - [X] 漣
90 - [X] WEB瘛餃漣撟喳 77 - [X] WEB瘛餃漣撟喳
91 - [X] 瘜典 78 - [X] 瘜典
92 - [X] 敹歲靽暑 79 - [X] 敹歲靽暑
@@ -101,61 +88,33 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git @@ -101,61 +88,33 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
101 - [X] 敶恥 88 - [X] 敶恥
102 - [X] 敶 89 - [X] 敶
103 - [X] GPS霈a嚗瘚 90 - [X] GPS霈a嚗瘚
104 -- [X] 瘛餃挽憭挽憭挽蝵桀  
105 -- [X] 瘛餃TSP閫  
106 -- [X] 瘛餃  
107 -- [X] 瘛餃TMP閫  
108 -- [X] 鈭垢敶閬蝵脣蝙嚗  
109 -- [X] 憭嚗韐蝸雿雿輻  
110 -- [X] WEB蝡舀H264銝265嚗憸.711A/G.711U/AAC,閬虜蝻撘  
111 -- [X] 摮  
112 -- [X] WGS84CJ02銝斤頂  
113 -  
114 -[//]: # (# docker敹恍)  
115 -  
116 -[//]: # (ocker-compose蛹輕銝嚗洵銝之摰嗡蝙嚗輕銝之摰嗉扇敺撈銝泅tar )  
117 -  
118 -[//]: # (https://github.com/SaltFish001/wvp_pro_compose)  
119 -  
120 -[//]: # ([https://github.com/SaltFish001/wvp_pro_compose](https://github.com/SaltFish001/wvp_pro_compose))  
121 -  
122 -[//]: # (餈雿輕銝芷摮銝憸)  
123 -  
124 -[//]: # (```shell)  
125 -  
126 -[//]: # (docker pull 648540858/wvp_pro)  
127 -  
128 -[//]: # ()  
129 -[//]: # (docker run --env WVP_IP="雿P" -it -p 18080:18080 -p 30000-30500:30000-30500/udp -p 30000-30500:30000-30500/tcp -p 80:80 -p 5060:5060 -p 5060:5060/udp 648540858/wvp_pro)  
130 -  
131 -[//]: # (```)  
132 -  
133 -[//]: # (docker雿輻霂行https://hub.docker.com/r/648540858/wvp_pro](https://hub.docker.com/r/648540858/wvp_pro))  
134 -  
135 -# gitee郊隞  
136 -https://gitee.com/pan648540858/wvp-GB28181-pro.git  
137 -  
138 -# 憸 91 +- [X] 蔭ZLM慦, 蔭憸憸;
  92 +- [X] 憭嚗韐蝸雿雿輻
  93 +- [X] udp憭垢璅∪, dp璅∪扯;
  94 +- [X] 蝵蝵莎
  95 +- [X] vp銝lm蝵莎像撟嗅
  96 +- [X] TSP/RTMP嚗蛹撘隞像
  97 +- [X] 瘚TSP/RTMP嚗蛹撘隞像
  98 +- [X] 瘚
  99 +- [X]
  100 +- [X] 鈭垢敶瘚/隞/隞亙鈭垢嚗蝸
  101 +
  102 +
  103 +# 憸圾
139 暻餌鈭挽憭摰寞改隞仿閬之挽憭瘚挽憭偌撟單隞仿憸 104 暻餌鈭挽憭摰寞改隞仿閬之挽憭瘚挽憭偌撟單隞仿憸
140 1. iki嚗粉隞亙葬雿憸 105 1. iki嚗粉隞亙葬雿憸
141 2. 揣issues嚗之 106 2. 揣issues嚗之
142 -3. Q蝢歹之敹撈嚗撣歇蝏粉鈭iki揣鈭ssues 107 +3. Q蝢歹901799015嚗之敹撈嚗撣歇蝏粉鈭iki揣鈭ssues
143 4. 雿隞亥窈雿蛹雿圾蝑晶 108 4. 雿隞亥窈雿蛹雿圾蝑晶
144 5. 雿隞交憸挽憭隞交摰寞憸 109 5. 雿隞交憸挽憭隞交摰寞憸
145 110
146 -  
147 -#  
148 -蝘摰之摰嗅之銝瓷移憸隞乩晶圾蝑隞交R  
149 -嚗笆隞遣霈桀隞交SSUE嚗隞亙黎銝韏瑁賑甈Z頞憿寧銝剜犖  
150 -  
151 -  
152 -  
153 # 雿輻撣桀 111 # 雿輻撣桀
154 QQ蝢: 901799015, ZLM雿輻﹝[https://github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit) 112 QQ蝢: 901799015, ZLM雿輻﹝[https://github.com/ZLMediaKit/ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
155 QQ蝘縑銝銝, 蝎曉.甈Z之摰嗅蝢日悄霈.閫★撖嫣葬嚗洽餈tar漱pr 113 QQ蝘縑銝銝, 蝎曉.甈Z之摰嗅蝢日悄霈.閫★撖嫣葬嚗洽餈tar漱pr
156 114
157 # 悅 115 # 悅
158 憿寧誨蝙摰賣IT悅嚗靽縑銝隞亥摨鈭★ 雿憿寧銋蝣蝙鈭鈭隞皞誨銝窈銵隞嚗 鈭蝙憿寧漣熒噩蛹銝璁憿寧嚗窈銵 雿輻憿寧隞嚗砲悅銝剖銵冽憿寧靘洵銝摨悅 116 憿寧誨蝙摰賣IT悅嚗靽縑銝隞亥摨鈭★ 雿憿寧銋蝣蝙鈭鈭隞皞誨銝窈銵隞嚗 鈭蝙憿寧漣熒噩蛹銝璁憿寧嚗窈銵 雿輻憿寧隞嚗砲悅銝剖銵冽憿寧靘洵銝摨悅
  117 +
159 # 靚 118 # 靚
160 陝雿憭(https://github.com/xia-chu) 皞獢,撟嗅撘葉蝏葬 119 陝雿憭(https://github.com/xia-chu) 皞獢,撟嗅撘葉蝏葬
161 陝雿dexter langhuihui](https://github.com/langhuihui) 撘皞末EB 120 陝雿dexter langhuihui](https://github.com/langhuihui) 撘皞末EB
doc/_media/2.png 0 → 100644

469 KB

doc/_media/3-1.png 0 → 100644

136 KB

doc/_media/3-2.png 0 → 100644

650 KB

doc/_media/3-3.png 0 → 100644

1.04 MB

doc/_media/3.png 0 → 100644

146 KB

doc/_media/index.png 0 → 100644

154 KB

src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
@@ -70,7 +70,7 @@ public class VideoStreamSessionManager { @@ -70,7 +70,7 @@ public class VideoStreamSessionManager {
70 stream ="*"; 70 stream ="*";
71 } 71 }
72 String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; 72 String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream;
73 - List<Object> scanResult = RedisUtil.scan(key); 73 + List<Object> scanResult = RedisUtil.scan(key, 1);
74 if (scanResult.size() == 0) { 74 if (scanResult.size() == 0) {
75 return null; 75 return null;
76 } 76 }
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -75,7 +75,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -75,7 +75,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
75 @Override 75 @Override
76 public void resetAllSN() { 76 public void resetAllSN() {
77 String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; 77 String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*";
78 - List<Object> keys = RedisUtil.scan(scanKey); 78 + List<Object> keys = RedisUtil.scan(scanKey, null);
79 for (Object o : keys) { 79 for (Object o : keys) {
80 String key = (String) o; 80 String key = (String) o;
81 RedisUtil.set(key, 1); 81 RedisUtil.set(key, 1);
@@ -129,7 +129,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -129,7 +129,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
129 } 129 }
130 @Override 130 @Override
131 public StreamInfo queryPlayByStreamId(String streamId) { 131 public StreamInfo queryPlayByStreamId(String streamId) {
132 - List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); 132 + List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId), 1);
133 if (playLeys == null || playLeys.size() == 0) { 133 if (playLeys == null || playLeys.size() == 0) {
134 return null; 134 return null;
135 } 135 }
@@ -141,7 +141,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -141,7 +141,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
141 List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, 141 List<Object> playLeys = RedisUtil.scan(String.format("%S_%s_*_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
142 userSetting.getServerId(), 142 userSetting.getServerId(),
143 deviceId, 143 deviceId,
144 - channelId)); 144 + channelId), 1);
145 if (playLeys == null || playLeys.size() == 0) { 145 if (playLeys == null || playLeys.size() == 0) {
146 return null; 146 return null;
147 } 147 }
@@ -278,7 +278,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -278,7 +278,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
278 stream, 278 stream,
279 callId 279 callId
280 ); 280 );
281 - List<Object> streamInfoScan = RedisUtil.scan(key); 281 + List<Object> streamInfoScan = RedisUtil.scan(key, 1);
282 if (streamInfoScan.size() > 0) { 282 if (streamInfoScan.size() > 0) {
283 return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); 283 return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
284 }else { 284 }else {
@@ -310,7 +310,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -310,7 +310,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
310 stream, 310 stream,
311 callId 311 callId
312 ); 312 );
313 - List<Object> streamInfoScan = RedisUtil.scan(key); 313 + List<Object> streamInfoScan = RedisUtil.scan(key, 1);
314 return (String) streamInfoScan.get(0); 314 return (String) streamInfoScan.get(0);
315 } 315 }
316 316
@@ -399,7 +399,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -399,7 +399,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
399 + channelId + "_" 399 + channelId + "_"
400 + streamId + "_" 400 + streamId + "_"
401 + callId; 401 + callId;
402 - List<Object> scan = RedisUtil.scan(key); 402 + List<Object> scan = RedisUtil.scan(key, 1);
403 if (scan.size() > 0) { 403 if (scan.size() > 0) {
404 return (SendRtpItem)RedisUtil.get((String)scan.get(0)); 404 return (SendRtpItem)RedisUtil.get((String)scan.get(0));
405 }else { 405 }else {
@@ -521,7 +521,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -521,7 +521,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
521 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX 521 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX
522 + userSetting.getServerId() + "_*_*_" 522 + userSetting.getServerId() + "_*_*_"
523 + channelId + "*_" + "*_"; 523 + channelId + "*_" + "*_";
524 - List<Object> RtpStreams = RedisUtil.scan(key); 524 + List<Object> RtpStreams = RedisUtil.scan(key, 1);
525 if (RtpStreams.size() > 0) { 525 if (RtpStreams.size() > 0) {
526 return true; 526 return true;
527 } else { 527 } else {
@@ -613,7 +613,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -613,7 +613,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
613 stream, 613 stream,
614 callId 614 callId
615 ); 615 );
616 - List<Object> streamInfoScan = RedisUtil.scan(key); 616 + List<Object> streamInfoScan = RedisUtil.scan(key, 1);
617 if (streamInfoScan.size() > 0) { 617 if (streamInfoScan.size() > 0) {
618 return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0)); 618 return (StreamInfo) RedisUtil.get((String) streamInfoScan.get(0));
619 }else { 619 }else {
@@ -732,7 +732,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -732,7 +732,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
732 String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; 732 String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId;
733 733
734 OnStreamChangedHookParam result = null; 734 OnStreamChangedHookParam result = null;
735 - List<Object> keys = RedisUtil.scan(scanKey); 735 + List<Object> keys = RedisUtil.scan(scanKey, 1);
736 if (keys.size() > 0) { 736 if (keys.size() > 0) {
737 String key = (String) keys.get(0); 737 String key = (String) keys.get(0);
738 result = (OnStreamChangedHookParam)RedisUtil.get(key); 738 result = (OnStreamChangedHookParam)RedisUtil.get(key);
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
1 package com.genersoft.iot.vmp.utils.redis; 1 package com.genersoft.iot.vmp.utils.redis;
2 2
3 -import java.util.*;  
4 -import java.util.concurrent.TimeUnit;  
5 -  
6 import com.alibaba.fastjson2.JSONObject; 3 import com.alibaba.fastjson2.JSONObject;
7 import com.genersoft.iot.vmp.utils.SpringBeanFactory; 4 import com.genersoft.iot.vmp.utils.SpringBeanFactory;
8 -import gov.nist.javax.sip.stack.UDPMessageChannel;  
9 import org.springframework.data.redis.core.*; 5 import org.springframework.data.redis.core.*;
10 import org.springframework.util.CollectionUtils; 6 import org.springframework.util.CollectionUtils;
11 7
  8 +import java.util.*;
  9 +import java.util.concurrent.TimeUnit;
  10 +
12 /** 11 /**
13 * Redis工具类 12 * Redis工具类
14 * @author swwheihei 13 * @author swwheihei
@@ -865,12 +864,16 @@ public class RedisUtil { @@ -865,12 +864,16 @@ public class RedisUtil {
865 * @param query 查询参数 864 * @param query 查询参数
866 * @return 865 * @return
867 */ 866 */
868 - public static List<Object> scan(String query) { 867 + public static List<Object> scan(String query, Integer count) {
869 if (redisTemplate == null) { 868 if (redisTemplate == null) {
870 redisTemplate = SpringBeanFactory.getBean("redisTemplate"); 869 redisTemplate = SpringBeanFactory.getBean("redisTemplate");
871 } 870 }
872 Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { 871 Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
873 - ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build(); 872 + ScanOptions.ScanOptionsBuilder match = ScanOptions.scanOptions().match("*" + query + "*");
  873 + if (count != null) {
  874 + match.count(count);
  875 + }
  876 + ScanOptions scanOptions = match.build();
874 Cursor<byte[]> scan = connection.scan(scanOptions); 877 Cursor<byte[]> scan = connection.scan(scanOptions);
875 Set<String> keys = new HashSet<>(); 878 Set<String> keys = new HashSet<>();
876 while (scan.hasNext()) { 879 while (scan.hasNext()) {
@@ -883,6 +886,15 @@ public class RedisUtil { @@ -883,6 +886,15 @@ public class RedisUtil {
883 return new ArrayList<>(resultKeys); 886 return new ArrayList<>(resultKeys);
884 } 887 }
885 888
  889 + /**
  890 + * 模糊查询
  891 + * @param query 查询参数
  892 + * @return
  893 + */
  894 + public static List<Object> scan(String query) {
  895 + return scan(query, null);
  896 + }
  897 +
886 // ============================== 消息发送与订阅 ============================== 898 // ============================== 消息发送与订阅 ==============================
887 public static void convertAndSend(String channel, JSONObject msg) { 899 public static void convertAndSend(String channel, JSONObject msg) {
888 if (redisTemplate == null) { 900 if (redisTemplate == null) {