From 760dc505cca74da37abb9b31549ea515a5db36e6 Mon Sep 17 00:00:00 2001 From: jieyuu <645634619@qq.com> Date: Sat, 9 Nov 2024 16:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E6=94=AF=E4=BB=98=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91=EF=BC=8Cbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/jieyuu/constant/TimeConstant.java | 2 +- .../controller/ProductOrderController.java | 3 +++ .../service/impl/ProductOrderServiceImpl.java | 17 +++++++++-------- .../src/main/resources/application.yml | 2 +- .../jieyuu/service/impl/ProductServiceImpl.java | 11 ++++++++--- .../src/main/resources/application.yml | 4 ++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/xdclass-common/src/main/java/net/jieyuu/constant/TimeConstant.java b/xdclass-common/src/main/java/net/jieyuu/constant/TimeConstant.java index 6596d7f..3600c5d 100644 --- a/xdclass-common/src/main/java/net/jieyuu/constant/TimeConstant.java +++ b/xdclass-common/src/main/java/net/jieyuu/constant/TimeConstant.java @@ -7,5 +7,5 @@ public class TimeConstant { * 订单超时 毫秒 默认30分钟 */ // todo 测试时将时间改为了5分钟 ,记得改回30分钟 - public static final long ORDER_PAY_TIMEOUT_MILLS = 1000 * 60 * 30; + public static final long ORDER_PAY_TIMEOUT_MILLS = 1000 * 60 * 5; } diff --git a/xdclass-order-service/src/main/java/net/jieyuu/controller/ProductOrderController.java b/xdclass-order-service/src/main/java/net/jieyuu/controller/ProductOrderController.java index 2567719..1f48347 100644 --- a/xdclass-order-service/src/main/java/net/jieyuu/controller/ProductOrderController.java +++ b/xdclass-order-service/src/main/java/net/jieyuu/controller/ProductOrderController.java @@ -16,6 +16,7 @@ import net.jieyuu.enums.ProductOrderPayTypeEnum; import net.jieyuu.request.ConfirmOrderRequest; import net.jieyuu.request.RepayOrderRequest; import net.jieyuu.service.ProductOrderService; +import net.jieyuu.utils.CommonUtil; import net.jieyuu.utils.JsonData; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -90,6 +91,7 @@ public class ProductOrderController { } else { log.error("创建订单失败{}:", jsonData.toString()); + CommonUtil.sendJsonMessage(response, jsonData); } } @@ -117,6 +119,7 @@ public class ProductOrderController { } else { log.error("重复支付订单失败{}:", jsonData.toString()); + CommonUtil.sendJsonMessage(response, jsonData); } } diff --git a/xdclass-order-service/src/main/java/net/jieyuu/service/impl/ProductOrderServiceImpl.java b/xdclass-order-service/src/main/java/net/jieyuu/service/impl/ProductOrderServiceImpl.java index 1b4694e..c844a4c 100644 --- a/xdclass-order-service/src/main/java/net/jieyuu/service/impl/ProductOrderServiceImpl.java +++ b/xdclass-order-service/src/main/java/net/jieyuu/service/impl/ProductOrderServiceImpl.java @@ -193,7 +193,6 @@ public class ProductOrderServiceImpl extends ServiceImpl().eq("out_trade_no", orderMessage.getOutTradeNo())); + ProductOrderDO productOrderDO = productOrderMapper.selectOne(new QueryWrapper() + .eq("out_trade_no", orderMessage.getOutTradeNo())); if (productOrderDO == null) { log.warn("直接确认消息,订单不存在:{}", orderMessage); @@ -507,6 +511,8 @@ public class ProductOrderServiceImpl extends ServiceImpl() .eq("out_trade_no", repayOrderRequest.getOutTradeNo()) .eq("user_id", loginUser.getId())); @@ -531,8 +537,7 @@ public class ProductOrderServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper() @@ -541,7 +546,6 @@ public class ProductOrderServiceImpl extends ServiceImpl im */ @Override public List findProductByIdBatch(List productIdList) { - List productDOList = productMapper.selectList(new QueryWrapper().in("id", productIdList)); - List productVOList = productDOList.stream().map(obj -> beanProcess(obj)).collect(Collectors.toList()); - return productVOList; + + if(!productIdList.isEmpty()){ + List productDOList = productMapper.selectList(new QueryWrapper().in("id", productIdList)); + List productVOList = productDOList.stream().map(obj -> beanProcess(obj)).collect(Collectors.toList()); + return productVOList; + } + return null; + } /** diff --git a/xdclass-product-service/src/main/resources/application.yml b/xdclass-product-service/src/main/resources/application.yml index 3986376..344e349 100644 --- a/xdclass-product-service/src/main/resources/application.yml +++ b/xdclass-product-service/src/main/resources/application.yml @@ -61,5 +61,5 @@ mqconfig: #消息过期,进入释放队列的key stock_release_routing_key: stock.release.routing.key - #消息过期时间,毫秒,测试改为15秒 - ttl: 15000 + #消息过期时间,毫秒,测试改为15分钟 + ttl: 300000