管理员系统部分优化、stripe异常通知优化

This commit is contained in:
2025-02-21 17:16:44 +08:00
parent c4dbd10a85
commit 68a9b2281a
7 changed files with 38 additions and 9 deletions

View File

@@ -49,4 +49,6 @@ public interface StripeService {
String detachCustomerAllPaymentMethod(String name, String email);
// Map getIp(HttpServletRequest request);
String getStackTrace(Exception e, int maxLines);
}

View File

@@ -7,7 +7,6 @@ import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.DateUtil;
import com.ai.da.common.utils.MinioUtil;
import com.ai.da.mapper.primary.*;
import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.Questionnaire;
@@ -31,7 +30,6 @@ import io.minio.http.Method;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -421,7 +419,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
List<Map<String, Object>> countryCount = trialOrderMapper.selectMaps(queryWrapper);
Map<Object, Object> countryCountMap = countryCount.stream().collect(Collectors.toMap(
map -> map.get("country"),
map -> map.get("country") == null ? "Not provided" : map.get("country"),
map -> map.get("count")
));
HashMap<String, List<Object>> resp = new HashMap<>();

View File

@@ -473,7 +473,7 @@ public class StripeServiceImpl implements StripeService {
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(orderNo);
// 2、确认订单状态为支付失败
boolean resp = true;
if (orderByOrderNo.getOrderStatus().equals(OrderStatusEnum.FAILURE.getType())) {
if (!Objects.isNull(orderByOrderNo) && orderByOrderNo.getOrderStatus().equals(OrderStatusEnum.FAILURE.getType())) {
// 3、判断失败订单之后再无成功的订单
QueryWrapper<OrderInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("account_id", orderByOrderNo.getAccountId());
@@ -1326,4 +1326,20 @@ public class StripeServiceImpl implements StripeService {
//
// return request.getRemoteAddr();
// }
public String getStackTrace(Exception e, int maxLines) {
StringBuilder sb = new StringBuilder();
StackTraceElement[] stackTraceElements = e.getStackTrace();
int lines = Math.min(maxLines, stackTraceElements.length);
for (int i = 0; i < lines; i++) {
sb.append(stackTraceElements[i].toString()).append("\n");
}
// 如果堆栈信息超过 maxLines 行,添加提示
if (stackTraceElements.length > maxLines) {
sb.append("... (More stack trace lines truncated)\n");
}
return sb.toString();
}
}