code review:积分、优惠劵、佣金等逻辑

This commit is contained in:
YunaiV
2023-10-01 23:31:07 +08:00
parent 057952bdeb
commit d4417d2474
27 changed files with 47 additions and 74 deletions

View File

@@ -34,7 +34,7 @@ public class ProductSpuApiImpl implements ProductSpuApi {
}
@Override
public List<ProductSpuRespDTO> getSpuListAndValidate(Collection<Long> ids) {
public List<ProductSpuRespDTO> validateSpuList(Collection<Long> ids) {
return ProductSpuConvert.INSTANCE.convertList2(spuService.validateSpuList(ids));
}
@@ -43,9 +43,4 @@ public class ProductSpuApiImpl implements ProductSpuApi {
return ProductSpuConvert.INSTANCE.convert02(spuService.getSpu(id));
}
@Override
public void validateSpuList(Collection<Long> ids) {
spuService.validateSpuList(ids);
}
}

View File

@@ -109,8 +109,8 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
return;
}
// 获得商品分类信息
List<ProductCategoryDO> categoryList = productCategoryMapper.selectBatchIds(ids);
Map<Long, ProductCategoryDO> categoryMap = CollectionUtils.convertMap(categoryList, ProductCategoryDO::getId);
List<ProductCategoryDO> list = productCategoryMapper.selectBatchIds(ids);
Map<Long, ProductCategoryDO> categoryMap = CollectionUtils.convertMap(list, ProductCategoryDO::getId);
// 校验
ids.forEach(id -> {
ProductCategoryDO category = categoryMap.get(id);

View File

@@ -146,8 +146,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
return Collections.emptyList();
}
// 获得商品信息
List<ProductSpuDO> spuList = productSpuMapper.selectBatchIds(ids);
Map<Long, ProductSpuDO> spuMap = CollectionUtils.convertMap(spuList, ProductSpuDO::getId);
List<ProductSpuDO> list = productSpuMapper.selectBatchIds(ids);
Map<Long, ProductSpuDO> spuMap = CollectionUtils.convertMap(list, ProductSpuDO::getId);
// 校验
ids.forEach(id -> {
ProductSpuDO spu = spuMap.get(id);
@@ -158,8 +158,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
throw exception(SPU_NOT_ENABLE, spu.getName());
}
});
return spuList;
return list;
}
@Override