From ca80bf71ed0f991f880f1d9a88694faa6317a4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com> Date: Tue, 17 Aug 2021 00:47:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor(OrderServiceImpl.java):=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E9=94=81=E5=BA=93=E5=AD=98=E5=93=8D=E5=BA=94=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/youlai/mall/oms/service/impl/OrderServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java index f9d7489bb..99ccc6136 100644 --- a/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java +++ b/mall-oms/oms-boot/src/main/java/com/youlai/mall/oms/service/impl/OrderServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -21,6 +22,7 @@ import com.github.binarywang.wxpay.service.WxPayService; import com.youlai.common.enums.BusinessTypeEnum; import com.youlai.common.redis.component.BusinessNoGenerator; import com.youlai.common.result.Result; +import com.youlai.common.result.ResultCode; import com.youlai.common.web.exception.BizException; import com.youlai.common.web.util.JwtUtils; import com.youlai.mall.oms.config.WxPayProperties; @@ -188,8 +190,9 @@ public class OrderServiceImpl extends ServiceImpl impleme Result goodsResult = goodsFeignClient.getSkuById(1l); System.out.println(goodsResult); + // 锁定库存 Result lockResult = stockFeignClient.lockStock(skuLockList); - Assert.isTrue(Result.success().getCode().equals(lockResult.getCode()), "锁定商品库存失败:{}", lockResult.getMsg()); + Assert.isTrue(Result.isSuccess(lockResult), "锁定商品库存失败:{}", lockResult.getMsg()); // 创建订单(状态:待支付) OmsOrder order = new OmsOrder();