Commit e410ef60 by 崔彦峰

refactor(goods): 重构商品上架基础服务中的条件判断逻辑

- 将旧商户商品代码为空的校验逻辑独立为单独的if条件
- 调整商品和套餐上架ID校验逻辑的嵌套结构,提高代码可读性
- 保持原有的业务校验逻辑不变,仅优化代码结构
1 parent 1ee2d8d9
...@@ -367,7 +367,8 @@ public class GoodsListingProductBaseService { ...@@ -367,7 +367,8 @@ public class GoodsListingProductBaseService {
if (Objects.equals(approval.getShelfType(), ShelfTypeEnum.SINGLE_STORE.getValue())) { if (Objects.equals(approval.getShelfType(), ShelfTypeEnum.SINGLE_STORE.getValue())) {
RpcAssert.assertNotNull(record.getShelfStyle(), DefaultErrorEnum.DATA_NULL, "record.shelfStyle is null"); RpcAssert.assertNotNull(record.getShelfStyle(), DefaultErrorEnum.DATA_NULL, "record.shelfStyle is null");
//校验上架id //校验上架id
if (Objects.equals(record.getShelfStyle(), ShelfStyleEnum.UPDATE.getValue()) && StringUtils.isBlank(record.getOldMerchantGoodsCode())) { if (Objects.equals(record.getShelfStyle(), ShelfStyleEnum.UPDATE.getValue())) {
if (StringUtils.isBlank(record.getOldMerchantGoodsCode())) {
RpcAssert.assertNotEmpty(record.getOldMerchantGoodsCode(), DefaultErrorEnum.DATA_NULL, "record.oldMerchantGoodsCode is null"); RpcAssert.assertNotEmpty(record.getOldMerchantGoodsCode(), DefaultErrorEnum.DATA_NULL, "record.oldMerchantGoodsCode is null");
} }
GoodsListingMerchantRef merchantRef = goodsListingMerchantRefService.getFirstOne(record.getBusinessCode()); GoodsListingMerchantRef merchantRef = goodsListingMerchantRefService.getFirstOne(record.getBusinessCode());
...@@ -408,6 +409,7 @@ public class GoodsListingProductBaseService { ...@@ -408,6 +409,7 @@ public class GoodsListingProductBaseService {
RpcAssert.assertIsTrue(packageCodes.contains(record.getOldMerchantGoodsCode()), DefaultErrorEnum.SERVICE_ERROR, "套餐上架id不匹配"); RpcAssert.assertIsTrue(packageCodes.contains(record.getOldMerchantGoodsCode()), DefaultErrorEnum.SERVICE_ERROR, "套餐上架id不匹配");
} }
} }
}
try{ try{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!