Browse Source

1:批量上架的输入做控制。
2:批量上架界面js报错问题的处理。

yujia 8 years ago
parent
commit
aaefb75eb5

+ 5 - 0
src/main/java/com/uas/platform/b2c/core/utils/RegexConstant.java

@@ -16,4 +16,9 @@ public class RegexConstant {
      * 判断是否是数字
      */
     public static final String NumberData = "^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$";
+
+    /**
+     * 判断是否只包含数字,英文,特殊字符
+     */
+    public static final String EnglishAnDigitAndSpecialCharacter = "^[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】_\\-‘;:”“’。,、?A-Za-z0-9]+$";
 }

+ 0 - 20
src/main/java/com/uas/platform/b2c/prod/commodity/controller/GoodsController.java

@@ -246,26 +246,6 @@ public class GoodsController {
 		logger.log("商品批次", "下架对应的批次" + batchCodes + ",操作者是:" + SystemSession.getUser().getUserUU() + "-" + SystemSession.getUser().getUserName());
 	}
 
-    /**
-     * 获取批量发布商品的模板(大量)
-     *
-     * @param uuids the uuids 器件的uuid
-     * @return model and view
-     */
-    @RequestMapping(value = "/release/template", method = RequestMethod.GET)
-	public ModelAndView exportOrderses(String uuids) {
-		ModelAndView modelAndView = new ModelAndView();
-		// List<ReleaseProductByBatch> releaseProductByBatchs =
-		// releaseProductByBatchService.findByUuids(productuuids);
-		// modelAndView.addObject("releaseProductByBatchs",
-		// releaseProductByBatchs);
-		List<ComponentInfo> components = componentService.findInfoByUuids(uuids);
-		modelAndView.addObject("components", components);
-		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch", "优软商城"));
-		logger.log("商品批次", "下载批量上架商品的Excel模板");
-		return modelAndView;
-	}
-
     /**
      * 通过导入Excel批量发布商品
      *

+ 18 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ReleaseProductByBatchController.java

@@ -1,17 +1,17 @@
 package com.uas.platform.b2c.prod.commodity.controller;
 
+import com.uas.platform.b2c.common.base.model.FileUpload;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.b2c.core.support.view.JxlsExcelView;
+import com.uas.platform.b2c.core.utils.FastjsonUtils;
 import com.uas.platform.b2c.prod.commodity.dao.ReleaseProductByBatchDao;
 import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
 import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
-import com.uas.platform.b2c.common.base.model.FileUpload;
 import com.uas.platform.b2c.prod.product.brand.modal.BrandInfo;
 import com.uas.platform.b2c.prod.product.brand.service.BrandService;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
 import com.uas.platform.b2c.prod.product.component.modal.Component;
-import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
-import com.uas.platform.b2c.core.utils.FastjsonUtils;
-import com.uas.platform.b2c.core.support.view.JxlsExcelView;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -258,4 +258,18 @@ public class ReleaseProductByBatchController {
         session.setAttribute("load-error-ing", false);
         return modelAndView;
     }
+
+    /**
+     * 获取批量发布商品的模板(大量)
+     *
+     * @param uuids the uuids 器件的uuid
+     * @return model and view
+     */
+    @RequestMapping(value = "/release/template", method = RequestMethod.GET)
+    public ModelAndView exportOrderses(String uuids) {
+        ModelAndView modelAndView = new ModelAndView();
+        modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch", "优软商城库存上传模板"));
+        logger.log("商品批次", "下载批量上架商品的Excel模板");
+        return modelAndView;
+    }
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -243,7 +243,7 @@ public class ReleaseProductByBatch implements Serializable {
 
 	/**
 	 * 发布状态编号
-	 * 
+	 *  101 已发布 111 关键信息字段缺失 121 匹配时找不到对应的信息
 	 * @return
 	 */
 	@Column(name = "rel_releasecode")

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

@@ -1,6 +1,11 @@
 package com.uas.platform.b2c.prod.commodity.service.impl;
 
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.base.dao.CommonDao;
+import com.uas.platform.b2c.core.config.SysConf;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.utils.NumberUtil;
+import com.uas.platform.b2c.core.utils.RegexConstant;
 import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
 import com.uas.platform.b2c.prod.commodity.dao.ReleaseProductByBatchDao;
 import com.uas.platform.b2c.prod.commodity.model.Goods;
@@ -8,17 +13,16 @@ import com.uas.platform.b2c.prod.commodity.model.GoodsQtyPrice;
 import com.uas.platform.b2c.prod.commodity.model.ReleaseProductByBatch;
 import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
-import com.uas.platform.b2c.common.base.dao.CommonDao;
-import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
-import com.uas.platform.b2c.prod.store.dao.StoreInDao;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
-import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.prod.store.model.StoreStatus;
+import com.uas.platform.b2c.prod.store.service.StoreInService;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.ReleaseStatus;
 import com.uas.platform.core.model.Type;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,7 +64,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	private CommonDao commonDao;
 
 	@Autowired
-	private StoreInDao storeInDao;
+	private StoreInService storeInService;
 
 	@Autowired
 	private SysConf SysConf;
@@ -79,6 +83,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale) {
 		ModelMap modelMap = new ModelMap();
 		List<ReleaseProductByBatch> releaseProductByBatchs = new ArrayList<ReleaseProductByBatch>();
+		Pattern codePattern = Pattern.compile(RegexConstant.EnglishAnDigitAndSpecialCharacter);
+
+		Pattern chineseAndEnglishPattern = Pattern.compile(RegexConstant.chineseAndEnglish);
 		Sheet sheet = workbook.getSheetAt(0);
 		int colNum = sheet.getRow(0).getPhysicalNumberOfCells();
 		if(colNum != 25) {
@@ -86,16 +93,18 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		}
 		int rowNum = sheet.getLastRowNum();
 		String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
-		String storeid = null;
+		String storeid = null, storeName = null;
 		if(selfSale) {
-			List<StoreIn> storeIns = storeInDao.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
-			if(CollectionUtils.isEmpty(storeIns)) {
+			StoreIn storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
+			if(storeIn == null || storeIn.getStatus() != StoreStatus.OPENED) {
 				throw new IllegalOperatorException("您还没有开店铺,不能选择店铺自营。");
 			}else {
-				storeid = storeIns.get(0).getUuid();
+				storeid = storeIn.getUuid();
+				storeName = storeIn.getStoreName();
 			}
 		}else {
 			storeid = SysConf.getStoreid();
+			storeName = SysConf.getEnName();
 		}
 		Row headerRow = sheet.getRow(0);
 		int total = 0;
@@ -111,8 +120,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			for (int r = 1; r <= rowNum; r++) {
 				Row row = sheet.getRow(r);
 				// 英文品牌名称
-				total++;
 				if (row != null && row.getCell(1) != null && row.getCell(1).getCellType() != Cell.CELL_TYPE_BLANK) {
+					total++;
 					ReleaseProductByBatch releaseProductByBatch = new ReleaseProductByBatch();
 					releaseProductByBatch.setReleaseCode(ReleaseStatus.success.value());
 					releaseProductByBatch.setReleaseStatus(ReleaseStatus.success.getPhrase());
@@ -138,7 +147,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					if(StringUtils.isEmpty(codeCellValue) || "B2C1".equals(brandNameCnCellValue) || "B2C2".equals(brandNameCnCellValue)) {
 						continue;
 					}else {
-						releaseProductByBatch.setCode(codeCellValue.toString());
+						String code = codeCellValue.toString();
+						releaseProductByBatch.setCode(code);
+						Matcher matcher = codePattern.matcher(code);
+						if(!matcher.find()) {
+							releaseProductByBatch.addErrmsg("3:产品型号仅限英文、数字、特殊字符");
+						}
 					}
 
 					// 库存类型
@@ -156,14 +170,16 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 发布库存量
 					Double reserve = null;
-					Object reserveCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_NUMERIC, r, 4);
-					if (reserveCellValue == null || Double.valueOf(reserveCellValue.toString()).doubleValue() <= 0) {
-						releaseProductByBatch.addErrmsg("5:发布数量为空或者小于等于0");
+					Object reserveCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_STRING, r, 4);
+					if (reserveCellValue == null || !isNumber(reserveCellValue.toString())) {
+						releaseProductByBatch.addErrmsg("5:发布数量为空或者不是数字");
 					} else {
 						reserve = Double.valueOf(reserveCellValue.toString());
 						int compareTo = reserve.compareTo(99999999d);
 						if(compareTo > 0) {
 							releaseProductByBatch.addErrmsg("5:发布数量大于了我们设置的最大值99999999");
+						}else if(NumberUtil.compare(reserve, 0.0) < 1) {
+							releaseProductByBatch.addErrmsg("5:发布数量必须大于0");
 						}
 						releaseProductByBatch.setReserve(reserve);
 					}
@@ -174,7 +190,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					if (packagingCellValue == null || StringUtils.isEmpty(packagingCellValue.toString())) {
 						releaseProductByBatch.addErrmsg("6:包装方式不能为空");
 					} else {
-						releaseProductByBatch.setPackaging(packagingCellValue.toString());
+						packaging = packagingCellValue.toString();
+						releaseProductByBatch.setPackaging(packaging);
+						Matcher matcher = chineseAndEnglishPattern.matcher(packaging);
+						if(!matcher.find()) {
+							releaseProductByBatch.addErrmsg("6:包装方式仅限中文或英文");
+						}
 					}
 
 					//封装方式
@@ -182,8 +203,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					releaseProductByBatch.setEncapsulation(String.valueOf(encapsulationCellValue));
 					
 					Double sample = null;
-					Object sampleObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_NUMERIC, r, 7);
-					if (sampleObj != null) {
+					Object sampleObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING, r, 7);
+					if ((sampleObj != null)&&(isNumber(sampleObj.toString()))) {
 						sample = Double.valueOf(sampleObj.toString());
 						if (sample <= 0) {
 							// 这个是存在输入数据后再删除就会默认成0
@@ -197,8 +218,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					}
 					
 					// 最小起订量
-					Object minBuyCellValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_NUMERIC, r, 8);
-					if (minBuyCellValue != null) {
+					Object minBuyCellValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_STRING, r, 8);
+					if ((minBuyCellValue != null)&&(isNumber(minBuyCellValue.toString()))) {
 						Double minBuy = Double.valueOf(minBuyCellValue.toString());
 						if (minBuy <= 0) {
 							// 输入负数
@@ -212,12 +233,12 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 							releaseProductByBatch.setMinBuyQty(minBuy);
 						}
 					}else {
-						releaseProductByBatch.addErrmsg("9:最小起订量的数量不可以为空");
+						releaseProductByBatch.addErrmsg("9:最小起订量的数量不可以为空且只能是数字");
 					}
 					
 					// 最小包装量
-					Object minPackQtyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_NUMERIC, r, 9);
-					if (minPackQtyCellValue != null) {
+					Object minPackQtyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_STRING, r, 9);
+					if ((minPackQtyCellValue != null)&&(isNumber(minPackQtyCellValue.toString()))) {
 						Double minPackQty = Double.valueOf(minPackQtyCellValue.toString());
 						if (minPackQty <= 0) {
 							// 输入负数
@@ -226,20 +247,20 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 							releaseProductByBatch.setMinPackage(minPackQty);
 						}
 					}else {
-						releaseProductByBatch.addErrmsg("10:最小包装量不可以为空");
+						releaseProductByBatch.addErrmsg("10:最小包装量不可以为空且只能是数字");
 					}
 
 					// 最小包单价(人民币)
-					Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_NUMERIC, r, 10);
-					if (rmbPriceMinPackQtyCellValue != null) {
+					Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
+					if ((rmbPriceMinPackQtyCellValue != null)&&(isNumber(rmbPriceMinPackQtyCellValue.toString()))) {
 						Double rmbPrice = Double.valueOf(rmbPriceMinPackQtyCellValue.toString());
 						rmbPrice = fractionNumCeil(rmbPrice, 6);
 						releaseProductByBatch.setRmbMinPackPrice(rmbPrice);
 					}
 
 					// 最小包单价(美元)
-					Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_NUMERIC, r, 11);
-					if (usdPriceMinPackQtyCellValue != null) {
+					Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
+					if ((usdPriceMinPackQtyCellValue != null)&&(isNumber(usdPriceMinPackQtyCellValue.toString()))) {
 						Double usdPrice = Double.valueOf(usdPriceMinPackQtyCellValue.toString());
 						usdPrice = fractionNumCeil(usdPrice, 6);
 						releaseProductByBatch.setUsdMinPackPrice(usdPrice);
@@ -296,10 +317,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						Object deliveryCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
 						if (!StringUtils.isEmpty(deliveryCellValue)) {
 							Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
-							if (delivers != null) {
+							if (!ArrayUtils.isEmpty(delivers)&&(delivers[0] !=null)&&(delivers[1] !=null)) {
 								releaseProductByBatch.setDeliveryDemMinTime(delivers[0]);
 								releaseProductByBatch.setDeliveryDemMaxTime(delivers[1]);
-
 								Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMaxTime(), (short) 0, (short) 9);
 								if(!aBoolean) {
 									releaseProductByBatch.addErrmsg("14:大陆交期的不在(0,9]天");
@@ -317,7 +337,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						Object deliveryhkCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
 						if (!StringUtils.isEmpty(deliveryhkCellValue)) {
 							Short[] deliverys = splitDeliveryString(deliveryhkCellValue.toString());
-							if (deliverys != null) {
+							if (!ArrayUtils.isEmpty(deliverys)&&(deliverys[0] !=null)&&(deliverys[1] !=null)) {
 								releaseProductByBatch.setDeliveryHKMinTime(deliverys[0]);
 								releaseProductByBatch.setDeliveryHKMaxTime(deliverys[1]);
 
@@ -335,19 +355,19 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					if("RMB-USD".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null ||  releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写");
+							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写,且格式必须是5~5");
 						}
 					}else if("RMB".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币,所以大陆交期需要填写");
+							releaseProductByBatch.addErrmsg("14-15:您上架的币别是人民币,所以大陆交期需要填写,且格式必须是5~5");
 						}
 					}else if("USD".equals(releaseProductByBatch.getCurrency())) {
 						if(releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您上架的币别是美金,所以香港交期需要填写");
+							releaseProductByBatch.addErrmsg("14-15:您上架的币别是美金,所以香港交期需要填写,且格式必须是5~5");
 						}
 					}else {
 						if(releaseProductByBatch.getDeliveryDemMaxTime() == null && releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("14-15:您必须要填写一个类型的交期");
+							releaseProductByBatch.addErrmsg("14-15:您必须要填写一个类型的交期,且格式必须是5~5");
 						}
 					}
 
@@ -431,13 +451,11 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					releaseProductByBatch.setPublisherTel(SystemSession.getUser().getUserTel());
 					releaseProductByBatch.setPublisherUu(SystemSession.getUser().getUserUU());
 					releaseProductByBatch.setStoreid(storeid);
-					StoreIn storeIn = storeInDao.findByUuid(storeid);
-					if (storeIn == null) {
-						throw new IllegalOperatorException("店铺不存在");
-
+					releaseProductByBatch.setStoreName(storeName);
+					if(!StringUtils.isEmpty(releaseProductByBatch.getErrmsg())) {
+						releaseProductByBatch.setReleaseCode(ReleaseStatus.failure.value());
+						releaseProductByBatch.setReleaseStatus(ReleaseStatus.failure.getPhrase());
 					}
-					releaseProductByBatch.setStoreName(storeIn.getStoreName());
-
 					releaseProductByBatch.setUnit("PCS");
 					releaseProductByBatch.setCreateDate(new Date());
 					releaseProductByBatchs.add(releaseProductByBatch);
@@ -457,7 +475,17 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		return modelMap;
 	}
 
-	/**
+	private Boolean isNumber(String str) {
+		Pattern numberPattern = Pattern.compile(RegexConstant.NumberData);
+		Matcher matcher = numberPattern.matcher(str);
+		if(matcher.find()) {
+			return true;
+		}else {
+			return false;
+		}
+	}
+
+ 	/**
 	 * 创建时间 :2016年12月11日 下午2:02:16
 	 * 
 	 * @author yujia
@@ -584,8 +612,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	private void readSectionPrice(Cell cellQty, Cell cellPriceRMB, Cell cellPriceUSD, List<GoodsQtyPrice> prices,
 			ReleaseProductByBatch releaseProductByBatch, int r, int num, Double[] priceMaxMinPrice) {
 		// 先跟据币别判断对应的价格是否有空值
-		Object startQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_NUMERIC, r, num);
-		if (startQtyCellValue != null) {
+		Object startQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_STRING, r, num);
+		if ((startQtyCellValue != null)&&(isNumber(startQtyCellValue.toString()))) {
 			Double start = Double.valueOf(startQtyCellValue.toString());
 			GoodsQtyPrice qtyPrice = new GoodsQtyPrice();
 			// 分段数量start不得大于库存量
@@ -599,8 +627,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			// 人民币价格
 			if(currency != null && currency.contains("RMB")) {
 				Double pricermb = null;
-				Object pricermbReadWorkBookCellValue = readWorkBookCell(cellPriceRMB, Cell.CELL_TYPE_NUMERIC, r, num+1);
-				if (pricermbReadWorkBookCellValue != null) {
+				Object pricermbReadWorkBookCellValue = readWorkBookCell(cellPriceRMB, Cell.CELL_TYPE_STRING, r, num+1);
+				if ((pricermbReadWorkBookCellValue != null)&&(isNumber(pricermbReadWorkBookCellValue.toString()))) {
 					pricermb = Double.valueOf(pricermbReadWorkBookCellValue.toString());
 				}
 				if (pricermb != null && pricermb > 0.0) {
@@ -620,8 +648,8 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 			if(currency != null && currency.contains("USD")) {
 				// 美金价格
 				Double priceusd = null;
-				Object priceusdReadWorkBookCellValue = readWorkBookCell(cellPriceUSD, Cell.CELL_TYPE_NUMERIC, r, num+2);
-				if (priceusdReadWorkBookCellValue != null) {
+				Object priceusdReadWorkBookCellValue = readWorkBookCell(cellPriceUSD, Cell.CELL_TYPE_STRING, r, num+2);
+				if ((priceusdReadWorkBookCellValue != null)&&(isNumber(priceusdReadWorkBookCellValue.toString()))) {
 					priceusd = Double.valueOf(priceusdReadWorkBookCellValue.toString());
 				}
 				if (priceusd != null && priceusd > 0) {

+ 42 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/status/ReleaseBatchStatus.java

@@ -0,0 +1,42 @@
+package com.uas.platform.b2c.prod.commodity.status;
+
+/**
+ * description
+ *
+ * @author yuj 2017-09-05 20:48
+ */
+public enum  ReleaseBatchStatus {
+
+    INFO_DEFICIENCY(111, "关键信息缺失,或格式不正确"),
+
+    PUBLISH(101, "已发布"),
+
+    MATCH_FAILURE(121, "匹配失败");
+
+    private Integer code;
+
+    private String message;
+
+    ReleaseBatchStatus(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public ReleaseBatchStatus setCode(Integer code) {
+        this.code = code;
+        return this;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public ReleaseBatchStatus setMessage(String message) {
+        this.message = message;
+        return this;
+    }
+}

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -1,7 +1,7 @@
 define([ 'app/app' ], function(app) {
     'use strict';
     app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms) {
-        $rootScope.active = 'vendor_goods';
+        $rootScope.active = 'vendor_material';
         $scope.keyword = '';
         $scope.tab = 'onSale';
         $scope.isInt = /^[0-9]*[1-9][0-9]*$/;

+ 9 - 7
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -137,6 +137,9 @@ define([ 'app/app' ], function(app) {
 
 		// 上传Excel批量发布(大量)
 		$scope.upload = function() {
+			if(($scope.batch.myFiles == null) || ($scope.batch.myFiles.length == 0)) {
+				return ;
+			}
 			var file = $scope.batch.myFiles[0];
 			if(!file) {
 				toaster.pop('info', '请选择需要上传的文件');
@@ -174,13 +177,12 @@ define([ 'app/app' ], function(app) {
 					templateUrl : $rootScope.rootPath + '/static/view/vendor/modal/releaseProductByBatchTip.html',
 					controller : 'releaseProductByBatchTipCtrl',
 				});
-
 				modalInstance.result.then(function(response) {
 				}, function(res) {
-					window.location.href = $rootScope.rootPath + '/trade/goods/release/template';
+					window.location.href = $rootScope.rootPath + '/release/product/release/template';
 				});
 			}else {
-				window.location.href = $rootScope.rootPath + '/trade/goods/release/template';
+				window.location.href = $rootScope.rootPath + '/release/product/release/template';
 			}
 		};
 
@@ -196,10 +198,10 @@ define([ 'app/app' ], function(app) {
 				}, function(res) {
 					toaster.pop("error", "发布失败", res.data);
 				});
-			} else {
+			}else {
 				event.stopPropagation();//阻止冒泡事件
 				event.preventDefault();//阻止默认的事件。
-				toaster.pop("info", "提示", "验证通过的数量为零,没有信息发布");
+				toaster.pop("info", "提示", "没有信息发布");
 			}
 		};
 
@@ -236,10 +238,10 @@ define([ 'app/app' ], function(app) {
 					getDownLoadStatus();
 				}, 500);
 			}else {
-				if(!$scope.result.batch) {
+				if(!$scope.result || !$scope.result.batch) {
 					toaster.pop('info', '提示', '您没有上传信息');
 				}else if(!$scope.result.failure) {
-					toaster.pop('info', '提示', '您上传的信息为空');
+					toaster.pop('info', '提示', '您没有匹配不成功的数据');
 				}
 			}
 		};

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -353,7 +353,7 @@
                             </tbody>
                         </table>
                         <div>3、如核对信息无误之后,点击确认发布</div>
-                        <a class="blue-bg publish" href="javascript:void(0)" ng-click="publish()" ng-disabled="!result.success" >确认上架</a>
+                        <a class="blue-bg publish" href="javascript:void(0)" ng-click="publish($event)" ng-disabled="!result.success" >确认上架</a>
                     </div>
                 </div>
                 <div class="load_next">