Просмотр исходного кода

1:批量上架功能的调整。

yujia 8 лет назад
Родитель
Сommit
529051bca5

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

@@ -17,6 +17,11 @@ public class RegexConstant {
      */
     public static final String NumberData = "^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$";
 
+    /**
+     * 整数的正则表达式
+     */
+    public static final String Integer = "^[-\\+]?[\\d]*$";
+
     /**
      * 判断是否只包含数字,英文,特殊字符
      */

+ 14 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/constant/DoubleConstant.java

@@ -0,0 +1,14 @@
+package com.uas.platform.b2c.prod.commodity.constant;
+
+/**
+ * 浮点数的常量
+ *
+ * @author yuj 2017-09-11 21:30
+ */
+public class DoubleConstant {
+
+    /**
+     * 最大库存
+     */
+    public static final Double maxReserve = 999999999d;
+}

+ 14 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/constant/ShortConstant.java

@@ -0,0 +1,14 @@
+package com.uas.platform.b2c.prod.commodity.constant;
+
+/**
+ * Short常量的调整
+ *
+ * @author yuj 2017-09-11 19:30
+ */
+public class ShortConstant {
+
+    /**
+     * 最长交期
+     */
+    public static final Short maxDelivery = 31;
+}

+ 11 - 5
src/main/java/com/uas/platform/b2c/prod/commodity/controller/ReleaseProductByBatchController.java

@@ -12,6 +12,7 @@ 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.trade.order.StringConstant.Currency;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
@@ -187,7 +188,7 @@ public class ReleaseProductByBatchController {
      * @return model map
      */
     @RequestMapping(value = "/release/excel", method = RequestMethod.POST)
-    public ModelMap releaseByExcel(FileUpload uploadItem, @RequestParam("selfSale") Boolean selfSale) {
+    public ModelMap releaseByExcel(FileUpload uploadItem, @RequestParam("selfSale") Boolean selfSale, String currency) {
         ModelMap map = new ModelMap();
         String fileName = uploadItem.getFile().getOriginalFilename();
         String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
@@ -202,7 +203,7 @@ public class ReleaseProductByBatchController {
             } else {
                 throw new IllegalOperatorException("文件格不正确,请上传.xls或.xlsx的文件");
             }
-            map = releaseProductByBatchService.releaseByWorkbook(workbook, selfSale);
+            map = releaseProductByBatchService.releaseByWorkbook(workbook, selfSale, currency);
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -262,13 +263,18 @@ public class ReleaseProductByBatchController {
     /**
      * 获取批量发布商品的模板(大量)
      *
-     * @param uuids the uuids 器件的uuid
+     * @param currency
      * @return model and view
      */
     @RequestMapping(value = "/release/template", method = RequestMethod.GET)
-    public ModelAndView exportOrderses(String uuids) {
+    public ModelAndView exportOrderses(String currency) {
         ModelAndView modelAndView = new ModelAndView();
-        modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch", "优软商城库存上传模板"));
+        if(Currency.USD.equals(currency)) {
+            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releasebyBatch-usd", "优软商城库存上传模板"));
+        }else {
+            modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/trade/releaseByBatch-rmb", "优软商城库存上传模板"));
+        }
+
         logger.log("商品批次", "下载批量上架商品的Excel模板");
         return modelAndView;
     }

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

@@ -2,6 +2,7 @@ package com.uas.platform.b2c.prod.commodity.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
+import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import org.apache.commons.collections.CollectionUtils;
 import org.codehaus.jackson.annotate.JsonIgnore;
@@ -164,40 +165,52 @@ public class ReleaseProductByBatch implements Serializable {
 	private String encapsulation;
 
 	/**
-	 * 商城最长交期
+	 * 自己填写最长交期
 	 */
-	@Column(name = "go_b2cmaxdelivery")
-	private Short b2cMaxDelivery;
+	@Column(name = "go_selfmaxdelivery")
+	private Short selfMaxDelivery;
 
 	/**
-	 * 商城最短交期
+	 * 自己填写最短交期
 	 */
-	@Column(name = "go_b2cmindelivery")
-	private Short b2cMinDelivery;
-
-	/**
-	 * 用户填写的大陆最长交期
-	 */
-	@Column(name = "rel_maxdeliverydemtime")
-	private Short deliveryDemMaxTime;
-
-	/**
-	 * 用户填写的大陆最短交期
-	 */
-	@Column(name = "rel_mindeliverydemtime")
-	private Short deliveryDemMinTime;
-
-	/**
-	 * 用户填写的香港最短交期
-	 */
-	@Column(name = "rel_mindeliveryhktime")
-	private Short deliveryHKMinTime;
-
-	/**
-	 * 用户填写的香港最长交期
-	 */
-	@Column(name = "rel_maxdeliveryhktime")
-	private Short deliveryHKMaxTime;
+	@Column(name = "go_selfcmindelivery")
+	private Short selfMinDelivery;
+
+//	/**
+//	 * 商城最长交期
+//	 */
+//	@Column(name = "go_b2cmaxdelivery")
+//	private Short b2cMaxDelivery;
+//
+//	/**
+//	 * 商城最短交期
+//	 */
+//	@Column(name = "go_b2cmindelivery")
+//	private Short b2cMinDelivery;
+//
+//	/**
+//	 * 用户填写的大陆最长交期
+//	 */
+//	@Column(name = "rel_maxdeliverydemtime")
+//	private Short deliveryDemMaxTime;
+//
+//	/**
+//	 * 用户填写的大陆最短交期
+//	 */
+//	@Column(name = "rel_mindeliverydemtime")
+//	private Short deliveryDemMinTime;
+//
+//	/**
+//	 * 用户填写的香港最短交期
+//	 */
+//	@Column(name = "rel_mindeliveryhktime")
+//	private Short deliveryHKMinTime;
+//
+//	/**
+//	 * 用户填写的香港最长交期
+//	 */
+//	@Column(name = "rel_maxdeliveryhktime")
+//	private Short deliveryHKMaxTime;
 
 	/**
 	 * 备注
@@ -653,21 +666,21 @@ public class ReleaseProductByBatch implements Serializable {
 		this.publisherName = publisherName;
 	}
 
-	public Short getB2cMaxDelivery() {
-		return b2cMaxDelivery;
-	}
-
-	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
-		this.b2cMaxDelivery = b2cMaxDelivery;
-	}
-
-	public Short getB2cMinDelivery() {
-		return b2cMinDelivery;
-	}
-
-	public void setB2cMinDelivery(Short b2cMinDelivery) {
-		this.b2cMinDelivery = b2cMinDelivery;
-	}
+//	public Short getB2cMaxDelivery() {
+//		return b2cMaxDelivery;
+//	}
+//
+//	public void setB2cMaxDelivery(Short b2cMaxDelivery) {
+//		this.b2cMaxDelivery = b2cMaxDelivery;
+//	}
+//
+//	public Short getB2cMinDelivery() {
+//		return b2cMinDelivery;
+//	}
+//
+//	public void setB2cMinDelivery(Short b2cMinDelivery) {
+//		this.b2cMinDelivery = b2cMinDelivery;
+//	}
 
 	public Long getPublisherUu() {
 		return publisherUu;
@@ -855,16 +868,16 @@ public class ReleaseProductByBatch implements Serializable {
 	@JsonIgnore
 	@JSONField(serialize = false)
 	public String getDeliveryHKTime() {
-		Short maxdeliveryHKTime = getB2cMaxDelivery();
-		Short mindeliveryHKTime = getB2cMinDelivery();
-		if(maxdeliveryHKTime == null || mindeliveryHKTime == null) {
-			return "";
-		}else {
-			if(maxdeliveryHKTime.shortValue() != mindeliveryHKTime.shortValue()) {
-				return maxdeliveryHKTime + "-" + mindeliveryHKTime;
+		if(Currency.USD.equals(this.currency)) {
+			Short selfMinDelivery = getSelfMinDelivery();
+			Short selfMaxDelivery = getSelfMaxDelivery();
+			if((selfMinDelivery == null) || (selfMaxDelivery == null)) {
+				return selfMinDelivery == null ? String.valueOf(selfMaxDelivery) : String.valueOf(selfMinDelivery);
 			}else {
-				return maxdeliveryHKTime.toString();
+				return selfMinDelivery + "~" + selfMaxDelivery;
 			}
+		}else {
+			return null;
 		}
 	}
 
@@ -876,16 +889,16 @@ public class ReleaseProductByBatch implements Serializable {
 	@JsonIgnore
 	@JSONField(serialize = false)
 	public String getDeliveryDemTime() {
-		Short maxdeliveryDemTime = getB2cMaxDelivery();
-		Short mindeliveryDemTime = getB2cMinDelivery();
-		if(maxdeliveryDemTime == null || mindeliveryDemTime == null) {
-			return "";
-		}else {
-			if(maxdeliveryDemTime.shortValue() != mindeliveryDemTime.shortValue()) {
-				return maxdeliveryDemTime + "-" + mindeliveryDemTime;
+		if(Currency.RMB.equals(this.currency)) {
+			Short selfMinDelivery = getSelfMinDelivery();
+			Short selfMaxDelivery = getSelfMaxDelivery();
+			if((selfMinDelivery == null) || (selfMaxDelivery == null)) {
+				return selfMinDelivery == null ? String.valueOf(selfMaxDelivery) : String.valueOf(selfMinDelivery);
 			}else {
-				return maxdeliveryDemTime.toString();
+				return selfMinDelivery + "~" + selfMaxDelivery;
 			}
+		}else {
+			return null;
 		}
 	}
 
@@ -1010,11 +1023,12 @@ public class ReleaseProductByBatch implements Serializable {
 		goods.setCode(releaseProductByBatch.getCode());
 		goods.setCreatedDate(new Date());
 		goods.setUpdateDate(new Date());
-		// 交货周期 暂未做最长与最短
-		goods.setSelfDeliveryDemMaxTime(releaseProductByBatch.getDeliveryDemMaxTime());
-		goods.setSelfDeliveryDemMinTime(releaseProductByBatch.getDeliveryDemMinTime());
-		goods.setSelfDeliveryHKMaxTime(releaseProductByBatch.getDeliveryHKMaxTime());
-		goods.setSelfDeliveryHKMinTime(releaseProductByBatch.getDeliveryHKMinTime());
+		goods.setMinDelivery(releaseProductByBatch.getSelfMinDelivery());
+		goods.setMaxDelivery(releaseProductByBatch.getSelfMaxDelivery());
+//		goods.setSelfDeliveryDemMaxTime(releaseProductByBatch.getDeliveryDemMaxTime());
+//		goods.setSelfDeliveryDemMinTime(releaseProductByBatch.getDeliveryDemMinTime());
+//		goods.setSelfDeliveryHKMaxTime(releaseProductByBatch.getDeliveryHKMaxTime());
+//		goods.setSelfDeliveryHKMinTime(releaseProductByBatch.getDeliveryHKMinTime());
 		goods.setProduceDate(releaseProductByBatch.getProductDate());
 		goods.setPublisherUU(releaseProductByBatch.getPublisherUu());
 		goods.setPublisherName(releaseProductByBatch.getPublisherName());
@@ -1075,39 +1089,58 @@ public class ReleaseProductByBatch implements Serializable {
 		return serialVersionUID;
 	}
 
-	public Short getDeliveryDemMaxTime() {
-		return deliveryDemMaxTime;
-	}
-
-	public ReleaseProductByBatch setDeliveryDemMaxTime(Short deliveryDemMaxTime) {
-		this.deliveryDemMaxTime = deliveryDemMaxTime;
-		return this;
-	}
-
-	public Short getDeliveryDemMinTime() {
-		return deliveryDemMinTime;
-	}
-
-	public ReleaseProductByBatch setDeliveryDemMinTime(Short deliveryDemMinTime) {
-		this.deliveryDemMinTime = deliveryDemMinTime;
-		return this;
-	}
-
-	public Short getDeliveryHKMinTime() {
-		return deliveryHKMinTime;
-	}
-
-	public ReleaseProductByBatch setDeliveryHKMinTime(Short deliveryHKMinTime) {
-		this.deliveryHKMinTime = deliveryHKMinTime;
+//	public Short getDeliveryDemMaxTime() {
+//		return deliveryDemMaxTime;
+//	}
+//
+//	public ReleaseProductByBatch setDeliveryDemMaxTime(Short deliveryDemMaxTime) {
+//		this.deliveryDemMaxTime = deliveryDemMaxTime;
+//		return this;
+//	}
+//
+//	public Short getDeliveryDemMinTime() {
+//		return deliveryDemMinTime;
+//	}
+//
+//	public ReleaseProductByBatch setDeliveryDemMinTime(Short deliveryDemMinTime) {
+//		this.deliveryDemMinTime = deliveryDemMinTime;
+//		return this;
+//	}
+//
+//	public Short getDeliveryHKMinTime() {
+//		return deliveryHKMinTime;
+//	}
+//
+//	public ReleaseProductByBatch setDeliveryHKMinTime(Short deliveryHKMinTime) {
+//		this.deliveryHKMinTime = deliveryHKMinTime;
+//		return this;
+//	}
+//
+//	public Short getDeliveryHKMaxTime() {
+//		return deliveryHKMaxTime;
+//	}
+//
+//	public ReleaseProductByBatch setDeliveryHKMaxTime(Short deliveryHKMaxTime) {
+//		this.deliveryHKMaxTime = deliveryHKMaxTime;
+//		return this;
+//	}
+
+
+	public Short getSelfMaxDelivery() {
+		return selfMaxDelivery;
+	}
+
+	public ReleaseProductByBatch setSelfMaxDelivery(Short selfMaxDelivery) {
+		this.selfMaxDelivery = selfMaxDelivery;
 		return this;
 	}
 
-	public Short getDeliveryHKMaxTime() {
-		return deliveryHKMaxTime;
+	public Short getSelfMinDelivery() {
+		return selfMinDelivery;
 	}
 
-	public ReleaseProductByBatch setDeliveryHKMaxTime(Short deliveryHKMaxTime) {
-		this.deliveryHKMaxTime = deliveryHKMaxTime;
+	public ReleaseProductByBatch setSelfMinDelivery(Short selfMinDelivery) {
+		this.selfMinDelivery = selfMinDelivery;
 		return this;
 	}
 

+ 2 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/ReleaseProductByBatchService.java

@@ -29,9 +29,10 @@ public interface ReleaseProductByBatchService {
      *
      * @param workbook the workbook 上传的文件
      * @param selfSale 是否自售
+     * @param currency
      * @return model map
      */
-    public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale);
+    public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale, String currency);
 
     /**
      * 根据发布者UU获取一组产品的信息

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

@@ -1,11 +1,14 @@
 package com.uas.platform.b2c.prod.commodity.service.impl;
 
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.service.EnterpriseService;
 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.constant.DoubleConstant;
+import com.uas.platform.b2c.prod.commodity.constant.ShortConstant;
 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;
@@ -18,12 +21,12 @@ import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.prod.store.model.StoreStatus;
 import com.uas.platform.b2c.prod.store.service.StoreInService;
+import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 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;
@@ -45,6 +48,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import static com.uas.platform.b2c.core.utils.NumberUtil.fractionNumCeil;
+import static java.util.Collections.emptyList;
 
 @Service
 public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchService {
@@ -70,6 +74,9 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	@Autowired
 	private SysConf SysConf;
 
+	@Autowired
+	private EnterpriseService enterpriseService;
+
 	@Override
 	public ReleaseProductByBatch save(ReleaseProductByBatch releaseProductByBatch) {
 		return releaseProductByBatch;
@@ -81,32 +88,20 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	 * @author hejq
 	 */
 	@Override
-	public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale) {
+	public ModelMap releaseByWorkbook(Workbook workbook, Boolean selfSale, String currency) {
 		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 != 26) {
+		if(colNum != 21) {
 			throw new IllegalOperatorException("您上传的信息列信息不正确,请与模板的列做比较");
 		}
 		int rowNum = sheet.getLastRowNum();
 		String batch = createNumberService.getTimeNumber("product$goods", 8, rowNum);
-		String storeid = null, storeName = null;
-		if(selfSale) {
-			StoreIn storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
-			if(storeIn == null || storeIn.getStatus() != StoreStatus.OPENED) {
-				throw new IllegalOperatorException("您还没有开店铺,不能选择店铺自营。");
-			}else {
-				storeid = storeIn.getUuid();
-				storeName = storeIn.getStoreName();
-			}
-		}else {
-			storeid = SysConf.getStoreid();
-			storeName = SysConf.getEnName();
-		}
+		StoreIn storeIn = getStoreInfo(selfSale);
+		String storeid = storeIn.getUuid(), storeName = storeIn.getStoreName();
 		Row headerRow = sheet.getRow(0);
 		int total = 0;
 		if (headerRow != null) {
@@ -129,7 +124,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					releaseProductByBatch.setRelbatchid(batch);
 					Cell cell = row.getCell(1);
 					Object cellValue = readWorkBookCell(cell, Cell.CELL_TYPE_STRING, r, 1);
-					if(StringUtils.isEmpty(cellValue) || "UAS1".equals(cellValue) || "UAS2".equals(cellValue)) {
+					if(StringUtils.isEmpty(cellValue)) {
 						continue;
 					}else {
 						releaseProductByBatch.setBrandNameEn(String.valueOf(cellValue));
@@ -137,7 +132,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 中文品牌名
 					Object brandNameCnCellValue = readWorkBookCell(row.getCell(0), Cell.CELL_TYPE_STRING, r, 0);
-					if("示例优软商城品牌1".equals(brandNameCnCellValue) || "示例优软商城品牌2".equals(brandNameCnCellValue)) {
+					if(StringUtils.isEmpty(brandNameCnCellValue)) {
 						continue;
 					}else {
 						releaseProductByBatch.setBrandNameCn(String.valueOf(brandNameCnCellValue));
@@ -145,7 +140,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 产品型号
 					Object codeCellValue = readWorkBookCell(row.getCell(2), Cell.CELL_TYPE_STRING, r, 2);
-					if(StringUtils.isEmpty(codeCellValue) || "B2C1".equals(brandNameCnCellValue) || "B2C2".equals(brandNameCnCellValue)) {
+					if(StringUtils.isEmpty(codeCellValue)) {
 						continue;
 					}else {
 						String code = codeCellValue.toString();
@@ -156,11 +151,20 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						}
 					}
 
+					// 可拆卖
+					Object breakUpCellValue = readWorkBookCell(row.getCell(3), Cell.CELL_TYPE_STRING, r, 3);
+					releaseProductByBatch.setBreakUpStr(String.valueOf(breakUpCellValue));
+					if (!StringUtils.isEmpty(breakUpCellValue)&&(ReleaseConstant.YES.equals(breakUpCellValue.toString()))) {
+						releaseProductByBatch.setBreakUp(Boolean.TRUE);
+					}else {
+						releaseProductByBatch.setBreakUp(Boolean.FALSE);
+					}
+
 					// 库存类型
-					Object originialCellValue = readWorkBookCell(row.getCell(3), Cell.CELL_TYPE_STRING, r, 3);
+					Object originialCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_STRING, r, 4);
 					if (StringUtils.isEmpty(originialCellValue)
 							|| ((!"现货".equals(originialCellValue)) && (!"呆滞库存".equals(originialCellValue)))) {
-						releaseProductByBatch.addErrmsg("4:库存类型为空,或者没有选择现货或者呆滞库存");
+						releaseProductByBatch.addErrmsg("5:库存类型为空,或者没有选择现货或者呆滞库存");
 					} else {
 						if ("现货".equals(originialCellValue)) {
 							releaseProductByBatch.setOriginal(Type.Goods_Original_Code.value());
@@ -171,40 +175,44 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 
 					// 发布库存量
 					Double reserve = null;
-					Object reserveCellValue = readWorkBookCell(row.getCell(4), Cell.CELL_TYPE_STRING, r, 4);
+					Object reserveCellValue = readWorkBookCell(row.getCell(5), Cell.CELL_TYPE_STRING, r, 5);
 					if (reserveCellValue == null || !isNumber(reserveCellValue.toString())) {
-						releaseProductByBatch.addErrmsg("5:发布数量为空或者不是数字");
+						releaseProductByBatch.addErrmsg("6:发布数量为空或者不是数字");
 					} else {
 						reserve = Double.valueOf(reserveCellValue.toString());
 						int compareTo = reserve.compareTo(99999999d);
 						if(compareTo > 0) {
-							releaseProductByBatch.addErrmsg("5:发布数量大于了我们设置的最大值99999999");
+							releaseProductByBatch.addErrmsg("6:发布数量大于了我们设置的最大值99999999");
 						}else if(NumberUtil.compare(reserve, 0.0) < 1) {
-							releaseProductByBatch.addErrmsg("5:发布数量必须大于0");
+							releaseProductByBatch.addErrmsg("6:发布数量必须大于0");
 						}
 						releaseProductByBatch.setReserve(reserve);
 					}
 
+					// 生产日期
+					Object produceDateCellValue = readWorkBookCell(row.getCell(6), Cell.CELL_TYPE_STRING, r, 6);
+					if (produceDateCellValue == null) {
+						releaseProductByBatch.addErrmsg("7:产品生产日期不可以为空");
+					} else {
+						releaseProductByBatch.setProductDate(String.valueOf(produceDateCellValue));
+					}
+
 					//包装方式
 					String packaging = null;
-					Object packagingCellValue = readWorkBookCell(row.getCell(5), Cell.CELL_TYPE_STRING, r, 5);
+					Object packagingCellValue = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING, r, 7);
 					if (packagingCellValue == null || StringUtils.isEmpty(packagingCellValue.toString())) {
-						releaseProductByBatch.addErrmsg("6:包装方式不能为空");
+						releaseProductByBatch.addErrmsg("8:包装方式不能为空");
 					} else {
 						packaging = packagingCellValue.toString();
 						releaseProductByBatch.setPackaging(packaging);
 						Matcher matcher = chineseAndEnglishPattern.matcher(packaging);
 						if(!matcher.find()) {
-							releaseProductByBatch.addErrmsg("6:包装方式仅限中文或英文");
+							releaseProductByBatch.addErrmsg("8:包装方式仅限中文或英文");
 						}
 					}
 
-					//封装方式
-					Object encapsulationCellValue = readWorkBookCell(row.getCell(6), Cell.CELL_TYPE_STRING, r, 6);
-					releaseProductByBatch.setEncapsulation(String.valueOf(encapsulationCellValue));
-					
 					Double sample = null;
-					Object sampleObj = readWorkBookCell(row.getCell(7), Cell.CELL_TYPE_STRING, r, 7);
+					Object sampleObj = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_STRING, r, 8);
 					if ((sampleObj != null)&&(isNumber(sampleObj.toString()))) {
 						sample = Double.valueOf(sampleObj.toString());
 						if (sample <= 0) {
@@ -217,168 +225,73 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						// 这个是没有输入数据默认为null
 						releaseProductByBatch.setMinPackage((double) 0);
 					}
+
+					//封装方式
+					Object encapsulationCellValue = readWorkBookCell(row.getCell(6), Cell.CELL_TYPE_STRING, r, 6);
+					releaseProductByBatch.setEncapsulation(String.valueOf(encapsulationCellValue));
 					
 					// 最小起订量
-					Object minBuyCellValue = readWorkBookCell(row.getCell(8), Cell.CELL_TYPE_STRING, r, 8);
+					Object minBuyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_STRING, r, 9);
 					if ((minBuyCellValue != null)&&(isNumber(minBuyCellValue.toString()))) {
 						Double minBuy = Double.valueOf(minBuyCellValue.toString());
 						if (minBuy <= 0) {
 							// 输入负数
-							releaseProductByBatch.addErrmsg("9:最小起订量的数量不能是负数");
+							releaseProductByBatch.addErrmsg("10:最小起订量的数量不能是负数");
 						} else {
 							Double rel_reserve = releaseProductByBatch.getReserve() == null ? 0 : releaseProductByBatch.getReserve();
 							int relVal = minBuy.compareTo(rel_reserve);
 							if(relVal > 0) {
-								releaseProductByBatch.addErrmsg("9:最小起订量的数量不能大于库存的数量");
+								releaseProductByBatch.addErrmsg("10:最小起订量的数量不能大于库存的数量");
 							}
 							releaseProductByBatch.setMinBuyQty(minBuy);
 						}
 					}else {
-						releaseProductByBatch.addErrmsg("9:最小起订量的数量不可以为空且只能是数字");
+						releaseProductByBatch.addErrmsg("10:最小起订量的数量不可以为空且只能是数字");
 					}
 					
 					// 最小包装量
-					Object minPackQtyCellValue = readWorkBookCell(row.getCell(9), Cell.CELL_TYPE_STRING, r, 9);
+					Object minPackQtyCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
 					if ((minPackQtyCellValue != null)&&(isNumber(minPackQtyCellValue.toString()))) {
 						Double minPackQty = Double.valueOf(minPackQtyCellValue.toString());
 						if (minPackQty <= 0) {
 							// 输入负数
-							releaseProductByBatch.addErrmsg("10:最小包装量的数量不能是负数");
+							releaseProductByBatch.addErrmsg("11:最小包装量的数量不能是负数");
 						} else {
 							releaseProductByBatch.setMinPackage(minPackQty);
 						}
 					}else {
-						releaseProductByBatch.addErrmsg("10:最小包装量不可以为空且只能是数字");
-					}
-
-					// 可拆卖
-					Object breakUpCellValue = readWorkBookCell(row.getCell(10), Cell.CELL_TYPE_STRING, r, 10);
-					releaseProductByBatch.setBreakUpStr(String.valueOf(breakUpCellValue));
-					if (!StringUtils.isEmpty(breakUpCellValue)&&(ReleaseConstant.YES.equals(breakUpCellValue.toString()))) {
-						releaseProductByBatch.setBreakUp(Boolean.TRUE);
-					}else {
-						releaseProductByBatch.setBreakUp(Boolean.FALSE);
-					}
-
-					// 最小包单价(人民币)
-					Object rmbPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
-					if ((rmbPriceMinPackQtyCellValue != null)&&(isNumber(rmbPriceMinPackQtyCellValue.toString()))) {
-						Double rmbPrice = Double.valueOf(rmbPriceMinPackQtyCellValue.toString());
-						rmbPrice = fractionNumCeil(rmbPrice, 6);
-						releaseProductByBatch.setRmbMinPackPrice(rmbPrice);
-					}
-
-					// 最小包单价(美元)
-					Object usdPriceMinPackQtyCellValue = readWorkBookCell(row.getCell(12), Cell.CELL_TYPE_STRING, r, 12);
-					if ((usdPriceMinPackQtyCellValue != null)&&(isNumber(usdPriceMinPackQtyCellValue.toString()))) {
-						Double usdPrice = Double.valueOf(usdPriceMinPackQtyCellValue.toString());
-						usdPrice = fractionNumCeil(usdPrice, 6);
-						releaseProductByBatch.setUsdMinPackPrice(usdPrice);
+						releaseProductByBatch.addErrmsg("11:最小包装量不可以为空且只能是数字");
 					}
 
 					// 确认币别
-					Double rmbMinPackPrice = releaseProductByBatch.getRmbMinPackPrice();
-					Double usdMinPackPrice = releaseProductByBatch.getUsdMinPackPrice();
-					if (rmbMinPackPrice == null && usdMinPackPrice == null) {
-						releaseProductByBatch.addErrmsg("12-13:最小包单价至少填一种价格");
-					} else if (rmbMinPackPrice != null && usdMinPackPrice == null) {
-						releaseProductByBatch.setCurrency("RMB");
-						releaseProductByBatch.setRmbTaxRate(0.17d);
-					} else if (rmbMinPackPrice == null && usdMinPackPrice != null) {
+					if(Currency.USD.equals(currency)) {
 						releaseProductByBatch.setCurrency("USD");
 						releaseProductByBatch.setUsdTaxRate(0d);
-					} else {
-						releaseProductByBatch.setCurrency("RMB-USD");
+					}else {
+						releaseProductByBatch.setCurrency("RMB");
 						releaseProductByBatch.setRmbTaxRate(0.17d);
-						releaseProductByBatch.setUsdTaxRate(0d);
-					}
-					
-					// 生产日期
-					Object produceDateCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
-					if (produceDateCellValue == null) {
-						releaseProductByBatch.addErrmsg("14:产品生产日期不可以为空");
-					} else {
-						releaseProductByBatch.setProductDate(String.valueOf(produceDateCellValue));
-					}
-
-					//交期时间
-//					if(releaseProductByBatch.getCurrency() != null) {
-//						Object deliveryCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
-//						if (!StringUtils.isEmpty(deliveryCellValue)) {
-//							Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
-//							if (delivers != null) {
-//								releaseProductByBatch.setB2cMinDelivery(delivers[0]);
-//								releaseProductByBatch.setB2cMaxDelivery(delivers[1]);
-//
-//								Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getB2cMaxDelivery(), (short) 0, (short) 9);
-//								if(!aBoolean) {
-//									releaseProductByBatch.addErrmsg("14:交期的不在(0,9]天");
-//								}
-//								Boolean bBoolean = deliveryTimeBetween(releaseProductByBatch.getB2cMinDelivery(), (short) 0, (short) 9);
-//								if(!bBoolean) {
-//									releaseProductByBatch.addErrmsg("14:交期的不在(0,9]天");
-//								}
-//							}
-//						}
-//					}
-
-					// 大陆交期
-					if(releaseProductByBatch.getCurrency() != null && releaseProductByBatch.getCurrency().contains("RMB")) {
-						Object deliveryCellValue = readWorkBookCell(row.getCell(14), Cell.CELL_TYPE_STRING, r, 14);
-						if (!StringUtils.isEmpty(deliveryCellValue)) {
-							Short[] delivers = splitDeliveryString(deliveryCellValue.toString());
-							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("15:大陆交期的不在(0,9]天");
-								}
-								Boolean bBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryDemMinTime(), (short) 0, (short) 9);
-								if(!bBoolean) {
-									releaseProductByBatch.addErrmsg("15:大陆交期的不在(0,9]天");
-								}
-							}
-						}
 					}
 
-					// 香港交期
-					if(releaseProductByBatch.getCurrency() != null && releaseProductByBatch.getCurrency().contains("USD")) {
-						Object deliveryhkCellValue = readWorkBookCell(row.getCell(15), Cell.CELL_TYPE_STRING, r, 15);
-						if (!StringUtils.isEmpty(deliveryhkCellValue)) {
-							Short[] deliverys = splitDeliveryString(deliveryhkCellValue.toString());
-							if (!ArrayUtils.isEmpty(deliverys)&&(deliverys[0] !=null)&&(deliverys[1] !=null)) {
-								releaseProductByBatch.setDeliveryHKMinTime(deliverys[0]);
-								releaseProductByBatch.setDeliveryHKMaxTime(deliverys[1]);
-
-								Boolean aBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryHKMinTime(), (short) 0, (short) 9);
-								if(!aBoolean) {
-									releaseProductByBatch.addErrmsg("16:香港交期的不在(0,9]天");
-								}
-								Boolean bBoolean = deliveryTimeBetween(releaseProductByBatch.getDeliveryHKMaxTime(), (short) 0, (short) 9);
-								if(!bBoolean) {
-									releaseProductByBatch.addErrmsg("16:香港交期的不在(0,9]天");
-								}
-							}
+					// 最小包单价
+					Object priceMinPackQtyCellValue = readWorkBookCell(row.getCell(11), Cell.CELL_TYPE_STRING, r, 11);
+					if ((priceMinPackQtyCellValue != null)&&(isNumber(priceMinPackQtyCellValue.toString()))) {
+						Double price = Double.valueOf(priceMinPackQtyCellValue.toString());
+						price = fractionNumCeil(price, 6);
+						if(Currency.USD.equals(currency)) {
+							releaseProductByBatch.setUsdMinPackPrice(price);
+						}else {
+							releaseProductByBatch.setRmbMinPackPrice(price);
 						}
+					}else {
+						releaseProductByBatch.addErrmsg("最小包单价信息为空");
 					}
 
-					if("RMB-USD".equals(releaseProductByBatch.getCurrency())) {
-						if(releaseProductByBatch.getDeliveryDemMaxTime() == null ||  releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("15-16:您上架的币别是人民币和美金,所以香港和大陆的交期都需要填写,且格式必须是5~5");
-						}
-					}else if("RMB".equals(releaseProductByBatch.getCurrency())) {
-						if(releaseProductByBatch.getDeliveryDemMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("15-16:您上架的币别是人民币,所以大陆交期需要填写,且格式必须是5~5");
-						}
-					}else if("USD".equals(releaseProductByBatch.getCurrency())) {
-						if(releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("15-16:您上架的币别是美金,所以香港交期需要填写,且格式必须是5~5");
-						}
+					Object deliveryMinCellValue = readWorkBookCell(row.getCell(12), Cell.CELL_TYPE_STRING, r, 12);
+					Object deliveryMaxCellValue = readWorkBookCell(row.getCell(13), Cell.CELL_TYPE_STRING, r, 13);
+					if(StringUtils.isEmpty(deliveryMinCellValue) && StringUtils.isEmpty(deliveryMaxCellValue)) {
+						releaseProductByBatch.addErrmsg("13-14:存在交期的信息为空");
 					}else {
-						if(releaseProductByBatch.getDeliveryDemMaxTime() == null && releaseProductByBatch.getDeliveryHKMaxTime() == null) {
-							releaseProductByBatch.addErrmsg("15-16:您必须要填写一个类型的交期,且格式必须是5~5");
-						}
+						setDeliveryTime(releaseProductByBatch, deliveryMinCellValue, deliveryMaxCellValue);
 					}
 
 					// 分段数量
@@ -386,39 +299,23 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					Double[] priceMaxMinPrice = {Double.MAX_VALUE, Double.MIN_VALUE, Double.MAX_VALUE, Double.MIN_VALUE}; //最小人民币价格,最大人民币价格,最小美金价格,最大美金价格
 					for (int i = 0; i < 3; i++) {
 						// 起始量必须等于最小起定量
-						readSectionPrice(row.getCell(16 + 3 * i), row.getCell(17 + 3 * i), row.getCell(18 + 3 * i),
-								prices, releaseProductByBatch, r, (16 + 3 * i), priceMaxMinPrice);
+						readSectionPrice(row.getCell(14 + 2 * i), row.getCell(15 + 2 * i),
+								prices, releaseProductByBatch, r, (14 + 2 * i), priceMaxMinPrice);
 					}
 					if (!CollectionUtils.isEmpty(prices)) {
-						double start = -1;
-						for (int j = 0; j < prices.size(); j++) {
-							GoodsQtyPrice price = prices.get(j);
-							if(j == 0) {
-								int val = price.getStart().compareTo(releaseProductByBatch.getMinBuyQty());
-								if(val != 0) {
-									releaseProductByBatch.addErrmsg("17:第一个分段数量的起始值与最小起订量不相等");
-								}
-							}
-
-							// 判断输入的后一个分段是否大于前一个分段
-							if (start < price.getStart()) {
-								start = price.getStart();
-							} else {
-								releaseProductByBatch.addErrmsg("17:分段数量起始值存在后一个分段的开始值小于前一个分段的开始值");
-							}
-
-							if (j < prices.size() - 1) {
-								price.setEnd(prices.get(j + 1).getStart() - 1);
-							}
-							if (j == prices.size() - 1) {
-								price.setEnd(reserve);
-							}
-						}
+						setPricesQty(prices, releaseProductByBatch);
 					} else {
 						// 如果未填分段价格,默认为最小包装量价格
 						GoodsQtyPrice qtyPrice = new GoodsQtyPrice();
 						qtyPrice.setStart(releaseProductByBatch.getMinBuyQty());
-						if (rmbMinPackPrice != null) {
+						if(Currency.USD.equals(releaseProductByBatch.getCurrency())) {
+							Double usdMinPackPrice = releaseProductByBatch.getUsdMinPackPrice();
+							qtyPrice.setUSDPrice(usdMinPackPrice);
+							qtyPrice.setUSDNTPrice(usdMinPackPrice);
+							priceMaxMinPrice[2] = usdMinPackPrice;
+							priceMaxMinPrice[3] = usdMinPackPrice;
+						}else {
+							Double rmbMinPackPrice = releaseProductByBatch.getRmbMinPackPrice();
 							qtyPrice.setRMBPrice(rmbMinPackPrice);
 							BigDecimal priceNum = new BigDecimal(rmbMinPackPrice);
 							BigDecimal taxNum = new BigDecimal(releaseProductByBatch.getRmbTaxRate() + 1);
@@ -426,12 +323,6 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 							priceMaxMinPrice[0] = rmbMinPackPrice;
 							priceMaxMinPrice[1] = rmbMinPackPrice;
 						}
-						if (usdMinPackPrice != null) {
-							qtyPrice.setUSDPrice(usdMinPackPrice);
-							qtyPrice.setUSDNTPrice(usdMinPackPrice);
-							priceMaxMinPrice[2] = usdMinPackPrice;
-							priceMaxMinPrice[3] = usdMinPackPrice;
-						}
 						qtyPrice.setEnd(reserve);
 						prices.add(qtyPrice);
 					}
@@ -450,7 +341,7 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 					}
 
 					// 备注
-					Object remarkCellValue = readWorkBookCell(row.getCell(25), Cell.CELL_TYPE_STRING, r, 25);
+					Object remarkCellValue = readWorkBookCell(row.getCell(20), Cell.CELL_TYPE_STRING, r, 20);
 					if (!StringUtils.isEmpty(remarkCellValue)) {
 						String remark = remarkCellValue.toString();
 						releaseProductByBatch.setRemark(remark);
@@ -485,6 +376,56 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		return modelMap;
 	}
 
+	/**
+	 * 分析分段的价格
+ 	 */
+	private void setPricesQty(List<GoodsQtyPrice> prices, ReleaseProductByBatch productByBatch) {
+		double end = -1;
+		GoodsQtyPrice[] array = new GoodsQtyPrice[prices.size()];
+		prices.toArray(array);
+		Arrays.sort(array, new Comparator<GoodsQtyPrice>() {
+			@Override
+			public int compare(GoodsQtyPrice o1, GoodsQtyPrice o2) {
+				return NumberUtil.compare(o1.getEnd(), o2.getEnd());
+			}
+		});
+		List<GoodsQtyPrice> priceList = Collections.<GoodsQtyPrice>emptyList();
+		for (int j = 0; j < priceList.size(); j++) {
+			GoodsQtyPrice price = priceList.get(j);
+			if(NumberUtil.compare(end, -1d) == 0) {
+				if(NumberUtil.compare(price.getEnd(), productByBatch.getMinBuyQty()) > 0) {
+					price.setStart(productByBatch.getMinBuyQty());
+					end = price.getEnd();
+				}
+			}
+
+			if (j < prices.size() - 1) {
+				price.setEnd(prices.get(j - 1).getStart() - 1);
+			}
+			if (j == prices.size() - 1) {
+				price.setEnd(DoubleConstant.maxReserve);
+			}
+		}
+	}
+
+	/**
+	 * 获取店铺的信息
+	 * @param selfSale
+	 * @return
+	 */
+	private StoreIn getStoreInfo(Boolean selfSale) {
+		StoreIn storeIn = null;
+		if(selfSale) {
+			storeIn = storeInService.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
+			if((storeIn == null) || (storeIn.getStatus() != StoreStatus.OPENED)) {
+				throw new IllegalOperatorException("您的公司还为开店,不能选择自营");
+			}
+		}else {
+			storeIn = storeInService.findByUuid(SysConf.getStoreid());
+		}
+		return storeIn;
+	}
+
 	private Boolean isNumber(String str) {
 		Pattern numberPattern = Pattern.compile(RegexConstant.NumberData);
 		Matcher matcher = numberPattern.matcher(str);
@@ -495,6 +436,44 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 		}
 	}
 
+	/**
+	 * 设置交期的信息
+	 */
+	private void setDeliveryTime(ReleaseProductByBatch releaseProductByBatch, Object minDelivery, Object maxDelivery) {
+		minDelivery = minDelivery == null ? maxDelivery : minDelivery;
+		maxDelivery = maxDelivery == null ? minDelivery : maxDelivery;
+		Pattern intMinP = Pattern.compile(RegexConstant.Integer);
+		Matcher intMinM = intMinP.matcher(minDelivery.toString());
+		Short min = null, max = null;
+		if(intMinM.find()) {
+			String g = intMinM.group();
+			min = Short.valueOf(g);
+		}
+		Pattern intMaxP = Pattern.compile(RegexConstant.Integer);
+		Matcher intMaxM = intMaxP.matcher(maxDelivery.toString());
+		if(intMaxM.find()) {
+			String g = intMaxM.group();
+			max = Short.valueOf(g);
+		}
+		if((min != null) || (max != null)) {
+			min  = min == null ? max : min;
+			max  = max == null ? min : max;
+			if(min.shortValue() > ShortConstant.maxDelivery || min.shortValue() < 0 || max.shortValue() > Short.MAX_VALUE || max.shortValue() < 0){
+				releaseProductByBatch.addErrmsg("13-14:交期的信息必须为正整数并且小于" + ShortConstant.maxDelivery);
+			}else {
+				if(min.shortValue() > max.shortValue()) {
+					Short delivery = max;
+					max  = min;
+					min = delivery;
+				}
+				releaseProductByBatch.setSelfMinDelivery(min);
+				releaseProductByBatch.setSelfMaxDelivery(max);
+			}
+		}else {
+			releaseProductByBatch.addErrmsg("13-14:交期的信息必须为正整数并且小于" + ShortConstant.maxDelivery);
+		}
+	}
+
  	/**
 	 * 创建时间 :2016年12月11日 下午2:02:16
 	 * 
@@ -619,85 +598,48 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 	 *             获取每一个分段的的数量
 	 * 
 	 */
-	private void readSectionPrice(Cell cellQty, Cell cellPriceRMB, Cell cellPriceUSD, List<GoodsQtyPrice> prices,
+	private void readSectionPrice(Cell cellQty, Cell cellPrice, List<GoodsQtyPrice> prices,
 			ReleaseProductByBatch releaseProductByBatch, int r, int num, Double[] priceMaxMinPrice) {
 		// 先跟据币别判断对应的价格是否有空值
-		Object startQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_STRING, r, num);
-		if ((startQtyCellValue != null)&&(isNumber(startQtyCellValue.toString()))) {
-			Double start = Double.valueOf(startQtyCellValue.toString());
+		Object endQtyCellValue = readWorkBookCell(cellQty, Cell.CELL_TYPE_STRING, r, num);
+		if ((endQtyCellValue != null)&&(isNumber(endQtyCellValue.toString()))) {
+			Double end = Double.valueOf(endQtyCellValue.toString());
 			GoodsQtyPrice qtyPrice = new GoodsQtyPrice();
 			// 分段数量start不得大于库存量
-			if (start > releaseProductByBatch.getReserve() || start <= 0) {
-				releaseProductByBatch.addErrmsg("11: 分段数量存在起始值大于库存量或者开始数量小于0");
-			}
-			qtyPrice.setStart(start);
-			
-			String currency = releaseProductByBatch.getCurrency();
-
-			// 人民币价格
-			if(currency != null && currency.contains("RMB")) {
-				Double pricermb = 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) {
-					pricermb = fractionNumCeil(pricermb, 6);
-					qtyPrice.setRMBPrice(pricermb);
-					BigDecimal taxNum = new BigDecimal(releaseProductByBatch.getRmbTaxRate() + 1);
-					qtyPrice.setRMBNTPrice(new BigDecimal(pricermb).divide(taxNum, 6, BigDecimal.ROUND_HALF_UP).doubleValue());
-					if(priceMaxMinPrice[0] > pricermb) {
-						priceMaxMinPrice[0] = pricermb;
-					}
-					if(priceMaxMinPrice[1] < pricermb) {
-						priceMaxMinPrice[1] = pricermb;
-					}
-				}
+			if (end > releaseProductByBatch.getReserve() || end <= 0) {
+				releaseProductByBatch.addErrmsg(num + ": 分段数量存在结束值大于库存量或者结束值小于0");
 			}
+			qtyPrice.setEnd(end);
 
-			if(currency != null && currency.contains("USD")) {
-				// 美金价格
-				Double priceusd = 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) {
-					priceusd = fractionNumCeil(priceusd, 6);
-					qtyPrice.setUSDPrice(priceusd);
-					qtyPrice.setUSDNTPrice(priceusd);
-					if(priceMaxMinPrice[2] > priceusd) {
-						priceMaxMinPrice[2] = priceusd;
+			Double price = null;
+			Object priceCellValue = readWorkBookCell(cellPrice, Cell.CELL_TYPE_STRING, r, num + 1);
+			if ((priceCellValue != null)&&(isNumber(priceCellValue.toString()))) {
+				price = Double.valueOf(priceCellValue.toString());
+			}
+			if (price != null && price > 0.0) {
+				price = fractionNumCeil(price, 6);
+				if(Currency.USD.equals(releaseProductByBatch.getCurrency())) {
+					qtyPrice.setUSDPrice(price);
+					qtyPrice.setUSDNTPrice(price);
+					if(priceMaxMinPrice[2] > price) {
+						priceMaxMinPrice[2] = price;
+					}
+					if(priceMaxMinPrice[3] < price) {
+						priceMaxMinPrice[3] = price;
+					}
+				}else {
+					qtyPrice.setRMBPrice(price);
+					BigDecimal taxNum = new BigDecimal(releaseProductByBatch.getRmbTaxRate() + 1);
+					qtyPrice.setRMBNTPrice(new BigDecimal(price).divide(taxNum, 6, BigDecimal.ROUND_HALF_UP).doubleValue());
+					if(priceMaxMinPrice[0] > price) {
+						priceMaxMinPrice[0] = price;
 					}
-					if(priceMaxMinPrice[3] < priceusd) {
-						priceMaxMinPrice[3] = priceusd;
+					if(priceMaxMinPrice[1] < price) {
+						priceMaxMinPrice[1] = price;
 					}
 				}
+				prices.add(qtyPrice);
 			}
-
-			// 验证信息的一致性
-			Double rmbPrice = qtyPrice.getRMBPrice();
-			Double usdPrice = qtyPrice.getUSDPrice();
-			
-			boolean isUnit = true;
-			if ("RMB".equalsIgnoreCase(currency)) {
-				if (rmbPrice == null) {
-					isUnit = false;
-				}
-			} else if ("RMB-USD".equalsIgnoreCase(currency)) {
-				if (rmbPrice == null || usdPrice == null) {
-					isUnit = false;
-				}
-			} else if ("USD".equalsIgnoreCase(currency)) {
-				if (usdPrice == null) {
-					isUnit = false;
-				}
-			}
-			if (!isUnit) {
-				releaseProductByBatch.addErrmsg("11: 前后的价格信息不一致,例如最小包单价填了人民币和美金,后面的分段只填了人民币");
-			}
-
-			prices.add(qtyPrice);
 		}
 	}
 

BIN
src/main/resources/jxls-tpl/trade/releaseByBatch-rmb.xls


BIN
src/main/resources/jxls-tpl/trade/releasebyBatch-usd.xls


BIN
src/main/webapp/resources/img/product/releaseByBatch-rmb.png


BIN
src/main/webapp/resources/img/product/releaseByBatch-usd.png


+ 21 - 4
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -7,7 +7,19 @@ define([ 'app/app' ], function(app) {
 	}]);
 
 	//批量上架的Ctrl
-	app.register.controller('batchPutOnCtrl', ['$scope', '$rootScope', 'ngTableParams', '$upload', '$q', 'AuthenticationService', 'BaseService', 'StoreInfo', 'SessionService', '$modal', 'toaster', 'ReleaseProductByBatch', 'Loading', function ($scope, $rootScope, ngTableParams, $upload, $q, AuthenticationService, BaseService, StoreInfo, SessionService, $modal, toaster, ReleaseProductByBatch, Loading) {
+	app.register.controller('batchPutOnCtrl', ['$scope', '$rootScope', 'ngTableParams', '$upload', '$q', 'AuthenticationService', 'BaseService', 'StoreInfo', 'SessionService', '$modal', 'toaster', 'ReleaseProductByBatch', 'Loading', 'Enterprise', function ($scope, $rootScope, ngTableParams, $upload, $q, AuthenticationService, BaseService, StoreInfo, SessionService, $modal, toaster, ReleaseProductByBatch, Loading, Enterprise) {
+
+		//获取币别信息
+		Enterprise.getCurrencyByRegisterAddress(null, function (data) {
+			if(data.code == 1) {
+				$scope.batch.currency = data.data;
+			}else {
+				toaster.pop('info', '提示', '您公司的注册地址为空,无法确定币别,系统默认为人民币');
+				$scope.batch.currency = 'RMB';
+			}
+		}, function (response) {
+			toaster.pop('info', '提示', '获取不到公司的币别信息');
+		});
 
 		//切换展示的信息
 		$scope.toggleActive = function(active) {
@@ -74,7 +86,12 @@ define([ 'app/app' ], function(app) {
 
 		// 查看范例
 		$scope.showImg = function() {
-			var src = $rootScope.rootPath + "/static/img/product/excel_releaseByBatch_eg.png", box = $('#image-box');
+			var src = '', box = $('#image-box');
+			if($scope.batch.currency === 'RMB') {
+				src = $rootScope.rootPath + "/static/img/product/releaseByBatch-rmb.png";
+			}else {
+				src = $rootScope.rootPath + "/static/img/product/releaseByBatch-usd.png";
+			}
 			box.show();
 			box.find('img').attr('src', src);
 			box.find('a').click(function(){
@@ -179,10 +196,10 @@ define([ 'app/app' ], function(app) {
 				});
 				modalInstance.result.then(function(response) {
 				}, function(res) {
-					window.location.href = $rootScope.rootPath + '/release/product/release/template';
+					window.location.href = $rootScope.rootPath + '/release/product/release/template?currency' + '=' + $scope.batch.currency;
 				});
 			}else {
-				window.location.href = $rootScope.rootPath + '/release/product/release/template';
+				window.location.href = $rootScope.rootPath + '/release/product/release/template?currency' + '=' + $scope.batch.currency;
 			}
 		};