Commit 61fa0744 by 崔彦峰

refactor(goods): 调整商品套餐销售占比校验逻辑

- 移除销售占比总和必须为100%的强制校验
- 添加注释说明销售占比强校验已放宽
- 确认业务链路不再要求总和必须为100%
1 parent 43cb7208
......@@ -166,15 +166,7 @@ public class GoodsListingProductBaseService {
if(CollectionUtils.isEmpty(productBaseList)) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "上架商品未配置");
}
// 校验商品套餐的销售占比和必须是100
BigDecimal sum = productBaseList.stream().filter(o->{
RpcAssert.assertIsTrue(Objects.equals(o.getIntegrity(),StatusEnum.YES.getValue()),DefaultErrorEnum.SERVER_ERROR, "上架商品/套餐信息未填写完整");
return o.getSalesProportionPercent() !=null;
}).map(GoodsListingProductBase::getSalesProportionPercent)
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (CommonConstants.ONEHUNDRED_BIGDECIMAL.compareTo(sum) != 0) {
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "销售占比有误,请确认后重新提交");
}
// 销售占比强校验先放宽,确认链路不再要求总和必须为100%。
List<GoodsListingProductDetailDTO> detailList = goodsListingProductDetailService.listByBusinessCode(goodsListingApproval.getBusinessCode());
Map<Integer,List<GoodsListingProductDetailDTO>> detailMap = detailList.stream()
.collect(Collectors.groupingBy(GoodsListingProductDetailDTO::getProductBaseId));
......@@ -507,4 +499,4 @@ public class GoodsListingProductBaseService {
public String createPackageCode(){
return "MPG" + DateUtils.formatDate(new Date(), "yyyyMMddHHmmss") + RandomUtils.nextInt(10000, 100000);
}
}
\ No newline at end of file
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!