Bladeren bron

只支持文本

liujc 1 jaar geleden
bovenliggende
commit
a20c28757a

+ 54 - 43
.idea/httpRequests/http-requests-log.http

@@ -1,3 +1,57 @@
+POST http://127.0.0.1:8805/api-web/imHistoryMessage/historyMessage
+Authorization: bearer f63411e7-63e0-48e4-bbfa-40413b97b744
+Content-Type: application/json
+Content-Length: 55
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+  "keyword": "AAA课程"
+}
+
+<> 2023-10-23T172204.200.json
+
+###
+
+POST http://127.0.0.1:8805/api-web/imHistoryMessage/historyMessage
+Authorization: bearer f63411e7-63e0-48e4-bbfa-40413b97b744
+Content-Type: application/json
+Content-Length: 46
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+  "keyword": ""
+}
+
+<> 2023-10-23T172149.200.json
+
+###
+
+POST http://127.0.0.1:8805/api-web/imHistoryMessage/historyMessage
+Authorization: bearer f63411e7-63e0-48e4-bbfa-40413b97b744
+Content-Type: application/json
+Content-Length: 46
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+{
+  "page": 1,
+  "rows": 10,
+  "keyword": ""
+}
+
+<> 2023-10-23T172106.200.json
+
+###
+
 POST http://127.0.0.1:8805/api-web/imHistoryMessage/initMsgBodyJson
 Authorization: bearer f63411e7-63e0-48e4-bbfa-40413b97b744
 Content-Length: 0
@@ -838,46 +892,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip
 
 ###
 
-POST http://127.0.0.1:8805/api-web/imHistoryMessage/historyMessage
-Authorization: bearer 3526591a-a4e9-488c-82f1-4a1e56a0c6a4
-Content-Type: application/json
-Content-Length: 29
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-  "page": 1,
-  "rows": 10
-}
-
-<> 2023-10-23T112353.200.json
-
-###
-
-POST http://127.0.0.1:8805/api-web/imHistoryMessage/imToTencent
-Authorization: bearer 3526591a-a4e9-488c-82f1-4a1e56a0c6a4
-Content-Length: 0
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-###
-
-POST http://127.0.0.1:8805/api-web/imHistoryMessage/historyMessage
-Authorization: bearer 3526591a-a4e9-488c-82f1-4a1e56a0c6a4
-Content-Type: application/json
-Content-Length: 29
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-  "page": 1,
-  "rows": 10
-}
-
-<> 2023-10-23T111620.200.json
-
-###
-

+ 7 - 7
mec-common/audit-log/src/main/java/com/yonge/log/service/impl/HistoryMessageTenantServiceImpl.java

@@ -132,16 +132,16 @@ public class HistoryMessageTenantServiceImpl extends BaseServiceImplWithMongo<St
         if (StringUtils.isNotBlank(param.getAppService())) {
             criteria.and("app_service").is(param.getAppService());
         }
+        Pattern pattern = Pattern.compile(".*", Pattern.CASE_INSENSITIVE);
         if (StringUtils.isNotBlank(param.getKeyword())) {
+            pattern = Pattern.compile(".*" + param.getKeyword() + ".*", Pattern.CASE_INSENSITIVE);
+        }
 
-// 创建正则表达式模式,以匹配 Text 字段中包含搜索关键词的部分
-            Pattern pattern = Pattern.compile(".*" + param.getKeyword() + ".*", Pattern.CASE_INSENSITIVE);
+        criteria.and("msg_body_json").elemMatch(
+            Criteria.where("MsgContent.Text").regex(pattern)
+                .and("MsgType").is("TIMTextElem")
+        );
 
-            criteria.and("msg_body_json").elemMatch(
-                Criteria.where("MsgContent.Text").regex(pattern)
-                    .and("MsgType").is("TIMTextElem")
-            );
-        }
         query.addCriteria(criteria);
         query.with(Sort.by(Sort.Order.asc("msg_timestamp"))); // 以升序方式按字段排序