feat: 优化代码
This commit is contained in:
parent
56f70dce6c
commit
80a5ef4957
@ -68,7 +68,7 @@ public class ExampleApplication {
|
|||||||
| retryMethod|RetryMethod|是|RetryAnnotationMethod|重试处理入口|
|
| retryMethod|RetryMethod|是|RetryAnnotationMethod|重试处理入口|
|
||||||
| bizId | BizIdGenerate |是| SimpleBizIdGenerate |自定义业务id,默认为hash(param),传入成员列表,全部拼接取hash|
|
| bizId | BizIdGenerate |是| SimpleBizIdGenerate |自定义业务id,默认为hash(param),传入成员列表,全部拼接取hash|
|
||||||
| retryCompleteCallback | RetryCompleteCallback |否| SimpleRetryCompleteCallback |服务端重试完成(重试成功、重试到达最大次数)回调客户端|
|
| retryCompleteCallback | RetryCompleteCallback |否| SimpleRetryCompleteCallback |服务端重试完成(重试成功、重试到达最大次数)回调客户端|
|
||||||
| isThrowException|boolean|否|true| 本地重试完成后是否抛出异 |
|
| isThrowException|boolean|否|true| 本地重试完成后是否抛出异常 |
|
||||||
| bizNo |String|否|无| bizNo spel表达式|
|
| bizNo |String|否|无| bizNo spel表达式|
|
||||||
| localTimes |int|是|3| 本地重试次数 次数必须大于等于1|
|
| localTimes |int|是|3| 本地重试次数 次数必须大于等于1|
|
||||||
| localInterval |int|是|2| 本地重试间隔时间(s)|
|
| localInterval |int|是|2| 本地重试间隔时间(s)|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
{{ retryTaskInfo.executorName }}
|
{{ retryTaskInfo.executorName }}
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="扩展参数" span="2">
|
<a-descriptions-item label="扩展参数" span="2">
|
||||||
{{ retryTaskInfo.bizNo }}
|
{{ retryTaskInfo.extAttrs }}
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="参数" span="3">
|
<a-descriptions-item label="参数" span="3">
|
||||||
{{ retryTaskInfo.argsStr }}
|
{{ retryTaskInfo.argsStr }}
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.5.6</version>
|
<version>2.6.8</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重试对账系统关闭监听器
|
* 系统关闭监听器
|
||||||
*
|
*
|
||||||
* @author: www.byteblogs.com
|
* @author: www.byteblogs.com
|
||||||
* @date : 2021-11-19 19:00
|
* @date : 2021-11-19 19:00
|
||||||
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重试对账系统启动监听器
|
* 系统启动监听器
|
||||||
*
|
*
|
||||||
* @author: www.byteblogs.com
|
* @author: www.byteblogs.com
|
||||||
* @date : 2021-11-19 19:00
|
* @date : 2021-11-19 19:00
|
||||||
|
@ -122,7 +122,8 @@ public class RetryAspect {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return openRetry(point, traceId, retryable, executorClassName, throwable); }
|
return openRetry(point, traceId, retryable, executorClassName, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
private RetryerResultContext openRetry(ProceedingJoinPoint point, String traceId, Retryable retryable, String executorClassName, Throwable throwable) {
|
private RetryerResultContext openRetry(ProceedingJoinPoint point, String traceId, Retryable retryable, String executorClassName, Throwable throwable) {
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import com.x.retry.server.web.model.request.GroupConfigQueryVO;
|
|||||||
import com.x.retry.server.web.model.request.GroupConfigRequestVO;
|
import com.x.retry.server.web.model.request.GroupConfigRequestVO;
|
||||||
import com.x.retry.server.web.model.response.GroupConfigResponseVO;
|
import com.x.retry.server.web.model.response.GroupConfigResponseVO;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -84,7 +85,16 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public Boolean updateGroup(GroupConfigRequestVO groupConfigRequestVO) {
|
public Boolean updateGroup(GroupConfigRequestVO groupConfigRequestVO) {
|
||||||
|
|
||||||
Assert.isTrue(1 == groupConfigMapper.update(groupConfigConverter.convert(groupConfigRequestVO),
|
GroupConfig groupConfig = groupConfigMapper.selectOne(
|
||||||
|
new LambdaQueryWrapper<GroupConfig>().eq(GroupConfig::getGroupName, groupConfigRequestVO.getGroupName()));
|
||||||
|
if (Objects.isNull(groupConfig)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
groupConfig.setVersion(groupConfig.getVersion() + 1);
|
||||||
|
BeanUtils.copyProperties(groupConfigRequestVO, groupConfig);
|
||||||
|
|
||||||
|
Assert.isTrue(1 == groupConfigMapper.update(groupConfig,
|
||||||
new LambdaUpdateWrapper<GroupConfig>().eq(GroupConfig::getGroupName, groupConfigRequestVO.getGroupName())),
|
new LambdaUpdateWrapper<GroupConfig>().eq(GroupConfig::getGroupName, groupConfigRequestVO.getGroupName())),
|
||||||
new XRetryServerException("新增组异常异常 groupConfigVO[{}]", groupConfigRequestVO));
|
new XRetryServerException("新增组异常异常 groupConfigVO[{}]", groupConfigRequestVO));
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.x.retry.server.service.impl;
|
package com.x.retry.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
import com.x.retry.common.core.util.Assert;
|
import com.x.retry.common.core.util.Assert;
|
||||||
import com.x.retry.server.config.RequestDataHelper;
|
import com.x.retry.server.config.RequestDataHelper;
|
||||||
@ -47,11 +48,26 @@ public class RetryDeadLetterServiceImpl implements RetryDeadLetterService {
|
|||||||
PageDTO<RetryDeadLetter> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
PageDTO<RetryDeadLetter> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||||
|
|
||||||
if (StringUtils.isBlank(queryVO.getGroupName())) {
|
if (StringUtils.isBlank(queryVO.getGroupName())) {
|
||||||
return new PageResult<>(pageDTO, new ArrayList<>());
|
return new PageResult<>(pageDTO, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<RetryDeadLetter> retryDeadLetterLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
retryDeadLetterLambdaQueryWrapper.eq(RetryDeadLetter::getGroupName, queryVO.getGroupName());
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(queryVO.getSceneName())) {
|
||||||
|
retryDeadLetterLambdaQueryWrapper.eq(RetryDeadLetter::getSceneName, queryVO.getSceneName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(queryVO.getBizNo())) {
|
||||||
|
retryDeadLetterLambdaQueryWrapper.eq(RetryDeadLetter::getBizNo, queryVO.getBizNo());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(queryVO.getBizId())) {
|
||||||
|
retryDeadLetterLambdaQueryWrapper.eq(RetryDeadLetter::getBizId, queryVO.getBizId());
|
||||||
}
|
}
|
||||||
|
|
||||||
RequestDataHelper.setPartition(queryVO.getGroupName());
|
RequestDataHelper.setPartition(queryVO.getGroupName());
|
||||||
PageDTO<RetryDeadLetter> retryDeadLetterPageDTO = retryDeadLetterMapper.selectPage(pageDTO, null);
|
PageDTO<RetryDeadLetter> retryDeadLetterPageDTO = retryDeadLetterMapper.selectPage(pageDTO, retryDeadLetterLambdaQueryWrapper);
|
||||||
|
|
||||||
return new PageResult<>(retryDeadLetterPageDTO,
|
return new PageResult<>(retryDeadLetterPageDTO,
|
||||||
retryDeadLetterResponseVOConverter.batchConvert(retryDeadLetterPageDTO.getRecords()));
|
retryDeadLetterResponseVOConverter.batchConvert(retryDeadLetterPageDTO.getRecords()));
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重试对账系统关闭监听器
|
* 关闭监听器
|
||||||
*
|
*
|
||||||
* @author: www.byteblogs.com
|
* @author: www.byteblogs.com
|
||||||
* @date : 2021-11-19 19:00
|
* @date : 2021-11-19 19:00
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重试对账系统启动监听器
|
* 系统启动监听器
|
||||||
*
|
*
|
||||||
* @author: www.byteblogs.com
|
* @author: www.byteblogs.com
|
||||||
* @date : 2021-11-19 19:00
|
* @date : 2021-11-19 19:00
|
||||||
|
@ -10,4 +10,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class RetryDeadLetterQueryVO extends BaseQueryVO {
|
public class RetryDeadLetterQueryVO extends BaseQueryVO {
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
private String sceneName;
|
||||||
|
private String bizNo;
|
||||||
|
private String bizId;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user