This commit is contained in:
jack ning
2025-03-06 17:10:39 +08:00
parent 4a5d56826a
commit 85b49784f6
5 changed files with 20 additions and 21 deletions

View File

@@ -21,6 +21,7 @@ import java.util.Optional;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
@@ -134,4 +135,13 @@ public class MessageEventListener {
});
}
@Async
@EventListener
public void onMessageCreateEvent(MessageCreateEvent event) {
List<String> messageJsonList = event.getMessageJsonList();
Assert.notEmpty(messageJsonList, "Message JSON list must not be empty");
// ... rest of the method
}
}

View File

@@ -15,6 +15,7 @@ package com.bytedesk.core.utils;
import java.util.Random;
import java.util.UUID;
import org.springframework.util.Assert;
public class Utils {
@@ -47,7 +48,7 @@ public class Utils {
/**
* 带有时间戳的uuid
* UUID.randomUUID().toString()长度为36我们去掉-之后,截取前半段
* UUID.randomUUID().toString()长度为36我们去掉'-'之后,截取前半段
*
* @return uuid
*/
@@ -60,20 +61,9 @@ public class Utils {
}
public static String formatUid(String orgUid, String uid) {
// 如果都为空则调用getUid
if ((orgUid == null || orgUid.isEmpty()) && (uid == null || uid.isEmpty())) {
return getUid();
}
// 如果orgUid为空则返回uid
if (orgUid == null || orgUid.isEmpty()) {
return uid;
}
// 如果uid为空则返回orgUid
if (uid == null || uid.isEmpty()) {
return orgUid;
}
// 如果orgUid和uid都不为空则返回orgUid_uid
return orgUid + "_" + uid.toLowerCase();
Assert.hasText(orgUid, "Organization UID must not be empty");
Assert.hasText(uid, "UID must not be empty");
return orgUid + "_" + uid;
}