Commit 60680a34 by 崔彦峰

feat(goods): 添加商品上架模型判断逻辑

- 在商品上架审批服务中增加特殊货架和普通货架单店类型的条件判断
- 仅在特殊货架或普通货架单店模式下执行利润率计算完成校验
- 保留原有的利润率缺失检查和异常抛出机制
- 确保不同货架模式下的业务逻辑正确执行
1 parent 3412b478
...@@ -385,6 +385,8 @@ public class GoodsListingApprovalService { ...@@ -385,6 +385,8 @@ public class GoodsListingApprovalService {
if (CollectionUtils.isEmpty(products)) { if (CollectionUtils.isEmpty(products)) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "产品信息为空,businessCode:" + record.getBusinessCode()); throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "产品信息为空,businessCode:" + record.getBusinessCode());
} }
if (Objects.equals(record.getShelfModel(), ShelfModelEnum.SPECIAL_SHELF.getValue())
|| (Objects.equals(record.getShelfModel(), ShelfModelEnum.ORDINARY_SHELF.getValue()) && Objects.equals(record.getShelfType(), ShelfTypeEnum.SINGLE_STORE.getValue()))) {
boolean hasNotFinish = products.stream().anyMatch(o -> !Objects.equals(o.getProfitRateCalFinish() ,StatusEnum.YES.getValue())); boolean hasNotFinish = products.stream().anyMatch(o -> !Objects.equals(o.getProfitRateCalFinish() ,StatusEnum.YES.getValue()));
if (hasNotFinish) { if (hasNotFinish) {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "利润率未计算完成"); throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR, "利润率未计算完成");
...@@ -402,6 +404,8 @@ public class GoodsListingApprovalService { ...@@ -402,6 +404,8 @@ public class GoodsListingApprovalService {
log.warn("存在产品缺少利润率:{}",String.join(",",nonProfitProducts)); log.warn("存在产品缺少利润率:{}",String.join(",",nonProfitProducts));
throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "利润率缺失,请检查后重新操作"); throw new RpcServiceException(RpcErrorEnum.DATA_INVALID_WITH_SPECIFIC_MSG, "利润率缺失,请检查后重新操作");
} }
}
final Date now = new Date(); final Date now = new Date();
if (Objects.equals(record.getShelfModel(), ShelfModelEnum.SPECIAL_SHELF.getValue())) { if (Objects.equals(record.getShelfModel(), ShelfModelEnum.SPECIAL_SHELF.getValue())) {
goodsListingApprovalMapper.updateByPrimaryKeySelective(GoodsListingApproval.builder() goodsListingApprovalMapper.updateByPrimaryKeySelective(GoodsListingApproval.builder()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!