Administrator
2025-05-22 9bb4c9aeeb6165c08e6be165640f177f2c193627
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -73,6 +73,12 @@
            return new FebsResponse().fail().message("商品编号不能重复");
        }
        Integer carriageType = addMallGoodsDto.getCarriageType();
        if (addMallGoodsDto.getIsNormal() == 3) {
            String storeAppId = addMallGoodsDto.getStoreAppId();
            if (ObjectUtil.isEmpty(storeAppId)) {
                return new FebsResponse().fail().message("微信小店APP_ID不能为空");
            }
        }
        if (addMallGoodsDto.getGoodsType() == 1) {
            if (1 == carriageType) {
                if (ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount())
@@ -126,11 +132,15 @@
                    if (StrUtil.isEmpty(presentPrice)) {
                        return new FebsResponse().fail().message("商品规格现价不能为空");
                    }
//                    if (StrUtil.isEmpty(addSku.getLevelOnePrice())
//                    || StrUtil.isEmpty(addSku.getLevelTwoPrice())
//                            || StrUtil.isEmpty(addSku.getLevelThreePrice())) {
//                        return new FebsResponse().fail().message("商品规格级别价格不能为空");
//                    }
                    if (StrUtil.isEmpty(addSku.getLevelOnePrice())) {
                        return new FebsResponse().fail().message("佣金不能为空");
                    }
                    BigDecimal costPrice = addSku.getCostPrice();
                    BigDecimal levelOnePrice = new BigDecimal(addSku.getLevelOnePrice());
                    if (levelOnePrice.compareTo(costPrice) >= 0) {
                        return new FebsResponse().fail().message("佣金要小于成本价");
                    }
                    BigDecimal goodsWeight = addSku.getGoodsWeight();
                    if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){
                        return new FebsResponse().fail().message("重量不能小于零");
@@ -200,7 +210,7 @@
            sku.setCostPrice(mallGoods.getCostPrice());
            sku.setPresentPrice(new BigDecimal(mallGoods.getPresentPrice()));
            sku.setOriginalPrice(new BigDecimal(mallGoods.getOriginalPrice()));
//            sku.setLevelOnePrice(mallGoods.getLevelOnePrice());
            sku.setLevelOnePrice(mallGoods.getLevelOnePrice());
//            sku.setLevelTwoPrice(mallGoods.getLevelTwoPrice());
//            sku.setLevelThreePrice(mallGoods.getLevelThreePrice());
            sku.setSkuVolume(mallGoods.getVolume());
@@ -241,7 +251,7 @@
                mallGoodsSku.setOriginalPrice(new BigDecimal(addMallGoodsSkuDto.getOriginalPrice()));
                mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getPresentPrice()));
//                mallGoodsSku.setPresentPrice(new BigDecimal(addMallGoodsSkuDto.getOriginalPrice()));
//                mallGoodsSku.setLevelOnePrice(new BigDecimal(addMallGoodsSkuDto.getLevelOnePrice()));
                mallGoodsSku.setLevelOnePrice(new BigDecimal(addMallGoodsSkuDto.getLevelOnePrice()));
//                mallGoodsSku.setLevelTwoPrice(new BigDecimal(addMallGoodsSkuDto.getLevelTwoPrice()));
//                mallGoodsSku.setLevelThreePrice(new BigDecimal(addMallGoodsSkuDto.getLevelThreePrice()));
                mallGoodsSku.setStyleId(mallGoodsStyleSku.getId());
@@ -366,6 +376,14 @@
            }
        }
        if (mallGoodsUpdateDto.getIsNormal() == 3) {
            String storeAppId = mallGoodsUpdateDto.getStoreAppId();
            if (ObjectUtil.isEmpty(storeAppId)) {
                return new FebsResponse().fail().message("微信小店APP_ID不能为空");
            }
        }
        if (mallGoodsUpdateDto.getGoodsType() != 2) {
            Long categoryId = mallGoodsUpdateDto.getCategoryId();
            if (ObjectUtil.isEmpty(categoryId)) {
@@ -402,6 +420,15 @@
                    if (presentPrice.compareTo(BigDecimal.ZERO) < 0) {
                        return new FebsResponse().fail().message("商品规格现价不能小于0");
                    }
                    if (ObjectUtil.isEmpty(addSku.getLevelOnePrice())) {
                        return new FebsResponse().fail().message("佣金不能为空");
                    }
                    BigDecimal costPrice = addSku.getCostPrice();
                    BigDecimal levelOnePrice = addSku.getLevelOnePrice();
                    if (levelOnePrice.compareTo(costPrice) >= 0) {
                        return new FebsResponse().fail().message("佣金要小于成本价");
                    }
                    BigDecimal goodsWeight = addSku.getGoodsWeight();
                    if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){
                        return new FebsResponse().fail().message("重量不能小于零");