From c82b495ca5b31b023e33cb0027593f27de963869 Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 24 May 2023 14:12:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=98=AF=E5=90=A6=E8=A2=AB=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/infra/api/config/ApiConfigApi.java | 1 + .../yudao/module/infra/api/config/ApiConfigImpl.java | 12 ++++++++++++ .../shop/request/order/CreateOrderRequest.java | 4 ++-- .../request/order/OrderComputedPriceRequest.java | 4 ++-- .../module/shop/dal/dataobject/order/StoreOrder.java | 2 +- .../shop/service/order/impl/OrderServiceImpl.java | 2 +- .../iocoder/yudao/module/shop/utils/OrderUtil.java | 6 +++--- .../yudao/module/member/api/address/AddressApi.java | 2 +- .../module/member/api/address/AddressApiImpl.java | 2 +- 9 files changed, 24 insertions(+), 11 deletions(-) diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigApi.java index b72cfea4b..79492e80c 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigApi.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigApi.java @@ -24,4 +24,5 @@ public interface ApiConfigApi { * */ CommonResult getConfigKey( String key); + String getConfigKeyValue( String key); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigImpl.java index 58e2186ad..31595375f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/api/config/ApiConfigImpl.java @@ -50,4 +50,16 @@ public class ApiConfigImpl implements ApiConfigApi{ } return success(config.getValue()); } + + @Override + public String getConfigKeyValue(String key) { + ConfigDO config = configService.getConfigByKey(key); + if (config == null) { + return null; + } + if (!config.getVisible()) { + throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); + } + return config.getValue(); + } } diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/CreateOrderRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/CreateOrderRequest.java index 42636003e..9e9b5b330 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/CreateOrderRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/CreateOrderRequest.java @@ -40,10 +40,10 @@ public class CreateOrderRequest implements Serializable { private Integer shippingType; @Schema(description = "收货地址id") - private Integer addressId; + private Long addressId; @Schema(description = "优惠券编号") - private Integer couponId; + private Long couponId; @Schema(description = "支付类型:weixin-微信支付,yue-余额支付,alipay-支付宝支付") @NotBlank(message = "支付类型不能为空") diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderComputedPriceRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderComputedPriceRequest.java index 92650b4db..83590a4d6 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderComputedPriceRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderComputedPriceRequest.java @@ -32,10 +32,10 @@ public class OrderComputedPriceRequest { private String preOrderNo; @Schema(description = "地址id") - private Integer addressId; + private Long addressId; @Schema(description = "优惠券id") - private Integer couponId; + private Long couponId; @Schema(description = "快递类型: 1-快递配送,2-到店自提") @NotNull(message = "快递类型不能为空") diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java index 5b95330b7..d9bbd7e5e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/order/StoreOrder.java @@ -74,7 +74,7 @@ public class StoreOrder implements Serializable { private BigDecimal deductionPrice; @Schema(description = "优惠券id") - private Integer couponId; + private Long couponId; @Schema(description = "优惠券金额") private BigDecimal couponPrice; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java index 536346d02..cc0f5dcae 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderServiceImpl.java @@ -1249,7 +1249,7 @@ public class OrderServiceImpl implements OrderService { storeOrder.setStoreId(orderRequest.getStoreId()); } storeOrder.setTotalNum(orderInfoVo.getOrderProNum()); - storeOrder.setCouponId(Optional.ofNullable(orderRequest.getCouponId()).orElse(0)); + storeOrder.setCouponId(Optional.ofNullable(orderRequest.getCouponId()).orElse(0L)); // 订单总价 BigDecimal totalPrice = computedOrderPriceResponse.getProTotalFee().add(computedOrderPriceResponse.getFreightFee()); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/utils/OrderUtil.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/utils/OrderUtil.java index 051b9d4d7..6918fa04c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/utils/OrderUtil.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/utils/OrderUtil.java @@ -106,13 +106,13 @@ public class OrderUtil { payType = payType.toLowerCase(); switch (payType){ case PayConstants.PAY_TYPE_WE_CHAT: - result = apiConfigApi.getConfigKey(SysConfigConstants.CONFIG_PAY_WEIXIN_OPEN).equals("1"); + result = apiConfigApi.getConfigKeyValue(SysConfigConstants.CONFIG_PAY_WEIXIN_OPEN).equals("1"); break; case PayConstants.PAY_TYPE_YUE: - result = (apiConfigApi.getConfigKey(SysConfigConstants.CONFIG_YUE_PAY_STATUS).equals("1")); + result = (apiConfigApi.getConfigKeyValue(SysConfigConstants.CONFIG_YUE_PAY_STATUS).equals("1")); break; case PayConstants.PAY_TYPE_ALI_PAY: - result = (apiConfigApi.getConfigKey(SysConfigConstants.CONFIG_ALI_PAY_STATUS).equals("1")); + result = (apiConfigApi.getConfigKeyValue(SysConfigConstants.CONFIG_ALI_PAY_STATUS).equals("1")); break; } return result; diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApi.java index 93597ec02..299335702 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApi.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApi.java @@ -19,7 +19,7 @@ public interface AddressApi { AddressRespDTO getAddress(Long id, Long userId); - AddressRespDTO getById(Integer addressId); + AddressRespDTO getById(Long addressId); /** * 获取默认地址 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApiImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApiImpl.java index e0d9ce97a..06f679c26 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApiImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/api/address/AddressApiImpl.java @@ -36,7 +36,7 @@ public class AddressApiImpl implements AddressApi { } @Override - public AddressRespDTO getById(Integer addressId) { + public AddressRespDTO getById(Long addressId) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(AddressDO::getId, addressId); return AddressConvert.INSTANCE.convert02(addressMapper.selectOne(lambdaQueryWrapper));