mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-16 12:18:10 +00:00
update modules/ticket: mod 4 files
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2025-02-18 17:06:01
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-02-18 17:49:16
|
||||
* @LastEditTime: 2025-02-18 17:51:40
|
||||
* @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.
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
/*
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2025-02-18 17:05:46
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-02-18 17:53:57
|
||||
* @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.
|
||||
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
|
||||
* contact: 270580156@qq.com
|
||||
*
|
||||
* Copyright (c) 2025 by bytedesk.com, All Rights Reserved.
|
||||
*/
|
||||
package com.bytedesk.ticket.message;
|
||||
|
||||
import java.util.List;
|
||||
// import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface TicketMessageRepository extends JpaRepository<TicketMessageEntity, Long> {
|
||||
List<TicketMessageEntity> findByStatusAndRetryCountLessThan(TicketMessageStatusEnum status, int retryCount);
|
||||
public interface TicketMessageRepository extends JpaRepository<TicketMessageEntity, Long>, JpaSpecificationExecutor<TicketMessageEntity> {
|
||||
// List<TicketMessageEntity> findByStatusAndRetryCountLessThan(TicketMessageStatusEnum status, int retryCount);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2025-02-18 17:01:34
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-02-18 17:49:34
|
||||
* @LastEditTime: 2025-02-18 17:54:16
|
||||
* @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,29 +18,29 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
// import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TicketMessageRetryService {
|
||||
|
||||
private final TicketMessageRepository messageRepository;
|
||||
// private final TicketMessageRepository messageRepository;
|
||||
|
||||
@Scheduled(fixedDelay = 300000) // 5分钟
|
||||
public void retryFailedMessages() {
|
||||
List<TicketMessageEntity> failedMessages =
|
||||
messageRepository.findByStatusAndRetryCountLessThan(
|
||||
TicketMessageStatusEnum.FAILED, 3);
|
||||
// List<TicketMessageEntity> failedMessages =
|
||||
// messageRepository.findByStatusAndRetryCountLessThan(
|
||||
// TicketMessageStatusEnum.FAILED, 3);
|
||||
|
||||
for (TicketMessageEntity message : failedMessages) {
|
||||
try {
|
||||
// 重试发送消息
|
||||
// message.setRetryCount(message.getRetryCount() + 1);
|
||||
// messageRepository.save(message);
|
||||
} catch (Exception e) {
|
||||
log.error("消息重试失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
// for (TicketMessageEntity message : failedMessages) {
|
||||
// try {
|
||||
// // 重试发送消息
|
||||
// // message.setRetryCount(message.getRetryCount() + 1);
|
||||
// messageRepository.save(message);
|
||||
// } catch (Exception e) {
|
||||
// log.error("消息重试失败: {}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: jackning 270580156@qq.com
|
||||
* @Date: 2025-01-16 14:58:38
|
||||
* @LastEditors: jackning 270580156@qq.com
|
||||
* @LastEditTime: 2025-02-18 17:45:59
|
||||
* @LastEditTime: 2025-02-18 17:50:17
|
||||
* @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.
|
||||
@@ -15,6 +15,7 @@ package com.bytedesk.ticket.ticket;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.bytedesk.core.base.BaseRequest;
|
||||
import com.bytedesk.core.rbac.user.UserProtobuf;
|
||||
|
||||
@@ -23,7 +24,6 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
Reference in New Issue
Block a user