update modules/core: mod 12 files

This commit is contained in:
jack ning
2025-07-05 10:16:04 +08:00
parent 71019fc7d8
commit 47b745da7e
12 changed files with 41 additions and 66 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-05-29 14:40:06
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-03-25 14:10:37
* @LastEditTime: 2025-07-05 09:54:26
* @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.
@@ -13,12 +13,13 @@
*/
package com.bytedesk.core.member;
import com.bytedesk.core.base.BaseResponse;
import java.io.Serializable;
import com.bytedesk.core.rbac.user.UserTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@@ -27,12 +28,16 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MemberProtobuf extends BaseResponse {
public class MemberProtobuf implements Serializable {
private static final long serialVersionUID = 1L;
private String uid;
private String nickname;
private String avatar;
@Builder.Default
private String type = UserTypeEnum.MEMBER.name();
}

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-05-30 10:01:47
* @LastEditTime: 2025-07-05 09:54:43
* @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.
@@ -44,7 +44,6 @@ public class UserProtobuf implements Serializable {
private String avatar;
// ROBOT/AGENT/SYSTEM/USER/VISITOR/WORKGROUP
@Builder.Default
private String type = UserTypeEnum.USER.name();

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-06-29 13:00:33
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-06-13 12:38:10
* @LastEditTime: 2025-07-05 09:49:35
* @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.
@@ -169,18 +169,20 @@ public abstract class AbstractThreadEntity extends BaseEntity {
@Column(columnDefinition = TypeConsts.COLUMN_TYPE_TEXT)
private List<String> invites = new ArrayList<>();
// 多个管理员监听会话
// 多个管理员监听会话, 存放多个 UserProtobuf 实体转换成的 JSON
@Builder.Default
@Convert(converter = JsonListConverter.class)
@Column(columnDefinition = TypeConsts.COLUMN_TYPE_TEXT)
private List<String> monitors = new ArrayList<>();
// 存放多个 UserProtobuf 实体转换成的 JSON
// assistants: monitoring agent、quality check agent、robot agent
@Builder.Default
@Convert(converter = JsonListConverter.class)
@Column(columnDefinition = TypeConsts.COLUMN_TYPE_TEXT)
private List<String> assistants = new ArrayList<>();
// 存放多个 UserProtobuf 实体转换成的 JSON
// ticketors: ticket observers
@Builder.Default
@Convert(converter = JsonListConverter.class)

View File

@@ -80,5 +80,10 @@ public interface ThreadRepository extends JpaRepository<ThreadEntity, Long>, Jpa
@Query("SELECT t FROM ThreadEntity t WHERE t.topic = :topic AND t.status != :status AND t.deleted = false")
List<ThreadEntity> findByTopicAndStatusNotAndDeletedFalse(@Param("topic") String topic, @Param("status") String status);
@Query("SELECT t FROM ThreadEntity t WHERE t.topic IN :topics AND t.deleted = false")
List<ThreadEntity> findByTopicsInAndDeletedFalse(@Param("topics") List<String> topics);
@Query("SELECT t FROM ThreadEntity t WHERE t.topic IN :topics AND t.deleted = false")
Page<ThreadEntity> findByTopicsInAndDeletedFalse(@Param("topics") List<String> topics, Pageable pageable);
}

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-06-14 13:35:56
* @LastEditTime: 2025-07-05 10:01: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.
@@ -100,7 +100,6 @@ public class ThreadRestController extends BaseRestController<ThreadRequest> {
@Operation(summary = "根据主题查询会话", description = "通过主题查找相关会话")
@GetMapping("/query/topic")
public ResponseEntity<?> queryByThreadTopic(ThreadRequest request) {
Optional<ThreadResponse> threadOptional = threadRestService.queryByTopic(request);
if (threadOptional.isPresent()) {
return ResponseEntity.ok(JsonResult.success(threadOptional.get()));

View File

@@ -13,8 +13,11 @@
*/
package com.bytedesk.core.thread;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.modelmapper.ModelMapper;
import org.springframework.cache.annotation.CacheEvict;
@@ -27,6 +30,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.lang.NonNull;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import com.bytedesk.core.base.BaseRestServiceWithExcel;
@@ -63,6 +67,8 @@ public class ThreadRestService
private final BytedeskEventPublisher bytedeskEventPublisher;
private final TopicRepository topicRepository;
@Override
public Page<ThreadEntity> queryByOrgEntity(ThreadRequest request) {
Pageable pageable = request.getPageable();
@@ -114,6 +120,8 @@ public class ThreadRestService
return Optional.empty();
}
@Transactional
@Override
public ThreadResponse create(ThreadRequest request) {
UserEntity owner = authService.getUser();
//
@@ -142,32 +150,7 @@ public class ThreadRestService
return convertToResponse(savedThread);
}
// 在group会话创建之后自动为group成员members创建会话
// 同事群组会话org/group/{group_uid}
// public ThreadResponse createGroupMemberThread(ThreadEntity thread, UserEntity owner) {
// //
// Optional<ThreadEntity> threadOptional = findFirstByTopicAndOwner(thread.getTopic(), owner);
// if (threadOptional.isPresent()) {
// return convertToResponse(threadOptional.get());
// }
// ThreadEntity groupThread = ThreadEntity.builder()
// .uid(uidUtils.getUid())
// .type(thread.getType())
// .topic(thread.getTopic())
// .unreadCount(0)
// .status(thread.getStatus())
// .client(ClientEnum.SYSTEM.name())
// .user(thread.getUser())
// .owner(owner)
// .orgUid(thread.getOrgUid())
// .build();
// ThreadEntity updateThread = save(groupThread);
// if (updateThread == null) {
// throw new RuntimeException("thread save failed");
// }
// return convertToResponse(updateThread);
// }
@Transactional
public ThreadResponse createGroupMemberThread(String user, String topic, String orgUid, UserEntity owner) {
//
Optional<ThreadEntity> threadOptional = findFirstByTopicAndOwner(topic, owner);

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-04-13 16:03:44
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-07-05 09:40:37
* @LastEditTime: 2025-07-05 10:05:04
* @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.
@@ -50,9 +50,11 @@ public class TopicEntity extends BaseEntityNoOrg {
@Convert(converter = StringSetConverter.class)
private Set<String> topics = new HashSet<>();
// 每种topic的qos都可能不一样因为用数组存储索引topic不方便分开暂时不用此字段
/** AT_MOST_ONCE(0),AT_LEAST_ONCE(1), EXACTLY_ONCE(2), */
@Builder.Default
private Integer qos = 1;
// @Builder.Default
// @Column(name = "topic_qos")
// private Integer qos = 1;
/**
* current online clientIds

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-04-13 16:15:11
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-07-05 09:40:49
* @LastEditTime: 2025-07-05 10:04:08
* @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.
@@ -39,8 +39,8 @@ public class TopicRequest extends BaseRequest {
@Builder.Default
private Set<String> topics = new HashSet<>();
@Builder.Default
private Integer qos = 1;
// @Builder.Default
// private Integer qos = 1;
@Builder.Default
private Set<String> clientIds = new HashSet<>();

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-04-13 16:15:22
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-07-05 09:41:01
* @LastEditTime: 2025-07-05 10:04:22
* @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.
@@ -35,8 +35,7 @@ public class TopicResponse extends BaseResponse {
private Set<String> topics;
private Integer qos;
// private Integer qos;
private Set<String> clientIds;
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-02-06 10:17:01
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-05-05 11:00:20
* @LastEditTime: 2025-07-05 09:57:20
* @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.
@@ -71,9 +71,6 @@ public class AgentResponse extends BaseResponse {
private String timeoutRemindTip;
// private Integer currentThreadCount;
// private UserResponse user;
private MemberProtobuf member;
private String userUid;

View File

@@ -40,8 +40,6 @@ public class ModuleResponse extends BaseResponse {
private String type;
// private String color;
private Integer order;
private List<MemberProtobuf> members;
@@ -53,8 +51,4 @@ public class ModuleResponse extends BaseResponse {
private String userUid;
private Boolean isPublic;
// private ZonedDateTime createdAt;
// private ZonedDateTime updatedAt;
}

View File

@@ -40,21 +40,11 @@ public class ProjectResponse extends BaseResponse {
private String type;
// private String color;
private Integer order;
private List<MemberProtobuf> members;
private List<ModuleResponse> modules;
// private String parentUid;
private String userUid;
private Boolean isPublic;
// private ZonedDateTime createdAt;
// private ZonedDateTime updatedAt;
}