新增 后管批量手动退款临时接口

This commit is contained in:
Lemon
2025-03-07 09:39:00 +08:00
parent 50bc20e01b
commit d3f5db910b
4 changed files with 56 additions and 1 deletions

View File

@@ -727,4 +727,25 @@ public class TempController extends BaseController {
}
return response;
}
/**
* 重试订单退款接口/重试退款按钮 (批量)
* http://localhost:8080/order/retryRefundOrderBatch
*/
@PostMapping("/retryRefundOrderBatch")
public RestApiResponse<?> retryRefundOrderBatch(@RequestBody ApplyRefundDTO dto) {
RestApiResponse<?> response;
try {
orderBasicInfoService.retryRefundOrderList(dto.getOrderCoderList());
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("批量重试订单退款接口 error,", e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("批量重试订单退款接口 error,", e);
response = new RestApiResponse<>(e);
}
return response;
}
}

View File

@@ -51,4 +51,6 @@ public class ApplyRefundDTO {
* 钱包编号
*/
private String walletCode;
private List<String> orderCoderList;
}

View File

@@ -541,4 +541,6 @@ public interface OrderBasicInfoService{
* @return
*/
List<String> tempGetOrderCodes(QueryOrderDTO dto);
void retryRefundOrderList(List<String> orderCoderList);
}

View File

@@ -2328,7 +2328,23 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
if (CollectionUtils.isEmpty(orderCodeList)) {
return resultList;
}
return orderBasicInfoMapper.queryOrderList(orderCodeList);
List<OrderBasicInfo> orderBasicInfos = orderBasicInfoMapper.queryOrderList(orderCodeList);
for (OrderBasicInfo orderBasicInfo : orderBasicInfos) {
String orderCode = orderBasicInfo.getOrderCode();
// 给每个订单查询结果设置缓存
// 如果orderCode是00000000000000000000000000000000直接continue
if (StringUtils.equals(Constants.ILLEGAL_TRANSACTION_CODE, orderCode)) {
continue;
}
// 查缓存
String redisKey = CacheConstants.GET_ORDER_INFO_BY_ORDER_CODE + orderCode;
OrderBasicInfo redisInfo = redisCache.getCacheObject(redisKey);
// 如果该订单缓存为空,重新设置缓存
if (redisInfo == null) {
redisCache.setCacheObject(redisKey, orderBasicInfo, 5, TimeUnit.MINUTES);
}
}
return orderBasicInfos;
}
/**
@@ -3997,6 +4013,20 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
}
}
public void retryRefundOrderList(List<String> orderCodeList) {
// 批量查订单信息
List<OrderBasicInfo> orderBasicInfos = queryOrderList(orderCodeList);
if (CollectionUtils.isNotEmpty(orderBasicInfos)) {
orderBasicInfos.forEach(orderBasicInfo -> {
try {
retryRefundOrder(orderBasicInfo);
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
});
}
}
@Override
public void retryRefundOrder(OrderBasicInfo orderBasicInfo) throws BaseAdaPayException {
if (orderBasicInfo == null) {