This commit is contained in:
jack ning
2025-04-28 17:23:06 +08:00
parent 41c6f553b4
commit f620beb548
11 changed files with 266 additions and 123 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-01-29 16:21:24
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-27 13:10:02
* @LastEditTime: 2025-04-28 16:59:05
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -18,7 +18,6 @@ import com.alibaba.fastjson2.JSON;
import com.bytedesk.core.base.BaseExtra;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -48,10 +47,10 @@ public class MessageExtra extends BaseExtra {
// private String feedback = BytedeskConsts.EMPTY_JSON_STRING;
// 自动回复
@Builder.Default
private Boolean isAutoReply = false;
// @Builder.Default
// private Boolean isAutoReply = false;
private String autoReplyType;
// private String autoReplyType;
// 翻译
// private String translation;

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-04-16 18:04:37
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-27 13:26:33
* @LastEditTime: 2025-04-28 16:28:49
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -154,14 +154,14 @@ public class MessagePersistService {
// FAQ
//
if (type.equals(MessageTypeEnum.FAQ_UP)
|| type.equals(MessageTypeEnum.FAQ_DOWN)) {
// content为被评价的faq消息的uid
if (StringUtils.hasText(messageProtobuf.getContent())) {
dealWithFaqRateMessage(type, messageProtobuf);
return true;
}
}
// if (type.equals(MessageTypeEnum.FAQ_UP)
// || type.equals(MessageTypeEnum.FAQ_DOWN)) {
// // content为被评价的faq消息的uid
// if (StringUtils.hasText(messageProtobuf.getContent())) {
// dealWithFaqRateMessage(type, messageProtobuf);
// return true;
// }
// }
// QA
// if (type.equals(MessageTypeEnum.QA)) {
@@ -253,19 +253,19 @@ public class MessagePersistService {
// }
// }
private void dealWithFaqRateMessage(MessageTypeEnum type, MessageProtobuf message) {
// log.info("dealWithFaqRateMessage");
Optional<MessageEntity> messageOpt = messageRestService.findByUid(message.getContent());
if (messageOpt.isPresent()) {
MessageEntity messageEntity = messageOpt.get();
if (type.equals(MessageTypeEnum.FAQ_UP)) {
messageEntity.setStatus(MessageStatusEnum.RATE_UP.name());
} else if (type.equals(MessageTypeEnum.FAQ_DOWN)) {
messageEntity.setStatus(MessageStatusEnum.RATE_DOWN.name());
}
messageRestService.save(messageEntity);
}
}
// private void dealWithFaqRateMessage(MessageTypeEnum type, MessageProtobuf message) {
// // log.info("dealWithFaqRateMessage");
// Optional<MessageEntity> messageOpt = messageRestService.findByUid(message.getContent());
// if (messageOpt.isPresent()) {
// MessageEntity messageEntity = messageOpt.get();
// if (type.equals(MessageTypeEnum.FAQ_UP)) {
// messageEntity.setStatus(MessageStatusEnum.RATE_UP.name());
// } else if (type.equals(MessageTypeEnum.FAQ_DOWN)) {
// messageEntity.setStatus(MessageStatusEnum.RATE_DOWN.name());
// }
// messageRestService.save(messageEntity);
// }
// }
private void dealWithRobotRateMessage(MessageTypeEnum type, MessageProtobuf message) {
// log.info("dealWithRobotRateMessage");

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-08-31 16:23:54
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-04-28 14:17:15
* @LastEditTime: 2025-04-28 17:14:13
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -109,5 +109,26 @@ public class MessageUtils {
BytedeskEventPublisher bytedeskEventPublisher = ApplicationContextHolder.getBean(BytedeskEventPublisher.class);
bytedeskEventPublisher.publishMessageJsonEvent(messageProtobuf.toJson());
}
public static MessageEntity getThreadMessage(String content, String type, String extra, String user, ThreadEntity thread) {
// UserProtobuf system = UserProtobuf.getSystemUser();
// MessageExtra extra = MessageUtils.getMessageExtra(thread.getOrgUid());
MessageEntity message = MessageEntity.builder()
.uid(UidUtils.getInstance().getUid())
.content(content)
.type(type)
.status(MessageStatusEnum.READ.name())
.client(ClientEnum.SYSTEM.name())
.user(user)
.orgUid(thread.getOrgUid())
.createdAt(LocalDateTime.now())
.updatedAt(LocalDateTime.now())
.thread(thread)
.extra(extra)
.build();
return message;
}
}