Browse Source

处理批量上架的bug。

yujia 7 years ago
parent
commit
aa62bb2d36

+ 8 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -1810,7 +1810,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		if (StringUtils.isEmpty(importNum)) {
 			throw new IllegalOperatorException("生成批次号失败");
 		}
-		String time = importNum.substring(IntegerConstant.NO_SHORT, (IntegerConstant.TIME_LENGTH - 1));
+		String time = importNum.substring(IntegerConstant.NO_SHORT, (IntegerConstant.TIME_LENGTH));
 		Integer num = Integer.valueOf(importNum.substring(IntegerConstant.TIME_LENGTH));
 		String prodNum = null;
 		for (ReleaseProductByBatch releaseProductByBatch : releaseProductByBatchList) {
@@ -1856,13 +1856,16 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
             }
 		}
-
-		List<Product> products1 = productDao.save(products);
+		List<Product> products1 = new ArrayList<>();
+		if (products.size() != 0) {
+			List<Product> productes = productDao.save(products);
+			products1.addAll(productes);
+		}
 		for (Product product : products1) {
 			prIds.add(product.getId());
 		}
-		if (reIds.size() < 1) {
-			map.put("reIds", prIds);
+		if (reIds.size() > 0) {
+			map.put("reIds", reIds);
 		}
 		map.put("prIds", prIds);
 		map.put("propertyvalues", propertyMap);