parent
cdceb51f92
commit
0a0a863472
|
|
@ -129,7 +129,7 @@ public class TbProductSku implements Serializable {
|
||||||
|
|
||||||
@Column(name = "`is_grounding`")
|
@Column(name = "`is_grounding`")
|
||||||
@ApiModelProperty(value = "是否上架")
|
@ApiModelProperty(value = "是否上架")
|
||||||
private Integer isGrounding;
|
private Integer isGrounding = 1;
|
||||||
|
|
||||||
public void setIsDel(Integer isDel) {
|
public void setIsDel(Integer isDel) {
|
||||||
if(isDel!=null){
|
if(isDel!=null){
|
||||||
|
|
|
||||||
|
|
@ -374,8 +374,6 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认开启共享库存和库存
|
|
||||||
// product.setIsDistribute(1);
|
|
||||||
TbProduct save = tbProductRepository.save(product);
|
TbProduct save = tbProductRepository.save(product);
|
||||||
if (save.getId() == null) {
|
if (save.getId() == null) {
|
||||||
throw new BadRequestException("添加商品失败");
|
throw new BadRequestException("添加商品失败");
|
||||||
|
|
@ -491,28 +489,13 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if ("sku".equals(save.getTypeEnum())) {
|
if ("sku".equals(save.getTypeEnum())) {
|
||||||
// List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
||||||
List<Integer> collect = tbProductSkus.stream().map(TbProductSku::getId).collect(Collectors.toList());
|
|
||||||
HashMap<String, TbProductSku> skuInfo = new HashMap<>();
|
|
||||||
for (TbProductSku productSkus : tbProductSkus) {
|
for (TbProductSku productSkus : tbProductSkus) {
|
||||||
skuInfo.put(productSkus.getId().toString(), productSkus);
|
if (!collect.contains(productSkus.getId())) {
|
||||||
}
|
tbProductSkuRepository.deleteBySkuId(productSkus.getId());
|
||||||
for (TbProductSku tbProductSku : resources.getSkuList()) {
|
|
||||||
if (!collect.contains(tbProductSku.getId())) {
|
|
||||||
tbProductSkuRepository.deleteBySkuId(tbProductSku.getId());
|
|
||||||
}else {
|
|
||||||
TbProductSku productSku = skuInfo.get(tbProductSku.getId().toString());
|
|
||||||
if (productSku != null) {
|
|
||||||
tbProductSku.setIsGrounding(productSku.getIsGrounding());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (TbProductSku productSkus : tbProductSkus) {
|
|
||||||
// if (!collect.contains(productSkus.getId())) {
|
|
||||||
// tbProductSkuRepository.deleteBySkuId(productSkus.getId());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
tbProductSkuRepository.saveAll(resources.getSkuList());
|
tbProductSkuRepository.saveAll(resources.getSkuList());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue