|
|
@@ -1,6 +1,7 @@
|
|
|
package com.sqx.scheduler.order;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
@@ -14,6 +15,9 @@ import com.sqx.modules.order.entity.TbOrder;
|
|
|
import com.sqx.modules.order.service.AppOrderService;
|
|
|
import com.sqx.modules.pay.config.WXConfig;
|
|
|
import com.sqx.modules.pay.config.WechatPayConfig;
|
|
|
+import com.sqx.modules.pay.entity.PayDetails;
|
|
|
+import com.sqx.modules.pay.enums.PayStateEnums;
|
|
|
+import com.sqx.modules.pay.service.PayDetailsService;
|
|
|
import com.sqx.scheduler.config.SchedulerLock;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -42,6 +46,7 @@ public class OrderScheduler {
|
|
|
private final RedissonClient redissonClient;
|
|
|
private final AppOrderService orderService;
|
|
|
private final CommonInfoService commonInfoService;
|
|
|
+ private final PayDetailsService payDetailsService;
|
|
|
|
|
|
private final static String RHT_PAY_BASE_URL = "https://api.ekbuyclub.com";
|
|
|
|
|
|
@@ -188,7 +193,6 @@ public class OrderScheduler {
|
|
|
log.info("没有符合条件的超时订单,超时订单自动取消任务运行....");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
WXConfig config = new WXConfig();
|
|
|
// 当前都是小程序支付
|
|
|
config.setAppId(commonInfoService.findOne(74).getValue());
|
|
|
@@ -225,6 +229,7 @@ public class OrderScheduler {
|
|
|
tbOrder.setStatus(5);
|
|
|
orders.add(tbOrder);
|
|
|
}else if ("SUCCESS".equals(trade_state)){
|
|
|
+ tbOrder.setPayType(1);
|
|
|
orderService.updateOrderAfterPaySuccess(tbOrder);
|
|
|
}
|
|
|
}else {
|
|
|
@@ -232,16 +237,27 @@ public class OrderScheduler {
|
|
|
qqrb.setTraceno(orderNumber);// 商户流水号
|
|
|
QrcodeQueryResponseBean response2 = qrcodePay.query(qqrb);
|
|
|
String respCode = response2.getRespCode();
|
|
|
+
|
|
|
// 0未支付,1支付成功,2支付失败,4退款中,5退款成功,6退款失败
|
|
|
if ("0".equals(respCode)) {
|
|
|
tbOrder.setStatus(5);
|
|
|
orders.add(tbOrder);
|
|
|
}else if ("1".equals(respCode)){
|
|
|
+ PayDetails payDetails = payDetailsService.getByOrderNo(orderNumber);
|
|
|
+ if (!ObjectUtil.isNull(payDetails)) {
|
|
|
+ payDetails.setState(PayStateEnums.PAY_SUCCESS.getStateCode());
|
|
|
+ payDetails.setPayTime(response2.getTransDate()+ " " + response2.getTransTime());
|
|
|
+ payDetails.setTradeNo(response2.getChannelOrderno());
|
|
|
+ payDetails.setRemark("RHT PAY SUCCESS");
|
|
|
+ payDetailsService.updateDetail(payDetails);
|
|
|
+ }else {
|
|
|
+ log.error("超时任务处理订单【{}】支付成功,但未获取到支付订单!支付通知信息:{}", orderNumber, response2);
|
|
|
+ }
|
|
|
+ tbOrder.setPayType(1);
|
|
|
orderService.updateOrderAfterPaySuccess(tbOrder);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
tbOrder.setStatus(5);
|
|
|
orders.add(tbOrder);
|