From fb6f02439445da5d95c8f5f40612f8917f161d17 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Tue, 23 Jul 2024 11:22:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=8D=95=E4=BD=8D=E5=BF=85?= =?UTF-8?q?=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/productimpl/TbProductServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java index f7254b7c..489982b2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java @@ -341,6 +341,9 @@ public class TbProductServiceImpl implements TbProductService { // } product.setCategoryId(String.valueOf(resources.getCategoryId())); } + if (product.getUnitId() == null) { + throw new BadRequestException("商品单位未填写"); + } if (!CollectionUtils.isEmpty(resources.getImages())) { product.setImages(resources.getImages().toString()); } @@ -350,9 +353,6 @@ public class TbProductServiceImpl implements TbProductService { product.setStatus(1); product.setCreatedAt(Instant.now().toEpochMilli()); product.setUpdatedAt(Instant.now().toEpochMilli()); - if (resources.getUnitId() != null) { - product.setUnitId(resources.getUnitId()); - } if ("sku".equals(resources.getTypeEnum())) { List collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList()); product.setLowPrice(collect.get(0));