修改商品 规格
This commit is contained in:
@@ -83,9 +83,9 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
case "weight":
|
||||
return "称重商品";
|
||||
case "currentPrice":
|
||||
return "套餐商品/团购卷";
|
||||
case "group":
|
||||
return "时价商品";
|
||||
case "group":
|
||||
return "套餐商品/团购卷";
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
@@ -328,6 +328,9 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
TbProduct product = new TbProduct();
|
||||
//组装
|
||||
BeanUtil.copyProperties(resources, product, CopyOptions.create().setIgnoreNullValue(true));
|
||||
if(CollectionUtils.isEmpty(resources.getSkuList())){
|
||||
throw new BadRequestException("商品规格不可为空");
|
||||
}
|
||||
if (!"group".equals(resources.getTypeEnum())) {
|
||||
if (resources.getCategoryId() == null) {
|
||||
throw new BadRequestException("必填内容未填写");
|
||||
@@ -446,6 +449,7 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
}
|
||||
}
|
||||
if (!"group".equals(product.getTypeEnum())) {
|
||||
if (resources.getCategoryId() == null) throw new BadRequestException("商品分类不可为空");
|
||||
product.setIsCombo(0);
|
||||
product.setGroupSnap(null);
|
||||
if (resources.getNotices() != null && resources.getNotices().getId() != null) {
|
||||
@@ -506,15 +510,19 @@ public class TbProductServiceImpl implements TbProductService {
|
||||
productSkuResult.setTagSnap(resources.getSkuSnap());
|
||||
productSkuResult.setId(save.getId());
|
||||
tbProductSkuResultRepository.save(productSkuResult);
|
||||
}else if ("group".equals(resources.getTypeEnum())) {
|
||||
TbPurchaseNotice notices = resources.getNotices();
|
||||
if (StringUtils.isBlank(notices.getDateUsed())
|
||||
&& StringUtils.isBlank(notices.getAvailableTime())
|
||||
&& StringUtils.isBlank(notices.getBookingType())
|
||||
&& StringUtils.isBlank(notices.getRefundPolicy())) {
|
||||
throw new BadRequestException("修改购买须知失败,必填项未填写");
|
||||
}else {
|
||||
tbProductSkuResultRepository.deleteByIdN(save.getId());
|
||||
if ("group".equals(resources.getTypeEnum())) {
|
||||
TbPurchaseNotice notices = resources.getNotices();
|
||||
if (StringUtils.isBlank(notices.getDateUsed())
|
||||
&& StringUtils.isBlank(notices.getAvailableTime())
|
||||
&& StringUtils.isBlank(notices.getBookingType())
|
||||
&& StringUtils.isBlank(notices.getRefundPolicy())) {
|
||||
throw new BadRequestException("修改购买须知失败,必填项未填写");
|
||||
}
|
||||
resources.getNotices().setCouponId(save.getId());
|
||||
noticeRepository.save(resources.getNotices());
|
||||
}
|
||||
noticeRepository.save(resources.getNotices());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user