商品单位必填

This commit is contained in:
wangw 2024-07-23 11:22:56 +08:00
parent fe05a3ae7d
commit fb6f024394
1 changed files with 3 additions and 3 deletions

View File

@ -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<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
product.setLowPrice(collect.get(0));