商品单位必填
This commit is contained in:
parent
fe05a3ae7d
commit
fb6f024394
|
|
@ -341,6 +341,9 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
// }
|
// }
|
||||||
product.setCategoryId(String.valueOf(resources.getCategoryId()));
|
product.setCategoryId(String.valueOf(resources.getCategoryId()));
|
||||||
}
|
}
|
||||||
|
if (product.getUnitId() == null) {
|
||||||
|
throw new BadRequestException("商品单位未填写");
|
||||||
|
}
|
||||||
if (!CollectionUtils.isEmpty(resources.getImages())) {
|
if (!CollectionUtils.isEmpty(resources.getImages())) {
|
||||||
product.setImages(resources.getImages().toString());
|
product.setImages(resources.getImages().toString());
|
||||||
}
|
}
|
||||||
|
|
@ -350,9 +353,6 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
product.setStatus(1);
|
product.setStatus(1);
|
||||||
product.setCreatedAt(Instant.now().toEpochMilli());
|
product.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
product.setUpdatedAt(Instant.now().toEpochMilli());
|
product.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
if (resources.getUnitId() != null) {
|
|
||||||
product.setUnitId(resources.getUnitId());
|
|
||||||
}
|
|
||||||
if ("sku".equals(resources.getTypeEnum())) {
|
if ("sku".equals(resources.getTypeEnum())) {
|
||||||
List<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
|
List<BigDecimal> collect = resources.getSkuList().stream().map(TbProductSku::getSalePrice).sorted().collect(Collectors.toList());
|
||||||
product.setLowPrice(collect.get(0));
|
product.setLowPrice(collect.get(0));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue