统一 boot 和 cloud 代码
This commit is contained in:
parent
633a4c5687
commit
7bff98b658
@ -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;
|
||||
|
@ -108,8 +108,8 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic
|
||||
}
|
||||
|
||||
// 2. 校验商品 sku 都存在
|
||||
Map<Long, ProductSkuRespDTO> skuMap = convertMap(productSkuApi.getSkuListBySpuId(singletonList(spuId)),
|
||||
ProductSkuRespDTO::getId);
|
||||
List<ProductSkuRespDTO> skus = productSkuApi.getSkuListBySpuId(singletonList(spuId));
|
||||
Map<Long, ProductSkuRespDTO> skuMap = convertMap(skus, ProductSkuRespDTO::getId);
|
||||
products.forEach(product -> {
|
||||
if (!skuMap.containsKey(product.getSkuId())) {
|
||||
throw exception(SKU_NOT_EXISTS);
|
||||
|
@ -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<CouponDO> getCouponPage(CouponPageReqVO pageReqVO) {
|
||||
// 获得用户编号
|
||||
if (StrUtil.isNotEmpty(pageReqVO.getNickname())) {
|
||||
Set<Long> userIds = CollectionUtils.convertSet(memberUserApi.getUserListByNickname(pageReqVO.getNickname()),
|
||||
MemberUserRespDTO::getId);
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
List<MemberUserRespDTO> 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);
|
||||
|
@ -123,8 +123,8 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
|
||||
}
|
||||
|
||||
// 2. 校验商品 sku 都存在
|
||||
Map<Long, ProductSkuRespDTO> skuMap = convertMap(productSkuApi.getSkuListBySpuId(singletonList(spuId)),
|
||||
ProductSkuRespDTO::getId);
|
||||
List<ProductSkuRespDTO> skus = productSkuApi.getSkuListBySpuId(singletonList(spuId));
|
||||
Map<Long, ProductSkuRespDTO> skuMap = convertMap(skus, ProductSkuRespDTO::getId);
|
||||
products.forEach(product -> {
|
||||
if (!skuMap.containsKey(product.getSkuId())) {
|
||||
throw exception(SKU_NOT_EXISTS);
|
||||
|
@ -77,6 +77,7 @@ public class BrokerageUserController {
|
||||
@PreAuthorize("@ss.hasPermission('trade:brokerage-user:query')")
|
||||
public CommonResult<BrokerageUserRespVO> 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));
|
||||
}
|
||||
|
@ -232,7 +232,8 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
||||
return PageResult.empty();
|
||||
}
|
||||
// 1.2 根据昵称过滤下级用户
|
||||
Map<Long, MemberUserRespDTO> userMap = convertMapByFilter(memberUserApi.getUserList(childIds),
|
||||
List<MemberUserRespDTO> users = memberUserApi.getUserList(childIds);
|
||||
Map<Long, MemberUserRespDTO> userMap = convertMapByFilter(users,
|
||||
user -> StrUtil.contains(user.getNickname(), pageReqVO.getNickname()),
|
||||
MemberUserRespDTO::getId);
|
||||
if (CollUtil.isEmpty(userMap)) {
|
||||
|
@ -38,7 +38,8 @@ public interface MemberUserApi {
|
||||
* @return 会员用户 Map
|
||||
*/
|
||||
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
|
||||
return convertMap(getUserList(ids), MemberUserRespDTO::getId);
|
||||
List<MemberUserRespDTO> list = getUserList(ids);
|
||||
return convertMap(list, MemberUserRespDTO::getId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user