|
@@ -40,7 +40,7 @@ public class OrderExpireDelayedMessageListener {
|
|
|
public void handleMessage(Message message, Channel channel) throws IOException {
|
|
|
try {
|
|
|
String msg = new String(message.getBody());
|
|
|
- log.info("收到延迟消息,订单ID,{}:", msg);
|
|
|
+ log.info("收到延迟消息,子订单ID{}:", msg);
|
|
|
|
|
|
// 业务逻辑处理
|
|
|
orderExpireMessage(msg);
|
|
@@ -60,21 +60,29 @@ public class OrderExpireDelayedMessageListener {
|
|
|
|
|
|
AppOrderProInfo appOrderProInfo = appOrderProInfoService.getById(proOrderInfoId);
|
|
|
|
|
|
- if (Objects.equals(appOrderProInfo.getOrderStatus(), CommonConstant.ORDER_STATUS_1)) {
|
|
|
- log.info("修改子订单:{},支付状态为已过期", appOrderProInfo.getId());
|
|
|
- appOrderProInfo.setOrderStatus(CommonConstant.ORDER_STATUS_3);
|
|
|
- appOrderProInfoService.updateById(appOrderProInfo);
|
|
|
+ if (appOrderProInfo == null) {
|
|
|
+ log.info("子订单不存在:{}", proOrderInfoId);
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- //执行业务代码
|
|
|
- AppOrder appOrder = appOrderService.getById(appOrderProInfo.getOrderId());
|
|
|
- List<AppOrderProInfo> appOrderProInfoList = appOrderProInfoService.list(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, appOrderProInfo.getOrderId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(appOrderProInfo)){
|
|
|
+ if (Objects.equals(appOrderProInfo.getOrderStatus(), CommonConstant.ORDER_STATUS_1)) {
|
|
|
+ log.info("修改子订单:{},支付状态为已过期", appOrderProInfo.getId());
|
|
|
+ appOrderProInfo.setOrderStatus(CommonConstant.ORDER_STATUS_3);
|
|
|
+ appOrderProInfoService.updateById(appOrderProInfo);
|
|
|
+ }
|
|
|
|
|
|
- if (appOrderProInfoList.stream().filter(orderProInfo -> Objects.equals(orderProInfo.getOrderStatus(),
|
|
|
- CommonConstant.ORDER_STATUS_3)).count() == appOrderProInfoList.size()) {
|
|
|
- log.info("修改订单:{},支付状态为已过期", appOrder.getOrderCode());
|
|
|
- appOrder.setOrderStatus(CommonConstant.ORDER_STATUS_3);
|
|
|
- appOrderService.updateById(appOrder);
|
|
|
+ //执行业务代码
|
|
|
+ AppOrder appOrder = appOrderService.getById(appOrderProInfo.getOrderId());
|
|
|
+ List<AppOrderProInfo> appOrderProInfoList = appOrderProInfoService.list(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, appOrderProInfo.getOrderId()));
|
|
|
+
|
|
|
+ if (appOrderProInfoList.stream().filter(orderProInfo -> Objects.equals(orderProInfo.getOrderStatus(),
|
|
|
+ CommonConstant.ORDER_STATUS_3)).count() == appOrderProInfoList.size()) {
|
|
|
+ log.info("修改订单:{},支付状态为已过期", appOrder.getOrderCode());
|
|
|
+ appOrder.setOrderStatus(CommonConstant.ORDER_STATUS_3);
|
|
|
+ appOrderService.updateById(appOrder);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|