Commit b98c6bc9 by zhoulm

fix: 修正重复数据校验的错误类型为SERVER_ERROR

将重复数据校验的错误类型从PARAMETER_NULL改为SERVER_ERROR,以更准确地反映错误性质
1 parent 0fc3597f
......@@ -196,19 +196,19 @@ public class GoodsListingGoodsTypeGroupRelationService {
if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_TYPE.getValue())) {
RpcAssert.assertNotNull(item.getGoodsType(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.goodsType is null");
RpcAssert.assertNotEmpty(item.getGoodsTypeName(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.goodsTypeName is null");
RpcAssert.assertIsTrue(!relationKeySet.contains(String.valueOf(item.getGoodsType())), DefaultErrorEnum.PARAMETER_NULL,"按商品品类存在重复数据");
RpcAssert.assertIsTrue(!relationKeySet.contains(String.valueOf(item.getGoodsType())), DefaultErrorEnum.SERVER_ERROR,"按商品品类存在重复数据");
relationKeySet.add(String.valueOf(item.getGoodsType()));
}else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.UPGRADE_GOODS.getValue())) {
RpcAssert.assertNotNull(item.getUpgradeGoodsId(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeGoodsId is null");
RpcAssert.assertNotEmpty(item.getUpgradeGoodsName(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeGoodsName is null");
RpcAssert.assertNotEmpty(item.getUpgradeCommodityCode(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeCommodityCode is null");
RpcAssert.assertNotEmpty(item.getMerchantGoodsCode(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.merchantGoodsCode is null");
RpcAssert.assertIsTrue(!relationKeySet.contains(item.getMerchantGoodsCode()), DefaultErrorEnum.PARAMETER_NULL,"按具体商品存在重复数据");
RpcAssert.assertIsTrue(!relationKeySet.contains(item.getMerchantGoodsCode()), DefaultErrorEnum.SERVER_ERROR,"按具体商品存在重复数据");
relationKeySet.add(item.getMerchantGoodsCode());
}else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_PACKAGE.getValue())) {
RpcAssert.assertNotEmpty(item.getPackageCode(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.packageCode is null");
RpcAssert.assertNotEmpty(item.getPackageName(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.packageName is null");
RpcAssert.assertIsTrue(!relationKeySet.contains(item.getPackageCode()), DefaultErrorEnum.PARAMETER_NULL,"按具体套餐存在重复数据");
RpcAssert.assertIsTrue(!relationKeySet.contains(item.getPackageCode()), DefaultErrorEnum.SERVER_ERROR,"按具体套餐存在重复数据");
relationKeySet.add(item.getPackageCode());
}else {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR,"分账品类错误");
......@@ -228,13 +228,13 @@ public class GoodsListingGoodsTypeGroupRelationService {
List<GoodsListingGoodsTypeGroupRelation> relationList = relationMap.get(group.getId());
for(GoodsListingGoodsTypeGroupRelation item:relationList) {
if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_TYPE.getValue())) {
RpcAssert.assertIsTrue(!goodsTypeSet.contains(item.getGoodsType()), DefaultErrorEnum.PARAMETER_NULL,"按商品品类存在重复数据");
RpcAssert.assertIsTrue(!goodsTypeSet.contains(item.getGoodsType()), DefaultErrorEnum.SERVER_ERROR,"按商品品类存在重复数据");
goodsTypeSet.add(item.getGoodsType());
}else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.UPGRADE_GOODS.getValue())) {
RpcAssert.assertIsTrue(!merchantGoodsCodeSet.contains(item.getMerchantGoodsCode()), DefaultErrorEnum.PARAMETER_NULL,"按具体商品存在重复数据");
RpcAssert.assertIsTrue(!merchantGoodsCodeSet.contains(item.getMerchantGoodsCode()), DefaultErrorEnum.SERVER_ERROR,"按具体商品存在重复数据");
merchantGoodsCodeSet.add(item.getMerchantGoodsCode());
}else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_PACKAGE.getValue())) {
RpcAssert.assertIsTrue(!packageCodeSet.contains(item.getPackageCode()), DefaultErrorEnum.PARAMETER_NULL,"按具体套餐存在重复数据");
RpcAssert.assertIsTrue(!packageCodeSet.contains(item.getPackageCode()), DefaultErrorEnum.SERVER_ERROR,"按具体套餐存在重复数据");
packageCodeSet.add(item.getPackageCode());
}else {
throw new RpcServiceException(DefaultErrorEnum.SERVER_ERROR,"分账品类错误");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!