فهرست منبع

处理第一个分段价格是数字报错的问题

yujia 7 سال پیش
والد
کامیت
de94e56582
1فایلهای تغییر یافته به همراه11 افزوده شده و 6 حذف شده
  1. 11 6
      src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

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

@@ -1129,7 +1129,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	 */
 	 */
 	private List<GoodsQtyPrice> initQtyPriceByExcel(Row row, boolean isImport, ReleaseProductByBatch aProduct, int rowNum) {
 	private List<GoodsQtyPrice> initQtyPriceByExcel(Row row, boolean isImport, ReleaseProductByBatch aProduct, int rowNum) {
 		List<GoodsQtyPrice> qtyPriceList = new ArrayList<>();
 		List<GoodsQtyPrice> qtyPriceList = new ArrayList<>();
-		Object firstValue = readWorkBookCell(row.getCell(UploadConstant.PRICE_START), Cell.CELL_TYPE_NUMERIC,
+		Object firstValue = readWorkBookCell(row.getCell(UploadConstant.PRICE_START), Cell.CELL_TYPE_STRING,
 				rowNum, UploadConstant.PRICE_START);
 				rowNum, UploadConstant.PRICE_START);
 		if (isImport) {
 		if (isImport) {
 			firstValue = readWorkBookCell(row.getCell(UploadConstant.PRICE_START), Cell.CELL_TYPE_STRING,
 			firstValue = readWorkBookCell(row.getCell(UploadConstant.PRICE_START), Cell.CELL_TYPE_STRING,
@@ -1145,14 +1145,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		if (StringUtils.isEmpty(firstValue)) {
 		if (StringUtils.isEmpty(firstValue)) {
 			aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
 			aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
 		} else {
 		} else {
-			Double cellPrice = Double.valueOf(firstValue.toString());
-			if (validatePrice(cellPrice)) {
-				GoodsQtyPrice qtyPrice = getOneQtyPrice(aProduct.getMinBuyQty(), DoubleConstant.maxMinPackageQty,
-						cellPrice, aProduct.getRmbTaxRate(), aProduct.getCurrency());
-				qtyPriceList.add(qtyPrice);
+			if (RegexConstant.isNumber(firstValue.toString())) {
+				Double cellPrice = Double.valueOf(firstValue.toString());
+				if (validatePrice(cellPrice)) {
+					GoodsQtyPrice qtyPrice = getOneQtyPrice(aProduct.getMinBuyQty(), DoubleConstant.maxMinPackageQty,
+							cellPrice, aProduct.getRmbTaxRate(), aProduct.getCurrency());
+					qtyPriceList.add(qtyPrice);
+				} else {
+					aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
+				}
 			} else {
 			} else {
 				aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
 				aProduct.addErrmsg(ErrorInfoConstant.PRICE_INFO.getInfo());
 			}
 			}
+
 		}
 		}
 
 
 		if (!CollectionUtils.isEmpty(qtyPriceList)) {
 		if (!CollectionUtils.isEmpty(qtyPriceList)) {