Commit 7e962b35 by zhoulm

分账对账规则不再支持商品分类配置

1 parent 71f45971
...@@ -193,12 +193,7 @@ public class GoodsListingGoodsTypeGroupRelationService { ...@@ -193,12 +193,7 @@ public class GoodsListingGoodsTypeGroupRelationService {
RpcAssert.assertNotEmpty(relationList, DefaultErrorEnum.SERVER_ERROR,"分账品类数据不能为空"); RpcAssert.assertNotEmpty(relationList, DefaultErrorEnum.SERVER_ERROR,"分账品类数据不能为空");
Set<String> relationKeySet = new HashSet<>(); Set<String> relationKeySet = new HashSet<>();
for(GoodsListingGoodsTypeGroupRelation item:relationList) { for(GoodsListingGoodsTypeGroupRelation item:relationList) {
if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_TYPE.getValue())) { if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.UPGRADE_GOODS.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.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.assertNotNull(item.getUpgradeGoodsId(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeGoodsId is null");
RpcAssert.assertNotEmpty(item.getUpgradeGoodsName(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeGoodsName 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.getUpgradeCommodityCode(), DefaultErrorEnum.PARAMETER_NULL,"goodsTypeGroupRelation.upgradeCommodityCode is null");
...@@ -221,16 +216,12 @@ public class GoodsListingGoodsTypeGroupRelationService { ...@@ -221,16 +216,12 @@ public class GoodsListingGoodsTypeGroupRelationService {
RpcAssert.assertNotEmpty(allRelationList, DefaultErrorEnum.SERVER_ERROR,"分账品类数据不能为空"); RpcAssert.assertNotEmpty(allRelationList, DefaultErrorEnum.SERVER_ERROR,"分账品类数据不能为空");
Map<Integer,List<GoodsListingGoodsTypeGroupRelation>> relationMap = allRelationList.stream() Map<Integer,List<GoodsListingGoodsTypeGroupRelation>> relationMap = allRelationList.stream()
.collect(Collectors.groupingBy(GoodsListingGoodsTypeGroupRelation::getGoodsTypeGroupId)); .collect(Collectors.groupingBy(GoodsListingGoodsTypeGroupRelation::getGoodsTypeGroupId));
Set<Integer> goodsTypeSet = new HashSet<>();
Set<String> merchantGoodsCodeSet = new HashSet<>(); Set<String> merchantGoodsCodeSet = new HashSet<>();
Set<String> packageCodeSet = new HashSet<>(); Set<String> packageCodeSet = new HashSet<>();
for(GoodsListingGoodsTypeGroup group:allGroupList) { for(GoodsListingGoodsTypeGroup group:allGroupList) {
List<GoodsListingGoodsTypeGroupRelation> relationList = relationMap.get(group.getId()); List<GoodsListingGoodsTypeGroupRelation> relationList = relationMap.get(group.getId());
for(GoodsListingGoodsTypeGroupRelation item:relationList) { for(GoodsListingGoodsTypeGroupRelation item:relationList) {
if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_TYPE.getValue())) { if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.UPGRADE_GOODS.getValue())) {
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.SERVER_ERROR,"按具体商品存在重复数据"); RpcAssert.assertIsTrue(!merchantGoodsCodeSet.contains(item.getMerchantGoodsCode()), DefaultErrorEnum.SERVER_ERROR,"按具体商品存在重复数据");
merchantGoodsCodeSet.add(item.getMerchantGoodsCode()); merchantGoodsCodeSet.add(item.getMerchantGoodsCode());
}else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_PACKAGE.getValue())) { }else if(Objects.equals(group.getCategoryType(), GoodsGroupCategoryTypeEnum.GOODS_PACKAGE.getValue())) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!