mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-25 08:41:52 +08:00
【代码评审】商城:积分商城的 review
This commit is contained in:
parent
b849194d82
commit
f6a6a1ff88
@ -290,7 +290,7 @@ public class CollectionUtils {
|
||||
return valueFunc.apply(t);
|
||||
}
|
||||
|
||||
public static <T, V extends Comparable<? super V>> T getMinPropertyObj(List<T> from, Function<T, V> valueFunc) {
|
||||
public static <T, V extends Comparable<? super V>> T getMinObject(List<T> from, Function<T, V> valueFunc) {
|
||||
if (CollUtil.isEmpty(from)) {
|
||||
return null;
|
||||
}
|
||||
@ -298,7 +298,6 @@ public class CollectionUtils {
|
||||
return from.stream().min(Comparator.comparing(valueFunc)).get();
|
||||
}
|
||||
|
||||
|
||||
public static <T, V extends Comparable<? super V>> V getSumValue(Collection<T> from, Function<T, V> valueFunc,
|
||||
BinaryOperator<V> accumulator) {
|
||||
return getSumValue(from, valueFunc, accumulator, null);
|
||||
|
@ -129,7 +129,7 @@ public class PointActivityController {
|
||||
List<PointActivityRespVO> result = BeanUtils.toBean(activityList, PointActivityRespVO.class);
|
||||
result.forEach(activity -> {
|
||||
// 设置 product 信息
|
||||
PointProductDO minProduct = getMinPropertyObj(productsMap.get(activity.getId()), PointProductDO::getPoint);
|
||||
PointProductDO minProduct = getMinObject(productsMap.get(activity.getId()), PointProductDO::getPoint);
|
||||
assert minProduct != null;
|
||||
activity.setPoint(minProduct.getPoint()).setPrice(minProduct.getPrice());
|
||||
findAndThen(spuMap, activity.getSpuId(),
|
||||
|
@ -26,9 +26,9 @@ public class PointActivityRespVO {
|
||||
@ExcelProperty("活动状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动库存(剩余库存积分兑换时扣减)")
|
||||
private Integer stock;
|
||||
@Schema(description = "积分商城活动库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动库存")
|
||||
private Integer stock; // 剩余库存积分兑换时扣减
|
||||
|
||||
@Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动总库存")
|
||||
|
@ -102,7 +102,7 @@ public class AppPointActivityController {
|
||||
List<AppPointActivityRespVO> result = BeanUtils.toBean(activityList, AppPointActivityRespVO.class);
|
||||
result.forEach(activity -> {
|
||||
// 设置 product 信息
|
||||
PointProductDO minProduct = getMinPropertyObj(productsMap.get(activity.getId()), PointProductDO::getPoint);
|
||||
PointProductDO minProduct = getMinObject(productsMap.get(activity.getId()), PointProductDO::getPoint);
|
||||
assert minProduct != null;
|
||||
activity.setPoint(minProduct.getPoint()).setPrice(minProduct.getPrice());
|
||||
findAndThen(spuMap, activity.getSpuId(),
|
||||
|
@ -12,5 +12,4 @@ import lombok.ToString;
|
||||
@ToString(callSuper = true)
|
||||
public class AppPointActivityPageReqVO extends PageParam {
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,14 +22,16 @@ public class AppPointActivityRespVO {
|
||||
@ExcelProperty("活动状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动库存(剩余库存积分兑换时扣减)")
|
||||
private Integer stock;
|
||||
@Schema(description = "积分商城活动库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动库存")
|
||||
private Integer stock; // 剩余库存积分兑换时扣减
|
||||
|
||||
@Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("积分商城活动总库存")
|
||||
private Integer totalStock;
|
||||
|
||||
// TODO @puhui999:只返回必要的字段,例如说 remark、sort、createTime 应该是不需要的呢。也可以看看别的也不需要哈。
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
Loading…
Reference in New Issue
Block a user