|
@@ -5,6 +5,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
+import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -631,7 +632,8 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
|
|
|
public List<FsStoreProductExportVO> selectFsStoreProductExportList(FsStoreProduct fsStoreProduct) {
|
|
|
return fsStoreProductMapper.selectFsStoreProductExportList(fsStoreProduct);
|
|
|
}
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private FsWarehousesMapper fsWarehousesMapper;
|
|
|
@Override
|
|
|
public String importStoreProduct(List<FsStoreProductExportVO> list, boolean updateSupport) {
|
|
|
if (com.fs.common.utils.StringUtils.isNull(list) || list.size() == 0)
|
|
@@ -642,13 +644,25 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
|
|
|
int failureNum = 0;
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
+ Map<String, FsWarehouses> warehousesMap = fsWarehousesMapper.selectFsWarehousesMap();
|
|
|
+
|
|
|
for (FsStoreProductExportVO productVO : list){
|
|
|
try
|
|
|
{
|
|
|
FsStoreProduct product = BeanCopyUtils.copy(productVO, FsStoreProduct.class);
|
|
|
- if (product.getBarCode()==null || product.getBarCode()==""){
|
|
|
+ Assert.notNull(product,"产品不能为空");
|
|
|
+ if (StringUtils.isBlank(product.getBarCode())){
|
|
|
throw new CustomException("商品编号为空");
|
|
|
}
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(product.getWarehouseCode())){
|
|
|
+ FsWarehouses fsWarehouses = warehousesMap.get(product.getWarehouseCode());
|
|
|
+ if(fsWarehouses == null) {
|
|
|
+ throw new CustomException("对应的仓库代码找不到!");
|
|
|
+ }
|
|
|
+ product.setWarehouseId(fsWarehouses.getId());
|
|
|
+ }
|
|
|
+
|
|
|
this.insertFsStoreProduct(product);
|
|
|
ProductArrtDTO formatDetailDto = ProductArrtDTO.builder()
|
|
|
.value("规格")
|