Merge branch 'dev/dev_xp' into dev/dev
This commit is contained in:
@@ -300,4 +300,6 @@ public class RedisUtil {
|
|||||||
redisTemplate.delete(keys);
|
redisTemplate.delete(keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static String STRIPE_EXCEPTION_LOG = "StripeException:";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class ConvenientInquiryController {
|
|||||||
|
|
||||||
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
|
||||||
@GetMapping("/getDesignStatistic")
|
@GetMapping("/getDesignStatistic")
|
||||||
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
|
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime,
|
||||||
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
@RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
|
||||||
Long accountId = UserContext.getUserHolder().getId();
|
Long accountId = UserContext.getUserHolder().getId();
|
||||||
String userEmail = accountService.getById(accountId).getUserEmail();
|
String userEmail = accountService.getById(accountId).getUserEmail();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.ai.da.controller;
|
package com.ai.da.controller;
|
||||||
|
|
||||||
import com.ai.da.common.response.Response;
|
import com.ai.da.common.response.Response;
|
||||||
|
import com.ai.da.common.utils.DateUtil;
|
||||||
|
import com.ai.da.common.utils.RedisUtil;
|
||||||
import com.ai.da.common.utils.SendEmailUtil;
|
import com.ai.da.common.utils.SendEmailUtil;
|
||||||
import com.ai.da.model.dto.ProductPurchaseDTO;
|
import com.ai.da.model.dto.ProductPurchaseDTO;
|
||||||
import com.ai.da.service.StripeService;
|
import com.ai.da.service.StripeService;
|
||||||
@@ -20,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Api(tags = "Stripe模块")
|
@Api(tags = "Stripe模块")
|
||||||
@@ -31,6 +34,8 @@ public class StripeController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StripeService stripeService;
|
private StripeService stripeService;
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@ApiOperation("创建支付链接")
|
@ApiOperation("创建支付链接")
|
||||||
@PostMapping("/createOrder")
|
@PostMapping("/createOrder")
|
||||||
@@ -54,11 +59,16 @@ public class StripeController {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("Stripe Controller层异常捕捉, {}", e.getMessage());
|
log.error("Stripe Controller层异常捕捉, {}", e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
String key_1 = RedisUtil.STRIPE_EXCEPTION_LOG + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_HH);
|
||||||
|
String key_2 = key_1 + ":" + DateUtil.dateToStr(new Date(), DateUtil.YYYY_MM_DD_hh_mm_ss);
|
||||||
|
String stackTrace = stripeService.getStackTrace(e, 10);
|
||||||
|
redisUtil.addToString(key_2, stackTrace);
|
||||||
|
Long size = redisUtil.getSize(key_1);
|
||||||
// 给我发送邮件
|
// 给我发送邮件
|
||||||
if (webhookReminderFlag.equals("1")){
|
if (webhookReminderFlag.equals("1") && size == 3){
|
||||||
SendEmailUtil.commonExceptionReminder("Stripe Webhook 回调", new String[]{"xupei3360@163.com"});
|
SendEmailUtil.commonExceptionReminder("Stripe Webhook 回调", new String[]{"xupei3360@163.com"});
|
||||||
}
|
}
|
||||||
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,4 +49,6 @@ public interface StripeService {
|
|||||||
String detachCustomerAllPaymentMethod(String name, String email);
|
String detachCustomerAllPaymentMethod(String name, String email);
|
||||||
|
|
||||||
// Map getIp(HttpServletRequest request);
|
// Map getIp(HttpServletRequest request);
|
||||||
|
|
||||||
|
String getStackTrace(Exception e, int maxLines);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.ai.da.common.enums.CreditsEventsEnum;
|
|||||||
import com.ai.da.common.response.PageBaseResponse;
|
import com.ai.da.common.response.PageBaseResponse;
|
||||||
import com.ai.da.common.utils.CopyUtil;
|
import com.ai.da.common.utils.CopyUtil;
|
||||||
import com.ai.da.common.utils.DateUtil;
|
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.*;
|
||||||
import com.ai.da.mapper.primary.entity.Account;
|
import com.ai.da.mapper.primary.entity.Account;
|
||||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||||
@@ -31,7 +30,6 @@ import io.minio.http.Method;
|
|||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.xssf.usermodel.*;
|
import org.apache.poi.xssf.usermodel.*;
|
||||||
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;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -421,7 +419,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
|||||||
List<Map<String, Object>> countryCount = trialOrderMapper.selectMaps(queryWrapper);
|
List<Map<String, Object>> countryCount = trialOrderMapper.selectMaps(queryWrapper);
|
||||||
|
|
||||||
Map<Object, Object> countryCountMap = countryCount.stream().collect(Collectors.toMap(
|
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")
|
map -> map.get("count")
|
||||||
));
|
));
|
||||||
HashMap<String, List<Object>> resp = new HashMap<>();
|
HashMap<String, List<Object>> resp = new HashMap<>();
|
||||||
|
|||||||
@@ -473,7 +473,7 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(orderNo);
|
OrderInfo orderByOrderNo = orderInfoService.getOrderByOrderNo(orderNo);
|
||||||
// 2、确认订单状态为支付失败
|
// 2、确认订单状态为支付失败
|
||||||
boolean resp = true;
|
boolean resp = true;
|
||||||
if (orderByOrderNo.getOrderStatus().equals(OrderStatusEnum.FAILURE.getType())) {
|
if (!Objects.isNull(orderByOrderNo) && orderByOrderNo.getOrderStatus().equals(OrderStatusEnum.FAILURE.getType())) {
|
||||||
// 3、判断失败订单之后再无成功的订单
|
// 3、判断失败订单之后再无成功的订单
|
||||||
QueryWrapper<OrderInfo> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<OrderInfo> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("account_id", orderByOrderNo.getAccountId());
|
queryWrapper.eq("account_id", orderByOrderNo.getAccountId());
|
||||||
@@ -1326,4 +1326,20 @@ public class StripeServiceImpl implements StripeService {
|
|||||||
//
|
//
|
||||||
// return request.getRemoteAddr();
|
// 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="getDesignStatistic" resultType="com.ai.da.model.dto.UserDesignStatisticDTO" parameterType="String">
|
<select id="getDesignStatistic" resultType="com.ai.da.model.dto.UserDesignStatisticDTO" parameterType="String">
|
||||||
select d.*,c.id trialOrderId, c.title,c.surname,c.given_name,c.country,c.occupation,c.create_time
|
select d.*,c.id trialOrderId
|
||||||
from (
|
from (
|
||||||
select b.account_id,count(b.account_id) design_times,a.user_name,a.user_email,a.is_trial,a.credits
|
select b.account_id,count(b.account_id) design_times,a.user_name,a.user_email,a.is_trial,a.credits,
|
||||||
|
a.title,a.surname,a.given_name,a.country,a.occupation,a.create_date
|
||||||
from t_account a
|
from t_account a
|
||||||
left join t_design b on a.id = b.account_id
|
left join t_design b on a.id = b.account_id
|
||||||
<where>
|
<where>
|
||||||
|
|||||||
Reference in New Issue
Block a user