From 9f9cb30b03044c5e687f3adba4621056acc8a232 Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 31 May 2023 17:29:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/infra/api/config/ApiConfigApi.java | 43 ++++++++++--------- .../infra/api/config/ApiConfigImpl.java | 12 ++++++ .../admin/config/ConfigController.java | 1 + .../yudao-module-shop-biz/pom.xml | 5 +++ .../app/member/MemberController.java | 16 +++++++ .../service/order/impl/OrderServiceImpl.java | 4 +- .../service/user/MemberUserServiceImpl.java | 2 +- 7 files changed, 60 insertions(+), 23 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 79492e80c..7335eb0bd 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 @@ -4,25 +4,28 @@ package cn.iocoder.yudao.module.infra.api.config; import cn.iocoder.yudao.framework.common.pojo.CommonResult; /** -*
-* ApiConfigApi
-* Description:
-* @author: zenghuapei
-* Date: 2023/4/3 10:19
-* ----------------------------------------------------------------------
-* 
-**/ + *
+ * ApiConfigApi
+ * Description:
+ * @author: zenghuapei
+ * Date: 2023/4/3 10:19
+ * ----------------------------------------------------------------------
+ * 
+ **/ public interface ApiConfigApi { - /** - *
-  * getConfigKey
-  * Description:获取参数key
-  * @author: zenghuapei
-  * @date: 2023/4/3 10:21
-  * @param key:
-  * @return
-  * 
- */ - CommonResult getConfigKey( String key); - String getConfigKeyValue( String key); + /** + *
+     * getConfigKey
+     * Description:获取参数key
+     * @author: zenghuapei
+     * @date: 2023/4/3 10:21
+     * @param key:
+     * @return
+     * 
+ */ + CommonResult getConfigKey(String key); + + String getConfigKeyValue(String key); + + String getConfigRemark(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 31595375f..9a957b8f6 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 @@ -62,4 +62,16 @@ public class ApiConfigImpl implements ApiConfigApi{ } return config.getValue(); } + + @Override + public String getConfigRemark(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.getRemark(); + } } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java index f9a6a8e9e..195152d57 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java @@ -102,4 +102,5 @@ public class ConfigController { ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas); } + } diff --git a/yudao-module-mall/yudao-module-shop-biz/pom.xml b/yudao-module-mall/yudao-module-shop-biz/pom.xml index 1d093c2f7..79d49ce36 100644 --- a/yudao-module-mall/yudao-module-shop-biz/pom.xml +++ b/yudao-module-mall/yudao-module-shop-biz/pom.xml @@ -23,6 +23,11 @@ yudao-module-member-api ${revision} + + cn.iocoder.boot + yudao-module-infra-api + ${revision} + cn.iocoder.boot yudao-module-shop-api diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java index dd8815b22..9e20dae01 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/member/MemberController.java @@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; +import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearRespVO; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderPageReqVO; import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO; @@ -27,8 +29,12 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*; +import javax.annotation.security.PermitAll; import java.util.List; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + /** * @Title:MemberController * @Description: 会员相关信息 @@ -46,6 +52,8 @@ public class MemberController { private RechargeGearService rechargeGearService; @Autowired private RechargeOrderService rechargeOrderService; + @Autowired + private ApiConfigApi apiConfigApi; // 会员档次信息列表 @@ -123,4 +131,12 @@ public class MemberController { return CommonResult.success(rechargeOrderService.memberChangeTie(changeTieRequest)); } + + @GetMapping(value = "/get-app_value-by-key") + @Operation(summary = "根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端") + @PermitAll + @TenantIgnore + public CommonResult getAppConfigKey(@RequestParam("key") String key) { + return success(apiConfigApi.getConfigRemark(key)); + } } 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 62bb5afe1..e35550ebc 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 @@ -806,7 +806,7 @@ public class OrderServiceImpl implements OrderService { orderInfoVo.setOrderProNum(orderProNum); // 获取默认地址 UserAddressRespDTO userAddress = userAddressApi.getDefaultByUid(user.getId()); - if (ObjectUtil.isNotNull(userAddress)) { + if (ObjectUtil.isNotNull(userAddress.getId())) { // 计算运费 getFreightFee(orderInfoVo, userAddress); orderInfoVo.setAddressId(userAddress.getId()); @@ -820,7 +820,7 @@ public class OrderServiceImpl implements OrderService { orderInfoVo.setFreightFee(BigDecimal.ZERO); } // 实际支付金额 - orderInfoVo.setPayFee(orderInfoVo.getProTotalFee().add(BigDecimal.ZERO)); + orderInfoVo.setPayFee(orderInfoVo.getProTotalFee().add(orderInfoVo.getProTotalFee())); //用户剩余积分 //用户剩余经验 // 缓存订单 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index 966f7dbd2..ff4bdb1bd 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -103,7 +103,7 @@ public class MemberUserServiceImpl implements MemberUserService { user.setMobile(mobile); user.setNickname(realName); user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启 - user.setPassword(encodePassword("123456")); // 加密密码 + user.setPassword(encodePassword(mobile.substring(5,11))); // 加密密码 user.setRegisterIp(registerIp); user.setPromoterId(promoterId); user.setTenantId(TenantContextHolder.getRequiredTenantId());