diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java index bc146dffc..16ddb7a5b 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java @@ -96,13 +96,13 @@ public class AppCouponTemplateController { */ private Long getProductScopeValue(Integer productScope, Long spuId) { // 通用券:没有商品范围 - if (productScope == null || ObjectUtils.equalsAny(productScope, PromotionProductScopeEnum.ALL.getScope(), null)) { + if (ObjectUtils.equalsAny(productScope, PromotionProductScopeEnum.ALL.getScope(), null)) { return null; } // 品类券:查询商品的品类编号 if (Objects.equals(productScope, PromotionProductScopeEnum.CATEGORY.getScope()) && spuId != null) { - return Optional.ofNullable(productSpuApi.getSpu(spuId)) - .map(ProductSpuRespDTO::getCategoryId).orElse(null); + ProductSpuRespDTO spu = productSpuApi.getSpu(spuId); + return spu != null ? spu.getCategoryId() : null; } // 商品卷:直接返回 return spuId; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java index 5216ea3c3..29dbb5c43 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java @@ -108,8 +108,8 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic } // 2. 校验商品 sku 都存在 - Map skuMap = convertMap(productSkuApi.getSkuListBySpuId(singletonList(spuId)), - ProductSkuRespDTO::getId); + List skus = productSkuApi.getSkuListBySpuId(singletonList(spuId)); + Map skuMap = convertMap(skus, ProductSkuRespDTO::getId); products.forEach(product -> { if (!skuMap.containsKey(product.getSkuId())) { throw exception(SKU_NOT_EXISTS); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java index bed4d25a3..f5baf50cb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java @@ -7,7 +7,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; @@ -80,12 +79,11 @@ public class CouponServiceImpl implements CouponService { public PageResult getCouponPage(CouponPageReqVO pageReqVO) { // 获得用户编号 if (StrUtil.isNotEmpty(pageReqVO.getNickname())) { - Set userIds = CollectionUtils.convertSet(memberUserApi.getUserListByNickname(pageReqVO.getNickname()), - MemberUserRespDTO::getId); - if (CollUtil.isEmpty(userIds)) { + List users = memberUserApi.getUserListByNickname(pageReqVO.getNickname()); + if (CollUtil.isEmpty(users)) { return PageResult.empty(); } - pageReqVO.setUserIds(userIds); + pageReqVO.setUserIds(convertSet(users, MemberUserRespDTO::getId)); } // 分页查询 return couponMapper.selectPage(pageReqVO); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java index 841118a6c..002420c66 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java @@ -123,8 +123,8 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { } // 2. 校验商品 sku 都存在 - Map skuMap = convertMap(productSkuApi.getSkuListBySpuId(singletonList(spuId)), - ProductSkuRespDTO::getId); + List skus = productSkuApi.getSkuListBySpuId(singletonList(spuId)); + Map skuMap = convertMap(skus, ProductSkuRespDTO::getId); products.forEach(product -> { if (!skuMap.containsKey(product.getSkuId())) { throw exception(SKU_NOT_EXISTS); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java index 7ec3d8f0f..622ff87ea 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/brokerage/BrokerageUserController.java @@ -77,6 +77,7 @@ public class BrokerageUserController { @PreAuthorize("@ss.hasPermission('trade:brokerage-user:query')") public CommonResult getBrokerageUser(@RequestParam("id") Long id) { BrokerageUserDO brokerageUser = brokerageUserService.getBrokerageUser(id); + // TODO @疯狂:是不是搞成一个统一的 convert? BrokerageUserRespVO respVO = BrokerageUserConvert.INSTANCE.convert(brokerageUser); return success(BrokerageUserConvert.INSTANCE.copyTo(memberUserApi.getUser(id), respVO)); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java index ac27808cf..19c7d409f 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java @@ -232,7 +232,8 @@ public class BrokerageUserServiceImpl implements BrokerageUserService { return PageResult.empty(); } // 1.2 根据昵称过滤下级用户 - Map userMap = convertMapByFilter(memberUserApi.getUserList(childIds), + List users = memberUserApi.getUserList(childIds); + Map userMap = convertMapByFilter(users, user -> StrUtil.contains(user.getNickname(), pageReqVO.getNickname()), MemberUserRespDTO::getId); if (CollUtil.isEmpty(userMap)) { diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/MemberUserApi.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/MemberUserApi.java index 3d2130e18..c9fb80100 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/MemberUserApi.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/MemberUserApi.java @@ -38,7 +38,8 @@ public interface MemberUserApi { * @return 会员用户 Map */ default Map getUserMap(Collection ids) { - return convertMap(getUserList(ids), MemberUserRespDTO::getId); + List list = getUserList(ids); + return convertMap(list, MemberUserRespDTO::getId); } /**