mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-19 05:37:53 +00:00
update
This commit is contained in:
@@ -36,5 +36,6 @@ public class TypeConsts {
|
||||
public static final String COMPONENT_TYPE_TEAM = "team";
|
||||
public static final String COMPONENT_TYPE_SERVICE = "service";
|
||||
public static final String COMPONENT_TYPE_ROBOT = "robot";
|
||||
public static final String COMPONENT_TYPE_VISITOR = "visitor";
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-01-29 16:21:24
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-03-05 16:36:20
|
||||
* @LastEditTime: 2025-03-15 14:20:07
|
||||
* @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.
|
||||
@@ -72,7 +72,7 @@ public class MessageRestController extends BaseRestController<MessageRequest> {
|
||||
@GetMapping("/query/topic")
|
||||
public ResponseEntity<?> queryByTopic(MessageRequest request) {
|
||||
|
||||
Page<MessageResponse> response = messageService.queryByTopic(request);
|
||||
Page<MessageResponse> response = messageService.queryByOrg(request);
|
||||
//
|
||||
return ResponseEntity.ok(JsonResult.success(response));
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
||||
@@ -61,18 +59,13 @@ public class MessageRestService extends BaseRestService<MessageEntity, MessageRe
|
||||
return queryByOrg(request);
|
||||
}
|
||||
|
||||
@Cacheable(value = "message", key = "#request.topic", unless = "#result == null")
|
||||
public Page<MessageResponse> queryByTopic(MessageRequest request) {
|
||||
|
||||
Pageable pageable = PageRequest.of(request.getPageNumber(), request.getPageSize(), Sort.Direction.DESC,
|
||||
"createdAt");
|
||||
|
||||
Specification<MessageEntity> specs = MessageSpecification.search(request);
|
||||
|
||||
Page<MessageEntity> messagePage = messageRepository.findAll(specs, pageable);
|
||||
|
||||
return messagePage.map(ConvertUtils::convertToMessageResponse);
|
||||
}
|
||||
// @Cacheable(value = "message", key = "#request.topic", unless = "#result == null")
|
||||
// public Page<MessageResponse> queryByTopic(MessageRequest request) {
|
||||
// Pageable pageable = request.getPageable();
|
||||
// Specification<MessageEntity> specs = MessageSpecification.search(request);
|
||||
// Page<MessageEntity> messagePage = messageRepository.findAll(specs, pageable);
|
||||
// return messagePage.map(ConvertUtils::convertToMessageResponse);
|
||||
// }
|
||||
|
||||
@Cacheable(value = "message", key = "#uid", unless = "#result == null")
|
||||
public Optional<MessageEntity> findByUid(String uid) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2024-06-05 22:53:57
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-03-13 11:01:27
|
||||
* @LastEditTime: 2025-03-15 14:14:41
|
||||
* @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.
|
||||
@@ -49,6 +49,15 @@ public class MessageSpecification extends BaseSpecification {
|
||||
} else if (TypeConsts.COMPONENT_TYPE_ROBOT.equals(request.getComponentType())) {
|
||||
// topic like '%robot%'
|
||||
predicates.add(criteriaBuilder.like(root.get("topic"), "%robot%"));
|
||||
} else if (TypeConsts.COMPONENT_TYPE_VISITOR.equals(request.getComponentType())) {
|
||||
// 访客端查询消息:过滤掉一些消息类型,比如:TRANSFER, TRANSFER_ACCEPT, TRANSFER_REJECT
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.TRANSFER.name()));
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.TRANSFER_ACCEPT.name()));
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.TRANSFER_REJECT.name()));
|
||||
// 过滤掉 INVITE, INVITE_ACCEPT, INVITE_REJECT
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.INVITE.name()));
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.INVITE_ACCEPT.name()));
|
||||
predicates.add(criteriaBuilder.notEqual(root.get("type"), MessageTypeEnum.INVITE_REJECT.name()));
|
||||
}
|
||||
}
|
||||
predicates.add(criteriaBuilder.equal(root.get("deleted"), false));
|
||||
|
||||
Reference in New Issue
Block a user