回调订单查询优化
This commit is contained in:
parent
79bc357bb1
commit
5828199ba0
|
|
@ -1,5 +1,6 @@
|
||||||
package com.sqx.modules.pay.controller.app;
|
package com.sqx.modules.pay.controller.app;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
@ -204,7 +205,19 @@ public class WuyouController {
|
||||||
|
|
||||||
log.info("无忧支付回调成功, 参数: {}", JSONObject.toJSONString(notifyDto));
|
log.info("无忧支付回调成功, 参数: {}", JSONObject.toJSONString(notifyDto));
|
||||||
|
|
||||||
PayDetails payDetails = payDetailsDao.selectByTradeNo(notifyDto.getOut_trade_no());
|
DateTime offsetMinute = DateUtil.offsetMinute(new Date(), -30);
|
||||||
|
String format = DateUtil.format(offsetMinute, "yyyy-MM-dd HH:mm:ss");
|
||||||
|
List<PayDetails> details = payDetailsDao.selectList(new LambdaQueryWrapper<PayDetails>()
|
||||||
|
.eq(PayDetails::getTradeNo, notifyDto.getOut_trade_no()).ge(PayDetails::getCreateTime, format));
|
||||||
|
if (details.isEmpty()) {
|
||||||
|
log.error("无忧支付回调订单不存在, 参数: {}", JSONObject.toJSONString(notifyDto));
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
if (details.size() > 1) {
|
||||||
|
log.error("无忧支付回调订单重复, 参数: {}", JSONObject.toJSONString(notifyDto));
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
PayDetails payDetails = details.get(0);
|
||||||
if (payDetails == null) {
|
if (payDetails == null) {
|
||||||
log.error("无忧支付回调订单不存在, 参数: {}", JSONObject.toJSONString(notifyDto));
|
log.error("无忧支付回调订单不存在, 参数: {}", JSONObject.toJSONString(notifyDto));
|
||||||
return "success";
|
return "success";
|
||||||
|
|
@ -215,7 +228,10 @@ public class WuyouController {
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
|
|
||||||
Orders order = ordersService.selectOrderByOrdersNo(payDetails.getOrderId());
|
QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("orders_no", payDetails.getOrderId()).eq("user_id", payDetails.getUserId());
|
||||||
|
queryWrapper.last("limit 1");
|
||||||
|
Orders order = ordersService.getOne(queryWrapper);
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
log.error("无忧支付回调订单不存在, 参数: {}", JSONObject.toJSONString(notifyDto));
|
log.error("无忧支付回调订单不存在, 参数: {}", JSONObject.toJSONString(notifyDto));
|
||||||
return "订单不存在";
|
return "订单不存在";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue