mirror of
https://gitee.com/270580156/weiyu.git
synced 2025-12-30 10:52:26 +00:00
update modules/core: mod 12 files
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user