mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-17 20:57:51 +00:00
update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-01-29 16:21:24
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-04-14 15:56:44
|
||||
* @LastEditTime: 2025-04-14 16:47:21
|
||||
* @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.
|
||||
@@ -186,15 +186,6 @@ public class ThreadRestController extends BaseRestController<ThreadRequest> {
|
||||
return ResponseEntity.ok(JsonResult.success("delete thread success"));
|
||||
}
|
||||
|
||||
@ActionAnnotation(title = "会话", action = "accept", description = "accept thread")
|
||||
@PostMapping("/accept")
|
||||
public ResponseEntity<?> acceptByAgent (@RequestBody ThreadRequest request) {
|
||||
|
||||
ThreadResponse threadResponse = threadService.acceptByAgent(request);
|
||||
|
||||
return ResponseEntity.ok(JsonResult.success(threadResponse));
|
||||
}
|
||||
|
||||
// https://github.com/alibaba/easyexcel
|
||||
// https://easyexcel.opensource.alibaba.com/docs/current/
|
||||
@ActionAnnotation(title = "会话", action = "导出", description = "export thread")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-01-29 16:21:24
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-04-14 15:55:59
|
||||
* @LastEditTime: 2025-04-14 16:53:32
|
||||
* @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.
|
||||
@@ -45,7 +45,6 @@ import com.bytedesk.core.rbac.user.UserUtils;
|
||||
import com.bytedesk.core.tag.TagRequest;
|
||||
import com.bytedesk.core.tag.TagRestService;
|
||||
import com.bytedesk.core.tag.TagTypeEnum;
|
||||
import com.bytedesk.core.thread.event.ThreadAcceptEvent;
|
||||
import com.bytedesk.core.thread.event.ThreadCloseEvent;
|
||||
import com.bytedesk.core.topic.TopicUtils;
|
||||
import com.bytedesk.core.uid.UidUtils;
|
||||
@@ -113,7 +112,6 @@ public class ThreadRestService extends BaseRestService<ThreadEntity, ThreadReque
|
||||
}
|
||||
|
||||
public ThreadResponse create(ThreadRequest request) {
|
||||
|
||||
UserEntity owner = authService.getUser();
|
||||
//
|
||||
Optional<ThreadEntity> threadOptional = findFirstByTopicAndOwner(request.getTopic(), owner);
|
||||
@@ -498,31 +496,11 @@ public class ThreadRestService extends BaseRestService<ThreadEntity, ThreadReque
|
||||
throw new RuntimeException("thread save failed");
|
||||
}
|
||||
// 发布关闭事件
|
||||
bytedeskEventPublisher.publishEvent(new ThreadCloseEvent(updateThread));
|
||||
bytedeskEventPublisher.publishEvent(new ThreadCloseEvent(this, updateThread));
|
||||
//
|
||||
return convertToResponse(updateThread);
|
||||
}
|
||||
|
||||
public ThreadResponse acceptByAgent(ThreadRequest threadRequest) {
|
||||
//
|
||||
Optional<ThreadEntity> threadOptional = findByUid(threadRequest.getUid());
|
||||
if (!threadOptional.isPresent()) {
|
||||
throw new RuntimeException("accept thread " + threadRequest.getUid() + " not found");
|
||||
}
|
||||
ThreadEntity thread = threadOptional.get();
|
||||
thread.setStatus(ThreadProcessStatusEnum.CHATTING.name());
|
||||
thread.setAgent(threadRequest.getAgent());
|
||||
//
|
||||
ThreadEntity updateThread = save(thread);
|
||||
if (updateThread == null) {
|
||||
throw new RuntimeException("thread save failed");
|
||||
}
|
||||
// 通知queue更新,queue member更新, 增加agent接待数量
|
||||
bytedeskEventPublisher.publishEvent(new ThreadAcceptEvent(updateThread));
|
||||
|
||||
return convertToResponse(updateThread);
|
||||
}
|
||||
|
||||
// 获取当前接待会话数量
|
||||
public int countByThreadTopicAndState(String topic, String state) {
|
||||
return threadRepository.countByTopicAndStatusAndDeletedFalse(topic, state);
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ThreadAcceptEvent extends ApplicationEvent {
|
||||
|
||||
private ThreadEntity thread;
|
||||
|
||||
public ThreadAcceptEvent(ThreadEntity thread) {
|
||||
super(thread);
|
||||
public ThreadAcceptEvent(Object source, ThreadEntity thread) {
|
||||
super(source);
|
||||
this.thread = thread;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-04-23 08:51:27
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2024-12-20 12:34:58
|
||||
* @LastEditTime: 2025-04-14 16:39:47
|
||||
* @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.
|
||||
@@ -26,8 +26,8 @@ public class ThreadCloseEvent extends ApplicationEvent {
|
||||
|
||||
private ThreadEntity thread;
|
||||
|
||||
public ThreadCloseEvent(ThreadEntity thread) {
|
||||
super(thread);
|
||||
public ThreadCloseEvent(Object source, ThreadEntity thread) {
|
||||
super(source);
|
||||
this.thread = thread;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user