|
@@ -17,6 +17,7 @@ import com.fjhx.service.product.ProductInfoService;
|
|
|
import com.fjhx.service.stock.StockService;
|
|
|
import com.fjhx.uitl.code.CodeEnum;
|
|
|
import com.fjhx.utils.Assert;
|
|
|
+import com.fjhx.utils.FileClientUtil;
|
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
|
import com.fjhx.utils.wrapperUtil.KeywordData;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -151,6 +153,8 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
productCombinationService.saveBatch(productCombinationList);
|
|
|
}
|
|
|
|
|
|
+ FileClientUtil.bindingFile(productInfoVo.getId(), productInfoVo.getFileInfoList());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -181,12 +185,19 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
|
|
|
|
|
|
}
|
|
|
|
|
|
+ FileClientUtil.relieveBindingFile(productInfoVo.getId());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void delete(ProductInfoVo productInfoVo) {
|
|
|
- // TODO 有库存不允许删除
|
|
|
+
|
|
|
+ long count = stockService.count(q -> q.eq(Stock::getGoodsId, productInfoVo.getId()).gt(Stock::getQuantity, BigDecimal.ZERO));
|
|
|
+ Assert.eqZero(count, "此产品已有库存,无法删除");
|
|
|
+
|
|
|
removeById(productInfoVo.getId());
|
|
|
+ FileClientUtil.againBindingFile(productInfoVo.getId(), productInfoVo.getFileInfoList());
|
|
|
}
|
|
|
|
|
|
@Override
|